@opencx/widget 2.5.1 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/api-BwKgAJ6p.cjs +2 -0
  2. package/dist/api-BwKgAJ6p.cjs.map +1 -0
  3. package/dist/api-DRZ9vPwy.js +1360 -0
  4. package/dist/api-DRZ9vPwy.js.map +1 -0
  5. package/dist/basic.cjs +85 -85
  6. package/dist/basic.cjs.map +1 -1
  7. package/dist/basic.js +13350 -12831
  8. package/dist/basic.js.map +1 -1
  9. package/dist/core/client/api.d.ts +368 -40
  10. package/dist/core/client/chat.d.ts +55 -12
  11. package/dist/core/client/config.d.ts +13 -3
  12. package/dist/core/client/contact.d.ts +3 -13
  13. package/dist/core/errors/index.d.ts +6 -0
  14. package/dist/core/platform/audio.d.ts +38 -0
  15. package/dist/core/platform/index.d.ts +6 -2
  16. package/dist/core/platform/storage.d.ts +8 -2
  17. package/dist/core/sdk/index.d.ts +11 -0
  18. package/dist/core/tests/platform/logger.test.d.ts +1 -0
  19. package/dist/core/tests/platform/storage.test.d.ts +1 -0
  20. package/dist/core/tests/test-utils.d.ts +2 -0
  21. package/dist/core/tests/types/pub-sub.test.d.ts +1 -0
  22. package/dist/core/types/helpers.d.ts +5 -2
  23. package/dist/core/types/index.d.ts +6 -6
  24. package/dist/core/types/messages.d.ts +20 -9
  25. package/dist/core/types/pub-sub.d.ts +1 -0
  26. package/dist/core/types/schemas-v2.d.ts +10 -710
  27. package/dist/index-B5YLfjom.cjs +18 -0
  28. package/dist/index-B5YLfjom.cjs.map +1 -0
  29. package/dist/index-EZN9_jan.js +1219 -0
  30. package/dist/index-EZN9_jan.js.map +1 -0
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.js +22 -874
  34. package/dist/index.js.map +1 -1
  35. package/dist/react-web/core-integration/ChatProvider.d.ts +101 -0
  36. package/dist/react-web/core-integration/components.d.ts +11 -0
  37. package/dist/react-web/core-integration/hooks/useChatMessages.d.ts +64 -0
  38. package/dist/react-web/core-integration/hooks/useChatSession.d.ts +77 -0
  39. package/dist/react-web/core-integration/hooks/useConfig.d.ts +1 -0
  40. package/dist/react-web/core-integration/hooks/useContact.d.ts +11 -0
  41. package/dist/react-web/core-integration/hooks/useLocale.d.ts +4 -0
  42. package/dist/react-web/core-integration/hooks/usePreludeData.d.ts +36 -0
  43. package/dist/react-web/core-integration/hooks/usePubsub.d.ts +2 -0
  44. package/dist/react-web/{hooks → core-integration/hooks}/useUploadFiles.d.ts +2 -2
  45. package/dist/react-web/{hooks → core-integration/hooks}/useVote.d.ts +2 -2
  46. package/dist/react-web/core-integration/hooks.d.ts +9 -0
  47. package/dist/react-web/core-integration/index.d.ts +2 -0
  48. package/dist/react-web/index.d.ts +4 -10
  49. package/dist/react-web/types/components.d.ts +6 -3
  50. package/dist/react-web/types/index.d.ts +3 -2
  51. package/dist/react-web/types/options.d.ts +4 -30
  52. package/dist/react.cjs +1 -1
  53. package/dist/react.cjs.map +1 -1
  54. package/dist/react.js +10 -46
  55. package/dist/react.js.map +1 -1
  56. package/dist/src/@components/BotOrAgentMessageGroup.d.ts +1 -2
  57. package/dist/src/@components/BotOrAgentMessageWrapper.d.ts +2 -2
  58. package/dist/src/@components/ChatEvent.component.d.ts +3 -3
  59. package/dist/src/@components/Text.component.d.ts +1 -1
  60. package/dist/src/components/button.d.ts +1 -1
  61. package/dist/src/components/dialog.d.ts +9 -9
  62. package/dist/src/designs/basic/index.d.ts +1 -1
  63. package/dist/style.css +1 -1
  64. package/dist-embed/script.js +119 -124
  65. package/dist-embed/script.js.map +1 -1
  66. package/package.json +8 -4
  67. package/dist/core/types/schemas.d.ts +0 -543
  68. package/dist/core/utils/create-fetch.d.ts +0 -24
  69. package/dist/core/utils/genId.d.ts +0 -2
  70. package/dist/core/utils/history-to-widget-messages.d.ts +0 -4
  71. package/dist/genUuid-BkZtn1k9.cjs +0 -2
  72. package/dist/genUuid-BkZtn1k9.cjs.map +0 -1
  73. package/dist/genUuid-CDpI3ugS.js +0 -136
  74. package/dist/genUuid-CDpI3ugS.js.map +0 -1
  75. package/dist/index-1bY4_hBw.cjs +0 -18
  76. package/dist/index-1bY4_hBw.cjs.map +0 -1
  77. package/dist/index-D84Xc70r.js +0 -2609
  78. package/dist/index-D84Xc70r.js.map +0 -1
  79. package/dist/package.json.d.ts +0 -157
  80. package/dist/react-web/Root.d.ts +0 -6
  81. package/dist/react-web/hooks/index.d.ts +0 -6
  82. package/dist/react-web/hooks/use-sound.d.ts +0 -13
  83. package/dist/react-web/hooks/useAbstractChat.d.ts +0 -157
  84. package/dist/react-web/hooks/useAxiosInstance.d.ts +0 -190
  85. package/dist/react-web/hooks/useSyncState.d.ts +0 -4
  86. package/dist/react-web/hooks/useTimeoutState.d.ts +0 -3
  87. package/dist/react-web/providers/ChatProvider.d.ts +0 -143
  88. package/dist/react-web/providers/ConfigDataProvider.d.ts +0 -62
  89. package/dist/react-web/providers/ContactProvider.d.ts +0 -58
  90. package/dist/react-web/providers/LocalesProvider.d.ts +0 -11
  91. package/dist/react-web/providers/componentRegistry.d.ts +0 -13
  92. package/dist/react-web/providers/use-widget-sfx.d.ts +0 -7
  93. package/dist/react-web/providers/usePreludeData.d.ts +0 -2
  94. package/dist/react-web/utils/debug.d.ts +0 -2
  95. package/dist/react-web/utils/getters.d.ts +0 -24
  96. package/dist/react-web/utils/index.d.ts +0 -1
  97. package/dist/src/hooks/useShouldCollectData.d.ts +0 -3
  98. /package/dist/core/{utils/genId.test.d.ts → tests/client/integration-perisitance.test.d.ts} +0 -0
  99. /package/dist/{react-web/hooks/use-sound.test.d.ts → core/tests/client/integration.test.d.ts} +0 -0
  100. /package/dist/{react-web/hooks/use-sync-state.test.d.ts → core/tests/platform/audio.test.d.ts} +0 -0
  101. /package/dist/react-web/{locales → core-integration/locales}/ar.locale.d.ts +0 -0
  102. /package/dist/react-web/{locales → core-integration/locales}/de.locale.d.ts +0 -0
  103. /package/dist/react-web/{locales → core-integration/locales}/en.locale.d.ts +0 -0
  104. /package/dist/react-web/{locales → core-integration/locales}/fr.locale.d.ts +0 -0
  105. /package/dist/react-web/{locales → core-integration/locales}/helper.d.ts +0 -0
  106. /package/dist/react-web/{locales → core-integration/locales}/index.d.ts +0 -0
  107. /package/dist/react-web/{locales → core-integration/locales}/nl.locale.d.ts +0 -0
  108. /package/dist/react-web/{locales → core-integration/locales}/pt.locale.d.ts +0 -0
@@ -1,2609 +0,0 @@
1
- var ln = Object.defineProperty;
2
- var dn = (e, t, n) => t in e ? ln(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var at = (e, t, n) => dn(e, typeof t != "symbol" ? t + "" : t, n);
4
- import de, { useMemo as ee, useState as Ke, useCallback as ge, useEffect as le, createContext as ht, useContext as yt, useRef as se, useReducer as fn, useLayoutEffect as pn, useDebugValue as gn } from "react";
5
- import { jsx as $ } from "react/jsx-runtime";
6
- import { create as mn } from "mutative";
7
- import l from "zod";
8
- import { c as St, g as ve } from "./genUuid-CDpI3ugS.js";
9
- import hn from "lodash.set";
10
- import yn from "axios";
11
- const Sn = typeof window > "u", it = {
12
- getItem: () => null,
13
- setItem: () => {
14
- },
15
- removeItem: () => {
16
- }
17
- };
18
- function vn(e) {
19
- return Sn ? it : e === "local" ? localStorage : e === "session" ? sessionStorage : it;
20
- }
21
- function Je(e, t, n = "session") {
22
- const r = ee(() => vn(n), [n]), [s, o] = Ke(() => {
23
- const g = r.getItem(e);
24
- if (g !== null)
25
- try {
26
- return JSON.parse(g);
27
- } catch (u) {
28
- console.error(`Error parsing stored value for key '${e}':`, u);
29
- }
30
- return typeof t == "function" ? t() : t ?? null;
31
- }), a = ge(
32
- (g) => {
33
- if (o(g), g === null)
34
- r.removeItem(e);
35
- else
36
- try {
37
- r.setItem(e, JSON.stringify(g));
38
- } catch (u) {
39
- console.error(
40
- `Error saving state to storage for key '${e}':`,
41
- u
42
- );
43
- }
44
- },
45
- [e, r]
46
- ), d = ge(() => {
47
- o(null), r.removeItem(e);
48
- }, [e, r]);
49
- return le(() => {
50
- const g = (u) => {
51
- u.key === e && u.newValue !== JSON.stringify(s) && o(u.newValue ? JSON.parse(u.newValue) : null);
52
- };
53
- return window.addEventListener("storage", g), () => {
54
- window.removeEventListener("storage", g);
55
- };
56
- }, [e, s]), [s, a, d];
57
- }
58
- const En = "@opencx/widget", vt = "2.5.1", bn = "module", wn = {
59
- access: "public"
60
- }, On = {
61
- clean: "rm -rf ./dist ./dist-embed",
62
- "clean:dist": "rm -rf ./dist ./dist-embed",
63
- prepublishOnly: "pnpm clean && pnpm test && pnpm batman",
64
- "build:lib": "vite build",
65
- dev: "vite -c vite.config.ts",
66
- "build:embed": "vite build -c vite.embed.config.ts",
67
- test: "vitest run",
68
- batman: "pnpm build:lib && pnpm build:embed",
69
- "test:watch": "vitest --watch",
70
- cs: "changeset",
71
- csv: "changeset version",
72
- csp: "changeset publish",
73
- "type-check": "tsc --noEmit",
74
- lint: "biome lint --fix",
75
- format: "biome format --fix"
76
- }, An = {
77
- "lucide-react": "^0.412.0",
78
- react: "^18.3.1",
79
- "rehype-raw": "^7.0.0"
80
- }, _n = {
81
- react: {
82
- optional: !0
83
- }
84
- }, Rn = {
85
- axios: "^1.7.5",
86
- zod: "^3.23.8"
87
- }, Tn = {
88
- "@radix-ui/react-avatar": "^1.1.0",
89
- "@radix-ui/react-dropdown-menu": "^2.1.4",
90
- "@radix-ui/react-slot": "^1.1.0",
91
- "@radix-ui/react-switch": "^1.1.0",
92
- "@radix-ui/react-tooltip": "^1.1.2",
93
- clsx: "^2.1.1",
94
- "date-fns": "^4.1.0",
95
- "framer-motion": "^11.3.30",
96
- "lodash.isequal": "^4.5.0",
97
- "lodash.set": "^4.3.2",
98
- "lucide-react": "^0.436.0",
99
- mutative: "^1.0.11",
100
- "react-dropzone": "^14.3.5",
101
- "react-hot-toast": "^2.4.1",
102
- tinycolor2: "^1.6.0",
103
- uuid: "^11.0.4",
104
- zod: "^3.23.8"
105
- }, Dn = {
106
- "@opencx/widget": {
107
- react: {
108
- optional: !0,
109
- dependencies: {
110
- "react-hot-toast": "^2.4.1",
111
- "react-markdown": "^9.0.1",
112
- "framer-motion": "^11.3.30",
113
- "date-fns": "^4.1.0"
114
- }
115
- }
116
- }
117
- }, Nn = {
118
- react: {
119
- "react-hot-toast": "^2.4.1",
120
- "react-markdown": "^9.0.1",
121
- "framer-motion": "^11.3.30",
122
- "date-fns": "^4.1.0"
123
- }
124
- }, Cn = [
125
- "dist",
126
- "dist-embed"
127
- ], xn = {
128
- url: "https://github.com/openchatai/widget/issues"
129
- }, Pn = {
130
- name: "openchatai",
131
- url: "https://github.com/openchatai"
132
- }, In = "./dist/index.js", jn = "./dist/index.js", Ln = "./dist/index.d.ts", kn = !1, Fn = {
133
- ".": {
134
- types: "./dist/index.d.ts",
135
- import: "./dist/index.js",
136
- require: "./dist/index.cjs"
137
- },
138
- "./basic": {
139
- types: "./dist/basic.d.ts",
140
- import: "./dist/basic.js",
141
- require: "./dist/basic.cjs"
142
- },
143
- "./react": {
144
- types: "./dist/react.d.ts",
145
- import: "./dist/react.js",
146
- require: "./dist/react.cjs"
147
- },
148
- "./package.json": "./package.json",
149
- "./dist/*.css": "./dist/*.css"
150
- }, Mn = {
151
- "@biomejs/biome": "1.9.4",
152
- "@changesets/cli": "^2.27.9",
153
- "@radix-ui/react-popover": "^1.1.2",
154
- "@tailwindcss/typography": "^0.5.15",
155
- "@testing-library/dom": "^10.4.0",
156
- "@testing-library/jest-dom": "^6.5.0",
157
- "@testing-library/react": "^16.0.1",
158
- "@types/lodash.debounce": "^4.0.9",
159
- "@types/lodash.isequal": "^4.5.8",
160
- "@types/lodash.set": "^4.3.9",
161
- "@types/node": "^20.14.8",
162
- "@types/react": "^18.3.4",
163
- "@types/react-dom": "^18.3.0",
164
- "@types/tinycolor2": "^1.4.6",
165
- "@uiw/react-iframe": "^1.0.3",
166
- "@vitejs/plugin-react": "^4.3.4",
167
- autoprefixer: "^10.4.20",
168
- axios: "^1.7.5",
169
- "class-variance-authority": "^0.7.0",
170
- jsdom: "^25.0.1",
171
- mutative: "^1.0.11",
172
- postcss: "^8.4.41",
173
- "postcss-prefix-selector": "^1.16.1",
174
- react: "^18.3.1",
175
- "react-dom": "^18.3.1",
176
- "react-markdown": "^9.0.1",
177
- "react-use": "^17.5.1",
178
- "rehype-raw": "^7.0.0",
179
- "remark-gfm": "^4.0.0",
180
- swr: "^2.2.5",
181
- "tailwind-merge": "^2.4.0",
182
- tailwindcss: "^3.4.6",
183
- "tailwindcss-animate": "^1.0.7",
184
- typescript: "^5.5.4",
185
- vite: "^5.4.2",
186
- "vite-plugin-dts": "4.0.3",
187
- "vite-plugin-externalize-deps": "^0.8.0",
188
- "vite-tsconfig-paths": "^5.0.1",
189
- vitest: "^2.0.5"
190
- }, Vn = {
191
- name: En,
192
- private: !1,
193
- version: vt,
194
- type: bn,
195
- publishConfig: wn,
196
- scripts: On,
197
- peerDependencies: An,
198
- peerDependenciesMeta: _n,
199
- optionalDependencies: Rn,
200
- dependencies: Tn,
201
- overrides: Dn,
202
- conditionalDependencies: Nn,
203
- files: Cn,
204
- bugs: xn,
205
- author: Pn,
206
- main: In,
207
- module: jn,
208
- types: Ln,
209
- sideEffects: kn,
210
- exports: Fn,
211
- devDependencies: Mn
212
- }, Un = "X-Bot-Token", Hn = "X-Widget-Version";
213
- function Et(e) {
214
- const t = ee(() => yn.create({
215
- baseURL: e.apiUrl,
216
- headers: {
217
- [Un]: e.botToken,
218
- [Hn]: vt,
219
- "X-Use-Guard": !0
220
- }
221
- }), [e]);
222
- return { apis: ee(
223
- () => ({
224
- createSession: (r) => {
225
- if (!r)
226
- throw new Error("Bot token is required");
227
- return t.post("/chat-session/" + r);
228
- },
229
- /**
230
- * get session data by id
231
- * @param sessionId
232
- */
233
- fetchSession: (r) => {
234
- if (!r)
235
- throw new Error("Session id is required");
236
- return t.get(`widget/session/${r}`);
237
- },
238
- fetchPreludeData: async () => (await t.get("/widget/prelude")).data,
239
- /**
240
- * get the organization office working hours.
241
- */
242
- getOfficeHours: () => t.get("/copilot/office-hours/public"),
243
- // TODO unify with history polling function
244
- fetchHistory: (r) => {
245
- if (!r)
246
- throw new Error("Session id is required");
247
- return t.get(
248
- `widget/session/history/${r}`
249
- );
250
- },
251
- /**
252
- * downvote a message
253
- * @param id
254
- * @returns
255
- * @deprecated use vote instead
256
- */
257
- downvote: (r) => t.delete(`/chat/vote/${r}`),
258
- /**
259
- * upvote a message
260
- * @param id
261
- * @returns
262
- * @deprecated use vote instead
263
- */
264
- upvote: (r) => t.post(`/chat/vote/${r}`),
265
- /**
266
- * given the userData object we will create or update the contact + get the related conversations/tickets/sessions
267
- */
268
- dumpContact: (r) => t.post("/widget/contact/upsert", r),
269
- /**
270
- * get the completions for the given input
271
- */
272
- getCompletions: (r) => t.post("/widget/chat/completions", { input: r }),
273
- /**
274
- * @param file
275
- * @param options
276
- */
277
- uploadFile: async (r, s) => {
278
- const o = new FormData();
279
- return o.append("file", r.file), t.post(`/widget/upload?fileId=${r.id}`, o, {
280
- headers: {
281
- "Content-Type": "multipart/form-data"
282
- },
283
- ...s
284
- });
285
- },
286
- getHistoryPooling: async ({
287
- lastMessageTimestamp: r,
288
- sessionId: s
289
- }) => {
290
- const o = new URLSearchParams();
291
- return o.append("lastMessageTimestamp", r.toString()), t.get(`/widget/session/history/${s}/?${o.toString()}`);
292
- },
293
- /**
294
- * send a message to the chat
295
- * @param message
296
- */
297
- sendMessage: async (r) => t.post("widget/chat/send", r),
298
- /**
299
- * vote on a message
300
- * @param data
301
- */
302
- vote: (r) => t.post("/widget/chat/vote", r)
303
- }),
304
- [t]
305
- ), options: e };
306
- }
307
- function De(e) {
308
- const t = ht({});
309
- return [() => {
310
- const r = yt(t);
311
- if (r === void 0)
312
- throw new Error("useSafeContext must be used within a Provider");
313
- return r;
314
- }, t.Provider];
315
- }
316
- const Gn = {
317
- ok: "حسنا",
318
- yes: "نعم",
319
- no: "لا",
320
- agree: "موافق",
321
- cancel: "إلغاء",
322
- "yes-exit": "نعم، اخرج",
323
- "yes-reset": "نعم، إعادة تعيين",
324
- "no-cancel": "لا، إلغاء",
325
- "are-you-sure": "هل أنت متأكد؟",
326
- recording: "تسجيل",
327
- "thank-you": "شكرا",
328
- "sorry-try-again": "عذرا، حاول مرة أخرى",
329
- "error-occurred": "حدث خطأ",
330
- "please-try-again": "يرجى المحاولة مرة أخرى",
331
- "write-a-message": "اكتب رسالة...",
332
- "send-message": "إرسال رسالة",
333
- connected: "متصل",
334
- connecting: "جاري الاتصال",
335
- reconnecting: "جاري إعادة الاتصال",
336
- reconnected: "تم إعادة الاتصال",
337
- disconnecting: "جاري قطع الاتصال",
338
- disconnected: "قطع الاتصال",
339
- error: "خطأ",
340
- "persist-session": "حفظ الجلسة",
341
- settings: "إعدادات",
342
- close: "إغلاق",
343
- help: "مساعدة",
344
- chat: "محادثة",
345
- send: "إرسال",
346
- copy: "نسخ",
347
- copied: "تم النسخ",
348
- "sound-effects": "التاثيرات الصوتية",
349
- language: "اللغة",
350
- select: "اختر",
351
- agent: "الوكيل",
352
- user: "المستخدم",
353
- bot: "البوت",
354
- "reset-conversation-confirm": "هل أنت متأكد من أنك تريد إعادة تعيين المحادثة؟",
355
- "close-widget": "إغلاق الودجة",
356
- "got-any-questions": "هل لديك أي أسئلة؟ تحدث معنا!",
357
- "typical-response-time": "عادة ما نرد في أقل من دقيقة واحدة",
358
- "session-closed-lead": "تم حل مشكلتك!",
359
- exit: "خروج",
360
- "create-new-ticket": "إنشاء تذكرة جديدة",
361
- "reset-conversation": "إعادة تعيين المحادثة",
362
- "welcome-title": "مرحبًا بك في دردشة الدعم الخاصة بنا",
363
- "welcome-description": "نحن هنا للمساعدة! ابدأ محادثة وسنرد عليك في أقرب وقت ممكن.",
364
- "your-name": "اسمك",
365
- "your-email": "عنوان بريدك الإلكتروني",
366
- "start-chat": "تحدث إلى الدعم",
367
- "starting-chat": "جاري الاتصال...",
368
- "hello-greeting": "مرحبًا! كيف يمكننا مساعدتك اليوم؟"
369
- }, zn = {
370
- ok: "OK",
371
- yes: "Ja",
372
- no: "Nein",
373
- agree: "Zustimmen",
374
- cancel: "Stornieren",
375
- "yes-exit": "Ja, beenden",
376
- "yes-reset": "Ja, zurücksetzen",
377
- "no-cancel": "Nein, abbrechen",
378
- "are-you-sure": "Sind Sie sicher?",
379
- recording: "Aufnahme läuft",
380
- "thank-you": "Vielen Dank",
381
- "sorry-try-again": "Entschuldigung, bitte versuchen Sie es erneut",
382
- "error-occurred": "Ein Fehler ist aufgetreten",
383
- "please-try-again": "Bitte versuchen Sie es erneut",
384
- "write-a-message": "Nachricht schreiben...",
385
- "send-message": "Nachricht senden",
386
- connected: "Verbunden",
387
- connecting: "Verbindung wird hergestellt",
388
- reconnecting: "Verbindung wird wiederhergestellt",
389
- reconnected: "Wieder verbunden",
390
- disconnecting: "Verbindung wird getrennt",
391
- disconnected: "Verbindung getrennt",
392
- error: "Fehler",
393
- "persist-session": "Sitzung beibehalten",
394
- settings: "Einstellungen",
395
- close: "Schließen",
396
- help: "Hilfe",
397
- chat: "Chat",
398
- send: "Senden",
399
- copy: "Kopieren",
400
- copied: "Kopiert",
401
- "sound-effects": "Soundeffekte",
402
- language: "Sprache",
403
- select: "Auswählen",
404
- agent: "Agent",
405
- user: "Benutzer",
406
- bot: "Bot",
407
- "got-any-questions": "Haben Sie Fragen? Chatten Sie mit uns!",
408
- "typical-response-time": "Üblicherweise antworten wir in weniger als 1 Minute",
409
- "reset-conversation-confirm": "Möchten Sie die Konversation wirklich zurücksetzen?",
410
- "close-widget": "Widget schließen",
411
- "session-closed-lead": "Ihr Problem wurde gelöst!",
412
- "create-new-ticket": "Neues Ticket erstellen",
413
- exit: "Beenden",
414
- "reset-conversation": "Konversation zurücksetzen",
415
- "welcome-title": "Willkommen in unserem Support-Chat",
416
- "welcome-description": "Wir sind hier, um zu helfen! Beginnen Sie ein Gespräch und wir werden so schnell wie möglich antworten.",
417
- "your-name": "Ihr Name",
418
- "your-email": "Ihre E-Mail-Adresse",
419
- "start-chat": "Mit dem Support sprechen",
420
- "starting-chat": "Verbindung wird hergestellt...",
421
- "hello-greeting": "Hallo! Wie können wir Ihnen heute helfen?"
422
- }, Yn = {
423
- ok: "OK",
424
- yes: "Yes",
425
- no: "No",
426
- agree: "Agree",
427
- cancel: "Cancel",
428
- "yes-exit": "Yes, exit",
429
- "yes-reset": "Yes, reset",
430
- "no-cancel": "No, cancel",
431
- "are-you-sure": "Are you sure?",
432
- recording: "Recording...",
433
- "thank-you": "Thank you",
434
- "sorry-try-again": "Sorry, please try again",
435
- "error-occurred": "An error occurred",
436
- "please-try-again": "Please try again",
437
- "write-a-message": "Write a message...",
438
- "send-message": "Send message",
439
- connected: "Connected",
440
- connecting: "Connecting",
441
- reconnecting: "Reconnecting",
442
- reconnected: "Reconnected",
443
- disconnecting: "Disconnecting",
444
- disconnected: "Disconnected",
445
- error: "Error",
446
- "persist-session": "Persist session",
447
- settings: "Settings",
448
- close: "Close",
449
- help: "Help",
450
- chat: "Chat",
451
- send: "Send",
452
- copy: "Copy",
453
- copied: "Copied",
454
- "sound-effects": "Sound effects",
455
- language: "Language",
456
- select: "Select",
457
- agent: "Agent",
458
- user: "User",
459
- bot: "Bot",
460
- "reset-conversation-confirm": "Are you sure you want to reset the conversation?",
461
- "close-widget": "Close widget",
462
- "got-any-questions": "Got any questions? Chat with us!",
463
- "typical-response-time": "Typically respond in less than 1 minute",
464
- "session-closed-lead": "Your issue has been resolved!",
465
- "create-new-ticket": "Create new ticket",
466
- exit: "Exit",
467
- "reset-conversation": "Reset conversation",
468
- "welcome-title": "Welcome to our support chat",
469
- "welcome-description": "We're here to help! Start a conversation and we'll get back to you as soon as possible.",
470
- "your-name": "Your name",
471
- "your-email": "Your email address",
472
- "start-chat": "Talk to support",
473
- "starting-chat": "Connecting...",
474
- "hello-greeting": "Hi there!"
475
- }, qn = {
476
- ok: "D'accord",
477
- yes: "Oui",
478
- no: "Non",
479
- agree: "Accepter",
480
- cancel: "Annuler",
481
- "yes-exit": "Oui, quitter",
482
- "yes-reset": "Oui, réinitialiser",
483
- "no-cancel": "Non, annuler",
484
- "are-you-sure": "Êtes-vous sûr ?",
485
- recording: "Enregistrement...",
486
- "thank-you": "Merci",
487
- "sorry-try-again": "Désolé, veuillez réessayer",
488
- "error-occurred": "Une erreur s'est produite",
489
- "please-try-again": "Veuillez réessayer",
490
- "write-a-message": "Écrivez un message...",
491
- "send-message": "Envoyer le message",
492
- connected: "Connecté",
493
- connecting: "Connexion en cours",
494
- reconnecting: "Reconnexion en cours",
495
- reconnected: "Reconnecté",
496
- disconnecting: "Déconnexion en cours",
497
- disconnected: "Déconnecté",
498
- error: "Erreur",
499
- "persist-session": "Conserver la session",
500
- settings: "Paramètres",
501
- close: "Fermer",
502
- help: "Aide",
503
- chat: "Chat",
504
- send: "Envoyer",
505
- copy: "Copier",
506
- copied: "Copié",
507
- "sound-effects": "Effets sonores",
508
- language: "Langue",
509
- select: "Sélectionner",
510
- agent: "Agent",
511
- user: "Utilisateur",
512
- bot: "Bot",
513
- "reset-conversation-confirm": "Êtes-vous sûr de vouloir réinitialiser la conversation ?",
514
- "close-widget": "Fermer le widget",
515
- "got-any-questions": "Vous avez des questions ? Chattez avec nous !",
516
- "typical-response-time": "Nous répondons généralement en moins d'une minute",
517
- "session-closed-lead": "Votre problème a été résolu !",
518
- "create-new-ticket": "Créer un nouveau ticket",
519
- exit: "Sortie",
520
- "reset-conversation": "Réinitialiser la conversation",
521
- "welcome-title": "Bienvenue dans notre chat de support",
522
- "welcome-description": "Nous sommes là pour vous aider ! Commencez une conversation et nous vous répondrons dès que possible.",
523
- "your-name": "Votre nom",
524
- "your-email": "Votre adresse e-mail",
525
- "start-chat": "Parler au support",
526
- "starting-chat": "Connexion...",
527
- "hello-greeting": "Bonjour ! Comment pouvons-nous vous aider aujourd'hui ?"
528
- }, Bn = {
529
- ok: "OK",
530
- yes: "Ja",
531
- no: "Nee",
532
- agree: "Akkoord",
533
- cancel: "Annuleren",
534
- "yes-exit": "Ja, afsluiten",
535
- "yes-reset": "Ja, resetten",
536
- "no-cancel": "Nee, annuleren",
537
- "are-you-sure": "Weet u het zeker?",
538
- recording: "Opname...",
539
- "thank-you": "Dank u",
540
- "sorry-try-again": "Sorry, probeer het opnieuw",
541
- "error-occurred": "Er is een fout opgetreden",
542
- "please-try-again": "Probeer het opnieuw",
543
- "write-a-message": "Schrijf een bericht...",
544
- "send-message": "Bericht verzenden",
545
- connected: "Verbonden",
546
- connecting: "Verbinding maken",
547
- reconnecting: "Opnieuw verbinding maken",
548
- reconnected: "Opnieuw verbonden",
549
- disconnecting: "Verbinding verbreken",
550
- disconnected: "Verbinding verbroken",
551
- error: "Fout",
552
- "persist-session": "Sessie behouden",
553
- settings: "Instellingen",
554
- close: "Sluiten",
555
- help: "Help",
556
- chat: "Chat",
557
- send: "Verzenden",
558
- copy: "Kopiëren",
559
- copied: "Gekopieerd",
560
- "sound-effects": "Geluidseffecten",
561
- language: "Taal",
562
- select: "Selecteren",
563
- agent: "Agent",
564
- user: "Gebruiker",
565
- bot: "Bot",
566
- "reset-conversation-confirm": "Weet u zeker dat u het gesprek wilt resetten?",
567
- "close-widget": "Widget sluiten",
568
- "got-any-questions": "Heeft u vragen? Chat met ons!",
569
- "typical-response-time": "We reageren doorgaans binnen 1 minuut",
570
- "session-closed-lead": "Uw probleem is opgelost!",
571
- "create-new-ticket": "Nieuw ticket aanmaken",
572
- exit: "Afsluiten",
573
- "reset-conversation": "Gesprek resetten",
574
- "welcome-title": "Welkom bij onze supportchat",
575
- "welcome-description": "We zijn hier om te helpen! Begin een gesprek en we nemen zo snel mogelijk contact met u op.",
576
- "your-name": "Uw naam",
577
- "your-email": "Uw e-mailadres",
578
- "start-chat": "Praat met ondersteuning",
579
- "starting-chat": "Verbinding maken...",
580
- "hello-greeting": "Hallo! Hoe kunnen we u vandaag helpen?"
581
- }, Xn = {
582
- ok: "OK",
583
- yes: "Sim",
584
- no: "Não",
585
- agree: "Concordo",
586
- cancel: "Cancelar",
587
- "yes-exit": "Sim, sair",
588
- "yes-reset": "Sim, redefinir",
589
- "no-cancel": "Não, cancelar",
590
- "are-you-sure": "Você tem certeza?",
591
- recording: "Gravando...",
592
- "thank-you": "Obrigado",
593
- "sorry-try-again": "Desculpe, tente novamente",
594
- "error-occurred": "Ocorreu um erro",
595
- "please-try-again": "Por favor, tente novamente",
596
- "write-a-message": "Escreva uma mensagem...",
597
- "send-message": "Enviar mensagem",
598
- connected: "Conectado",
599
- connecting: "Conectando",
600
- reconnecting: "Reconectando",
601
- reconnected: "Reconectado",
602
- disconnecting: "Desconectando",
603
- disconnected: "Desconectado",
604
- error: "Erro",
605
- "persist-session": "Persistir sessão",
606
- settings: "Configurações",
607
- close: "Fechar",
608
- help: "Ajuda",
609
- chat: "Bate-papo",
610
- send: "Enviar",
611
- copy: "Copiar",
612
- copied: "Copiado",
613
- "sound-effects": "Efeitos sonoros",
614
- language: "Idioma",
615
- select: "Selecionar",
616
- agent: "Agente",
617
- user: "Usuário",
618
- bot: "Bot",
619
- "reset-conversation-confirm": "Você tem certeza de que deseja redefinir a conversa?",
620
- "close-widget": "Fechar widget",
621
- "got-any-questions": "Tem alguma dúvida? Converse conosco!",
622
- "typical-response-time": "Geralmente respondemos em menos de 1 minuto",
623
- "session-closed-lead": "Seu problema foi resolvido!",
624
- "create-new-ticket": "Criar novo ticket",
625
- exit: "Sair",
626
- "reset-conversation": "Redefinir conversa",
627
- "welcome-title": "Bem-vindo ao nosso chat de suporte",
628
- "welcome-description": "Estamos aqui para ajudar! Inicie uma conversa e responderemos o mais rápido possível.",
629
- "your-name": "Seu nome",
630
- "your-email": "Seu endereço de email",
631
- "start-chat": "Falar com o suporte",
632
- "starting-chat": "Conectando...",
633
- "hello-greeting": "Olá! Como podemos ajudar você hoje?"
634
- }, Qn = {
635
- en: Yn,
636
- ar: Gn,
637
- nl: Bn,
638
- fr: qn,
639
- de: zn,
640
- pt: Xn
641
- };
642
- function Wn(e, t) {
643
- const n = Qn[t];
644
- return n && n[e] || "";
645
- }
646
- const [Es, Kn] = De();
647
- function bt({ children: e }) {
648
- const t = ce();
649
- return /* @__PURE__ */ $(
650
- Kn,
651
- {
652
- value: {
653
- get: (n, r) => Wn(n, t.language ?? "en") + (r ?? ""),
654
- lang: t.language
655
- },
656
- children: e
657
- }
658
- );
659
- }
660
- class Jn {
661
- constructor(t) {
662
- at(this, "components", [
663
- {
664
- key: "FALLBACK",
665
- component: (t) => "fallback"
666
- },
667
- {
668
- key: "LOADING",
669
- component: (t) => "loading"
670
- }
671
- ]);
672
- const { components: n } = t;
673
- if (n && n.forEach((r) => this.register(r)), this.components.length === 0)
674
- throw new Error("No components registered");
675
- if (!this.get("FALLBACK"))
676
- throw new Error("No fallback component registered");
677
- }
678
- register(t) {
679
- const n = this.components.findIndex((r) => r.key === t.key);
680
- return n !== -1 ? this.components[n] = t : this.components.push(t), this;
681
- }
682
- get(t) {
683
- const n = this.components.find(
684
- (r) => r.key.toUpperCase() === t.toUpperCase()
685
- );
686
- return n || null;
687
- }
688
- getOrFallback(t) {
689
- return t ? this.get(t) || this.get("FALLBACK") : this.get("FALLBACK");
690
- }
691
- getComponent(t, n) {
692
- var r;
693
- return n ? this.getOrFallback(t).component : (r = this.get(t)) == null ? void 0 : r.component;
694
- }
695
- }
696
- const Zn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABlCAYAAAC7vkbxAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAACd2SURBVHgB7X15lGZHdd+99b6vu2dfNNIghIgEYonELhkQIGDACB8WOUAsMBgbjA9yYiIHEjA2OO4Tzsk5JCeHBIEd2+AQUBJHAmFAQiBrQ4A2tDHDKEH7vs1oZnqme7q/5dXNrap7a3nf6+nu6ZmR/qD6vP7eV69evXp3+d2l6r0P4FflV+VXZf6C8DQuRGS+dt99Yx/7zuPrBp3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4PqciNjJN1jDRqyHjW98nKwBk9YtPcA/ZTwuZ3exHoPnfQAnPZwwkm8uxkR1YY2u3SAZhBycR7uWM9W0MmVcMsXvz9Se+eScD5hGBpQOVp5whRWGaT+64YNVeXPXMzgS9qEf2VLLVK1iMn78f4Si2yKv17V6eIeEBHFKb4mI396IPbxN86tUST5TtR2t2TVh7P3t9t1oau2XcVNsGg5mHXnXSit2TsKUGfGq0oa38f1JavN8hxQxDAAAAAElFTkSuQmCC", $n = {
697
- primaryColor: "hsl(0,0%,0%)",
698
- triggerOffset: "20px"
699
- };
700
- function er(e) {
701
- return ee(() => {
702
- var s, o, a, d;
703
- const t = {
704
- messageArrived: "https://cloud.opencopilot.so/sfx/notification3.mp3",
705
- ...e.soundEffectFiles
706
- }, n = Object.assign({}, $n, e.theme ?? {}), r = {
707
- id: "555",
708
- is_ai: !0,
709
- profile_picture: ((s = e.bot) == null ? void 0 : s.avatarUrl) || Zn,
710
- name: ((o = e.bot) == null ? void 0 : o.name) || "Bot"
711
- };
712
- return {
713
- ...e,
714
- bot: r,
715
- apiUrl: e.apiUrl ?? "https://api-v2.opencopilot.so/backend",
716
- socketUrl: e.socketUrl ?? "https://api-v2.opencopilot.so",
717
- language: e.language ?? nr,
718
- botToken: e.token,
719
- headers: e.headers ?? {},
720
- pathParams: e.pathParams ?? {},
721
- queryParams: e.queryParams ?? {},
722
- user: e.user ?? {},
723
- theme: n,
724
- soundEffectFiles: t,
725
- collectUserData: e.collectUserData ?? !1,
726
- defaultSettings: {
727
- persistSession: ((a = e.settings) == null ? void 0 : a.persistSession) ?? !1,
728
- useSoundEffects: ((d = e.settings) == null ? void 0 : d.useSoundEffects) ?? !1
729
- }
730
- };
731
- }, [e]);
732
- }
733
- const [ce, tr] = De(), nr = "en";
734
- function rr({
735
- children: e,
736
- data: t
737
- }) {
738
- const n = ee(
739
- () => new Jn({
740
- components: t.components
741
- }),
742
- [t]
743
- ), r = er(t), s = Et({
744
- apiUrl: r.apiUrl,
745
- botToken: r.token
746
- }), [o, a] = Je(
747
- "open_settings",
748
- r.defaultSettings,
749
- "local"
750
- );
751
- return /* @__PURE__ */ $(
752
- tr,
753
- {
754
- value: { ...r, http: s, componentStore: n, widgetSettings: o, setSettings: (g) => {
755
- const u = Object.assign(
756
- {},
757
- r.defaultSettings,
758
- o,
759
- g
760
- );
761
- a(u);
762
- } },
763
- children: /* @__PURE__ */ $(bt, { children: e })
764
- }
765
- );
766
- }
767
- var bs = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
768
- function ws(e) {
769
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
770
- }
771
- function sr(e) {
772
- if (e.__esModule) return e;
773
- var t = e.default;
774
- if (typeof t == "function") {
775
- var n = function r() {
776
- return this instanceof r ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
777
- };
778
- n.prototype = t.prototype;
779
- } else n = {};
780
- return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
781
- var s = Object.getOwnPropertyDescriptor(e, r);
782
- Object.defineProperty(n, r, s.get ? s : {
783
- enumerable: !0,
784
- get: function() {
785
- return e[r];
786
- }
787
- });
788
- }), n;
789
- }
790
- var wt = {}, Ge = function(e, t) {
791
- return Ge = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
792
- n.__proto__ = r;
793
- } || function(n, r) {
794
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
795
- }, Ge(e, t);
796
- };
797
- function Ot(e, t) {
798
- if (typeof t != "function" && t !== null)
799
- throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
800
- Ge(e, t);
801
- function n() {
802
- this.constructor = e;
803
- }
804
- e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
805
- }
806
- var Re = function() {
807
- return Re = Object.assign || function(t) {
808
- for (var n, r = 1, s = arguments.length; r < s; r++) {
809
- n = arguments[r];
810
- for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
811
- }
812
- return t;
813
- }, Re.apply(this, arguments);
814
- };
815
- function At(e, t) {
816
- var n = {};
817
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
818
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
819
- for (var s = 0, r = Object.getOwnPropertySymbols(e); s < r.length; s++)
820
- t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[s]) && (n[r[s]] = e[r[s]]);
821
- return n;
822
- }
823
- function _t(e, t, n, r) {
824
- var s = arguments.length, o = s < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, a;
825
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, n, r);
826
- else for (var d = e.length - 1; d >= 0; d--) (a = e[d]) && (o = (s < 3 ? a(o) : s > 3 ? a(t, n, o) : a(t, n)) || o);
827
- return s > 3 && o && Object.defineProperty(t, n, o), o;
828
- }
829
- function Rt(e, t) {
830
- return function(n, r) {
831
- t(n, r, e);
832
- };
833
- }
834
- function Tt(e, t, n, r, s, o) {
835
- function a(h) {
836
- if (h !== void 0 && typeof h != "function") throw new TypeError("Function expected");
837
- return h;
838
- }
839
- for (var d = r.kind, g = d === "getter" ? "get" : d === "setter" ? "set" : "value", u = !t && e ? r.static ? e : e.prototype : null, c = t || (u ? Object.getOwnPropertyDescriptor(u, r.name) : {}), i, m = !1, p = n.length - 1; p >= 0; p--) {
840
- var y = {};
841
- for (var f in r) y[f] = f === "access" ? {} : r[f];
842
- for (var f in r.access) y.access[f] = r.access[f];
843
- y.addInitializer = function(h) {
844
- if (m) throw new TypeError("Cannot add initializers after decoration has completed");
845
- o.push(a(h || null));
846
- };
847
- var v = (0, n[p])(d === "accessor" ? { get: c.get, set: c.set } : c[g], y);
848
- if (d === "accessor") {
849
- if (v === void 0) continue;
850
- if (v === null || typeof v != "object") throw new TypeError("Object expected");
851
- (i = a(v.get)) && (c.get = i), (i = a(v.set)) && (c.set = i), (i = a(v.init)) && s.unshift(i);
852
- } else (i = a(v)) && (d === "field" ? s.unshift(i) : c[g] = i);
853
- }
854
- u && Object.defineProperty(u, r.name, c), m = !0;
855
- }
856
- function Dt(e, t, n) {
857
- for (var r = arguments.length > 2, s = 0; s < t.length; s++)
858
- n = r ? t[s].call(e, n) : t[s].call(e);
859
- return r ? n : void 0;
860
- }
861
- function Nt(e) {
862
- return typeof e == "symbol" ? e : "".concat(e);
863
- }
864
- function Ct(e, t, n) {
865
- return typeof t == "symbol" && (t = t.description ? "[".concat(t.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: n ? "".concat(n, " ", t) : t });
866
- }
867
- function xt(e, t) {
868
- if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
869
- }
870
- function Pt(e, t, n, r) {
871
- function s(o) {
872
- return o instanceof n ? o : new n(function(a) {
873
- a(o);
874
- });
875
- }
876
- return new (n || (n = Promise))(function(o, a) {
877
- function d(c) {
878
- try {
879
- u(r.next(c));
880
- } catch (i) {
881
- a(i);
882
- }
883
- }
884
- function g(c) {
885
- try {
886
- u(r.throw(c));
887
- } catch (i) {
888
- a(i);
889
- }
890
- }
891
- function u(c) {
892
- c.done ? o(c.value) : s(c.value).then(d, g);
893
- }
894
- u((r = r.apply(e, t || [])).next());
895
- });
896
- }
897
- function It(e, t) {
898
- var n = { label: 0, sent: function() {
899
- if (o[0] & 1) throw o[1];
900
- return o[1];
901
- }, trys: [], ops: [] }, r, s, o, a = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
902
- return a.next = d(0), a.throw = d(1), a.return = d(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() {
903
- return this;
904
- }), a;
905
- function d(u) {
906
- return function(c) {
907
- return g([u, c]);
908
- };
909
- }
910
- function g(u) {
911
- if (r) throw new TypeError("Generator is already executing.");
912
- for (; a && (a = 0, u[0] && (n = 0)), n; ) try {
913
- if (r = 1, s && (o = u[0] & 2 ? s.return : u[0] ? s.throw || ((o = s.return) && o.call(s), 0) : s.next) && !(o = o.call(s, u[1])).done) return o;
914
- switch (s = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
915
- case 0:
916
- case 1:
917
- o = u;
918
- break;
919
- case 4:
920
- return n.label++, { value: u[1], done: !1 };
921
- case 5:
922
- n.label++, s = u[1], u = [0];
923
- continue;
924
- case 7:
925
- u = n.ops.pop(), n.trys.pop();
926
- continue;
927
- default:
928
- if (o = n.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
929
- n = 0;
930
- continue;
931
- }
932
- if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
933
- n.label = u[1];
934
- break;
935
- }
936
- if (u[0] === 6 && n.label < o[1]) {
937
- n.label = o[1], o = u;
938
- break;
939
- }
940
- if (o && n.label < o[2]) {
941
- n.label = o[2], n.ops.push(u);
942
- break;
943
- }
944
- o[2] && n.ops.pop(), n.trys.pop();
945
- continue;
946
- }
947
- u = t.call(e, n);
948
- } catch (c) {
949
- u = [6, c], s = 0;
950
- } finally {
951
- r = o = 0;
952
- }
953
- if (u[0] & 5) throw u[1];
954
- return { value: u[0] ? u[1] : void 0, done: !0 };
955
- }
956
- }
957
- var Ne = Object.create ? function(e, t, n, r) {
958
- r === void 0 && (r = n);
959
- var s = Object.getOwnPropertyDescriptor(t, n);
960
- (!s || ("get" in s ? !t.__esModule : s.writable || s.configurable)) && (s = { enumerable: !0, get: function() {
961
- return t[n];
962
- } }), Object.defineProperty(e, r, s);
963
- } : function(e, t, n, r) {
964
- r === void 0 && (r = n), e[r] = t[n];
965
- };
966
- function jt(e, t) {
967
- for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) && Ne(t, e, n);
968
- }
969
- function Te(e) {
970
- var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
971
- if (n) return n.call(e);
972
- if (e && typeof e.length == "number") return {
973
- next: function() {
974
- return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e };
975
- }
976
- };
977
- throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
978
- }
979
- function Ze(e, t) {
980
- var n = typeof Symbol == "function" && e[Symbol.iterator];
981
- if (!n) return e;
982
- var r = n.call(e), s, o = [], a;
983
- try {
984
- for (; (t === void 0 || t-- > 0) && !(s = r.next()).done; ) o.push(s.value);
985
- } catch (d) {
986
- a = { error: d };
987
- } finally {
988
- try {
989
- s && !s.done && (n = r.return) && n.call(r);
990
- } finally {
991
- if (a) throw a.error;
992
- }
993
- }
994
- return o;
995
- }
996
- function Lt() {
997
- for (var e = [], t = 0; t < arguments.length; t++)
998
- e = e.concat(Ze(arguments[t]));
999
- return e;
1000
- }
1001
- function kt() {
1002
- for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
1003
- for (var r = Array(e), s = 0, t = 0; t < n; t++)
1004
- for (var o = arguments[t], a = 0, d = o.length; a < d; a++, s++)
1005
- r[s] = o[a];
1006
- return r;
1007
- }
1008
- function Ft(e, t, n) {
1009
- if (n || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
1010
- (o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
1011
- return e.concat(o || Array.prototype.slice.call(t));
1012
- }
1013
- function me(e) {
1014
- return this instanceof me ? (this.v = e, this) : new me(e);
1015
- }
1016
- function Mt(e, t, n) {
1017
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1018
- var r = n.apply(e, t || []), s, o = [];
1019
- return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), d("next"), d("throw"), d("return", a), s[Symbol.asyncIterator] = function() {
1020
- return this;
1021
- }, s;
1022
- function a(p) {
1023
- return function(y) {
1024
- return Promise.resolve(y).then(p, i);
1025
- };
1026
- }
1027
- function d(p, y) {
1028
- r[p] && (s[p] = function(f) {
1029
- return new Promise(function(v, h) {
1030
- o.push([p, f, v, h]) > 1 || g(p, f);
1031
- });
1032
- }, y && (s[p] = y(s[p])));
1033
- }
1034
- function g(p, y) {
1035
- try {
1036
- u(r[p](y));
1037
- } catch (f) {
1038
- m(o[0][3], f);
1039
- }
1040
- }
1041
- function u(p) {
1042
- p.value instanceof me ? Promise.resolve(p.value.v).then(c, i) : m(o[0][2], p);
1043
- }
1044
- function c(p) {
1045
- g("next", p);
1046
- }
1047
- function i(p) {
1048
- g("throw", p);
1049
- }
1050
- function m(p, y) {
1051
- p(y), o.shift(), o.length && g(o[0][0], o[0][1]);
1052
- }
1053
- }
1054
- function Vt(e) {
1055
- var t, n;
1056
- return t = {}, r("next"), r("throw", function(s) {
1057
- throw s;
1058
- }), r("return"), t[Symbol.iterator] = function() {
1059
- return this;
1060
- }, t;
1061
- function r(s, o) {
1062
- t[s] = e[s] ? function(a) {
1063
- return (n = !n) ? { value: me(e[s](a)), done: !1 } : o ? o(a) : a;
1064
- } : o;
1065
- }
1066
- }
1067
- function Ut(e) {
1068
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1069
- var t = e[Symbol.asyncIterator], n;
1070
- return t ? t.call(e) : (e = typeof Te == "function" ? Te(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
1071
- return this;
1072
- }, n);
1073
- function r(o) {
1074
- n[o] = e[o] && function(a) {
1075
- return new Promise(function(d, g) {
1076
- a = e[o](a), s(d, g, a.done, a.value);
1077
- });
1078
- };
1079
- }
1080
- function s(o, a, d, g) {
1081
- Promise.resolve(g).then(function(u) {
1082
- o({ value: u, done: d });
1083
- }, a);
1084
- }
1085
- }
1086
- function Ht(e, t) {
1087
- return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
1088
- }
1089
- var or = Object.create ? function(e, t) {
1090
- Object.defineProperty(e, "default", { enumerable: !0, value: t });
1091
- } : function(e, t) {
1092
- e.default = t;
1093
- };
1094
- function Gt(e) {
1095
- if (e && e.__esModule) return e;
1096
- var t = {};
1097
- if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) && Ne(t, e, n);
1098
- return or(t, e), t;
1099
- }
1100
- function zt(e) {
1101
- return e && e.__esModule ? e : { default: e };
1102
- }
1103
- function Yt(e, t, n, r) {
1104
- if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
1105
- if (typeof t == "function" ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1106
- return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
1107
- }
1108
- function qt(e, t, n, r, s) {
1109
- if (r === "m") throw new TypeError("Private method is not writable");
1110
- if (r === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
1111
- if (typeof t == "function" ? e !== t || !s : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1112
- return r === "a" ? s.call(e, n) : s ? s.value = n : t.set(e, n), n;
1113
- }
1114
- function Bt(e, t) {
1115
- if (t === null || typeof t != "object" && typeof t != "function") throw new TypeError("Cannot use 'in' operator on non-object");
1116
- return typeof e == "function" ? t === e : e.has(t);
1117
- }
1118
- function Xt(e, t, n) {
1119
- if (t != null) {
1120
- if (typeof t != "object" && typeof t != "function") throw new TypeError("Object expected.");
1121
- var r, s;
1122
- if (n) {
1123
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
1124
- r = t[Symbol.asyncDispose];
1125
- }
1126
- if (r === void 0) {
1127
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
1128
- r = t[Symbol.dispose], n && (s = r);
1129
- }
1130
- if (typeof r != "function") throw new TypeError("Object not disposable.");
1131
- s && (r = function() {
1132
- try {
1133
- s.call(this);
1134
- } catch (o) {
1135
- return Promise.reject(o);
1136
- }
1137
- }), e.stack.push({ value: t, dispose: r, async: n });
1138
- } else n && e.stack.push({ async: !0 });
1139
- return t;
1140
- }
1141
- var ar = typeof SuppressedError == "function" ? SuppressedError : function(e, t, n) {
1142
- var r = new Error(n);
1143
- return r.name = "SuppressedError", r.error = e, r.suppressed = t, r;
1144
- };
1145
- function Qt(e) {
1146
- function t(o) {
1147
- e.error = e.hasError ? new ar(o, e.error, "An error was suppressed during disposal.") : o, e.hasError = !0;
1148
- }
1149
- var n, r = 0;
1150
- function s() {
1151
- for (; n = e.stack.pop(); )
1152
- try {
1153
- if (!n.async && r === 1) return r = 0, e.stack.push(n), Promise.resolve().then(s);
1154
- if (n.dispose) {
1155
- var o = n.dispose.call(n.value);
1156
- if (n.async) return r |= 2, Promise.resolve(o).then(s, function(a) {
1157
- return t(a), s();
1158
- });
1159
- } else r |= 1;
1160
- } catch (a) {
1161
- t(a);
1162
- }
1163
- if (r === 1) return e.hasError ? Promise.reject(e.error) : Promise.resolve();
1164
- if (e.hasError) throw e.error;
1165
- }
1166
- return s();
1167
- }
1168
- function Wt(e, t) {
1169
- return typeof e == "string" && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(n, r, s, o, a) {
1170
- return r ? t ? ".jsx" : ".js" : s && (!o || !a) ? n : s + o + "." + a.toLowerCase() + "js";
1171
- }) : e;
1172
- }
1173
- const ir = {
1174
- __extends: Ot,
1175
- __assign: Re,
1176
- __rest: At,
1177
- __decorate: _t,
1178
- __param: Rt,
1179
- __esDecorate: Tt,
1180
- __runInitializers: Dt,
1181
- __propKey: Nt,
1182
- __setFunctionName: Ct,
1183
- __metadata: xt,
1184
- __awaiter: Pt,
1185
- __generator: It,
1186
- __createBinding: Ne,
1187
- __exportStar: jt,
1188
- __values: Te,
1189
- __read: Ze,
1190
- __spread: Lt,
1191
- __spreadArrays: kt,
1192
- __spreadArray: Ft,
1193
- __await: me,
1194
- __asyncGenerator: Mt,
1195
- __asyncDelegator: Vt,
1196
- __asyncValues: Ut,
1197
- __makeTemplateObject: Ht,
1198
- __importStar: Gt,
1199
- __importDefault: zt,
1200
- __classPrivateFieldGet: Yt,
1201
- __classPrivateFieldSet: qt,
1202
- __classPrivateFieldIn: Bt,
1203
- __addDisposableResource: Xt,
1204
- __disposeResources: Qt,
1205
- __rewriteRelativeImportExtension: Wt
1206
- }, cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1207
- __proto__: null,
1208
- __addDisposableResource: Xt,
1209
- get __assign() {
1210
- return Re;
1211
- },
1212
- __asyncDelegator: Vt,
1213
- __asyncGenerator: Mt,
1214
- __asyncValues: Ut,
1215
- __await: me,
1216
- __awaiter: Pt,
1217
- __classPrivateFieldGet: Yt,
1218
- __classPrivateFieldIn: Bt,
1219
- __classPrivateFieldSet: qt,
1220
- __createBinding: Ne,
1221
- __decorate: _t,
1222
- __disposeResources: Qt,
1223
- __esDecorate: Tt,
1224
- __exportStar: jt,
1225
- __extends: Ot,
1226
- __generator: It,
1227
- __importDefault: zt,
1228
- __importStar: Gt,
1229
- __makeTemplateObject: Ht,
1230
- __metadata: xt,
1231
- __param: Rt,
1232
- __propKey: Nt,
1233
- __read: Ze,
1234
- __rest: At,
1235
- __rewriteRelativeImportExtension: Wt,
1236
- __runInitializers: Dt,
1237
- __setFunctionName: Ct,
1238
- __spread: Lt,
1239
- __spreadArray: Ft,
1240
- __spreadArrays: kt,
1241
- __values: Te,
1242
- default: ir
1243
- }, Symbol.toStringTag, { value: "Module" })), ur = /* @__PURE__ */ sr(cr);
1244
- var Oe = {}, ct;
1245
- function lr() {
1246
- if (ct) return Oe;
1247
- ct = 1, Object.defineProperty(Oe, "__esModule", { value: !0 });
1248
- var e = de;
1249
- function t() {
1250
- var n = e.useRef(!1), r = e.useCallback(function() {
1251
- return n.current;
1252
- }, []);
1253
- return e.useEffect(function() {
1254
- return n.current = !0, function() {
1255
- n.current = !1;
1256
- };
1257
- }, []), r;
1258
- }
1259
- return Oe.default = t, Oe;
1260
- }
1261
- Object.defineProperty(wt, "__esModule", { value: !0 });
1262
- var ze = ur, je = de, dr = ze.__importDefault(lr());
1263
- function fr(e, t, n) {
1264
- t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
1265
- var r = je.useRef(0), s = dr.default(), o = je.useState(n), a = o[0], d = o[1], g = je.useCallback(function() {
1266
- for (var u = [], c = 0; c < arguments.length; c++)
1267
- u[c] = arguments[c];
1268
- var i = ++r.current;
1269
- return a.loading || d(function(m) {
1270
- return ze.__assign(ze.__assign({}, m), { loading: !0 });
1271
- }), e.apply(void 0, u).then(function(m) {
1272
- return s() && i === r.current && d({ value: m, loading: !1 }), m;
1273
- }, function(m) {
1274
- return s() && i === r.current && d({ error: m, loading: !1 }), m;
1275
- });
1276
- }, t);
1277
- return [a, g];
1278
- }
1279
- var oe = wt.default = fr;
1280
- const pr = (e = 20) => {
1281
- const t = "abcdefghijklmnopqrstuvwxyz0123456789";
1282
- let n = "";
1283
- for (let r = 0; r < e; r++)
1284
- n += t[Math.floor(Math.random() * t.length)];
1285
- return n;
1286
- }, re = /* @__PURE__ */ new Map();
1287
- function Os() {
1288
- const [e, t] = Ke([]), { http: n } = ce();
1289
- function r(c) {
1290
- const i = c.map((m) => ({
1291
- file: m,
1292
- id: pr(10),
1293
- status: "pending",
1294
- progress: 0
1295
- }));
1296
- t((m) => [...m, ...i]), i.forEach(a);
1297
- }
1298
- function s(c, i) {
1299
- t(
1300
- (m) => m.map((p) => p.id === c ? { ...p, ...i } : p)
1301
- );
1302
- }
1303
- function o(c) {
1304
- t((i) => i.filter((m) => m.id !== c));
1305
- }
1306
- const a = async (c) => {
1307
- const i = new AbortController();
1308
- re.set(c.id, i);
1309
- try {
1310
- t(
1311
- (p) => p.map(
1312
- (y) => y.id === c.id ? { ...y, status: "uploading", progress: 0 } : y
1313
- )
1314
- );
1315
- const m = await n.apis.uploadFile(c, {
1316
- signal: i.signal,
1317
- onUploadProgress: (p) => {
1318
- if (!p.total) return;
1319
- const y = Math.round(
1320
- p.loaded * 100 / p.total
1321
- );
1322
- s(c.id, { progress: y });
1323
- }
1324
- });
1325
- s(c.id, {
1326
- status: "success",
1327
- fileUrl: m.data.fileUrl,
1328
- progress: 100
1329
- });
1330
- } catch (m) {
1331
- i.signal.aborted || s(c.id, {
1332
- status: "error",
1333
- error: m instanceof Error ? m.message : "Upload failed",
1334
- progress: 0
1335
- });
1336
- } finally {
1337
- re.delete(c.id);
1338
- }
1339
- }, d = (c) => {
1340
- const i = re.get(c);
1341
- i && (i.abort(), re.delete(c)), o(c);
1342
- }, g = ee(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
1343
- function u() {
1344
- re.forEach((c) => c.abort()), re.clear(), t([]);
1345
- }
1346
- return le(() => () => {
1347
- re.forEach((c) => c.abort()), re.clear();
1348
- }, []), {
1349
- allFiles: e,
1350
- appendFiles: r,
1351
- handleCancelUpload: d,
1352
- successFiles: g,
1353
- emptyTheFiles: u,
1354
- getFileById: (c) => e.find((i) => i.id === c),
1355
- getUploadProgress: (c) => {
1356
- var i;
1357
- return ((i = e.find((m) => m.id === c)) == null ? void 0 : i.progress) ?? 0;
1358
- },
1359
- getUploadStatus: (c) => {
1360
- var i;
1361
- return (i = e.find((m) => m.id === c)) == null ? void 0 : i.status;
1362
- },
1363
- hasErrors: e.some((c) => c.status === "error"),
1364
- isUploading: e.some((c) => c.status === "uploading")
1365
- };
1366
- }
1367
- var Ce = /* @__PURE__ */ ((e) => (e[e.OPEN = 0] = "OPEN", e[e.CLOSED_RESOLVED = 1] = "CLOSED_RESOLVED", e[e.CLOSED_UNRESOLVED = 2] = "CLOSED_UNRESOLVED", e))(Ce || {}), Kt = /* @__PURE__ */ ((e) => (e.WEB = "web", e.WEB_VOICE = "web_voice", e.PHONE_VOICE = "phone_voice", e.EMAIL = "email", e.SMS = "sms", e.WHATSAPP = "whatsapp", e.API = "api", e))(Kt || {}), $e = /* @__PURE__ */ ((e) => (e.resolved = "resolved", e.assumed_resolved = "assumed_resolved", e.handed_off = "handed_off", e))($e || {}), Jt = /* @__PURE__ */ ((e) => (e.happy = "happy", e.neutral = "neutral", e.angry = "angry", e))(Jt || {}), Zt = /* @__PURE__ */ ((e) => (e.MESSAGE = "message", e.HANDOFF = "handoff", e.HANDOFF_TO_ZENDESK = "handoff_to_zendesk", e.AGENT_MESSAGE = "agent_message", e.AGENT_JOINED = "agent_joined", e.AGENT_TOOK_SESSION_FROM_AI = "agent_took_session_from_ai", e.AI_DECIDED_TO_RESOLVE_THE_ISSUE = "ai_decided_to_resolve_the_issue", e.EMAIL_DRAFT_MESSAGE = "email_draft_message", e.FOLLOWUP = "followup", e))(Zt || {});
1368
- const gr = l.object({
1369
- id: l.string(),
1370
- ai_closure_type: l.nativeEnum($e).nullable(),
1371
- assignee_id: l.number().nullable(),
1372
- channel: l.nativeEnum(Kt),
1373
- summary: l.string().nullable(),
1374
- status: l.nativeEnum(Ce),
1375
- language: l.string().nullable(),
1376
- last_message: l.string().nullable(),
1377
- last_message_at: l.date().nullable(),
1378
- assignee: l.object({
1379
- name: l.string(),
1380
- email: l.string(),
1381
- avatar_url: l.string().optional()
1382
- }).nullable().optional(),
1383
- sentiment: l.nativeEnum(Jt).nullable()
1384
- });
1385
- l.object({
1386
- publicId: l.string().uuid(),
1387
- message: l.string().nullable(),
1388
- type: l.string().nullable(),
1389
- agent_avatar: l.string().nullable(),
1390
- agent_id: l.number().nullable(),
1391
- agent_name: l.string().nullable(),
1392
- created_at: l.string(),
1393
- from_user: l.boolean().nullable(),
1394
- handoff_happened_during_office_hours: l.boolean().nullable(),
1395
- session_id: l.string(),
1396
- updated_at: l.string().nullable(),
1397
- attachments: l.array(St).optional()
1398
- });
1399
- const mr = l.object({
1400
- name: l.string(),
1401
- is_ai: l.boolean(),
1402
- profile_picture: l.string().optional().nullable(),
1403
- id: l.string().nullable()
1404
- }), hr = l.object({
1405
- type: l.literal("message"),
1406
- value: l.string(),
1407
- attachments: l.array(St).optional(),
1408
- is_stream_chunk: l.boolean().optional(),
1409
- server_session_id: l.string(),
1410
- client_message_id: l.string().optional(),
1411
- server_message_id: l.string()
1412
- }), yr = l.object({
1413
- type: l.literal("info"),
1414
- value: l.string()
1415
- }), Sr = l.object({
1416
- type: l.literal("ui"),
1417
- value: l.object({
1418
- type: l.string(),
1419
- request_response: l.any(),
1420
- name: l.string(),
1421
- content: l.string(),
1422
- message_id: l.string().optional()
1423
- }),
1424
- client_message_id: l.string().optional(),
1425
- server_session_id: l.string()
1426
- }), vr = l.object({
1427
- type: l.literal("chat_event"),
1428
- value: l.object({
1429
- event: l.nativeEnum(Zt),
1430
- message: l.string()
1431
- })
1432
- }), Er = l.object({
1433
- type: l.literal("options"),
1434
- value: l.object({
1435
- options: l.array(l.string())
1436
- }),
1437
- server_session_id: l.string()
1438
- }), br = l.object({
1439
- type: l.literal("session_update"),
1440
- value: l.object({
1441
- session: gr
1442
- }),
1443
- server_session_id: l.string()
1444
- });
1445
- l.discriminatedUnion("type", [
1446
- hr,
1447
- yr,
1448
- Sr,
1449
- vr,
1450
- Er,
1451
- br
1452
- ]).and(
1453
- l.object({
1454
- timestamp: l.string(),
1455
- agent: mr
1456
- })
1457
- );
1458
- l.object({
1459
- id: l.string(),
1460
- name: l.string().nullable(),
1461
- created_at: l.string(),
1462
- avatar_url: l.string().nullable(),
1463
- email: l.string().nullable()
1464
- });
1465
- function ut(e) {
1466
- var n, r, s;
1467
- const t = [];
1468
- for (let o = 0; o < e.length; o++) {
1469
- const a = e[o];
1470
- if (a.from_user === !0)
1471
- a.message && a.message.length > 0 && t.push({
1472
- type: "FROM_USER",
1473
- content: a.message,
1474
- id: a.publicId,
1475
- deliveredAt: a.created_at || "",
1476
- attachments: a.attachments,
1477
- timestamp: a.created_at || ""
1478
- });
1479
- else
1480
- switch (a.type) {
1481
- case "message":
1482
- t.push({
1483
- type: "FROM_BOT",
1484
- component: "TEXT",
1485
- data: {
1486
- message: a.message ?? ""
1487
- },
1488
- id: a.publicId,
1489
- timestamp: a.created_at || "",
1490
- original: a,
1491
- attachments: a.attachments,
1492
- agent: {
1493
- id: ((n = a.agent_id) == null ? void 0 : n.toString()) ?? null,
1494
- is_ai: !0,
1495
- profile_picture: a.agent_avatar || "",
1496
- name: a.agent_name || ""
1497
- }
1498
- });
1499
- break;
1500
- case "agent_message":
1501
- t.push({
1502
- type: "FROM_AGENT",
1503
- component: "TEXT",
1504
- data: {
1505
- message: a.message ?? ""
1506
- },
1507
- id: a.publicId,
1508
- timestamp: a.created_at || "",
1509
- original: a,
1510
- attachments: a.attachments,
1511
- agent: {
1512
- id: ((r = a.agent_id) == null ? void 0 : r.toString()) ?? null,
1513
- is_ai: !1,
1514
- name: a.agent_name || "",
1515
- profile_picture: a.agent_avatar || ""
1516
- }
1517
- });
1518
- break;
1519
- default:
1520
- t.push({
1521
- type: "FROM_BOT",
1522
- component: "CHAT_EVENT",
1523
- data: {
1524
- event: a.type,
1525
- message: a.message ?? ""
1526
- },
1527
- id: a.publicId || ve(),
1528
- original: a,
1529
- attachments: a.attachments,
1530
- timestamp: a.created_at || "",
1531
- agent: {
1532
- is_ai: !0,
1533
- id: ((s = a.agent_id) == null ? void 0 : s.toString()) ?? null,
1534
- name: a.agent_name || "",
1535
- profile_picture: a.agent_avatar || ""
1536
- }
1537
- });
1538
- }
1539
- }
1540
- return t;
1541
- }
1542
- function wr(e) {
1543
- const t = se(null);
1544
- return le(() => {
1545
- if (!t.current) {
1546
- const n = new Audio(e.src);
1547
- n.volume = e.volume, n.loop = !1, n.preload = "auto", t.current = n;
1548
- }
1549
- return () => {
1550
- var n, r;
1551
- (n = t.current) == null || n.pause(), (r = t.current) == null || r.remove();
1552
- };
1553
- }, [e]), {
1554
- play: () => {
1555
- var n;
1556
- e.soundEnabled && ((n = t.current) == null || n.play());
1557
- },
1558
- stop: () => {
1559
- var n;
1560
- (n = t.current) == null || n.pause();
1561
- }
1562
- };
1563
- }
1564
- function Or() {
1565
- const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } = ce(), r = (t == null ? void 0 : t.useSoundEffects) ?? n.useSoundEffects;
1566
- return {
1567
- messageArrivedSound: wr({
1568
- src: e.messageArrived,
1569
- soundEnabled: r,
1570
- volume: 0.5
1571
- })
1572
- };
1573
- }
1574
- const Ar = 5e3;
1575
- function _r(e, t) {
1576
- return mn(e, (n) => {
1577
- const r = () => {
1578
- n.lastUpdated = Date.now();
1579
- };
1580
- switch (t.type) {
1581
- case "ADD_RESPONSE_MESSAGE": {
1582
- n.messages.push(t.payload), r();
1583
- break;
1584
- }
1585
- case "APPEND_USER_MESSAGE": {
1586
- n.messages.push(t.payload), r();
1587
- break;
1588
- }
1589
- case "RESET": {
1590
- n.messages = [], n.lastUpdated = null, n.keyboard = null;
1591
- break;
1592
- }
1593
- case "PREPEND_HISTORY": {
1594
- const s = t.payload.map((o) => o.id);
1595
- n.messages = n.messages.filter(
1596
- (o) => !s.includes(o.id)
1597
- ), n.messages = [...t.payload, ...n.messages], r();
1598
- break;
1599
- }
1600
- case "SET_KEYBOARD": {
1601
- n.keyboard = t.payload;
1602
- break;
1603
- }
1604
- case "SET_DELIVERED_AT": {
1605
- const s = n.messages.find((o) => {
1606
- var a;
1607
- if (o.type === "FROM_USER" && o.id === ((a = t.payload) == null ? void 0 : a.clientMessageId))
1608
- return !0;
1609
- });
1610
- (s == null ? void 0 : s.type) === "FROM_USER" && hn(s, "deliveredAt", t.payload.deliveredAt);
1611
- break;
1612
- }
1613
- case "SET_MESSAGES": {
1614
- n.messages = t.payload;
1615
- break;
1616
- }
1617
- case "APPEND_MESSAGES": {
1618
- const s = t.payload.filter((o) => !n.messages.some((a) => a.id === o.id));
1619
- n.messages.push(...s);
1620
- break;
1621
- }
1622
- }
1623
- });
1624
- }
1625
- function Rr({
1626
- persist: e,
1627
- sessionKey: t = (n, { external_id: r }) => `[OPEN_SESSION_${n}]_${r || "session"}`
1628
- }) {
1629
- const { botToken: n, http: r, user: s } = ce(), [o, a, d] = Je(
1630
- t(n, s),
1631
- void 0,
1632
- e ? "local" : "memory"
1633
- ), g = (f) => ({
1634
- ...f,
1635
- isSessionClosed: f.status !== Ce.OPEN,
1636
- isAssignedToAi: f.assignee_id === 555,
1637
- isAssignedToHuman: f.assignee_id !== 555,
1638
- isPendingHuman: f.assignee_id === 555 && f.ai_closure_type === $e.handed_off
1639
- }), u = ee(() => o ? g(o) : null, [o]), [c, i] = oe(
1640
- async (f) => {
1641
- let v = await r.apis.fetchSession(f);
1642
- return v.data && a(v.data), v.data;
1643
- },
1644
- [r, a]
1645
- ), [m, p] = oe(
1646
- async (f) => {
1647
- try {
1648
- const v = await i(f);
1649
- return v ? g(v) : null;
1650
- } catch (v) {
1651
- throw console.error("Error polling session:", v), v;
1652
- }
1653
- },
1654
- [i, g]
1655
- );
1656
- function y() {
1657
- a(null), d();
1658
- }
1659
- return {
1660
- session: u,
1661
- refreshSession: i,
1662
- refreshSessionState: c,
1663
- deleteSession: y,
1664
- setSession: a,
1665
- transformSession: g,
1666
- pollSession: p
1667
- };
1668
- }
1669
- function Tr({ onSessionDestroy: e }) {
1670
- const [t, n] = fn(_r, {
1671
- lastUpdated: null,
1672
- messages: [],
1673
- keyboard: null
1674
- }), [r, s] = Ke({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: d, widgetSettings: g, defaultSettings: u, language: c, ...i } = ce(), { messageArrivedSound: m } = Or(), p = (g == null ? void 0 : g.persistSession) || u.persistSession, { refreshSession: y, session: f, deleteSession: v, setSession: h, pollSession: q } = Rr({
1675
- persist: p
1676
- }), [D, S] = oe(
1677
- async (_) => {
1678
- if (!f) return [];
1679
- try {
1680
- const { data: N } = await d.apis.fetchHistory(_);
1681
- return N ? Array.isArray(N) ? ut(N) : [] : [];
1682
- } catch (N) {
1683
- throw console.error("Error fetching history:", N), N;
1684
- }
1685
- },
1686
- [f, d.apis]
1687
- ), [O, E] = oe(
1688
- async (_, N) => {
1689
- try {
1690
- const M = await d.apis.getHistoryPooling({
1691
- sessionId: _,
1692
- lastMessageTimestamp: N
1693
- });
1694
- if (M.data) {
1695
- const H = ut(M.data);
1696
- if (H.length > 0) {
1697
- n({
1698
- type: "APPEND_MESSAGES",
1699
- payload: H
1700
- });
1701
- try {
1702
- m.play();
1703
- } catch (ue) {
1704
- console.error("Error playing sound:", ue);
1705
- }
1706
- }
1707
- return H;
1708
- }
1709
- return [];
1710
- } catch (M) {
1711
- throw console.error("Error polling messages:", M), M;
1712
- }
1713
- },
1714
- [d.apis, n, m]
1715
- );
1716
- le(() => {
1717
- let _;
1718
- return f && (_ = setInterval(() => {
1719
- var M;
1720
- q(f.id);
1721
- const N = (M = t.messages.at(-1)) == null ? void 0 : M.timestamp;
1722
- N && E(f.id, N);
1723
- }, Ar)), () => {
1724
- clearInterval(_);
1725
- };
1726
- }, [f, q, E]);
1727
- const [F, A] = oe(
1728
- async () => {
1729
- if (f)
1730
- try {
1731
- const _ = await y(f.id);
1732
- if (_) {
1733
- const N = await S(_.id);
1734
- N && n({ type: "PREPEND_HISTORY", payload: N });
1735
- }
1736
- } catch (_) {
1737
- throw console.error("Error initializing session:", _), _;
1738
- }
1739
- },
1740
- [f, y, S, n]
1741
- );
1742
- le(() => {
1743
- A();
1744
- }, []);
1745
- const [x, P] = oe(
1746
- async () => {
1747
- try {
1748
- v(), n({ type: "RESET" }), e == null || e(), s({ state: "idle" });
1749
- } catch (_) {
1750
- throw console.error("Error clearing session:", _), _;
1751
- }
1752
- },
1753
- [v, n, e, s]
1754
- ), [B, W] = oe(
1755
- async () => {
1756
- try {
1757
- await P();
1758
- const { data: _ } = await d.apis.createSession(a);
1759
- return h(_), _;
1760
- } catch (_) {
1761
- throw console.error("Error recreating session:", _), _;
1762
- }
1763
- },
1764
- [P, d.apis, a, h]
1765
- ), L = async ({ content: _, user: N, attachments: M, ...H }) => {
1766
- var ue;
1767
- try {
1768
- let U = f, G = !1;
1769
- if ((!f || f != null && f.isAssignedToAi) && s({ state: "loading" }), !f && o)
1770
- try {
1771
- const { data: w } = await d.apis.createSession(a);
1772
- if (w)
1773
- h(w), U = {
1774
- ...w,
1775
- isSessionClosed: w.status !== Ce.OPEN,
1776
- isAssignedToAi: w.assignee_id === 555,
1777
- isAssignedToHuman: !1,
1778
- isPendingHuman: !1
1779
- }, G = !0;
1780
- else
1781
- throw new Error("Failed to create new chat session");
1782
- } catch (w) {
1783
- throw s({
1784
- state: "error",
1785
- error: w instanceof Error ? w.message : "Failed to create session"
1786
- }), w;
1787
- }
1788
- if (!U) {
1789
- const w = new Error("No active session available");
1790
- throw s({ state: "error", error: w.message }), w;
1791
- }
1792
- const Y = ve(), { headers: fe, queryParams: we } = i;
1793
- if (n({
1794
- type: "APPEND_USER_MESSAGE",
1795
- payload: {
1796
- type: "FROM_USER",
1797
- id: Y,
1798
- content: _.text,
1799
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1800
- user: {
1801
- ...i.user,
1802
- ...N
1803
- },
1804
- deliveredAt: null,
1805
- attachments: M
1806
- }
1807
- }), t.keyboard && n({
1808
- type: "SET_KEYBOARD",
1809
- payload: null
1810
- }), !G && U.isAssignedToAi)
1811
- try {
1812
- const w = await q(U.id);
1813
- w && (U = w);
1814
- } catch (w) {
1815
- console.error("Error polling session:", w);
1816
- }
1817
- const ne = await d.apis.sendMessage({
1818
- id: Y,
1819
- content: _.text,
1820
- session_id: U.id,
1821
- bot_token: a,
1822
- headers: fe,
1823
- query_params: we,
1824
- user: {
1825
- ...i.user,
1826
- ...N
1827
- },
1828
- language: c,
1829
- attachments: M,
1830
- ...H
1831
- });
1832
- if (n({
1833
- type: "SET_DELIVERED_AT",
1834
- payload: {
1835
- clientMessageId: Y,
1836
- deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
1837
- }
1838
- }), ne.data.success) {
1839
- const w = ne.data;
1840
- if (w.autopilotResponse && n({
1841
- type: "ADD_RESPONSE_MESSAGE",
1842
- payload: {
1843
- type: "FROM_BOT",
1844
- id: w.autopilotResponse.id || ve(),
1845
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1846
- component: "TEXT",
1847
- data: {
1848
- message: w.autopilotResponse.value.content
1849
- }
1850
- }
1851
- }), w.uiResponse) {
1852
- const he = w.uiResponse.value;
1853
- n({
1854
- type: "ADD_RESPONSE_MESSAGE",
1855
- payload: {
1856
- type: "FROM_BOT",
1857
- id: ve(),
1858
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1859
- component: he.name,
1860
- data: he.request_response
1861
- }
1862
- });
1863
- }
1864
- } else {
1865
- const w = ((ue = ne.data.error) == null ? void 0 : ue.message) || "Unknown error occurred";
1866
- n({
1867
- type: "ADD_RESPONSE_MESSAGE",
1868
- payload: {
1869
- type: "FROM_BOT",
1870
- id: ve(),
1871
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1872
- component: "TEXT",
1873
- data: {
1874
- message: w,
1875
- variant: "error"
1876
- }
1877
- }
1878
- }), s({ state: "error", error: w });
1879
- }
1880
- return s({ state: "idle" }), { id: Y };
1881
- } catch (U) {
1882
- const G = U instanceof Error ? U.message : "An unexpected error occurred";
1883
- throw console.error("Error in sendMessage:", G, U), (!f || f != null && f.isAssignedToAi) && s({ state: "error", error: G }), U;
1884
- }
1885
- }, te = ge(
1886
- (_) => {
1887
- L({
1888
- content: {
1889
- text: _
1890
- }
1891
- }).catch((N) => {
1892
- console.error("Error handling keyboard input:", N);
1893
- }), n({
1894
- type: "SET_KEYBOARD",
1895
- payload: null
1896
- });
1897
- },
1898
- [n, L]
1899
- );
1900
- return {
1901
- version: Vn.version,
1902
- state: t,
1903
- session: f,
1904
- noMessages: o,
1905
- initState: F,
1906
- clearSessionState: x,
1907
- recreateSessionState: B,
1908
- hookState: r,
1909
- recreateSession: W,
1910
- clearSession: P,
1911
- sendMessage: L,
1912
- handleKeyboard: te
1913
- };
1914
- }
1915
- const [As, Dr] = De();
1916
- function Nr({
1917
- children: e
1918
- }) {
1919
- const { settings: t } = ce(), n = Tr({
1920
- defaultHookSettings: {
1921
- persistSession: (t == null ? void 0 : t.persistSession) ?? !0,
1922
- useSoundEffects: (t == null ? void 0 : t.useSoundEffects) ?? !1
1923
- }
1924
- });
1925
- return /* @__PURE__ */ $(Dr, { value: n, children: e });
1926
- }
1927
- function Cr() {
1928
- const { http: e, botToken: t, user: n, collectUserData: r } = ce(), [s, o] = Je(
1929
- `${t}:contact:${n.external_id}`,
1930
- null,
1931
- "local"
1932
- ), [a, d] = oe(
1933
- async (u) => {
1934
- var c;
1935
- try {
1936
- if (!u || !u.email) return null;
1937
- const i = await e.apis.dumpContact(u);
1938
- return (c = i == null ? void 0 : i.data) != null && c.id && o(i.data), i == null ? void 0 : i.data;
1939
- } catch (i) {
1940
- console.error(i);
1941
- }
1942
- return null;
1943
- },
1944
- [e.apis]
1945
- );
1946
- le(() => {
1947
- n && t && d(n);
1948
- }, [n, t]);
1949
- const g = ee(() => !(s != null && s.id) && r ? {
1950
- should: !0,
1951
- reason: "No contact id and collectUserData is true"
1952
- } : {
1953
- should: !1
1954
- }, [s]);
1955
- return {
1956
- creatingContactState: a,
1957
- createContactAsync: d,
1958
- contact: s,
1959
- shouldCollectData: g
1960
- };
1961
- }
1962
- const [_s, xr] = De();
1963
- function Pr({ children: e }) {
1964
- const t = Cr();
1965
- return /* @__PURE__ */ $(xr, { value: t, children: e });
1966
- }
1967
- function Rs({
1968
- children: e,
1969
- options: t
1970
- }) {
1971
- return /* @__PURE__ */ $(rr, { data: t, children: /* @__PURE__ */ $(Pr, { children: /* @__PURE__ */ $(bt, { children: /* @__PURE__ */ $(Nr, { children: e }) }) }) });
1972
- }
1973
- var Ye = { exports: {} }, Le = {};
1974
- /**
1975
- * @license React
1976
- * use-sync-external-store-shim.production.min.js
1977
- *
1978
- * Copyright (c) Facebook, Inc. and its affiliates.
1979
- *
1980
- * This source code is licensed under the MIT license found in the
1981
- * LICENSE file in the root directory of this source tree.
1982
- */
1983
- var lt;
1984
- function Ir() {
1985
- if (lt) return Le;
1986
- lt = 1;
1987
- var e = de;
1988
- function t(i, m) {
1989
- return i === m && (i !== 0 || 1 / i === 1 / m) || i !== i && m !== m;
1990
- }
1991
- var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, s = e.useEffect, o = e.useLayoutEffect, a = e.useDebugValue;
1992
- function d(i, m) {
1993
- var p = m(), y = r({ inst: { value: p, getSnapshot: m } }), f = y[0].inst, v = y[1];
1994
- return o(function() {
1995
- f.value = p, f.getSnapshot = m, g(f) && v({ inst: f });
1996
- }, [i, p, m]), s(function() {
1997
- return g(f) && v({ inst: f }), i(function() {
1998
- g(f) && v({ inst: f });
1999
- });
2000
- }, [i]), a(p), p;
2001
- }
2002
- function g(i) {
2003
- var m = i.getSnapshot;
2004
- i = i.value;
2005
- try {
2006
- var p = m();
2007
- return !n(i, p);
2008
- } catch {
2009
- return !0;
2010
- }
2011
- }
2012
- function u(i, m) {
2013
- return m();
2014
- }
2015
- var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : d;
2016
- return Le.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : c, Le;
2017
- }
2018
- var ke = {};
2019
- /**
2020
- * @license React
2021
- * use-sync-external-store-shim.development.js
2022
- *
2023
- * Copyright (c) Facebook, Inc. and its affiliates.
2024
- *
2025
- * This source code is licensed under the MIT license found in the
2026
- * LICENSE file in the root directory of this source tree.
2027
- */
2028
- var dt;
2029
- function jr() {
2030
- return dt || (dt = 1, process.env.NODE_ENV !== "production" && function() {
2031
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2032
- var e = de, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2033
- function n(D) {
2034
- {
2035
- for (var S = arguments.length, O = new Array(S > 1 ? S - 1 : 0), E = 1; E < S; E++)
2036
- O[E - 1] = arguments[E];
2037
- r("error", D, O);
2038
- }
2039
- }
2040
- function r(D, S, O) {
2041
- {
2042
- var E = t.ReactDebugCurrentFrame, F = E.getStackAddendum();
2043
- F !== "" && (S += "%s", O = O.concat([F]));
2044
- var A = O.map(function(x) {
2045
- return String(x);
2046
- });
2047
- A.unshift("Warning: " + S), Function.prototype.apply.call(console[D], console, A);
2048
- }
2049
- }
2050
- function s(D, S) {
2051
- return D === S && (D !== 0 || 1 / D === 1 / S) || D !== D && S !== S;
2052
- }
2053
- var o = typeof Object.is == "function" ? Object.is : s, a = e.useState, d = e.useEffect, g = e.useLayoutEffect, u = e.useDebugValue, c = !1, i = !1;
2054
- function m(D, S, O) {
2055
- c || e.startTransition !== void 0 && (c = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
2056
- var E = S();
2057
- if (!i) {
2058
- var F = S();
2059
- o(E, F) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), i = !0);
2060
- }
2061
- var A = a({
2062
- inst: {
2063
- value: E,
2064
- getSnapshot: S
2065
- }
2066
- }), x = A[0].inst, P = A[1];
2067
- return g(function() {
2068
- x.value = E, x.getSnapshot = S, p(x) && P({
2069
- inst: x
2070
- });
2071
- }, [D, E, S]), d(function() {
2072
- p(x) && P({
2073
- inst: x
2074
- });
2075
- var B = function() {
2076
- p(x) && P({
2077
- inst: x
2078
- });
2079
- };
2080
- return D(B);
2081
- }, [D]), u(E), E;
2082
- }
2083
- function p(D) {
2084
- var S = D.getSnapshot, O = D.value;
2085
- try {
2086
- var E = S();
2087
- return !o(O, E);
2088
- } catch {
2089
- return !0;
2090
- }
2091
- }
2092
- function y(D, S, O) {
2093
- return S();
2094
- }
2095
- var f = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !f, h = v ? y : m, q = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h;
2096
- ke.useSyncExternalStore = q, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2097
- }()), ke;
2098
- }
2099
- process.env.NODE_ENV === "production" ? Ye.exports = Ir() : Ye.exports = jr();
2100
- var Lr = Ye.exports;
2101
- const ae = () => {
2102
- }, V = (
2103
- /*#__NOINLINE__*/
2104
- ae()
2105
- ), Fe = Object, b = (e) => e === V, Q = (e) => typeof e == "function", ie = (e, t) => ({
2106
- ...e,
2107
- ...t
2108
- }), kr = (e) => Q(e.then), Ae = /* @__PURE__ */ new WeakMap();
2109
- let Fr = 0;
2110
- const Ee = (e) => {
2111
- const t = typeof e, n = e && e.constructor, r = n == Date;
2112
- let s, o;
2113
- if (Fe(e) === e && !r && n != RegExp) {
2114
- if (s = Ae.get(e), s) return s;
2115
- if (s = ++Fr + "~", Ae.set(e, s), n == Array) {
2116
- for (s = "@", o = 0; o < e.length; o++)
2117
- s += Ee(e[o]) + ",";
2118
- Ae.set(e, s);
2119
- }
2120
- if (n == Fe) {
2121
- s = "#";
2122
- const a = Fe.keys(e).sort();
2123
- for (; !b(o = a.pop()); )
2124
- b(e[o]) || (s += o + ":" + Ee(e[o]) + ",");
2125
- Ae.set(e, s);
2126
- }
2127
- } else
2128
- s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
2129
- return s;
2130
- }, Z = /* @__PURE__ */ new WeakMap(), Me = {}, _e = {}, et = "undefined", xe = typeof window != et, qe = typeof document != et, Mr = () => xe && typeof window.requestAnimationFrame != et, $t = (e, t) => {
2131
- const n = Z.get(e);
2132
- return [
2133
- // Getter
2134
- () => !b(t) && e.get(t) || Me,
2135
- // Setter
2136
- (r) => {
2137
- if (!b(t)) {
2138
- const s = e.get(t);
2139
- t in _e || (_e[t] = s), n[5](t, ie(s, r), s || Me);
2140
- }
2141
- },
2142
- // Subscriber
2143
- n[6],
2144
- // Get server cache snapshot
2145
- () => !b(t) && t in _e ? _e[t] : !b(t) && e.get(t) || Me
2146
- ];
2147
- };
2148
- let Be = !0;
2149
- const Vr = () => Be, [Xe, Qe] = xe && window.addEventListener ? [
2150
- window.addEventListener.bind(window),
2151
- window.removeEventListener.bind(window)
2152
- ] : [
2153
- ae,
2154
- ae
2155
- ], Ur = () => {
2156
- const e = qe && document.visibilityState;
2157
- return b(e) || e !== "hidden";
2158
- }, Hr = (e) => (qe && document.addEventListener("visibilitychange", e), Xe("focus", e), () => {
2159
- qe && document.removeEventListener("visibilitychange", e), Qe("focus", e);
2160
- }), Gr = (e) => {
2161
- const t = () => {
2162
- Be = !0, e();
2163
- }, n = () => {
2164
- Be = !1;
2165
- };
2166
- return Xe("online", t), Xe("offline", n), () => {
2167
- Qe("online", t), Qe("offline", n);
2168
- };
2169
- }, zr = {
2170
- isOnline: Vr,
2171
- isVisible: Ur
2172
- }, Yr = {
2173
- initFocus: Hr,
2174
- initReconnect: Gr
2175
- }, ft = !de.useId, be = !xe || "Deno" in window, qr = (e) => Mr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ve = be ? le : pn, Ue = typeof navigator < "u" && navigator.connection, pt = !be && Ue && ([
2176
- "slow-2g",
2177
- "2g"
2178
- ].includes(Ue.effectiveType) || Ue.saveData), tt = (e) => {
2179
- if (Q(e))
2180
- try {
2181
- e = e();
2182
- } catch {
2183
- e = "";
2184
- }
2185
- const t = e;
2186
- return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? Ee(e) : "", [
2187
- e,
2188
- t
2189
- ];
2190
- };
2191
- let Br = 0;
2192
- const We = () => ++Br, en = 0, tn = 1, nn = 2, Xr = 3;
2193
- var Se = {
2194
- __proto__: null,
2195
- ERROR_REVALIDATE_EVENT: Xr,
2196
- FOCUS_EVENT: en,
2197
- MUTATE_EVENT: nn,
2198
- RECONNECT_EVENT: tn
2199
- };
2200
- async function rn(...e) {
2201
- const [t, n, r, s] = e, o = ie({
2202
- populateCache: !0,
2203
- throwOnError: !0
2204
- }, typeof s == "boolean" ? {
2205
- revalidate: s
2206
- } : s || {});
2207
- let a = o.populateCache;
2208
- const d = o.rollbackOnError;
2209
- let g = o.optimisticData;
2210
- const u = (m) => typeof d == "function" ? d(m) : d !== !1, c = o.throwOnError;
2211
- if (Q(n)) {
2212
- const m = n, p = [], y = t.keys();
2213
- for (const f of y)
2214
- // Skip the special useSWRInfinite and useSWRSubscription keys.
2215
- !/^\$(inf|sub)\$/.test(f) && m(t.get(f)._k) && p.push(f);
2216
- return Promise.all(p.map(i));
2217
- }
2218
- return i(n);
2219
- async function i(m) {
2220
- const [p] = tt(m);
2221
- if (!p) return;
2222
- const [y, f] = $t(t, p), [v, h, q, D] = Z.get(t), S = () => {
2223
- const L = v[p];
2224
- return (Q(o.revalidate) ? o.revalidate(y().data, m) : o.revalidate !== !1) && (delete q[p], delete D[p], L && L[0]) ? L[0](nn).then(() => y().data) : y().data;
2225
- };
2226
- if (e.length < 3)
2227
- return S();
2228
- let O = r, E;
2229
- const F = We();
2230
- h[p] = [
2231
- F,
2232
- 0
2233
- ];
2234
- const A = !b(g), x = y(), P = x.data, B = x._c, W = b(B) ? P : B;
2235
- if (A && (g = Q(g) ? g(W, P) : g, f({
2236
- data: g,
2237
- _c: W
2238
- })), Q(O))
2239
- try {
2240
- O = O(W);
2241
- } catch (L) {
2242
- E = L;
2243
- }
2244
- if (O && kr(O))
2245
- if (O = await O.catch((L) => {
2246
- E = L;
2247
- }), F !== h[p][0]) {
2248
- if (E) throw E;
2249
- return O;
2250
- } else E && A && u(E) && (a = !0, f({
2251
- data: W,
2252
- _c: V
2253
- }));
2254
- if (a && !E)
2255
- if (Q(a)) {
2256
- const L = a(O, W);
2257
- f({
2258
- data: L,
2259
- error: V,
2260
- _c: V
2261
- });
2262
- } else
2263
- f({
2264
- data: O,
2265
- error: V,
2266
- _c: V
2267
- });
2268
- if (h[p][1] = We(), Promise.resolve(S()).then(() => {
2269
- f({
2270
- _c: V
2271
- });
2272
- }), E) {
2273
- if (c) throw E;
2274
- return;
2275
- }
2276
- return O;
2277
- }
2278
- }
2279
- const gt = (e, t) => {
2280
- for (const n in e)
2281
- e[n][0] && e[n][0](t);
2282
- }, Qr = (e, t) => {
2283
- if (!Z.has(e)) {
2284
- const n = ie(Yr, t), r = {}, s = rn.bind(V, e);
2285
- let o = ae;
2286
- const a = {}, d = (c, i) => {
2287
- const m = a[c] || [];
2288
- return a[c] = m, m.push(i), () => m.splice(m.indexOf(i), 1);
2289
- }, g = (c, i, m) => {
2290
- e.set(c, i);
2291
- const p = a[c];
2292
- if (p)
2293
- for (const y of p)
2294
- y(i, m);
2295
- }, u = () => {
2296
- if (!Z.has(e) && (Z.set(e, [
2297
- r,
2298
- {},
2299
- {},
2300
- {},
2301
- s,
2302
- g,
2303
- d
2304
- ]), !be)) {
2305
- const c = n.initFocus(setTimeout.bind(V, gt.bind(V, r, en))), i = n.initReconnect(setTimeout.bind(V, gt.bind(V, r, tn)));
2306
- o = () => {
2307
- c && c(), i && i(), Z.delete(e);
2308
- };
2309
- }
2310
- };
2311
- return u(), [
2312
- e,
2313
- s,
2314
- u,
2315
- o
2316
- ];
2317
- }
2318
- return [
2319
- e,
2320
- Z.get(e)[4]
2321
- ];
2322
- }, Wr = (e, t, n, r, s) => {
2323
- const o = n.errorRetryCount, a = s.retryCount, d = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
2324
- !b(o) && a > o || setTimeout(r, d, s);
2325
- }, Kr = (e, t) => Ee(e) == Ee(t), [sn, Jr] = Qr(/* @__PURE__ */ new Map()), Zr = ie(
2326
- {
2327
- // events
2328
- onLoadingSlow: ae,
2329
- onSuccess: ae,
2330
- onError: ae,
2331
- onErrorRetry: Wr,
2332
- onDiscarded: ae,
2333
- // switches
2334
- revalidateOnFocus: !0,
2335
- revalidateOnReconnect: !0,
2336
- revalidateIfStale: !0,
2337
- shouldRetryOnError: !0,
2338
- // timeouts
2339
- errorRetryInterval: pt ? 1e4 : 5e3,
2340
- focusThrottleInterval: 5 * 1e3,
2341
- dedupingInterval: 2 * 1e3,
2342
- loadingTimeout: pt ? 5e3 : 3e3,
2343
- // providers
2344
- compare: Kr,
2345
- isPaused: () => !1,
2346
- cache: sn,
2347
- mutate: Jr,
2348
- fallback: {}
2349
- },
2350
- // use web preset by default
2351
- zr
2352
- ), $r = (e, t) => {
2353
- const n = ie(e, t);
2354
- if (t) {
2355
- const { use: r, fallback: s } = e, { use: o, fallback: a } = t;
2356
- r && o && (n.use = r.concat(o)), s && a && (n.fallback = ie(s, a));
2357
- }
2358
- return n;
2359
- }, es = ht({}), ts = "$inf$", on = xe && window.__SWR_DEVTOOLS_USE__, ns = on ? window.__SWR_DEVTOOLS_USE__ : [], rs = () => {
2360
- on && (window.__SWR_DEVTOOLS_REACT__ = de);
2361
- }, ss = (e) => Q(e[1]) ? [
2362
- e[0],
2363
- e[1],
2364
- e[2] || {}
2365
- ] : [
2366
- e[0],
2367
- null,
2368
- (e[1] === null ? e[2] : e[1]) || {}
2369
- ], os = () => ie(Zr, yt(es)), as = (e) => (t, n, r) => e(t, n && ((...o) => {
2370
- const [a] = tt(t), [, , , d] = Z.get(sn);
2371
- if (a.startsWith(ts))
2372
- return n(...o);
2373
- const g = d[a];
2374
- return b(g) ? n(...o) : (delete d[a], g);
2375
- }), r), is = ns.concat(as), cs = (e) => function(...n) {
2376
- const r = os(), [s, o, a] = ss(n), d = $r(r, a);
2377
- let g = e;
2378
- const { use: u } = d, c = (u || []).concat(is);
2379
- for (let i = c.length; i--; )
2380
- g = c[i](g);
2381
- return g(s, o || d.fetcher || null, d);
2382
- }, us = (e, t, n) => {
2383
- const r = t[e] || (t[e] = []);
2384
- return r.push(n), () => {
2385
- const s = r.indexOf(n);
2386
- s >= 0 && (r[s] = r[r.length - 1], r.pop());
2387
- };
2388
- };
2389
- rs();
2390
- const mt = de.use || ((e) => {
2391
- if (e.status === "pending")
2392
- throw e;
2393
- if (e.status === "fulfilled")
2394
- return e.value;
2395
- throw e.status === "rejected" ? e.reason : (e.status = "pending", e.then((t) => {
2396
- e.status = "fulfilled", e.value = t;
2397
- }, (t) => {
2398
- e.status = "rejected", e.reason = t;
2399
- }), e);
2400
- }), He = {
2401
- dedupe: !0
2402
- }, ls = (e, t, n) => {
2403
- const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: d, revalidateIfStale: g, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: m } = n, [p, y, f, v] = Z.get(r), [h, q] = tt(e), D = se(!1), S = se(!1), O = se(h), E = se(t), F = se(n), A = () => F.current, x = () => A().isVisible() && A().isOnline(), [P, B, W, L] = $t(r, h), te = se({}).current, _ = b(a) ? n.fallback[h] : a, N = (R, T) => {
2404
- for (const j in te) {
2405
- const C = j;
2406
- if (C === "data") {
2407
- if (!s(R[C], T[C]) && (!b(R[C]) || !s(ne, T[C])))
2408
- return !1;
2409
- } else if (T[C] !== R[C])
2410
- return !1;
2411
- }
2412
- return !0;
2413
- }, M = ee(() => {
2414
- const R = !h || !t ? !1 : b(d) ? A().isPaused() || o ? !1 : b(g) ? !0 : g : d, T = (k) => {
2415
- const K = ie(k);
2416
- return delete K._k, R ? {
2417
- isValidating: !0,
2418
- isLoading: !0,
2419
- ...K
2420
- } : K;
2421
- }, j = P(), C = L(), X = T(j), pe = j === C ? X : T(C);
2422
- let I = X;
2423
- return [
2424
- () => {
2425
- const k = T(P());
2426
- return N(k, I) ? (I.data = k.data, I.isLoading = k.isLoading, I.isValidating = k.isValidating, I.error = k.error, I) : (I = k, k);
2427
- },
2428
- () => pe
2429
- ];
2430
- }, [
2431
- r,
2432
- h
2433
- ]), H = Lr.useSyncExternalStore(ge(
2434
- (R) => W(h, (T, j) => {
2435
- N(j, T) || R();
2436
- }),
2437
- // eslint-disable-next-line react-hooks/exhaustive-deps
2438
- [
2439
- r,
2440
- h
2441
- ]
2442
- ), M[0], M[1]), ue = !D.current, U = p[h] && p[h].length > 0, G = H.data, Y = b(G) ? _ : G, fe = H.error, we = se(Y), ne = m ? b(G) ? we.current : G : Y, w = U && !b(fe) ? !1 : ue && !b(d) ? d : A().isPaused() ? !1 : o ? b(Y) ? !1 : g : b(Y) || g, he = !!(h && t && ue && w), an = b(H.isValidating) ? he : H.isValidating, cn = b(H.isLoading) ? he : H.isLoading, ye = ge(
2443
- async (R) => {
2444
- const T = E.current;
2445
- if (!h || !T || S.current || A().isPaused())
2446
- return !1;
2447
- let j, C, X = !0;
2448
- const pe = R || {}, I = !f[h] || !pe.dedupe, k = () => ft ? !S.current && h === O.current && D.current : h === O.current, K = {
2449
- isValidating: !1,
2450
- isLoading: !1
2451
- }, rt = () => {
2452
- B(K);
2453
- }, st = () => {
2454
- const z = f[h];
2455
- z && z[1] === C && delete f[h];
2456
- }, ot = {
2457
- isValidating: !0
2458
- };
2459
- b(P().data) && (ot.isLoading = !0);
2460
- try {
2461
- if (I && (B(ot), n.loadingTimeout && b(P().data) && setTimeout(() => {
2462
- X && k() && A().onLoadingSlow(h, n);
2463
- }, n.loadingTimeout), f[h] = [
2464
- T(q),
2465
- We()
2466
- ]), [j, C] = f[h], j = await j, I && setTimeout(st, n.dedupingInterval), !f[h] || f[h][1] !== C)
2467
- return I && k() && A().onDiscarded(h), !1;
2468
- K.error = V;
2469
- const z = y[h];
2470
- if (!b(z) && // case 1
2471
- (C <= z[0] || // case 2
2472
- C <= z[1] || // case 3
2473
- z[1] === 0))
2474
- return rt(), I && k() && A().onDiscarded(h), !1;
2475
- const J = P().data;
2476
- K.data = s(J, j) ? J : j, I && k() && A().onSuccess(j, h, n);
2477
- } catch (z) {
2478
- st();
2479
- const J = A(), { shouldRetryOnError: Pe } = J;
2480
- J.isPaused() || (K.error = z, I && k() && (J.onError(z, h, J), (Pe === !0 || Q(Pe) && Pe(z)) && (!A().revalidateOnFocus || !A().revalidateOnReconnect || x()) && J.onErrorRetry(z, h, J, (un) => {
2481
- const Ie = p[h];
2482
- Ie && Ie[0] && Ie[0](Se.ERROR_REVALIDATE_EVENT, un);
2483
- }, {
2484
- retryCount: (pe.retryCount || 0) + 1,
2485
- dedupe: !0
2486
- })));
2487
- }
2488
- return X = !1, rt(), !0;
2489
- },
2490
- // `setState` is immutable, and `eventsCallback`, `fnArg`, and
2491
- // `keyValidating` are depending on `key`, so we can exclude them from
2492
- // the deps array.
2493
- //
2494
- // FIXME:
2495
- // `fn` and `config` might be changed during the lifecycle,
2496
- // but they might be changed every render like this.
2497
- // `useSWR('key', () => fetch('/api/'), { suspense: true })`
2498
- // So we omit the values from the deps array
2499
- // even though it might cause unexpected behaviors.
2500
- // eslint-disable-next-line react-hooks/exhaustive-deps
2501
- [
2502
- h,
2503
- r
2504
- ]
2505
- ), nt = ge(
2506
- // Use callback to make sure `keyRef.current` returns latest result every time
2507
- (...R) => rn(r, O.current, ...R),
2508
- // eslint-disable-next-line react-hooks/exhaustive-deps
2509
- []
2510
- );
2511
- if (Ve(() => {
2512
- E.current = t, F.current = n, b(G) || (we.current = G);
2513
- }), Ve(() => {
2514
- if (!h) return;
2515
- const R = ye.bind(V, He);
2516
- let T = 0;
2517
- const C = us(h, p, (X, pe = {}) => {
2518
- if (X == Se.FOCUS_EVENT) {
2519
- const I = Date.now();
2520
- A().revalidateOnFocus && I > T && x() && (T = I + A().focusThrottleInterval, R());
2521
- } else if (X == Se.RECONNECT_EVENT)
2522
- A().revalidateOnReconnect && x() && R();
2523
- else {
2524
- if (X == Se.MUTATE_EVENT)
2525
- return ye();
2526
- if (X == Se.ERROR_REVALIDATE_EVENT)
2527
- return ye(pe);
2528
- }
2529
- });
2530
- return S.current = !1, O.current = h, D.current = !0, B({
2531
- _k: q
2532
- }), w && (b(Y) || be ? R() : qr(R)), () => {
2533
- S.current = !0, C();
2534
- };
2535
- }, [
2536
- h
2537
- ]), Ve(() => {
2538
- let R;
2539
- function T() {
2540
- const C = Q(u) ? u(P().data) : u;
2541
- C && R !== -1 && (R = setTimeout(j, C));
2542
- }
2543
- function j() {
2544
- !P().error && (c || A().isVisible()) && (i || A().isOnline()) ? ye(He).then(T) : T();
2545
- }
2546
- return T(), () => {
2547
- R && (clearTimeout(R), R = -1);
2548
- };
2549
- }, [
2550
- u,
2551
- c,
2552
- i,
2553
- h
2554
- ]), gn(ne), o && b(Y) && h) {
2555
- if (!ft && be)
2556
- throw new Error("Fallback data is required when using suspense in SSR.");
2557
- E.current = t, F.current = n, S.current = !1;
2558
- const R = v[h];
2559
- if (!b(R)) {
2560
- const T = nt(R);
2561
- mt(T);
2562
- }
2563
- if (b(fe)) {
2564
- const T = ye(He);
2565
- b(ne) || (T.status = "fulfilled", T.value = !0), mt(T);
2566
- } else
2567
- throw fe;
2568
- }
2569
- return {
2570
- mutate: nt,
2571
- get data() {
2572
- return te.data = !0, ne;
2573
- },
2574
- get error() {
2575
- return te.error = !0, fe;
2576
- },
2577
- get isValidating() {
2578
- return te.isValidating = !0, an;
2579
- },
2580
- get isLoading() {
2581
- return te.isLoading = !0, cn;
2582
- }
2583
- };
2584
- }, ds = cs(ls);
2585
- function Ts() {
2586
- const { apiUrl: e, botToken: t } = ce(), n = Et({
2587
- apiUrl: e,
2588
- botToken: t
2589
- });
2590
- return ds(n.options, n.apis.fetchPreludeData);
2591
- }
2592
- export {
2593
- $e as A,
2594
- Rs as W,
2595
- oe as _,
2596
- _s as a,
2597
- As as b,
2598
- bs as c,
2599
- Es as d,
2600
- Os as e,
2601
- Ts as f,
2602
- ws as g,
2603
- Re as h,
2604
- At as i,
2605
- Ft as j,
2606
- Or as k,
2607
- ce as u
2608
- };
2609
- //# sourceMappingURL=index-D84Xc70r.js.map