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

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