@botonic/webchat-react 2.27.0 → 2.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,35 @@
1
- import { jsx as n, jsxs as w, Fragment as Ee } from "react/jsx-runtime";
2
- import { Button as Wt, DropdownMenuItem as Xe, DropdownMenuItemCheckbox as Vt, PopoverTrigger as $t, DropdownMenu as Ht } from "@lilara/ui-web-react";
3
- import ft, { createContext as Re, useContext as xe, useState as N, useRef as C, useCallback as v, useMemo as _e, useEffect as S, forwardRef as O, useLayoutEffect as Ft } from "react";
4
- import { cva as F, cx as E } from "class-variance-authority";
5
- import { WebchatController as Ut, setupGlobalWebchatAPI as zt, publicWebchatController as nt, isCloseWebviewMessage as jt, isWebviewPostMessage as qt, WEBVIEW_MESSAGE_TYPES as le } from "@botonic/webchat-core";
6
- import { useDialog as Gt, FocusScope as Kt, useButton as pt, useFocusRing as Ze, mergeProps as gt, useObjectRef as Xt } from "react-aria";
1
+ import { jsx as n, jsxs as w, Fragment as Ie } from "react/jsx-runtime";
2
+ import { Button as Ht, DropdownMenuItem as Ze, DropdownMenuItemCheckbox as Ft, PopoverTrigger as Ut, DropdownMenu as zt } from "@lilara/ui-web-react";
3
+ import bt, { createContext as Re, useContext as xe, useState as N, useRef as y, useCallback as v, useMemo as _e, useEffect as T, forwardRef as O, useLayoutEffect as jt } from "react";
4
+ import { cva as F, cx as I } from "class-variance-authority";
5
+ import { WebchatController as qt, setupGlobalWebchatAPI as Gt, publicWebchatController as ot, isCloseWebviewMessage as Kt, isWebviewPostMessage as Xt, WEBVIEW_MESSAGE_TYPES as le, WebchatMessageFactory as Qe } from "@botonic/webchat-core";
6
+ import { useDialog as Zt, FocusScope as Qt, useButton as vt, useFocusRing as Ye, mergeProps as wt, useObjectRef as Yt } from "react-aria";
7
7
  import { useSelector as L } from "@xstate/react";
8
- import { DEFAULT_WEBCHAT_CLIENT_SETTINGS as Zt, BotonicButtonType as Qt, WebchatMessageFactory as Qe, MessageSentBy as me } from "@botonic/shared";
9
- const vt = Re(null);
10
- function U() {
11
- const e = xe(vt);
8
+ import { DEFAULT_WEBCHAT_CLIENT_SETTINGS as Jt, BotonicButtonType as en, MessageSentBy as me, MessageType as tn } from "@botonic/shared";
9
+ const Ct = Re(null);
10
+ function z() {
11
+ const e = xe(Ct);
12
12
  if (!e)
13
13
  throw new Error("useWebchatContext must be used within a WebchatProvider");
14
14
  return e;
15
15
  }
16
- const bt = Re(
16
+ const yt = Re(
17
17
  null
18
18
  );
19
- function Yt({
19
+ function nn({
20
20
  children: e
21
21
  }) {
22
- const [t, a] = N(), o = C(t);
22
+ const [t, a] = N(), o = y(t);
23
23
  o.current = t;
24
- const s = v((c) => {
25
- a(c);
26
- }, []), i = v((c) => {
27
- o.current === c && a(void 0);
24
+ const s = v((l) => {
25
+ a(l);
26
+ }, []), i = v((l) => {
27
+ o.current === l && a(void 0);
28
28
  }, []), r = v(() => {
29
29
  o.current !== void 0 && a(void 0);
30
30
  }, []);
31
31
  return /* @__PURE__ */ n(
32
- bt.Provider,
32
+ yt.Provider,
33
33
  {
34
34
  value: { activeId: t, setActive: s, clearActive: i, pauseAll: r },
35
35
  children: e
@@ -37,25 +37,25 @@ function Yt({
37
37
  );
38
38
  }
39
39
  function Le() {
40
- const e = xe(bt);
40
+ const e = xe(yt);
41
41
  if (!e)
42
42
  throw new Error(
43
43
  "useMediaPlayback must be used within a MediaPlaybackProvider"
44
44
  );
45
45
  return e;
46
46
  }
47
- function Jt(e, t, a = !1) {
47
+ function on(e, t, a = !1) {
48
48
  const o = e.custom?.[t];
49
49
  return typeof o == "boolean" ? o : a;
50
50
  }
51
- function en(e) {
51
+ function an(e) {
52
52
  return {
53
53
  input: {
54
54
  isComposerVisible: e.user_input_enabled,
55
55
  isTextInputEnabled: e.user_input_enabled,
56
56
  areAttachmentsVisible: e.attachments_enabled,
57
57
  isEmojiPickerVisible: e.emoji_picker_enabled,
58
- isAudioRecordingVisible: Jt(
58
+ isAudioRecordingVisible: on(
59
59
  e,
60
60
  "audio_recording_enabled"
61
61
  ),
@@ -63,10 +63,10 @@ function en(e) {
63
63
  }
64
64
  };
65
65
  }
66
- function tn(e) {
66
+ function sn(e) {
67
67
  const [t, a] = N(""), o = _e(() => {
68
68
  console.log("🏗️ Creating WebchatController with config:", e);
69
- const h = new Ut(e);
69
+ const h = new qt(e);
70
70
  return h.initialize().catch((p) => {
71
71
  console.error("❌ Failed to initialize webchat:", p);
72
72
  }), h;
@@ -82,7 +82,7 @@ function tn(e) {
82
82
  ), r = L(
83
83
  o.machine,
84
84
  (h) => h.matches("operational")
85
- ), c = L(
85
+ ), l = L(
86
86
  o.machine,
87
87
  (h) => h.matches("connectionFailed")
88
88
  ), f = L(
@@ -90,21 +90,21 @@ function tn(e) {
90
90
  (h) => h.context.connectionStatus || "disconnected"
91
91
  ), _ = L(
92
92
  o.machine,
93
- (h) => h.context.effectiveWebchatClientSettings ?? Zt
93
+ (h) => h.context.effectiveWebchatClientSettings ?? Jt
94
94
  ), m = _e(
95
- () => en(_),
95
+ () => an(_),
96
96
  [_]
97
- ), l = L(
97
+ ), d = L(
98
98
  o.machine,
99
99
  (h) => h.context.soundsEnabled ?? !0
100
- ), d = L(
100
+ ), c = L(
101
101
  o.machine,
102
102
  (h) => h.context.overlayActor
103
103
  ), u = L(
104
- d,
104
+ c,
105
105
  (h) => h.context.overlayState
106
106
  );
107
- return S(() => (zt(o), () => {
107
+ return T(() => (Gt(o), () => {
108
108
  console.log("🧹 Cleaning up webchat controller"), o.destroy();
109
109
  }), [o]), {
110
110
  // Framework-agnostic controller - all webchat functionality
@@ -115,7 +115,7 @@ function tn(e) {
115
115
  // XState machine state (direct from machine via useSelector)
116
116
  isOpen: i,
117
117
  isInitialized: r,
118
- initializationError: c,
118
+ initializationError: l,
119
119
  messageActors: s,
120
120
  connectionStatus: f,
121
121
  webchatClientSettings: _,
@@ -123,7 +123,7 @@ function tn(e) {
123
123
  // Overlay state (webview or cover component)
124
124
  overlayState: u,
125
125
  // Sound notification state
126
- soundsEnabled: l,
126
+ soundsEnabled: d,
127
127
  // Configuration
128
128
  avatarConfig: e.avatarConfig,
129
129
  enableResponsiveHeroHeader: e.enableResponsiveHeroHeader ?? !0,
@@ -131,23 +131,23 @@ function tn(e) {
131
131
  customMessages: e.customMessages
132
132
  };
133
133
  }
134
- const nn = O(({ children: e, ...t }, a) => {
135
- const o = tn(t);
136
- ft.useImperativeHandle(a, () => o.controller, [o.controller]);
134
+ const rn = O(({ children: e, ...t }, a) => {
135
+ const o = sn(t);
136
+ bt.useImperativeHandle(a, () => o.controller, [o.controller]);
137
137
  const s = {
138
138
  state: o,
139
139
  controller: o.controller
140
140
  // Direct access to controller
141
141
  };
142
- return /* @__PURE__ */ n(vt.Provider, { value: s, children: /* @__PURE__ */ n(Yt, { children: e }) });
143
- }), on = {
142
+ return /* @__PURE__ */ n(Ct.Provider, { value: s, children: /* @__PURE__ */ n(nn, { children: e }) });
143
+ }), cn = {
144
144
  collapsedByDefaultWhenConversationHasMessages: !0,
145
145
  collapseOnUserEngagement: !0,
146
146
  expandHeroWhenReturningToScrollTop: !0
147
147
  };
148
- function an(e) {
148
+ function ln(e) {
149
149
  return {
150
- ...on,
150
+ ...cn,
151
151
  ...e
152
152
  };
153
153
  }
@@ -156,7 +156,7 @@ function qe(e) {
156
156
  }
157
157
  function Me() {
158
158
  }
159
- const sn = {
159
+ const dn = {
160
160
  header: {
161
161
  variant: "collapsed",
162
162
  collapseProgress: 1,
@@ -170,40 +170,40 @@ const sn = {
170
170
  },
171
171
  onUserEngagement: Me
172
172
  };
173
- function rn({
173
+ function un({
174
174
  controller: e,
175
175
  isOpen: t,
176
176
  layout: a,
177
177
  enableResponsiveHeroHeader: o = !0
178
178
  }) {
179
- const s = an(a), i = qe(
179
+ const s = ln(a), i = qe(
180
180
  e.machine.getSnapshot()
181
- ), r = s.collapsedByDefaultWhenConversationHasMessages && i > 0, c = C(null), f = C(
181
+ ), r = s.collapsedByDefaultWhenConversationHasMessages && i > 0, l = y(null), f = y(
182
182
  o ? r : !1
183
- ), _ = C(!1), [m, l] = N(
183
+ ), _ = y(!1), [m, d] = N(
184
184
  () => o ? r : !1
185
- ), [d, u] = N(
185
+ ), [c, u] = N(
186
186
  () => o ? r : !0
187
187
  ), [h, p] = N(!1), g = L(
188
188
  e.machine,
189
189
  (P) => qe(P),
190
190
  (P, A) => P === A
191
191
  );
192
- S(() => {
192
+ T(() => {
193
193
  if (!o) return;
194
194
  if (g === 0) {
195
- u(!1), l(!1), f.current = !1, _.current = !1, c.current = 0;
195
+ u(!1), d(!1), f.current = !1, _.current = !1, l.current = 0;
196
196
  return;
197
197
  }
198
- const P = c.current;
199
- c.current = g, s.collapsedByDefaultWhenConversationHasMessages && (P === null || P === 0) && (u(!0), l(!0), f.current = !0);
198
+ const P = l.current;
199
+ l.current = g, s.collapsedByDefaultWhenConversationHasMessages && (P === null || P === 0) && (u(!0), d(!0), f.current = !0);
200
200
  }, [
201
201
  o,
202
202
  g,
203
203
  s.collapsedByDefaultWhenConversationHasMessages
204
- ]), S(() => {
204
+ ]), T(() => {
205
205
  if (!o || !t || !s.collapsedByDefaultWhenConversationHasMessages) return;
206
- qe(e.machine.getSnapshot()) > 0 && (u(!0), l(!0), f.current = !0);
206
+ qe(e.machine.getSnapshot()) > 0 && (u(!0), d(!0), f.current = !0);
207
207
  }, [
208
208
  o,
209
209
  t,
@@ -211,8 +211,8 @@ function rn({
211
211
  s.collapsedByDefaultWhenConversationHasMessages
212
212
  ]);
213
213
  const b = v(() => {
214
- o && (f.current = !0, l(!0), s.collapseOnUserEngagement && u(!0));
215
- }, [o, s.collapseOnUserEngagement]), M = v(
214
+ o && (f.current = !0, d(!0), s.collapseOnUserEngagement && u(!0));
215
+ }, [o, s.collapseOnUserEngagement]), C = v(
216
216
  (P) => {
217
217
  if (o && f.current) {
218
218
  if (!P) {
@@ -223,41 +223,41 @@ function rn({
223
223
  }
224
224
  },
225
225
  [o, s.expandHeroWhenReturningToScrollTop]
226
- ), T = v(
226
+ ), S = v(
227
227
  (P) => {
228
228
  o && p(P);
229
229
  },
230
230
  [o]
231
- ), y = d ? "collapsed" : "expanded";
231
+ ), M = c ? "collapsed" : "expanded";
232
232
  return o ? {
233
233
  header: {
234
- variant: y,
235
- collapseProgress: d ? 1 : 0,
234
+ variant: M,
235
+ collapseProgress: c ? 1 : 0,
236
236
  hasShadow: h
237
237
  },
238
238
  messages: {
239
239
  hasUserInteracted: m,
240
- onScrollDepthChange: T,
241
- onMessagesScrollAtTopChange: M,
240
+ onScrollDepthChange: S,
241
+ onMessagesScrollAtTopChange: C,
242
242
  onUserInteraction: b
243
243
  },
244
244
  onUserEngagement: b
245
- } : sn;
245
+ } : dn;
246
246
  }
247
- const cn = "backdrop-module__base___2047X", ln = {
248
- base: cn
247
+ const mn = "backdrop-module__base___2047X", _n = {
248
+ base: mn
249
249
  };
250
- function dn({ isClosing: e = !1 }) {
250
+ function hn({ isClosing: e = !1 }) {
251
251
  return /* @__PURE__ */ n(
252
252
  "div",
253
253
  {
254
- className: ln.base,
254
+ className: _n.base,
255
255
  "aria-hidden": !0,
256
256
  "data-closing": e || void 0
257
257
  }
258
258
  );
259
259
  }
260
- function un() {
260
+ function fn() {
261
261
  return /* @__PURE__ */ n(
262
262
  "svg",
263
263
  {
@@ -270,7 +270,7 @@ function un() {
270
270
  }
271
271
  );
272
272
  }
273
- function mn() {
273
+ function pn() {
274
274
  return /* @__PURE__ */ n(
275
275
  "svg",
276
276
  {
@@ -283,31 +283,31 @@ function mn() {
283
283
  }
284
284
  );
285
285
  }
286
- const _n = "dialog-module__base___K18e8", hn = "dialog-module__success___z5NAQ", fn = "dialog-module__error___Q46VR", pn = "dialog-module__loading___21312", gn = "dialog-module__actions___xFizf", vn = "dialog-module__closing___qgRFX", bn = "dialog-module__iconContainer___8lOJ3", wn = "dialog-module__spinner___jL0bN", Cn = "dialog-module__textContent___t6Tqt", yn = "dialog-module__title___jr3if", Mn = "dialog-module__subtitle___K1uUB", z = {
287
- base: _n,
288
- success: hn,
289
- error: fn,
290
- loading: pn,
291
- actions: gn,
292
- closing: vn,
293
- iconContainer: bn,
294
- spinner: wn,
295
- textContent: Cn,
296
- title: yn,
297
- subtitle: Mn
298
- }, Pn = F(z.base, {
286
+ const gn = "dialog-module__base___K18e8", bn = "dialog-module__success___z5NAQ", vn = "dialog-module__error___Q46VR", wn = "dialog-module__loading___21312", Cn = "dialog-module__actions___xFizf", yn = "dialog-module__closing___qgRFX", Mn = "dialog-module__iconContainer___8lOJ3", Pn = "dialog-module__spinner___jL0bN", Nn = "dialog-module__textContent___t6Tqt", Sn = "dialog-module__title___jr3if", Tn = "dialog-module__subtitle___K1uUB", j = {
287
+ base: gn,
288
+ success: bn,
289
+ error: vn,
290
+ loading: wn,
291
+ actions: Cn,
292
+ closing: yn,
293
+ iconContainer: Mn,
294
+ spinner: Pn,
295
+ textContent: Nn,
296
+ title: Sn,
297
+ subtitle: Tn
298
+ }, An = F(j.base, {
299
299
  variants: {
300
300
  variant: {
301
301
  default: "",
302
- loading: z.loading,
303
- success: z.success,
304
- error: z.error
302
+ loading: j.loading,
303
+ success: j.success,
304
+ error: j.error
305
305
  },
306
- isClosing: { true: z.closing }
306
+ isClosing: { true: j.closing }
307
307
  },
308
308
  defaultVariants: { variant: "default" }
309
309
  });
310
- function Nn({
310
+ function En({
311
311
  variant: e,
312
312
  title: t,
313
313
  subtitle: a,
@@ -319,77 +319,77 @@ function Nn({
319
319
  process.env.NODE_ENV !== "production" && o && o.length > 3 && console.warn(
320
320
  `[Dialog] actions array has ${o.length} items; only the first 3 are rendered.`
321
321
  );
322
- const c = r?.slice().sort((l, d) => {
322
+ const l = r?.slice().sort((d, c) => {
323
323
  const u = (h) => (h ?? "solid") === "solid";
324
- return Number(u(l.appearance)) - Number(u(d.appearance));
325
- }), f = C(null), { dialogProps: _, titleProps: m } = Gt({ role: "dialog" }, f);
326
- return S(() => {
324
+ return Number(u(d.appearance)) - Number(u(c.appearance));
325
+ }), f = y(null), { dialogProps: _, titleProps: m } = Zt({ role: "dialog" }, f);
326
+ return T(() => {
327
327
  f.current && f.current.focus();
328
- }, [e]), /* @__PURE__ */ n(Kt, { contain: !0, restoreFocus: !0, autoFocus: !0, children: /* @__PURE__ */ w(
328
+ }, [e]), /* @__PURE__ */ n(Qt, { contain: !0, restoreFocus: !0, autoFocus: !0, children: /* @__PURE__ */ w(
329
329
  "div",
330
330
  {
331
331
  ..._,
332
332
  "aria-modal": !0,
333
333
  ref: f,
334
- className: Pn({ variant: e, isClosing: s }),
334
+ className: An({ variant: e, isClosing: s }),
335
335
  onAnimationEnd: s ? i : void 0,
336
336
  children: [
337
337
  (e === "loading" || e === "success" || e === "error") && /* @__PURE__ */ w(
338
338
  "div",
339
339
  {
340
- className: z.iconContainer,
340
+ className: j.iconContainer,
341
341
  "data-variant": e,
342
342
  "aria-hidden": !0,
343
343
  children: [
344
- e === "loading" && /* @__PURE__ */ n("div", { className: z.spinner }, "loading"),
345
- e === "success" && /* @__PURE__ */ n(un, {}, "success"),
346
- e === "error" && /* @__PURE__ */ n(mn, {}, "error")
344
+ e === "loading" && /* @__PURE__ */ n("div", { className: j.spinner }, "loading"),
345
+ e === "success" && /* @__PURE__ */ n(fn, {}, "success"),
346
+ e === "error" && /* @__PURE__ */ n(pn, {}, "error")
347
347
  ]
348
348
  }
349
349
  ),
350
- /* @__PURE__ */ w("div", { className: z.textContent, children: [
351
- /* @__PURE__ */ n("h2", { ...m, className: z.title, children: t }),
352
- a && /* @__PURE__ */ n("p", { className: z.subtitle, children: a })
350
+ /* @__PURE__ */ w("div", { className: j.textContent, children: [
351
+ /* @__PURE__ */ n("h2", { ...m, className: j.title, children: t }),
352
+ a && /* @__PURE__ */ n("p", { className: j.subtitle, children: a })
353
353
  ] }),
354
- c && c.length > 0 && /* @__PURE__ */ n("div", { className: z.actions, "data-variant": e, children: c.map(({ label: l, ...d }, u) => /* @__PURE__ */ n(Wt, { ...d, children: l }, u)) })
354
+ l && l.length > 0 && /* @__PURE__ */ n("div", { className: j.actions, "data-variant": e, children: l.map(({ label: d, ...c }, u) => /* @__PURE__ */ n(Ht, { ...c, children: d }, u)) })
355
355
  ]
356
356
  }
357
357
  ) });
358
358
  }
359
- const wt = Re(null);
360
- function Sn() {
361
- const e = xe(wt);
359
+ const Mt = Re(null);
360
+ function In() {
361
+ const e = xe(Mt);
362
362
  if (!e)
363
363
  throw new Error("useDialog must be used within a DialogProvider");
364
364
  return e;
365
365
  }
366
- const Tn = {
366
+ const Rn = {
367
367
  isOpen: !1,
368
368
  variant: "default",
369
369
  title: "",
370
370
  subtitle: void 0,
371
371
  actions: void 0
372
372
  };
373
- function An({
373
+ function xn({
374
374
  children: e,
375
375
  onOpen: t,
376
376
  controlsRef: a
377
377
  }) {
378
- const [o, s] = N(Tn), [i, r] = N(!1), c = C(t);
379
- c.current = t;
378
+ const [o, s] = N(Rn), [i, r] = N(!1), l = y(t);
379
+ l.current = t;
380
380
  const f = v(() => {
381
381
  s((p) => ({ ...p, isOpen: !1 })), r(!1);
382
- }, []), _ = C(f);
382
+ }, []), _ = y(f);
383
383
  _.current = f;
384
384
  const m = v((p) => {
385
- r(!1), c.current?.(), s({
385
+ r(!1), l.current?.(), s({
386
386
  isOpen: !0,
387
387
  variant: p.variant ?? "default",
388
388
  title: p.title,
389
389
  subtitle: p.subtitle,
390
390
  actions: p.actions
391
391
  });
392
- }, []), l = v((p) => {
392
+ }, []), d = v((p) => {
393
393
  s((g) => ({
394
394
  ...g,
395
395
  ...p.variant !== void 0 && { variant: p.variant },
@@ -397,14 +397,14 @@ function An({
397
397
  subtitle: "subtitle" in p ? p.subtitle : g.subtitle,
398
398
  actions: "actions" in p ? p.actions : g.actions
399
399
  }));
400
- }, []), d = v(() => {
400
+ }, []), c = v(() => {
401
401
  if (typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
402
402
  _.current();
403
403
  return;
404
404
  }
405
405
  r(!0);
406
406
  }, []);
407
- a && (a.current = { open: m, update: l, close: d }), S(() => {
407
+ a && (a.current = { open: m, update: d, close: c }), T(() => {
408
408
  if (process.env.NODE_ENV !== "production") {
409
409
  const p = document.querySelector(
410
410
  "[data-webchat-container], [data-webview-frame]"
@@ -414,12 +414,12 @@ function An({
414
414
  ));
415
415
  }
416
416
  }, []);
417
- const u = o.isOpen || i, h = { open: m, update: l, close: d, dialogState: o };
418
- return /* @__PURE__ */ w(wt.Provider, { value: h, children: [
417
+ const u = o.isOpen || i, h = { open: m, update: d, close: c, dialogState: o };
418
+ return /* @__PURE__ */ w(Mt.Provider, { value: h, children: [
419
419
  e,
420
- u && /* @__PURE__ */ n(dn, { isClosing: i }),
420
+ u && /* @__PURE__ */ n(hn, { isClosing: i }),
421
421
  u && /* @__PURE__ */ n(
422
- Nn,
422
+ En,
423
423
  {
424
424
  variant: o.variant,
425
425
  title: o.title,
@@ -431,29 +431,29 @@ function An({
431
431
  )
432
432
  ] });
433
433
  }
434
- function In({
434
+ function Ln({
435
435
  children: e
436
436
  }) {
437
- const { pauseAll: t } = Le(), a = C(t);
437
+ const { pauseAll: t } = Le(), a = y(t);
438
438
  a.current = t;
439
- const o = C(null), s = () => {
439
+ const o = y(null), s = () => {
440
440
  a.current();
441
441
  };
442
- return S(() => (nt.setDialogController({
442
+ return T(() => (ot.setDialogController({
443
443
  open: (i) => o.current?.open(i),
444
444
  update: (i) => o.current?.update(i),
445
445
  close: () => o.current?.close()
446
446
  }), () => {
447
- nt.setDialogController(void 0);
448
- }), []), /* @__PURE__ */ n(An, { onOpen: s, controlsRef: o, children: e });
449
- }
450
- const En = "button-component-module__buttonComponent___KMwSR", Rn = "button-component-module__secondary___TTpBp", xn = "button-component-module__primary___bD2jQ", Ln = "button-component-module__iconWrapper___70XMO", ge = {
451
- buttonComponent: En,
452
- secondary: Rn,
453
- primary: xn,
454
- iconWrapper: Ln
447
+ ot.setDialogController(void 0);
448
+ }), []), /* @__PURE__ */ n(xn, { onOpen: s, controlsRef: o, children: e });
449
+ }
450
+ const Bn = "button-component-module__buttonComponent___KMwSR", kn = "button-component-module__secondary___TTpBp", Dn = "button-component-module__primary___bD2jQ", On = "button-component-module__iconWrapper___70XMO", ge = {
451
+ buttonComponent: Bn,
452
+ secondary: kn,
453
+ primary: Dn,
454
+ iconWrapper: On
455
455
  };
456
- function Bn() {
456
+ function Wn() {
457
457
  return /* @__PURE__ */ w(
458
458
  "svg",
459
459
  {
@@ -499,8 +499,8 @@ function Bn() {
499
499
  }
500
500
  );
501
501
  }
502
- function kn(e) {
503
- return "type" in e ? e.type === Qt.WebUrl || !!e.webview : !1;
502
+ function Vn(e) {
503
+ return "type" in e ? e.type === en.WebUrl || !!e.webview : !1;
504
504
  }
505
505
  const Ae = O(
506
506
  ({
@@ -511,7 +511,7 @@ const Ae = O(
511
511
  className: s,
512
512
  variant: i = "secondary"
513
513
  }, r) => {
514
- const c = kn(o);
514
+ const l = Vn(o);
515
515
  return /* @__PURE__ */ w(
516
516
  "button",
517
517
  {
@@ -520,46 +520,46 @@ const Ae = O(
520
520
  onClick: (_) => {
521
521
  _.preventDefault(), _.stopPropagation(), a?.(o);
522
522
  },
523
- className: E(
523
+ className: I(
524
524
  ge.buttonComponent,
525
525
  i === "primary" && ge.primary,
526
526
  i === "secondary" && ge.secondary,
527
- c && ge.withIcon,
527
+ l && ge.withIcon,
528
528
  s
529
529
  ),
530
530
  type: "button",
531
531
  children: [
532
- c && /* @__PURE__ */ n("span", { className: ge.iconWrapper, children: /* @__PURE__ */ n(Bn, {}) }),
532
+ l && /* @__PURE__ */ n("span", { className: ge.iconWrapper, children: /* @__PURE__ */ n(Wn, {}) }),
533
533
  e
534
534
  ]
535
535
  }
536
536
  );
537
537
  }
538
- ), Dn = "confirm-modal-module__overlay___rRE3G", On = "confirm-modal-module__modal___AliW3", Wn = "confirm-modal-module__title___nOVLU", Vn = "confirm-modal-module__message___NiTmg", $n = "confirm-modal-module__buttons___T9sSa", ve = {
539
- overlay: Dn,
540
- modal: On,
541
- title: Wn,
542
- message: Vn,
543
- buttons: $n
538
+ ), $n = "confirm-modal-module__overlay___rRE3G", Hn = "confirm-modal-module__modal___AliW3", Fn = "confirm-modal-module__title___nOVLU", Un = "confirm-modal-module__message___NiTmg", zn = "confirm-modal-module__buttons___T9sSa", be = {
539
+ overlay: $n,
540
+ modal: Hn,
541
+ title: Fn,
542
+ message: Un,
543
+ buttons: zn
544
544
  };
545
- function Hn(e) {
545
+ function jn(e) {
546
546
  return e === !1 || e === void 0 ? null : e === !0 ? {
547
547
  message: "Are you sure you want to close?"
548
548
  } : typeof e == "string" ? {
549
549
  message: e
550
550
  } : e;
551
551
  }
552
- const Fn = ({
552
+ const qn = ({
553
553
  config: e,
554
554
  onConfirm: t,
555
555
  onCancel: a
556
556
  }) => {
557
- const o = C(null), s = C(null), i = Hn(e);
558
- S(() => {
557
+ const o = y(null), s = y(null), i = jn(e);
558
+ T(() => {
559
559
  o.current?.focus();
560
- }, []), S(() => {
561
- const m = (l) => {
562
- l.key === "Escape" && (l.stopPropagation(), a());
560
+ }, []), T(() => {
561
+ const m = (d) => {
562
+ d.key === "Escape" && (d.stopPropagation(), a());
563
563
  };
564
564
  return window.addEventListener("keydown", m, !0), () => {
565
565
  window.removeEventListener("keydown", m, !0);
@@ -567,21 +567,21 @@ const Fn = ({
567
567
  }, [a]);
568
568
  const r = v((m) => {
569
569
  if (m.key === "Tab") {
570
- const l = s.current?.querySelectorAll(
570
+ const d = s.current?.querySelectorAll(
571
571
  "button:not([disabled])"
572
572
  );
573
- if (!l?.length) return;
574
- const d = l[0], u = l[l.length - 1];
575
- m.shiftKey ? document.activeElement === d && (m.preventDefault(), u.focus()) : document.activeElement === u && (m.preventDefault(), d.focus());
573
+ if (!d?.length) return;
574
+ const c = d[0], u = d[d.length - 1];
575
+ m.shiftKey ? document.activeElement === c && (m.preventDefault(), u.focus()) : document.activeElement === u && (m.preventDefault(), c.focus());
576
576
  }
577
577
  }, []);
578
578
  if (!i)
579
579
  return null;
580
- const c = i.title || "Close?", f = i.confirmText || "Close", _ = i.cancelText || "Cancel";
580
+ const l = i.title || "Close?", f = i.confirmText || "Close", _ = i.cancelText || "Cancel";
581
581
  return /* @__PURE__ */ n(
582
582
  "div",
583
583
  {
584
- className: ve.overlay,
584
+ className: be.overlay,
585
585
  role: "alertdialog",
586
586
  "aria-modal": "true",
587
587
  "aria-labelledby": "confirm-close-title",
@@ -591,13 +591,13 @@ const Fn = ({
591
591
  "div",
592
592
  {
593
593
  ref: s,
594
- className: ve.modal,
594
+ className: be.modal,
595
595
  onClick: (m) => m.stopPropagation(),
596
596
  onKeyDown: r,
597
597
  children: [
598
- /* @__PURE__ */ n("h3", { id: "confirm-close-title", className: ve.title, children: c }),
599
- /* @__PURE__ */ n("p", { id: "confirm-close-message", className: ve.message, children: i.message }),
600
- /* @__PURE__ */ w("div", { className: ve.buttons, children: [
598
+ /* @__PURE__ */ n("h3", { id: "confirm-close-title", className: be.title, children: l }),
599
+ /* @__PURE__ */ n("p", { id: "confirm-close-message", className: be.message, children: i.message }),
600
+ /* @__PURE__ */ w("div", { className: be.buttons, children: [
601
601
  /* @__PURE__ */ n(
602
602
  Ae,
603
603
  {
@@ -623,47 +623,47 @@ const Fn = ({
623
623
  )
624
624
  }
625
625
  );
626
- }, Ct = Re(null);
626
+ }, Pt = Re(null);
627
627
  function Be() {
628
- const e = xe(Ct);
628
+ const e = xe(Pt);
629
629
  if (!e)
630
630
  throw new Error("useOverlayContext must be used within an Overlay");
631
631
  return e;
632
632
  }
633
- const Un = "cover-frame-module__base___e38vU", zn = "cover-frame-module__errorContainer___o19mQ", jn = "cover-frame-module__errorText___ltF9m", Ke = {
634
- base: Un,
635
- errorContainer: zn,
636
- errorText: jn
637
- }, ot = F(Ke.base);
638
- function qn({ className: e }) {
633
+ const Gn = "cover-frame-module__base___e38vU", Kn = "cover-frame-module__errorContainer___o19mQ", Xn = "cover-frame-module__errorText___ltF9m", Ke = {
634
+ base: Gn,
635
+ errorContainer: Kn,
636
+ errorText: Xn
637
+ }, at = F(Ke.base);
638
+ function Zn({ className: e }) {
639
639
  const { overlayState: t, coverRegistry: a, setIsLoading: o } = Be();
640
- if (S(() => {
640
+ if (T(() => {
641
641
  t?.type === "cover" && o(!1);
642
642
  }, [t?.type, o]), !t || t.type !== "cover")
643
643
  return null;
644
644
  const s = t, i = a?.[s.componentId];
645
- return i ? /* @__PURE__ */ n("div", { className: ot({ className: e }), "data-overlay-cover-frame": !0, children: /* @__PURE__ */ n(i, { ...s.props || {} }) }) : (console.warn(
645
+ return i ? /* @__PURE__ */ n("div", { className: at({ className: e }), "data-overlay-cover-frame": !0, children: /* @__PURE__ */ n(i, { ...s.props || {} }) }) : (console.warn(
646
646
  `[OverlayCoverFrame] Component "${s.componentId}" not found in registry. Available components: ${Object.keys(a || {}).join(", ") || "none"}`
647
- ), /* @__PURE__ */ n("div", { className: ot({ className: e }), "data-overlay-cover-frame": !0, children: /* @__PURE__ */ n("div", { className: Ke.errorContainer, children: /* @__PURE__ */ w("p", { className: Ke.errorText, children: [
647
+ ), /* @__PURE__ */ n("div", { className: at({ className: e }), "data-overlay-cover-frame": !0, children: /* @__PURE__ */ n("div", { className: Ke.errorContainer, children: /* @__PURE__ */ w("p", { className: Ke.errorText, children: [
648
648
  'Component "',
649
649
  s.componentId,
650
650
  '" not found'
651
651
  ] }) }) }));
652
652
  }
653
- const Gn = "webview-frame-module__base___u5SZG", Kn = "webview-frame-module__loadingContainer___eqQ-L", Xn = "webview-frame-module__spinner___5gsaP", Zn = "webview-frame-module__iframe___XewWc", Te = {
654
- base: Gn,
655
- loadingContainer: Kn,
656
- spinner: Xn,
657
- iframe: Zn
658
- }, Qn = F(Te.base);
659
- function Yn({ className: e }) {
653
+ const Qn = "webview-frame-module__base___u5SZG", Yn = "webview-frame-module__loadingContainer___eqQ-L", Jn = "webview-frame-module__spinner___5gsaP", eo = "webview-frame-module__iframe___XewWc", Te = {
654
+ base: Qn,
655
+ loadingContainer: Yn,
656
+ spinner: Jn,
657
+ iframe: eo
658
+ }, to = F(Te.base);
659
+ function no({ className: e }) {
660
660
  const { overlayState: t, sandboxPermissions: a, isLoading: o, setIsLoading: s } = Be(), i = v(() => {
661
661
  s(!1);
662
662
  }, [s]);
663
663
  if (!t || t.type !== "webview")
664
664
  return null;
665
665
  const r = t;
666
- return /* @__PURE__ */ w("div", { className: Qn({ className: e }), "data-overlay-webview-frame": !0, children: [
666
+ return /* @__PURE__ */ w("div", { className: to({ className: e }), "data-overlay-webview-frame": !0, children: [
667
667
  o && /* @__PURE__ */ n("div", { className: Te.loadingContainer, children: /* @__PURE__ */ n("div", { className: Te.spinner, "aria-label": "Loading webview" }) }),
668
668
  /* @__PURE__ */ n(
669
669
  "iframe",
@@ -678,29 +678,29 @@ function Yn({ className: e }) {
678
678
  )
679
679
  ] });
680
680
  }
681
- function Jn({ className: e }) {
681
+ function oo({ className: e }) {
682
682
  const { overlayState: t } = Be();
683
683
  if (!t)
684
684
  return null;
685
685
  switch (t.type) {
686
686
  case "webview":
687
- return /* @__PURE__ */ n(Yn, { className: e });
687
+ return /* @__PURE__ */ n(no, { className: e });
688
688
  case "cover":
689
- return /* @__PURE__ */ n(qn, { className: e });
689
+ return /* @__PURE__ */ n(Zn, { className: e });
690
690
  default:
691
691
  return null;
692
692
  }
693
693
  }
694
- const eo = "header-module__base___WYM0o", to = "header-module__minimal___6nq5w", no = "header-module__titleContainer___56hi4", oo = "header-module__icon___BCSbe", ao = "header-module__title___0c-LL", so = "header-module__closeButton___wOwC8", se = {
695
- base: eo,
694
+ const ao = "header-module__base___WYM0o", so = "header-module__minimal___6nq5w", ro = "header-module__titleContainer___56hi4", io = "header-module__icon___BCSbe", co = "header-module__title___0c-LL", lo = "header-module__closeButton___wOwC8", se = {
695
+ base: ao,
696
696
  default: "header-module__default___z7D3c",
697
- minimal: to,
698
- titleContainer: no,
699
- icon: oo,
700
- title: ao,
701
- closeButton: so
697
+ minimal: so,
698
+ titleContainer: ro,
699
+ icon: io,
700
+ title: co,
701
+ closeButton: lo
702
702
  };
703
- function ro(e, t) {
703
+ function uo(e, t) {
704
704
  const a = t?.title || "Overlay", o = t?.icon, s = t?.allowClose !== !1;
705
705
  return {
706
706
  title: a,
@@ -711,7 +711,7 @@ function ro(e, t) {
711
711
  }
712
712
  };
713
713
  }
714
- const io = F(se.base, {
714
+ const mo = F(se.base, {
715
715
  variants: {
716
716
  variant: {
717
717
  default: se.default,
@@ -722,12 +722,12 @@ const io = F(se.base, {
722
722
  variant: "default"
723
723
  }
724
724
  });
725
- function co(e) {
726
- const { overlayState: t, attemptClose: a } = Be(), { showClose: o, title: s, icon: i, variants: r } = ro(
725
+ function _o(e) {
726
+ const { overlayState: t, attemptClose: a } = Be(), { showClose: o, title: s, icon: i, variants: r } = uo(
727
727
  e,
728
728
  t
729
729
  );
730
- return /* @__PURE__ */ w("header", { className: io(r), "data-overlay-header": !0, children: [
730
+ return /* @__PURE__ */ w("header", { className: mo(r), "data-overlay-header": !0, children: [
731
731
  /* @__PURE__ */ w("div", { className: se.titleContainer, children: [
732
732
  i && /* @__PURE__ */ n("span", { className: se.icon, children: i }),
733
733
  /* @__PURE__ */ n("h4", { className: se.title, children: s })
@@ -744,50 +744,50 @@ function co(e) {
744
744
  )
745
745
  ] });
746
746
  }
747
- const lo = "overlay-module__base___qm4j7", uo = "overlay-module__loading___8U4v9", at = {
748
- base: lo,
749
- loading: uo
747
+ const ho = "overlay-module__base___qm4j7", fo = "overlay-module__loading___8U4v9", st = {
748
+ base: ho,
749
+ loading: fo
750
750
  };
751
- function mo(e, t) {
751
+ function po(e, t) {
752
752
  const [a, o] = N(!0), [s, i] = N(!1), r = v(() => {
753
753
  e?.confirmClose ? i(!0) : t.onClose();
754
- }, [t, e?.confirmClose]), c = v(() => {
754
+ }, [t, e?.confirmClose]), l = v(() => {
755
755
  i(!1), t.onClose();
756
756
  }, [t]), f = v(() => {
757
757
  i(!1);
758
758
  }, []);
759
- return S(() => {
759
+ return T(() => {
760
760
  e?.isOpen && e?.type === "webview" && o(!0);
761
- }, [e?.isOpen, e?.type]), S(() => {
761
+ }, [e?.isOpen, e?.type]), T(() => {
762
762
  e?.type === "webview" && o(!0);
763
- }, [e?.type === "webview" ? e.url : null]), S(() => {
763
+ }, [e?.type === "webview" ? e.url : null]), T(() => {
764
764
  if (e?.type !== "webview")
765
765
  return;
766
766
  const _ = (m) => {
767
- if (jt(m.data)) {
767
+ if (Kt(m.data)) {
768
768
  r();
769
769
  return;
770
770
  }
771
- if (qt(m.data)) {
772
- const l = m.data;
773
- switch (l.type) {
771
+ if (Xt(m.data)) {
772
+ const d = m.data;
773
+ switch (d.type) {
774
774
  case le.SET_TITLE:
775
- t.onSetTitle(l.title);
775
+ t.onSetTitle(d.title);
776
776
  break;
777
777
  case le.SET_ICON:
778
- t.onSetIcon(l.icon);
778
+ t.onSetIcon(d.icon);
779
779
  break;
780
780
  case le.SET_ALLOW_CLOSE:
781
- t.onSetAllowClose(l.allow);
781
+ t.onSetAllowClose(d.allow);
782
782
  break;
783
783
  case le.SET_CONFIRM_CLOSE:
784
- t.onSetConfirmClose(l.config);
784
+ t.onSetConfirmClose(d.config);
785
785
  break;
786
786
  case le.SEND_PAYLOAD:
787
- t.onSendPayload(l.payload);
787
+ t.onSendPayload(d.payload);
788
788
  break;
789
789
  case le.NAVIGATE:
790
- t.onNavigate(l.url);
790
+ t.onNavigate(d.url);
791
791
  break;
792
792
  }
793
793
  }
@@ -795,7 +795,7 @@ function mo(e, t) {
795
795
  return window.addEventListener("message", _), () => {
796
796
  window.removeEventListener("message", _);
797
797
  };
798
- }, [t, r, e?.type]), S(() => {
798
+ }, [t, r, e?.type]), T(() => {
799
799
  if (s) return;
800
800
  const _ = (m) => {
801
801
  m.key === "Escape" && e?.isOpen && e?.allowClose !== !1 && r();
@@ -814,19 +814,19 @@ function mo(e, t) {
814
814
  showConfirmModal: s,
815
815
  setShowConfirmModal: i,
816
816
  attemptClose: r,
817
- handleConfirmClose: c,
817
+ handleConfirmClose: l,
818
818
  handleCancelClose: f,
819
819
  variants: { isLoading: a }
820
820
  };
821
821
  }
822
- const _o = "allow-scripts allow-forms allow-same-origin allow-popups", ho = F(at.base, {
822
+ const go = "allow-scripts allow-forms allow-same-origin allow-popups", bo = F(st.base, {
823
823
  variants: {
824
824
  isLoading: {
825
- true: at.loading
825
+ true: st.loading
826
826
  }
827
827
  }
828
828
  });
829
- function fo({
829
+ function vo({
830
830
  overlayState: e,
831
831
  onClose: t,
832
832
  onSetTitle: a,
@@ -834,7 +834,7 @@ function fo({
834
834
  onSetAllowClose: s,
835
835
  onSetConfirmClose: i,
836
836
  onSendPayload: r,
837
- onNavigate: c,
837
+ onNavigate: l,
838
838
  coverRegistry: f,
839
839
  children: _
840
840
  }) {
@@ -845,37 +845,37 @@ function fo({
845
845
  onSetAllowClose: s,
846
846
  onSetConfirmClose: i,
847
847
  onSendPayload: r,
848
- onNavigate: c
848
+ onNavigate: l
849
849
  }, {
850
- isLoading: l,
851
- setIsLoading: d,
850
+ isLoading: d,
851
+ setIsLoading: c,
852
852
  showConfirmModal: u,
853
853
  setShowConfirmModal: h,
854
854
  attemptClose: p,
855
855
  handleConfirmClose: g,
856
856
  handleCancelClose: b,
857
- variants: M
858
- } = mo(e, m);
857
+ variants: C
858
+ } = po(e, m);
859
859
  if (!e?.isOpen)
860
860
  return null;
861
- const T = {
861
+ const S = {
862
862
  overlayState: e,
863
863
  ...m,
864
- sandboxPermissions: _o,
865
- isLoading: l,
866
- setIsLoading: d,
864
+ sandboxPermissions: go,
865
+ isLoading: d,
866
+ setIsLoading: c,
867
867
  attemptClose: p,
868
868
  showConfirmModal: u,
869
869
  setShowConfirmModal: h,
870
870
  coverRegistry: f
871
871
  };
872
- return /* @__PURE__ */ n(Ct.Provider, { value: T, children: /* @__PURE__ */ w("div", { className: ho(M), "data-overlay": !0, children: [
873
- _ || /* @__PURE__ */ w(Ee, { children: [
874
- /* @__PURE__ */ n(co, {}),
875
- /* @__PURE__ */ n(Jn, {})
872
+ return /* @__PURE__ */ n(Pt.Provider, { value: S, children: /* @__PURE__ */ w("div", { className: bo(C), "data-overlay": !0, children: [
873
+ _ || /* @__PURE__ */ w(Ie, { children: [
874
+ /* @__PURE__ */ n(_o, {}),
875
+ /* @__PURE__ */ n(oo, {})
876
876
  ] }),
877
877
  u && e.confirmClose && /* @__PURE__ */ n(
878
- Fn,
878
+ qn,
879
879
  {
880
880
  config: e.confirmClose,
881
881
  onConfirm: g,
@@ -884,25 +884,25 @@ function fo({
884
884
  )
885
885
  ] }) });
886
886
  }
887
- function po(e, t, a) {
887
+ function wo(e, t, a) {
888
888
  const {
889
889
  layout: o = "default",
890
890
  size: s = "normal",
891
891
  position: i = "bottom-right",
892
892
  "aria-label": r = "Webchat interface",
893
- className: c,
893
+ className: l,
894
894
  coverRegistry: f,
895
895
  // Exclude from DOM props
896
896
  ..._
897
- } = e, m = L(t.controller.machine, (b) => b.context.isOpen || !1), [l, d] = N(null), [u, h] = N(!1), p = C(!1), g = v(
897
+ } = e, m = L(t.controller.machine, (b) => b.context.isOpen || !1), [d, c] = N(null), [u, h] = N(!1), p = y(!1), g = v(
898
898
  (b) => {
899
- b.target === b.currentTarget && l !== null && (l === "closing" && h(!1), d(null));
899
+ b.target === b.currentTarget && d !== null && (d === "closing" && h(!1), c(null));
900
900
  },
901
- [l]
901
+ [d]
902
902
  );
903
- return S(() => {
903
+ return T(() => {
904
904
  const b = p.current;
905
- p.current = m, b === !1 && m ? (h(!0), d("opening")) : b === !0 && !m && d("closing");
905
+ p.current = m, b === !1 && m ? (h(!0), c("opening")) : b === !0 && !m && c("closing");
906
906
  }, [m]), {
907
907
  // Component visibility - stays true during close animation
908
908
  shouldRender: u,
@@ -925,14 +925,14 @@ function po(e, t, a) {
925
925
  size: s,
926
926
  position: i,
927
927
  isOpen: m,
928
- isOpening: l === "opening",
929
- isClosing: l === "closing",
930
- className: c
928
+ isOpening: d === "opening",
929
+ isClosing: d === "closing",
930
+ className: l
931
931
  }
932
932
  };
933
933
  }
934
- const go = "webchat-container-module__base___-nEHI", Y = {
935
- base: go,
934
+ const Co = "webchat-container-module__base___-nEHI", ee = {
935
+ base: Co,
936
936
  "is-open": "webchat-container-module__is-open___y7UjX",
937
937
  default: "webchat-container-module__default___Zl33C",
938
938
  "position-bottom-right": "webchat-container-module__position-bottom-right___NIW0p",
@@ -941,25 +941,25 @@ const go = "webchat-container-module__base___-nEHI", Y = {
941
941
  "position-top-left": "webchat-container-module__position-top-left___ehR4d",
942
942
  "is-opening": "webchat-container-module__is-opening___5Ot9W",
943
943
  "is-closing": "webchat-container-module__is-closing___o0hqs"
944
- }, vo = F(Y.base, {
944
+ }, yo = F(ee.base, {
945
945
  variants: {
946
946
  layout: {
947
- default: Y.default
947
+ default: ee.default
948
948
  },
949
949
  position: {
950
- "bottom-right": Y["position-bottom-right"],
951
- "bottom-left": Y["position-bottom-left"],
952
- "top-right": Y["position-top-right"],
953
- "top-left": Y["position-top-left"]
950
+ "bottom-right": ee["position-bottom-right"],
951
+ "bottom-left": ee["position-bottom-left"],
952
+ "top-right": ee["position-top-right"],
953
+ "top-left": ee["position-top-left"]
954
954
  },
955
955
  isOpen: {
956
- true: Y["is-open"]
956
+ true: ee["is-open"]
957
957
  },
958
958
  isOpening: {
959
- true: Y["is-opening"]
959
+ true: ee["is-opening"]
960
960
  },
961
961
  isClosing: {
962
- true: Y["is-closing"]
962
+ true: ee["is-closing"]
963
963
  }
964
964
  },
965
965
  defaultVariants: {
@@ -967,52 +967,52 @@ const go = "webchat-container-module__base___-nEHI", Y = {
967
967
  position: "bottom-right"
968
968
  }
969
969
  });
970
- function bo(e) {
971
- const { state: t, controller: a } = U(), o = C(null), { shouldRender: s, containerProps: i, variants: r } = po(
970
+ function Mo(e) {
971
+ const { state: t, controller: a } = z(), o = y(null), { shouldRender: s, containerProps: i, variants: r } = wo(
972
972
  e,
973
973
  t,
974
974
  o
975
975
  ), {
976
- children: c,
976
+ children: l,
977
977
  coverRegistry: f,
978
978
  layout: _,
979
979
  size: m,
980
- position: l,
981
- ...d
980
+ position: d,
981
+ ...c
982
982
  } = e, u = v(
983
983
  () => a.overlay.close(),
984
984
  [a]
985
985
  ), h = v(
986
- (y) => a.overlay.setTitle(y),
986
+ (M) => a.overlay.setTitle(M),
987
987
  [a]
988
988
  ), p = v(
989
- (y) => a.overlay.setIcon(y),
989
+ (M) => a.overlay.setIcon(M),
990
990
  [a]
991
991
  ), g = v(
992
- (y) => a.overlay.setAllowClose(y),
992
+ (M) => a.overlay.setAllowClose(M),
993
993
  [a]
994
994
  ), b = v(
995
- (y) => a.overlay.setConfirmClose(y),
995
+ (M) => a.overlay.setConfirmClose(M),
996
996
  [a]
997
- ), M = v(
998
- (y) => a.overlay.sendPayload(y),
997
+ ), C = v(
998
+ (M) => a.overlay.sendPayload(M),
999
999
  [a]
1000
- ), T = v(
1001
- (y) => a.overlay.navigate(y),
1000
+ ), S = v(
1001
+ (M) => a.overlay.navigate(M),
1002
1002
  [a]
1003
1003
  );
1004
1004
  return s ? /* @__PURE__ */ w(
1005
1005
  "div",
1006
1006
  {
1007
1007
  ...i,
1008
- ...d,
1009
- className: vo(r),
1008
+ ...c,
1009
+ className: yo(r),
1010
1010
  "data-testid": "webchat-container",
1011
1011
  "data-webchat-container": !0,
1012
1012
  children: [
1013
- /* @__PURE__ */ n(In, { children: c }),
1013
+ /* @__PURE__ */ n(Ln, { children: l }),
1014
1014
  /* @__PURE__ */ n(
1015
- fo,
1015
+ vo,
1016
1016
  {
1017
1017
  overlayState: t.overlayState,
1018
1018
  onClose: u,
@@ -1020,8 +1020,8 @@ function bo(e) {
1020
1020
  onSetIcon: p,
1021
1021
  onSetAllowClose: g,
1022
1022
  onSetConfirmClose: b,
1023
- onSendPayload: M,
1024
- onNavigate: T,
1023
+ onSendPayload: C,
1024
+ onNavigate: S,
1025
1025
  coverRegistry: f
1026
1026
  }
1027
1027
  )
@@ -1029,7 +1029,7 @@ function bo(e) {
1029
1029
  }
1030
1030
  ) : null;
1031
1031
  }
1032
- function wo() {
1032
+ function Po() {
1033
1033
  return /* @__PURE__ */ w(
1034
1034
  "svg",
1035
1035
  {
@@ -1050,7 +1050,7 @@ function wo() {
1050
1050
  }
1051
1051
  );
1052
1052
  }
1053
- function Co() {
1053
+ function No() {
1054
1054
  return /* @__PURE__ */ n(
1055
1055
  "svg",
1056
1056
  {
@@ -1065,26 +1065,26 @@ function Co() {
1065
1065
  }
1066
1066
  );
1067
1067
  }
1068
- function yo(e) {
1068
+ function So(e) {
1069
1069
  return Math.min(1, Math.max(0, e));
1070
1070
  }
1071
- function Mo(e, t, a) {
1071
+ function To(e, t, a) {
1072
1072
  const {
1073
1073
  title: o = "Chat",
1074
1074
  avatarSrc: s,
1075
1075
  avatarAlt: i,
1076
1076
  showStatus: r = !0,
1077
- showClose: c = !0,
1077
+ showClose: l = !0,
1078
1078
  onClose: f,
1079
1079
  variant: _ = "collapsed",
1080
1080
  collapseProgress: m,
1081
- hasShadow: l = !1,
1082
- enableResponsiveHeroHeader: d,
1081
+ hasShadow: d = !1,
1082
+ enableResponsiveHeroHeader: c,
1083
1083
  "aria-label": u,
1084
1084
  className: h,
1085
1085
  style: p,
1086
1086
  ...g
1087
- } = e, b = s ?? t.avatarConfig?.bot?.src, M = t.avatarConfig?.bot?.svg, T = i ?? t.avatarConfig?.bot?.alt, y = L(
1087
+ } = e, b = s ?? t.avatarConfig?.bot?.src, C = t.avatarConfig?.bot?.svg, S = i ?? t.avatarConfig?.bot?.alt, M = L(
1088
1088
  t.controller.machine,
1089
1089
  (B) => B.context.connectionStatus || "disconnected"
1090
1090
  ), P = v(() => {
@@ -1104,11 +1104,11 @@ function Mo(e, t, a) {
1104
1104
  default:
1105
1105
  return "Offline";
1106
1106
  }
1107
- }, []), W = r ? A(y) : void 0, V = _ !== "expanded", $ = d ?? t.enableResponsiveHeroHeader ?? !0, j = yo(
1107
+ }, []), W = r ? A(M) : void 0, V = _ !== "expanded", $ = c ?? t.enableResponsiveHeroHeader ?? !0, q = So(
1108
1108
  m ?? Number(V)
1109
- ), q = {
1109
+ ), G = {
1110
1110
  ...p,
1111
- "--webchat-header-collapse-progress": String(j)
1111
+ "--webchat-header-collapse-progress": String(q)
1112
1112
  };
1113
1113
  return {
1114
1114
  // Header element props
@@ -1116,32 +1116,32 @@ function Mo(e, t, a) {
1116
1116
  ...g,
1117
1117
  ref: a,
1118
1118
  "aria-label": u || `${o} header`,
1119
- style: q,
1119
+ style: G,
1120
1120
  "data-webchat-responsive-hero": $ ? "on" : "off"
1121
1121
  },
1122
1122
  // Header content
1123
1123
  title: o,
1124
1124
  avatarSrc: b,
1125
- avatarSvg: M,
1126
- avatarAlt: T,
1125
+ avatarSvg: C,
1126
+ avatarAlt: S,
1127
1127
  showStatus: r,
1128
1128
  statusText: W,
1129
- showClose: c,
1129
+ showClose: l,
1130
1130
  onClose: P,
1131
- connectionStatus: y,
1131
+ connectionStatus: M,
1132
1132
  // CSS class variants
1133
1133
  variants: {
1134
1134
  variant: _,
1135
- hasShadow: l,
1135
+ hasShadow: d,
1136
1136
  className: h
1137
1137
  }
1138
1138
  };
1139
1139
  }
1140
- const Po = "webchat-header-module__base___VbIWd", No = "webchat-header-module__profile___NsohW", So = "webchat-header-module__avatar___klWPr", To = "webchat-header-module__collapsed___Xwj3m", Ao = "webchat-header-module__expanded___9RKFH", x = {
1141
- base: Po,
1140
+ const Ao = "webchat-header-module__base___VbIWd", Eo = "webchat-header-module__profile___NsohW", Io = "webchat-header-module__avatar___klWPr", Ro = "webchat-header-module__collapsed___Xwj3m", xo = "webchat-header-module__expanded___9RKFH", x = {
1141
+ base: Ao,
1142
1142
  "header-content": "webchat-header-module__header-content___bPP9l",
1143
- profile: No,
1144
- avatar: So,
1143
+ profile: Eo,
1144
+ avatar: Io,
1145
1145
  "header-text": "webchat-header-module__header-text___64Yj9",
1146
1146
  "header-title": "webchat-header-module__header-title___QHcHi",
1147
1147
  "status-text": "webchat-header-module__status-text___fTZvQ",
@@ -1152,38 +1152,38 @@ const Po = "webchat-header-module__base___VbIWd", No = "webchat-header-module__p
1152
1152
  "avatar-svg": "webchat-header-module__avatar-svg___dKAm6",
1153
1153
  "status-dot": "webchat-header-module__status-dot___rjbA2",
1154
1154
  "has-shadow": "webchat-header-module__has-shadow___uQ7mG",
1155
- collapsed: To,
1156
- expanded: Ao
1157
- }, yt = O((e, t) => {
1158
- const a = Xt(t), { buttonProps: o } = pt(e, a), { focusProps: s, isFocusVisible: i } = Ze();
1155
+ collapsed: Ro,
1156
+ expanded: xo
1157
+ }, Nt = O((e, t) => {
1158
+ const a = Yt(t), { buttonProps: o } = vt(e, a), { focusProps: s, isFocusVisible: i } = Ye();
1159
1159
  return /* @__PURE__ */ n(
1160
1160
  "button",
1161
1161
  {
1162
- ...gt(o, s),
1162
+ ...wt(o, s),
1163
1163
  ref: a,
1164
1164
  className: x["header-button"],
1165
1165
  "aria-label": e["aria-label"] ?? "Open menu",
1166
1166
  "data-focus-visible": i || void 0,
1167
- children: /* @__PURE__ */ n(Co, {})
1167
+ children: /* @__PURE__ */ n(No, {})
1168
1168
  }
1169
1169
  );
1170
1170
  });
1171
- function Io(e) {
1172
- const t = C(null), { buttonProps: a } = pt(e, t), { focusProps: o, isFocusVisible: s } = Ze();
1171
+ function Lo(e) {
1172
+ const t = y(null), { buttonProps: a } = vt(e, t), { focusProps: o, isFocusVisible: s } = Ye();
1173
1173
  return /* @__PURE__ */ n(
1174
1174
  "button",
1175
1175
  {
1176
- ...gt(a, o),
1176
+ ...wt(a, o),
1177
1177
  ref: t,
1178
1178
  className: x["header-button"],
1179
1179
  "aria-label": e["aria-label"] ?? "Close chat",
1180
1180
  "data-focus-visible": s || void 0,
1181
- children: /* @__PURE__ */ n(wo, {})
1181
+ children: /* @__PURE__ */ n(Po, {})
1182
1182
  }
1183
1183
  );
1184
1184
  }
1185
- yt.displayName = "MenuTriggerButton";
1186
- const Eo = F(x.base, {
1185
+ Nt.displayName = "MenuTriggerButton";
1186
+ const Bo = F(x.base, {
1187
1187
  variants: {
1188
1188
  variant: {
1189
1189
  default: x.collapsed,
@@ -1198,36 +1198,36 @@ const Eo = F(x.base, {
1198
1198
  variant: "collapsed"
1199
1199
  }
1200
1200
  });
1201
- function Ro({
1201
+ function ko({
1202
1202
  children: e,
1203
1203
  ...t
1204
1204
  }) {
1205
- const { state: a } = U(), o = C(null), {
1205
+ const { state: a } = z(), o = y(null), {
1206
1206
  headerProps: s,
1207
1207
  title: i,
1208
1208
  avatarSrc: r,
1209
- avatarSvg: c,
1209
+ avatarSvg: l,
1210
1210
  avatarAlt: f,
1211
1211
  showStatus: _,
1212
1212
  statusText: m,
1213
- showClose: l,
1214
- onClose: d,
1213
+ showClose: d,
1214
+ onClose: c,
1215
1215
  connectionStatus: u,
1216
1216
  variants: h
1217
- } = Mo(t, a, o);
1217
+ } = To(t, a, o);
1218
1218
  return /* @__PURE__ */ n(
1219
1219
  "header",
1220
1220
  {
1221
1221
  ...s,
1222
- className: Eo(h),
1222
+ className: Bo(h),
1223
1223
  "data-webchat-header": !0,
1224
1224
  children: /* @__PURE__ */ w("div", { className: x["header-content"], children: [
1225
1225
  /* @__PURE__ */ w("div", { className: x.profile, children: [
1226
- /* @__PURE__ */ n("div", { className: x.avatar, "aria-hidden": "true", children: c ? /* @__PURE__ */ n(
1226
+ /* @__PURE__ */ n("div", { className: x.avatar, "aria-hidden": "true", children: l ? /* @__PURE__ */ n(
1227
1227
  "div",
1228
1228
  {
1229
1229
  className: x["avatar-svg"],
1230
- dangerouslySetInnerHTML: { __html: c },
1230
+ dangerouslySetInnerHTML: { __html: l },
1231
1231
  role: "img",
1232
1232
  "aria-label": f ?? i
1233
1233
  }
@@ -1256,7 +1256,7 @@ function Ro({
1256
1256
  ] }),
1257
1257
  /* @__PURE__ */ w("div", { className: x["header-actions"], children: [
1258
1258
  e,
1259
- l && /* @__PURE__ */ n(Io, { onPress: d })
1259
+ d && /* @__PURE__ */ n(Lo, { onPress: c })
1260
1260
  ] })
1261
1261
  ] })
1262
1262
  }
@@ -1269,18 +1269,18 @@ const re = {
1269
1269
  role: "img",
1270
1270
  "aria-hidden": !0
1271
1271
  };
1272
- function xo() {
1272
+ function Do() {
1273
1273
  return /* @__PURE__ */ n("svg", { ...re, children: /* @__PURE__ */ n("path", { d: "M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1C77.5 213.5 86.3 192 104.2 192H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm-64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z" }) });
1274
1274
  }
1275
- function Lo({
1275
+ function Oo({
1276
1276
  onClose: e,
1277
1277
  children: t
1278
1278
  }) {
1279
- const { controller: a } = U();
1279
+ const { controller: a } = z();
1280
1280
  return /* @__PURE__ */ n(
1281
- Xe,
1281
+ Ze,
1282
1282
  {
1283
- icon: /* @__PURE__ */ n(xo, {}),
1283
+ icon: /* @__PURE__ */ n(Do, {}),
1284
1284
  onPress: () => {
1285
1285
  a.downloadTranscript(), e?.();
1286
1286
  },
@@ -1288,18 +1288,18 @@ function Lo({
1288
1288
  }
1289
1289
  );
1290
1290
  }
1291
- function Bo() {
1291
+ function Wo() {
1292
1292
  return /* @__PURE__ */ n("svg", { ...re, children: /* @__PURE__ */ n("path", { d: "M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z" }) });
1293
1293
  }
1294
- function ko({
1294
+ function Vo({
1295
1295
  onClose: e,
1296
1296
  children: t
1297
1297
  }) {
1298
- const { controller: a } = U();
1298
+ const { controller: a } = z();
1299
1299
  return /* @__PURE__ */ n(
1300
- Xe,
1300
+ Ze,
1301
1301
  {
1302
- icon: /* @__PURE__ */ n(Bo, {}),
1302
+ icon: /* @__PURE__ */ n(Wo, {}),
1303
1303
  onPress: () => {
1304
1304
  a.resetConversation(), e?.();
1305
1305
  },
@@ -1307,14 +1307,14 @@ function ko({
1307
1307
  }
1308
1308
  );
1309
1309
  }
1310
- function Do() {
1310
+ function $o() {
1311
1311
  return /* @__PURE__ */ n("svg", { ...re, children: /* @__PURE__ */ n("path", { d: "M497 273L329 441c-15 15-41 4.5-41-17v-96H152c-13.3 0-24-10.7-24-24v-96c0-13.3 10.7-24 24-24h136V88c0-21.4 25.9-32 41-17l168 168c9.3 9.4 9.3 24.6 0 34zM192 436v-40c0-6.6-5.4-12-12-12H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h84c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12H96C42.1 64 0 106.1 0 160v192c0 53.9 42.1 96 96 96h84c6.6 0 12-5.4 12-12z" }) });
1312
1312
  }
1313
- const Oo = "Reset session?", Wo = "You will end this conversation and lose your chat history.", Vo = "Cancel", $o = "Reset session";
1314
- function Ho({
1313
+ const Ho = "Reset session?", Fo = "You will end this conversation and lose your chat history.", Uo = "Cancel", zo = "Reset session";
1314
+ function jo({
1315
1315
  onClose: e
1316
1316
  }) {
1317
- const { controller: t } = U(), { open: a, close: o } = Sn(), s = v(() => {
1317
+ const { controller: t } = z(), { open: a, close: o } = In(), s = v(() => {
1318
1318
  o();
1319
1319
  }, [o]), i = v(() => {
1320
1320
  t.resetSession(), o();
@@ -1323,17 +1323,17 @@ function Ho({
1323
1323
  menuItemProps: {
1324
1324
  onPress: v(() => {
1325
1325
  a({
1326
- title: Oo,
1327
- subtitle: Wo,
1326
+ title: Ho,
1327
+ subtitle: Fo,
1328
1328
  actions: [
1329
1329
  {
1330
- label: Vo,
1330
+ label: Uo,
1331
1331
  intent: "secondary",
1332
1332
  appearance: "outline",
1333
1333
  onPress: s
1334
1334
  },
1335
1335
  {
1336
- label: $o,
1336
+ label: zo,
1337
1337
  intent: "danger",
1338
1338
  onPress: i
1339
1339
  }
@@ -1343,14 +1343,14 @@ function Ho({
1343
1343
  }
1344
1344
  };
1345
1345
  }
1346
- function Fo({
1346
+ function qo({
1347
1347
  onClose: e,
1348
1348
  children: t
1349
1349
  }) {
1350
- const { menuItemProps: a } = Ho({ onClose: e });
1351
- return /* @__PURE__ */ n(Xe, { icon: /* @__PURE__ */ n(Do, {}), onPress: a.onPress, children: t ?? "Reset session" });
1350
+ const { menuItemProps: a } = jo({ onClose: e });
1351
+ return /* @__PURE__ */ n(Ze, { icon: /* @__PURE__ */ n($o, {}), onPress: a.onPress, children: t ?? "Reset session" });
1352
1352
  }
1353
- function Uo() {
1353
+ function Go() {
1354
1354
  return /* @__PURE__ */ n(
1355
1355
  "svg",
1356
1356
  {
@@ -1363,25 +1363,25 @@ function Uo() {
1363
1363
  }
1364
1364
  );
1365
1365
  }
1366
- function zo({
1366
+ function Ko({
1367
1367
  onClose: e,
1368
1368
  children: t
1369
1369
  }) {
1370
- const { state: a, controller: o } = U(), { soundsEnabled: s } = a;
1370
+ const { state: a, controller: o } = z(), { soundsEnabled: s } = a;
1371
1371
  return /* @__PURE__ */ n(
1372
- Vt,
1372
+ Ft,
1373
1373
  {
1374
- icon: /* @__PURE__ */ n(Uo, {}),
1374
+ icon: /* @__PURE__ */ n(Go, {}),
1375
1375
  isSelected: s,
1376
1376
  onChange: (i) => o.toggleSounds(i),
1377
1377
  children: t ?? "Sounds"
1378
1378
  }
1379
1379
  );
1380
1380
  }
1381
- function Mt() {
1381
+ function St() {
1382
1382
  return /* @__PURE__ */ n("svg", { ...re, viewBox: "0 0 384 512", children: /* @__PURE__ */ n("path", { d: "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z" }) });
1383
1383
  }
1384
- function Pt() {
1384
+ function Tt() {
1385
1385
  return /* @__PURE__ */ n(
1386
1386
  "svg",
1387
1387
  {
@@ -1402,7 +1402,7 @@ function Pt() {
1402
1402
  }
1403
1403
  );
1404
1404
  }
1405
- function Nt() {
1405
+ function At() {
1406
1406
  return /* @__PURE__ */ n(
1407
1407
  "svg",
1408
1408
  {
@@ -1423,23 +1423,23 @@ function Nt() {
1423
1423
  }
1424
1424
  );
1425
1425
  }
1426
- const jo = "attachment-preview-module__container___VIJkZ", qo = "attachment-preview-module__thumbnailList___by6c8", Go = "attachment-preview-module__thumbnailItem___GNFlf", Ko = "attachment-preview-module__thumbnail___Ckp9-", Xo = "attachment-preview-module__videoWrapper___lmpFI", Zo = "attachment-preview-module__videoPlayBadge___ky5sB", Qo = "attachment-preview-module__fileList___HO6cw", Yo = "attachment-preview-module__fileRow___F61bW", Jo = "attachment-preview-module__fileIcon___azbPW", ea = "attachment-preview-module__fileName___Ye6Av", ta = "attachment-preview-module__removeBtn___TWvdF", H = {
1427
- container: jo,
1428
- thumbnailList: qo,
1429
- thumbnailItem: Go,
1430
- thumbnail: Ko,
1431
- videoWrapper: Xo,
1432
- videoPlayBadge: Zo,
1433
- fileList: Qo,
1434
- fileRow: Yo,
1435
- fileIcon: Jo,
1436
- fileName: ea,
1437
- removeBtn: ta
1426
+ const Xo = "attachment-preview-module__container___VIJkZ", Zo = "attachment-preview-module__thumbnailList___by6c8", Qo = "attachment-preview-module__thumbnailItem___GNFlf", Yo = "attachment-preview-module__thumbnail___Ckp9-", Jo = "attachment-preview-module__videoWrapper___lmpFI", ea = "attachment-preview-module__videoPlayBadge___ky5sB", ta = "attachment-preview-module__fileList___HO6cw", na = "attachment-preview-module__fileRow___F61bW", oa = "attachment-preview-module__fileIcon___azbPW", aa = "attachment-preview-module__fileName___Ye6Av", sa = "attachment-preview-module__removeBtn___TWvdF", H = {
1427
+ container: Xo,
1428
+ thumbnailList: Zo,
1429
+ thumbnailItem: Qo,
1430
+ thumbnail: Yo,
1431
+ videoWrapper: Jo,
1432
+ videoPlayBadge: ea,
1433
+ fileList: ta,
1434
+ fileRow: na,
1435
+ fileIcon: oa,
1436
+ fileName: aa,
1437
+ removeBtn: sa
1438
1438
  };
1439
- function na(e) {
1440
- return e === "application/pdf" ? /* @__PURE__ */ n(Nt, {}) : /* @__PURE__ */ n(Pt, {});
1439
+ function ra(e) {
1440
+ return e === "application/pdf" ? /* @__PURE__ */ n(At, {}) : /* @__PURE__ */ n(Tt, {});
1441
1441
  }
1442
- function oa({ attachment: e, onRemove: t }) {
1442
+ function ia({ attachment: e, onRemove: t }) {
1443
1443
  return /* @__PURE__ */ w("div", { role: "listitem", className: H.thumbnailItem, children: [
1444
1444
  e.fileType === "video" ? /* @__PURE__ */ w("div", { className: H.videoWrapper, children: [
1445
1445
  /* @__PURE__ */ n(
@@ -1469,14 +1469,14 @@ function oa({ attachment: e, onRemove: t }) {
1469
1469
  className: H.removeBtn,
1470
1470
  "aria-label": `Remove ${e.file.name}`,
1471
1471
  onClick: () => t(e.id),
1472
- children: /* @__PURE__ */ n(Mt, {})
1472
+ children: /* @__PURE__ */ n(St, {})
1473
1473
  }
1474
1474
  )
1475
1475
  ] });
1476
1476
  }
1477
- function aa({ attachment: e, onRemove: t }) {
1477
+ function ca({ attachment: e, onRemove: t }) {
1478
1478
  return /* @__PURE__ */ w("div", { role: "listitem", className: H.fileRow, children: [
1479
- /* @__PURE__ */ n("span", { className: H.fileIcon, "aria-hidden": !0, children: na(e.file.type) }),
1479
+ /* @__PURE__ */ n("span", { className: H.fileIcon, "aria-hidden": !0, children: ra(e.file.type) }),
1480
1480
  /* @__PURE__ */ n("span", { className: H.fileName, children: e.file.name }),
1481
1481
  /* @__PURE__ */ n(
1482
1482
  "button",
@@ -1485,12 +1485,12 @@ function aa({ attachment: e, onRemove: t }) {
1485
1485
  className: H.removeBtn,
1486
1486
  "aria-label": `Remove ${e.file.name}`,
1487
1487
  onClick: () => t(e.id),
1488
- children: /* @__PURE__ */ n(Mt, {})
1488
+ children: /* @__PURE__ */ n(St, {})
1489
1489
  }
1490
1490
  )
1491
1491
  ] });
1492
1492
  }
1493
- function sa({
1493
+ function la({
1494
1494
  attachments: e,
1495
1495
  onRemove: t
1496
1496
  }) {
@@ -1504,7 +1504,7 @@ function sa({
1504
1504
  role: "list",
1505
1505
  "aria-label": "Image and video attachments",
1506
1506
  children: a.map((s) => /* @__PURE__ */ n(
1507
- oa,
1507
+ ia,
1508
1508
  {
1509
1509
  attachment: s,
1510
1510
  onRemove: t
@@ -1520,7 +1520,7 @@ function sa({
1520
1520
  role: "list",
1521
1521
  "aria-label": "File attachments",
1522
1522
  children: o.map((s) => /* @__PURE__ */ n(
1523
- aa,
1523
+ ca,
1524
1524
  {
1525
1525
  attachment: s,
1526
1526
  onRemove: t
@@ -1531,7 +1531,7 @@ function sa({
1531
1531
  )
1532
1532
  ] });
1533
1533
  }
1534
- const ra = 25 * 1024 * 1024, ia = ["image/*", "video/*"], St = [
1534
+ const da = 25 * 1024 * 1024, ua = ["image/*", "video/*"], Et = [
1535
1535
  ".pdf",
1536
1536
  ".doc",
1537
1537
  ".docx",
@@ -1541,64 +1541,64 @@ const ra = 25 * 1024 * 1024, ia = ["image/*", "video/*"], St = [
1541
1541
  ".pptx",
1542
1542
  ".txt",
1543
1543
  ".zip"
1544
- ], ca = new Set(
1545
- St.map((e) => e.slice(1))
1544
+ ], ma = new Set(
1545
+ Et.map((e) => e.slice(1))
1546
1546
  // strip leading '.'
1547
- ), la = [
1548
- ...ia,
1547
+ ), _a = [
1548
+ ...ua,
1549
1549
  "application/pdf",
1550
- ...St
1550
+ ...Et
1551
1551
  ].join(",");
1552
- function da(e) {
1552
+ function ha(e) {
1553
1553
  return e.type.startsWith("image/") ? "image" : e.type.startsWith("video/") ? "video" : "document";
1554
1554
  }
1555
- function ua(e) {
1555
+ function fa(e) {
1556
1556
  if (e.type.startsWith("image/") || e.type.startsWith("video/"))
1557
1557
  return !0;
1558
1558
  const t = e.name.split(".").pop()?.toLowerCase() ?? "";
1559
- return !!ca.has(t);
1559
+ return !!ma.has(t);
1560
1560
  }
1561
- function ma() {
1562
- const { controller: e } = U(), [t, a] = N([]), [o, s] = N(), i = C(null), r = C(/* @__PURE__ */ new Map());
1563
- S(() => {
1564
- const d = r.current;
1561
+ function pa() {
1562
+ const { controller: e } = z(), [t, a] = N([]), [o, s] = N(), i = y(null), r = y(/* @__PURE__ */ new Map());
1563
+ T(() => {
1564
+ const c = r.current;
1565
1565
  return () => {
1566
- d.forEach((u) => URL.revokeObjectURL(u));
1566
+ c.forEach((u) => URL.revokeObjectURL(u));
1567
1567
  };
1568
1568
  }, []);
1569
- const c = v(
1570
- (d) => {
1571
- const u = d.target.files?.[0];
1569
+ const l = v(
1570
+ (c) => {
1571
+ const u = c.target.files?.[0];
1572
1572
  if (!u) return;
1573
- if (d.target.value = "", !ua(u)) {
1573
+ if (c.target.value = "", !fa(u)) {
1574
1574
  s("File type not supported.");
1575
1575
  return;
1576
1576
  }
1577
- if (u.size > ra) {
1577
+ if (u.size > da) {
1578
1578
  s("File is too large. Maximum size is 25 MB.");
1579
1579
  return;
1580
1580
  }
1581
1581
  s(void 0), r.current.forEach((g) => URL.revokeObjectURL(g)), r.current.clear();
1582
1582
  const h = `${u.name}-${u.size}-${Date.now()}-${Math.random()}`, p = URL.createObjectURL(u);
1583
- r.current.set(h, p), a([{ id: h, file: u, previewUrl: p, fileType: da(u) }]);
1583
+ r.current.set(h, p), a([{ id: h, file: u, previewUrl: p, fileType: ha(u) }]);
1584
1584
  },
1585
1585
  []
1586
- ), f = v((d) => {
1587
- const u = r.current.get(d);
1588
- u && (URL.revokeObjectURL(u), r.current.delete(d)), a((h) => h.filter((p) => p.id !== d));
1586
+ ), f = v((c) => {
1587
+ const u = r.current.get(c);
1588
+ u && (URL.revokeObjectURL(u), r.current.delete(c)), a((h) => h.filter((p) => p.id !== c));
1589
1589
  }, []), _ = v(() => {
1590
- r.current.forEach((d) => URL.revokeObjectURL(d)), r.current.clear(), a([]);
1590
+ r.current.forEach((c) => URL.revokeObjectURL(c)), r.current.clear(), a([]);
1591
1591
  }, []), m = v(() => {
1592
1592
  i.current?.click();
1593
- }, []), l = v(() => {
1593
+ }, []), d = v(() => {
1594
1594
  if (t.length) {
1595
- for (const d of t) {
1595
+ for (const c of t) {
1596
1596
  const u = Qe.createMedia({
1597
- file: d.file,
1598
- attachmentUrl: d.previewUrl,
1597
+ file: c.file,
1598
+ attachmentUrl: c.previewUrl,
1599
1599
  metadata: { sent_by: me.User }
1600
1600
  });
1601
- e.sendMessage(u, d.file);
1601
+ e.sendMessage(u, c.file);
1602
1602
  }
1603
1603
  r.current.clear(), a([]);
1604
1604
  }
@@ -1608,68 +1608,68 @@ function ma() {
1608
1608
  hasAttachments: t.length > 0,
1609
1609
  attachmentError: o,
1610
1610
  fileInputRef: i,
1611
- handleFileInputChange: c,
1611
+ handleFileInputChange: l,
1612
1612
  handleRemoveAttachment: f,
1613
1613
  clearAttachments: _,
1614
1614
  handleOpenFilePicker: m,
1615
- sendAttachments: l,
1615
+ sendAttachments: d,
1616
1616
  attachmentListProps: {
1617
1617
  attachments: t,
1618
1618
  onRemove: f
1619
1619
  }
1620
1620
  };
1621
1621
  }
1622
- const _a = "audio-waveform-module__waveform___xs7iO", Tt = {
1623
- waveform: _a
1624
- }, ha = 30, fa = 1e3 / ha, pa = 24, st = 2, rt = 3;
1625
- function ga({ analyserNode: e }) {
1626
- const t = C(null), a = C(void 0), o = C(0);
1627
- return S(() => {
1622
+ const ga = "audio-waveform-module__waveform___xs7iO", It = {
1623
+ waveform: ga
1624
+ }, ba = 30, va = 1e3 / ba, wa = 24, rt = 2, it = 3;
1625
+ function Ca({ analyserNode: e }) {
1626
+ const t = y(null), a = y(void 0), o = y(0);
1627
+ return T(() => {
1628
1628
  const s = t.current;
1629
1629
  if (!s) return;
1630
1630
  const i = () => {
1631
- const d = window.devicePixelRatio ?? 1, u = Math.max(s.clientWidth, 60);
1632
- s.width = Math.round(u * d), s.height = pa * d;
1631
+ const c = window.devicePixelRatio ?? 1, u = Math.max(s.clientWidth, 60);
1632
+ s.width = Math.round(u * c), s.height = wa * c;
1633
1633
  };
1634
1634
  i();
1635
1635
  const r = new ResizeObserver(i);
1636
1636
  r.observe(s);
1637
- const c = s.getContext("2d");
1638
- if (!c) return;
1637
+ const l = s.getContext("2d");
1638
+ if (!l) return;
1639
1639
  const f = e.frequencyBinCount, _ = new Uint8Array(f);
1640
- function m(d, u, h, p) {
1640
+ function m(c, u, h, p) {
1641
1641
  const g = h / 2;
1642
1642
  if (p <= h) {
1643
- c.beginPath(), c.arc(d + g, u + g, g, 0, Math.PI * 2), c.fill();
1643
+ l.beginPath(), l.arc(c + g, u + g, g, 0, Math.PI * 2), l.fill();
1644
1644
  return;
1645
1645
  }
1646
- c.beginPath(), c.moveTo(d + g, u), c.arcTo(d + h, u, d + h, u + g, g), c.lineTo(d + h, u + p - g), c.arcTo(d + h, u + p, d + g, u + p, g), c.lineTo(d + g, u + p), c.arcTo(d, u + p, d, u + p - g, g), c.lineTo(d, u + g), c.arcTo(d, u, d + g, u, g), c.closePath(), c.fill();
1646
+ l.beginPath(), l.moveTo(c + g, u), l.arcTo(c + h, u, c + h, u + g, g), l.lineTo(c + h, u + p - g), l.arcTo(c + h, u + p, c + g, u + p, g), l.lineTo(c + g, u + p), l.arcTo(c, u + p, c, u + p - g, g), l.lineTo(c, u + g), l.arcTo(c, u, c + g, u, g), l.closePath(), l.fill();
1647
1647
  }
1648
- function l(d) {
1649
- if (d - o.current < fa) {
1650
- a.current = requestAnimationFrame(l);
1648
+ function d(c) {
1649
+ if (c - o.current < va) {
1650
+ a.current = requestAnimationFrame(d);
1651
1651
  return;
1652
1652
  }
1653
- o.current = d, e.getByteFrequencyData(_);
1654
- const u = window.devicePixelRatio ?? 1, h = s.width, p = s.height, g = st * u, b = Math.max(
1653
+ o.current = c, e.getByteFrequencyData(_);
1654
+ const u = window.devicePixelRatio ?? 1, h = s.width, p = s.height, g = rt * u, b = Math.max(
1655
1655
  1,
1656
- Math.floor(h / u / (st + rt))
1657
- ), M = rt * u;
1658
- c.clearRect(0, 0, h, p), c.fillStyle = "currentColor";
1659
- const T = Math.floor(f * 0.5);
1660
- for (let y = 0; y < b; y++) {
1661
- const P = Math.floor(y / b * T), A = _[P], W = Math.max(g, A / 255 * p * 1.1), V = y * (g + M), $ = (p - W) / 2;
1656
+ Math.floor(h / u / (rt + it))
1657
+ ), C = it * u;
1658
+ l.clearRect(0, 0, h, p), l.fillStyle = "currentColor";
1659
+ const S = Math.floor(f * 0.5);
1660
+ for (let M = 0; M < b; M++) {
1661
+ const P = Math.floor(M / b * S), A = _[P], W = Math.max(g, A / 255 * p * 1.1), V = M * (g + C), $ = (p - W) / 2;
1662
1662
  m(V, $, g, W);
1663
1663
  }
1664
- a.current = requestAnimationFrame(l);
1664
+ a.current = requestAnimationFrame(d);
1665
1665
  }
1666
- return a.current = requestAnimationFrame(l), () => {
1666
+ return a.current = requestAnimationFrame(d), () => {
1667
1667
  a.current !== void 0 && cancelAnimationFrame(a.current), r.disconnect();
1668
1668
  };
1669
- }, [e]), /* @__PURE__ */ n("canvas", { ref: t, className: Tt.waveform, "aria-hidden": !0 });
1669
+ }, [e]), /* @__PURE__ */ n("canvas", { ref: t, className: It.waveform, "aria-hidden": !0 });
1670
1670
  }
1671
- const va = 24, it = 2, ct = 3;
1672
- function ba(e, t, a, o, s) {
1671
+ const ya = 24, ct = 2, lt = 3;
1672
+ function Ma(e, t, a, o, s) {
1673
1673
  const i = o / 2;
1674
1674
  if (s <= o) {
1675
1675
  e.beginPath(), e.arc(t + i, a + i, i, 0, Math.PI * 2), e.fill();
@@ -1677,13 +1677,13 @@ function ba(e, t, a, o, s) {
1677
1677
  }
1678
1678
  e.beginPath(), e.moveTo(t + i, a), e.arcTo(t + o, a, t + o, a + i, i), e.lineTo(t + o, a + s - i), e.arcTo(t + o, a + s, t + i, a + s, i), e.lineTo(t + i, a + s), e.arcTo(t, a + s, t, a + s - i, i), e.lineTo(t, a + i), e.arcTo(t, a, t + i, a, i), e.closePath(), e.fill();
1679
1679
  }
1680
- function wa(e, t, a, o, s) {
1680
+ function Pa(e, t, a, o, s) {
1681
1681
  const i = window.devicePixelRatio ?? 1;
1682
1682
  e.clearRect(0, 0, t, a), e.fillStyle = "currentColor";
1683
- const r = it * i, c = ct * i, f = Math.max(
1683
+ const r = ct * i, l = lt * i, f = Math.max(
1684
1684
  1,
1685
- Math.floor(t / i / (it + ct))
1686
- ), _ = r, m = Math.round(s * f), l = new Float32Array(f);
1685
+ Math.floor(t / i / (ct + lt))
1686
+ ), _ = r, m = Math.round(s * f), d = new Float32Array(f);
1687
1687
  for (let h = 0; h < f; h++)
1688
1688
  if (o) {
1689
1689
  const p = Math.floor(h / f * o.length), g = Math.max(
@@ -1691,71 +1691,71 @@ function wa(e, t, a, o, s) {
1691
1691
  Math.floor((h + 1) / f * o.length)
1692
1692
  );
1693
1693
  let b = 0;
1694
- for (let M = p; M < g; M++) b += Math.abs(o[M]);
1695
- l[h] = b / (g - p);
1694
+ for (let C = p; C < g; C++) b += Math.abs(o[C]);
1695
+ d[h] = b / (g - p);
1696
1696
  } else
1697
- l[h] = 0.1 + 0.1 * Math.abs(Math.sin(h * 0.9)) + 0.07 * Math.abs(Math.sin(h * 1.7));
1698
- let d = 0;
1697
+ d[h] = 0.1 + 0.1 * Math.abs(Math.sin(h * 0.9)) + 0.07 * Math.abs(Math.sin(h * 1.7));
1698
+ let c = 0;
1699
1699
  for (let h = 0; h < f; h++)
1700
- l[h] > d && (d = l[h]);
1701
- const u = d > 0 ? a * 0.85 / d : 1;
1700
+ d[h] > c && (c = d[h]);
1701
+ const u = c > 0 ? a * 0.85 / c : 1;
1702
1702
  for (let h = 0; h < f; h++) {
1703
- const p = Math.max(_, l[h] * u), g = h * (r + c), b = (a - p) / 2;
1704
- e.globalAlpha = h < m ? 1 : 0.35, ba(e, g, b, r, p);
1703
+ const p = Math.max(_, d[h] * u), g = h * (r + l), b = (a - p) / 2;
1704
+ e.globalAlpha = h < m ? 1 : 0.35, Ma(e, g, b, r, p);
1705
1705
  }
1706
1706
  e.globalAlpha = 1;
1707
1707
  }
1708
1708
  function Pe(e, t, a) {
1709
- const o = window.devicePixelRatio ?? 1, s = Math.max(e.clientWidth, 60), i = Math.round(s * o), r = va * o;
1709
+ const o = window.devicePixelRatio ?? 1, s = Math.max(e.clientWidth, 60), i = Math.round(s * o), r = ya * o;
1710
1710
  e.width !== i && (e.width = i), e.height !== r && (e.height = r);
1711
- const c = e.getContext("2d");
1712
- c && wa(c, e.width, e.height, t, a);
1711
+ const l = e.getContext("2d");
1712
+ l && Pa(l, e.width, e.height, t, a);
1713
1713
  }
1714
- function Ca(e) {
1714
+ function Na(e) {
1715
1715
  return Math.min(1, Math.max(0, e));
1716
1716
  }
1717
- function lt(e, t) {
1717
+ function dt(e, t) {
1718
1718
  const a = e.getBoundingClientRect();
1719
- return Ca((t - a.left) / a.width);
1719
+ return Na((t - a.left) / a.width);
1720
1720
  }
1721
- function At({
1721
+ function Rt({
1722
1722
  audioBlob: e,
1723
1723
  progress: t,
1724
1724
  onSeek: a
1725
1725
  }) {
1726
- const o = C(null), s = C(null), i = C(t), r = C(a);
1727
- i.current = t, r.current = a, S(() => {
1726
+ const o = y(null), s = y(null), i = y(t), r = y(a);
1727
+ i.current = t, r.current = a, T(() => {
1728
1728
  const _ = o.current;
1729
1729
  if (!_) return;
1730
1730
  let m = !1;
1731
1731
  s.current = null, Pe(_, null, i.current);
1732
- const l = new ResizeObserver(() => {
1732
+ const d = new ResizeObserver(() => {
1733
1733
  m || Pe(_, s.current, i.current);
1734
1734
  });
1735
- l.observe(_);
1736
- const d = new AudioContext();
1737
- return e.arrayBuffer().then((u) => d.decodeAudioData(u)).then((u) => {
1735
+ d.observe(_);
1736
+ const c = new AudioContext();
1737
+ return e.arrayBuffer().then((u) => c.decodeAudioData(u)).then((u) => {
1738
1738
  m || (s.current = u.getChannelData(0), Pe(_, s.current, i.current));
1739
1739
  }).catch(() => {
1740
- }).finally(() => d.close()), () => {
1741
- m = !0, l.disconnect();
1740
+ }).finally(() => c.close()), () => {
1741
+ m = !0, d.disconnect();
1742
1742
  };
1743
- }, [e]), S(() => {
1743
+ }, [e]), T(() => {
1744
1744
  const _ = o.current;
1745
1745
  _ && Pe(_, s.current, t);
1746
1746
  }, [t]);
1747
- const c = v(
1747
+ const l = v(
1748
1748
  (_) => {
1749
1749
  if (!r.current) return;
1750
1750
  const m = o.current;
1751
- m && (_.preventDefault(), m.setPointerCapture(_.pointerId), r.current(lt(m, _.clientX)));
1751
+ m && (_.preventDefault(), m.setPointerCapture(_.pointerId), r.current(dt(m, _.clientX)));
1752
1752
  },
1753
1753
  []
1754
1754
  ), f = v(
1755
1755
  (_) => {
1756
1756
  if (!r.current || _.buttons === 0) return;
1757
1757
  const m = o.current;
1758
- m && r.current(lt(m, _.clientX));
1758
+ m && r.current(dt(m, _.clientX));
1759
1759
  },
1760
1760
  []
1761
1761
  );
@@ -1763,15 +1763,15 @@ function At({
1763
1763
  "canvas",
1764
1764
  {
1765
1765
  ref: o,
1766
- className: Tt.waveform,
1766
+ className: It.waveform,
1767
1767
  "data-seekable": !!a,
1768
1768
  "aria-hidden": !0,
1769
- onPointerDown: a ? c : void 0,
1769
+ onPointerDown: a ? l : void 0,
1770
1770
  onPointerMove: a ? f : void 0
1771
1771
  }
1772
1772
  );
1773
1773
  }
1774
- function ya() {
1774
+ function Sa() {
1775
1775
  return /* @__PURE__ */ n(
1776
1776
  "svg",
1777
1777
  {
@@ -1787,7 +1787,7 @@ function ya() {
1787
1787
  }
1788
1788
  );
1789
1789
  }
1790
- function It() {
1790
+ function xt() {
1791
1791
  return /* @__PURE__ */ w(
1792
1792
  "svg",
1793
1793
  {
@@ -1803,7 +1803,7 @@ function It() {
1803
1803
  }
1804
1804
  );
1805
1805
  }
1806
- function Ye() {
1806
+ function Je() {
1807
1807
  return /* @__PURE__ */ n(
1808
1808
  "svg",
1809
1809
  {
@@ -1816,7 +1816,7 @@ function Ye() {
1816
1816
  }
1817
1817
  );
1818
1818
  }
1819
- const J = {
1819
+ const te = {
1820
1820
  "recording-controls": "audio-input-module__recording-controls___Hj6Qf",
1821
1821
  "recording-controls-enter": "audio-input-module__recording-controls-enter___0w-HZ",
1822
1822
  "recording-controls-exit": "audio-input-module__recording-controls-exit___Bp3tQ",
@@ -1827,7 +1827,7 @@ const J = {
1827
1827
  "recording-timer": "audio-input-module__recording-timer___kyV0m",
1828
1828
  "preview-play-btn": "audio-input-module__preview-play-btn___WJatV"
1829
1829
  };
1830
- function Ma({
1830
+ function Ta({
1831
1831
  showControls: e,
1832
1832
  recordingControlsClassName: t,
1833
1833
  frozenIsRecording: a,
@@ -1835,26 +1835,26 @@ function Ma({
1835
1835
  analyserNode: s,
1836
1836
  audioBlob: i,
1837
1837
  audioProgress: r,
1838
- isPlaying: c,
1838
+ isPlaying: l,
1839
1839
  isPreview: f,
1840
1840
  handlePlayPause: _,
1841
1841
  handleSeekPreview: m,
1842
- handleCancelRecording: l,
1843
- timerDisplay: d,
1842
+ handleCancelRecording: d,
1843
+ timerDisplay: c,
1844
1844
  objectUrl: u,
1845
1845
  audioRef: h,
1846
1846
  handleAudioPlay: p,
1847
1847
  handleAudioPause: g,
1848
1848
  handleAudioEnded: b,
1849
- handleAudioLoadedMetadata: M,
1850
- handleAudioTimeUpdate: T
1849
+ handleAudioLoadedMetadata: C,
1850
+ handleAudioTimeUpdate: S
1851
1851
  }) {
1852
- return /* @__PURE__ */ w(Ee, { children: [
1852
+ return /* @__PURE__ */ w(Ie, { children: [
1853
1853
  e && /* @__PURE__ */ w(
1854
1854
  "div",
1855
1855
  {
1856
- className: E(
1857
- J["recording-controls"],
1856
+ className: I(
1857
+ te["recording-controls"],
1858
1858
  t
1859
1859
  ),
1860
1860
  children: [
@@ -1862,39 +1862,39 @@ function Ma({
1862
1862
  "button",
1863
1863
  {
1864
1864
  type: "button",
1865
- className: J["recording-side-btn"],
1865
+ className: te["recording-side-btn"],
1866
1866
  "aria-label": f ? "Discard recording" : "Cancel recording",
1867
- onClick: l,
1868
- children: /* @__PURE__ */ n(ya, {})
1867
+ onClick: d,
1868
+ children: /* @__PURE__ */ n(Sa, {})
1869
1869
  }
1870
1870
  ),
1871
1871
  /* @__PURE__ */ w(
1872
1872
  "div",
1873
1873
  {
1874
- className: E(
1875
- J["recording-pill"],
1876
- a ? J["recording-pill--recording"] : J["recording-pill--preview"]
1874
+ className: I(
1875
+ te["recording-pill"],
1876
+ a ? te["recording-pill--recording"] : te["recording-pill--preview"]
1877
1877
  ),
1878
1878
  children: [
1879
1879
  o && /* @__PURE__ */ n(
1880
1880
  "button",
1881
1881
  {
1882
1882
  type: "button",
1883
- className: J["preview-play-btn"],
1884
- "aria-label": c ? "Pause" : "Play recording",
1883
+ className: te["preview-play-btn"],
1884
+ "aria-label": l ? "Pause" : "Play recording",
1885
1885
  onClick: _,
1886
- children: c ? /* @__PURE__ */ n(It, {}) : /* @__PURE__ */ n(Ye, {})
1886
+ children: l ? /* @__PURE__ */ n(xt, {}) : /* @__PURE__ */ n(Je, {})
1887
1887
  }
1888
1888
  ),
1889
- a && s ? /* @__PURE__ */ n(ga, { analyserNode: s }) : o && i ? /* @__PURE__ */ n(
1890
- At,
1889
+ a && s ? /* @__PURE__ */ n(Ca, { analyserNode: s }) : o && i ? /* @__PURE__ */ n(
1890
+ Rt,
1891
1891
  {
1892
1892
  audioBlob: i,
1893
1893
  progress: r,
1894
1894
  onSeek: m
1895
1895
  }
1896
1896
  ) : null,
1897
- /* @__PURE__ */ n("span", { className: J["recording-timer"], children: d })
1897
+ /* @__PURE__ */ n("span", { className: te["recording-timer"], children: c })
1898
1898
  ]
1899
1899
  }
1900
1900
  )
@@ -1909,53 +1909,53 @@ function Ma({
1909
1909
  onPlay: p,
1910
1910
  onPause: g,
1911
1911
  onEnded: b,
1912
- onLoadedMetadata: M,
1913
- onTimeUpdate: T,
1912
+ onLoadedMetadata: C,
1913
+ onTimeUpdate: S,
1914
1914
  style: { display: "none" }
1915
1915
  }
1916
1916
  )
1917
1917
  ] });
1918
1918
  }
1919
- function Pa() {
1919
+ function Aa() {
1920
1920
  return typeof window < "u" && typeof navigator.mediaDevices?.getUserMedia == "function" && typeof MediaRecorder < "u";
1921
1921
  }
1922
- function Na() {
1922
+ function Ea() {
1923
1923
  const [e, t] = N("idle"), [a, o] = N(void 0), [s, i] = N(
1924
1924
  void 0
1925
- ), [r, c] = N(!1), f = Pa(), _ = C(void 0), m = C(void 0), l = C(void 0), d = C([]), u = v(() => {
1926
- m.current?.getTracks().forEach((b) => b.stop()), m.current = void 0, l.current?.close(), l.current = void 0, i(void 0);
1925
+ ), [r, l] = N(!1), f = Aa(), _ = y(void 0), m = y(void 0), d = y(void 0), c = y([]), u = v(() => {
1926
+ m.current?.getTracks().forEach((b) => b.stop()), m.current = void 0, d.current?.close(), d.current = void 0, i(void 0);
1927
1927
  }, []), h = v(async () => {
1928
1928
  if (!f || e !== "idle") return;
1929
- c(!1);
1929
+ l(!1);
1930
1930
  let b;
1931
1931
  try {
1932
1932
  b = await navigator.mediaDevices.getUserMedia({ audio: !0 });
1933
1933
  } catch (A) {
1934
- A instanceof Error && A.name === "NotAllowedError" && c(!0);
1934
+ A instanceof Error && A.name === "NotAllowedError" && l(!0);
1935
1935
  return;
1936
1936
  }
1937
1937
  m.current = b;
1938
- const M = new AudioContext();
1939
- l.current = M;
1940
- const T = M.createMediaStreamSource(b), y = M.createAnalyser();
1941
- y.fftSize = 256, T.connect(y), i(y), d.current = [];
1938
+ const C = new AudioContext();
1939
+ d.current = C;
1940
+ const S = C.createMediaStreamSource(b), M = C.createAnalyser();
1941
+ M.fftSize = 256, S.connect(M), i(M), c.current = [];
1942
1942
  const P = new MediaRecorder(b);
1943
1943
  _.current = P, P.ondataavailable = (A) => {
1944
- A.data.size > 0 && d.current.push(A.data);
1944
+ A.data.size > 0 && c.current.push(A.data);
1945
1945
  }, P.start(), t("recording");
1946
1946
  }, [f, e]), p = v(() => {
1947
1947
  const b = _.current;
1948
1948
  !b || e !== "recording" || (b.onstop = () => {
1949
- const M = new Blob(d.current, {
1949
+ const C = new Blob(c.current, {
1950
1950
  type: b.mimeType || "audio/webm"
1951
1951
  });
1952
- o(M), t("preview");
1952
+ o(C), t("preview");
1953
1953
  }, b.stop(), u());
1954
1954
  }, [e, u]), g = v(() => {
1955
1955
  const b = _.current;
1956
- b && b.state !== "inactive" && (b.onstop = null, b.stop()), u(), d.current = [], o(void 0), t("idle");
1956
+ b && b.state !== "inactive" && (b.onstop = null, b.stop()), u(), c.current = [], o(void 0), t("idle");
1957
1957
  }, [u]);
1958
- return S(() => () => {
1958
+ return T(() => () => {
1959
1959
  const b = _.current;
1960
1960
  b && b.state !== "inactive" && (b.onstop = null, b.stop()), u();
1961
1961
  }, [u]), {
@@ -1969,58 +1969,58 @@ function Na() {
1969
1969
  cancelRecording: g
1970
1970
  };
1971
1971
  }
1972
- function Ie(e) {
1972
+ function Ee(e) {
1973
1973
  const t = String(Math.floor(e / 60)).padStart(2, "0"), a = String(Math.floor(e % 60)).padStart(2, "0");
1974
1974
  return `${t}:${a}`;
1975
1975
  }
1976
- const Ge = "audio-recording", de = "audio-preview", Sa = 120;
1977
- function Ta(e) {
1976
+ const Ge = "audio-recording", de = "audio-preview", Ia = 120;
1977
+ function Ra(e) {
1978
1978
  return new Promise((t, a) => {
1979
1979
  const o = new FileReader();
1980
1980
  o.onloadend = () => t(o.result), o.onerror = a, o.readAsDataURL(e);
1981
1981
  });
1982
1982
  }
1983
- function Aa(e) {
1984
- const [t, a] = N(e), [o, s] = N(!1), i = C();
1985
- return S(() => (e ? (clearTimeout(i.current), a(!0), s(!1)) : (s(!0), i.current = setTimeout(() => {
1983
+ function xa(e) {
1984
+ const [t, a] = N(e), [o, s] = N(!1), i = y();
1985
+ return T(() => (e ? (clearTimeout(i.current), a(!0), s(!1)) : (s(!0), i.current = setTimeout(() => {
1986
1986
  a(!1), s(!1);
1987
- }, Sa)), () => {
1987
+ }, Ia)), () => {
1988
1988
  clearTimeout(i.current);
1989
1989
  }), [e]), { showControls: t, isExiting: o };
1990
1990
  }
1991
- function Ia(e, t) {
1992
- const { controller: a } = U(), { activeId: o, setActive: s, clearActive: i } = Le(), {
1991
+ function La(e, t) {
1992
+ const { controller: a } = z(), { activeId: o, setActive: s, clearActive: i } = Le(), {
1993
1993
  recorderState: r,
1994
- audioBlob: c,
1994
+ audioBlob: l,
1995
1995
  analyserNode: f,
1996
1996
  isSupported: _,
1997
1997
  startRecording: m,
1998
- confirmRecording: l,
1999
- cancelRecording: d
2000
- } = Na(), u = e.webchatClientSettingsBehaviors.input.isAudioRecordingVisible && _, [h, p] = N(0), g = C(
1998
+ confirmRecording: d,
1999
+ cancelRecording: c
2000
+ } = Ea(), u = e.webchatClientSettingsBehaviors.input.isAudioRecordingVisible && _, [h, p] = N(0), g = y(
2001
2001
  void 0
2002
- ), b = C(null), [M, T] = N(""), [y, P] = N(!1), [A, W] = N(0), [V, $] = N(0);
2003
- S(() => (r === "recording" ? (p(0), g.current = setInterval(() => {
2002
+ ), b = y(null), [C, S] = N(""), [M, P] = N(!1), [A, W] = N(0), [V, $] = N(0);
2003
+ T(() => (r === "recording" ? (p(0), g.current = setInterval(() => {
2004
2004
  p((R) => R + 1);
2005
- }, 1e3)) : (clearInterval(g.current), r === "idle" && (p(0), W(0), $(0), P(!1))), () => clearInterval(g.current)), [r]), S(() => {
2006
- if (!c) {
2007
- T("");
2005
+ }, 1e3)) : (clearInterval(g.current), r === "idle" && (p(0), W(0), $(0), P(!1))), () => clearInterval(g.current)), [r]), T(() => {
2006
+ if (!l) {
2007
+ S("");
2008
2008
  return;
2009
2009
  }
2010
- const R = URL.createObjectURL(c);
2011
- return T(R), () => URL.revokeObjectURL(R);
2012
- }, [c]);
2013
- const j = Ie(r === "recording" ? h : y ? V : A), q = A > 0 ? V / A : 0;
2014
- S(() => {
2015
- o !== de && y && b.current?.pause();
2016
- }, [o, y]);
2010
+ const R = URL.createObjectURL(l);
2011
+ return S(R), () => URL.revokeObjectURL(R);
2012
+ }, [l]);
2013
+ const q = Ee(r === "recording" ? h : M ? V : A), G = A > 0 ? V / A : 0;
2014
+ T(() => {
2015
+ o !== de && M && b.current?.pause();
2016
+ }, [o, M]);
2017
2017
  const B = v(() => {
2018
2018
  P(!0), s(de);
2019
- }, [s]), G = v(() => {
2019
+ }, [s]), K = v(() => {
2020
2020
  P(!1), i(de);
2021
- }, [i]), ee = v(() => {
2021
+ }, [i]), ne = v(() => {
2022
2022
  P(!1), i(de);
2023
- }, [i]), Q = v(
2023
+ }, [i]), J = v(
2024
2024
  (R) => {
2025
2025
  W(Math.round(R.currentTarget.duration));
2026
2026
  },
@@ -2032,20 +2032,20 @@ function Ia(e, t) {
2032
2032
  []
2033
2033
  ), ke = v(() => {
2034
2034
  const R = b.current;
2035
- R && (y ? R.pause() : R.play().catch(() => P(!1)));
2036
- }, [y]), De = v(() => {
2035
+ R && (M ? R.pause() : R.play().catch(() => P(!1)));
2036
+ }, [M]), De = v(() => {
2037
2037
  u && (s(Ge), m());
2038
2038
  }, [u, s, m]), Oe = v(() => {
2039
- i(Ge), l();
2040
- }, [i, l]), We = v(() => {
2041
- i(Ge), i(de), d();
2042
- }, [i, d]), ce = v(
2039
+ i(Ge), d();
2040
+ }, [i, d]), We = v(() => {
2041
+ i(Ge), i(de), c();
2042
+ }, [i, c]), ce = v(
2043
2043
  (R) => {
2044
2044
  !b.current || A === 0 || (b.current.currentTime = R * A, $(Math.round(b.current.currentTime)));
2045
2045
  },
2046
2046
  [A]
2047
2047
  ), Ve = v(() => {
2048
- b.current?.pause(), i(de), c && Ta(c).then((R) => {
2048
+ b.current?.pause(), i(de), l && Ra(l).then((R) => {
2049
2049
  const je = Qe.createAudio({
2050
2050
  attachmentContent: R,
2051
2051
  metadata: { sent_by: me.User }
@@ -2053,15 +2053,15 @@ function Ia(e, t) {
2053
2053
  a.sendMessage(je);
2054
2054
  }).catch(() => {
2055
2055
  }).finally(() => {
2056
- d();
2056
+ c();
2057
2057
  });
2058
- }, [c, a, d, i]), he = r !== "idle", { showControls: $e, isExiting: fe } = Aa(he), pe = C(r);
2058
+ }, [l, a, c, i]), he = r !== "idle", { showControls: $e, isExiting: fe } = xa(he), pe = y(r);
2059
2059
  he && (pe.current = r);
2060
- const He = pe.current === "recording", ae = pe.current === "preview", K = r === "preview", Fe = r === "recording", Ue = he, ze = fe ? J["recording-controls-exit"] : J["recording-controls-enter"];
2060
+ const He = pe.current === "recording", ae = pe.current === "preview", X = r === "preview", Fe = r === "recording", Ue = he, ze = fe ? te["recording-controls-exit"] : te["recording-controls-enter"];
2061
2061
  return {
2062
2062
  audioRecordingAvailable: u,
2063
2063
  hideBaseContent: Ue,
2064
- isPreview: K,
2064
+ isPreview: X,
2065
2065
  isRecording: Fe,
2066
2066
  handleMicrophoneClick: De,
2067
2067
  handleConfirmRecording: Oe,
@@ -2072,28 +2072,28 @@ function Ia(e, t) {
2072
2072
  frozenIsRecording: He,
2073
2073
  frozenIsPreview: ae,
2074
2074
  analyserNode: f,
2075
- audioBlob: c,
2076
- audioProgress: q,
2077
- isPlaying: y,
2078
- isPreview: K,
2075
+ audioBlob: l,
2076
+ audioProgress: G,
2077
+ isPlaying: M,
2078
+ isPreview: X,
2079
2079
  handlePlayPause: ke,
2080
2080
  handleSeekPreview: ce,
2081
2081
  handleCancelRecording: We,
2082
- timerDisplay: j,
2083
- objectUrl: M,
2082
+ timerDisplay: q,
2083
+ objectUrl: C,
2084
2084
  audioRef: b,
2085
2085
  handleAudioPlay: B,
2086
- handleAudioPause: G,
2087
- handleAudioEnded: ee,
2088
- handleAudioLoadedMetadata: Q,
2086
+ handleAudioPause: K,
2087
+ handleAudioEnded: ne,
2088
+ handleAudioLoadedMetadata: J,
2089
2089
  handleAudioTimeUpdate: Ce
2090
2090
  }
2091
2091
  };
2092
2092
  }
2093
- function Ea() {
2093
+ function Ba() {
2094
2094
  return /* @__PURE__ */ n("svg", { ...re, viewBox: "0 0 448 512", children: /* @__PURE__ */ n("path", { d: "M364.2 83.8c-24.4-24.4-64-24.4-88.4 0l-184 184c-42.1 42.1-42.1 110.3 0 152.4s110.3 42.1 152.4 0l152-152c10.9-10.9 28.7-10.9 39.6 0s10.9 28.7 0 39.6l-152 152c-64 64-167.6 64-231.6 0s-64-167.6 0-231.6l184-184c46.3-46.3 121.3-46.3 167.6 0s46.3 121.3 0 167.6l-176 176c-28.6 28.6-75 28.6-103.6 0s-28.6-75 0-103.6l144-144c10.9-10.9 28.7-10.9 39.6 0s10.9 28.7 0 39.6l-144 144c-6.7 6.7-6.7 17.7 0 24.4s17.7 6.7 24.4 0l176-176c24.4-24.4 24.4-64 0-88.4z" }) });
2095
2095
  }
2096
- function Ra() {
2096
+ function ka() {
2097
2097
  return /* @__PURE__ */ n(
2098
2098
  "svg",
2099
2099
  {
@@ -2110,10 +2110,10 @@ function Ra() {
2110
2110
  }
2111
2111
  );
2112
2112
  }
2113
- function xa() {
2113
+ function Da() {
2114
2114
  return /* @__PURE__ */ n("svg", { ...re, children: /* @__PURE__ */ n("path", { d: "M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm177.6 62.1C192.8 334.5 218.8 352 256 352s63.2-17.5 78.4-33.9c9-9.7 24.2-10.4 33.9-1.4s10.4 24.2 1.4 33.9c-22 23.8-60 49.4-113.6 49.4s-91.7-25.5-113.6-49.4c-9-9.7-8.4-24.9 1.4-33.9s24.9-8.4 33.9 1.4zM144.4 208a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm192-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z" }) });
2115
2115
  }
2116
- function La() {
2116
+ function Oa() {
2117
2117
  return /* @__PURE__ */ n(
2118
2118
  "svg",
2119
2119
  {
@@ -2130,15 +2130,15 @@ function La() {
2130
2130
  }
2131
2131
  );
2132
2132
  }
2133
- function dt() {
2133
+ function ut() {
2134
2134
  return /* @__PURE__ */ n("svg", { ...re, children: /* @__PURE__ */ n("path", { d: "M57.6 35.8C23.1 20.6-11.3 57.4 6.1 90.9l63 121.2c4.4 8.4 12.6 14.1 22 15.3L266 249.3c3.4 .4 6 3.3 6 6.7s-2.6 6.3-6 6.7L91.1 284.6c-9.4 1.2-17.6 6.9-22 15.3L6.1 421.1c-17.4 33.5 17 70.2 51.6 55.1L492.9 285.3c25.5-11.2 25.5-47.4 0-58.6L57.6 35.8z" }) });
2135
2135
  }
2136
- const Ba = "webchat-input-module__base___TZXU7", ka = "webchat-input-module__branding___ReLzJ", I = {
2136
+ const Wa = "webchat-input-module__base___TZXU7", Va = "webchat-input-module__branding___ReLzJ", E = {
2137
2137
  default: "webchat-input-module__default___tHS5e",
2138
- base: Ba,
2138
+ base: Wa,
2139
2139
  "input-form": "webchat-input-module__input-form___GnKc7",
2140
2140
  "input-row": "webchat-input-module__input-row___uqTs6",
2141
- branding: ka,
2141
+ branding: Va,
2142
2142
  "input-form--active": "webchat-input-module__input-form--active___ZioHn",
2143
2143
  "input-field": "webchat-input-module__input-field___c4r26",
2144
2144
  "primary-action-base": "webchat-input-module__primary-action-base___UfC2U",
@@ -2156,7 +2156,7 @@ const Ba = "webchat-input-module__base___TZXU7", ka = "webchat-input-module__bra
2156
2156
  "action-bar": "webchat-input-module__action-bar___gEuJH",
2157
2157
  "content-hidden": "webchat-input-module__content-hidden___9pFoD"
2158
2158
  };
2159
- function Da(e, t) {
2159
+ function $a(e, t) {
2160
2160
  const a = e.trim();
2161
2161
  return a ? t.some((o) => {
2162
2162
  if (o.message && a === o.message)
@@ -2169,70 +2169,70 @@ function Da(e, t) {
2169
2169
  }
2170
2170
  }) : !1;
2171
2171
  }
2172
- function Oa(e, t, a) {
2173
- const { controller: o } = U(), {
2172
+ function Ha(e, t, a) {
2173
+ const { controller: o } = z(), {
2174
2174
  placeholder: s = "Message...",
2175
2175
  disabled: i,
2176
2176
  variant: r = "default",
2177
- showBranding: c = !0,
2177
+ showBranding: l = !0,
2178
2178
  "aria-label": f,
2179
2179
  className: _,
2180
2180
  onEmojiClick: m,
2181
- onAttachmentClick: l,
2182
- onMicrophoneClick: d,
2181
+ onAttachmentClick: d,
2182
+ onMicrophoneClick: c,
2183
2183
  onUserMessageSent: u,
2184
2184
  ...h
2185
- } = e, [p, g] = N(""), b = C(""), M = t.webchatClientSettingsBehaviors.input, T = M.isTextInputEnabled && !i, y = Da(
2185
+ } = e, [p, g] = N(""), b = y(""), C = t.webchatClientSettingsBehaviors.input, S = C.isTextInputEnabled && !i, M = $a(
2186
2186
  p,
2187
- M.blockInputs
2187
+ C.blockInputs
2188
2188
  ), P = p.trim().length > 0, {
2189
2189
  hasAttachments: A,
2190
2190
  attachmentError: W,
2191
2191
  fileInputRef: V,
2192
2192
  handleFileInputChange: $,
2193
- handleOpenFilePicker: j,
2194
- sendAttachments: q,
2193
+ handleOpenFilePicker: q,
2194
+ sendAttachments: G,
2195
2195
  attachmentListProps: B
2196
- } = ma(), {
2197
- audioRecordingAvailable: G,
2198
- hideBaseContent: ee,
2199
- isPreview: Q,
2196
+ } = pa(), {
2197
+ audioRecordingAvailable: K,
2198
+ hideBaseContent: ne,
2199
+ isPreview: J,
2200
2200
  isRecording: Ce,
2201
2201
  handleMicrophoneClick: ke,
2202
2202
  handleConfirmRecording: De,
2203
2203
  handleSendRecording: Oe,
2204
2204
  overlayProps: We
2205
- } = Ia(t), ce = v(() => {
2206
- if (!T || y) return;
2207
- const X = b.current.trim();
2208
- if (X) {
2205
+ } = La(t), ce = v(() => {
2206
+ if (!S || M) return;
2207
+ const Z = b.current.trim();
2208
+ if (Z) {
2209
2209
  const ye = Qe.createText({
2210
- text: X,
2210
+ text: Z,
2211
2211
  metadata: {
2212
2212
  sent_by: me.User
2213
2213
  }
2214
2214
  });
2215
2215
  u?.(), o.sendMessage(ye), b.current = "", g("");
2216
2216
  }
2217
- }, [o, T, y, u]), Ve = v(
2218
- (X) => {
2219
- X.preventDefault(), A && q(), ce();
2217
+ }, [o, S, M, u]), Ve = v(
2218
+ (Z) => {
2219
+ Z.preventDefault(), A && G(), ce();
2220
2220
  },
2221
- [A, q, ce]
2221
+ [A, G, ce]
2222
2222
  ), he = v(
2223
- (X) => {
2224
- const ye = X.target.value;
2223
+ (Z) => {
2224
+ const ye = Z.target.value;
2225
2225
  b.current = ye, g(ye);
2226
2226
  },
2227
2227
  []
2228
2228
  ), $e = v(
2229
- (X) => {
2230
- X.key === "Enter" && !X.shiftKey && (X.preventDefault(), ce());
2229
+ (Z) => {
2230
+ Z.key === "Enter" && !Z.shiftKey && (Z.preventDefault(), ce());
2231
2231
  },
2232
2232
  [ce]
2233
- ), fe = P || A, pe = G ? !!i || !T || P && y : !!i || !T || !fe || P && y, He = G ? fe ? "submit" : "button" : "submit", ae = !Ce && !Q && G && !fe, K = Ce, Fe = !ae && !K, Ue = ae ? I["primary-action-mic"] : K ? I["primary-action-confirm"] : I["primary-action-send"], ze = K || Q ? "button" : He, tt = K ? !1 : pe, R = K ? De : Q ? Oe : ae ? ke : void 0, je = ae ? "Record voice message" : K ? "Confirm recording" : "Send message", Ot = v(() => {
2234
- j(), l?.();
2235
- }, [j, l]);
2233
+ ), fe = P || A, pe = K ? !!i || !S || P && M : !!i || !S || !fe || P && M, He = K ? fe ? "submit" : "button" : "submit", ae = !Ce && !J && K && !fe, X = Ce, Fe = !ae && !X, Ue = ae ? E["primary-action-mic"] : X ? E["primary-action-confirm"] : E["primary-action-send"], ze = X || J ? "button" : He, nt = X ? !1 : pe, R = X ? De : J ? Oe : ae ? ke : void 0, je = ae ? "Record voice message" : X ? "Confirm recording" : "Send message", $t = v(() => {
2234
+ q(), d?.();
2235
+ }, [q, d]);
2236
2236
  return {
2237
2237
  // Input wrapper props
2238
2238
  inputProps: {
@@ -2246,7 +2246,7 @@ function Oa(e, t, a) {
2246
2246
  hasText: P,
2247
2247
  handleSubmit: Ve,
2248
2248
  onEmojiClick: m,
2249
- onAttachmentClick: Ot,
2249
+ onAttachmentClick: $t,
2250
2250
  // Attachment preview
2251
2251
  hasAttachments: A,
2252
2252
  attachmentError: W,
@@ -2259,7 +2259,7 @@ function Oa(e, t, a) {
2259
2259
  onChange: he,
2260
2260
  onKeyDown: $e,
2261
2261
  placeholder: s,
2262
- disabled: !T,
2262
+ disabled: !S,
2263
2263
  rows: 1
2264
2264
  // minimum rows; CSS field-sizing: content allows growth up to --webchat-input-max-rows
2265
2265
  },
@@ -2268,96 +2268,96 @@ function Oa(e, t, a) {
2268
2268
  variant: r,
2269
2269
  className: _
2270
2270
  },
2271
- isInputEnabled: T,
2271
+ isInputEnabled: S,
2272
2272
  isInputDisabled: i,
2273
- inputBehavior: M,
2274
- showBranding: c,
2273
+ inputBehavior: C,
2274
+ showBranding: l,
2275
2275
  // Audio overlay (passed to AudioInput)
2276
2276
  overlayProps: We,
2277
- hideBaseContent: ee,
2278
- audioRecordingAvailable: G,
2277
+ hideBaseContent: ne,
2278
+ audioRecordingAvailable: K,
2279
2279
  // Primary action button
2280
2280
  primaryBgClass: Ue,
2281
2281
  primaryType: ze,
2282
- isPrimaryDisabled: tt,
2282
+ isPrimaryDisabled: nt,
2283
2283
  primaryHandler: R,
2284
2284
  primaryLabel: je,
2285
2285
  // Action bar
2286
2286
  showMic: ae,
2287
- showConfirm: K,
2287
+ showConfirm: X,
2288
2288
  showSend: Fe
2289
2289
  };
2290
2290
  }
2291
- const Wa = F(I.base, {
2291
+ const Fa = F(E.base, {
2292
2292
  variants: {
2293
2293
  variant: {
2294
- default: I.default
2294
+ default: E.default
2295
2295
  }
2296
2296
  },
2297
2297
  defaultVariants: {
2298
2298
  variant: "default"
2299
2299
  }
2300
2300
  });
2301
- function Va(e) {
2302
- const { state: t } = U(), a = C(null), {
2301
+ function Ua(e) {
2302
+ const { state: t } = z(), a = y(null), {
2303
2303
  inputProps: o,
2304
2304
  handleSubmit: s,
2305
2305
  fieldProps: i,
2306
2306
  variants: r,
2307
- showBranding: c,
2307
+ showBranding: l,
2308
2308
  onEmojiClick: f,
2309
2309
  onAttachmentClick: _,
2310
2310
  isInputDisabled: m,
2311
- inputBehavior: l,
2312
- overlayProps: d,
2311
+ inputBehavior: d,
2312
+ overlayProps: c,
2313
2313
  hideBaseContent: u,
2314
2314
  audioRecordingAvailable: h,
2315
2315
  primaryBgClass: p,
2316
2316
  primaryType: g,
2317
2317
  isPrimaryDisabled: b,
2318
- primaryHandler: M,
2319
- primaryLabel: T,
2320
- showMic: y,
2318
+ primaryHandler: C,
2319
+ primaryLabel: S,
2320
+ showMic: M,
2321
2321
  showConfirm: P,
2322
2322
  showSend: A,
2323
2323
  hasAttachments: W,
2324
2324
  attachmentError: V,
2325
2325
  fileInputRef: $,
2326
- handleFileInputChange: j,
2327
- attachmentListProps: q
2328
- } = Oa(e, t, a), { icons: B } = e;
2329
- if (!l.isComposerVisible)
2326
+ handleFileInputChange: q,
2327
+ attachmentListProps: G
2328
+ } = Ha(e, t, a), { icons: B } = e;
2329
+ if (!d.isComposerVisible)
2330
2330
  return null;
2331
- const G = c ? /* @__PURE__ */ n("p", { className: I.branding, children: "Powered by Hubtype" }) : void 0;
2331
+ const K = l ? /* @__PURE__ */ n("p", { className: E.branding, children: "Powered by Hubtype" }) : void 0;
2332
2332
  return /* @__PURE__ */ w(
2333
2333
  "div",
2334
2334
  {
2335
2335
  ...o,
2336
- className: Wa(r),
2336
+ className: Fa(r),
2337
2337
  "data-webchat-input": !0,
2338
- "data-attachments-enabled": String(l.areAttachmentsVisible),
2339
- "data-emoji-picker-enabled": String(l.isEmojiPickerVisible),
2338
+ "data-attachments-enabled": String(d.areAttachmentsVisible),
2339
+ "data-emoji-picker-enabled": String(d.isEmojiPickerVisible),
2340
2340
  children: [
2341
- /* @__PURE__ */ n("div", { className: I["input-container"], children: /* @__PURE__ */ w(
2341
+ /* @__PURE__ */ n("div", { className: E["input-container"], children: /* @__PURE__ */ w(
2342
2342
  "form",
2343
2343
  {
2344
2344
  onSubmit: s,
2345
- className: E(
2346
- I["input-form"],
2347
- u && I["input-form--active"]
2345
+ className: I(
2346
+ E["input-form"],
2347
+ u && E["input-form--active"]
2348
2348
  ),
2349
2349
  children: [
2350
- W && /* @__PURE__ */ n(sa, { ...q }),
2351
- V && /* @__PURE__ */ n("p", { className: I["attachment-error"], role: "alert", children: V }),
2352
- /* @__PURE__ */ w("div", { className: I["input-row"], children: [
2353
- h && /* @__PURE__ */ n(Ma, { ...d }),
2350
+ W && /* @__PURE__ */ n(la, { ...G }),
2351
+ V && /* @__PURE__ */ n("p", { className: E["attachment-error"], role: "alert", children: V }),
2352
+ /* @__PURE__ */ w("div", { className: E["input-row"], children: [
2353
+ h && /* @__PURE__ */ n(Ta, { ...c }),
2354
2354
  /* @__PURE__ */ n(
2355
2355
  "textarea",
2356
2356
  {
2357
2357
  ...i,
2358
- className: E(
2359
- I["input-field"],
2360
- u && I["content-hidden"]
2358
+ className: I(
2359
+ E["input-field"],
2360
+ u && E["content-hidden"]
2361
2361
  ),
2362
2362
  inert: u ? "" : void 0
2363
2363
  }
@@ -2365,34 +2365,34 @@ function Va(e) {
2365
2365
  /* @__PURE__ */ w(
2366
2366
  "div",
2367
2367
  {
2368
- className: E(
2369
- I["action-bar"],
2370
- u && I["content-hidden"]
2368
+ className: I(
2369
+ E["action-bar"],
2370
+ u && E["content-hidden"]
2371
2371
  ),
2372
2372
  role: "group",
2373
2373
  "aria-label": "Message actions",
2374
2374
  inert: u ? "" : void 0,
2375
2375
  children: [
2376
- l.isEmojiPickerVisible && /* @__PURE__ */ n(
2376
+ d.isEmojiPickerVisible && /* @__PURE__ */ n(
2377
2377
  "button",
2378
2378
  {
2379
2379
  type: "button",
2380
- className: I["action-button"],
2380
+ className: E["action-button"],
2381
2381
  "aria-label": "Emoji",
2382
2382
  disabled: m,
2383
2383
  onClick: f,
2384
- children: B?.emoji ?? /* @__PURE__ */ n(xa, {})
2384
+ children: B?.emoji ?? /* @__PURE__ */ n(Da, {})
2385
2385
  }
2386
2386
  ),
2387
- l.areAttachmentsVisible && /* @__PURE__ */ n(
2387
+ d.areAttachmentsVisible && /* @__PURE__ */ n(
2388
2388
  "button",
2389
2389
  {
2390
2390
  type: "button",
2391
- className: I["action-button"],
2391
+ className: E["action-button"],
2392
2392
  "aria-label": "Attach file",
2393
2393
  disabled: m,
2394
2394
  onClick: _,
2395
- children: B?.attachment ?? /* @__PURE__ */ n(Ea, {})
2395
+ children: B?.attachment ?? /* @__PURE__ */ n(Ba, {})
2396
2396
  }
2397
2397
  )
2398
2398
  ]
@@ -2402,48 +2402,48 @@ function Va(e) {
2402
2402
  "button",
2403
2403
  {
2404
2404
  type: g,
2405
- className: E(I["primary-action-base"], p),
2405
+ className: I(E["primary-action-base"], p),
2406
2406
  disabled: b,
2407
- "aria-label": T,
2408
- onClick: M,
2409
- children: /* @__PURE__ */ n("span", { className: I["icon-slot"], children: h ? /* @__PURE__ */ w(Ee, { children: [
2407
+ "aria-label": S,
2408
+ onClick: C,
2409
+ children: /* @__PURE__ */ n("span", { className: E["icon-slot"], children: h ? /* @__PURE__ */ w(Ie, { children: [
2410
2410
  /* @__PURE__ */ n(
2411
2411
  "span",
2412
2412
  {
2413
2413
  "aria-hidden": !0,
2414
- className: E(I["icon-face"], I["icon-mic"]),
2415
- "data-visible": y ? "true" : "false",
2416
- children: B?.microphone ?? /* @__PURE__ */ n(La, {})
2414
+ className: I(E["icon-face"], E["icon-mic"]),
2415
+ "data-visible": M ? "true" : "false",
2416
+ children: B?.microphone ?? /* @__PURE__ */ n(Oa, {})
2417
2417
  }
2418
2418
  ),
2419
2419
  /* @__PURE__ */ n(
2420
2420
  "span",
2421
2421
  {
2422
2422
  "aria-hidden": !0,
2423
- className: E(
2424
- I["icon-face"],
2425
- I["icon-confirm"]
2423
+ className: I(
2424
+ E["icon-face"],
2425
+ E["icon-confirm"]
2426
2426
  ),
2427
2427
  "data-visible": P ? "true" : "false",
2428
- children: /* @__PURE__ */ n(Ra, {})
2428
+ children: /* @__PURE__ */ n(ka, {})
2429
2429
  }
2430
2430
  ),
2431
2431
  /* @__PURE__ */ n(
2432
2432
  "span",
2433
2433
  {
2434
2434
  "aria-hidden": !0,
2435
- className: E(I["icon-face"], I["icon-send"]),
2435
+ className: I(E["icon-face"], E["icon-send"]),
2436
2436
  "data-visible": A ? "true" : "false",
2437
- children: B?.send ?? /* @__PURE__ */ n(dt, {})
2437
+ children: B?.send ?? /* @__PURE__ */ n(ut, {})
2438
2438
  }
2439
2439
  )
2440
2440
  ] }) : /* @__PURE__ */ n(
2441
2441
  "span",
2442
2442
  {
2443
2443
  "aria-hidden": !0,
2444
- className: E(I["icon-face"], I["icon-send"]),
2444
+ className: I(E["icon-face"], E["icon-send"]),
2445
2445
  "data-visible": "true",
2446
- children: B?.send ?? /* @__PURE__ */ n(dt, {})
2446
+ children: B?.send ?? /* @__PURE__ */ n(ut, {})
2447
2447
  }
2448
2448
  ) })
2449
2449
  }
@@ -2454,8 +2454,8 @@ function Va(e) {
2454
2454
  {
2455
2455
  ref: $,
2456
2456
  type: "file",
2457
- accept: la,
2458
- onChange: j,
2457
+ accept: _a,
2458
+ onChange: q,
2459
2459
  style: { display: "none" },
2460
2460
  "aria-hidden": !0,
2461
2461
  tabIndex: -1
@@ -2464,73 +2464,98 @@ function Va(e) {
2464
2464
  ]
2465
2465
  }
2466
2466
  ) }),
2467
- G
2467
+ K
2468
2468
  ]
2469
2469
  }
2470
2470
  );
2471
2471
  }
2472
- const $a = "message-bubble-module__base___WzTAP", Ha = "message-bubble-module__bot___PcXmL", Fa = "message-bubble-module__agent___WGfzX", Ua = "message-bubble-module__user___lFMMm", za = "message-bubble-module__system___e8-FD", ja = "message-bubble-module__sending___P9nK-", qa = "message-bubble-module__error___mine7", te = {
2473
- base: $a,
2474
- bot: Ha,
2475
- agent: Fa,
2476
- user: Ua,
2477
- system: za,
2478
- sending: ja,
2479
- error: qa
2480
- }, Ga = F(te.base, {
2472
+ function Xe(e) {
2473
+ if (!e) return;
2474
+ const t = e.replace(/-/g, "");
2475
+ if (t.length < 16 || parseInt(t[12], 16) !== 7) return;
2476
+ const o = parseInt(t.slice(0, 12), 16);
2477
+ if (!(!Number.isFinite(o) || o <= 0))
2478
+ return new Date(o);
2479
+ }
2480
+ const za = "message-bubble-module__base___WzTAP", ja = "message-bubble-module__bot___PcXmL", qa = "message-bubble-module__agent___WGfzX", Ga = "message-bubble-module__user___lFMMm", Ka = "message-bubble-module__system___e8-FD", Xa = "message-bubble-module__sending___P9nK-", Za = "message-bubble-module__error___mine7", Q = {
2481
+ base: za,
2482
+ bot: ja,
2483
+ agent: qa,
2484
+ user: Ga,
2485
+ "flat-top-corner": "message-bubble-module__flat-top-corner___CLxP2",
2486
+ "flat-bottom-corner": "message-bubble-module__flat-bottom-corner___DrB7C",
2487
+ system: Ka,
2488
+ sending: Xa,
2489
+ error: Za
2490
+ }, Qa = F(Q.base, {
2481
2491
  variants: {
2482
2492
  variant: {
2483
- user: te.user,
2484
- bot: te.bot,
2485
- system: te.system,
2486
- agent: te.agent
2493
+ user: Q.user,
2494
+ bot: Q.bot,
2495
+ system: Q.system,
2496
+ agent: Q.agent
2487
2497
  },
2488
2498
  status: {
2489
- sending: te.sending,
2490
- sent: te.sent,
2491
- error: te.error
2499
+ sending: Q.sending,
2500
+ sent: Q.sent,
2501
+ error: Q.error
2502
+ },
2503
+ flatTopCorner: {
2504
+ true: Q["flat-top-corner"]
2505
+ },
2506
+ flatBottomCorner: {
2507
+ true: Q["flat-bottom-corner"]
2492
2508
  }
2493
2509
  },
2494
2510
  defaultVariants: { variant: "bot", status: "sent" }
2495
- }), Je = O(
2496
- ({ variant: e = "bot", status: t = "sent", children: a, className: o }, s) => /* @__PURE__ */ n(
2511
+ }), et = O(
2512
+ ({
2513
+ variant: e = "bot",
2514
+ status: t = "sent",
2515
+ flatTopCorner: a,
2516
+ flatBottomCorner: o,
2517
+ children: s,
2518
+ className: i
2519
+ }, r) => /* @__PURE__ */ n(
2497
2520
  "div",
2498
2521
  {
2499
- ref: s,
2500
- className: Ga({
2522
+ ref: r,
2523
+ className: Qa({
2501
2524
  variant: e,
2502
2525
  status: t,
2503
- className: o
2526
+ flatTopCorner: a,
2527
+ flatBottomCorner: o,
2528
+ className: i
2504
2529
  }),
2505
2530
  "data-webchat-message-bubble": !0,
2506
- children: a
2531
+ children: s
2507
2532
  }
2508
2533
  )
2509
- ), Ka = "typing-message-module__typingDot___cCobM", Xa = "typing-message-module__typingDots___LwFeC", Ne = {
2510
- typingDot: Ka,
2511
- typingDots: Xa
2512
- }, Za = ({
2534
+ ), Ya = "typing-message-module__typingDot___cCobM", Ja = "typing-message-module__typingDots___LwFeC", Ne = {
2535
+ typingDot: Ya,
2536
+ typingDots: Ja
2537
+ }, es = ({
2513
2538
  isVisible: e = !1,
2514
2539
  className: t
2515
- }) => e ? /* @__PURE__ */ n(Je, { variant: "bot", className: t, children: /* @__PURE__ */ w("div", { "data-testid": "typing-indicator", className: Ne.typingDots, children: [
2540
+ }) => e ? /* @__PURE__ */ n(et, { variant: "bot", className: t, children: /* @__PURE__ */ w("div", { "data-testid": "typing-indicator", className: Ne.typingDots, children: [
2516
2541
  /* @__PURE__ */ n("span", { className: Ne.typingDot }),
2517
2542
  /* @__PURE__ */ n("span", { className: Ne.typingDot }),
2518
2543
  /* @__PURE__ */ n("span", { className: Ne.typingDot })
2519
- ] }) }) : null, Qa = "message-avatar-module__container___-EX1c", Ya = "message-avatar-module__base___RPKhe", Ja = "message-avatar-module__circle___M68eH", es = "message-avatar-module__square___PjaDi", ts = "message-avatar-module__image___rxwYA", ns = "message-avatar-module__svg___eMikf", os = "message-avatar-module__fallback___2Xa-W", as = "message-avatar-module__name___L20Ht", ss = "message-avatar-module__small___gBALc", rs = "message-avatar-module__medium___WSeE1", is = "message-avatar-module__large___a-hNp", cs = "message-avatar-module__bot___2Bh0Y", ls = "message-avatar-module__agent___MemVD", D = {
2520
- container: Qa,
2521
- base: Ya,
2522
- circle: Ja,
2523
- square: es,
2524
- image: ts,
2525
- svg: ns,
2526
- fallback: os,
2527
- name: as,
2528
- small: ss,
2529
- medium: rs,
2530
- large: is,
2531
- bot: cs,
2532
- agent: ls
2533
- }, ds = F(D.base, {
2544
+ ] }) }) : null, ts = "message-avatar-module__container___-EX1c", ns = "message-avatar-module__base___RPKhe", os = "message-avatar-module__circle___M68eH", as = "message-avatar-module__square___PjaDi", ss = "message-avatar-module__image___rxwYA", rs = "message-avatar-module__svg___eMikf", is = "message-avatar-module__fallback___2Xa-W", cs = "message-avatar-module__name___L20Ht", ls = "message-avatar-module__small___gBALc", ds = "message-avatar-module__medium___WSeE1", us = "message-avatar-module__large___a-hNp", ms = "message-avatar-module__bot___2Bh0Y", _s = "message-avatar-module__agent___MemVD", D = {
2545
+ container: ts,
2546
+ base: ns,
2547
+ circle: os,
2548
+ square: as,
2549
+ image: ss,
2550
+ svg: rs,
2551
+ fallback: is,
2552
+ name: cs,
2553
+ small: ls,
2554
+ medium: ds,
2555
+ large: us,
2556
+ bot: ms,
2557
+ agent: _s
2558
+ }, hs = F(D.base, {
2534
2559
  variants: {
2535
2560
  variant: {
2536
2561
  user: D.user,
@@ -2549,7 +2574,7 @@ const $a = "message-bubble-module__base___WzTAP", Ha = "message-bubble-module__b
2549
2574
  }
2550
2575
  },
2551
2576
  defaultVariants: { variant: "bot", size: "medium", shape: "circle" }
2552
- }), et = O(
2577
+ }), tt = O(
2553
2578
  ({
2554
2579
  variant: e = "bot",
2555
2580
  size: t = "medium",
@@ -2558,7 +2583,7 @@ const $a = "message-bubble-module__base___WzTAP", Ha = "message-bubble-module__b
2558
2583
  alt: s,
2559
2584
  svg: i,
2560
2585
  showName: r = !1,
2561
- name: c,
2586
+ name: l,
2562
2587
  fallback: f,
2563
2588
  className: _
2564
2589
  }, m) => /* @__PURE__ */ w(
@@ -2571,7 +2596,7 @@ const $a = "message-bubble-module__base___WzTAP", Ha = "message-bubble-module__b
2571
2596
  /* @__PURE__ */ n(
2572
2597
  "div",
2573
2598
  {
2574
- className: ds({
2599
+ className: hs({
2575
2600
  variant: e,
2576
2601
  size: t,
2577
2602
  shape: a,
@@ -2595,39 +2620,39 @@ const $a = "message-bubble-module__base___WzTAP", Ha = "message-bubble-module__b
2595
2620
  ) : /* @__PURE__ */ n("div", { className: D.fallback, children: f || (e === "bot" ? "🤖" : e === "agent" ? "👨‍💼" : "👤") })
2596
2621
  }
2597
2622
  ),
2598
- r && c && /* @__PURE__ */ n("div", { className: D.name, children: c })
2623
+ r && l && /* @__PURE__ */ n("div", { className: D.name, children: l })
2599
2624
  ]
2600
2625
  }
2601
2626
  )
2602
- ), us = "message-info-module__base___yO0Cd", ms = "message-info-module__senderName___fP58-", _s = "message-info-module__timestamp___xwDsF", hs = "message-info-module__status___jPwtz", fs = "message-info-module__top___NK5CY", ps = "message-info-module__bottom___NE4Rs", gs = "message-info-module__bot___xlQbg", vs = "message-info-module__agent___ckeYQ", bs = "message-info-module__user___bgEi-", ws = "message-info-module__system___MF1CS", Z = {
2603
- base: us,
2604
- senderName: ms,
2605
- timestamp: _s,
2606
- status: hs,
2607
- top: fs,
2608
- bottom: ps,
2609
- bot: gs,
2610
- agent: vs,
2611
- user: bs,
2612
- system: ws
2613
- }, Cs = F(Z.base, {
2627
+ ), fs = "message-info-module__base___yO0Cd", ps = "message-info-module__senderName___fP58-", gs = "message-info-module__timestamp___xwDsF", bs = "message-info-module__status___jPwtz", vs = "message-info-module__top___NK5CY", ws = "message-info-module__bottom___NE4Rs", Cs = "message-info-module__bot___xlQbg", ys = "message-info-module__agent___ckeYQ", Ms = "message-info-module__user___bgEi-", Ps = "message-info-module__system___MF1CS", Y = {
2628
+ base: fs,
2629
+ senderName: ps,
2630
+ timestamp: gs,
2631
+ status: bs,
2632
+ top: vs,
2633
+ bottom: ws,
2634
+ bot: Cs,
2635
+ agent: ys,
2636
+ user: Ms,
2637
+ system: Ps
2638
+ }, Ns = F(Y.base, {
2614
2639
  variants: {
2615
2640
  variant: {
2616
- user: Z.user,
2617
- bot: Z.bot,
2618
- system: Z.system,
2619
- agent: Z.agent
2641
+ user: Y.user,
2642
+ bot: Y.bot,
2643
+ system: Y.system,
2644
+ agent: Y.agent
2620
2645
  },
2621
2646
  position: {
2622
- top: Z.top,
2623
- bottom: Z.bottom
2647
+ top: Y.top,
2648
+ bottom: Y.bottom
2624
2649
  }
2625
2650
  },
2626
2651
  defaultVariants: { variant: "bot", position: "bottom" }
2627
- }), ys = (e) => {
2652
+ }), Ss = (e) => {
2628
2653
  if (e)
2629
2654
  return typeof e == "string" ? e : e.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2630
- }, Et = O(
2655
+ }, Lt = O(
2631
2656
  ({
2632
2657
  variant: e = "bot",
2633
2658
  position: t = "bottom",
@@ -2636,11 +2661,11 @@ const $a = "message-bubble-module__base___WzTAP", Ha = "message-bubble-module__b
2636
2661
  showStatus: s = !1,
2637
2662
  status: i,
2638
2663
  avatarProps: r,
2639
- senderName: c,
2664
+ senderName: l,
2640
2665
  className: f,
2641
2666
  children: _
2642
2667
  }, m) => {
2643
- const l = (h) => {
2668
+ const d = (h) => {
2644
2669
  switch (h) {
2645
2670
  case "sending":
2646
2671
  return "Sending...";
@@ -2651,50 +2676,66 @@ const $a = "message-bubble-module__base___WzTAP", Ha = "message-bubble-module__b
2651
2676
  default:
2652
2677
  return "";
2653
2678
  }
2654
- }, d = ys(o);
2655
- return a && d || s || _ || r || c ? /* @__PURE__ */ w(
2679
+ }, c = Ss(o);
2680
+ return a && c || s || _ || r || l ? /* @__PURE__ */ w(
2656
2681
  "div",
2657
2682
  {
2658
2683
  ref: m,
2659
- className: Cs({
2684
+ className: Ns({
2660
2685
  variant: e,
2661
2686
  position: t,
2662
2687
  className: f
2663
2688
  }),
2664
2689
  "data-webchat-message-info": !0,
2665
2690
  children: [
2666
- r && /* @__PURE__ */ n(et, { ...r }),
2667
- c && /* @__PURE__ */ n("span", { className: Z.senderName, children: c }),
2668
- a && d && /* @__PURE__ */ n("span", { className: Z.timestamp, children: d }),
2669
- s && i && /* @__PURE__ */ n("span", { className: Z.status, "data-status": i, children: l(i) }),
2691
+ r && /* @__PURE__ */ n(tt, { ...r }),
2692
+ l && /* @__PURE__ */ n("span", { className: Y.senderName, children: l }),
2693
+ a && c && /* @__PURE__ */ n("span", { className: Y.timestamp, children: c }),
2694
+ s && i && /* @__PURE__ */ n("span", { className: Y.status, "data-status": i, children: d(i) }),
2670
2695
  _
2671
2696
  ]
2672
2697
  }
2673
2698
  ) : null;
2674
2699
  }
2675
- ), Ms = "message-module__base___Ki7QB", Ps = "message-module__bot___vw-E6", Ns = "message-module__agent___2wXra", Ss = "message-module__user___BSpcY", Ts = "message-module__system___-jvsr", ne = {
2676
- base: Ms,
2677
- bot: Ps,
2678
- agent: Ns,
2679
- user: Ss,
2680
- system: Ts
2681
- }, As = F(ne.base, {
2700
+ ), Ts = "message-module__base___Ki7QB", As = "message-module__bot___vw-E6", Es = "message-module__agent___2wXra", Is = "message-module__user___BSpcY", Rs = "message-module__system___-jvsr", U = {
2701
+ base: Ts,
2702
+ "hide-footer": "message-module__hide-footer___hIyVr",
2703
+ bot: As,
2704
+ "is-full-width": "message-module__is-full-width___TbepW",
2705
+ "has-actions": "message-module__has-actions___oKqN8",
2706
+ "is-continuation": "message-module__is-continuation___0ir98",
2707
+ agent: Es,
2708
+ user: Is,
2709
+ system: Rs
2710
+ }, xs = F(U.base, {
2682
2711
  variants: {
2683
2712
  variant: {
2684
- user: ne.user,
2685
- bot: ne.bot,
2686
- system: ne.system,
2687
- agent: ne.agent
2713
+ user: U.user,
2714
+ bot: U.bot,
2715
+ system: U.system,
2716
+ agent: U.agent
2688
2717
  },
2689
2718
  status: {
2690
- sending: ne.sending,
2691
- sent: ne.sent,
2692
- error: ne.error
2719
+ sending: U.sending,
2720
+ sent: U.sent,
2721
+ error: U.error
2722
+ },
2723
+ hideFooter: {
2724
+ true: U["hide-footer"]
2725
+ },
2726
+ isContinuation: {
2727
+ true: U["is-continuation"]
2728
+ },
2729
+ hasActions: {
2730
+ true: U["has-actions"]
2731
+ },
2732
+ isFullWidth: {
2733
+ true: U["is-full-width"]
2693
2734
  }
2694
2735
  },
2695
2736
  defaultVariants: { variant: "bot", status: "sent" }
2696
2737
  });
2697
- function Rt(e) {
2738
+ function Bt(e) {
2698
2739
  const {
2699
2740
  variant: t = "bot",
2700
2741
  status: a = "sent",
@@ -2702,55 +2743,69 @@ function Rt(e) {
2702
2743
  showStatus: s = !1,
2703
2744
  timestamp: i,
2704
2745
  avatarConfig: r,
2705
- senderName: c,
2746
+ senderName: l,
2706
2747
  className: f,
2748
+ hideFooter: _,
2749
+ isContinuation: m,
2750
+ hasActions: d,
2751
+ isFullWidth: c,
2707
2752
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2708
- children: _,
2753
+ children: u,
2709
2754
  // Consume unknown props without forwarding them to child components
2710
2755
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2711
- ...m
2756
+ ...h
2712
2757
  } = e;
2713
2758
  return _e(() => {
2714
- const l = As({ variant: t, status: a, className: f }), d = {
2759
+ const p = xs({
2760
+ variant: t,
2761
+ status: a,
2762
+ className: f,
2763
+ hideFooter: _,
2764
+ isContinuation: m,
2765
+ hasActions: d,
2766
+ isFullWidth: c
2767
+ }), g = {
2715
2768
  variant: t,
2716
2769
  showTimestamp: o,
2717
2770
  showStatus: s,
2718
2771
  timestamp: i,
2719
2772
  status: a,
2720
- senderName: c
2721
- }, u = {
2773
+ senderName: l
2774
+ }, b = {
2722
2775
  variant: t,
2723
- status: a
2776
+ status: a,
2777
+ flatTopCorner: m,
2778
+ flatBottomCorner: _
2724
2779
  };
2725
2780
  if (!r)
2726
2781
  return {
2727
- messageClasses: l,
2728
- bubbleProps: u,
2729
- infoProps: d,
2782
+ messageClasses: p,
2783
+ bubbleProps: b,
2784
+ infoProps: g,
2730
2785
  standaloneAvatarProps: null
2731
2786
  };
2732
- const { placement: h, avatarProps: p } = r;
2733
- switch (h) {
2787
+ const { placement: C, avatarProps: S } = r;
2788
+ switch (C) {
2734
2789
  case "bubble":
2735
2790
  case "info":
2736
2791
  return {
2737
- messageClasses: l,
2738
- bubbleProps: u,
2739
- infoProps: { ...d, avatarProps: p },
2792
+ messageClasses: p,
2793
+ bubbleProps: b,
2794
+ infoProps: { ...g, avatarProps: S },
2740
2795
  standaloneAvatarProps: null
2741
2796
  };
2742
2797
  case "standalone":
2743
2798
  return {
2744
- messageClasses: l,
2745
- bubbleProps: u,
2746
- infoProps: d,
2747
- standaloneAvatarProps: p
2799
+ messageClasses: p,
2800
+ bubbleProps: b,
2801
+ infoProps: g,
2802
+ standaloneAvatarProps: S
2748
2803
  };
2749
2804
  default:
2750
2805
  return {
2751
- messageClasses: l,
2752
- bubbleProps: u,
2753
- infoProps: d,
2806
+ messageClasses: p,
2807
+ bubbleProps: b,
2808
+ infoProps: g,
2754
2809
  standaloneAvatarProps: null
2755
2810
  };
2756
2811
  }
@@ -2761,35 +2816,40 @@ function Rt(e) {
2761
2816
  s,
2762
2817
  i,
2763
2818
  r,
2764
- c,
2765
- f
2819
+ l,
2820
+ f,
2821
+ _,
2822
+ m,
2823
+ d,
2824
+ c
2766
2825
  ]);
2767
2826
  }
2768
2827
  const ie = O(
2769
- (e, t) => {
2770
- const { messageClasses: a, bubbleProps: o, infoProps: s, standaloneAvatarProps: i } = Rt(e);
2828
+ ({ botInteractionId: e, ...t }, a) => {
2829
+ const { messageClasses: o, bubbleProps: s, infoProps: i, standaloneAvatarProps: r } = Bt(t);
2771
2830
  return /* @__PURE__ */ w(
2772
2831
  "div",
2773
2832
  {
2774
- ref: t,
2775
- className: a,
2776
- "data-testid": `webchat-message-${e.variant || "bot"}`,
2833
+ ref: a,
2834
+ className: o,
2835
+ "data-testid": `webchat-message-${t.variant || "bot"}`,
2836
+ "data-interaction-id": e,
2777
2837
  children: [
2778
- i && /* @__PURE__ */ n(et, { ...i }),
2779
- /* @__PURE__ */ n(Je, { ...o, children: e.children }),
2780
- /* @__PURE__ */ n(Et, { ...s })
2838
+ r && /* @__PURE__ */ n(tt, { ...r }),
2839
+ /* @__PURE__ */ n(et, { ...s, children: t.children }),
2840
+ !t.hideFooter && /* @__PURE__ */ n(Lt, { ...i })
2781
2841
  ]
2782
2842
  }
2783
2843
  );
2784
2844
  }
2785
- ), Is = "audio-message-module__audioMessageBase___Xye8T", Es = "audio-message-module__audioControls___bPgRS", Rs = "audio-message-module__playButton___zFi0C", xs = "audio-message-module__waveformPlaceholder___I9e-v", Ls = "audio-message-module__timer___6vQtQ", be = {
2786
- audioMessageBase: Is,
2787
- audioControls: Es,
2788
- playButton: Rs,
2789
- waveformPlaceholder: xs,
2790
- timer: Ls
2845
+ ), Ls = "audio-message-module__audioMessageBase___Xye8T", Bs = "audio-message-module__audioControls___bPgRS", ks = "audio-message-module__playButton___zFi0C", Ds = "audio-message-module__waveformPlaceholder___I9e-v", Os = "audio-message-module__timer___6vQtQ", ve = {
2846
+ audioMessageBase: Ls,
2847
+ audioControls: Bs,
2848
+ playButton: ks,
2849
+ waveformPlaceholder: Ds,
2850
+ timer: Os
2791
2851
  };
2792
- function Bs({
2852
+ function Ws({
2793
2853
  src: e,
2794
2854
  messageId: t,
2795
2855
  onAudioLoad: a,
@@ -2797,45 +2857,45 @@ function Bs({
2797
2857
  onPause: s,
2798
2858
  onEnded: i
2799
2859
  }) {
2800
- const r = C(null), [c, f] = N(!1), [_, m] = N(), [l, d] = N(0), [u, h] = N(), p = C(!1), { activeId: g, setActive: b, clearActive: M } = Le(), { isFocusVisible: T, focusProps: y } = Ze();
2801
- S(() => {
2802
- t && g !== t && c && r.current?.pause();
2803
- }, [g, t, c]), S(() => {
2860
+ const r = y(null), [l, f] = N(!1), [_, m] = N(), [d, c] = N(0), [u, h] = N(), p = y(!1), { activeId: g, setActive: b, clearActive: C } = Le(), { isFocusVisible: S, focusProps: M } = Ye();
2861
+ T(() => {
2862
+ t && g !== t && l && r.current?.pause();
2863
+ }, [g, t, l]), T(() => {
2804
2864
  if (p.current) return;
2805
- let ee = !1;
2806
- return fetch(e).then((Q) => Q.blob()).then((Q) => {
2807
- ee || (p.current = !0, h(Q));
2865
+ let ne = !1;
2866
+ return fetch(e).then((J) => J.blob()).then((J) => {
2867
+ ne || (p.current = !0, h(J));
2808
2868
  }).catch(() => {
2809
2869
  }), () => {
2810
- ee = !0;
2870
+ ne = !0;
2811
2871
  };
2812
2872
  }, [e]);
2813
2873
  const P = v(() => {
2814
2874
  r.current && (m(r.current.duration), a?.());
2815
2875
  }, [a]), A = v(() => {
2816
- r.current && d(r.current.currentTime);
2876
+ r.current && c(r.current.currentTime);
2817
2877
  }, []), W = v(() => {
2818
2878
  f(!0), t && b(t), o?.();
2819
2879
  }, [t, o, b]), V = v(() => {
2820
- f(!1), t && M(t), s?.();
2821
- }, [t, s, M]), $ = v(() => {
2822
- f(!1), d(0), t && M(t), i?.();
2823
- }, [t, i, M]), j = v(() => {
2824
- r.current && (c ? r.current.pause() : r.current.play());
2825
- }, [c]), q = v(
2826
- (ee) => {
2827
- !r.current || _ === void 0 || (r.current.currentTime = ee * _, d(r.current.currentTime));
2880
+ f(!1), t && C(t), s?.();
2881
+ }, [t, s, C]), $ = v(() => {
2882
+ f(!1), c(0), t && C(t), i?.();
2883
+ }, [t, i, C]), q = v(() => {
2884
+ r.current && (l ? r.current.pause() : r.current.play());
2885
+ }, [l]), G = v(
2886
+ (ne) => {
2887
+ !r.current || _ === void 0 || (r.current.currentTime = ne * _, c(r.current.currentTime));
2828
2888
  },
2829
2889
  [_]
2830
- ), B = _ ? l / _ : 0, G = c ? Ie(l) : _ !== void 0 ? Ie(_) : "--:--";
2890
+ ), B = _ ? d / _ : 0, K = l ? Ee(d) : _ !== void 0 ? Ee(_) : "--:--";
2831
2891
  return {
2832
2892
  audioRef: r,
2833
2893
  audioBlob: u,
2834
- isPlaying: c,
2894
+ isPlaying: l,
2835
2895
  audioProgress: B,
2836
- timerLabel: G,
2837
- handlePlayPause: j,
2838
- handleSeek: q,
2896
+ timerLabel: K,
2897
+ handlePlayPause: q,
2898
+ handleSeek: G,
2839
2899
  audioProps: {
2840
2900
  onLoadedMetadata: P,
2841
2901
  onTimeUpdate: A,
@@ -2844,12 +2904,12 @@ function Bs({
2844
2904
  onEnded: $
2845
2905
  },
2846
2906
  playButtonProps: {
2847
- ...y,
2848
- "data-focus-visible": T
2907
+ ...M,
2908
+ "data-focus-visible": S
2849
2909
  }
2850
2910
  };
2851
2911
  }
2852
- const xt = O(
2912
+ const kt = O(
2853
2913
  ({
2854
2914
  src: e,
2855
2915
  messageId: t,
@@ -2858,20 +2918,20 @@ const xt = O(
2858
2918
  onPlay: s,
2859
2919
  onPause: i,
2860
2920
  onEnded: r,
2861
- className: c,
2921
+ className: l,
2862
2922
  ...f
2863
2923
  }, _) => {
2864
2924
  const {
2865
2925
  audioRef: m,
2866
- audioBlob: l,
2867
- isPlaying: d,
2926
+ audioBlob: d,
2927
+ isPlaying: c,
2868
2928
  audioProgress: u,
2869
2929
  timerLabel: h,
2870
2930
  handlePlayPause: p,
2871
2931
  handleSeek: g,
2872
2932
  audioProps: b,
2873
- playButtonProps: M
2874
- } = Bs({
2933
+ playButtonProps: C
2934
+ } = Ws({
2875
2935
  src: e,
2876
2936
  messageId: t,
2877
2937
  onAudioLoad: o,
@@ -2883,7 +2943,7 @@ const xt = O(
2883
2943
  ie,
2884
2944
  {
2885
2945
  ref: _,
2886
- className: E(be.audioMessageBase, c),
2946
+ className: I(ve.audioMessageBase, l),
2887
2947
  ...f,
2888
2948
  children: [
2889
2949
  /* @__PURE__ */ n(
@@ -2896,96 +2956,96 @@ const xt = O(
2896
2956
  preload: "metadata"
2897
2957
  }
2898
2958
  ),
2899
- /* @__PURE__ */ w("div", { className: be.audioControls, children: [
2959
+ /* @__PURE__ */ w("div", { className: ve.audioControls, children: [
2900
2960
  /* @__PURE__ */ n(
2901
2961
  "button",
2902
2962
  {
2903
2963
  type: "button",
2904
- className: be.playButton,
2964
+ className: ve.playButton,
2905
2965
  onClick: p,
2906
- "aria-label": d ? "Pause audio" : "Play audio",
2907
- ...M,
2908
- children: d ? /* @__PURE__ */ n(It, {}) : /* @__PURE__ */ n(Ye, {})
2966
+ "aria-label": c ? "Pause audio" : "Play audio",
2967
+ ...C,
2968
+ children: c ? /* @__PURE__ */ n(xt, {}) : /* @__PURE__ */ n(Je, {})
2909
2969
  }
2910
2970
  ),
2911
- l ? /* @__PURE__ */ n(
2912
- At,
2971
+ d ? /* @__PURE__ */ n(
2972
+ Rt,
2913
2973
  {
2914
- audioBlob: l,
2974
+ audioBlob: d,
2915
2975
  progress: u,
2916
2976
  onSeek: g
2917
2977
  }
2918
- ) : /* @__PURE__ */ n("div", { className: be.waveformPlaceholder, "aria-hidden": !0 }),
2919
- /* @__PURE__ */ n("span", { className: be.timer, children: h })
2978
+ ) : /* @__PURE__ */ n("div", { className: ve.waveformPlaceholder, "aria-hidden": !0 }),
2979
+ /* @__PURE__ */ n("span", { className: ve.timer, children: h })
2920
2980
  ] })
2921
2981
  ]
2922
2982
  }
2923
2983
  );
2924
2984
  }
2925
2985
  );
2926
- xt.displayName = "AudioMessage";
2927
- const ks = "button-message-module__actions___3CAVo", Ds = "button-message-module__floatingButton___OK9AF", ut = {
2928
- actions: ks,
2929
- floatingButton: Ds
2930
- }, Os = O(
2931
- ({ text: e, buttons: t, buttonsPerRow: a = 1, className: o, ...s }, i) => {
2932
- const r = Math.min(a, t.length), { messageClasses: c, bubbleProps: f, infoProps: _, standaloneAvatarProps: m } = Rt({ ...s, children: null });
2986
+ kt.displayName = "AudioMessage";
2987
+ const Vs = "button-message-module__actions___3CAVo", $s = "button-message-module__floatingButton___OK9AF", mt = {
2988
+ actions: Vs,
2989
+ floatingButton: $s
2990
+ }, Hs = O(
2991
+ ({ text: e, buttons: t, buttonsPerRow: a = 1, className: o, hideFooter: s, ...i }, r) => {
2992
+ const l = Math.min(a, t.length), { messageClasses: f, bubbleProps: _, infoProps: m, standaloneAvatarProps: d } = Bt({ ...i, children: null, hasActions: !0, hideFooter: s });
2933
2993
  return /* @__PURE__ */ w(
2934
2994
  "div",
2935
2995
  {
2936
- ref: i,
2937
- className: E(c, o),
2938
- "data-testid": `webchat-message-${s.variant || "bot"}`,
2996
+ ref: r,
2997
+ className: I(f, o),
2998
+ "data-testid": `webchat-message-${i.variant || "bot"}`,
2939
2999
  children: [
2940
- m && /* @__PURE__ */ n(et, { ...m }),
2941
- /* @__PURE__ */ n(Je, { ...f, children: e }),
3000
+ d && /* @__PURE__ */ n(tt, { ...d }),
3001
+ /* @__PURE__ */ n(et, { ..._, children: e }),
2942
3002
  /* @__PURE__ */ n(
2943
3003
  "div",
2944
3004
  {
2945
- className: ut.actions,
3005
+ className: mt.actions,
2946
3006
  "data-webchat-message-actions": !0,
2947
- style: { gridTemplateColumns: `repeat(${r}, 1fr)` },
2948
- children: t.map((l, d) => /* @__PURE__ */ n(
3007
+ style: { gridTemplateColumns: `repeat(${l}, 1fr)` },
3008
+ children: t.map((c, u) => /* @__PURE__ */ n(
2949
3009
  Ae,
2950
3010
  {
2951
- text: l.text,
2952
- disabled: l.disabled,
2953
- button: l.type ? {
2954
- type: l.type,
2955
- title: l.text,
2956
- payload: l.value,
2957
- webview: l.webview
2958
- } : { text: l.text, value: l.value },
2959
- onClick: () => l.onClick?.(l.value),
3011
+ text: c.text,
3012
+ disabled: c.disabled,
3013
+ button: c.type ? {
3014
+ type: c.type,
3015
+ title: c.text,
3016
+ payload: c.value,
3017
+ webview: c.webview
3018
+ } : { text: c.text, value: c.value },
3019
+ onClick: () => c.onClick?.(c.value),
2960
3020
  variant: "secondary",
2961
- className: ut.floatingButton
3021
+ className: mt.floatingButton
2962
3022
  },
2963
- d
3023
+ u
2964
3024
  ))
2965
3025
  }
2966
3026
  ),
2967
- /* @__PURE__ */ n(Et, { ..._ })
3027
+ !s && /* @__PURE__ */ n(Lt, { ...m })
2968
3028
  ]
2969
3029
  }
2970
3030
  );
2971
3031
  }
2972
- ), Ws = "carousel-message-module__carouselMessageBase___yV-Nd", Vs = "carousel-message-module__buttonContainer___lPydV", $s = "carousel-message-module__carouselWrapper___OaVVz", Hs = "carousel-message-module__carouselSlider___qtpjn", Fs = "carousel-message-module__carouselCard___5GhQQ", Us = "carousel-message-module__imageContainer___-NYcV", zs = "carousel-message-module__elementImage___TEjVf", js = "carousel-message-module__elementContent___fQqqZ", qs = "carousel-message-module__elementTitle___sUPzb", Gs = "carousel-message-module__elementSubtitle___7yW9w", Ks = "carousel-message-module__arrowLayer___-lMZC", Xs = "carousel-message-module__arrowButton___EkObr", Zs = "carousel-message-module__prevArrow___YcQdm", Qs = "carousel-message-module__nextArrow___ndT0K", k = {
2973
- carouselMessageBase: Ws,
2974
- buttonContainer: Vs,
2975
- carouselWrapper: $s,
2976
- carouselSlider: Hs,
2977
- carouselCard: Fs,
2978
- imageContainer: Us,
2979
- elementImage: zs,
2980
- elementContent: js,
2981
- elementTitle: qs,
2982
- elementSubtitle: Gs,
2983
- arrowLayer: Ks,
2984
- arrowButton: Xs,
2985
- prevArrow: Zs,
2986
- nextArrow: Qs
3032
+ ), Fs = "carousel-message-module__carouselMessageBase___yV-Nd", Us = "carousel-message-module__buttonContainer___lPydV", zs = "carousel-message-module__carouselWrapper___OaVVz", js = "carousel-message-module__carouselSlider___qtpjn", qs = "carousel-message-module__carouselCard___5GhQQ", Gs = "carousel-message-module__imageContainer___-NYcV", Ks = "carousel-message-module__elementImage___TEjVf", Xs = "carousel-message-module__elementContent___fQqqZ", Zs = "carousel-message-module__elementTitle___sUPzb", Qs = "carousel-message-module__elementSubtitle___7yW9w", Ys = "carousel-message-module__arrowLayer___-lMZC", Js = "carousel-message-module__arrowButton___EkObr", er = "carousel-message-module__prevArrow___YcQdm", tr = "carousel-message-module__nextArrow___ndT0K", k = {
3033
+ carouselMessageBase: Fs,
3034
+ buttonContainer: Us,
3035
+ carouselWrapper: zs,
3036
+ carouselSlider: js,
3037
+ carouselCard: qs,
3038
+ imageContainer: Gs,
3039
+ elementImage: Ks,
3040
+ elementContent: Xs,
3041
+ elementTitle: Zs,
3042
+ elementSubtitle: Qs,
3043
+ arrowLayer: Ys,
3044
+ arrowButton: Js,
3045
+ prevArrow: er,
3046
+ nextArrow: tr
2987
3047
  };
2988
- function Ys() {
3048
+ function nr() {
2989
3049
  return /* @__PURE__ */ n(
2990
3050
  "svg",
2991
3051
  {
@@ -2999,7 +3059,7 @@ function Ys() {
2999
3059
  }
3000
3060
  );
3001
3061
  }
3002
- function Js() {
3062
+ function or() {
3003
3063
  return /* @__PURE__ */ n(
3004
3064
  "svg",
3005
3065
  {
@@ -3013,38 +3073,38 @@ function Js() {
3013
3073
  }
3014
3074
  );
3015
3075
  }
3016
- const mt = 12;
3017
- function er({
3076
+ const _t = 12;
3077
+ function ar({
3018
3078
  elements: e,
3019
3079
  onButtonClick: t,
3020
3080
  onElementImageLoad: a
3021
3081
  }) {
3022
- const o = C(null), [s, i] = N(!1), [r, c] = N(e.length > 1), f = v(() => o.current?.firstElementChild?.offsetWidth ?? 200, []), _ = v(() => {
3082
+ const o = y(null), [s, i] = N(!1), [r, l] = N(e.length > 1), f = v(() => o.current?.firstElementChild?.offsetWidth ?? 200, []), _ = v(() => {
3023
3083
  const g = o.current;
3024
3084
  if (!g) return;
3025
3085
  const b = 2;
3026
- i(g.scrollLeft > b), c(g.scrollLeft < g.scrollWidth - g.clientWidth - b);
3086
+ i(g.scrollLeft > b), l(g.scrollLeft < g.scrollWidth - g.clientWidth - b);
3027
3087
  }, []), m = v(() => {
3028
3088
  const g = o.current;
3029
3089
  if (!g) return;
3030
3090
  const b = f();
3031
3091
  g.scrollTo({
3032
- left: g.scrollLeft - (b + mt),
3092
+ left: g.scrollLeft - (b + _t),
3033
3093
  behavior: "smooth"
3034
3094
  });
3035
- }, [f]), l = v(() => {
3095
+ }, [f]), d = v(() => {
3036
3096
  const g = o.current;
3037
3097
  if (!g) return;
3038
3098
  const b = f();
3039
3099
  g.scrollTo({
3040
- left: g.scrollLeft + (b + mt),
3100
+ left: g.scrollLeft + (b + _t),
3041
3101
  behavior: "smooth"
3042
3102
  });
3043
- }, [f]), d = v(
3103
+ }, [f]), c = v(
3044
3104
  (g) => {
3045
- g.key === "ArrowLeft" ? (g.preventDefault(), m()) : g.key === "ArrowRight" && (g.preventDefault(), l());
3105
+ g.key === "ArrowLeft" ? (g.preventDefault(), m()) : g.key === "ArrowRight" && (g.preventDefault(), d());
3046
3106
  },
3047
- [m, l]
3107
+ [m, d]
3048
3108
  ), u = v(
3049
3109
  (g) => {
3050
3110
  "type" in g && t?.(g);
@@ -3067,7 +3127,7 @@ function er({
3067
3127
  containerProps: {
3068
3128
  role: "region",
3069
3129
  "aria-label": "Carousel",
3070
- onKeyDown: d,
3130
+ onKeyDown: c,
3071
3131
  tabIndex: 0
3072
3132
  },
3073
3133
  sliderProps: {
@@ -3083,7 +3143,7 @@ function er({
3083
3143
  disabled: !s
3084
3144
  },
3085
3145
  nextArrowProps: {
3086
- onClick: l,
3146
+ onClick: d,
3087
3147
  "aria-label": "Next card",
3088
3148
  disabled: !r
3089
3149
  },
@@ -3094,26 +3154,27 @@ function er({
3094
3154
  }
3095
3155
  };
3096
3156
  }
3097
- const Lt = O(
3157
+ const Dt = O(
3098
3158
  ({ elements: e, onButtonClick: t, onElementImageLoad: a, className: o, ...s }, i) => {
3099
3159
  const {
3100
3160
  containerProps: r,
3101
- sliderProps: c,
3161
+ sliderProps: l,
3102
3162
  cardProps: f,
3103
3163
  imageProps: _,
3104
3164
  prevArrowProps: m,
3105
- nextArrowProps: l,
3106
- handleButtonClick: d,
3165
+ nextArrowProps: d,
3166
+ handleButtonClick: c,
3107
3167
  variants: u
3108
- } = er({ elements: e, onButtonClick: t, onElementImageLoad: a });
3168
+ } = ar({ elements: e, onButtonClick: t, onElementImageLoad: a });
3109
3169
  return /* @__PURE__ */ n(
3110
3170
  ie,
3111
3171
  {
3112
3172
  ref: i,
3113
- className: E(k.carouselMessageBase, o),
3173
+ className: I(k.carouselMessageBase, o),
3174
+ isFullWidth: !0,
3114
3175
  ...s,
3115
3176
  children: /* @__PURE__ */ w("div", { ...r, className: k.carouselWrapper, children: [
3116
- /* @__PURE__ */ n("div", { ...c, className: k.carouselSlider, children: e.map((h, p) => /* @__PURE__ */ w(
3177
+ /* @__PURE__ */ n("div", { ...l, className: k.carouselSlider, children: e.map((h, p) => /* @__PURE__ */ w(
3117
3178
  "div",
3118
3179
  {
3119
3180
  ...f(p),
@@ -3141,7 +3202,7 @@ const Lt = O(
3141
3202
  {
3142
3203
  text: g.title,
3143
3204
  button: g,
3144
- onClick: d,
3205
+ onClick: c,
3145
3206
  variant: "secondary"
3146
3207
  }
3147
3208
  )
@@ -3158,17 +3219,17 @@ const Lt = O(
3158
3219
  {
3159
3220
  ...m,
3160
3221
  type: "button",
3161
- className: E(k.arrowButton, k.prevArrow),
3162
- children: /* @__PURE__ */ n(Ys, {})
3222
+ className: I(k.arrowButton, k.prevArrow),
3223
+ children: /* @__PURE__ */ n(nr, {})
3163
3224
  }
3164
3225
  ),
3165
3226
  u.canScrollNext && /* @__PURE__ */ n(
3166
3227
  "button",
3167
3228
  {
3168
- ...l,
3229
+ ...d,
3169
3230
  type: "button",
3170
- className: E(k.arrowButton, k.nextArrow),
3171
- children: /* @__PURE__ */ n(Js, {})
3231
+ className: I(k.arrowButton, k.nextArrow),
3232
+ children: /* @__PURE__ */ n(or, {})
3172
3233
  }
3173
3234
  )
3174
3235
  ] })
@@ -3177,14 +3238,14 @@ const Lt = O(
3177
3238
  );
3178
3239
  }
3179
3240
  );
3180
- Lt.displayName = "CarouselMessage";
3181
- const tr = "document-message-module__documentMessageBase___hqh5-", nr = "document-message-module__fileRow___-dzrn", or = "document-message-module__fileIcon___OwdXn", ar = "document-message-module__fileName___2d5yP", Se = {
3182
- documentMessageBase: tr,
3183
- fileRow: nr,
3184
- fileIcon: or,
3185
- fileName: ar
3241
+ Dt.displayName = "CarouselMessage";
3242
+ const sr = "document-message-module__documentMessageBase___hqh5-", rr = "document-message-module__fileRow___-dzrn", ir = "document-message-module__fileIcon___OwdXn", cr = "document-message-module__fileName___2d5yP", Se = {
3243
+ documentMessageBase: sr,
3244
+ fileRow: rr,
3245
+ fileIcon: ir,
3246
+ fileName: cr
3186
3247
  };
3187
- function sr({
3248
+ function lr({
3188
3249
  src: e,
3189
3250
  filename: t,
3190
3251
  onDownload: a
@@ -3198,17 +3259,17 @@ function sr({
3198
3259
  }
3199
3260
  };
3200
3261
  }
3201
- function rr(e) {
3202
- return e?.includes("pdf") ? /* @__PURE__ */ n(Nt, {}) : /* @__PURE__ */ n(Pt, {});
3262
+ function dr(e) {
3263
+ return e?.includes("pdf") ? /* @__PURE__ */ n(At, {}) : /* @__PURE__ */ n(Tt, {});
3203
3264
  }
3204
- const Bt = O(
3265
+ const Ot = O(
3205
3266
  ({ src: e, filename: t, mimeType: a, onDownload: o, className: s, ...i }, r) => {
3206
- const { downloadProps: c } = sr({ src: e, filename: t, onDownload: o });
3267
+ const { downloadProps: l } = lr({ src: e, filename: t, onDownload: o });
3207
3268
  return /* @__PURE__ */ n(
3208
3269
  ie,
3209
3270
  {
3210
3271
  ref: r,
3211
- className: E(Se.documentMessageBase, s),
3272
+ className: I(Se.documentMessageBase, s),
3212
3273
  ...i,
3213
3274
  children: /* @__PURE__ */ w(
3214
3275
  "button",
@@ -3216,9 +3277,9 @@ const Bt = O(
3216
3277
  type: "button",
3217
3278
  className: Se.fileRow,
3218
3279
  "aria-label": `Download ${t || "document"}`,
3219
- ...c,
3280
+ ...l,
3220
3281
  children: [
3221
- /* @__PURE__ */ n("span", { className: Se.fileIcon, "aria-hidden": !0, children: rr(a) }),
3282
+ /* @__PURE__ */ n("span", { className: Se.fileIcon, "aria-hidden": !0, children: dr(a) }),
3222
3283
  /* @__PURE__ */ n("span", { className: Se.fileName, children: t || "Document" })
3223
3284
  ]
3224
3285
  }
@@ -3227,12 +3288,12 @@ const Bt = O(
3227
3288
  );
3228
3289
  }
3229
3290
  );
3230
- Bt.displayName = "DocumentMessage";
3231
- const ir = "image-message-module__imageMessageBase___FDwNN", cr = "image-message-module__mediaImage___xflT1", _t = {
3232
- imageMessageBase: ir,
3233
- mediaImage: cr
3291
+ Ot.displayName = "DocumentMessage";
3292
+ const ur = "image-message-module__imageMessageBase___FDwNN", mr = "image-message-module__mediaImage___xflT1", ht = {
3293
+ imageMessageBase: ur,
3294
+ mediaImage: mr
3234
3295
  };
3235
- function lr({ onImageLoad: e }) {
3296
+ function _r({ onImageLoad: e }) {
3236
3297
  const t = v(() => {
3237
3298
  e?.();
3238
3299
  }, [e]), a = v(() => {
@@ -3245,21 +3306,21 @@ function lr({ onImageLoad: e }) {
3245
3306
  }
3246
3307
  };
3247
3308
  }
3248
- const kt = O(
3309
+ const Wt = O(
3249
3310
  ({ src: e, alt: t = "Attached image", onImageLoad: a, className: o, ...s }, i) => {
3250
- const { imageProps: r } = lr({ onImageLoad: a });
3311
+ const { imageProps: r } = _r({ onImageLoad: a });
3251
3312
  return /* @__PURE__ */ n(
3252
3313
  ie,
3253
3314
  {
3254
3315
  ref: i,
3255
- className: E(_t.imageMessageBase, o),
3316
+ className: I(ht.imageMessageBase, o),
3256
3317
  ...s,
3257
3318
  children: /* @__PURE__ */ n(
3258
3319
  "img",
3259
3320
  {
3260
3321
  src: e,
3261
3322
  alt: t,
3262
- className: _t.mediaImage,
3323
+ className: ht.mediaImage,
3263
3324
  ...r
3264
3325
  }
3265
3326
  )
@@ -3267,17 +3328,17 @@ const kt = O(
3267
3328
  );
3268
3329
  }
3269
3330
  );
3270
- kt.displayName = "ImageMessage";
3271
- const dr = "location-message-module__locationMessageBase___rY3d-", ur = "location-message-module__locationContainer___9Rukw", mr = "location-message-module__locationContent___2BRdV", _r = "location-message-module__locationIcon___rjObu", hr = "location-message-module__locationInfo___NqVsR", fr = "location-message-module__locationTitle___RpUjH", pr = "location-message-module__locationCoordinates___lLfuf", gr = "location-message-module__locationLink___Zq2I2", oe = {
3272
- locationMessageBase: dr,
3273
- locationContainer: ur,
3274
- locationContent: mr,
3275
- locationIcon: _r,
3276
- locationInfo: hr,
3277
- locationTitle: fr,
3278
- locationCoordinates: pr,
3279
- locationLink: gr
3280
- }, vr = O(
3331
+ Wt.displayName = "ImageMessage";
3332
+ const hr = "location-message-module__locationMessageBase___rY3d-", fr = "location-message-module__locationContainer___9Rukw", pr = "location-message-module__locationContent___2BRdV", gr = "location-message-module__locationIcon___rjObu", br = "location-message-module__locationInfo___NqVsR", vr = "location-message-module__locationTitle___RpUjH", wr = "location-message-module__locationCoordinates___lLfuf", Cr = "location-message-module__locationLink___Zq2I2", oe = {
3333
+ locationMessageBase: hr,
3334
+ locationContainer: fr,
3335
+ locationContent: pr,
3336
+ locationIcon: gr,
3337
+ locationInfo: br,
3338
+ locationTitle: vr,
3339
+ locationCoordinates: wr,
3340
+ locationLink: Cr
3341
+ }, yr = O(
3281
3342
  ({
3282
3343
  latitude: e,
3283
3344
  longitude: t,
@@ -3286,14 +3347,14 @@ const dr = "location-message-module__locationMessageBase___rY3d-", ur = "locatio
3286
3347
  className: s,
3287
3348
  ...i
3288
3349
  }, r) => {
3289
- const c = v(() => {
3350
+ const l = v(() => {
3290
3351
  o?.();
3291
3352
  }, [o]), f = `https://www.google.com/maps?q=${e},${t}`;
3292
3353
  return /* @__PURE__ */ n(
3293
3354
  ie,
3294
3355
  {
3295
3356
  ref: r,
3296
- className: E(oe.locationMessageBase, s),
3357
+ className: I(oe.locationMessageBase, s),
3297
3358
  ...i,
3298
3359
  children: /* @__PURE__ */ w("div", { className: oe.locationContainer, children: [
3299
3360
  /* @__PURE__ */ w("div", { className: oe.locationContent, children: [
@@ -3331,7 +3392,7 @@ const dr = "location-message-module__locationMessageBase___rY3d-", ur = "locatio
3331
3392
  target: "_blank",
3332
3393
  rel: "noopener noreferrer",
3333
3394
  className: oe.locationLink,
3334
- onClick: c,
3395
+ onClick: l,
3335
3396
  "aria-label": `Open location in Google Maps: ${e}, ${t}`,
3336
3397
  children: [
3337
3398
  /* @__PURE__ */ n("span", { children: "View on Map" }),
@@ -3363,39 +3424,39 @@ const dr = "location-message-module__locationMessageBase___rY3d-", ur = "locatio
3363
3424
  }
3364
3425
  );
3365
3426
  }
3366
- ), br = "text-message-module__textMessageBase___p4r-t", wr = "text-message-module__textContent___yRb8d", ht = {
3367
- textMessageBase: br,
3368
- textContent: wr
3369
- }, Cr = O(
3427
+ ), Mr = "text-message-module__textMessageBase___p4r-t", Pr = "text-message-module__textContent___yRb8d", ft = {
3428
+ textMessageBase: Mr,
3429
+ textContent: Pr
3430
+ }, Nr = O(
3370
3431
  ({ text: e, className: t, ...a }, o) => /* @__PURE__ */ n(
3371
3432
  ie,
3372
3433
  {
3373
3434
  ref: o,
3374
- className: E(ht.textMessageBase, t),
3435
+ className: I(ft.textMessageBase, t),
3375
3436
  ...a,
3376
- children: /* @__PURE__ */ n("div", { className: ht.textContent, children: e })
3437
+ children: /* @__PURE__ */ n("div", { className: ft.textContent, children: e })
3377
3438
  }
3378
3439
  )
3379
3440
  );
3380
- function yr({
3441
+ function Sr({
3381
3442
  messageId: e,
3382
3443
  onVideoLoad: t,
3383
3444
  onPlay: a,
3384
3445
  onPause: o,
3385
3446
  onEnded: s
3386
3447
  }) {
3387
- const i = C(null), [r, c] = N(!1), { activeId: f, setActive: _, clearActive: m } = Le();
3388
- S(() => {
3448
+ const i = y(null), [r, l] = N(!1), { activeId: f, setActive: _, clearActive: m } = Le();
3449
+ T(() => {
3389
3450
  e && f !== e && r && i.current?.pause();
3390
3451
  }, [f, e, r]);
3391
- const l = v(() => {
3452
+ const d = v(() => {
3392
3453
  t?.();
3393
- }, [t]), d = v(() => {
3394
- c(!0), e && _(e), a?.();
3454
+ }, [t]), c = v(() => {
3455
+ l(!0), e && _(e), a?.();
3395
3456
  }, [e, a, _]), u = v(() => {
3396
- c(!1), e && m(e), o?.();
3457
+ l(!1), e && m(e), o?.();
3397
3458
  }, [e, o, m]), h = v(() => {
3398
- c(!1), e && m(e), s?.();
3459
+ l(!1), e && m(e), s?.();
3399
3460
  }, [e, s, m]), p = v(() => {
3400
3461
  i.current?.play();
3401
3462
  }, []);
@@ -3403,8 +3464,8 @@ function yr({
3403
3464
  videoRef: i,
3404
3465
  isPlaying: r,
3405
3466
  videoProps: {
3406
- onLoadedMetadata: l,
3407
- onPlay: d,
3467
+ onLoadedMetadata: d,
3468
+ onPlay: c,
3408
3469
  onPause: u,
3409
3470
  onEnded: h
3410
3471
  },
@@ -3413,13 +3474,13 @@ function yr({
3413
3474
  }
3414
3475
  };
3415
3476
  }
3416
- const Mr = "video-message-module__videoMessageBase___RX3Qk", Pr = "video-message-module__videoContainer___ctZrR", Nr = "video-message-module__videoElement___dYbDh", Sr = "video-message-module__playOverlay___QrUG8", Tr = "video-message-module__playIconWrapper___z-w6D", we = {
3417
- videoMessageBase: Mr,
3418
- videoContainer: Pr,
3419
- videoElement: Nr,
3420
- playOverlay: Sr,
3421
- playIconWrapper: Tr
3422
- }, Dt = O(
3477
+ const Tr = "video-message-module__videoMessageBase___RX3Qk", Ar = "video-message-module__videoContainer___ctZrR", Er = "video-message-module__videoElement___dYbDh", Ir = "video-message-module__playOverlay___QrUG8", Rr = "video-message-module__playIconWrapper___z-w6D", we = {
3478
+ videoMessageBase: Tr,
3479
+ videoContainer: Ar,
3480
+ videoElement: Er,
3481
+ playOverlay: Ir,
3482
+ playIconWrapper: Rr
3483
+ }, Vt = O(
3423
3484
  ({
3424
3485
  src: e,
3425
3486
  messageId: t,
@@ -3428,10 +3489,10 @@ const Mr = "video-message-module__videoMessageBase___RX3Qk", Pr = "video-message
3428
3489
  onPlay: s,
3429
3490
  onPause: i,
3430
3491
  onEnded: r,
3431
- className: c,
3492
+ className: l,
3432
3493
  ...f
3433
3494
  }, _) => {
3434
- const { videoRef: m, isPlaying: l, videoProps: d, playButtonProps: u } = yr({
3495
+ const { videoRef: m, isPlaying: d, videoProps: c, playButtonProps: u } = Sr({
3435
3496
  messageId: t,
3436
3497
  onVideoLoad: o,
3437
3498
  onPlay: s,
@@ -3442,7 +3503,7 @@ const Mr = "video-message-module__videoMessageBase___RX3Qk", Pr = "video-message
3442
3503
  ie,
3443
3504
  {
3444
3505
  ref: _,
3445
- className: E(we.videoMessageBase, c),
3506
+ className: I(we.videoMessageBase, l),
3446
3507
  ...f,
3447
3508
  children: /* @__PURE__ */ w("div", { className: we.videoContainer, children: [
3448
3509
  /* @__PURE__ */ n(
@@ -3453,18 +3514,18 @@ const Mr = "video-message-module__videoMessageBase___RX3Qk", Pr = "video-message
3453
3514
  "aria-label": a,
3454
3515
  className: we.videoElement,
3455
3516
  preload: "metadata",
3456
- controls: l,
3457
- ...d
3517
+ controls: d,
3518
+ ...c
3458
3519
  }
3459
3520
  ),
3460
- !l && /* @__PURE__ */ n(
3521
+ !d && /* @__PURE__ */ n(
3461
3522
  "button",
3462
3523
  {
3463
3524
  type: "button",
3464
3525
  className: we.playOverlay,
3465
3526
  "aria-label": "Play video",
3466
3527
  ...u,
3467
- children: /* @__PURE__ */ n("span", { className: we.playIconWrapper, "aria-hidden": !0, children: /* @__PURE__ */ n(Ye, {}) })
3528
+ children: /* @__PURE__ */ n("span", { className: we.playIconWrapper, "aria-hidden": !0, children: /* @__PURE__ */ n(Je, {}) })
3468
3529
  }
3469
3530
  )
3470
3531
  ] })
@@ -3472,25 +3533,17 @@ const Mr = "video-message-module__videoMessageBase___RX3Qk", Pr = "video-message
3472
3533
  );
3473
3534
  }
3474
3535
  );
3475
- Dt.displayName = "VideoMessage";
3476
- function Ar(e) {
3477
- if (!e) return;
3478
- const t = e.replace(/-/g, "");
3479
- if (t.length < 16 || parseInt(t[12], 16) !== 7) return;
3480
- const o = parseInt(t.slice(0, 12), 16);
3481
- if (!(!Number.isFinite(o) || o <= 0))
3482
- return new Date(o);
3483
- }
3484
- function Ir({
3536
+ Vt.displayName = "VideoMessage";
3537
+ function xr({
3485
3538
  messageActor: e,
3486
3539
  baseProps: t = {}
3487
3540
  }) {
3488
- const { message: a, status: o } = L(e, (c) => ({
3489
- message: c.context?.message,
3490
- status: c.context?.status
3541
+ const { message: a, status: o } = L(e, (l) => ({
3542
+ message: l.context?.message,
3543
+ status: l.context?.status
3491
3544
  })), s = L(
3492
3545
  e,
3493
- (c) => c.can?.({ type: "RETRY" }) ?? !1
3546
+ (l) => l.can?.({ type: "RETRY" }) ?? !1
3494
3547
  ), i = _e(() => {
3495
3548
  if (!a)
3496
3549
  return {
@@ -3500,7 +3553,7 @@ function Ir({
3500
3553
  showTimestamp: !0,
3501
3554
  isClickable: !1
3502
3555
  };
3503
- const c = (() => {
3556
+ const l = (() => {
3504
3557
  switch (o) {
3505
3558
  case "unsent":
3506
3559
  return "sending";
@@ -3526,18 +3579,18 @@ function Ir({
3526
3579
  return {
3527
3580
  ...t,
3528
3581
  variant: f,
3529
- status: c,
3530
- timestamp: Ar(a.id),
3582
+ status: l,
3583
+ timestamp: Xe(a.id),
3531
3584
  showTimestamp: !0,
3532
3585
  isClickable: s,
3533
3586
  onPress: _,
3534
3587
  avatarConfig: m
3535
3588
  };
3536
3589
  }, [a, o, s, e, t]), r = _e(
3537
- () => (c) => {
3590
+ () => (l) => {
3538
3591
  t.onUserInteraction?.(), e.send({
3539
3592
  type: "BUTTON_CLICKED",
3540
- button: c
3593
+ button: l
3541
3594
  });
3542
3595
  },
3543
3596
  [t, e]
@@ -3550,7 +3603,7 @@ function Ir({
3550
3603
  handleButtonClick: r
3551
3604
  };
3552
3605
  }
3553
- const Er = ({
3606
+ const Lr = ({
3554
3607
  messageActor: e,
3555
3608
  customMessageRenderer: t,
3556
3609
  baseProps: a = {
@@ -3560,24 +3613,24 @@ const Er = ({
3560
3613
  onImageLoadStart: s,
3561
3614
  onImageLoadComplete: i
3562
3615
  }) => {
3563
- const { message: r, messageProps: c, handleButtonClick: f } = Ir({
3616
+ const { message: r, messageProps: l, handleButtonClick: f } = xr({
3564
3617
  messageActor: e,
3565
3618
  baseProps: a
3566
3619
  });
3567
- return S(() => {
3620
+ return T(() => {
3568
3621
  if (r && r.type === "image") {
3569
3622
  const m = `img-${r.id}-${r.data}`;
3570
3623
  s?.(m);
3571
3624
  }
3572
- }, [r, s]), r ? /* @__PURE__ */ n(Ee, { children: (() => {
3625
+ }, [r, s]), r ? /* @__PURE__ */ n(Ie, { children: (() => {
3573
3626
  const { id: m } = r;
3574
3627
  if (r.isText())
3575
- return /* @__PURE__ */ n(Cr, { ...c, text: r.data.text }, m);
3628
+ return /* @__PURE__ */ n(Nr, { ...l, text: r.data.text }, m);
3576
3629
  if (r.isAudio())
3577
3630
  return /* @__PURE__ */ n(
3578
- xt,
3631
+ kt,
3579
3632
  {
3580
- ...c,
3633
+ ...l,
3581
3634
  src: r.data.attachment_url ?? r.data.attachment_content ?? "",
3582
3635
  messageId: m
3583
3636
  },
@@ -3585,9 +3638,9 @@ const Er = ({
3585
3638
  );
3586
3639
  if (r.isVideo())
3587
3640
  return /* @__PURE__ */ n(
3588
- Dt,
3641
+ Vt,
3589
3642
  {
3590
- ...c,
3643
+ ...l,
3591
3644
  src: r.data.attachment_url ?? r.data.attachment_content ?? "",
3592
3645
  messageId: m,
3593
3646
  alt: "Video",
@@ -3599,9 +3652,9 @@ const Er = ({
3599
3652
  );
3600
3653
  if (r.isDocument())
3601
3654
  return /* @__PURE__ */ n(
3602
- Bt,
3655
+ Ot,
3603
3656
  {
3604
- ...c,
3657
+ ...l,
3605
3658
  src: r.data.attachment_url ?? r.data.attachment_content ?? "",
3606
3659
  mimeType: r.data.mime_type,
3607
3660
  filename: r.data.filename
@@ -3610,9 +3663,9 @@ const Er = ({
3610
3663
  );
3611
3664
  if (r.isLocation())
3612
3665
  return /* @__PURE__ */ n(
3613
- vr,
3666
+ yr,
3614
3667
  {
3615
- ...c,
3668
+ ...l,
3616
3669
  latitude: r.data.latitude,
3617
3670
  longitude: r.data.longitude,
3618
3671
  alt: "Location coordinates",
@@ -3623,52 +3676,52 @@ const Er = ({
3623
3676
  m
3624
3677
  );
3625
3678
  if (r.isImage()) {
3626
- const l = r.data.attachment_url ?? r.data.attachment_content ?? "", d = `img-${m}-${l}`;
3679
+ const d = r.data.attachment_url ?? r.data.attachment_content ?? "", c = `img-${m}-${d}`;
3627
3680
  return /* @__PURE__ */ n(
3628
- kt,
3681
+ Wt,
3629
3682
  {
3630
- ...c,
3631
- src: l,
3683
+ ...l,
3684
+ src: d,
3632
3685
  alt: "Image",
3633
3686
  onImageLoad: () => {
3634
- o?.(), i?.(d);
3687
+ o?.(), i?.(c);
3635
3688
  }
3636
3689
  },
3637
3690
  m
3638
3691
  );
3639
3692
  }
3640
3693
  return r.isButtonMessage() ? /* @__PURE__ */ n(
3641
- Os,
3694
+ Hs,
3642
3695
  {
3643
- ...c,
3696
+ ...l,
3644
3697
  text: r.data.text,
3645
3698
  buttons: r.data.buttons?.map(
3646
- (l) => ({
3647
- text: l.title,
3648
- value: l.payload || l.title,
3649
- type: l.type,
3650
- webview: l.webview,
3699
+ (d) => ({
3700
+ text: d.title,
3701
+ value: d.payload || d.title,
3702
+ type: d.type,
3703
+ webview: d.webview,
3651
3704
  disabled: !1,
3652
3705
  onClick: () => {
3653
- f(l);
3706
+ f(d);
3654
3707
  }
3655
3708
  })
3656
3709
  )
3657
3710
  },
3658
3711
  m
3659
3712
  ) : r.isCarousel() ? /* @__PURE__ */ n(
3660
- Lt,
3713
+ Dt,
3661
3714
  {
3662
- ...c,
3663
- elements: r.data.elements.map((l, d) => ({
3664
- id: `${m}-${d}`,
3665
- title: l.title,
3666
- subtitle: l.subtitle,
3667
- image: l.image,
3668
- buttons: l.buttons
3715
+ ...l,
3716
+ elements: r.data.elements.map((d, c) => ({
3717
+ id: `${m}-${c}`,
3718
+ title: d.title,
3719
+ subtitle: d.subtitle,
3720
+ image: d.image,
3721
+ buttons: d.buttons
3669
3722
  })),
3670
- onButtonClick: (l) => {
3671
- f(l);
3723
+ onButtonClick: (d) => {
3724
+ f(d);
3672
3725
  },
3673
3726
  onElementImageLoad: () => {
3674
3727
  o?.();
@@ -3680,7 +3733,7 @@ const Er = ({
3680
3733
  ), null) : (console.warn(`Unknown message type: ${r.type}`), null);
3681
3734
  })() }) : null;
3682
3735
  };
3683
- function Rr(e) {
3736
+ function Br(e) {
3684
3737
  return _e(() => {
3685
3738
  if (!e)
3686
3739
  return { bot: null, agent: null };
@@ -3705,24 +3758,24 @@ function Rr(e) {
3705
3758
  };
3706
3759
  }, [e]);
3707
3760
  }
3708
- function xr(e, t, a) {
3761
+ function kr(e, t, a) {
3709
3762
  const {
3710
3763
  variant: o = "default",
3711
3764
  hasUserInteracted: s = !1,
3712
3765
  onScrollDepthChange: i,
3713
3766
  onMessagesScrollAtTopChange: r,
3714
- onUserInteraction: c,
3767
+ onUserInteraction: l,
3715
3768
  "aria-label": f,
3716
3769
  className: _,
3717
3770
  ...m
3718
- } = e, l = L(
3771
+ } = e, d = L(
3719
3772
  t.controller.machine,
3720
3773
  (h) => {
3721
3774
  const p = h.context.messageActors;
3722
3775
  return p ? Array.from(p.values()) : [];
3723
3776
  },
3724
3777
  (h, p) => h.length === p.length
3725
- ), d = Rr(t.avatarConfig), u = L(
3778
+ ), c = Br(t.avatarConfig), u = L(
3726
3779
  t.controller.machine,
3727
3780
  (h) => h.context.isTypingOn,
3728
3781
  (h, p) => h === p
@@ -3732,13 +3785,13 @@ function xr(e, t, a) {
3732
3785
  messagesProps: {
3733
3786
  ...m,
3734
3787
  ref: a,
3735
- "aria-label": f || `Chat messages, ${l.length} messages`,
3788
+ "aria-label": f || `Chat messages, ${d.length} messages`,
3736
3789
  "aria-live": "polite",
3737
3790
  "data-webchat-messages": ""
3738
3791
  },
3739
3792
  // Props for MessagesList component (using XState message actors)
3740
3793
  messageListProps: {
3741
- messageActors: l,
3794
+ messageActors: d,
3742
3795
  // From XState selector
3743
3796
  isTyping: u,
3744
3797
  // From XState selector
@@ -3746,11 +3799,11 @@ function xr(e, t, a) {
3746
3799
  customMessageRenderer: void 0,
3747
3800
  // TODO: Add custom message renderer support
3748
3801
  // Pre-computed avatar configs (performance optimization)
3749
- botAvatarConfig: d.bot,
3750
- agentAvatarConfig: d.agent,
3802
+ botAvatarConfig: c.bot,
3803
+ agentAvatarConfig: c.agent,
3751
3804
  onScrollDepthChange: i,
3752
3805
  onMessagesScrollAtTopChange: r,
3753
- onUserInteraction: c
3806
+ onUserInteraction: l
3754
3807
  },
3755
3808
  // CSS class variants
3756
3809
  variants: {
@@ -3759,8 +3812,8 @@ function xr(e, t, a) {
3759
3812
  }
3760
3813
  };
3761
3814
  }
3762
- const Lr = 8, Br = 1, kr = 350, Dr = 2;
3763
- function Or({
3815
+ const Dr = 8, Or = 1, Wr = 350, Vr = 2;
3816
+ function $r({
3764
3817
  scrollRef: e,
3765
3818
  hasUserInteracted: t,
3766
3819
  messageActorsLength: a,
@@ -3768,40 +3821,40 @@ function Or({
3768
3821
  onScrollDepthChange: s,
3769
3822
  onMessagesScrollAtTopChange: i
3770
3823
  }) {
3771
- const r = C(!1), c = C(!1), f = C(void 0), _ = v(() => {
3824
+ const r = y(!1), l = y(!1), f = y(void 0), _ = v(() => {
3772
3825
  if (!t) return;
3773
- const d = e.current;
3774
- if (!d) return;
3775
- const u = d.scrollTop <= Dr;
3826
+ const c = e.current;
3827
+ if (!c) return;
3828
+ const u = c.scrollTop <= Vr;
3776
3829
  i?.(u);
3777
3830
  }, [t, i]), m = v(() => {
3778
- const d = e.current;
3779
- if (!d) return;
3780
- const u = r.current ? d.scrollTop > Br : d.scrollTop > Lr;
3831
+ const c = e.current;
3832
+ if (!c) return;
3833
+ const u = r.current ? c.scrollTop > Or : c.scrollTop > Dr;
3781
3834
  r.current !== u && (r.current = u, s?.(u));
3782
- }, [s]), l = v(() => {
3783
- m(), !c.current && _();
3835
+ }, [s]), d = v(() => {
3836
+ m(), !l.current && _();
3784
3837
  }, [_, m]);
3785
- return Ft(() => {
3838
+ return jt(() => {
3786
3839
  if (!e.current) return;
3787
- const d = e.current;
3840
+ const c = e.current;
3788
3841
  requestAnimationFrame(() => {
3789
- c.current = !0, f.current !== void 0 && window.clearTimeout(f.current), d.scrollTo({
3790
- top: d.scrollHeight,
3842
+ l.current = !0, f.current !== void 0 && window.clearTimeout(f.current), c.scrollTo({
3843
+ top: c.scrollHeight,
3791
3844
  behavior: "smooth"
3792
3845
  }), f.current = window.setTimeout(() => {
3793
- c.current = !1, l();
3794
- }, kr), requestAnimationFrame(l);
3846
+ l.current = !1, d();
3847
+ }, Wr), requestAnimationFrame(d);
3795
3848
  });
3796
- }, [a, o, l]), { handleScrollState: l };
3849
+ }, [a, o, d]), { handleScrollState: d };
3797
3850
  }
3798
- const Wr = "webchat-messages-module__base___V7acY", ue = {
3799
- base: Wr,
3851
+ const Hr = "webchat-messages-module__base___V7acY", ue = {
3852
+ base: Hr,
3800
3853
  "messages-container": "webchat-messages-module__messages-container___Ew2gS",
3801
3854
  "scroll-fade-bottom": "webchat-messages-module__scroll-fade-bottom___WoP9u",
3802
3855
  "typing-indicator-container": "webchat-messages-module__typing-indicator-container___v3bpq",
3803
3856
  default: "webchat-messages-module__default___3C2qm"
3804
- }, Vr = F(ue.base, {
3857
+ }, Fr = F(ue.base, {
3805
3858
  variants: {
3806
3859
  variant: {
3807
3860
  default: ue.default
@@ -3810,8 +3863,20 @@ const Wr = "webchat-messages-module__base___V7acY", ue = {
3810
3863
  defaultVariants: {
3811
3864
  variant: "default"
3812
3865
  }
3813
- });
3814
- function $r({
3866
+ }), Ur = 1, zr = /* @__PURE__ */ new Set([tn.Text]);
3867
+ function pt(e) {
3868
+ return zr.has(e.type);
3869
+ }
3870
+ function jr(e, t) {
3871
+ return !e || !t ? !1 : Math.abs(t.getTime() - e.getTime()) <= Ur * 6e4;
3872
+ }
3873
+ function gt(e, t) {
3874
+ return !e || !t || !pt(e) || !pt(t) || e.sent_by !== t.sent_by ? !1 : jr(
3875
+ Xe(e.id),
3876
+ Xe(t.id)
3877
+ );
3878
+ }
3879
+ function qr({
3815
3880
  messageActors: e,
3816
3881
  isTyping: t,
3817
3882
  hasUserInteracted: a = !1,
@@ -3819,20 +3884,20 @@ function $r({
3819
3884
  botAvatarConfig: s,
3820
3885
  agentAvatarConfig: i,
3821
3886
  scrollRef: r,
3822
- onScrollDepthChange: c,
3887
+ onScrollDepthChange: l,
3823
3888
  onMessagesScrollAtTopChange: f,
3824
3889
  onUserInteraction: _
3825
3890
  }) {
3826
- const { handleScrollState: m } = Or({
3891
+ const { handleScrollState: m } = $r({
3827
3892
  scrollRef: r,
3828
3893
  hasUserInteracted: a ?? !1,
3829
3894
  messageActorsLength: e.length,
3830
3895
  isTyping: t,
3831
- onScrollDepthChange: c,
3896
+ onScrollDepthChange: l,
3832
3897
  onMessagesScrollAtTopChange: f
3833
- }), l = ft.useCallback(
3834
- (d, u, h) => {
3835
- const p = d;
3898
+ }), d = bt.useCallback(
3899
+ (c, u, h) => {
3900
+ const p = c;
3836
3901
  if (p.type === "custom" && p.data && o) {
3837
3902
  const g = o[p.data.name];
3838
3903
  if (g && typeof g == "function")
@@ -3853,29 +3918,35 @@ function $r({
3853
3918
  "data-testid": "webchat-messages-list",
3854
3919
  onScroll: m,
3855
3920
  children: [
3856
- e && e.length > 0 && e.map((d) => /* @__PURE__ */ n(
3857
- Er,
3858
- {
3859
- messageActor: d,
3860
- customMessageRenderer: l,
3861
- baseProps: {
3862
- className: ue.message,
3863
- // Pre-computed avatar configs (performance optimization)
3864
- botAvatarConfig: s,
3865
- agentAvatarConfig: i,
3866
- onUserInteraction: _
3867
- }
3868
- },
3869
- d.id
3870
- )),
3871
- t && /* @__PURE__ */ n("div", { className: ue["typing-indicator-container"], children: /* @__PURE__ */ n(Za, { isVisible: t }) }),
3921
+ e && e.length > 0 && e.map((c, u) => {
3922
+ const h = e[u - 1]?.getSnapshot().context?.message, p = c.getSnapshot().context?.message, g = e[u + 1]?.getSnapshot().context?.message, b = gt(p, g), C = gt(h, p);
3923
+ return /* @__PURE__ */ n(
3924
+ Lr,
3925
+ {
3926
+ messageActor: c,
3927
+ customMessageRenderer: d,
3928
+ baseProps: {
3929
+ className: ue.message,
3930
+ // Pre-computed avatar configs (performance optimization)
3931
+ botAvatarConfig: s,
3932
+ agentAvatarConfig: i,
3933
+ onUserInteraction: _,
3934
+ hideFooter: b,
3935
+ isContinuation: C,
3936
+ botInteractionId: p?.bot_interaction_id
3937
+ }
3938
+ },
3939
+ c.id
3940
+ );
3941
+ }),
3942
+ t && /* @__PURE__ */ n("div", { className: ue["typing-indicator-container"], children: /* @__PURE__ */ n(es, { isVisible: t }) }),
3872
3943
  /* @__PURE__ */ n("div", { className: ue["scroll-fade-bottom"], "aria-hidden": !0 })
3873
3944
  ]
3874
3945
  }
3875
3946
  );
3876
3947
  }
3877
- function Hr(e) {
3878
- const { state: t } = U(), a = C(null), o = C(null), { messagesProps: s, messageListProps: i, variants: r } = xr(
3948
+ function Gr(e) {
3949
+ const { state: t } = z(), a = y(null), o = y(null), { messagesProps: s, messageListProps: i, variants: r } = kr(
3879
3950
  e,
3880
3951
  t,
3881
3952
  a
@@ -3884,10 +3955,10 @@ function Hr(e) {
3884
3955
  "div",
3885
3956
  {
3886
3957
  ...s,
3887
- className: Vr(r),
3958
+ className: Fr(r),
3888
3959
  "data-webchat-messages": !0,
3889
3960
  children: /* @__PURE__ */ n(
3890
- $r,
3961
+ qr,
3891
3962
  {
3892
3963
  ...i,
3893
3964
  customMessages: t.customMessages,
@@ -3897,7 +3968,7 @@ function Hr(e) {
3897
3968
  }
3898
3969
  );
3899
3970
  }
3900
- function Fr({
3971
+ function Kr({
3901
3972
  isOpen: e,
3902
3973
  onClose: t,
3903
3974
  onControllerReady: a,
@@ -3905,24 +3976,24 @@ function Fr({
3905
3976
  placeholder: s = "Type a message...",
3906
3977
  showBranding: i = !0,
3907
3978
  coverRegistry: r,
3908
- icons: c,
3979
+ icons: l,
3909
3980
  heroHeaderLayout: f
3910
3981
  }) {
3911
- const { controller: _, state: m } = U(), l = C(!1), d = rn({
3982
+ const { controller: _, state: m } = z(), d = y(!1), c = un({
3912
3983
  controller: _,
3913
3984
  isOpen: e,
3914
3985
  layout: f,
3915
3986
  enableResponsiveHeroHeader: m.enableResponsiveHeroHeader
3916
- }), { header: u, messages: h, onUserEngagement: p } = d;
3917
- return S(() => {
3918
- _ && !l.current && (l.current = !0, a?.(_));
3919
- }, [_, a]), S(() => {
3987
+ }), { header: u, messages: h, onUserEngagement: p } = c;
3988
+ return T(() => {
3989
+ _ && !d.current && (d.current = !0, a?.(_));
3990
+ }, [_, a]), T(() => {
3920
3991
  if (!_) return;
3921
- const M = _.machine.getSnapshot().context.isOpen ?? !1;
3922
- e && !M ? _.open() : !e && M && _.close();
3923
- }, [e, _]), /* @__PURE__ */ w(bo, { layout: "default", coverRegistry: r, children: [
3992
+ const C = _.machine.getSnapshot().context.isOpen ?? !1;
3993
+ e && !C ? _.open() : !e && C && _.close();
3994
+ }, [e, _]), /* @__PURE__ */ w(Mo, { layout: "default", coverRegistry: r, children: [
3924
3995
  /* @__PURE__ */ n(
3925
- Ro,
3996
+ ko,
3926
3997
  {
3927
3998
  title: o,
3928
3999
  onClose: () => {
@@ -3933,34 +4004,34 @@ function Fr({
3933
4004
  hasShadow: u.hasShadow,
3934
4005
  enableResponsiveHeroHeader: m.enableResponsiveHeroHeader,
3935
4006
  children: /* @__PURE__ */ n(
3936
- $t,
4007
+ Ut,
3937
4008
  {
3938
- trigger: /* @__PURE__ */ n(yt, { "aria-label": "Open menu" }),
4009
+ trigger: /* @__PURE__ */ n(Nt, { "aria-label": "Open menu" }),
3939
4010
  placement: "bottom right",
3940
- children: ({ close: b }) => /* @__PURE__ */ w(Ht, { children: [
3941
- /* @__PURE__ */ n(ko, { onClose: b }),
3942
- /* @__PURE__ */ n(Lo, { onClose: b }),
3943
- /* @__PURE__ */ n(zo, {}),
3944
- /* @__PURE__ */ n(Fo, { onClose: b })
4011
+ children: ({ close: b }) => /* @__PURE__ */ w(zt, { children: [
4012
+ /* @__PURE__ */ n(Vo, { onClose: b }),
4013
+ /* @__PURE__ */ n(Oo, { onClose: b }),
4014
+ /* @__PURE__ */ n(Ko, {}),
4015
+ /* @__PURE__ */ n(qo, { onClose: b })
3945
4016
  ] })
3946
4017
  }
3947
4018
  )
3948
4019
  }
3949
4020
  ),
3950
- /* @__PURE__ */ n(Hr, { variant: "default", ...h }),
4021
+ /* @__PURE__ */ n(Gr, { variant: "default", ...h }),
3951
4022
  /* @__PURE__ */ n(
3952
- Va,
4023
+ Ua,
3953
4024
  {
3954
4025
  placeholder: s,
3955
4026
  showBranding: i,
3956
4027
  variant: "default",
3957
- icons: c,
4028
+ icons: l,
3958
4029
  onUserMessageSent: p
3959
4030
  }
3960
4031
  )
3961
4032
  ] });
3962
4033
  }
3963
- function Ur({
4034
+ function Xr({
3964
4035
  appId: e,
3965
4036
  isOpen: t,
3966
4037
  onClose: a,
@@ -3968,23 +4039,23 @@ function Ur({
3968
4039
  title: s,
3969
4040
  placeholder: i,
3970
4041
  showBranding: r = !0,
3971
- customMessages: c = {},
4042
+ customMessages: l = {},
3972
4043
  avatarConfig: f,
3973
4044
  coverRegistry: _,
3974
4045
  icons: m,
3975
- heroHeaderLayout: l,
4046
+ heroHeaderLayout: d,
3976
4047
  // Note: showTrigger is accepted but not implemented yet (reserved for future use)
3977
- ...d
4048
+ ...c
3978
4049
  }) {
3979
4050
  return /* @__PURE__ */ n(
3980
- nn,
4051
+ rn,
3981
4052
  {
3982
4053
  appId: e,
3983
- customMessages: c,
4054
+ customMessages: l,
3984
4055
  avatarConfig: f,
3985
- ...d,
4056
+ ...c,
3986
4057
  children: /* @__PURE__ */ n(
3987
- Fr,
4058
+ Kr,
3988
4059
  {
3989
4060
  isOpen: t,
3990
4061
  onClose: a,
@@ -3994,58 +4065,58 @@ function Ur({
3994
4065
  showBranding: r,
3995
4066
  coverRegistry: _,
3996
4067
  icons: m,
3997
- heroHeaderLayout: l
4068
+ heroHeaderLayout: d
3998
4069
  }
3999
4070
  )
4000
4071
  }
4001
4072
  );
4002
4073
  }
4003
- const Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4074
+ const ai = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4004
4075
  __proto__: null,
4005
- WebchatApp: Ur
4076
+ WebchatApp: Xr
4006
4077
  }, Symbol.toStringTag, { value: "Module" }));
4007
4078
  export {
4008
4079
  Be as A,
4009
- dn as B,
4010
- Io as C,
4011
- on as D,
4012
- ro as E,
4013
- po as F,
4014
- U as G,
4015
- Mo as H,
4016
- rn as I,
4017
- Oa as J,
4018
- xr as K,
4019
- tn as L,
4020
- yt as M,
4021
- Yr as N,
4022
- fo as O,
4023
- Za as T,
4024
- Ur as W,
4080
+ hn as B,
4081
+ Lo as C,
4082
+ cn as D,
4083
+ uo as E,
4084
+ wo as F,
4085
+ z as G,
4086
+ To as H,
4087
+ un as I,
4088
+ Ha as J,
4089
+ kr as K,
4090
+ sn as L,
4091
+ Nt as M,
4092
+ ai as N,
4093
+ vo as O,
4094
+ es as T,
4095
+ Xr as W,
4025
4096
  Ae as a,
4026
- Nn as b,
4027
- wt as c,
4028
- An as d,
4029
- Lo as e,
4030
- ko as f,
4031
- Fo as g,
4032
- zo as h,
4097
+ En as b,
4098
+ Mt as c,
4099
+ xn as d,
4100
+ Oo as e,
4101
+ Vo as f,
4102
+ qo as g,
4103
+ Ko as h,
4033
4104
  ie as i,
4034
- Je as j,
4035
- Er as k,
4036
- Fn as l,
4037
- Jn as m,
4038
- Ct as n,
4039
- qn as o,
4040
- co as p,
4041
- Yn as q,
4042
- bo as r,
4043
- Ro as s,
4044
- Va as t,
4045
- Hr as u,
4046
- nn as v,
4105
+ et as j,
4106
+ Lr as k,
4107
+ qn as l,
4108
+ oo as m,
4109
+ Pt as n,
4110
+ Zn as o,
4111
+ _o as p,
4112
+ no as q,
4113
+ Mo as r,
4114
+ ko as s,
4115
+ Ua as t,
4116
+ Gr as u,
4117
+ rn as v,
4047
4118
  qe as w,
4048
- an as x,
4049
- Sn as y,
4050
- mo as z
4119
+ ln as x,
4120
+ In as y,
4121
+ po as z
4051
4122
  };