@opencx/widget 3.0.0 → 3.0.2

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 (107) hide show
  1. package/dist/basic.cjs +3 -3
  2. package/dist/basic.cjs.map +1 -1
  3. package/dist/basic.js +432 -429
  4. package/dist/basic.js.map +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/react.cjs +1 -1
  8. package/dist/react.js +2 -2
  9. package/dist/{src → types/src}/designs/react/basic/index.d.ts +1 -1
  10. package/dist/{src → types/src}/designs/react/basic/utils/group-messages-by-type.d.ts +1 -1
  11. package/dist/{src → types/src}/designs/react/components/BotOrAgentMessage.d.ts +1 -1
  12. package/dist/{src → types/src}/designs/react/components/BotOrAgentMessageGroup.d.ts +1 -1
  13. package/dist/{src → types/src}/designs/react/components/Fallback.component.d.ts +1 -1
  14. package/dist/{src → types/src}/designs/react/components/RenderFile.d.ts +1 -1
  15. package/dist/{src/designs/react/components/keyboard.d.ts → types/src/designs/react/components/SuggestedReplies.d.ts} +2 -2
  16. package/dist/{src → types/src}/designs/react/components/Text.component.d.ts +1 -1
  17. package/dist/{src → types/src}/designs/react/components/UserMessageGroup.d.ts +1 -1
  18. package/dist/{src → types/src}/designs/react/components/lib/button.d.ts +1 -1
  19. package/dist/{src → types/src}/designs/react/components/lib/dialog.d.ts +7 -7
  20. package/dist/{src → types/src}/designs/react/components/lib/dropdown-menu.d.ts +2 -2
  21. package/dist/types/src/designs/react/hooks/useLocale.d.ts +6 -0
  22. package/dist/{src → types/src}/designs/react/index.d.ts +1 -1
  23. package/dist/{src → types/src}/headless/core/context/contact.d.ts +6 -7
  24. package/dist/{src → types/src}/headless/core/context/message.d.ts +5 -3
  25. package/dist/{src → types/src}/headless/core/context/session.d.ts +3 -3
  26. package/dist/{src → types/src}/headless/core/context/widget.d.ts +1 -1
  27. package/dist/types/src/headless/core/index.d.ts +10 -0
  28. package/dist/{src → types/src}/headless/core/types/messages.d.ts +1 -1
  29. package/dist/{src → types/src}/headless/core/types/schemas.d.ts +1 -1
  30. package/dist/{src → types/src}/headless/core/utils/Poller.d.ts +1 -1
  31. package/dist/{src → types/src}/headless/react/WidgetProvider.d.ts +1 -1
  32. package/dist/types/src/headless/react/hooks/useConfig.d.ts +1 -0
  33. package/dist/{src → types/src}/headless/react/hooks/useContact.d.ts +1 -1
  34. package/dist/{src → types/src}/headless/react/hooks/useMessages.d.ts +1 -1
  35. package/dist/{src → types/src}/headless/react/hooks/usePubsub.d.ts +1 -1
  36. package/dist/{src → types/src}/headless/react/index.d.ts +0 -1
  37. package/dist/{src → types/src}/headless/react/types/components.d.ts +1 -2
  38. package/dist/{useUploadFiles-BaCcqTwX.js → useUploadFiles-DJElNIQi.js} +87 -87
  39. package/dist/useUploadFiles-DJElNIQi.js.map +1 -0
  40. package/dist/{useUploadFiles-BZa0DENN.cjs → useUploadFiles-DMskqhR-.cjs} +4 -4
  41. package/dist/useUploadFiles-DMskqhR-.cjs.map +1 -0
  42. package/dist/{widget-DbgWez1r.js → widget-BeNOCqB5.js} +46 -43
  43. package/dist/widget-BeNOCqB5.js.map +1 -0
  44. package/dist/{widget-BlvH6dre.cjs → widget-DlAUwHzU.cjs} +2 -2
  45. package/dist/widget-DlAUwHzU.cjs.map +1 -0
  46. package/dist-embed/script.js +100 -100
  47. package/dist-embed/script.js.map +1 -1
  48. package/package.json +8 -13
  49. package/dist/basic.d.ts +0 -2
  50. package/dist/index.d.ts +0 -2
  51. package/dist/react.d.ts +0 -2
  52. package/dist/src/designs/react/hooks/useLocale.d.ts +0 -6
  53. package/dist/src/headless/core/index.d.ts +0 -7
  54. package/dist/src/headless/react/hooks/useConfig.d.ts +0 -1
  55. package/dist/useUploadFiles-BZa0DENN.cjs.map +0 -1
  56. package/dist/useUploadFiles-BaCcqTwX.js.map +0 -1
  57. package/dist/vitest/setup.d.ts +0 -1
  58. package/dist/widget-BlvH6dre.cjs.map +0 -1
  59. package/dist/widget-DbgWez1r.js.map +0 -1
  60. /package/dist/{src → types/src}/designs/react/basic/WidgetPopoverTrigger.d.ts +0 -0
  61. /package/dist/{src → types/src}/designs/react/basic/screens/chat-screen/ChatFooter.d.ts +0 -0
  62. /package/dist/{src → types/src}/designs/react/basic/screens/chat-screen/ChatHeader.d.ts +0 -0
  63. /package/dist/{src → types/src}/designs/react/basic/screens/chat-screen/ChatMain.d.ts +0 -0
  64. /package/dist/{src → types/src}/designs/react/basic/screens/chat-screen/ChatScreen.d.ts +0 -0
  65. /package/dist/{src → types/src}/designs/react/basic/screens/root-screen.d.ts +0 -0
  66. /package/dist/{src → types/src}/designs/react/basic/screens/welcome-screen/WelcomeScreen.d.ts +0 -0
  67. /package/dist/{src → types/src}/designs/react/basic/widget-interaction-tests/widget.test.d.ts +0 -0
  68. /package/dist/{src → types/src}/designs/react/components/BotOrAgentMessageWrapper.d.ts +0 -0
  69. /package/dist/{src → types/src}/designs/react/components/Loading.component.d.ts +0 -0
  70. /package/dist/{src → types/src}/designs/react/components/OpenLogoSvg.d.ts +0 -0
  71. /package/dist/{src → types/src}/designs/react/components/VoteButtons.d.ts +0 -0
  72. /package/dist/{src → types/src}/designs/react/components/lib/MotionDiv.d.ts +0 -0
  73. /package/dist/{src → types/src}/designs/react/components/lib/avatar.d.ts +0 -0
  74. /package/dist/{src → types/src}/designs/react/components/lib/input.d.ts +0 -0
  75. /package/dist/{src → types/src}/designs/react/components/lib/popover.d.ts +0 -0
  76. /package/dist/{src → types/src}/designs/react/components/lib/skeleton.d.ts +0 -0
  77. /package/dist/{src → types/src}/designs/react/components/lib/switch.d.ts +0 -0
  78. /package/dist/{src → types/src}/designs/react/components/lib/tooltip.d.ts +0 -0
  79. /package/dist/{src → types/src}/designs/react/components/lib/utils/cn.d.ts +0 -0
  80. /package/dist/{src → types/src}/designs/react/components/lib/wobble.d.ts +0 -0
  81. /package/dist/{src → types/src}/designs/react/components/markdown.d.ts +0 -0
  82. /package/dist/{src → types/src}/designs/react/constants.d.ts +0 -0
  83. /package/dist/{src → types/src}/designs/react/hooks/useWidgetContentHeight.d.ts +0 -0
  84. /package/dist/{src → types/src}/designs/react/render.d.ts +0 -0
  85. /package/dist/{src → types/src}/designs/translation/ar.locale.d.ts +0 -0
  86. /package/dist/{src → types/src}/designs/translation/de.locale.d.ts +0 -0
  87. /package/dist/{src → types/src}/designs/translation/en.locale.d.ts +0 -0
  88. /package/dist/{src → types/src}/designs/translation/fr.locale.d.ts +0 -0
  89. /package/dist/{src → types/src}/designs/translation/index.d.ts +0 -0
  90. /package/dist/{src → types/src}/designs/translation/nl.locale.d.ts +0 -0
  91. /package/dist/{src → types/src}/designs/translation/pt.locale.d.ts +0 -0
  92. /package/dist/{src → types/src}/designs/translation/translation.types.d.ts +0 -0
  93. /package/dist/{src → types/src}/headless/core/api.d.ts +0 -0
  94. /package/dist/{src → types/src}/headless/core/sdk/index.d.ts +0 -0
  95. /package/dist/{src → types/src}/headless/core/types/WidgetConfig.d.ts +0 -0
  96. /package/dist/{src → types/src}/headless/core/types/agent-or-bot.d.ts +0 -0
  97. /package/dist/{src → types/src}/headless/core/types/helpers.d.ts +0 -0
  98. /package/dist/{src → types/src}/headless/core/utils/PubSub.d.ts +0 -0
  99. /package/dist/{src → types/src}/headless/core/utils/PubSub.test.d.ts +0 -0
  100. /package/dist/{src → types/src}/headless/core/utils/uuid.d.ts +0 -0
  101. /package/dist/{src → types/src}/headless/react/ComponentRegistry.d.ts +0 -0
  102. /package/dist/{src → types/src}/headless/react/hooks/useIsAwaitingBotReply.d.ts +0 -0
  103. /package/dist/{src → types/src}/headless/react/hooks/usePreludeData.d.ts +0 -0
  104. /package/dist/{src → types/src}/headless/react/hooks/useSession.d.ts +0 -0
  105. /package/dist/{src → types/src}/headless/react/hooks/useUploadFiles.d.ts +0 -0
  106. /package/dist/{src → types/src}/headless/react/hooks/useVote.d.ts +0 -0
  107. /package/dist/{src → types/src}/headless/react/utils/create-safe-context.d.ts +0 -0
package/dist/basic.js CHANGED
@@ -1,54 +1,81 @@
1
1
  import { jsx as X, jsxs as Nt, Fragment as G4 } from "react/jsx-runtime";
2
- import * as Um from "@radix-ui/react-tooltip";
3
2
  import * as ie from "react";
4
- import P1, { forwardRef as Hw, memo as X4, useState as Nu, cloneElement as K4, useMemo as F1, useRef as U1, useEffect as Bm, createElement as i_, useLayoutEffect as J4, useImperativeHandle as Z4, useCallback as eI } from "react";
5
- import { clsx as nk } from "clsx";
3
+ import P1, { useMemo as F1, forwardRef as Hw, memo as X4, useState as Nu, cloneElement as K4, useRef as U1, useEffect as Um, createElement as i_, useLayoutEffect as J4, useImperativeHandle as Z4, useCallback as eI } from "react";
6
4
  import o_ from "tinycolor2";
7
- import { motion as Sc, AnimatePresence as Hm } from "framer-motion";
8
- import { Slot as zw } from "@radix-ui/react-slot";
9
- import { PaperclipIcon as tI, CircleDashed as nI, SendHorizonal as rI, CheckCheckIcon as aI, XIcon as rk, AlertCircle as iI, Loader2 as oI, FileAudio as uI, FileIcon as sI, ChevronRight as lI, Check as cI, Circle as dI, EllipsisVerticalIcon as fI, RotateCcw as hI, SendHorizontal as pI } from "lucide-react";
5
+ import { motion as Sc, AnimatePresence as Bm } from "framer-motion";
6
+ import { PaperclipIcon as tI, CircleDashed as nI, SendHorizonal as rI, CheckCheckIcon as aI, XIcon as nk, AlertCircle as iI, Loader2 as oI, FileAudio as uI, FileIcon as sI, ChevronRight as lI, Check as cI, Circle as dI, EllipsisVerticalIcon as fI, RotateCcw as hI, SendHorizontal as pI } from "lucide-react";
10
7
  import { useDropzone as mI } from "react-dropzone";
11
8
  import u_ from "react-hot-toast";
12
- import { u as $f, g as jw, d as Vw, h as gI, c as ak, e as Yw, a as zm, b as ik, _ as vI, i as Xs, j as ok, k as yI, l as s_, m as EI, W as bI } from "./useUploadFiles-BaCcqTwX.js";
9
+ import { u as $f, g as zw, d as jw, h as gI, c as rk, e as Vw, a as Hm, b as ak, _ as vI, i as Xs, j as ik, k as yI, l as s_, m as EI, W as bI } from "./useUploadFiles-DJElNIQi.js";
10
+ import * as zm from "@radix-ui/react-tooltip";
11
+ import { clsx as ok } from "clsx";
12
+ import { Slot as Yw } from "@radix-ui/react-slot";
13
13
  import * as Yn from "@radix-ui/react-dropdown-menu";
14
14
  import { formatDistance as TI } from "date-fns";
15
15
  import * as Gf from "@radix-ui/react-avatar";
16
16
  import { z as MT } from "zod";
17
- const Ww = "-", wI = (e) => {
18
- const n = SI(e), {
17
+ const wI = 400, xI = 600, Ww = {
18
+ widgetMinHeight: "min-h-[400px]",
19
+ widgetMaxHeight: "max-h-[600px]",
20
+ widgetHeight: "h-[600px]"
21
+ }, uk = ({ primary: e = "hsl(0, 0%, 0%)" }) => {
22
+ const n = o_(e).toHsl(), a = o_(e).isLight() ? "240 10% 3.9%" : "0 0% 100%";
23
+ return {
24
+ /**
25
+ * Spread the primary color without the `hsl()` call so that we can use tailwind opacity classes on it
26
+ */
27
+ "--opencx-primary": `${n.h} ${n.s}% ${n.l}%`,
28
+ "--opencx-primary-foreground": a,
29
+ "--opencx-background": "0 0% 100%",
30
+ "--opencx-foreground": "240 10% 3.9%",
31
+ "--opencx-accent": "240 4.8% 95.9%",
32
+ "--opencx-accent-foreground": "240 5.9% 10%",
33
+ "--opencx-destructive": "0 84.2% 60.2%",
34
+ "--opencx-destructive-foreground": "0 0% 98%",
35
+ "--opencx-secondary": "240 4.8% 95.9%",
36
+ "--opencx-secondary-foreground": "240 5.9% 10%",
37
+ "--opencx-muted": "240 4.8% 95.9%",
38
+ "--opencx-muted-foreground": "240 3.8% 46.1%",
39
+ "--opencx-input": "240 5.9% 90%",
40
+ "--opencx-border": "240 5.9% 90%",
41
+ "--opencx-ring": "240 5.9% 10%"
42
+ // "--opencx-trigger-offset": _.triggerOffset,
43
+ };
44
+ }, qw = "-", SI = (e) => {
45
+ const n = _I(e), {
19
46
  conflictingClassGroups: a,
20
47
  conflictingClassGroupModifiers: s
21
48
  } = e;
22
49
  return {
23
50
  getClassGroupId: (d) => {
24
- const g = d.split(Ww);
25
- return g[0] === "" && g.length !== 1 && g.shift(), uk(g, n) || xI(d);
51
+ const g = d.split(qw);
52
+ return g[0] === "" && g.length !== 1 && g.shift(), sk(g, n) || CI(d);
26
53
  },
27
54
  getConflictingClassGroupIds: (d, g) => {
28
55
  const E = a[d] || [];
29
56
  return g && s[d] ? [...E, ...s[d]] : E;
30
57
  }
31
58
  };
32
- }, uk = (e, n) => {
59
+ }, sk = (e, n) => {
33
60
  var d;
34
61
  if (e.length === 0)
35
62
  return n.classGroupId;
36
- const a = e[0], s = n.nextPart.get(a), f = s ? uk(e.slice(1), s) : void 0;
63
+ const a = e[0], s = n.nextPart.get(a), f = s ? sk(e.slice(1), s) : void 0;
37
64
  if (f)
38
65
  return f;
39
66
  if (n.validators.length === 0)
40
67
  return;
41
- const p = e.join(Ww);
68
+ const p = e.join(qw);
42
69
  return (d = n.validators.find(({
43
70
  validator: g
44
71
  }) => g(p))) == null ? void 0 : d.classGroupId;
45
- }, l_ = /^\[(.+)\]$/, xI = (e) => {
72
+ }, l_ = /^\[(.+)\]$/, CI = (e) => {
46
73
  if (l_.test(e)) {
47
74
  const n = l_.exec(e)[1], a = n == null ? void 0 : n.substring(0, n.indexOf(":"));
48
75
  if (a)
49
76
  return "arbitrary.." + a;
50
77
  }
51
- }, SI = (e) => {
78
+ }, _I = (e) => {
52
79
  const {
53
80
  theme: n,
54
81
  prefix: a
@@ -56,7 +83,7 @@ const Ww = "-", wI = (e) => {
56
83
  nextPart: /* @__PURE__ */ new Map(),
57
84
  validators: []
58
85
  };
59
- return _I(Object.entries(e.classGroups), a).forEach(([p, d]) => {
86
+ return kI(Object.entries(e.classGroups), a).forEach(([p, d]) => {
60
87
  fw(d, s, p, n);
61
88
  }), s;
62
89
  }, fw = (e, n, a, s) => {
@@ -67,7 +94,7 @@ const Ww = "-", wI = (e) => {
67
94
  return;
68
95
  }
69
96
  if (typeof f == "function") {
70
- if (CI(f)) {
97
+ if (AI(f)) {
71
98
  fw(f(s), n, a, s);
72
99
  return;
73
100
  }
@@ -83,16 +110,16 @@ const Ww = "-", wI = (e) => {
83
110
  });
84
111
  }, c_ = (e, n) => {
85
112
  let a = e;
86
- return n.split(Ww).forEach((s) => {
113
+ return n.split(qw).forEach((s) => {
87
114
  a.nextPart.has(s) || a.nextPart.set(s, {
88
115
  nextPart: /* @__PURE__ */ new Map(),
89
116
  validators: []
90
117
  }), a = a.nextPart.get(s);
91
118
  }), a;
92
- }, CI = (e) => e.isThemeGetter, _I = (e, n) => n ? e.map(([a, s]) => {
119
+ }, AI = (e) => e.isThemeGetter, kI = (e, n) => n ? e.map(([a, s]) => {
93
120
  const f = s.map((p) => typeof p == "string" ? n + p : typeof p == "object" ? Object.fromEntries(Object.entries(p).map(([d, g]) => [n + d, g])) : p);
94
121
  return [a, f];
95
- }) : e, AI = (e) => {
122
+ }) : e, RI = (e) => {
96
123
  if (e < 1)
97
124
  return {
98
125
  get: () => {
@@ -116,7 +143,7 @@ const Ww = "-", wI = (e) => {
116
143
  a.has(p) ? a.set(p, d) : f(p, d);
117
144
  }
118
145
  };
119
- }, sk = "!", kI = (e) => {
146
+ }, lk = "!", NI = (e) => {
120
147
  const {
121
148
  separator: n,
122
149
  experimentalParseClassName: a
@@ -137,7 +164,7 @@ const Ww = "-", wI = (e) => {
137
164
  }
138
165
  H === "[" ? T++ : H === "]" && T--;
139
166
  }
140
- const R = E.length === 0 ? g : g.substring(C), A = R.startsWith(sk), D = A ? R.substring(1) : R, L = S && S > C ? S - C : void 0;
167
+ const R = E.length === 0 ? g : g.substring(C), A = R.startsWith(lk), D = A ? R.substring(1) : R, L = S && S > C ? S - C : void 0;
141
168
  return {
142
169
  modifiers: E,
143
170
  hasImportantModifier: A,
@@ -149,7 +176,7 @@ const Ww = "-", wI = (e) => {
149
176
  className: g,
150
177
  parseClassName: d
151
178
  }) : d;
152
- }, RI = (e) => {
179
+ }, DI = (e) => {
153
180
  if (e.length <= 1)
154
181
  return e;
155
182
  const n = [];
@@ -157,16 +184,16 @@ const Ww = "-", wI = (e) => {
157
184
  return e.forEach((s) => {
158
185
  s[0] === "[" ? (n.push(...a.sort(), s), a = []) : a.push(s);
159
186
  }), n.push(...a.sort()), n;
160
- }, NI = (e) => ({
161
- cache: AI(e.cacheSize),
162
- parseClassName: kI(e),
163
- ...wI(e)
164
- }), DI = /\s+/, OI = (e, n) => {
187
+ }, OI = (e) => ({
188
+ cache: RI(e.cacheSize),
189
+ parseClassName: NI(e),
190
+ ...SI(e)
191
+ }), LI = /\s+/, II = (e, n) => {
165
192
  const {
166
193
  parseClassName: a,
167
194
  getClassGroupId: s,
168
195
  getConflictingClassGroupIds: f
169
- } = n, p = [], d = e.trim().split(DI);
196
+ } = n, p = [], d = e.trim().split(LI);
170
197
  let g = "";
171
198
  for (let E = d.length - 1; E >= 0; E -= 1) {
172
199
  const T = d[E], {
@@ -187,7 +214,7 @@ const Ww = "-", wI = (e) => {
187
214
  }
188
215
  D = !1;
189
216
  }
190
- const U = RI(C).join(":"), H = S ? U + sk : U, G = H + L;
217
+ const U = DI(C).join(":"), H = S ? U + lk : U, G = H + L;
191
218
  if (p.includes(G))
192
219
  continue;
193
220
  p.push(G);
@@ -200,49 +227,49 @@ const Ww = "-", wI = (e) => {
200
227
  }
201
228
  return g;
202
229
  };
203
- function LI() {
230
+ function MI() {
204
231
  let e = 0, n, a, s = "";
205
232
  for (; e < arguments.length; )
206
- (n = arguments[e++]) && (a = lk(n)) && (s && (s += " "), s += a);
233
+ (n = arguments[e++]) && (a = ck(n)) && (s && (s += " "), s += a);
207
234
  return s;
208
235
  }
209
- const lk = (e) => {
236
+ const ck = (e) => {
210
237
  if (typeof e == "string")
211
238
  return e;
212
239
  let n, a = "";
213
240
  for (let s = 0; s < e.length; s++)
214
- e[s] && (n = lk(e[s])) && (a && (a += " "), a += n);
241
+ e[s] && (n = ck(e[s])) && (a && (a += " "), a += n);
215
242
  return a;
216
243
  };
217
- function II(e, ...n) {
244
+ function PI(e, ...n) {
218
245
  let a, s, f, p = d;
219
246
  function d(E) {
220
247
  const T = n.reduce((C, S) => S(C), e());
221
- return a = NI(T), s = a.cache.get, f = a.cache.set, p = g, g(E);
248
+ return a = OI(T), s = a.cache.get, f = a.cache.set, p = g, g(E);
222
249
  }
223
250
  function g(E) {
224
251
  const T = s(E);
225
252
  if (T)
226
253
  return T;
227
- const C = OI(E, a);
254
+ const C = II(E, a);
228
255
  return f(E, C), C;
229
256
  }
230
257
  return function() {
231
- return p(LI.apply(null, arguments));
258
+ return p(MI.apply(null, arguments));
232
259
  };
233
260
  }
234
261
  const hn = (e) => {
235
262
  const n = (a) => a[e] || [];
236
263
  return n.isThemeGetter = !0, n;
237
- }, ck = /^\[(?:([a-z-]+):)?(.+)\]$/i, MI = /^\d+\/\d+$/, PI = /* @__PURE__ */ new Set(["px", "full", "screen"]), FI = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, UI = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, BI = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, HI = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, zI = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, ku = (e) => Bf(e) || PI.has(e) || MI.test(e), Ys = (e) => Xf(e, "length", GI), Bf = (e) => !!e && !Number.isNaN(Number(e)), PT = (e) => Xf(e, "number", Bf), Em = (e) => !!e && Number.isInteger(Number(e)), jI = (e) => e.endsWith("%") && Bf(e.slice(0, -1)), Tt = (e) => ck.test(e), Ws = (e) => FI.test(e), VI = /* @__PURE__ */ new Set(["length", "size", "percentage"]), YI = (e) => Xf(e, VI, dk), WI = (e) => Xf(e, "position", dk), qI = /* @__PURE__ */ new Set(["image", "url"]), QI = (e) => Xf(e, qI, KI), $I = (e) => Xf(e, "", XI), bm = () => !0, Xf = (e, n, a) => {
238
- const s = ck.exec(e);
264
+ }, dk = /^\[(?:([a-z-]+):)?(.+)\]$/i, FI = /^\d+\/\d+$/, UI = /* @__PURE__ */ new Set(["px", "full", "screen"]), BI = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, HI = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, zI = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, jI = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, VI = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, ku = (e) => Bf(e) || UI.has(e) || FI.test(e), Ys = (e) => Xf(e, "length", KI), Bf = (e) => !!e && !Number.isNaN(Number(e)), PT = (e) => Xf(e, "number", Bf), Em = (e) => !!e && Number.isInteger(Number(e)), YI = (e) => e.endsWith("%") && Bf(e.slice(0, -1)), Tt = (e) => dk.test(e), Ws = (e) => BI.test(e), WI = /* @__PURE__ */ new Set(["length", "size", "percentage"]), qI = (e) => Xf(e, WI, fk), QI = (e) => Xf(e, "position", fk), $I = /* @__PURE__ */ new Set(["image", "url"]), GI = (e) => Xf(e, $I, ZI), XI = (e) => Xf(e, "", JI), bm = () => !0, Xf = (e, n, a) => {
265
+ const s = dk.exec(e);
239
266
  return s ? s[1] ? typeof n == "string" ? s[1] === n : n.has(s[1]) : a(s[2]) : !1;
240
- }, GI = (e) => (
267
+ }, KI = (e) => (
241
268
  // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
242
269
  // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
243
270
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
244
- UI.test(e) && !BI.test(e)
245
- ), dk = () => !1, XI = (e) => HI.test(e), KI = (e) => zI.test(e), JI = () => {
271
+ HI.test(e) && !zI.test(e)
272
+ ), fk = () => !1, JI = (e) => jI.test(e), ZI = (e) => VI.test(e), e5 = () => {
246
273
  const e = hn("colors"), n = hn("spacing"), a = hn("blur"), s = hn("brightness"), f = hn("borderColor"), p = hn("borderRadius"), d = hn("borderSpacing"), g = hn("borderWidth"), E = hn("contrast"), T = hn("grayscale"), C = hn("hueRotate"), S = hn("invert"), R = hn("gap"), A = hn("gradientColorStops"), D = hn("gradientColorStopPositions"), L = hn("inset"), U = hn("margin"), H = hn("opacity"), G = hn("padding"), Y = hn("saturate"), Z = hn("scale"), K = hn("sepia"), W = hn("skew"), ce = hn("space"), Ie = hn("translate"), Pe = () => ["auto", "contain", "none"], J = () => ["auto", "hidden", "clip", "visible", "scroll"], Ee = () => ["auto", Tt, n], ge = () => [Tt, n], ke = () => ["", ku, Ys], De = () => ["auto", Bf, Tt], qe = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], je = () => ["solid", "dashed", "dotted", "double", "none"], at = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], pe = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], Ne = () => ["", "0", Tt], P = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], et = () => [Bf, Tt];
247
274
  return {
248
275
  cacheSize: 500,
@@ -262,7 +289,7 @@ const hn = (e) => {
262
289
  invert: Ne(),
263
290
  gap: ge(),
264
291
  gradientColorStops: [e],
265
- gradientColorStopPositions: [jI, Ys],
292
+ gradientColorStopPositions: [YI, Ys],
266
293
  inset: Ee(),
267
294
  margin: Ee(),
268
295
  opacity: et(),
@@ -1175,7 +1202,7 @@ const hn = (e) => {
1175
1202
  * @see https://tailwindcss.com/docs/background-position
1176
1203
  */
1177
1204
  "bg-position": [{
1178
- bg: [...qe(), WI]
1205
+ bg: [...qe(), QI]
1179
1206
  }],
1180
1207
  /**
1181
1208
  * Background Repeat
@@ -1191,7 +1218,7 @@ const hn = (e) => {
1191
1218
  * @see https://tailwindcss.com/docs/background-size
1192
1219
  */
1193
1220
  "bg-size": [{
1194
- bg: ["auto", "cover", "contain", YI]
1221
+ bg: ["auto", "cover", "contain", qI]
1195
1222
  }],
1196
1223
  /**
1197
1224
  * Background Image
@@ -1200,7 +1227,7 @@ const hn = (e) => {
1200
1227
  "bg-image": [{
1201
1228
  bg: ["none", {
1202
1229
  "gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
1203
- }, QI]
1230
+ }, GI]
1204
1231
  }],
1205
1232
  /**
1206
1233
  * Background Color
@@ -1616,7 +1643,7 @@ const hn = (e) => {
1616
1643
  * @see https://tailwindcss.com/docs/box-shadow
1617
1644
  */
1618
1645
  shadow: [{
1619
- shadow: ["", "inner", "none", Ws, $I]
1646
+ shadow: ["", "inner", "none", Ws, XI]
1620
1647
  }],
1621
1648
  /**
1622
1649
  * Box Shadow Color
@@ -2271,12 +2298,12 @@ const hn = (e) => {
2271
2298
  "font-size": ["leading"]
2272
2299
  }
2273
2300
  };
2274
- }, ZI = /* @__PURE__ */ II(JI);
2301
+ }, t5 = /* @__PURE__ */ PI(e5);
2275
2302
  function Ft(...e) {
2276
- return ZI(nk(e));
2303
+ return t5(ok(e));
2277
2304
  }
2278
- const e5 = Um.Provider, t5 = Um.Root, n5 = Um.Trigger, fk = ie.forwardRef(({ className: e, sideOffset: n = 4, ...a }, s) => /* @__PURE__ */ X(
2279
- Um.Content,
2305
+ const n5 = zm.Provider, r5 = zm.Root, a5 = zm.Trigger, hk = ie.forwardRef(({ className: e, sideOffset: n = 4, ...a }, s) => /* @__PURE__ */ X(
2306
+ zm.Content,
2280
2307
  {
2281
2308
  ref: s,
2282
2309
  sideOffset: n,
@@ -2287,17 +2314,17 @@ const e5 = Um.Provider, t5 = Um.Root, n5 = Um.Trigger, fk = ie.forwardRef(({ cla
2287
2314
  ...a
2288
2315
  }
2289
2316
  ));
2290
- fk.displayName = Um.Content.displayName;
2317
+ hk.displayName = zm.Content.displayName;
2291
2318
  function hw({
2292
2319
  children: e,
2293
2320
  content: n,
2294
2321
  side: a,
2295
2322
  align: s
2296
2323
  }) {
2297
- return /* @__PURE__ */ Nt(t5, { children: [
2298
- /* @__PURE__ */ X(n5, { asChild: !0, children: e }),
2324
+ return /* @__PURE__ */ Nt(r5, { children: [
2325
+ /* @__PURE__ */ X(a5, { asChild: !0, children: e }),
2299
2326
  /* @__PURE__ */ X(
2300
- fk,
2327
+ hk,
2301
2328
  {
2302
2329
  side: a,
2303
2330
  align: s,
@@ -2308,212 +2335,7 @@ function hw({
2308
2335
  )
2309
2336
  ] });
2310
2337
  }
2311
- const r5 = 400, a5 = 600, qw = {
2312
- widgetMinHeight: "min-h-[400px]",
2313
- widgetMaxHeight: "max-h-[600px]",
2314
- widgetHeight: "h-[600px]"
2315
- }, hk = ({ primary: e = "hsl(0, 0%, 0%)" }) => {
2316
- const n = o_(e).toHsl(), a = o_(e).isLight() ? "240 10% 3.9%" : "0 0% 100%";
2317
- return {
2318
- /**
2319
- * Spread the primary color without the `hsl()` call so that we can use tailwind opacity classes on it
2320
- */
2321
- "--opencx-primary": `${n.h} ${n.s}% ${n.l}%`,
2322
- "--opencx-primary-foreground": a,
2323
- "--opencx-background": "0 0% 100%",
2324
- "--opencx-foreground": "240 10% 3.9%",
2325
- "--opencx-accent": "240 4.8% 95.9%",
2326
- "--opencx-accent-foreground": "240 5.9% 10%",
2327
- "--opencx-destructive": "0 84.2% 60.2%",
2328
- "--opencx-destructive-foreground": "0 0% 98%",
2329
- "--opencx-secondary": "240 4.8% 95.9%",
2330
- "--opencx-secondary-foreground": "240 5.9% 10%",
2331
- "--opencx-muted": "240 4.8% 95.9%",
2332
- "--opencx-muted-foreground": "240 3.8% 46.1%",
2333
- "--opencx-input": "240 5.9% 90%",
2334
- "--opencx-border": "240 5.9% 90%",
2335
- "--opencx-ring": "240 5.9% 10%"
2336
- // "--opencx-trigger-offset": _.triggerOffset,
2337
- };
2338
- }, i5 = 10, o5 = (e, n) => ({
2339
- initial: { opacity: 0, x: -e, ...n.initial },
2340
- animate: { opacity: 1, x: 0, ...n.animate },
2341
- exit: { opacity: 0, x: e, ...n.exit }
2342
- }), u5 = (e, n) => ({
2343
- initial: { opacity: 0, x: e, ...n.initial },
2344
- animate: { opacity: 1, x: 0, ...n.animate },
2345
- exit: { opacity: 0, x: -e, ...n.exit }
2346
- }), s5 = (e, n) => ({
2347
- initial: { opacity: 0, y: e, ...n.initial },
2348
- animate: { opacity: 1, y: 0, ...n.animate },
2349
- exit: { opacity: 0, y: -e, ...n.exit }
2350
- }), l5 = (e, n) => ({
2351
- initial: { opacity: 0, y: -e, ...n.initial },
2352
- animate: { opacity: 1, y: 0, ...n.animate },
2353
- exit: { opacity: 0, y: e, ...n.exit }
2354
- }), c5 = {
2355
- right: o5,
2356
- left: u5,
2357
- up: s5,
2358
- down: l5
2359
- }, Du = Hw(
2360
- ({
2361
- fadeIn: e = "down",
2362
- distance: n = i5,
2363
- children: a,
2364
- snapExit: s = !1,
2365
- overrides: f = {},
2366
- ...p
2367
- }, d) => {
2368
- const g = e ? c5[e](n, f) : {};
2369
- return s && g.exit && typeof g.exit == "object" && !Array.isArray(g.exit) && (g.exit.transition = { duration: 0 }), /* @__PURE__ */ X(Sc.div, { ref: d, ...p, ...g, children: a });
2370
- }
2371
- );
2372
- Du.displayName = "MotionDiv";
2373
- const d_ = (e) => typeof e == "boolean" ? "".concat(e) : e === 0 ? "0" : e, f_ = nk, d5 = (e, n) => (a) => {
2374
- var s;
2375
- if ((n == null ? void 0 : n.variants) == null) return f_(e, a == null ? void 0 : a.class, a == null ? void 0 : a.className);
2376
- const { variants: f, defaultVariants: p } = n, d = Object.keys(f).map((T) => {
2377
- const C = a == null ? void 0 : a[T], S = p == null ? void 0 : p[T];
2378
- if (C === null) return null;
2379
- const R = d_(C) || d_(S);
2380
- return f[T][R];
2381
- }), g = a && Object.entries(a).reduce((T, C) => {
2382
- let [S, R] = C;
2383
- return R === void 0 || (T[S] = R), T;
2384
- }, {}), E = n == null || (s = n.compoundVariants) === null || s === void 0 ? void 0 : s.reduce((T, C) => {
2385
- let { class: S, className: R, ...A } = C;
2386
- return Object.entries(A).every((D) => {
2387
- let [L, U] = D;
2388
- return Array.isArray(U) ? U.includes({
2389
- ...p,
2390
- ...g
2391
- }[L]) : {
2392
- ...p,
2393
- ...g
2394
- }[L] === U;
2395
- }) ? [
2396
- ...T,
2397
- S,
2398
- R
2399
- ] : T;
2400
- }, []);
2401
- return f_(e, d, E, a == null ? void 0 : a.class, a == null ? void 0 : a.className);
2402
- }, h_ = {
2403
- x: 2,
2404
- y: 2
2405
- }, f5 = {
2406
- 1: "scale-[1]",
2407
- "1.01": "scale-[1.01]",
2408
- "1.02": "scale-[1.02]",
2409
- "1.1": "scale-[1.1]"
2410
- }, B1 = X4(
2411
- Hw(
2412
- ({ children: e, className: n, scale: a = "1.02", off: s = !1 }, f) => {
2413
- const [p, d] = Nu(!1), [g, E] = Nu({ x: 0, y: 0 });
2414
- if (s || /translate/.test(
2415
- e.props.className || ""
2416
- )) return e;
2417
- const C = (D) => {
2418
- var Ie, Pe;
2419
- const { clientX: L, clientY: U } = D, H = D.currentTarget.getBoundingClientRect(), G = L - (H.left + H.width / 2), Y = U - (H.top + H.height / 2), Z = Math.max(
2420
- -1,
2421
- Math.min(1, G / (H.width / 2))
2422
- ), K = Math.max(
2423
- -1,
2424
- Math.min(1, Y / (H.height / 2))
2425
- ), W = Z * h_.x, ce = K * h_.y;
2426
- E({ x: W, y: ce }), (Pe = (Ie = e.props).onMouseMove) == null || Pe.call(Ie, D);
2427
- }, S = () => {
2428
- var D, L;
2429
- d(!0), (L = (D = e.props).onMouseEnter) == null || L.call(D);
2430
- }, R = () => {
2431
- var D, L;
2432
- d(!1), E({ x: 0, y: 0 }), (L = (D = e.props).onMouseLeave) == null || L.call(D);
2433
- }, A = {
2434
- "--opencx-wobble-x": p ? `${g.x}px` : "0px",
2435
- "--opencx-wobble-y": p ? `${g.y}px` : "0px"
2436
- };
2437
- return K4(e, {
2438
- ref: f,
2439
- onMouseMove: C,
2440
- onMouseEnter: S,
2441
- onMouseLeave: R,
2442
- style: {
2443
- ...A,
2444
- ...e.props.style
2445
- },
2446
- className: Ft(
2447
- "translate-x-[var(--opencx-wobble-x)]",
2448
- "translate-y-[var(--opencx-wobble-y)]",
2449
- `hover:${f5[a]}`,
2450
- n,
2451
- e.props.className,
2452
- "transition-all ease-out"
2453
- )
2454
- });
2455
- }
2456
- )
2457
- );
2458
- B1.displayName = "Wobble";
2459
- const h5 = d5(
2460
- Ft(
2461
- "inline-flex shrink-0 items-center justify-center gap-2",
2462
- "text-sm font-medium whitespace-nowrap",
2463
- "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
2464
- "disabled:pointer-events-none disabled:opacity-50",
2465
- "shadow-sm active:shadow-none active:scale-95 hover:active:scale-95",
2466
- "rounded-xl",
2467
- // Add border to make transitions between variants smoother... because border takes 1 pixel of space in each direction
2468
- "border",
2469
- "transition"
2470
- ),
2471
- {
2472
- variants: {
2473
- variant: {
2474
- default: "border-primary bg-primary text-primary-foreground",
2475
- destructive: "border-destructive bg-destructive text-destructive-foreground",
2476
- outline: "bg-background hover:bg-accent hover:text-accent-foreground",
2477
- secondary: "bg-secondary text-secondary-foreground",
2478
- ghost: "border-transparent shadow-none hover:bg-accent hover:text-accent-foreground",
2479
- link: "border-transparent shadow-none text-primary underline-offset-4 hover:underline"
2480
- },
2481
- size: {
2482
- default: "h-10 px-4 py-2",
2483
- sm: "h-8 px-3 text-xs",
2484
- lg: "h-11 px-8",
2485
- icon: "h-10 w-10",
2486
- fit: "size-fit p-2"
2487
- }
2488
- },
2489
- defaultVariants: {
2490
- variant: "default",
2491
- size: "default"
2492
- }
2493
- }
2494
- ), Zs = ie.forwardRef(
2495
- ({ className: e, variant: n, size: a, asChild: s = !1, ...f }, p) => /* @__PURE__ */ X(B1, { ref: p, children: /* @__PURE__ */ X(
2496
- s ? zw : "button",
2497
- {
2498
- className: Ft(h5({ variant: n, size: a, className: e })),
2499
- ...f
2500
- }
2501
- ) })
2502
- );
2503
- Zs.displayName = "Button";
2504
- function p5({ options: e, onKeyboardClick: n }) {
2505
- return /* @__PURE__ */ X("div", { className: "flex items-center gap-2 p-2 flex-wrap", children: e.map((a, s) => /* @__PURE__ */ X(
2506
- Zs,
2507
- {
2508
- onClick: () => n(a),
2509
- className: "flex-1 rounded-full",
2510
- size: "sm",
2511
- children: a
2512
- },
2513
- s
2514
- )) });
2515
- }
2516
- const m5 = {
2338
+ const i5 = {
2517
2339
  ok: "حسنا",
2518
2340
  yes: "نعم",
2519
2341
  no: "لا",
@@ -2566,7 +2388,7 @@ const m5 = {
2566
2388
  "start-chat": "تحدث إلى الدعم",
2567
2389
  "starting-chat": "جاري الاتصال...",
2568
2390
  "hello-greeting": "مرحبًا! كيف يمكننا مساعدتك اليوم؟"
2569
- }, g5 = {
2391
+ }, o5 = {
2570
2392
  ok: "OK",
2571
2393
  yes: "Ja",
2572
2394
  no: "Nein",
@@ -2619,7 +2441,7 @@ const m5 = {
2619
2441
  "start-chat": "Mit dem Support sprechen",
2620
2442
  "starting-chat": "Verbindung wird hergestellt...",
2621
2443
  "hello-greeting": "Hallo! Wie können wir Ihnen heute helfen?"
2622
- }, v5 = {
2444
+ }, u5 = {
2623
2445
  ok: "OK",
2624
2446
  yes: "Yes",
2625
2447
  no: "No",
@@ -2672,7 +2494,7 @@ const m5 = {
2672
2494
  "start-chat": "Talk to support",
2673
2495
  "starting-chat": "Connecting...",
2674
2496
  "hello-greeting": "Hi there!"
2675
- }, y5 = {
2497
+ }, s5 = {
2676
2498
  ok: "D'accord",
2677
2499
  yes: "Oui",
2678
2500
  no: "Non",
@@ -2725,7 +2547,7 @@ const m5 = {
2725
2547
  "start-chat": "Parler au support",
2726
2548
  "starting-chat": "Connexion...",
2727
2549
  "hello-greeting": "Bonjour ! Comment pouvons-nous vous aider aujourd'hui ?"
2728
- }, E5 = {
2550
+ }, l5 = {
2729
2551
  ok: "OK",
2730
2552
  yes: "Ja",
2731
2553
  no: "Nee",
@@ -2778,7 +2600,7 @@ const m5 = {
2778
2600
  "start-chat": "Praat met ondersteuning",
2779
2601
  "starting-chat": "Verbinding maken...",
2780
2602
  "hello-greeting": "Hallo! Hoe kunnen we u vandaag helpen?"
2781
- }, b5 = {
2603
+ }, c5 = {
2782
2604
  ok: "OK",
2783
2605
  yes: "Sim",
2784
2606
  no: "Não",
@@ -2832,37 +2654,203 @@ const m5 = {
2832
2654
  "starting-chat": "Conectando...",
2833
2655
  "hello-greeting": "Olá! Como podemos ajudar você hoje?"
2834
2656
  }, pk = {
2835
- en: v5,
2836
- ar: m5,
2837
- nl: E5,
2838
- fr: y5,
2839
- de: g5,
2840
- pt: b5
2841
- }, T5 = Object.keys(pk), w5 = (e) => T5.includes(e);
2842
- function x5(e, n) {
2657
+ en: u5,
2658
+ ar: i5,
2659
+ nl: l5,
2660
+ fr: s5,
2661
+ de: o5,
2662
+ pt: c5
2663
+ }, d5 = Object.keys(pk), f5 = (e) => d5.includes(e);
2664
+ function h5(e, n) {
2843
2665
  const a = pk[n];
2844
2666
  return a && a[e] || "";
2845
2667
  }
2846
- function H1() {
2668
+ function B1() {
2847
2669
  const {
2848
2670
  widgetCtx: { config: e }
2849
2671
  } = $f();
2850
2672
  return F1(() => {
2851
- const a = w5(e.language) ? e.language : "en";
2673
+ const a = f5(e.language) ? e.language : "en";
2852
2674
  return {
2853
- get: (s) => x5(s, a),
2675
+ get: (s) => h5(s, a),
2854
2676
  lang: a
2855
2677
  };
2856
2678
  }, [e.language]);
2857
2679
  }
2858
- function S5({
2680
+ const p5 = 10, m5 = (e, n) => ({
2681
+ initial: { opacity: 0, x: -e, ...n.initial },
2682
+ animate: { opacity: 1, x: 0, ...n.animate },
2683
+ exit: { opacity: 0, x: e, ...n.exit }
2684
+ }), g5 = (e, n) => ({
2685
+ initial: { opacity: 0, x: e, ...n.initial },
2686
+ animate: { opacity: 1, x: 0, ...n.animate },
2687
+ exit: { opacity: 0, x: -e, ...n.exit }
2688
+ }), v5 = (e, n) => ({
2689
+ initial: { opacity: 0, y: e, ...n.initial },
2690
+ animate: { opacity: 1, y: 0, ...n.animate },
2691
+ exit: { opacity: 0, y: -e, ...n.exit }
2692
+ }), y5 = (e, n) => ({
2693
+ initial: { opacity: 0, y: -e, ...n.initial },
2694
+ animate: { opacity: 1, y: 0, ...n.animate },
2695
+ exit: { opacity: 0, y: e, ...n.exit }
2696
+ }), E5 = {
2697
+ right: m5,
2698
+ left: g5,
2699
+ up: v5,
2700
+ down: y5
2701
+ }, Du = Hw(
2702
+ ({
2703
+ fadeIn: e = "down",
2704
+ distance: n = p5,
2705
+ children: a,
2706
+ snapExit: s = !1,
2707
+ overrides: f = {},
2708
+ ...p
2709
+ }, d) => {
2710
+ const g = e ? E5[e](n, f) : {};
2711
+ return s && g.exit && typeof g.exit == "object" && !Array.isArray(g.exit) && (g.exit.transition = { duration: 0 }), /* @__PURE__ */ X(Sc.div, { ref: d, ...p, ...g, children: a });
2712
+ }
2713
+ );
2714
+ Du.displayName = "MotionDiv";
2715
+ const d_ = (e) => typeof e == "boolean" ? "".concat(e) : e === 0 ? "0" : e, f_ = ok, b5 = (e, n) => (a) => {
2716
+ var s;
2717
+ if ((n == null ? void 0 : n.variants) == null) return f_(e, a == null ? void 0 : a.class, a == null ? void 0 : a.className);
2718
+ const { variants: f, defaultVariants: p } = n, d = Object.keys(f).map((T) => {
2719
+ const C = a == null ? void 0 : a[T], S = p == null ? void 0 : p[T];
2720
+ if (C === null) return null;
2721
+ const R = d_(C) || d_(S);
2722
+ return f[T][R];
2723
+ }), g = a && Object.entries(a).reduce((T, C) => {
2724
+ let [S, R] = C;
2725
+ return R === void 0 || (T[S] = R), T;
2726
+ }, {}), E = n == null || (s = n.compoundVariants) === null || s === void 0 ? void 0 : s.reduce((T, C) => {
2727
+ let { class: S, className: R, ...A } = C;
2728
+ return Object.entries(A).every((D) => {
2729
+ let [L, U] = D;
2730
+ return Array.isArray(U) ? U.includes({
2731
+ ...p,
2732
+ ...g
2733
+ }[L]) : {
2734
+ ...p,
2735
+ ...g
2736
+ }[L] === U;
2737
+ }) ? [
2738
+ ...T,
2739
+ S,
2740
+ R
2741
+ ] : T;
2742
+ }, []);
2743
+ return f_(e, d, E, a == null ? void 0 : a.class, a == null ? void 0 : a.className);
2744
+ }, h_ = {
2745
+ x: 2,
2746
+ y: 2
2747
+ }, T5 = {
2748
+ 1: "scale-[1]",
2749
+ "1.01": "scale-[1.01]",
2750
+ "1.02": "scale-[1.02]",
2751
+ "1.1": "scale-[1.1]"
2752
+ }, H1 = X4(
2753
+ Hw(
2754
+ ({ children: e, className: n, scale: a = "1.02", off: s = !1 }, f) => {
2755
+ const [p, d] = Nu(!1), [g, E] = Nu({ x: 0, y: 0 });
2756
+ if (s || /translate/.test(
2757
+ e.props.className || ""
2758
+ )) return e;
2759
+ const C = (D) => {
2760
+ var Ie, Pe;
2761
+ const { clientX: L, clientY: U } = D, H = D.currentTarget.getBoundingClientRect(), G = L - (H.left + H.width / 2), Y = U - (H.top + H.height / 2), Z = Math.max(
2762
+ -1,
2763
+ Math.min(1, G / (H.width / 2))
2764
+ ), K = Math.max(
2765
+ -1,
2766
+ Math.min(1, Y / (H.height / 2))
2767
+ ), W = Z * h_.x, ce = K * h_.y;
2768
+ E({ x: W, y: ce }), (Pe = (Ie = e.props).onMouseMove) == null || Pe.call(Ie, D);
2769
+ }, S = () => {
2770
+ var D, L;
2771
+ d(!0), (L = (D = e.props).onMouseEnter) == null || L.call(D);
2772
+ }, R = () => {
2773
+ var D, L;
2774
+ d(!1), E({ x: 0, y: 0 }), (L = (D = e.props).onMouseLeave) == null || L.call(D);
2775
+ }, A = {
2776
+ "--opencx-wobble-x": p ? `${g.x}px` : "0px",
2777
+ "--opencx-wobble-y": p ? `${g.y}px` : "0px"
2778
+ };
2779
+ return K4(e, {
2780
+ ref: f,
2781
+ onMouseMove: C,
2782
+ onMouseEnter: S,
2783
+ onMouseLeave: R,
2784
+ style: {
2785
+ ...A,
2786
+ ...e.props.style
2787
+ },
2788
+ className: Ft(
2789
+ "translate-x-[var(--opencx-wobble-x)]",
2790
+ "translate-y-[var(--opencx-wobble-y)]",
2791
+ `hover:${T5[a]}`,
2792
+ n,
2793
+ e.props.className,
2794
+ "transition-all ease-out"
2795
+ )
2796
+ });
2797
+ }
2798
+ )
2799
+ );
2800
+ H1.displayName = "Wobble";
2801
+ const w5 = b5(
2802
+ Ft(
2803
+ "inline-flex shrink-0 items-center justify-center gap-2",
2804
+ "text-sm font-medium whitespace-nowrap",
2805
+ "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
2806
+ "disabled:pointer-events-none disabled:opacity-50",
2807
+ "shadow-sm active:shadow-none active:scale-95 hover:active:scale-95",
2808
+ "rounded-xl",
2809
+ // Add border to make transitions between variants smoother... because border takes 1 pixel of space in each direction
2810
+ "border",
2811
+ "transition"
2812
+ ),
2813
+ {
2814
+ variants: {
2815
+ variant: {
2816
+ default: "border-primary bg-primary text-primary-foreground",
2817
+ destructive: "border-destructive bg-destructive text-destructive-foreground",
2818
+ outline: "bg-background hover:bg-accent hover:text-accent-foreground",
2819
+ secondary: "bg-secondary text-secondary-foreground",
2820
+ ghost: "border-transparent shadow-none hover:bg-accent hover:text-accent-foreground",
2821
+ link: "border-transparent shadow-none text-primary underline-offset-4 hover:underline"
2822
+ },
2823
+ size: {
2824
+ default: "h-10 px-4 py-2",
2825
+ sm: "h-8 px-3 text-xs",
2826
+ lg: "h-11 px-8",
2827
+ icon: "h-10 w-10",
2828
+ fit: "size-fit p-2"
2829
+ }
2830
+ },
2831
+ defaultVariants: {
2832
+ variant: "default",
2833
+ size: "default"
2834
+ }
2835
+ }
2836
+ ), Zs = ie.forwardRef(
2837
+ ({ className: e, variant: n, size: a, asChild: s = !1, ...f }, p) => /* @__PURE__ */ X(H1, { ref: p, children: /* @__PURE__ */ X(
2838
+ s ? Yw : "button",
2839
+ {
2840
+ className: Ft(w5({ variant: n, size: a, className: e })),
2841
+ ...f
2842
+ }
2843
+ ) })
2844
+ );
2845
+ Zs.displayName = "Button";
2846
+ function x5({
2859
2847
  file: { status: e, file: n, error: a },
2860
2848
  onCancel: s
2861
2849
  }) {
2862
2850
  const [f, p] = Nu(
2863
2851
  null
2864
2852
  );
2865
- Bm(() => {
2853
+ Um(() => {
2866
2854
  if (!n.type.startsWith("image/")) return;
2867
2855
  const E = new FileReader();
2868
2856
  return E.onload = () => p(E.result), E.onerror = () => console.error("Error reading file"), E.readAsDataURL(n), () => E.abort();
@@ -2924,7 +2912,7 @@ function S5({
2924
2912
  "opacity-0 group-hover:opacity-100 transition"
2925
2913
  ),
2926
2914
  onClick: s,
2927
- children: /* @__PURE__ */ X(rk, { className: "size-4 text-primary-foreground" })
2915
+ children: /* @__PURE__ */ X(nk, { className: "size-4 text-primary-foreground" })
2928
2916
  }
2929
2917
  ),
2930
2918
  /* @__PURE__ */ X(g, {})
@@ -2935,16 +2923,16 @@ function S5({
2935
2923
  );
2936
2924
  }
2937
2925
  const p_ = Ft("rounded-3xl");
2938
- function C5() {
2926
+ function S5() {
2939
2927
  var Z;
2940
- const e = U1(null), { messageCtx: n } = Vw(), { session: a } = jw(), s = H1(), [f, p] = Nu(""), {
2928
+ const e = U1(null), { messageCtx: n } = jw(), { session: a } = zw(), s = B1(), [f, p] = Nu(""), {
2941
2929
  allFiles: d,
2942
2930
  emptyTheFiles: g,
2943
2931
  handleCancelUpload: E,
2944
2932
  appendFiles: T,
2945
2933
  isUploading: C,
2946
2934
  successFiles: S
2947
- } = gI(), R = !!((Z = a.session) != null && Z.isHandedOff), { isAwaitingBotReply: A } = ak(), D = (K) => {
2935
+ } = gI(), R = !!((Z = a.session) != null && Z.isHandedOff), { isAwaitingBotReply: A } = rk(), D = (K) => {
2948
2936
  R && T(K);
2949
2937
  }, L = async () => {
2950
2938
  if (A) return;
@@ -3008,8 +2996,8 @@ function C5() {
3008
2996
  {
3009
2997
  className: "flex items-center gap-1 px-2",
3010
2998
  "data-test": "file-attachments-container",
3011
- children: /* @__PURE__ */ X(Hm, { mode: "popLayout", children: d.map((K) => /* @__PURE__ */ X(Du, { snapExit: !0, children: /* @__PURE__ */ X(
3012
- S5,
2999
+ children: /* @__PURE__ */ X(Bm, { mode: "popLayout", children: d.map((K) => /* @__PURE__ */ X(Du, { snapExit: !0, children: /* @__PURE__ */ X(
3000
+ x5,
3013
3001
  {
3014
3002
  onCancel: () => E(K.id),
3015
3003
  file: K
@@ -3100,8 +3088,8 @@ function C5() {
3100
3088
  }
3101
3089
  );
3102
3090
  }
3103
- function _5() {
3104
- const { widgetCtx: e } = $f(), n = H1();
3091
+ function C5() {
3092
+ const { widgetCtx: e } = $f(), n = B1();
3105
3093
  return /* @__PURE__ */ X("div", { className: "p-2", "data-test": "session-closed-container", children: /* @__PURE__ */ Nt(
3106
3094
  "div",
3107
3095
  {
@@ -3132,10 +3120,10 @@ function _5() {
3132
3120
  }
3133
3121
  ) });
3134
3122
  }
3135
- function A5() {
3123
+ function _5() {
3136
3124
  var n;
3137
- const { session: e } = jw();
3138
- return /* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(Hm, { mode: "wait", children: e.session && !((n = e.session) != null && n.isOpened) ? /* @__PURE__ */ X(
3125
+ const { session: e } = zw();
3126
+ return /* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(Bm, { mode: "wait", children: e.session && !((n = e.session) != null && n.isOpened) ? /* @__PURE__ */ X(
3139
3127
  Du,
3140
3128
  {
3141
3129
  className: "overflow-hidden",
@@ -3144,7 +3132,7 @@ function A5() {
3144
3132
  animate: { height: "auto" },
3145
3133
  exit: { height: 0 }
3146
3134
  },
3147
- children: /* @__PURE__ */ X(_5, {})
3135
+ children: /* @__PURE__ */ X(C5, {})
3148
3136
  },
3149
3137
  "session-closed"
3150
3138
  ) : /* @__PURE__ */ X(
@@ -3156,12 +3144,12 @@ function A5() {
3156
3144
  animate: { height: "auto" },
3157
3145
  exit: { height: 0 }
3158
3146
  },
3159
- children: /* @__PURE__ */ X(C5, {})
3147
+ children: /* @__PURE__ */ X(S5, {})
3160
3148
  },
3161
3149
  "chat-input"
3162
3150
  ) }) });
3163
3151
  }
3164
- const k5 = Yn.Root, R5 = Yn.Trigger, N5 = Yn.Group, D5 = ie.forwardRef(({ className: e, inset: n, children: a, ...s }, f) => /* @__PURE__ */ Nt(
3152
+ const A5 = Yn.Root, k5 = Yn.Trigger, R5 = Yn.Group, N5 = ie.forwardRef(({ className: e, inset: n, children: a, ...s }, f) => /* @__PURE__ */ Nt(
3165
3153
  Yn.SubTrigger,
3166
3154
  {
3167
3155
  ref: f,
@@ -3177,8 +3165,8 @@ const k5 = Yn.Root, R5 = Yn.Trigger, N5 = Yn.Group, D5 = ie.forwardRef(({ classN
3177
3165
  ]
3178
3166
  }
3179
3167
  ));
3180
- D5.displayName = Yn.SubTrigger.displayName;
3181
- const O5 = ie.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ X(
3168
+ N5.displayName = Yn.SubTrigger.displayName;
3169
+ const D5 = ie.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ X(
3182
3170
  Yn.SubContent,
3183
3171
  {
3184
3172
  ref: a,
@@ -3189,7 +3177,7 @@ const O5 = ie.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ X(
3189
3177
  ...n
3190
3178
  }
3191
3179
  ));
3192
- O5.displayName = Yn.SubContent.displayName;
3180
+ D5.displayName = Yn.SubContent.displayName;
3193
3181
  const mk = ie.forwardRef(({ className: e, sideOffset: n = 4, ...a }, s) => /* @__PURE__ */ X(
3194
3182
  Yn.Content,
3195
3183
  {
@@ -3217,7 +3205,7 @@ const gk = ie.forwardRef(({ className: e, inset: n, ...a }, s) => /* @__PURE__ *
3217
3205
  }
3218
3206
  ) }));
3219
3207
  gk.displayName = Yn.Item.displayName;
3220
- const L5 = ie.forwardRef(({ className: e, children: n, checked: a, ...s }, f) => /* @__PURE__ */ Nt(
3208
+ const O5 = ie.forwardRef(({ className: e, children: n, checked: a, ...s }, f) => /* @__PURE__ */ Nt(
3221
3209
  Yn.CheckboxItem,
3222
3210
  {
3223
3211
  ref: f,
@@ -3233,8 +3221,8 @@ const L5 = ie.forwardRef(({ className: e, children: n, checked: a, ...s }, f) =>
3233
3221
  ]
3234
3222
  }
3235
3223
  ));
3236
- L5.displayName = Yn.CheckboxItem.displayName;
3237
- const I5 = ie.forwardRef(({ className: e, children: n, ...a }, s) => /* @__PURE__ */ Nt(
3224
+ O5.displayName = Yn.CheckboxItem.displayName;
3225
+ const L5 = ie.forwardRef(({ className: e, children: n, ...a }, s) => /* @__PURE__ */ Nt(
3238
3226
  Yn.RadioItem,
3239
3227
  {
3240
3228
  ref: s,
@@ -3249,8 +3237,8 @@ const I5 = ie.forwardRef(({ className: e, children: n, ...a }, s) => /* @__PURE_
3249
3237
  ]
3250
3238
  }
3251
3239
  ));
3252
- I5.displayName = Yn.RadioItem.displayName;
3253
- const M5 = ie.forwardRef(({ className: e, inset: n, ...a }, s) => /* @__PURE__ */ X(
3240
+ L5.displayName = Yn.RadioItem.displayName;
3241
+ const I5 = ie.forwardRef(({ className: e, inset: n, ...a }, s) => /* @__PURE__ */ X(
3254
3242
  Yn.Label,
3255
3243
  {
3256
3244
  ref: s,
@@ -3262,8 +3250,8 @@ const M5 = ie.forwardRef(({ className: e, inset: n, ...a }, s) => /* @__PURE__ *
3262
3250
  ...a
3263
3251
  }
3264
3252
  ));
3265
- M5.displayName = Yn.Label.displayName;
3266
- const P5 = ie.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ X(
3253
+ I5.displayName = Yn.Label.displayName;
3254
+ const M5 = ie.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ X(
3267
3255
  Yn.Separator,
3268
3256
  {
3269
3257
  ref: a,
@@ -3271,8 +3259,8 @@ const P5 = ie.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ X(
3271
3259
  ...n
3272
3260
  }
3273
3261
  ));
3274
- P5.displayName = Yn.Separator.displayName;
3275
- function F5({
3262
+ M5.displayName = Yn.Separator.displayName;
3263
+ function P5({
3276
3264
  className: e,
3277
3265
  ...n
3278
3266
  }) {
@@ -3284,11 +3272,11 @@ function F5({
3284
3272
  }
3285
3273
  );
3286
3274
  }
3287
- function U5() {
3288
- const e = H1(), [n, a] = Nu(!1), { widgetCtx: s } = $f();
3289
- return /* @__PURE__ */ Nt(k5, { open: n, onOpenChange: a, children: [
3290
- /* @__PURE__ */ X(R5, { asChild: !0, children: /* @__PURE__ */ X(Zs, { variant: "ghost", size: "fit", className: "rounded-full", children: /* @__PURE__ */ X(fI, { className: "size-4" }) }) }),
3291
- /* @__PURE__ */ X(mk, { align: "end", className: "min-w-56", children: /* @__PURE__ */ X(N5, { children: /* @__PURE__ */ Nt(
3275
+ function F5() {
3276
+ const e = B1(), [n, a] = Nu(!1), { widgetCtx: s } = $f();
3277
+ return /* @__PURE__ */ Nt(A5, { open: n, onOpenChange: a, children: [
3278
+ /* @__PURE__ */ X(k5, { asChild: !0, children: /* @__PURE__ */ X(Zs, { variant: "ghost", size: "fit", className: "rounded-full", children: /* @__PURE__ */ X(fI, { className: "size-4" }) }) }),
3279
+ /* @__PURE__ */ X(mk, { align: "end", className: "min-w-56", children: /* @__PURE__ */ X(R5, { children: /* @__PURE__ */ Nt(
3292
3280
  gk,
3293
3281
  {
3294
3282
  onSelect: () => {
@@ -3309,14 +3297,80 @@ function U5() {
3309
3297
  ) }) })
3310
3298
  ] });
3311
3299
  }
3312
- function B5() {
3300
+ function U5() {
3313
3301
  var a;
3314
- const { data: e, isLoading: n } = Yw();
3302
+ const { data: e, isLoading: n } = Vw();
3315
3303
  return /* @__PURE__ */ X("header", { className: "p-2 border-b bg-background", children: /* @__PURE__ */ Nt("div", { className: "flex items-center gap-2", children: [
3316
- /* @__PURE__ */ X("div", { className: "flex-1 pl-2", children: n ? /* @__PURE__ */ X(F5, { className: "h-4 w-2/3" }) : /* @__PURE__ */ X("h2", { className: "font-semibold", children: (a = e == null ? void 0 : e.data) == null ? void 0 : a.organizationName }) }),
3317
- /* @__PURE__ */ X(U5, {})
3304
+ /* @__PURE__ */ X("div", { className: "flex-1 pl-2", children: n ? /* @__PURE__ */ X(P5, { className: "h-4 w-2/3" }) : /* @__PURE__ */ X("h2", { className: "font-semibold", children: (a = e == null ? void 0 : e.data) == null ? void 0 : a.organizationName }) }),
3305
+ /* @__PURE__ */ X(F5, {})
3318
3306
  ] }) });
3319
3307
  }
3308
+ function B5(e) {
3309
+ const n = [];
3310
+ let a = null;
3311
+ return e.forEach((s) => {
3312
+ var f, p, d, g;
3313
+ (!a || ((f = a[0]) == null ? void 0 : f.type) !== s.type) && (a = [], n.push(a)), ((p = a[0]) == null ? void 0 : p.type) === "FROM_AGENT" && s.type === "FROM_AGENT" && ((d = s.agent) == null ? void 0 : d.id) !== ((g = a[0].agent) == null ? void 0 : g.id) && (a = [], n.push(a)), a.push(s);
3314
+ }), n;
3315
+ }
3316
+ function H5(e) {
3317
+ var n;
3318
+ return ((n = e == null ? void 0 : e[0]) == null ? void 0 : n.type) === "FROM_USER";
3319
+ }
3320
+ function z5(e) {
3321
+ var n;
3322
+ return ((n = e == null ? void 0 : e[0]) == null ? void 0 : n.type) === "FROM_BOT";
3323
+ }
3324
+ function j5(e) {
3325
+ var n;
3326
+ return ((n = e == null ? void 0 : e[0]) == null ? void 0 : n.type) === "FROM_AGENT";
3327
+ }
3328
+ function pw({
3329
+ message: e,
3330
+ Wrapper: n,
3331
+ wrapperProps: a
3332
+ }) {
3333
+ const { componentStore: s } = $f(), f = s.getComponent(
3334
+ e.component,
3335
+ !1
3336
+ );
3337
+ return f ? n ? (
3338
+ // @ts-ignore
3339
+ /* @__PURE__ */ i_(
3340
+ n,
3341
+ {
3342
+ ...a,
3343
+ key: e.id,
3344
+ "data-test": `message-wrapper-${e.id}`
3345
+ },
3346
+ /* @__PURE__ */ X(f, { ...e, id: e.id })
3347
+ )
3348
+ ) : /* @__PURE__ */ X("div", { "data-test": `message-${e.id}`, children: /* @__PURE__ */ i_(f, { ...e, id: e.id, key: e.id }) }) : null;
3349
+ }
3350
+ function mw({
3351
+ children: e,
3352
+ className: n,
3353
+ messageId: a
3354
+ }) {
3355
+ return /* @__PURE__ */ X(
3356
+ "div",
3357
+ {
3358
+ className: Ft("w-fit space-y-2", n),
3359
+ "data-test": `message-wrapper-${a}`,
3360
+ children: /* @__PURE__ */ X(
3361
+ "div",
3362
+ {
3363
+ "data-test": "message-content-wrapper",
3364
+ className: Ft(
3365
+ "w-fit p-2 rounded-2xl text-sm",
3366
+ "bg-secondary border shadow-sm"
3367
+ ),
3368
+ children: e
3369
+ }
3370
+ )
3371
+ }
3372
+ );
3373
+ }
3320
3374
  const z1 = ie.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ X(
3321
3375
  Gf.Root,
3322
3376
  {
@@ -3380,7 +3434,7 @@ function yk({ attachment: e }) {
3380
3434
  ] })
3381
3435
  ] });
3382
3436
  }
3383
- function H5({
3437
+ function V5({
3384
3438
  message: e
3385
3439
  }) {
3386
3440
  var n;
@@ -3400,10 +3454,10 @@ function H5({
3400
3454
  e.attachments && e.attachments.length > 0 && /* @__PURE__ */ X("div", { className: "flex gap-1 flex-wrap justify-end", children: (n = e.attachments) == null ? void 0 : n.map((a) => /* @__PURE__ */ X(yk, { attachment: a }, a.id)) })
3401
3455
  ] });
3402
3456
  }
3403
- function z5({
3457
+ function Y5({
3404
3458
  messages: e
3405
3459
  }) {
3406
- const { user: n } = zm();
3460
+ const { user: n } = Hm();
3407
3461
  return /* @__PURE__ */ Nt(
3408
3462
  "div",
3409
3463
  {
@@ -3414,62 +3468,16 @@ function z5({
3414
3468
  ),
3415
3469
  children: [
3416
3470
  /* @__PURE__ */ X(z1, { className: "bg-primary text-primary-foreground", children: /* @__PURE__ */ X(Qw, { src: n == null ? void 0 : n.avatarUrl, alt: (n == null ? void 0 : n.name) || "User avatar" }) }),
3417
- e.map((a) => /* @__PURE__ */ X(H5, { message: a }, a.id))
3471
+ e.map((a) => /* @__PURE__ */ X(V5, { message: a }, a.id))
3418
3472
  ]
3419
3473
  }
3420
3474
  );
3421
3475
  }
3422
- function pw({
3423
- message: e,
3424
- Wrapper: n,
3425
- wrapperProps: a
3426
- }) {
3427
- const { componentStore: s } = $f(), f = s.getComponent(
3428
- e.component,
3429
- !1
3430
- );
3431
- return f ? n ? (
3432
- // @ts-ignore
3433
- /* @__PURE__ */ i_(
3434
- n,
3435
- {
3436
- ...a,
3437
- key: e.id,
3438
- "data-test": `message-wrapper-${e.id}`
3439
- },
3440
- /* @__PURE__ */ X(f, { ...e, id: e.id })
3441
- )
3442
- ) : /* @__PURE__ */ X("div", { "data-test": `message-${e.id}`, children: /* @__PURE__ */ i_(f, { ...e, id: e.id, key: e.id }) }) : null;
3443
- }
3444
- function mw({
3445
- children: e,
3446
- className: n,
3447
- messageId: a
3448
- }) {
3449
- return /* @__PURE__ */ X(
3450
- "div",
3451
- {
3452
- className: Ft("w-fit space-y-2", n),
3453
- "data-test": `message-wrapper-${a}`,
3454
- children: /* @__PURE__ */ X(
3455
- "div",
3456
- {
3457
- "data-test": "message-content-wrapper",
3458
- className: Ft(
3459
- "w-fit p-2 rounded-2xl text-sm",
3460
- "bg-secondary border shadow-sm"
3461
- ),
3462
- children: e
3463
- }
3464
- )
3465
- }
3466
- );
3467
- }
3468
- function j5({
3476
+ function W5({
3469
3477
  messages: e,
3470
3478
  agent: n
3471
3479
  }) {
3472
- const { session: a } = jw();
3480
+ const { session: a } = zw();
3473
3481
  return /* @__PURE__ */ Nt("div", { className: Ft("flex flex-col items-start gap-2", "pr-8"), children: [
3474
3482
  /* @__PURE__ */ X(z1, { children: /* @__PURE__ */ X(Qw, { src: (n == null ? void 0 : n.avatar) ?? "", alt: "Agent Icon" }) }),
3475
3483
  e.map((s) => {
@@ -3489,29 +3497,12 @@ function j5({
3489
3497
  })
3490
3498
  ] });
3491
3499
  }
3492
- function V5(e) {
3493
- const n = [];
3494
- let a = null;
3495
- return e.forEach((s) => {
3496
- var f, p, d;
3497
- (!a || a[0].type !== s.type) && (a = [], n.push(a)), ((f = a[0]) == null ? void 0 : f.type) === "FROM_AGENT" && s.type === "FROM_AGENT" && ((p = s.agent) == null ? void 0 : p.id) !== ((d = a[0].agent) == null ? void 0 : d.id) && (a = [], n.push(a)), a.push(s);
3498
- }), n;
3499
- }
3500
- function Y5(e) {
3501
- return (e == null ? void 0 : e[0].type) === "FROM_USER";
3502
- }
3503
- function W5(e) {
3504
- return (e == null ? void 0 : e[0].type) === "FROM_BOT";
3505
- }
3506
- function q5(e) {
3507
- return (e == null ? void 0 : e[0].type) === "FROM_AGENT";
3508
- }
3509
- function Q5() {
3500
+ function q5() {
3510
3501
  var T;
3511
3502
  const {
3512
3503
  messages: { messages: e }
3513
- } = Vw(), { isAwaitingBotReply: n } = ak(), { componentStore: a } = $f(), s = zm(), f = F1(
3514
- () => V5(e),
3504
+ } = jw(), { isAwaitingBotReply: n } = rk(), { componentStore: a } = $f(), s = Hm(), f = F1(
3505
+ () => B5(e),
3515
3506
  [e.length]
3516
3507
  ), p = a.getComponent(
3517
3508
  "loading"
@@ -3522,7 +3513,7 @@ function Q5() {
3522
3513
  C && (C.scrollTop = C.scrollHeight);
3523
3514
  }, 0);
3524
3515
  }
3525
- Bm(() => {
3516
+ Um(() => {
3526
3517
  g();
3527
3518
  }, [e]);
3528
3519
  const E = e.length === 0;
@@ -3562,17 +3553,17 @@ function Q5() {
3562
3553
  "default-welcome"
3563
3554
  )),
3564
3555
  f.map((C, S) => {
3565
- var A;
3566
- if (!(C == null ? void 0 : C[0].type)) return null;
3567
- if (Y5(C))
3568
- return /* @__PURE__ */ X(z5, { messages: C }, S);
3569
- if (W5(C) || q5(C)) {
3570
- const D = (A = C[0]) == null ? void 0 : A.agent;
3556
+ var A, D;
3557
+ if (!((A = C == null ? void 0 : C[0]) == null ? void 0 : A.type)) return null;
3558
+ if (H5(C))
3559
+ return /* @__PURE__ */ X(Y5, { messages: C }, S);
3560
+ if (z5(C) || j5(C)) {
3561
+ const L = (D = C[0]) == null ? void 0 : D.agent;
3571
3562
  return /* @__PURE__ */ X(
3572
- j5,
3563
+ W5,
3573
3564
  {
3574
3565
  messages: C,
3575
- agent: D
3566
+ agent: L
3576
3567
  },
3577
3568
  S
3578
3569
  );
@@ -3584,13 +3575,13 @@ function Q5() {
3584
3575
  }
3585
3576
  );
3586
3577
  }
3587
- const $5 = "[data-chat-widget-content-root]";
3578
+ const Q5 = "[data-chat-widget-content-root]";
3588
3579
  function Ek({
3589
3580
  fallbackHeight: e
3590
3581
  }) {
3591
3582
  const n = U1(null);
3592
- return Bm(() => {
3593
- const a = document.querySelector($5);
3583
+ return Um(() => {
3584
+ const a = document.querySelector(Q5);
3594
3585
  if (a && n.current) {
3595
3586
  const s = n.current;
3596
3587
  let f;
@@ -3609,10 +3600,22 @@ function Ek({
3609
3600
  }
3610
3601
  }, []), { observedElementRef: n };
3611
3602
  }
3603
+ function $5({ options: e, onKeyboardClick: n }) {
3604
+ return /* @__PURE__ */ X("div", { className: "flex items-center gap-2 p-2 flex-wrap", children: e.map((a, s) => /* @__PURE__ */ X(
3605
+ Zs,
3606
+ {
3607
+ onClick: () => n(a),
3608
+ className: "flex-1 rounded-full",
3609
+ size: "sm",
3610
+ children: a
3611
+ },
3612
+ s
3613
+ )) });
3614
+ }
3612
3615
  function G5() {
3613
3616
  var d, g;
3614
- const { messages: e, messageCtx: n } = Vw(), s = (g = (d = Yw().data) == null ? void 0 : d.data) == null ? void 0 : g.initialQuestions, { observedElementRef: f } = Ek({
3615
- fallbackHeight: a5
3617
+ const { messages: e, messageCtx: n } = jw(), s = (g = (d = Vw().data) == null ? void 0 : d.data) == null ? void 0 : g.initialQuestions, { observedElementRef: f } = Ek({
3618
+ fallbackHeight: xI
3616
3619
  }), p = e.messages.length === 0;
3617
3620
  return /* @__PURE__ */ X(
3618
3621
  "div",
@@ -3620,7 +3623,7 @@ function G5() {
3620
3623
  ref: f,
3621
3624
  "data-test": "chat-screen",
3622
3625
  className: Ft(
3623
- qw.widgetHeight,
3626
+ Ww.widgetHeight,
3624
3627
  "w-full flex flex-col overflow-hidden bg-background z-10 origin-bottom absolute bottom-0 inset-x-0"
3625
3628
  ),
3626
3629
  children: /* @__PURE__ */ Nt(
@@ -3632,17 +3635,17 @@ function G5() {
3632
3635
  background: "linear-gradient(333.89deg, rgba(75, 240, 171, 0.8) 58%, rgba(75, 240, 171, 0) 85.74%), linear-gradient(113.43deg, #46B1FF 19.77%, #1883FF 65.81%)"
3633
3636
  },
3634
3637
  children: [
3635
- /* @__PURE__ */ X(B5, {}),
3638
+ /* @__PURE__ */ X(U5, {}),
3636
3639
  /* @__PURE__ */ Nt(
3637
3640
  "div",
3638
3641
  {
3639
3642
  className: "flex bg-background shadow-lg flex-col w-full flex-1 overflow-auto",
3640
3643
  "data-test": "chat-main-container",
3641
3644
  children: [
3642
- /* @__PURE__ */ X(Q5, {}),
3645
+ /* @__PURE__ */ X(q5, {}),
3643
3646
  /* @__PURE__ */ Nt("footer", { "data-test": "chat-footer", children: [
3644
3647
  e.suggestedReplies && /* @__PURE__ */ X(
3645
- p5,
3648
+ $5,
3646
3649
  {
3647
3650
  "data-test": "chat-keyboard",
3648
3651
  options: e.suggestedReplies,
@@ -3673,7 +3676,7 @@ function G5() {
3673
3676
  ))
3674
3677
  }
3675
3678
  ),
3676
- /* @__PURE__ */ X(A5, {})
3679
+ /* @__PURE__ */ X(_5, {})
3677
3680
  ] })
3678
3681
  ]
3679
3682
  }
@@ -3685,7 +3688,7 @@ function G5() {
3685
3688
  );
3686
3689
  }
3687
3690
  const gw = ie.forwardRef(
3688
- ({ className: e, type: n, ...a }, s) => /* @__PURE__ */ X(B1, { ref: s, children: /* @__PURE__ */ X(
3691
+ ({ className: e, type: n, ...a }, s) => /* @__PURE__ */ X(H1, { ref: s, children: /* @__PURE__ */ X(
3689
3692
  "input",
3690
3693
  {
3691
3694
  type: n,
@@ -3704,8 +3707,8 @@ const X5 = MT.object({
3704
3707
  });
3705
3708
  function K5() {
3706
3709
  var g, E, T;
3707
- const { contactCtx: e } = ik(), n = zm(), a = H1(), { data: s } = Yw(), { observedElementRef: f } = Ek({
3708
- fallbackHeight: r5
3710
+ const { contactCtx: e } = ak(), n = Hm(), a = B1(), { data: s } = Vw(), { observedElementRef: f } = Ek({
3711
+ fallbackHeight: wI
3709
3712
  }), [p, d] = vI(
3710
3713
  async (C) => {
3711
3714
  C.preventDefault();
@@ -3722,7 +3725,7 @@ function K5() {
3722
3725
  ref: f,
3723
3726
  "data-test": "welcome-screen",
3724
3727
  className: Ft(
3725
- qw.widgetMinHeight,
3728
+ Ww.widgetMinHeight,
3726
3729
  "h-fit bg-primary rounded-3xl flex flex-col"
3727
3730
  ),
3728
3731
  children: [
@@ -3836,8 +3839,8 @@ function K5() {
3836
3839
  );
3837
3840
  }
3838
3841
  function J5() {
3839
- const { contactCtx: e } = ik(), n = e.shouldCollectData();
3840
- return /* @__PURE__ */ X("div", { className: "bg-background size-full", "data-test": "root-screen", children: /* @__PURE__ */ X(Hm, { mode: "wait", children: n ? /* @__PURE__ */ X(
3842
+ const { contactCtx: e } = ak(), n = e.shouldCollectData();
3843
+ return /* @__PURE__ */ X("div", { className: "bg-background size-full", "data-test": "root-screen", children: /* @__PURE__ */ X(Bm, { mode: "wait", children: n ? /* @__PURE__ */ X(
3841
3844
  Du,
3842
3845
  {
3843
3846
  fadeIn: "right",
@@ -23004,7 +23007,7 @@ var S1 = vw.exports, uM = [
23004
23007
  "ul"
23005
23008
  ], ol = uM.reduce((e, n) => {
23006
23009
  const a = ie.forwardRef((s, f) => {
23007
- const { asChild: p, ...d } = s, g = p ? zw : n;
23010
+ const { asChild: p, ...d } = s, g = p ? Yw : n;
23008
23011
  return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ X(g, { ...d, ref: f });
23009
23012
  });
23010
23013
  return a.displayName = `Primitive.${n}`, { ...e, [n]: a };
@@ -24392,7 +24395,7 @@ const l8 = zM, c8 = jM, d8 = UM, f8 = YM, h8 = BM, L_ = FM, p8 = VM, m8 = (e, n,
24392
24395
  platform: p
24393
24396
  });
24394
24397
  };
24395
- var v1 = typeof document < "u" ? J4 : Bm;
24398
+ var v1 = typeof document < "u" ? J4 : Um;
24396
24399
  function k1(e, n) {
24397
24400
  if (e === n)
24398
24401
  return !0;
@@ -25114,7 +25117,7 @@ function tP(e) {
25114
25117
  return n.options = Xs({ async: !0, ssr: !1 }, e), n;
25115
25118
  }
25116
25119
  var Gk = function(e) {
25117
- var n = e.sideCar, a = ok(e, ["sideCar"]);
25120
+ var n = e.sideCar, a = ik(e, ["sideCar"]);
25118
25121
  if (!n)
25119
25122
  throw new Error("Sidecar: please provide `sideCar` property to import the right car");
25120
25123
  var s = n.read();
@@ -25132,7 +25135,7 @@ var Xk = tP(), qT = function() {
25132
25135
  onScrollCapture: qT,
25133
25136
  onWheelCapture: qT,
25134
25137
  onTouchMoveCapture: qT
25135
- }), f = s[0], p = s[1], d = e.forwardProps, g = e.children, E = e.className, T = e.removeScrollBar, C = e.enabled, S = e.shards, R = e.sideCar, A = e.noIsolation, D = e.inert, L = e.allowPinchZoom, U = e.as, H = U === void 0 ? "div" : U, G = e.gapMode, Y = ok(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), Z = R, K = J8([a, n]), W = Xs(Xs({}, Y), f);
25138
+ }), f = s[0], p = s[1], d = e.forwardProps, g = e.children, E = e.className, T = e.removeScrollBar, C = e.enabled, S = e.shards, R = e.sideCar, A = e.noIsolation, D = e.inert, L = e.allowPinchZoom, U = e.as, H = U === void 0 ? "div" : U, G = e.gapMode, Y = ik(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), Z = R, K = J8([a, n]), W = Xs(Xs({}, Y), f);
25136
25139
  return ie.createElement(
25137
25140
  ie.Fragment,
25138
25141
  null,
@@ -25525,7 +25528,7 @@ var LP = ie.forwardRef(
25525
25528
  return ie.useEffect(() => {
25526
25529
  const d = s.current;
25527
25530
  if (d) return Q8(d);
25528
- }, []), /* @__PURE__ */ X(t3, { as: zw, allowPinchZoom: !0, children: /* @__PURE__ */ X(
25531
+ }, []), /* @__PURE__ */ X(t3, { as: Yw, allowPinchZoom: !0, children: /* @__PURE__ */ X(
25529
25532
  s3,
25530
25533
  {
25531
25534
  ...e,
@@ -25702,7 +25705,7 @@ var zP = /* @__PURE__ */ P1.createContext({
25702
25705
  }, [E]);
25703
25706
  F1(() => {
25704
25707
  !p && g.onLoad && E && g.onLoad(U.current);
25705
- }, [E]), Bm(() => {
25708
+ }, [E]), Um(() => {
25706
25709
  if (C && !p) {
25707
25710
  var Z;
25708
25711
  (Z = C.contentWindow) == null || Z.addEventListener("DOMContentLoaded", H);
@@ -25756,7 +25759,7 @@ function VP({ className: e }) {
25756
25759
  );
25757
25760
  }
25758
25761
  function YP({ isOpen: e }) {
25759
- const { theme: n } = zm();
25762
+ const { theme: n } = Hm();
25760
25763
  return /* @__PURE__ */ X(
25761
25764
  o3,
25762
25765
  {
@@ -25766,7 +25769,7 @@ function YP({ isOpen: e }) {
25766
25769
  fontSize: "16px",
25767
25770
  position: "fixed",
25768
25771
  zIndex: 1e7,
25769
- ...hk(
25772
+ ...uk(
25770
25773
  { primary: n == null ? void 0 : n.primaryColor }
25771
25774
  // { triggerOffset: theme.triggerOffset },
25772
25775
  ),
@@ -25776,7 +25779,7 @@ function YP({ isOpen: e }) {
25776
25779
  bottom: "20px"
25777
25780
  },
25778
25781
  className: Ft("size-12 font-inter flex items-center justify-center"),
25779
- children: /* @__PURE__ */ X(B1, { children: /* @__PURE__ */ X(
25782
+ children: /* @__PURE__ */ X(H1, { children: /* @__PURE__ */ X(
25780
25783
  "div",
25781
25784
  {
25782
25785
  className: Ft(
@@ -25790,13 +25793,13 @@ function YP({ isOpen: e }) {
25790
25793
  "active:scale-90",
25791
25794
  "[&_svg]:size-6"
25792
25795
  ),
25793
- children: /* @__PURE__ */ X(Hm, { mode: "wait", children: e ? /* @__PURE__ */ X(
25796
+ children: /* @__PURE__ */ X(Bm, { mode: "wait", children: e ? /* @__PURE__ */ X(
25794
25797
  Du,
25795
25798
  {
25796
25799
  snapExit: !0,
25797
25800
  fadeIn: "up",
25798
25801
  overrides: { initial: { rotate: 45 }, animate: { rotate: 0 } },
25799
- children: /* @__PURE__ */ X(rk, {})
25802
+ children: /* @__PURE__ */ X(nk, {})
25800
25803
  },
25801
25804
  "x-icon"
25802
25805
  ) : /* @__PURE__ */ X(
@@ -25814,7 +25817,7 @@ function YP({ isOpen: e }) {
25814
25817
  );
25815
25818
  }
25816
25819
  function WP() {
25817
- return /* @__PURE__ */ X(Hm, { children: /* @__PURE__ */ Nt(
25820
+ return /* @__PURE__ */ X(Bm, { children: /* @__PURE__ */ Nt(
25818
25821
  Sc.div,
25819
25822
  {
25820
25823
  "data-test": "loading-container",
@@ -40845,7 +40848,7 @@ function ZY({
40845
40848
  opened: n = !1,
40846
40849
  ...a
40847
40850
  }) {
40848
- const s = $f(), { theme: f } = zm(), [p, d] = Nu(n);
40851
+ const s = $f(), { theme: f } = Hm(), [p, d] = Nu(n);
40849
40852
  return /* @__PURE__ */ Nt(UP, { open: p, onOpenChange: d, children: [
40850
40853
  /* @__PURE__ */ X("style", { children: p3 }),
40851
40854
  /* @__PURE__ */ X(
@@ -40893,7 +40896,7 @@ function ZY({
40893
40896
  style: {
40894
40897
  maxHeight: "85dvh",
40895
40898
  width: "350px",
40896
- minHeight: qw.widgetMinHeight,
40899
+ minHeight: Ww.widgetMinHeight,
40897
40900
  height: "var(--opencx-widget-height)",
40898
40901
  overflow: "hidden",
40899
40902
  /** outline is better than border because of box sizing; the outline wouldn't affect the content inside... the border will mess up how the children's border radius sits with the parent */
@@ -40906,7 +40909,7 @@ function ZY({
40906
40909
  transitionDuration: "150ms"
40907
40910
  },
40908
40911
  children: /* @__PURE__ */ X(
40909
- e5,
40912
+ n5,
40910
40913
  {
40911
40914
  delayDuration: 200,
40912
40915
  disableHoverableContent: !0,
@@ -40915,7 +40918,7 @@ function ZY({
40915
40918
  {
40916
40919
  style: {
40917
40920
  display: "contents",
40918
- ...hk(
40921
+ ...uk(
40919
40922
  { primary: f == null ? void 0 : f.primaryColor }
40920
40923
  // { triggerOffset: theme.triggerOffset },
40921
40924
  )