@telia-ace/widget-conversation 1.1.2-rc.1 → 1.1.2-rc.11

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,1584 @@
1
+ import { jsx as n, jsxs as h, Fragment as N } from "react/jsx-runtime";
2
+ import a from "@emotion/styled";
3
+ import { borderTabStyle as f, Input as se, Button as I, SymbolBadge as x, useIsTabbing as ae, useDispatch as Y, useContainer as ie, useProperties as H, 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 He, Suspense as Te, useRef as me, useMemo as Ae, 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(), u = 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
+ } = H(), [O, 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 && (u("user-submit", { text: e }), r(""), j(""))) : e.length < 1 && d.preventDefault();
35
+ }, pe = (d) => {
36
+ $ && (d.preventDefault(), u("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 && u("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__ */ h(
61
+ je,
62
+ {
63
+ grow: z,
64
+ className: T("humany-conversation-input", t),
65
+ scrollableCss: O,
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(I)`
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
+ }, R = 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__ */ h(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
+ }), M = ({
530
+ className: t,
531
+ name: e,
532
+ timestamp: r,
533
+ ariaHidden: o = !1
534
+ }) => {
535
+ const s = He(ge);
536
+ if (!e && !r)
537
+ return null;
538
+ let i = "";
539
+ return e ? r ? i = `${e}: ${re(r, s)}` : i = e : r && (i = re(r, s)), /* @__PURE__ */ n(Qe, { "aria-hidden": o, children: i });
540
+ }, fe = ({
541
+ className: t,
542
+ children: e,
543
+ sender: r,
544
+ timestamp: o
545
+ }) => {
546
+ const { avatar: s, name: i } = r, { avatarSize: c } = H();
547
+ return /* @__PURE__ */ h(
548
+ Ze,
549
+ {
550
+ hasAvatar: !!s,
551
+ className: T(
552
+ t,
553
+ "humany-conversation-agent-message"
554
+ ),
555
+ children: [
556
+ s && /* @__PURE__ */ n(We, { avatarSize: c, children: typeof s == "string" ? (
557
+ // eslint-disable-next-line jsx-a11y/alt-text
558
+ /* @__PURE__ */ n("img", { src: s })
559
+ ) : /* @__PURE__ */ n(x, { symbol: s }) }),
560
+ e,
561
+ /* @__PURE__ */ n(
562
+ M,
563
+ {
564
+ name: i,
565
+ timestamp: o,
566
+ ariaHidden: !0
567
+ }
568
+ )
569
+ ]
570
+ }
571
+ );
572
+ }, Ze = a.div`
573
+ display: grid;
574
+ margin-right: 10%;
575
+ width: 90%;
576
+ ${(t) => t.hasAvatar ? p`
577
+ grid-template-columns: auto 1fr;
578
+ grid-template-rows: 1fr auto;
579
+ grid-template-areas:
580
+ 'avatar content'
581
+ '. info';
582
+ ` : p`
583
+ grid-template-columns: 1fr;
584
+ grid-template-rows: 1fr auto;
585
+ grid-template-areas:
586
+ 'content'
587
+ 'info';
588
+ `};
589
+ `, et = Z(
590
+ ({ className: t, children: e, timestamp: r, discrete: o, fullWidth: s }, i) => /* @__PURE__ */ n(
591
+ tt,
592
+ {
593
+ ref: i,
594
+ className: T(
595
+ t,
596
+ "humany-conversation-system-message"
597
+ ),
598
+ fullWidth: s,
599
+ children: o ? /* @__PURE__ */ h(nt, { className: "humany-conversation-discrete-message", children: [
600
+ e,
601
+ /* @__PURE__ */ n(M, { timestamp: r })
602
+ ] }) : /* @__PURE__ */ h(N, { children: [
603
+ e,
604
+ /* @__PURE__ */ n(M, { timestamp: r })
605
+ ] })
606
+ }
607
+ )
608
+ ), tt = a.div`
609
+ ${(t) => t.fullWidth && "width: 100%"};
610
+ padding: 0 ${(t) => {
611
+ var e;
612
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
613
+ }};
614
+ overflow: auto;
615
+ `, nt = a.div`
616
+ text-align: center;
617
+ word-wrap: break-word;
618
+ font-size: ${(t) => {
619
+ var e;
620
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
621
+ }};
622
+ color: ${(t) => {
623
+ var e;
624
+ return (e = t.theme.colors) == null ? void 0 : e.text;
625
+ }};
626
+ > p {
627
+ margin: 0;
628
+ }
629
+ `, rt = ({ className: t, children: e, timestamp: r }) => {
630
+ const { userLabel: o = "" } = H();
631
+ return /* @__PURE__ */ h(
632
+ ot,
633
+ {
634
+ className: T(
635
+ t,
636
+ "humany-conversation-user-message"
637
+ ),
638
+ children: [
639
+ e,
640
+ /* @__PURE__ */ n(
641
+ M,
642
+ {
643
+ name: o,
644
+ timestamp: r,
645
+ ariaHidden: !0
646
+ }
647
+ )
648
+ ]
649
+ }
650
+ );
651
+ }, ot = a.div`
652
+ margin-left: 10%;
653
+ width: 90%;
654
+ display: flex;
655
+ flex-direction: column;
656
+ align-items: flex-end;
657
+ `, ee = (t) => Array.isArray(t) ? t : Object.keys(t).map((e) => ({
658
+ label: t[e],
659
+ actionKey: e
660
+ })), st = ({ header: t, actions: e, dispatch: r }) => /* @__PURE__ */ n(
661
+ at,
662
+ {
663
+ className: "humany-conversation-button-list",
664
+ header: t,
665
+ items: ee(e),
666
+ renderItem: (o) => {
667
+ var i;
668
+ const s = !!((i = o == null ? void 0 : o.data) != null && i.href);
669
+ return /* @__PURE__ */ n("li", { children: s ? /* @__PURE__ */ h(
670
+ it,
671
+ {
672
+ onClick: () => {
673
+ r("action", o);
674
+ },
675
+ href: o.data.href,
676
+ target: o.data.target,
677
+ "aria-label": o.label,
678
+ title: o.label,
679
+ children: [
680
+ /* @__PURE__ */ n(x, { symbol: o.symbol }),
681
+ o.label
682
+ ]
683
+ }
684
+ ) : /* @__PURE__ */ h(
685
+ lt,
686
+ {
687
+ onClick: () => {
688
+ r("action", o);
689
+ },
690
+ "aria-label": o.label,
691
+ title: o.label,
692
+ children: [
693
+ /* @__PURE__ */ n(x, { symbol: o.symbol }),
694
+ o.label
695
+ ]
696
+ }
697
+ ) }, o.actionKey);
698
+ }
699
+ }
700
+ ), at = a(K)`
701
+ ${E}
702
+ > ul {
703
+ display: flex;
704
+ flex-wrap: wrap;
705
+ gap: ${(t) => {
706
+ var e;
707
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
708
+ }};
709
+ > li {
710
+ margin: 0;
711
+ }
712
+ }
713
+ ${S}
714
+ `, it = a(we)`
715
+ ${B};
716
+
717
+ display: block;
718
+ padding: ${(t) => {
719
+ var e;
720
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
721
+ }};
722
+ background-color: ${(t) => {
723
+ var e;
724
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
725
+ }};
726
+ width: 100%;
727
+ color: #ffffff;
728
+ overflow: hidden;
729
+ text-overflow: ellipsis;
730
+ &:focus-visible {
731
+ ${f}
732
+ background-color: transparent;
733
+ }
734
+
735
+ i,
736
+ svg {
737
+ margin-right: ${(t) => {
738
+ var e;
739
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
740
+ }};
741
+ }
742
+ `, lt = a(I)`
743
+ ${B};
744
+
745
+ display: block;
746
+ padding: ${(t) => {
747
+ var e;
748
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
749
+ }};
750
+ background-color: ${(t) => {
751
+ var e;
752
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
753
+ }};
754
+ width: 100%;
755
+ color: #ffffff;
756
+ overflow: hidden;
757
+ text-overflow: ellipsis;
758
+ &:focus-visible {
759
+ ${f}
760
+ background-color: transparent;
761
+ }
762
+
763
+ i,
764
+ svg {
765
+ margin-right: ${(t) => {
766
+ var e;
767
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
768
+ }};
769
+ }
770
+ `, ct = ({ type: t, content: e = {} }) => {
771
+ const r = ke(t);
772
+ return !r || !t ? null : /* @__PURE__ */ n(Te, { fallback: null, children: /* @__PURE__ */ n(r, { ...e }) });
773
+ }, dt = ({ body: t }) => /* @__PURE__ */ n(mt, { html: t }), mt = a(G)`
774
+ ${Ce}
775
+ color: inherit;
776
+ white-space: pre-wrap;
777
+ ${S}
778
+ a {
779
+ color: ${(t) => t.theme.colors.link};
780
+ &:focus-visible {
781
+ ${f};
782
+ }
783
+ }
784
+ `, ut = ({ header: t, actions: e, dispatch: r }) => /* @__PURE__ */ n(
785
+ ht,
786
+ {
787
+ className: "humany-conversation-item-list",
788
+ header: t,
789
+ items: ee(e),
790
+ renderItem: (o) => {
791
+ var s;
792
+ return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ h(gt, { children: [
793
+ ((s = o.symbol) == null ? void 0 : s.content) && /* @__PURE__ */ n("div", { className: "item-icon", children: /* @__PURE__ */ n(
794
+ x,
795
+ {
796
+ size: 22,
797
+ symbol: {
798
+ type: o.symbol.type,
799
+ content: o.symbol.content
800
+ }
801
+ }
802
+ ) }),
803
+ /* @__PURE__ */ h("div", { className: "item-body", children: [
804
+ /* @__PURE__ */ n(
805
+ I,
806
+ {
807
+ onClick: () => {
808
+ r("action", o);
809
+ },
810
+ "aria-label": o.label,
811
+ title: o.label,
812
+ children: o.label
813
+ }
814
+ ),
815
+ o.description && /* @__PURE__ */ n("p", { children: o.description })
816
+ ] })
817
+ ] }) }, o.actionKey);
818
+ }
819
+ }
820
+ ), ht = a(K)`
821
+ ${E}
822
+
823
+ > .humany-paragraph {
824
+ ${S}
825
+ margin-bottom: 0;
826
+
827
+ h1 {
828
+ margin: 0;
829
+ }
830
+ }
831
+
832
+ ${(t) => J(t)(
833
+ "h1",
834
+ p`
835
+ white-space: normal;
836
+ `
837
+ )}
838
+
839
+ > ul {
840
+ display: flex;
841
+ flex-direction: column;
842
+ gap: ${(t) => {
843
+ var e;
844
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
845
+ }};
846
+ > li {
847
+ margin: 0;
848
+ }
849
+ }
850
+
851
+ li {
852
+ border-bottom: ${(t) => t.theme.border};
853
+
854
+ &:last-of-type {
855
+ border-bottom: none;
856
+ }
857
+ }
858
+ `, gt = a.div`
859
+ display: flex;
860
+ gap: ${(t) => {
861
+ var e;
862
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
863
+ }};
864
+ ${S}
865
+
866
+ .item-icon {
867
+ }
868
+
869
+ .item-body {
870
+ display: flex;
871
+ flex-direction: column;
872
+ align-items: flex-start;
873
+ gap: ${(t) => {
874
+ var e;
875
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
876
+ }};
877
+
878
+ p {
879
+ margin: 0;
880
+ white-space: normal;
881
+ }
882
+ }
883
+
884
+ button {
885
+ background: transparent;
886
+ border: none;
887
+ font-family: inherit;
888
+ font-size: ${(t) => {
889
+ var e;
890
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
891
+ }};
892
+ cursor: pointer;
893
+ padding: 0;
894
+ margin: 0;
895
+
896
+ &:focus-visible {
897
+ ${f}
898
+ span {
899
+ color: ${(t) => {
900
+ var e;
901
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
902
+ }};
903
+ text-decoration: underline;
904
+ }
905
+ }
906
+ }
907
+ `, ft = ({ header: t, actions: e, dispatch: r }) => {
908
+ const o = Se(e), s = me(), i = ae();
909
+ return Q(() => {
910
+ if (o && Array.isArray(e) && Array.isArray(o) && o.length < e.length && s.current) {
911
+ const c = s.current.querySelectorAll(
912
+ ".humany-conversation-link-list > ul > li"
913
+ ), m = c[o.length];
914
+ if (c.length === e.length && o.length) {
915
+ const u = c[o.length - 1];
916
+ if (u) {
917
+ const y = u.querySelector(
918
+ ".humany-button"
919
+ );
920
+ y && y.focus();
921
+ }
922
+ } else
923
+ m && new MutationObserver((y, b) => {
924
+ y.forEach((l) => {
925
+ if (l.addedNodes) {
926
+ const g = Array.from(
927
+ l.addedNodes
928
+ ).find((w) => w.tagName === "BUTTON");
929
+ g && Ne(s.current, document.activeElement) && (i && g.focus(), b.disconnect());
930
+ }
931
+ });
932
+ }).observe(m, {
933
+ attributes: !1,
934
+ characterData: !1,
935
+ childList: !0,
936
+ subtree: !0,
937
+ attributeOldValue: !1,
938
+ characterDataOldValue: !1
939
+ });
940
+ }
941
+ }), /* @__PURE__ */ n(
942
+ yt,
943
+ {
944
+ ref: s,
945
+ className: "humany-conversation-link-list",
946
+ header: t,
947
+ items: ee(e),
948
+ renderItem: (c) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ h(
949
+ pt,
950
+ {
951
+ help: c.actionKey === "help",
952
+ onClick: () => {
953
+ r("action", c);
954
+ },
955
+ "aria-label": c.label,
956
+ title: c.label,
957
+ children: [
958
+ c.label,
959
+ c.actionKey === "help" && /* @__PURE__ */ n(
960
+ x,
961
+ {
962
+ size: 14,
963
+ symbol: {
964
+ type: "Svg",
965
+ content: "caret-down"
966
+ }
967
+ }
968
+ )
969
+ ]
970
+ }
971
+ ) }, c.actionKey)
972
+ }
973
+ );
974
+ }, yt = a(K)`
975
+ ${E}
976
+ ${S}
977
+
978
+ ${(t) => J(t)(
979
+ "h1",
980
+ p`
981
+ white-space: normal;
982
+ `
983
+ )}
984
+
985
+ > ul {
986
+ display: flex;
987
+ flex-direction: column;
988
+ gap: ${(t) => {
989
+ var e;
990
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
991
+ }};
992
+ > li {
993
+ margin: 0;
994
+ }
995
+ }
996
+ `, pt = a(I)`
997
+ display: block;
998
+ text-align: left;
999
+ font-weight: 300;
1000
+ color: ${(t) => {
1001
+ var e;
1002
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1003
+ }};
1004
+ max-width: 100%;
1005
+ text-overflow: ellipsis;
1006
+ overflow: hidden;
1007
+
1008
+ ${(t) => {
1009
+ var e, r;
1010
+ return t.help && p`
1011
+ color: ${(e = t.theme.colors) == null ? void 0 : e.text};
1012
+ text-decoration: underline;
1013
+
1014
+ i,
1015
+ svg {
1016
+ margin-left: ${(r = t.theme.sizes) == null ? void 0 : r.small};
1017
+ }
1018
+ `;
1019
+ }}
1020
+
1021
+ &:focus-visible {
1022
+ ${f}
1023
+ span {
1024
+ color: ${(t) => {
1025
+ var e;
1026
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1027
+ }};
1028
+ text-decoration: underline;
1029
+ }
1030
+ }
1031
+ `, bt = () => /* @__PURE__ */ n($t, { className: "humany-conversation-separator" }), $t = a.div`
1032
+ ${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
1033
+ width: 100%;
1034
+ `, vt = ({ text: t }) => /* @__PURE__ */ n(xt, { className: "humany-conversation-text", variant: "span", children: t }), xt = a(X)`
1035
+ ${S}
1036
+ `, wt = ({
1037
+ header: t = "Video call",
1038
+ acceptLabel: e = "Accept",
1039
+ declineLabel: r = "Decline",
1040
+ dispatch: o
1041
+ }) => {
1042
+ const s = Ae(() => [
1043
+ {
1044
+ label: e,
1045
+ actionKey: "accept-video-call",
1046
+ symbol: {
1047
+ type: "Svg",
1048
+ content: "video"
1049
+ }
1050
+ },
1051
+ {
1052
+ label: r,
1053
+ actionKey: "decline-video-call",
1054
+ symbol: {
1055
+ type: "Svg",
1056
+ content: "close"
1057
+ }
1058
+ }
1059
+ ], [e, r]);
1060
+ return /* @__PURE__ */ n(
1061
+ kt,
1062
+ {
1063
+ className: "humany-conversation-video-request",
1064
+ header: t,
1065
+ items: s,
1066
+ renderItem: (i) => {
1067
+ const c = i.actionKey === "accept-video-call" ? "#70c48e" : "#da5c85";
1068
+ return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
1069
+ Ct,
1070
+ {
1071
+ onClick: () => {
1072
+ o("action", i);
1073
+ },
1074
+ "aria-label": i.label,
1075
+ title: i.label,
1076
+ bgColor: c,
1077
+ children: /* @__PURE__ */ n(x, { symbol: i.symbol, size: 25 })
1078
+ }
1079
+ ) }, i.actionKey);
1080
+ }
1081
+ }
1082
+ );
1083
+ }, kt = a(K)`
1084
+ ${(t) => E(t)}
1085
+ > ul {
1086
+ display: flex;
1087
+ flex-wrap: wrap;
1088
+ gap: ${(t) => {
1089
+ var e;
1090
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
1091
+ }};
1092
+ > li {
1093
+ margin: 0;
1094
+ }
1095
+ }
1096
+ ${(t) => S(t)}
1097
+ `, Ct = a(I)`
1098
+ ${B};
1099
+
1100
+ background-color: ${(t) => t.bgColor};
1101
+ display: flex;
1102
+ justify-content: center;
1103
+ align-items: center;
1104
+ color: #ffffff;
1105
+ width: 46px;
1106
+ height: 46px;
1107
+ border-radius: 100%;
1108
+
1109
+ &:focus-visible {
1110
+ ${f}
1111
+ background-color: transparent;
1112
+
1113
+ i,
1114
+ svg {
1115
+ color: ${(t) => {
1116
+ var e;
1117
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1118
+ }};
1119
+
1120
+ path {
1121
+ stroke: ${(t) => {
1122
+ var e;
1123
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1124
+ }};
1125
+ }
1126
+ }
1127
+ }
1128
+
1129
+ i,
1130
+ svg {
1131
+ color: #fff;
1132
+
1133
+ path {
1134
+ stroke: #fff;
1135
+ }
1136
+ }
1137
+ `, St = ([t, e]) => ({ type: t, content: e }), zt = ({ items: t, dispatch: e }) => /* @__PURE__ */ n(
1138
+ Lt,
1139
+ {
1140
+ role: "none",
1141
+ className: "humany-message-list",
1142
+ items: t.map(St),
1143
+ renderLi: !0,
1144
+ renderItem: (r) => {
1145
+ switch (r.type) {
1146
+ case C.Text:
1147
+ return /* @__PURE__ */ n(vt, { text: r.content });
1148
+ case C.HTML:
1149
+ return /* @__PURE__ */ n(dt, { ...r.content });
1150
+ case C.Separator:
1151
+ return /* @__PURE__ */ n(bt, { ...r.content });
1152
+ case C.ItemList:
1153
+ return /* @__PURE__ */ n(ut, { ...r.content, dispatch: e });
1154
+ case C.LinkList:
1155
+ return /* @__PURE__ */ n(ft, { ...r.content, dispatch: e });
1156
+ case C.ButtonList:
1157
+ return /* @__PURE__ */ n(st, { ...r.content, dispatch: e });
1158
+ case C.VideoRequest:
1159
+ return /* @__PURE__ */ n(wt, { ...r.content, dispatch: e });
1160
+ default:
1161
+ return /* @__PURE__ */ n(ct, { type: r.type, content: r.content });
1162
+ }
1163
+ }
1164
+ }
1165
+ ), Lt = a(ce)`
1166
+ ${ze}
1167
+
1168
+ > li {
1169
+ margin: 0;
1170
+ }
1171
+ `, Nt = Z(
1172
+ ({ className: t, timestamp: e, sender: r, type: o, content: s }, i) => {
1173
+ const c = ue(
1174
+ (l) => {
1175
+ let g = "first";
1176
+ return s.length > 1 && (g = l === 0 ? "first" : l + 1 === s.length ? "last" : "middle"), g;
1177
+ },
1178
+ [s]
1179
+ ), { userLabel: m = "" } = H(), u = () => /* @__PURE__ */ n(N, { children: s.map((l) => {
1180
+ const { key: g, body: w, title: z, form: $, actions: A } = l, O = !!w && !z && !$ && !A;
1181
+ return /* @__PURE__ */ n(
1182
+ et,
1183
+ {
1184
+ className: t,
1185
+ discrete: O,
1186
+ ref: i,
1187
+ timestamp: e,
1188
+ fullWidth: !!$ || !!A,
1189
+ children: O && w ? /* @__PURE__ */ n(G, { html: w }) : /* @__PURE__ */ n(q, { isSystem: !0, content: l })
1190
+ },
1191
+ g
1192
+ );
1193
+ }) }), y = () => /* @__PURE__ */ h(N, { children: [
1194
+ /* @__PURE__ */ n(oe, { className: "humany-sr-only", children: /* @__PURE__ */ n(M, { name: r == null ? void 0 : r.name, timestamp: e }) }),
1195
+ /* @__PURE__ */ n(
1196
+ fe,
1197
+ {
1198
+ sender: r,
1199
+ timestamp: e,
1200
+ className: t,
1201
+ children: /* @__PURE__ */ n(V, { className: "humany-message-content-bundle", children: s.map((l, g) => /* @__PURE__ */ n(
1202
+ _,
1203
+ {
1204
+ className: "humany-message-container",
1205
+ left: !0,
1206
+ ref: i,
1207
+ children: /* @__PURE__ */ n(
1208
+ q,
1209
+ {
1210
+ content: l,
1211
+ stacked: c(g)
1212
+ }
1213
+ )
1214
+ },
1215
+ l.key
1216
+ )) })
1217
+ }
1218
+ )
1219
+ ] }), b = () => /* @__PURE__ */ h(N, { children: [
1220
+ /* @__PURE__ */ n(oe, { className: "humany-sr-only", children: /* @__PURE__ */ n(M, { name: m, timestamp: e }) }),
1221
+ /* @__PURE__ */ n(rt, { timestamp: e, className: t, children: /* @__PURE__ */ n(V, { className: "humany-message-content-bundle", children: s.map((l, g) => /* @__PURE__ */ n(
1222
+ _,
1223
+ {
1224
+ className: "humany-message-container",
1225
+ right: !0,
1226
+ ref: i,
1227
+ children: /* @__PURE__ */ n(
1228
+ q,
1229
+ {
1230
+ isUser: !0,
1231
+ content: l,
1232
+ stacked: c(g)
1233
+ }
1234
+ )
1235
+ },
1236
+ l.key
1237
+ )) }) })
1238
+ ] });
1239
+ switch (o) {
1240
+ case W.System:
1241
+ return u();
1242
+ case W.Agent:
1243
+ return y();
1244
+ case W.User:
1245
+ return b();
1246
+ default:
1247
+ return null;
1248
+ }
1249
+ }
1250
+ ), q = ({
1251
+ content: t,
1252
+ isUser: e,
1253
+ isSystem: r,
1254
+ stacked: o
1255
+ }) => {
1256
+ const s = Y(), { title: i, body: c, actions: m, form: u, items: y } = t;
1257
+ return y ? /* @__PURE__ */ n(
1258
+ F,
1259
+ {
1260
+ className: "humany-message-content",
1261
+ user: !!e,
1262
+ stacked: o,
1263
+ children: /* @__PURE__ */ n(zt, { items: y, dispatch: s })
1264
+ }
1265
+ ) : /* @__PURE__ */ h(
1266
+ F,
1267
+ {
1268
+ className: "humany-message-content",
1269
+ padded: !r,
1270
+ user: !!e,
1271
+ stacked: o,
1272
+ fullWidth: !!u || !!m,
1273
+ children: [
1274
+ i && /* @__PURE__ */ n(R, { children: /* @__PURE__ */ n(Ve, { variant: "h2", children: i }) }),
1275
+ c && /* @__PURE__ */ n(R, { children: /* @__PURE__ */ n(Xe, { html: c }) }),
1276
+ u && /* @__PURE__ */ n(R, { children: /* @__PURE__ */ n(
1277
+ Ye,
1278
+ {
1279
+ ...u,
1280
+ onChange: (l, g) => {
1281
+ s("form", {
1282
+ data: g,
1283
+ formKey: u.schema.id,
1284
+ actionKey: l
1285
+ });
1286
+ }
1287
+ }
1288
+ ) }),
1289
+ m && /* @__PURE__ */ n(R, { children: /* @__PURE__ */ n(
1290
+ Ge,
1291
+ {
1292
+ items: Object.keys(m).map((l) => ({ label: m[l], actionKey: l })),
1293
+ renderItem: (l) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
1294
+ Je,
1295
+ {
1296
+ onClick: () => {
1297
+ s("action", l.actionKey);
1298
+ },
1299
+ children: l.label
1300
+ }
1301
+ ) }, l.actionKey)
1302
+ }
1303
+ ) })
1304
+ ]
1305
+ }
1306
+ );
1307
+ }, oe = a.div`
1308
+ position: absolute;
1309
+ left: -10000px;
1310
+ top: auto;
1311
+ width: 1px;
1312
+ height: 1px;
1313
+ overflow: hidden;
1314
+ `, ye = () => {
1315
+ const t = ue((m) => {
1316
+ m && setTimeout(() => {
1317
+ m.scrollIntoView({
1318
+ block: "start",
1319
+ behavior: "smooth"
1320
+ });
1321
+ }, 250);
1322
+ }, []), [e, r] = le(!0), {
1323
+ messages: o,
1324
+ loading: s,
1325
+ typingActors: i = []
1326
+ } = H(), c = () => i && i.length ? i.map((m, u) => /* @__PURE__ */ n(
1327
+ U,
1328
+ {
1329
+ id: `typing_${m.name}`,
1330
+ children: /* @__PURE__ */ n(fe, { timestamp: Date.now(), sender: m, children: /* @__PURE__ */ n(
1331
+ ne,
1332
+ {
1333
+ boxed: !0,
1334
+ ref: t
1335
+ }
1336
+ ) })
1337
+ },
1338
+ `typing_${m.name}`
1339
+ )) : null;
1340
+ return /* @__PURE__ */ h(N, { children: [
1341
+ /* @__PURE__ */ h(Mt, { tabIndex: 0, scrollableCss: e, ref: r, children: [
1342
+ o && o.length ? o.map((m, u) => {
1343
+ const { type: y, timestamp: b, sender: l, content: g } = m;
1344
+ return /* @__PURE__ */ n(
1345
+ U,
1346
+ {
1347
+ className: "humany-conversation-entry",
1348
+ tabIndex: -1,
1349
+ children: /* @__PURE__ */ n(Nt, { ...m, ref: t })
1350
+ },
1351
+ `${y}_${l == null ? void 0 : l.name}_${b}_${g[0].key}`
1352
+ );
1353
+ }) : null,
1354
+ c(),
1355
+ s && /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(ne, { ref: t }) })
1356
+ ] }),
1357
+ /* @__PURE__ */ n(Re, {})
1358
+ ] });
1359
+ }, Mt = a.div`
1360
+ display: flex;
1361
+ flex-direction: column;
1362
+ align-items: stretch;
1363
+ flex: 0 1 100%;
1364
+ padding: 0 ${(t) => {
1365
+ var e;
1366
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1367
+ }};
1368
+ ${(t) => !!t.scrollableCss && t.scrollableCss};
1369
+ &:focus-visible {
1370
+ ${(t) => f(t)};
1371
+ }
1372
+ `, U = a.div`
1373
+ margin: 0;
1374
+ margin-bottom: ${(t) => {
1375
+ var e;
1376
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1377
+ }};
1378
+
1379
+ &:first-of-type {
1380
+ margin-top: ${(t) => {
1381
+ var e;
1382
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1383
+ }};
1384
+ }
1385
+
1386
+ &:last-of-type {
1387
+ padding-bottom: ${(t) => {
1388
+ var e;
1389
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1390
+ }};
1391
+ }
1392
+
1393
+ & span,
1394
+ p,
1395
+ a,
1396
+ div {
1397
+ font-weight: 300;
1398
+ }
1399
+
1400
+ & b,
1401
+ h1 {
1402
+ font-weight: normal;
1403
+ }
1404
+
1405
+ &:focus-visible {
1406
+ ${f}
1407
+ border-radius: ${(t) => {
1408
+ var e;
1409
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1410
+ }};
1411
+ }
1412
+ ${(t) => J(t)(
1413
+ "h1",
1414
+ p`
1415
+ font-weight: normal;
1416
+ `
1417
+ )}
1418
+ `, It = ({ dispatch: t }) => {
1419
+ const e = me(null);
1420
+ return Q(() => {
1421
+ e.current && e.current.parentNode && t("overlay-mounted", e.current);
1422
+ }, [e]), /* @__PURE__ */ n(
1423
+ de,
1424
+ {
1425
+ portalId: "humany-conversation-overlay-portal",
1426
+ className: "humany-conversation-overlay-outlet",
1427
+ ref: e
1428
+ }
1429
+ );
1430
+ }, Ht = ({
1431
+ dispatch: t,
1432
+ header: e,
1433
+ buttonLabel: r
1434
+ }) => /* @__PURE__ */ h(
1435
+ Tt,
1436
+ {
1437
+ portalId: "humany-conversation-portal",
1438
+ className: "humany-conversation-outlet",
1439
+ children: [
1440
+ /* @__PURE__ */ h(At, { className: "humany-conversation-outlet-head", children: [
1441
+ /* @__PURE__ */ n(
1442
+ Rt,
1443
+ {
1444
+ className: "humany-conversation-outlet-head-button",
1445
+ "aria-label": r,
1446
+ title: r,
1447
+ onClick: () => t("hide-overlay-conversation"),
1448
+ children: /* @__PURE__ */ n(
1449
+ x,
1450
+ {
1451
+ symbol: {
1452
+ type: "Svg",
1453
+ content: "caret-down"
1454
+ },
1455
+ size: 20
1456
+ }
1457
+ )
1458
+ }
1459
+ ),
1460
+ e && /* @__PURE__ */ n(
1461
+ Ot,
1462
+ {
1463
+ className: "humany-conversation-outlet-header",
1464
+ variant: "h1",
1465
+ children: e
1466
+ }
1467
+ )
1468
+ ] }),
1469
+ /* @__PURE__ */ n(ye, {})
1470
+ ]
1471
+ }
1472
+ ), Tt = a(de)`
1473
+ z-index: 11;
1474
+ top: auto;
1475
+ height: 65%;
1476
+ background-color: #ffffff;
1477
+ display: flex;
1478
+ flex-direction: column;
1479
+ border-top-right-radius: ${(t) => {
1480
+ var e;
1481
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
1482
+ }};
1483
+ border-top-left-radius: ${(t) => {
1484
+ var e;
1485
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
1486
+ }};
1487
+ `, At = a.div`
1488
+ display: flex;
1489
+ flex-direction: column;
1490
+ justify-content: center;
1491
+ align-items: center;
1492
+ gap: ${(t) => {
1493
+ var e;
1494
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
1495
+ }};
1496
+ padding: ${(t) => {
1497
+ var e;
1498
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
1499
+ }};
1500
+ ${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
1501
+ `, Ot = a(X)`
1502
+ font-size: ${(t) => {
1503
+ var e;
1504
+ return (e = t.theme.fonts) == null ? void 0 : e.medium;
1505
+ }};
1506
+ color: ${(t) => {
1507
+ var e;
1508
+ return (e = t.theme.colors) == null ? void 0 : e.text;
1509
+ }};
1510
+ margin: 0;
1511
+ `, Rt = a(I)`
1512
+ display: flex;
1513
+ align-items: center;
1514
+ justify-content: center;
1515
+ padding: ${(t) => {
1516
+ var e;
1517
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1518
+ }} ${(t) => {
1519
+ var e;
1520
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
1521
+ }};
1522
+ ${(t) => t.theme.borderRadius && `border-radius: ${t.theme.borderRadius};`}
1523
+
1524
+ &:focus-visible {
1525
+ ${f};
1526
+ }
1527
+
1528
+ svg line {
1529
+ stroke: ${(t) => {
1530
+ var e;
1531
+ return (e = t.theme.colors) == null ? void 0 : e.text;
1532
+ }};
1533
+ }
1534
+ `, Yt = ({ className: t, ...e }) => {
1535
+ const {
1536
+ overlay: r,
1537
+ overlayConversationHeader: o,
1538
+ overlayConversationCloseLabel: s,
1539
+ conversationControllerId: i
1540
+ } = H(), c = Y(), u = ie().get("$settings");
1541
+ return /* @__PURE__ */ n(
1542
+ Le.Provider,
1543
+ {
1544
+ value: i ? { id: i } : null,
1545
+ children: /* @__PURE__ */ h(ge.Provider, { value: u == null ? void 0 : u.language, children: [
1546
+ /* @__PURE__ */ n(
1547
+ Bt,
1548
+ {
1549
+ "aria-live": "assertive",
1550
+ ...e,
1551
+ className: T(
1552
+ t,
1553
+ "humany-conversation-component"
1554
+ ),
1555
+ children: /* @__PURE__ */ n(ye, {})
1556
+ }
1557
+ ),
1558
+ r && /* @__PURE__ */ h(N, { children: [
1559
+ /* @__PURE__ */ n(It, { dispatch: c }),
1560
+ r.conversation && /* @__PURE__ */ n(
1561
+ Ht,
1562
+ {
1563
+ dispatch: c,
1564
+ header: o,
1565
+ buttonLabel: s
1566
+ }
1567
+ )
1568
+ ] })
1569
+ ] })
1570
+ }
1571
+ );
1572
+ }, Bt = a.div`
1573
+ position: absolute;
1574
+ right: 0;
1575
+ left: 0;
1576
+ bottom: 0;
1577
+ top: 0;
1578
+ overflow: hidden;
1579
+ display: flex;
1580
+ flex-direction: column;
1581
+ `;
1582
+ export {
1583
+ Yt as default
1584
+ };