@telia-ace/widget-conversation 0.0.1

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