@telia-ace/widget-conversation 1.1.2-rc.10 → 1.1.2-rc.12

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,119 +1,110 @@
1
- import { jsx as n, jsxs as u, Fragment as N } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as u, Fragment as L } from "react/jsx-runtime";
2
2
  import a from "@emotion/styled";
3
- import { borderTabStyle as f, Input as se, Button as M, SymbolBadge as x, useIsTabbing as ae, useDispatch as Y, useContainer as ie, useProperties as I, useScroll as le, Typography as X, invertedHoverButton as xe, Html as G, List as ce, buttonCss as B, ItemList as K, itemList as E, Link as we, useComponent as ke, genericHtml as Ce, headingElement as J, usePrevious as Se, list as ze, WidgetOverlayOutlet as de, ConversationContext as Le } from "@telia-ace/widget-ui";
4
- import { appendClassNames as T, htmlParentContains as Ne } from "@telia-ace/widget-utilities";
5
- import { css as p, keyframes as Me } from "@emotion/react";
6
- import Ie, { useState as P, useEffect as Q, forwardRef as Z, useContext as Te, Suspense as Ae, useRef as me, useMemo as He, useCallback as ue } from "react";
7
- import { FormComponent as Oe } from "@telia-ace/widget-forms";
8
- import { ConversationMessageListItemType as C, ConversationMessageType as W } from "./index.mjs";
3
+ import { Input as ne, borderTabStyle as y, Button as M, SymbolBadge as x, useIsTabbing as re, useDispatch as _, useProperties as C, useScroll as oe, Typography as F, invertedHoverButton as be, Html as Y, List as se, buttonCss as R, ItemList as B, itemList as K, Link as $e, useComponent as ve, genericHtml as xe, headingElement as X, usePrevious as ke, list as we, useContainer as ae, WidgetOverlayOutlet as ie, ConversationContext as Ce } from "@telia-ace/widget-ui";
4
+ import { appendClassNames as H, htmlParentContains as Se } from "@telia-ace/widget-utilities";
5
+ import { css as b, keyframes as ze } from "@emotion/react";
6
+ import Le, { useState as D, useEffect as G, forwardRef as J, useContext as Ne, Suspense as Me, useRef as le, useMemo as Ie, useCallback as ce } from "react";
7
+ import { FormComponent as He } from "@telia-ace/widget-forms";
8
+ import { ConversationMessageListItemType as w, ConversationMessageType as j } from "./index.mjs";
9
9
  import "@telia-ace/widget-core";
10
10
  import "@telia-ace/widget-services";
11
11
  import "@telia-ace/widget-plugins";
12
- const Re = ({ className: t }) => {
13
- const [e, r] = P(""), [o, s] = P(0), [i, c] = P(0), m = ae(), h = Y(), y = ie(), {
14
- inputPlaceholder: b = "Type your message",
15
- inputHidden: l = !1,
16
- inputDisabled: g = !1,
17
- sendButtonLabel: w = "Send message",
18
- inputMultiline: z = !0,
19
- secondaryAction: $,
20
- skipToLatestMessageLabel: A = "Skip to latest message"
21
- } = I(), [H, v] = le(!0);
22
- Q(() => {
23
- if (v.current) {
24
- const { lineHeight: d, maxHeight: k } = getComputedStyle(v.current);
25
- if (d && d.indexOf("px") > -1) {
26
- const L = d.split("px"), $e = parseInt(L[0], 10);
27
- s($e);
28
- const ve = k.split("px");
29
- c(parseInt(ve[0], 10));
12
+ const Te = ({ className: t }) => {
13
+ const [e, o] = D(""), [r, s] = D(0), [i, c] = D(0), d = re(), m = _(), {
14
+ inputPlaceholder: f = "Type your message",
15
+ inputHidden: k = !1,
16
+ inputDisabled: l = !1,
17
+ sendButtonLabel: h = "Send message",
18
+ inputMultiline: $ = !0,
19
+ secondaryAction: v
20
+ } = C(), [T, p] = oe(!0);
21
+ G(() => {
22
+ if (p.current) {
23
+ const { lineHeight: g, maxHeight: A } = getComputedStyle(p.current);
24
+ if (g && g.indexOf("px") > -1) {
25
+ const I = g.split("px"), ye = parseInt(I[0], 10);
26
+ s(ye);
27
+ const pe = A.split("px");
28
+ c(parseInt(pe[0], 10));
30
29
  }
31
30
  }
32
- }, [v.current]);
33
- const D = (d) => {
34
- !d.shiftKey || !z ? (d.preventDefault(), e && e.length > 0 && (h("user-submit", { text: e }), r(""), j(""))) : e.length < 1 && d.preventDefault();
35
- }, pe = (d) => {
36
- $ && (d.preventDefault(), h("action", {
37
- actionKey: $.action,
38
- ...$
31
+ }, [p.current]);
32
+ const z = (g) => {
33
+ !g.shiftKey || !$ ? (g.preventDefault(), e && e.length > 0 && (m("user-submit", { text: e }), o(""), E(""))) : e.length < 1 && g.preventDefault();
34
+ }, ge = (g) => {
35
+ v && (g.preventDefault(), m("action", {
36
+ actionKey: v.action,
37
+ ...v
39
38
  }));
40
- }, be = (d) => {
41
- if (z && v.current) {
42
- const k = v.current.scrollHeight;
43
- if (k > o) {
44
- v.current.style.height = "auto";
45
- let L = k;
46
- d.length < 1 && (L = o), v.current.style.height = `${L}px`, L >= i ? v.current.style.overflowY = "scroll" : v.current.style.overflowY = "hidden";
39
+ }, fe = (g) => {
40
+ if ($ && p.current) {
41
+ const A = p.current.scrollHeight;
42
+ if (A > r) {
43
+ p.current.style.height = "auto";
44
+ let I = A;
45
+ g.length < 1 && (I = r), p.current.style.height = `${I}px`, I >= i ? p.current.style.overflowY = "scroll" : p.current.style.overflowY = "hidden";
47
46
  }
48
47
  }
49
- }, j = (d) => {
50
- be(d), r(d), d && d.length > 0 && h("user-typing", { textLength: d.length });
51
- }, te = () => {
52
- const d = y.get("widgetDOMElement");
53
- if (d) {
54
- const k = d.querySelectorAll(
55
- ".humany-conversation-entry"
56
- );
57
- k.length && k[k.length - 1].focus();
58
- }
48
+ }, E = (g) => {
49
+ fe(g), o(g), g && g.length > 0 && m("user-typing", { textLength: g.length });
59
50
  };
60
- return l ? null : /* @__PURE__ */ u(
61
- je,
51
+ return k ? null : /* @__PURE__ */ u(
52
+ Be,
62
53
  {
63
- grow: z,
64
- className: T("humany-conversation-input", t),
65
- scrollableCss: H,
66
- isTabbing: m,
54
+ grow: $,
55
+ className: H("humany-conversation-input", t),
56
+ scrollableCss: T,
57
+ isTabbing: d,
67
58
  children: [
68
- $ && /* @__PURE__ */ n(
69
- De,
59
+ v && /* @__PURE__ */ n(
60
+ Re,
70
61
  {
71
- disabled: g,
72
- onClick: pe,
73
- title: $.label,
74
- "aria-label": $.label,
62
+ disabled: l,
63
+ onClick: ge,
64
+ title: v.label,
65
+ "aria-label": v.label,
75
66
  children: /* @__PURE__ */ n(
76
67
  x,
77
68
  {
78
69
  size: 24,
79
- symbol: { type: "Svg", content: $.icon || "browse" }
70
+ symbol: { type: "Svg", content: v.icon || "browse" }
80
71
  }
81
72
  )
82
73
  }
83
74
  ),
84
- z ? /* @__PURE__ */ n(
85
- Ke,
75
+ $ ? /* @__PURE__ */ n(
76
+ Ae,
86
77
  {
87
78
  value: e,
88
- onChange: j,
89
- onEnter: D,
90
- disabled: g,
91
- "aria-label": b,
92
- placeholder: b,
79
+ onChange: E,
80
+ onEnter: z,
81
+ disabled: l,
82
+ "aria-label": f,
83
+ placeholder: f,
93
84
  type: "textarea",
94
85
  rows: 1,
95
- ref: v
86
+ ref: p
96
87
  }
97
88
  ) : /* @__PURE__ */ n(
98
- Ee,
89
+ Oe,
99
90
  {
100
91
  value: e,
101
- onChange: j,
102
- onEnter: D,
103
- disabled: g,
104
- "aria-label": b,
105
- placeholder: b
92
+ onChange: E,
93
+ onEnter: z,
94
+ disabled: l,
95
+ "aria-label": f,
96
+ placeholder: f
106
97
  }
107
98
  ),
108
99
  /* @__PURE__ */ n(
109
- he,
100
+ de,
110
101
  {
111
102
  disabled: !1,
112
- onClick: D,
113
- title: w,
114
- "aria-label": w,
103
+ onClick: z,
104
+ title: h,
105
+ "aria-label": h,
115
106
  children: /* @__PURE__ */ n(
116
- Pe,
107
+ Ke,
117
108
  {
118
109
  size: 22,
119
110
  symbol: { type: "Svg", content: "send" },
@@ -121,42 +112,11 @@ const Re = ({ className: t }) => {
121
112
  }
122
113
  )
123
114
  }
124
- ),
125
- /* @__PURE__ */ n(
126
- Be,
127
- {
128
- className: "humany-skip-to-latest-message",
129
- onKeyDown: (d) => {
130
- (d.key === "Enter" || d.keyCode === 13) && te();
131
- },
132
- onClick: te,
133
- children: A
134
- }
135
115
  )
136
116
  ]
137
117
  }
138
118
  );
139
- }, Be = a.button`
140
- position: absolute;
141
- bottom: 112px;
142
- text-align: center;
143
- background-color: white;
144
- padding: ${(t) => {
145
- var e;
146
- return (e = t.theme.sizes) == null ? void 0 : e.small;
147
- }};
148
- text-decoration: none;
149
- border-radius: ${(t) => {
150
- var e;
151
- return (e = t.theme.sizes) == null ? void 0 : e.small;
152
- }};
153
- left: -10000000px;
154
- &:focus-visible {
155
- left: 50%;
156
- transform: translateX(-50%);
157
- ${f};
158
- }
159
- `, Ke = a(se)`
119
+ }, Ae = a(ne)`
160
120
  resize: none;
161
121
  flex: 1;
162
122
  flex-shrink: 1;
@@ -177,10 +137,10 @@ const Re = ({ className: t }) => {
177
137
  transition: height 200ms linear;
178
138
  outline: none;
179
139
  &:focus-visible {
180
- ${f};
140
+ ${y};
181
141
  outline-offset: 12px;
182
142
  }
183
- `, Ee = a(se)`
143
+ `, Oe = a(ne)`
184
144
  flex: 1;
185
145
  border: none;
186
146
  background-color: transparent;
@@ -206,7 +166,7 @@ const Re = ({ className: t }) => {
206
166
  }};
207
167
  font-style: italic;
208
168
  }
209
- `, he = a(M)`
169
+ `, de = a(M)`
210
170
  flex: 0 0 50px;
211
171
  align-self: stretch;
212
172
  background-color: transparent;
@@ -216,19 +176,19 @@ const Re = ({ className: t }) => {
216
176
  border: none;
217
177
  color: #a6a6a6;
218
178
  &:focus-visible {
219
- ${f};
179
+ ${y};
220
180
  }
221
- `, De = a(he)`
181
+ `, Re = a(de)`
222
182
  border-right: ${(t) => t.theme.border};
223
183
  margin: ${(t) => {
224
184
  var e;
225
185
  return (e = t.theme.sizes) == null ? void 0 : e.normal;
226
186
  }} 0;
227
- `, je = a.div`
228
- ${(t) => t.grow ? p`
187
+ `, Be = a.div`
188
+ ${(t) => t.grow ? b`
229
189
  min-height: 50px;
230
190
  max-height: 150px;
231
- ` : p`
191
+ ` : b`
232
192
  height: 50px;
233
193
  `}
234
194
  flex: 0 0 auto;
@@ -239,11 +199,11 @@ const Re = ({ className: t }) => {
239
199
  return (e = t.theme.colors) == null ? void 0 : e.accent;
240
200
  }};
241
201
  border-top: ${(t) => t.theme.inputBorder};
242
- ${(t) => t["data-has-focus"] && t.isTabbing && f}
202
+ ${(t) => t["data-has-focus"] && t.isTabbing && y}
243
203
  textarea {
244
204
  ${(t) => !!t.scrollableCss && t.scrollableCss}
245
205
  }
246
- `, Pe = a(
206
+ `, Ke = a(
247
207
  ({
248
208
  hasContent: t,
249
209
  ...e
@@ -260,7 +220,7 @@ const Re = ({ className: t }) => {
260
220
  return t.hasContent ? (e = t.theme.colors) == null ? void 0 : e.primary : "#a6a6a6";
261
221
  }};
262
222
  }
263
- `, We = a.div`
223
+ `, Ee = a.div`
264
224
  width: ${(t) => t.avatarSize || "32px"};
265
225
  height: ${(t) => t.avatarSize || "32px"};
266
226
  border-radius: 50%;
@@ -307,7 +267,7 @@ const Re = ({ className: t }) => {
307
267
  }};
308
268
  }
309
269
  }
310
- `, qe = Me`
270
+ `, De = ze`
311
271
  0% {
312
272
  opacity: 0;
313
273
  }
@@ -317,7 +277,7 @@ const Re = ({ className: t }) => {
317
277
  100% {
318
278
  opacity: 0;
319
279
  }
320
- `, Ue = a.div`
280
+ `, je = a.div`
321
281
  display: flex;
322
282
  justify-content: center;
323
283
  > div {
@@ -329,7 +289,7 @@ const Re = ({ className: t }) => {
329
289
  var e;
330
290
  return (e = t.theme.colors) == null ? void 0 : e.text;
331
291
  }};
332
- animation: ${qe} 1s infinite;
292
+ animation: ${De} 1s infinite;
333
293
  }
334
294
  > div:nth-of-type(2) {
335
295
  animation-delay: 100ms;
@@ -337,29 +297,29 @@ const Re = ({ className: t }) => {
337
297
  > div:nth-of-type(3) {
338
298
  animation-delay: 200ms;
339
299
  }
340
- `, V = a.div`
300
+ `, q = a.div`
341
301
  grid-area: content;
342
302
  max-width: 100%;
343
303
  overflow: hidden;
344
- `, Ve = a(X)`
304
+ `, Pe = a(F)`
345
305
  font-size: ${(t) => {
346
306
  var e;
347
307
  return (e = t.theme.fonts) == null ? void 0 : e.normal;
348
308
  }};
349
309
  font-weight: normal;
350
310
  margin: 0;
351
- `, _ = a.div`
311
+ `, U = a.div`
352
312
  display: flex;
353
313
  ${(t) => t.left && "justify-content: start;"};
354
314
  ${(t) => t.center && "justify-content: center;"};
355
315
  ${(t) => t.right && "justify-content: end;"};
356
- `, F = a.div`
316
+ `, V = a.div`
357
317
  ${(t) => {
358
318
  var e;
359
319
  return t.padded && `padding: ${(e = t.theme.sizes) == null ? void 0 : e.medium};`;
360
320
  }}
361
- ${(t) => !t.user && t.stacked && _e(t.stacked, t.theme)}
362
- ${(t) => t.user && t.stacked && Fe(t.stacked, t.theme)}
321
+ ${(t) => !t.user && t.stacked && We(t.stacked, t.theme)}
322
+ ${(t) => t.user && t.stacked && qe(t.stacked, t.theme)}
363
323
 
364
324
  display: inline-block;
365
325
  margin-top: ${(t) => {
@@ -375,15 +335,15 @@ const Re = ({ className: t }) => {
375
335
  }
376
336
  max-width: 100%;
377
337
  ${(t) => t.fullWidth && "width: 100%;"}
378
- `, _e = (t, e) => {
379
- var o, s;
380
- const r = p`
381
- background-color: ${(o = e.colors) == null ? void 0 : o.accent};
338
+ `, We = (t, e) => {
339
+ var r, s;
340
+ const o = b`
341
+ background-color: ${(r = e.colors) == null ? void 0 : r.accent};
382
342
  color: ${(s = e.colors) == null ? void 0 : s.text};
383
343
  ${e.border && `border: ${e.border};`};
384
344
  `;
385
- return e.borderRadius ? p`
386
- ${r}
345
+ return e.borderRadius ? b`
346
+ ${o}
387
347
 
388
348
  border-top-right-radius: ${e.borderRadius};
389
349
  border-bottom-right-radius: ${e.borderRadius};
@@ -395,15 +355,15 @@ const Re = ({ className: t }) => {
395
355
  ${t === "last" && `
396
356
  border-bottom-left-radius: ${e.borderRadius};
397
357
  `}
398
- ` : r;
399
- }, Fe = (t, e) => {
400
- var o, s;
401
- const r = p`
402
- background-color: ${(o = e.colors) == null ? void 0 : o.primary};
358
+ ` : o;
359
+ }, qe = (t, e) => {
360
+ var r, s;
361
+ const o = b`
362
+ background-color: ${(r = e.colors) == null ? void 0 : r.primary};
403
363
  color: ${(s = e.colors) == null ? void 0 : s.accent};
404
364
  `;
405
- return e.borderRadius ? p`
406
- ${r}
365
+ return e.borderRadius ? b`
366
+ ${o}
407
367
 
408
368
  border-top-left-radius: ${e.borderRadius};
409
369
  border-bottom-left-radius: ${e.borderRadius};
@@ -415,7 +375,7 @@ const Re = ({ className: t }) => {
415
375
  ${t === "last" && `
416
376
  border-bottom-right-radius: ${e.borderRadius};
417
377
  `}
418
- ` : r;
378
+ ` : o;
419
379
  }, O = a.div`
420
380
  margin-bottom: ${(t) => {
421
381
  var e;
@@ -425,18 +385,18 @@ const Re = ({ className: t }) => {
425
385
  margin-bottom: 0;
426
386
  }
427
387
  `, S = (t) => {
428
- var e, r;
429
- return p`
388
+ var e, o;
389
+ return b`
430
390
  margin: ${(e = t.theme.sizes) == null ? void 0 : e.medium} 0;
431
- padding: 0 ${(r = t.theme.sizes) == null ? void 0 : r.medium};
391
+ padding: 0 ${(o = t.theme.sizes) == null ? void 0 : o.medium};
432
392
  `;
433
- }, Ye = a(Oe)`
393
+ }, Ue = a(He)`
434
394
  & button.humany-form-component-button {
435
395
  ${(t) => {
436
- var e, r, o, s;
437
- return ((e = t.theme.colors) == null ? void 0 : e.primary) && ((r = t.theme.colors) == null ? void 0 : r.accent) && xe({
396
+ var e, o, r, s;
397
+ return ((e = t.theme.colors) == null ? void 0 : e.primary) && ((o = t.theme.colors) == null ? void 0 : o.accent) && be({
438
398
  active: !1,
439
- primaryColor: (o = t.theme.colors) == null ? void 0 : o.primary,
399
+ primaryColor: (r = t.theme.colors) == null ? void 0 : r.primary,
440
400
  secondaryColor: (s = t.theme.colors) == null ? void 0 : s.accent,
441
401
  theme: t.theme
442
402
  });
@@ -458,18 +418,18 @@ const Re = ({ className: t }) => {
458
418
  }};
459
419
  }
460
420
  }
461
- `, Xe = a(G)`
421
+ `, Ve = a(Y)`
462
422
  white-space: pre-wrap;
463
423
  a {
464
424
  color: ${(t) => t.theme.colors.link};
465
425
  &:focus {
466
426
  ${(t) => {
467
427
  var e;
468
- return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && f;
428
+ return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && y;
469
429
  }};
470
430
  }
471
431
  }
472
- `, Ge = a(ce)`
432
+ `, _e = a(se)`
473
433
  padding: 0;
474
434
  list-style: none;
475
435
  margin: 0 -${(t) => {
@@ -482,8 +442,8 @@ const Re = ({ className: t }) => {
482
442
  return (e = t.theme.sizes) == null ? void 0 : e.normal;
483
443
  }};
484
444
  }
485
- `, Je = a.button`
486
- ${(t) => B(t)};
445
+ `, Fe = a.button`
446
+ ${(t) => R(t)};
487
447
  display: block;
488
448
  background-color: ${(t) => {
489
449
  var e;
@@ -492,23 +452,23 @@ const Re = ({ className: t }) => {
492
452
  width: 100%;
493
453
  color: #fff;
494
454
  &:focus-visible {
495
- ${f}
455
+ ${y}
496
456
  background-color: transparent;
497
457
  }
498
- `, ne = Z(
499
- ({ boxed: t, className: e, agentData: r }, o) => /* @__PURE__ */ n(V, { ref: o, children: /* @__PURE__ */ n(_, { left: t, center: !t, children: /* @__PURE__ */ n(
500
- F,
458
+ `, Z = J(
459
+ ({ boxed: t, className: e, agentData: o }, r) => /* @__PURE__ */ n(q, { ref: r, children: /* @__PURE__ */ n(U, { left: t, center: !t, children: /* @__PURE__ */ n(
460
+ V,
501
461
  {
502
462
  padded: !!t,
503
463
  stacked: t ? "first" : void 0,
504
- children: /* @__PURE__ */ u(Ue, { children: [
464
+ children: /* @__PURE__ */ u(je, { children: [
505
465
  /* @__PURE__ */ n("div", {}),
506
466
  /* @__PURE__ */ n("div", {}),
507
467
  /* @__PURE__ */ n("div", {})
508
468
  ] })
509
469
  }
510
470
  ) }) })
511
- ), ge = Ie.createContext(null), Qe = a.p`
471
+ ), me = Le.createContext(null), Ye = a.p`
512
472
  && {
513
473
  font-size: ${(t) => {
514
474
  var e;
@@ -523,84 +483,96 @@ const Re = ({ className: t }) => {
523
483
  var e;
524
484
  return (e = t.theme.colors) == null ? void 0 : e.text;
525
485
  }};
526
- `, re = (t, e) => new Date(t).toLocaleTimeString(e || [], {
486
+ `, ee = (t, e) => new Date(t).toLocaleTimeString(e || [], {
527
487
  hour: "numeric",
528
488
  minute: "2-digit"
529
- }), R = ({ className: t, name: e, timestamp: r }) => {
530
- const o = Te(ge);
531
- if (!e && !r)
489
+ }), N = ({
490
+ className: t,
491
+ name: e,
492
+ timestamp: o,
493
+ ariaHidden: r = !1
494
+ }) => {
495
+ const s = Ne(me);
496
+ if (!e && !o)
532
497
  return null;
533
- let s = "";
534
- return e ? r ? s = `${e}: ${re(r, o)}` : s = e : r && (s = re(r, o)), /* @__PURE__ */ n(Qe, { children: s });
535
- }, fe = ({
498
+ let i = "";
499
+ return e ? o ? i = `${e}: ${ee(o, s)}` : i = e : o && (i = ee(o, s)), /* @__PURE__ */ n(Ye, { "aria-hidden": r, children: i });
500
+ }, ue = ({
536
501
  className: t,
537
502
  children: e,
538
- sender: r,
539
- timestamp: o
503
+ sender: o,
504
+ timestamp: r
540
505
  }) => {
541
- const { avatar: s, name: i } = r, { avatarSize: c } = I();
506
+ const { avatar: s, name: i } = o, { avatarSize: c } = C();
542
507
  return /* @__PURE__ */ u(
543
- Ze,
508
+ Xe,
544
509
  {
545
510
  hasAvatar: !!s,
546
- className: T(
511
+ className: H(
547
512
  t,
548
513
  "humany-conversation-agent-message"
549
514
  ),
550
515
  children: [
551
- s && /* @__PURE__ */ n(We, { avatarSize: c, children: typeof s == "string" ? (
516
+ s && /* @__PURE__ */ n(Ee, { avatarSize: c, children: typeof s == "string" ? (
552
517
  // eslint-disable-next-line jsx-a11y/alt-text
553
518
  /* @__PURE__ */ n("img", { src: s })
554
519
  ) : /* @__PURE__ */ n(x, { symbol: s }) }),
555
520
  e,
556
- /* @__PURE__ */ n(R, { name: i, timestamp: o })
521
+ /* @__PURE__ */ n(
522
+ N,
523
+ {
524
+ name: i,
525
+ timestamp: r,
526
+ ariaHidden: !0
527
+ }
528
+ )
557
529
  ]
558
530
  }
559
531
  );
560
- }, Ze = a.div`
532
+ }, Xe = a.div`
561
533
  display: grid;
562
534
  margin-right: 10%;
563
535
  width: 90%;
564
- ${(t) => t.hasAvatar ? p`
536
+ ${(t) => t.hasAvatar ? b`
565
537
  grid-template-columns: auto 1fr;
566
538
  grid-template-rows: 1fr auto;
567
539
  grid-template-areas:
568
540
  'avatar content'
569
541
  '. info';
570
- ` : p`
542
+ ` : b`
571
543
  grid-template-columns: 1fr;
572
544
  grid-template-rows: 1fr auto;
573
545
  grid-template-areas:
574
546
  'content'
575
547
  'info';
576
548
  `};
577
- `, et = Z(
578
- ({ className: t, children: e, timestamp: r, discrete: o, fullWidth: s }, i) => /* @__PURE__ */ n(
579
- tt,
549
+ `, Ge = J(
550
+ ({ className: t, children: e, timestamp: o, discrete: r, fullWidth: s }, i) => /* @__PURE__ */ n(
551
+ Je,
580
552
  {
581
553
  ref: i,
582
- className: T(
554
+ className: H(
583
555
  t,
584
556
  "humany-conversation-system-message"
585
557
  ),
586
558
  fullWidth: s,
587
- children: o ? /* @__PURE__ */ u(nt, { className: "humany-conversation-discrete-message", children: [
559
+ children: r ? /* @__PURE__ */ u(Qe, { className: "humany-conversation-discrete-message", children: [
588
560
  e,
589
- /* @__PURE__ */ n(R, { timestamp: r })
590
- ] }) : /* @__PURE__ */ u(N, { children: [
561
+ /* @__PURE__ */ n(N, { timestamp: o })
562
+ ] }) : /* @__PURE__ */ u(L, { children: [
591
563
  e,
592
- /* @__PURE__ */ n(R, { timestamp: r })
564
+ /* @__PURE__ */ n(N, { timestamp: o })
593
565
  ] })
594
566
  }
595
567
  )
596
- ), tt = a.div`
568
+ ), Je = a.div`
597
569
  ${(t) => t.fullWidth && "width: 100%"};
598
570
  padding: 0 ${(t) => {
599
571
  var e;
600
572
  return (e = t.theme.sizes) == null ? void 0 : e.large;
601
573
  }};
602
574
  overflow: auto;
603
- `, nt = a.div`
575
+ `, Qe = a.div`
604
576
  text-align: center;
605
577
  word-wrap: break-word;
606
578
  font-size: ${(t) => {
@@ -614,72 +586,79 @@ const Re = ({ className: t }) => {
614
586
  > p {
615
587
  margin: 0;
616
588
  }
617
- `, rt = ({ className: t, children: e, timestamp: r }) => {
618
- const { userLabel: o = "" } = I();
589
+ `, Ze = ({ className: t, children: e, timestamp: o }) => {
590
+ const { userLabel: r = "" } = C();
619
591
  return /* @__PURE__ */ u(
620
- ot,
592
+ et,
621
593
  {
622
- className: T(
594
+ className: H(
623
595
  t,
624
596
  "humany-conversation-user-message"
625
597
  ),
626
598
  children: [
627
599
  e,
628
- /* @__PURE__ */ n(R, { name: o, timestamp: r })
600
+ /* @__PURE__ */ n(
601
+ N,
602
+ {
603
+ name: r,
604
+ timestamp: o,
605
+ ariaHidden: !0
606
+ }
607
+ )
629
608
  ]
630
609
  }
631
610
  );
632
- }, ot = a.div`
611
+ }, et = a.div`
633
612
  margin-left: 10%;
634
613
  width: 90%;
635
614
  display: flex;
636
615
  flex-direction: column;
637
616
  align-items: flex-end;
638
- `, ee = (t) => Array.isArray(t) ? t : Object.keys(t).map((e) => ({
617
+ `, Q = (t) => Array.isArray(t) ? t : Object.keys(t).map((e) => ({
639
618
  label: t[e],
640
619
  actionKey: e
641
- })), st = ({ header: t, actions: e, dispatch: r }) => /* @__PURE__ */ n(
642
- at,
620
+ })), tt = ({ header: t, actions: e, dispatch: o }) => /* @__PURE__ */ n(
621
+ nt,
643
622
  {
644
623
  className: "humany-conversation-button-list",
645
624
  header: t,
646
- items: ee(e),
647
- renderItem: (o) => {
625
+ items: Q(e),
626
+ renderItem: (r) => {
648
627
  var i;
649
- const s = !!((i = o == null ? void 0 : o.data) != null && i.href);
628
+ const s = !!((i = r == null ? void 0 : r.data) != null && i.href);
650
629
  return /* @__PURE__ */ n("li", { children: s ? /* @__PURE__ */ u(
651
- it,
630
+ rt,
652
631
  {
653
632
  onClick: () => {
654
- r("action", o);
633
+ o("action", r);
655
634
  },
656
- href: o.data.href,
657
- target: o.data.target,
658
- "aria-label": o.label,
659
- title: o.label,
635
+ href: r.data.href,
636
+ target: r.data.target,
637
+ "aria-label": r.label,
638
+ title: r.label,
660
639
  children: [
661
- /* @__PURE__ */ n(x, { symbol: o.symbol }),
662
- o.label
640
+ /* @__PURE__ */ n(x, { symbol: r.symbol }),
641
+ r.label
663
642
  ]
664
643
  }
665
644
  ) : /* @__PURE__ */ u(
666
- lt,
645
+ ot,
667
646
  {
668
647
  onClick: () => {
669
- r("action", o);
648
+ o("action", r);
670
649
  },
671
- "aria-label": o.label,
672
- title: o.label,
650
+ "aria-label": r.label,
651
+ title: r.label,
673
652
  children: [
674
- /* @__PURE__ */ n(x, { symbol: o.symbol }),
675
- o.label
653
+ /* @__PURE__ */ n(x, { symbol: r.symbol }),
654
+ r.label
676
655
  ]
677
656
  }
678
- ) }, o.actionKey);
657
+ ) }, r.actionKey);
679
658
  }
680
659
  }
681
- ), at = a(K)`
682
- ${E}
660
+ ), nt = a(B)`
661
+ ${K}
683
662
  > ul {
684
663
  display: flex;
685
664
  flex-wrap: wrap;
@@ -692,8 +671,8 @@ const Re = ({ className: t }) => {
692
671
  }
693
672
  }
694
673
  ${S}
695
- `, it = a(we)`
696
- ${B};
674
+ `, rt = a($e)`
675
+ ${R};
697
676
 
698
677
  display: block;
699
678
  padding: ${(t) => {
@@ -709,7 +688,7 @@ const Re = ({ className: t }) => {
709
688
  overflow: hidden;
710
689
  text-overflow: ellipsis;
711
690
  &:focus-visible {
712
- ${f}
691
+ ${y}
713
692
  background-color: transparent;
714
693
  }
715
694
 
@@ -720,8 +699,8 @@ const Re = ({ className: t }) => {
720
699
  return (e = t.theme.sizes) == null ? void 0 : e.small;
721
700
  }};
722
701
  }
723
- `, lt = a(M)`
724
- ${B};
702
+ `, ot = a(M)`
703
+ ${R};
725
704
 
726
705
  display: block;
727
706
  padding: ${(t) => {
@@ -737,7 +716,7 @@ const Re = ({ className: t }) => {
737
716
  overflow: hidden;
738
717
  text-overflow: ellipsis;
739
718
  &:focus-visible {
740
- ${f}
719
+ ${y}
741
720
  background-color: transparent;
742
721
  }
743
722
 
@@ -748,36 +727,36 @@ const Re = ({ className: t }) => {
748
727
  return (e = t.theme.sizes) == null ? void 0 : e.small;
749
728
  }};
750
729
  }
751
- `, ct = ({ type: t, content: e = {} }) => {
752
- const r = ke(t);
753
- return !r || !t ? null : /* @__PURE__ */ n(Ae, { fallback: null, children: /* @__PURE__ */ n(r, { ...e }) });
754
- }, dt = ({ body: t }) => /* @__PURE__ */ n(mt, { html: t }), mt = a(G)`
755
- ${Ce}
730
+ `, st = ({ type: t, content: e = {} }) => {
731
+ const o = ve(t);
732
+ return !o || !t ? null : /* @__PURE__ */ n(Me, { fallback: null, children: /* @__PURE__ */ n(o, { ...e }) });
733
+ }, at = ({ body: t }) => /* @__PURE__ */ n(it, { html: t }), it = a(Y)`
734
+ ${xe}
756
735
  color: inherit;
757
736
  white-space: pre-wrap;
758
737
  ${S}
759
738
  a {
760
739
  color: ${(t) => t.theme.colors.link};
761
740
  &:focus-visible {
762
- ${f};
741
+ ${y};
763
742
  }
764
743
  }
765
- `, ut = ({ header: t, actions: e, dispatch: r }) => /* @__PURE__ */ n(
766
- ht,
744
+ `, lt = ({ header: t, actions: e, dispatch: o }) => /* @__PURE__ */ n(
745
+ ct,
767
746
  {
768
747
  className: "humany-conversation-item-list",
769
748
  header: t,
770
- items: ee(e),
771
- renderItem: (o) => {
749
+ items: Q(e),
750
+ renderItem: (r) => {
772
751
  var s;
773
- return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ u(gt, { children: [
774
- ((s = o.symbol) == null ? void 0 : s.content) && /* @__PURE__ */ n("div", { className: "item-icon", children: /* @__PURE__ */ n(
752
+ return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ u(dt, { children: [
753
+ ((s = r.symbol) == null ? void 0 : s.content) && /* @__PURE__ */ n("div", { className: "item-icon", children: /* @__PURE__ */ n(
775
754
  x,
776
755
  {
777
756
  size: 22,
778
757
  symbol: {
779
- type: o.symbol.type,
780
- content: o.symbol.content
758
+ type: r.symbol.type,
759
+ content: r.symbol.content
781
760
  }
782
761
  }
783
762
  ) }),
@@ -786,20 +765,20 @@ const Re = ({ className: t }) => {
786
765
  M,
787
766
  {
788
767
  onClick: () => {
789
- r("action", o);
768
+ o("action", r);
790
769
  },
791
- "aria-label": o.label,
792
- title: o.label,
793
- children: o.label
770
+ "aria-label": r.label,
771
+ title: r.label,
772
+ children: r.label
794
773
  }
795
774
  ),
796
- o.description && /* @__PURE__ */ n("p", { children: o.description })
775
+ r.description && /* @__PURE__ */ n("p", { children: r.description })
797
776
  ] })
798
- ] }) }, o.actionKey);
777
+ ] }) }, r.actionKey);
799
778
  }
800
779
  }
801
- ), ht = a(K)`
802
- ${E}
780
+ ), ct = a(B)`
781
+ ${K}
803
782
 
804
783
  > .humany-paragraph {
805
784
  ${S}
@@ -810,9 +789,9 @@ const Re = ({ className: t }) => {
810
789
  }
811
790
  }
812
791
 
813
- ${(t) => J(t)(
792
+ ${(t) => X(t)(
814
793
  "h1",
815
- p`
794
+ b`
816
795
  white-space: normal;
817
796
  `
818
797
  )}
@@ -836,7 +815,7 @@ const Re = ({ className: t }) => {
836
815
  border-bottom: none;
837
816
  }
838
817
  }
839
- `, gt = a.div`
818
+ `, dt = a.div`
840
819
  display: flex;
841
820
  gap: ${(t) => {
842
821
  var e;
@@ -875,7 +854,7 @@ const Re = ({ className: t }) => {
875
854
  margin: 0;
876
855
 
877
856
  &:focus-visible {
878
- ${f}
857
+ ${y}
879
858
  span {
880
859
  color: ${(t) => {
881
860
  var e;
@@ -885,32 +864,32 @@ const Re = ({ className: t }) => {
885
864
  }
886
865
  }
887
866
  }
888
- `, ft = ({ header: t, actions: e, dispatch: r }) => {
889
- const o = Se(e), s = me(), i = ae();
890
- return Q(() => {
891
- if (o && Array.isArray(e) && Array.isArray(o) && o.length < e.length && s.current) {
867
+ `, mt = ({ header: t, actions: e, dispatch: o }) => {
868
+ const r = ke(e), s = le(), i = re();
869
+ return G(() => {
870
+ if (r && Array.isArray(e) && Array.isArray(r) && r.length < e.length && s.current) {
892
871
  const c = s.current.querySelectorAll(
893
872
  ".humany-conversation-link-list > ul > li"
894
- ), m = c[o.length];
895
- if (c.length === e.length && o.length) {
896
- const h = c[o.length - 1];
897
- if (h) {
898
- const y = h.querySelector(
873
+ ), d = c[r.length];
874
+ if (c.length === e.length && r.length) {
875
+ const m = c[r.length - 1];
876
+ if (m) {
877
+ const f = m.querySelector(
899
878
  ".humany-button"
900
879
  );
901
- y && y.focus();
880
+ f && f.focus();
902
881
  }
903
882
  } else
904
- m && new MutationObserver((y, b) => {
905
- y.forEach((l) => {
883
+ d && new MutationObserver((f, k) => {
884
+ f.forEach((l) => {
906
885
  if (l.addedNodes) {
907
- const g = Array.from(
886
+ const h = Array.from(
908
887
  l.addedNodes
909
- ).find((w) => w.tagName === "BUTTON");
910
- g && Ne(s.current, document.activeElement) && (i && g.focus(), b.disconnect());
888
+ ).find(($) => $.tagName === "BUTTON");
889
+ h && Se(s.current, document.activeElement) && (i && h.focus(), k.disconnect());
911
890
  }
912
891
  });
913
- }).observe(m, {
892
+ }).observe(d, {
914
893
  attributes: !1,
915
894
  characterData: !1,
916
895
  childList: !0,
@@ -920,18 +899,18 @@ const Re = ({ className: t }) => {
920
899
  });
921
900
  }
922
901
  }), /* @__PURE__ */ n(
923
- yt,
902
+ ut,
924
903
  {
925
904
  ref: s,
926
905
  className: "humany-conversation-link-list",
927
906
  header: t,
928
- items: ee(e),
907
+ items: Q(e),
929
908
  renderItem: (c) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ u(
930
- pt,
909
+ ht,
931
910
  {
932
911
  help: c.actionKey === "help",
933
912
  onClick: () => {
934
- r("action", c);
913
+ o("action", c);
935
914
  },
936
915
  "aria-label": c.label,
937
916
  title: c.label,
@@ -952,13 +931,13 @@ const Re = ({ className: t }) => {
952
931
  ) }, c.actionKey)
953
932
  }
954
933
  );
955
- }, yt = a(K)`
956
- ${E}
934
+ }, ut = a(B)`
935
+ ${K}
957
936
  ${S}
958
937
 
959
- ${(t) => J(t)(
938
+ ${(t) => X(t)(
960
939
  "h1",
961
- p`
940
+ b`
962
941
  white-space: normal;
963
942
  `
964
943
  )}
@@ -974,7 +953,7 @@ const Re = ({ className: t }) => {
974
953
  margin: 0;
975
954
  }
976
955
  }
977
- `, pt = a(M)`
956
+ `, ht = a(M)`
978
957
  display: block;
979
958
  text-align: left;
980
959
  font-weight: 300;
@@ -987,20 +966,20 @@ const Re = ({ className: t }) => {
987
966
  overflow: hidden;
988
967
 
989
968
  ${(t) => {
990
- var e, r;
991
- return t.help && p`
969
+ var e, o;
970
+ return t.help && b`
992
971
  color: ${(e = t.theme.colors) == null ? void 0 : e.text};
993
972
  text-decoration: underline;
994
973
 
995
974
  i,
996
975
  svg {
997
- margin-left: ${(r = t.theme.sizes) == null ? void 0 : r.small};
976
+ margin-left: ${(o = t.theme.sizes) == null ? void 0 : o.small};
998
977
  }
999
978
  `;
1000
979
  }}
1001
980
 
1002
981
  &:focus-visible {
1003
- ${f}
982
+ ${y}
1004
983
  span {
1005
984
  color: ${(t) => {
1006
985
  var e;
@@ -1009,18 +988,18 @@ const Re = ({ className: t }) => {
1009
988
  text-decoration: underline;
1010
989
  }
1011
990
  }
1012
- `, bt = () => /* @__PURE__ */ n($t, { className: "humany-conversation-separator" }), $t = a.div`
991
+ `, gt = () => /* @__PURE__ */ n(ft, { className: "humany-conversation-separator" }), ft = a.div`
1013
992
  ${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
1014
993
  width: 100%;
1015
- `, vt = ({ text: t }) => /* @__PURE__ */ n(xt, { className: "humany-conversation-text", variant: "span", children: t }), xt = a(X)`
994
+ `, yt = ({ text: t }) => /* @__PURE__ */ n(pt, { className: "humany-conversation-text", variant: "span", children: t }), pt = a(F)`
1016
995
  ${S}
1017
- `, wt = ({
996
+ `, bt = ({
1018
997
  header: t = "Video call",
1019
998
  acceptLabel: e = "Accept",
1020
- declineLabel: r = "Decline",
1021
- dispatch: o
999
+ declineLabel: o = "Decline",
1000
+ dispatch: r
1022
1001
  }) => {
1023
- const s = He(() => [
1002
+ const s = Ie(() => [
1024
1003
  {
1025
1004
  label: e,
1026
1005
  actionKey: "accept-video-call",
@@ -1030,16 +1009,16 @@ const Re = ({ className: t }) => {
1030
1009
  }
1031
1010
  },
1032
1011
  {
1033
- label: r,
1012
+ label: o,
1034
1013
  actionKey: "decline-video-call",
1035
1014
  symbol: {
1036
1015
  type: "Svg",
1037
1016
  content: "close"
1038
1017
  }
1039
1018
  }
1040
- ], [e, r]);
1019
+ ], [e, o]);
1041
1020
  return /* @__PURE__ */ n(
1042
- kt,
1021
+ $t,
1043
1022
  {
1044
1023
  className: "humany-conversation-video-request",
1045
1024
  header: t,
@@ -1047,10 +1026,10 @@ const Re = ({ className: t }) => {
1047
1026
  renderItem: (i) => {
1048
1027
  const c = i.actionKey === "accept-video-call" ? "#70c48e" : "#da5c85";
1049
1028
  return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
1050
- Ct,
1029
+ vt,
1051
1030
  {
1052
1031
  onClick: () => {
1053
- o("action", i);
1032
+ r("action", i);
1054
1033
  },
1055
1034
  "aria-label": i.label,
1056
1035
  title: i.label,
@@ -1061,8 +1040,8 @@ const Re = ({ className: t }) => {
1061
1040
  }
1062
1041
  }
1063
1042
  );
1064
- }, kt = a(K)`
1065
- ${(t) => E(t)}
1043
+ }, $t = a(B)`
1044
+ ${(t) => K(t)}
1066
1045
  > ul {
1067
1046
  display: flex;
1068
1047
  flex-wrap: wrap;
@@ -1075,8 +1054,8 @@ const Re = ({ className: t }) => {
1075
1054
  }
1076
1055
  }
1077
1056
  ${(t) => S(t)}
1078
- `, Ct = a(M)`
1079
- ${B};
1057
+ `, vt = a(M)`
1058
+ ${R};
1080
1059
 
1081
1060
  background-color: ${(t) => t.bgColor};
1082
1061
  display: flex;
@@ -1088,7 +1067,7 @@ const Re = ({ className: t }) => {
1088
1067
  border-radius: 100%;
1089
1068
 
1090
1069
  &:focus-visible {
1091
- ${f}
1070
+ ${y}
1092
1071
  background-color: transparent;
1093
1072
 
1094
1073
  i,
@@ -1115,84 +1094,81 @@ const Re = ({ className: t }) => {
1115
1094
  stroke: #fff;
1116
1095
  }
1117
1096
  }
1118
- `, St = ([t, e]) => ({ type: t, content: e }), zt = ({ items: t, dispatch: e }) => /* @__PURE__ */ n(
1119
- Lt,
1097
+ `, xt = ([t, e]) => ({ type: t, content: e }), kt = ({ items: t, dispatch: e }) => /* @__PURE__ */ n(
1098
+ wt,
1120
1099
  {
1121
1100
  role: "none",
1122
1101
  className: "humany-message-list",
1123
- items: t.map(St),
1102
+ items: t.map(xt),
1124
1103
  renderLi: !0,
1125
- renderItem: (r) => {
1126
- switch (r.type) {
1127
- case C.Text:
1128
- return /* @__PURE__ */ n(vt, { text: r.content });
1129
- case C.HTML:
1130
- return /* @__PURE__ */ n(dt, { ...r.content });
1131
- case C.Separator:
1132
- return /* @__PURE__ */ n(bt, { ...r.content });
1133
- case C.ItemList:
1134
- return /* @__PURE__ */ n(ut, { ...r.content, dispatch: e });
1135
- case C.LinkList:
1136
- return /* @__PURE__ */ n(ft, { ...r.content, dispatch: e });
1137
- case C.ButtonList:
1138
- return /* @__PURE__ */ n(st, { ...r.content, dispatch: e });
1139
- case C.VideoRequest:
1140
- return /* @__PURE__ */ n(wt, { ...r.content, dispatch: e });
1104
+ renderItem: (o) => {
1105
+ switch (o.type) {
1106
+ case w.Text:
1107
+ return /* @__PURE__ */ n(yt, { text: o.content });
1108
+ case w.HTML:
1109
+ return /* @__PURE__ */ n(at, { ...o.content });
1110
+ case w.Separator:
1111
+ return /* @__PURE__ */ n(gt, { ...o.content });
1112
+ case w.ItemList:
1113
+ return /* @__PURE__ */ n(lt, { ...o.content, dispatch: e });
1114
+ case w.LinkList:
1115
+ return /* @__PURE__ */ n(mt, { ...o.content, dispatch: e });
1116
+ case w.ButtonList:
1117
+ return /* @__PURE__ */ n(tt, { ...o.content, dispatch: e });
1118
+ case w.VideoRequest:
1119
+ return /* @__PURE__ */ n(bt, { ...o.content, dispatch: e });
1141
1120
  default:
1142
- return /* @__PURE__ */ n(ct, { type: r.type, content: r.content });
1121
+ return /* @__PURE__ */ n(st, { type: o.type, content: o.content });
1143
1122
  }
1144
1123
  }
1145
1124
  }
1146
- ), Lt = a(ce)`
1147
- ${ze}
1125
+ ), wt = a(se)`
1126
+ ${we}
1148
1127
 
1149
1128
  > li {
1150
1129
  margin: 0;
1151
1130
  }
1152
- `, Nt = Z(
1153
- ({ className: t, timestamp: e, sender: r, type: o, content: s }, i) => {
1154
- const c = ue(
1131
+ `, Ct = J(
1132
+ ({ className: t, timestamp: e, sender: o, type: r, content: s }, i) => {
1133
+ const c = ce(
1155
1134
  (l) => {
1156
- let g = "first";
1157
- return s.length > 1 && (g = l === 0 ? "first" : l + 1 === s.length ? "last" : "middle"), g;
1135
+ let h = "first";
1136
+ return s.length > 1 && (h = l === 0 ? "first" : l + 1 === s.length ? "last" : "middle"), h;
1158
1137
  },
1159
1138
  [s]
1160
- ), { userLabel: m = "" } = I(), h = () => /* @__PURE__ */ n(N, { children: s.map((l) => {
1161
- const { key: g, body: w, title: z, form: $, actions: A } = l, H = !!w && !z && !$ && !A;
1139
+ ), { userLabel: d = "" } = C(), m = () => /* @__PURE__ */ n(L, { children: s.map((l) => {
1140
+ const { key: h, body: $, title: v, form: T, actions: p } = l, z = !!$ && !v && !T && !p;
1162
1141
  return /* @__PURE__ */ n(
1163
- et,
1142
+ Ge,
1164
1143
  {
1165
1144
  className: t,
1166
- discrete: H,
1145
+ discrete: z,
1167
1146
  ref: i,
1168
1147
  timestamp: e,
1169
- fullWidth: !!$ || !!A,
1170
- children: H && w ? /* @__PURE__ */ n(G, { html: w }) : /* @__PURE__ */ n(q, { isSystem: !0, content: l })
1148
+ fullWidth: !!T || !!p,
1149
+ children: z && $ ? /* @__PURE__ */ n(Y, { html: $ }) : /* @__PURE__ */ n(P, { isSystem: !0, content: l })
1171
1150
  },
1172
- g
1151
+ h
1173
1152
  );
1174
- }) }), y = () => /* @__PURE__ */ u(N, { children: [
1175
- /* @__PURE__ */ u(oe, { className: "humany-sr-only", children: [
1176
- r == null ? void 0 : r.name,
1177
- ":"
1178
- ] }),
1153
+ }) }), f = () => /* @__PURE__ */ u(L, { children: [
1154
+ /* @__PURE__ */ n(te, { className: "humany-sr-only", children: /* @__PURE__ */ n(N, { name: o == null ? void 0 : o.name, timestamp: e }) }),
1179
1155
  /* @__PURE__ */ n(
1180
- fe,
1156
+ ue,
1181
1157
  {
1182
- sender: r,
1158
+ sender: o,
1183
1159
  timestamp: e,
1184
1160
  className: t,
1185
- children: /* @__PURE__ */ n(V, { className: "humany-message-content-bundle", children: s.map((l, g) => /* @__PURE__ */ n(
1186
- _,
1161
+ children: /* @__PURE__ */ n(q, { className: "humany-message-content-bundle", children: s.map((l, h) => /* @__PURE__ */ n(
1162
+ U,
1187
1163
  {
1188
1164
  className: "humany-message-container",
1189
1165
  left: !0,
1190
1166
  ref: i,
1191
1167
  children: /* @__PURE__ */ n(
1192
- q,
1168
+ P,
1193
1169
  {
1194
1170
  content: l,
1195
- stacked: c(g)
1171
+ stacked: c(h)
1196
1172
  }
1197
1173
  )
1198
1174
  },
@@ -1200,85 +1176,82 @@ const Re = ({ className: t }) => {
1200
1176
  )) })
1201
1177
  }
1202
1178
  )
1203
- ] }), b = () => /* @__PURE__ */ u(N, { children: [
1204
- /* @__PURE__ */ u(oe, { className: "humany-sr-only", children: [
1205
- m,
1206
- ":"
1207
- ] }),
1208
- /* @__PURE__ */ n(rt, { timestamp: e, className: t, children: /* @__PURE__ */ n(V, { className: "humany-message-content-bundle", children: s.map((l, g) => /* @__PURE__ */ n(
1209
- _,
1179
+ ] }), k = () => /* @__PURE__ */ u(L, { children: [
1180
+ /* @__PURE__ */ n(te, { className: "humany-sr-only", children: /* @__PURE__ */ n(N, { name: d, timestamp: e }) }),
1181
+ /* @__PURE__ */ n(Ze, { timestamp: e, className: t, children: /* @__PURE__ */ n(q, { className: "humany-message-content-bundle", children: s.map((l, h) => /* @__PURE__ */ n(
1182
+ U,
1210
1183
  {
1211
1184
  className: "humany-message-container",
1212
1185
  right: !0,
1213
1186
  ref: i,
1214
1187
  children: /* @__PURE__ */ n(
1215
- q,
1188
+ P,
1216
1189
  {
1217
1190
  isUser: !0,
1218
1191
  content: l,
1219
- stacked: c(g)
1192
+ stacked: c(h)
1220
1193
  }
1221
1194
  )
1222
1195
  },
1223
1196
  l.key
1224
1197
  )) }) })
1225
1198
  ] });
1226
- switch (o) {
1227
- case W.System:
1228
- return h();
1229
- case W.Agent:
1230
- return y();
1231
- case W.User:
1232
- return b();
1199
+ switch (r) {
1200
+ case j.System:
1201
+ return m();
1202
+ case j.Agent:
1203
+ return f();
1204
+ case j.User:
1205
+ return k();
1233
1206
  default:
1234
1207
  return null;
1235
1208
  }
1236
1209
  }
1237
- ), q = ({
1210
+ ), P = ({
1238
1211
  content: t,
1239
1212
  isUser: e,
1240
- isSystem: r,
1241
- stacked: o
1213
+ isSystem: o,
1214
+ stacked: r
1242
1215
  }) => {
1243
- const s = Y(), { title: i, body: c, actions: m, form: h, items: y } = t;
1244
- return y ? /* @__PURE__ */ n(
1245
- F,
1216
+ const s = _(), { title: i, body: c, actions: d, form: m, items: f } = t;
1217
+ return f ? /* @__PURE__ */ n(
1218
+ V,
1246
1219
  {
1247
1220
  className: "humany-message-content",
1248
1221
  user: !!e,
1249
- stacked: o,
1250
- children: /* @__PURE__ */ n(zt, { items: y, dispatch: s })
1222
+ stacked: r,
1223
+ children: /* @__PURE__ */ n(kt, { items: f, dispatch: s })
1251
1224
  }
1252
1225
  ) : /* @__PURE__ */ u(
1253
- F,
1226
+ V,
1254
1227
  {
1255
1228
  className: "humany-message-content",
1256
- padded: !r,
1229
+ padded: !o,
1257
1230
  user: !!e,
1258
- stacked: o,
1259
- fullWidth: !!h || !!m,
1231
+ stacked: r,
1232
+ fullWidth: !!m || !!d,
1260
1233
  children: [
1261
- i && /* @__PURE__ */ n(O, { children: /* @__PURE__ */ n(Ve, { variant: "h2", children: i }) }),
1262
- c && /* @__PURE__ */ n(O, { children: /* @__PURE__ */ n(Xe, { html: c }) }),
1263
- h && /* @__PURE__ */ n(O, { children: /* @__PURE__ */ n(
1264
- Ye,
1234
+ i && /* @__PURE__ */ n(O, { children: /* @__PURE__ */ n(Pe, { variant: "h2", children: i }) }),
1235
+ c && /* @__PURE__ */ n(O, { children: /* @__PURE__ */ n(Ve, { html: c }) }),
1236
+ m && /* @__PURE__ */ n(O, { children: /* @__PURE__ */ n(
1237
+ Ue,
1265
1238
  {
1266
- ...h,
1267
- onChange: (l, g) => {
1239
+ ...m,
1240
+ onChange: (l, h) => {
1268
1241
  s("form", {
1269
- data: g,
1270
- formKey: h.schema.id,
1242
+ data: h,
1243
+ formKey: m.schema.id,
1271
1244
  actionKey: l
1272
1245
  });
1273
1246
  }
1274
1247
  }
1275
1248
  ) }),
1276
- m && /* @__PURE__ */ n(O, { children: /* @__PURE__ */ n(
1277
- Ge,
1249
+ d && /* @__PURE__ */ n(O, { children: /* @__PURE__ */ n(
1250
+ _e,
1278
1251
  {
1279
- items: Object.keys(m).map((l) => ({ label: m[l], actionKey: l })),
1252
+ items: Object.keys(d).map((l) => ({ label: d[l], actionKey: l })),
1280
1253
  renderItem: (l) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
1281
- Je,
1254
+ Fe,
1282
1255
  {
1283
1256
  onClick: () => {
1284
1257
  s("action", l.actionKey);
@@ -1291,59 +1264,101 @@ const Re = ({ className: t }) => {
1291
1264
  ]
1292
1265
  }
1293
1266
  );
1294
- }, oe = a.div`
1267
+ }, te = a.div`
1295
1268
  position: absolute;
1296
1269
  left: -10000px;
1297
1270
  top: auto;
1298
1271
  width: 1px;
1299
1272
  height: 1px;
1300
1273
  overflow: hidden;
1301
- `, ye = () => {
1302
- const t = ue((m) => {
1303
- m && setTimeout(() => {
1304
- m.scrollIntoView({
1274
+ `, St = () => {
1275
+ const { skipToLatestMessageLabel: t = "Skip to latest message" } = C(), e = ae(), o = () => {
1276
+ const r = e.get("widgetDOMElement");
1277
+ if (r) {
1278
+ const s = r.querySelectorAll(
1279
+ ".humany-conversation-entry"
1280
+ );
1281
+ s.length && s[s.length - 1].focus();
1282
+ }
1283
+ };
1284
+ return /* @__PURE__ */ n(
1285
+ zt,
1286
+ {
1287
+ className: "humany-skip-to-latest-message",
1288
+ onKeyDown: (r) => {
1289
+ (r.key === "Enter" || r.keyCode === 13) && o();
1290
+ },
1291
+ onClick: o,
1292
+ children: t
1293
+ }
1294
+ );
1295
+ }, zt = a.button`
1296
+ position: absolute;
1297
+ bottom: 60px;
1298
+ text-align: center;
1299
+ background-color: white;
1300
+ text-decoration: none;
1301
+ padding: ${(t) => {
1302
+ var e;
1303
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1304
+ }};
1305
+ border-radius: ${(t) => {
1306
+ var e;
1307
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1308
+ }};
1309
+ left: -10000000px;
1310
+ &:focus-visible {
1311
+ left: 50%;
1312
+ transform: translateX(-50%);
1313
+ ${y};
1314
+ }
1315
+ `, he = () => {
1316
+ const t = ce((d) => {
1317
+ d && setTimeout(() => {
1318
+ d.scrollIntoView({
1305
1319
  block: "start",
1306
1320
  behavior: "smooth"
1307
1321
  });
1308
1322
  }, 250);
1309
- }, []), [e, r] = le(!0), {
1310
- messages: o,
1323
+ }, []), [e, o] = oe(!0), {
1324
+ messages: r,
1311
1325
  loading: s,
1312
1326
  typingActors: i = []
1313
- } = I(), c = () => i && i.length ? i.map((m, h) => /* @__PURE__ */ n(
1314
- U,
1327
+ } = C(), c = () => i && i.length ? i.map((d, m) => /* @__PURE__ */ n(
1328
+ W,
1315
1329
  {
1316
- id: `typing_${m.name}`,
1317
- children: /* @__PURE__ */ n(fe, { timestamp: Date.now(), sender: m, children: /* @__PURE__ */ n(
1318
- ne,
1330
+ id: `typing_${d.name}`,
1331
+ children: /* @__PURE__ */ n(ue, { timestamp: Date.now(), sender: d, children: /* @__PURE__ */ n(
1332
+ Z,
1319
1333
  {
1320
1334
  boxed: !0,
1321
1335
  ref: t
1322
1336
  }
1323
1337
  ) })
1324
1338
  },
1325
- `typing_${m.name}`
1339
+ `typing_${d.name}`
1326
1340
  )) : null;
1327
- return /* @__PURE__ */ u(N, { children: [
1328
- /* @__PURE__ */ u(Mt, { tabIndex: 0, scrollableCss: e, ref: r, children: [
1329
- o && o.length ? o.map((m, h) => {
1330
- const { type: y, timestamp: b, sender: l, content: g } = m;
1341
+ return /* @__PURE__ */ u(L, { children: [
1342
+ /* @__PURE__ */ u(Lt, { tabIndex: 0, scrollableCss: e, ref: o, children: [
1343
+ r && r.length ? r.map((d, m) => {
1344
+ const { type: f, timestamp: k, sender: l, content: h } = d;
1331
1345
  return /* @__PURE__ */ n(
1332
- U,
1346
+ W,
1333
1347
  {
1334
1348
  className: "humany-conversation-entry",
1335
1349
  tabIndex: -1,
1336
- children: /* @__PURE__ */ n(Nt, { ...m, ref: t })
1350
+ children: /* @__PURE__ */ n(Ct, { ...d, ref: t })
1337
1351
  },
1338
- `${y}_${l == null ? void 0 : l.name}_${b}_${g[0].key}`
1352
+ `${f}_${l == null ? void 0 : l.name}_${k}_${h[0].key}`
1339
1353
  );
1340
1354
  }) : null,
1341
1355
  c(),
1342
- s && /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(ne, { ref: t }) })
1356
+ s && /* @__PURE__ */ n(W, { children: /* @__PURE__ */ n(Z, { ref: t }) })
1343
1357
  ] }),
1344
- /* @__PURE__ */ n(Re, {})
1358
+ /* @__PURE__ */ n(Te, {}),
1359
+ /* @__PURE__ */ n(St, {})
1345
1360
  ] });
1346
- }, Mt = a.div`
1361
+ }, Lt = a.div`
1347
1362
  display: flex;
1348
1363
  flex-direction: column;
1349
1364
  align-items: stretch;
@@ -1354,9 +1369,9 @@ const Re = ({ className: t }) => {
1354
1369
  }};
1355
1370
  ${(t) => !!t.scrollableCss && t.scrollableCss};
1356
1371
  &:focus-visible {
1357
- ${(t) => f(t)};
1372
+ ${(t) => y(t)};
1358
1373
  }
1359
- `, U = a.div`
1374
+ `, W = a.div`
1360
1375
  margin: 0;
1361
1376
  margin-bottom: ${(t) => {
1362
1377
  var e;
@@ -1390,47 +1405,47 @@ const Re = ({ className: t }) => {
1390
1405
  }
1391
1406
 
1392
1407
  &:focus-visible {
1393
- ${f}
1408
+ ${y}
1394
1409
  border-radius: ${(t) => {
1395
1410
  var e;
1396
1411
  return (e = t.theme.sizes) == null ? void 0 : e.small;
1397
1412
  }};
1398
1413
  }
1399
- ${(t) => J(t)(
1414
+ ${(t) => X(t)(
1400
1415
  "h1",
1401
- p`
1416
+ b`
1402
1417
  font-weight: normal;
1403
1418
  `
1404
1419
  )}
1405
- `, It = ({ dispatch: t }) => {
1406
- const e = me(null);
1407
- return Q(() => {
1420
+ `, Nt = ({ dispatch: t }) => {
1421
+ const e = le(null);
1422
+ return G(() => {
1408
1423
  e.current && e.current.parentNode && t("overlay-mounted", e.current);
1409
1424
  }, [e]), /* @__PURE__ */ n(
1410
- de,
1425
+ ie,
1411
1426
  {
1412
1427
  portalId: "humany-conversation-overlay-portal",
1413
1428
  className: "humany-conversation-overlay-outlet",
1414
1429
  ref: e
1415
1430
  }
1416
1431
  );
1417
- }, Tt = ({
1432
+ }, Mt = ({
1418
1433
  dispatch: t,
1419
1434
  header: e,
1420
- buttonLabel: r
1435
+ buttonLabel: o
1421
1436
  }) => /* @__PURE__ */ u(
1422
- At,
1437
+ It,
1423
1438
  {
1424
1439
  portalId: "humany-conversation-portal",
1425
1440
  className: "humany-conversation-outlet",
1426
1441
  children: [
1427
1442
  /* @__PURE__ */ u(Ht, { className: "humany-conversation-outlet-head", children: [
1428
1443
  /* @__PURE__ */ n(
1429
- Rt,
1444
+ At,
1430
1445
  {
1431
1446
  className: "humany-conversation-outlet-head-button",
1432
- "aria-label": r,
1433
- title: r,
1447
+ "aria-label": o,
1448
+ title: o,
1434
1449
  onClick: () => t("hide-overlay-conversation"),
1435
1450
  children: /* @__PURE__ */ n(
1436
1451
  x,
@@ -1445,7 +1460,7 @@ const Re = ({ className: t }) => {
1445
1460
  }
1446
1461
  ),
1447
1462
  e && /* @__PURE__ */ n(
1448
- Ot,
1463
+ Tt,
1449
1464
  {
1450
1465
  className: "humany-conversation-outlet-header",
1451
1466
  variant: "h1",
@@ -1453,10 +1468,10 @@ const Re = ({ className: t }) => {
1453
1468
  }
1454
1469
  )
1455
1470
  ] }),
1456
- /* @__PURE__ */ n(ye, {})
1471
+ /* @__PURE__ */ n(he, {})
1457
1472
  ]
1458
1473
  }
1459
- ), At = a(de)`
1474
+ ), It = a(ie)`
1460
1475
  z-index: 11;
1461
1476
  top: auto;
1462
1477
  height: 65%;
@@ -1485,7 +1500,7 @@ const Re = ({ className: t }) => {
1485
1500
  return (e = t.theme.sizes) == null ? void 0 : e.normal;
1486
1501
  }};
1487
1502
  ${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
1488
- `, Ot = a(X)`
1503
+ `, Tt = a(F)`
1489
1504
  font-size: ${(t) => {
1490
1505
  var e;
1491
1506
  return (e = t.theme.fonts) == null ? void 0 : e.medium;
@@ -1495,7 +1510,7 @@ const Re = ({ className: t }) => {
1495
1510
  return (e = t.theme.colors) == null ? void 0 : e.text;
1496
1511
  }};
1497
1512
  margin: 0;
1498
- `, Rt = a(M)`
1513
+ `, At = a(M)`
1499
1514
  display: flex;
1500
1515
  align-items: center;
1501
1516
  justify-content: center;
@@ -1509,7 +1524,7 @@ const Re = ({ className: t }) => {
1509
1524
  ${(t) => t.theme.borderRadius && `border-radius: ${t.theme.borderRadius};`}
1510
1525
 
1511
1526
  &:focus-visible {
1512
- ${f};
1527
+ ${y};
1513
1528
  }
1514
1529
 
1515
1530
  svg line {
@@ -1518,37 +1533,37 @@ const Re = ({ className: t }) => {
1518
1533
  return (e = t.theme.colors) == null ? void 0 : e.text;
1519
1534
  }};
1520
1535
  }
1521
- `, Yt = ({ className: t, ...e }) => {
1536
+ `, _t = ({ className: t, ...e }) => {
1522
1537
  const {
1523
- overlay: r,
1524
- overlayConversationHeader: o,
1538
+ overlay: o,
1539
+ overlayConversationHeader: r,
1525
1540
  overlayConversationCloseLabel: s,
1526
1541
  conversationControllerId: i
1527
- } = I(), c = Y(), h = ie().get("$settings");
1542
+ } = C(), c = _(), m = ae().get("$settings");
1528
1543
  return /* @__PURE__ */ n(
1529
- Le.Provider,
1544
+ Ce.Provider,
1530
1545
  {
1531
1546
  value: i ? { id: i } : null,
1532
- children: /* @__PURE__ */ u(ge.Provider, { value: h == null ? void 0 : h.language, children: [
1547
+ children: /* @__PURE__ */ u(me.Provider, { value: m == null ? void 0 : m.language, children: [
1533
1548
  /* @__PURE__ */ n(
1534
- Bt,
1549
+ Ot,
1535
1550
  {
1536
1551
  "aria-live": "assertive",
1537
1552
  ...e,
1538
- className: T(
1553
+ className: H(
1539
1554
  t,
1540
1555
  "humany-conversation-component"
1541
1556
  ),
1542
- children: /* @__PURE__ */ n(ye, {})
1557
+ children: /* @__PURE__ */ n(he, {})
1543
1558
  }
1544
1559
  ),
1545
- r && /* @__PURE__ */ u(N, { children: [
1546
- /* @__PURE__ */ n(It, { dispatch: c }),
1547
- r.conversation && /* @__PURE__ */ n(
1548
- Tt,
1560
+ o && /* @__PURE__ */ u(L, { children: [
1561
+ /* @__PURE__ */ n(Nt, { dispatch: c }),
1562
+ o.conversation && /* @__PURE__ */ n(
1563
+ Mt,
1549
1564
  {
1550
1565
  dispatch: c,
1551
- header: o,
1566
+ header: r,
1552
1567
  buttonLabel: s
1553
1568
  }
1554
1569
  )
@@ -1556,7 +1571,7 @@ const Re = ({ className: t }) => {
1556
1571
  ] })
1557
1572
  }
1558
1573
  );
1559
- }, Bt = a.div`
1574
+ }, Ot = a.div`
1560
1575
  position: absolute;
1561
1576
  right: 0;
1562
1577
  left: 0;
@@ -1567,5 +1582,5 @@ const Re = ({ className: t }) => {
1567
1582
  flex-direction: column;
1568
1583
  `;
1569
1584
  export {
1570
- Yt as default
1585
+ _t as default
1571
1586
  };