@opencx/widget-core 4.0.49 → 4.0.50

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.
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
- import R from "openapi-fetch";
2
- import D from "lodash.isequal";
3
- import { v4 as E } from "uuid";
4
- const V = (_) => {
1
+ import D from "openapi-fetch";
2
+ import V from "lodash.isequal";
3
+ import { v4 as L } from "uuid";
4
+ const F = (_) => {
5
5
  console.log(_.error);
6
- }, F = (_) => {
7
- const o = R({
6
+ }, B = (_) => {
7
+ const o = D({
8
8
  baseUrl: _.baseUrl
9
9
  }), i = {
10
10
  onRequest: _.onRequest,
11
11
  onResponse: _.onResponse,
12
- onError: _.onError || V
12
+ onError: _.onError || F
13
13
  };
14
14
  return o.use(i), o;
15
15
  };
16
- class A {
16
+ class M {
17
17
  constructor({ config: o }) {
18
18
  var h, s;
19
19
  this.userToken = null, this.constructClientOptions = (e) => {
@@ -27,7 +27,7 @@ class A {
27
27
  }, this.createOpenAPIClient = ({
28
28
  baseUrl: e,
29
29
  headers: t
30
- }) => F({
30
+ }) => B({
31
31
  baseUrl: e,
32
32
  onRequest: ({ request: a }) => {
33
33
  Object.entries(t).forEach(([n, r]) => {
@@ -73,7 +73,7 @@ class A {
73
73
  abortSignal: t,
74
74
  onProgress: a
75
75
  }) => new Promise((n, r) => {
76
- var y;
76
+ var k;
77
77
  const c = new FormData();
78
78
  c.append("file", e);
79
79
  const u = new XMLHttpRequest();
@@ -83,18 +83,18 @@ class A {
83
83
  r(new DOMException("Aborted", "AbortError"));
84
84
  return;
85
85
  }
86
- u.upload.addEventListener("progress", (v) => {
87
- if (v.lengthComputable && a) {
88
- const b = Math.round(v.loaded / v.total * 100);
89
- a(b);
86
+ u.upload.addEventListener("progress", (g) => {
87
+ if (g.lengthComputable && a) {
88
+ const f = Math.round(g.loaded / g.total * 100);
89
+ a(f);
90
90
  }
91
91
  }), u.addEventListener("load", () => {
92
92
  if (u.status >= 200 && u.status < 300)
93
93
  try {
94
- const v = JSON.parse(u.responseText);
95
- n(v);
96
- } catch (v) {
97
- r(new Error(`Failed to parse response: ${v}`));
94
+ const g = JSON.parse(u.responseText);
95
+ n(g);
96
+ } catch (g) {
97
+ r(new Error(`Failed to parse response: ${g}`));
98
98
  }
99
99
  else
100
100
  r(new Error(`Upload failed with status: ${u.status}`));
@@ -103,8 +103,8 @@ class A {
103
103
  }), u.addEventListener("timeout", () => {
104
104
  r(new Error("Upload timed out"));
105
105
  });
106
- const { baseUrl: p } = this.constructClientOptions(this.userToken), d = `${p}/backend/widget/v2/upload`;
107
- u.open("POST", d), u.setRequestHeader("X-Bot-Token", this.config.token), this.userToken ?? ((y = this.config.user) == null ? void 0 : y.token) ? u.setRequestHeader("Authorization", `Bearer ${this.userToken}`) : console.error("User token not set"), u.send(c);
106
+ const { baseUrl: p } = this.constructClientOptions(this.userToken), b = `${p}/backend/widget/v2/upload`;
107
+ u.open("POST", b), u.setRequestHeader("X-Bot-Token", this.config.token), this.userToken ?? ((k = this.config.user) == null ? void 0 : k.token) ? u.setRequestHeader("Authorization", `Bearer ${this.userToken}`) : console.error("User token not set"), u.send(c);
108
108
  }), this.vote = async (e) => await this.client.POST("/backend/widget/v2/chat/vote", { body: e }), this.resolveSession = async (e, t) => await this.client.POST("/backend/widget/v2/session/resolve", {
109
109
  body: e,
110
110
  signal: t
@@ -117,13 +117,13 @@ class A {
117
117
  this.client = this.createOpenAPIClient({ baseUrl: i, headers: l });
118
118
  }
119
119
  }
120
- function B(_, o) {
120
+ function K(_, o) {
121
121
  console.error(`Missing case for ${_} in ${o}`);
122
122
  }
123
123
  class S {
124
124
  constructor(o) {
125
125
  this.subscribers = /* @__PURE__ */ new Set(), this.get = () => this.state, this.set = (i) => {
126
- D(this.state, i) || (this.state = i, this.notifySubscribers(i));
126
+ V(this.state, i) || (this.state = i, this.notifySubscribers(i));
127
127
  }, this.setPartial = (i) => {
128
128
  if (i == null) return;
129
129
  const l = { ...this.state, ...i };
@@ -143,7 +143,7 @@ class S {
143
143
  }), this.state = o, this.initialState = o;
144
144
  }
145
145
  }
146
- class L {
146
+ class U {
147
147
  constructor() {
148
148
  this.state = new S({
149
149
  isPolling: !1,
@@ -172,7 +172,7 @@ class L {
172
172
  };
173
173
  }
174
174
  }
175
- function U(_) {
175
+ function N(_) {
176
176
  try {
177
177
  const o = _();
178
178
  return o instanceof Promise ? o.then((i) => ({ data: i })).catch((i) => ({ error: i })) : { data: o };
@@ -180,7 +180,7 @@ function U(_) {
180
180
  return { error: o };
181
181
  }
182
182
  }
183
- class K {
183
+ class H {
184
184
  constructor({
185
185
  api: o,
186
186
  config: i,
@@ -188,7 +188,7 @@ class K {
188
188
  messageCtx: h,
189
189
  sessionPollingIntervalSeconds: s
190
190
  }) {
191
- this.poller = new L(), this.fetchSessionAndFullHistoryAbortController = new AbortController(), this.registerPolling = () => {
191
+ this.poller = new U(), this.fetchSessionAndFullHistoryAbortController = new AbortController(), this.registerPolling = () => {
192
192
  this.sessionCtx.sessionState.subscribe(({ session: e }) => {
193
193
  e != null && e.id ? this.poller.startPolling(async (t) => {
194
194
  this.fetchSessionAndHistory({ sessionId: e.id, abortSignal: t });
@@ -220,11 +220,11 @@ class K {
220
220
  lastMessageTimestamp: a ? void 0 : r
221
221
  });
222
222
  if (c != null && c.session && (this.sessionCtx.sessionState.setPartial({ session: c.session }), this.sessionCtx.setSessions([c.session])), c != null && c.history && c.history.length > 0) {
223
- const p = this.messageCtx.state.get().messages, w = c.history.map(this.mapHistoryToMessage).filter((d) => d !== null).filter(
224
- (d) => !p.some((k) => k.id === d.id)
223
+ const p = this.messageCtx.state.get().messages, y = c.history.map(this.mapHistoryToMessage).filter((b) => b !== null).filter(
224
+ (b) => !p.some((v) => v.id === b.id)
225
225
  );
226
226
  this.messageCtx.state.setPartial({
227
- messages: [...p, ...w]
227
+ messages: [...p, ...y]
228
228
  });
229
229
  }
230
230
  this.messageCtx.state.get().isInitialFetchLoading && this.messageCtx.state.setPartial({ isInitialFetchLoading: !1 });
@@ -326,7 +326,7 @@ class K {
326
326
  case "none":
327
327
  return null;
328
328
  default:
329
- return B(
329
+ return K(
330
330
  e.systemMessagePayload,
331
331
  this.constructSystemMessage.name
332
332
  ), null;
@@ -335,14 +335,14 @@ class K {
335
335
  const t = e.result;
336
336
  if (t === null || typeof t != "object") return t;
337
337
  if ("responseBodyText" in t && typeof t.responseBodyText == "string") {
338
- const a = t.responseBodyText, n = U(() => JSON.parse(a)).data;
338
+ const a = t.responseBodyText, n = N(() => JSON.parse(a)).data;
339
339
  if (n) return n;
340
340
  }
341
341
  return e.result;
342
342
  }, this.api = o, this.config = i, this.sessionCtx = l, this.messageCtx = h, this.sessionPollingIntervalSeconds = s, this.registerPolling();
343
343
  }
344
344
  }
345
- class H {
345
+ class J {
346
346
  constructor({
347
347
  config: o,
348
348
  api: i,
@@ -353,26 +353,26 @@ class H {
353
353
  var s;
354
354
  return !!(!((s = this.state.get().contact) != null && s.token) && this.config.collectUserData);
355
355
  }, this.autoCreateUnverifiedUserIfNotExists = async () => {
356
- var s, e, t, a, n, r, c, u, p, w, d, k, y, v;
356
+ var s, e, t, a, n, r, c, u, p, y, b, v, k, g;
357
357
  if (!((s = this.config.user) != null && s.token)) {
358
358
  if (this.config.collectUserData && !((t = (e = this.config.user) == null ? void 0 : e.data) != null && t.email)) {
359
359
  if ((a = this.config.extraDataCollectionFields) != null && a.length)
360
360
  return;
361
- const b = await ((n = this.storageCtx) == null ? void 0 : n.getContactToken());
362
- b && await this.setUnverifiedContact(b);
361
+ const f = await ((n = this.storageCtx) == null ? void 0 : n.getContactToken());
362
+ f && await this.setUnverifiedContact(f);
363
363
  return;
364
364
  }
365
365
  if (!((c = (r = this.config.user) == null ? void 0 : r.data) != null && c.email)) {
366
- const b = await ((u = this.storageCtx) == null ? void 0 : u.getContactToken());
367
- if (b) {
368
- await this.setUnverifiedContact(b);
366
+ const f = await ((u = this.storageCtx) == null ? void 0 : u.getContactToken());
367
+ if (f) {
368
+ await this.setUnverifiedContact(f);
369
369
  return;
370
370
  }
371
371
  }
372
372
  await this.createUnverifiedContact({
373
- email: (w = (p = this.config.user) == null ? void 0 : p.data) == null ? void 0 : w.email,
374
- non_verified_name: (k = (d = this.config.user) == null ? void 0 : d.data) == null ? void 0 : k.name,
375
- non_verified_custom_data: (v = (y = this.config.user) == null ? void 0 : y.data) == null ? void 0 : v.customData
373
+ email: (y = (p = this.config.user) == null ? void 0 : p.data) == null ? void 0 : y.email,
374
+ non_verified_name: (v = (b = this.config.user) == null ? void 0 : b.data) == null ? void 0 : v.name,
375
+ non_verified_custom_data: (g = (k = this.config.user) == null ? void 0 : k.data) == null ? void 0 : g.customData
376
376
  });
377
377
  }
378
378
  }, this.createUnverifiedContact = async (s, e) => {
@@ -389,7 +389,7 @@ class H {
389
389
  }
390
390
  }, this.setUnverifiedContact = async (s) => {
391
391
  var a, n, r, c;
392
- const e = await ((a = this.storageCtx) == null ? void 0 : a.getExternalContactId()), t = ((n = this.config.user) == null ? void 0 : n.externalId) || e || E();
392
+ const e = await ((a = this.storageCtx) == null ? void 0 : a.getExternalContactId()), t = ((n = this.config.user) == null ? void 0 : n.externalId) || e || L();
393
393
  this.api.setAuthToken(s), await ((r = this.storageCtx) == null ? void 0 : r.setContactToken(s)), await ((c = this.storageCtx) == null ? void 0 : c.setExternalContactId(t)), this.state.setPartial({ contact: { token: s, externalId: t } });
394
394
  }, this.config = o, this.storageCtx = l, this.api = i, this.state = new S({
395
395
  contact: (h = o.user) != null && h.token ? {
@@ -404,9 +404,9 @@ class H {
404
404
  }
405
405
  }
406
406
  function C() {
407
- return E();
407
+ return L();
408
408
  }
409
- class J {
409
+ class q {
410
410
  constructor({
411
411
  config: o,
412
412
  api: i,
@@ -445,14 +445,14 @@ class J {
445
445
  }, this.config = o, this.api = i, this.sessionCtx = l, this.messageCtx = h;
446
446
  }
447
447
  }
448
- class q {
448
+ class W {
449
449
  constructor({
450
450
  config: o,
451
451
  api: i,
452
452
  contactCtx: l,
453
453
  sessionsPollingIntervalSeconds: h
454
454
  }) {
455
- this.sessionsRefresher = new L(), this.sessionState = new S({
455
+ this.sessionsRefresher = new U(), this.sessionState = new S({
456
456
  session: null,
457
457
  isCreatingSession: !1,
458
458
  isResolvingSession: !1
@@ -481,7 +481,7 @@ class q {
481
481
  Object.entries(this.config.sessionCustomData || {}).map(
482
482
  ([s, e]) => {
483
483
  var t;
484
- return typeof e == "string" ? [s, e] : typeof e == "boolean" ? [s, e] : typeof e == "number" ? [s, e] : [s, ((t = U(() => JSON.stringify(e))) == null ? void 0 : t.data) || ""];
484
+ return typeof e == "string" ? [s, e] : typeof e == "boolean" ? [s, e] : typeof e == "number" ? [s, e] : [s, ((t = N(() => JSON.stringify(e))) == null ? void 0 : t.data) || ""];
485
485
  }
486
486
  )
487
487
  ), this.createSession = async () => {
@@ -564,7 +564,8 @@ class Y {
564
564
  }), this.sendMessageAbortController = new AbortController(), this.reset = () => {
565
565
  this.sendMessageAbortController.abort("Resetting chat"), this.state.reset();
566
566
  }, this.sendMessage = async (s) => {
567
- var e, t, a, n, r, c, u, p, w;
567
+ var t, a, n, r, c, u, p, y, b;
568
+ let e;
568
569
  try {
569
570
  if (!s.content.trim() && (!s.attachments || s.attachments.length === 0)) {
570
571
  console.warn(
@@ -572,56 +573,56 @@ class Y {
572
573
  );
573
574
  return;
574
575
  }
575
- const d = this.sessionCtx.sessionState.get().session, y = (d == null ? void 0 : d.assignee.kind) === "ai", v = this.state.get().isSendingMessageToAI, b = this.state.get().messages.at(-1);
576
- if (v || // If last message is from user, then bot response did not arrive yet
577
- y && (b == null ? void 0 : b.type) === "USER") {
576
+ const v = this.sessionCtx.sessionState.get().session, g = (v == null ? void 0 : v.assignee.kind) === "ai", f = this.state.get().isSendingMessageToAI, z = this.state.get().messages.at(-1);
577
+ if (this.config.disableSendingWhenAwaitingAIReply !== !1 && (f || // If last message is from user, then bot response did not arrive yet
578
+ g && (z == null ? void 0 : z.type) === "USER")) {
578
579
  console.warn("Cannot send messages while awaiting AI response");
579
580
  return;
580
581
  }
581
- this.sendMessageAbortController = new AbortController(), this.state.setPartial({
582
+ this.sendMessageAbortController.abort("Superseded by a newer message"), this.sendMessageAbortController = new AbortController(), e = this.sendMessageAbortController, this.state.setPartial({
582
583
  lastAIResMightSolveUserIssue: !1,
583
584
  isSendingMessage: !0,
584
- isSendingMessageToAI: !!y || !d
585
+ isSendingMessageToAI: !!g || !v
585
586
  });
586
- const I = this.state.get().messages, P = !((e = this.sessionCtx.sessionState.get().session) != null && e.id) && I.length === 0 && ((t = this.config.advancedInitialMessages) == null ? void 0 : t.some((g) => g.persistent)), j = P ? (this.config.advancedInitialMessages || []).filter((g) => g.persistent).map(
587
- (g) => ({
587
+ const P = this.state.get().messages, j = !((t = this.sessionCtx.sessionState.get().session) != null && t.id) && P.length === 0 && ((a = this.config.advancedInitialMessages) == null ? void 0 : a.some((d) => d.persistent)), A = j ? (this.config.advancedInitialMessages || []).filter((d) => d.persistent).map(
588
+ (d) => ({
588
589
  id: C(),
589
590
  component: "bot_message",
590
591
  type: "AI",
591
592
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
592
593
  data: {
593
- message: g.message
594
+ message: d.message
594
595
  },
595
596
  agent: this.config.bot ? { ...this.config.bot, isAi: !0, id: null } : void 0
596
597
  })
597
- ) : [], z = this.toUserMessage(
598
+ ) : [], I = this.toUserMessage(
598
599
  s.content.trim(),
599
600
  s.attachments || void 0
600
601
  );
601
602
  if (this.state.setPartial({
602
603
  messages: [
603
- ...j,
604
- ...I,
605
- z
604
+ ...A,
605
+ ...P,
606
+ I
606
607
  ]
607
- }), !((a = this.sessionCtx.sessionState.get().session) != null && a.id)) {
608
+ }), !((n = this.sessionCtx.sessionState.get().session) != null && n.id)) {
608
609
  if (!await this.sessionCtx.createSession()) {
609
610
  console.error("Failed to create session");
610
611
  return;
611
612
  }
612
613
  this.sessionCtx.refreshSessions();
613
614
  }
614
- const T = (n = this.sessionCtx.sessionState.get().session) == null ? void 0 : n.id;
615
+ const T = (r = this.sessionCtx.sessionState.get().session) == null ? void 0 : r.id;
615
616
  if (!T) return;
616
617
  const { data: m } = await this.api.sendMessage(
617
618
  {
618
- uuid: z.id,
619
+ uuid: I.id,
619
620
  bot_token: this.config.token,
620
621
  headers: this.config.headers,
621
622
  query_params: this.config.queryParams,
622
623
  body_properties: this.config.bodyProperties,
623
624
  session_id: T,
624
- content: z.content,
625
+ content: I.content,
625
626
  attachments: s.attachments,
626
627
  clientContext: this.config.context,
627
628
  custom_data: {
@@ -630,43 +631,43 @@ class Y {
630
631
  },
631
632
  language: this.config.language,
632
633
  exit_mode_prompt: s.exitModePrompt,
633
- initial_messages: P ? j.map((g) => ({
634
- uuid: g.id,
635
- content: g.data.message
634
+ initial_messages: j ? A.map((d) => ({
635
+ uuid: d.id,
636
+ content: d.data.message
636
637
  })) : void 0
637
638
  },
638
- this.sendMessageAbortController.signal
639
+ e.signal
639
640
  );
640
641
  if (m != null && m.success) {
641
- const g = this.toBotMessage(m);
642
- if (g) {
642
+ const d = this.toBotMessage(m);
643
+ if (d) {
643
644
  const x = this.state.get().messages;
644
645
  if (!!x.some(
645
- (O) => O.id === g.id
646
+ (R) => R.id === d.id
646
647
  )) {
647
648
  this.state.setPartial({
648
- lastAIResMightSolveUserIssue: ((r = m.autopilotResponse) == null ? void 0 : r.mightSolveUserIssue) || ((c = m.uiResponse) == null ? void 0 : c.mightSolveUserIssue)
649
+ lastAIResMightSolveUserIssue: ((c = m.autopilotResponse) == null ? void 0 : c.mightSolveUserIssue) || ((u = m.uiResponse) == null ? void 0 : u.mightSolveUserIssue)
649
650
  });
650
651
  return;
651
652
  }
652
653
  this.state.setPartial({
653
- messages: [...x, g],
654
- lastAIResMightSolveUserIssue: ((u = m.autopilotResponse) == null ? void 0 : u.mightSolveUserIssue) || ((p = m.uiResponse) == null ? void 0 : p.mightSolveUserIssue)
654
+ messages: [...x, d],
655
+ lastAIResMightSolveUserIssue: ((p = m.autopilotResponse) == null ? void 0 : p.mightSolveUserIssue) || ((y = m.uiResponse) == null ? void 0 : y.mightSolveUserIssue)
655
656
  });
656
657
  }
657
658
  m.session && this.sessionCtx.sessionState.setPartial({ session: m.session });
658
659
  } else {
659
- const g = this.toBotErrorMessage(
660
- ((w = m == null ? void 0 : m.error) == null ? void 0 : w.message) || "Something went wrong. Please refresh the page or try again."
660
+ const d = this.toBotErrorMessage(
661
+ ((b = m == null ? void 0 : m.error) == null ? void 0 : b.message) || "Something went wrong. Please refresh the page or try again."
661
662
  ), x = this.state.get().messages;
662
663
  this.state.setPartial({
663
- messages: [...x, g]
664
+ messages: [...x, d]
664
665
  });
665
666
  }
666
- } catch (d) {
667
- this.sendMessageAbortController.signal.aborted || console.error("Failed to send message:", d);
667
+ } catch (v) {
668
+ e != null && e.signal.aborted || console.error("Failed to send message:", v);
668
669
  } finally {
669
- this.state.setPartial({
670
+ e != null && e.signal.aborted || this.state.setPartial({
670
671
  isSendingMessage: !1,
671
672
  isSendingMessageToAI: !1
672
673
  });
@@ -782,7 +783,7 @@ class $ {
782
783
  }, this.getExternalContactId = async () => this.storage.get(this.KEYS.externalContactId(this.config.token)), this.storage = o, this.config = i;
783
784
  }
784
785
  }
785
- const f = class f {
786
+ const w = class w {
786
787
  constructor({
787
788
  config: o,
788
789
  storage: i,
@@ -791,35 +792,35 @@ const f = class f {
791
792
  }) {
792
793
  if (this.modes = [], this.resetChat = () => {
793
794
  this.sessionCtx.reset(), this.messageCtx.reset();
794
- }, !f.pollingIntervalsSeconds)
795
+ }, !w.pollingIntervalsSeconds)
795
796
  throw Error(
796
797
  "Widget polling values are not defined, did you call WidgetCtx.initialize()"
797
798
  );
798
- this.config = o, this.org = h, this.api = new A({ config: o }), this.storageCtx = i ? new $({ storage: i, config: o }) : void 0, this.modes = l, this.contactCtx = new H({
799
+ this.config = o, this.org = h, this.api = new M({ config: o }), this.storageCtx = i ? new $({ storage: i, config: o }) : void 0, this.modes = l, this.contactCtx = new J({
799
800
  api: this.api,
800
801
  config: this.config,
801
802
  storageCtx: this.storageCtx
802
- }), this.sessionCtx = new q({
803
+ }), this.sessionCtx = new W({
803
804
  config: this.config,
804
805
  api: this.api,
805
806
  contactCtx: this.contactCtx,
806
- sessionsPollingIntervalSeconds: f.pollingIntervalsSeconds.sessions
807
+ sessionsPollingIntervalSeconds: w.pollingIntervalsSeconds.sessions
807
808
  }), this.messageCtx = new Y({
808
809
  config: this.config,
809
810
  api: this.api,
810
811
  sessionCtx: this.sessionCtx,
811
812
  contactCtx: this.contactCtx
812
- }), this.csatCtx = new J({
813
+ }), this.csatCtx = new q({
813
814
  config: this.config,
814
815
  api: this.api,
815
816
  sessionCtx: this.sessionCtx,
816
817
  messageCtx: this.messageCtx
817
- }), this.activeSessionPollingCtx = new K({
818
+ }), this.activeSessionPollingCtx = new H({
818
819
  api: this.api,
819
820
  config: this.config,
820
821
  sessionCtx: this.sessionCtx,
821
822
  messageCtx: this.messageCtx,
822
- sessionPollingIntervalSeconds: f.pollingIntervalsSeconds.session
823
+ sessionPollingIntervalSeconds: w.pollingIntervalsSeconds.session
823
824
  }), this.routerCtx = new G({
824
825
  config: this.config,
825
826
  contactCtx: this.contactCtx,
@@ -828,20 +829,20 @@ const f = class f {
828
829
  });
829
830
  }
830
831
  };
831
- f.pollingIntervalsSeconds = null, f.initialize = async ({
832
+ w.pollingIntervalsSeconds = null, w.initialize = async ({
832
833
  config: o,
833
834
  storage: i
834
835
  }) => {
835
836
  var h, s, e;
836
- const l = await new A({
837
+ const l = await new M({
837
838
  config: o
838
839
  }).getExternalWidgetConfig();
839
840
  if (!l.data)
840
841
  throw new Error("Failed to fetch widget config");
841
- return f.pollingIntervalsSeconds = {
842
+ return w.pollingIntervalsSeconds = {
842
843
  session: ((h = l.data) == null ? void 0 : h.sessionPollingIntervalSeconds) || 10,
843
844
  sessions: ((s = l.data) == null ? void 0 : s.sessionsPollingIntervalSeconds) || 60
844
- }, new f({
845
+ }, new w({
845
846
  config: o,
846
847
  storage: i,
847
848
  modes: ((e = l.data) == null ? void 0 : e.modes) || [],
@@ -851,8 +852,8 @@ f.pollingIntervalsSeconds = null, f.initialize = async ({
851
852
  }
852
853
  });
853
854
  };
854
- let M = f;
855
- const W = {
855
+ let E = w;
856
+ const Z = {
856
857
  write_a_message_placeholder: "اكتب رسالة...",
857
858
  your_issue_has_been_resolved: "تم حل مشكلتك!",
858
859
  new_conversation: "محادثة جديدة",
@@ -868,7 +869,7 @@ const W = {
868
869
  no_conversations_yet: "لا يوجد محادثات",
869
870
  back_to_conversations: "العودة إلى المحادثات",
870
871
  closed_conversations: "المحادثات المغلقة"
871
- }, Z = {
872
+ }, X = {
872
873
  write_a_message_placeholder: "একটি বার্তা লিখুন...",
873
874
  your_issue_has_been_resolved: "আপনার সমস্যা সমাধান হয়েছে!",
874
875
  new_conversation: "নতুন কথোপকথন",
@@ -884,7 +885,7 @@ const W = {
884
885
  no_conversations_yet: "এখনো কোনো কথোপকথন নেই",
885
886
  back_to_conversations: "কথোপকথনে ফিরে যান",
886
887
  closed_conversations: "বন্ধ কথোপকথন"
887
- }, X = {
888
+ }, Q = {
888
889
  write_a_message_placeholder: "Напишете съобщение...",
889
890
  your_issue_has_been_resolved: "Вашият проблем е разрешен!",
890
891
  new_conversation: "Нов разговор",
@@ -900,7 +901,7 @@ const W = {
900
901
  no_conversations_yet: "Все още няма разговори",
901
902
  back_to_conversations: "Назад към разговорите",
902
903
  closed_conversations: "Затворени разговори"
903
- }, Q = {
904
+ }, ee = {
904
905
  write_a_message_placeholder: "Napište zprávu...",
905
906
  your_issue_has_been_resolved: "Váš problém byl vyřešen!",
906
907
  new_conversation: "Nová konverzace",
@@ -916,7 +917,7 @@ const W = {
916
917
  no_conversations_yet: "Zatím žádné konverzace",
917
918
  back_to_conversations: "Zpět na konverzace",
918
919
  closed_conversations: "Uzavřené konverzace"
919
- }, ee = {
920
+ }, te = {
920
921
  write_a_message_placeholder: "Skriv en besked...",
921
922
  your_issue_has_been_resolved: "Dit problem er løst!",
922
923
  new_conversation: "Ny samtale",
@@ -932,7 +933,7 @@ const W = {
932
933
  no_conversations_yet: "Ingen samtaler endnu",
933
934
  back_to_conversations: "Tilbage til samtaler",
934
935
  closed_conversations: "Lukkede samtaler"
935
- }, te = {
936
+ }, se = {
936
937
  write_a_message_placeholder: "Γράψτε ένα μήνυμα...",
937
938
  your_issue_has_been_resolved: "Το πρόβλημά σας επιλύθηκε!",
938
939
  new_conversation: "Νέα συνομιλία",
@@ -948,7 +949,7 @@ const W = {
948
949
  no_conversations_yet: "Δεν υπάρχουν συνομιλίες ακόμα",
949
950
  back_to_conversations: "Πίσω στις συνομιλίες",
950
951
  closed_conversations: "Κλειστές συνομιλίες"
951
- }, se = {
952
+ }, ae = {
952
953
  write_a_message_placeholder: "Nachricht schreiben...",
953
954
  your_issue_has_been_resolved: "Ihr Problem wurde gelöst!",
954
955
  new_conversation: "Neue Konversation",
@@ -964,7 +965,7 @@ const W = {
964
965
  no_conversations_yet: "noch keine Gespräche",
965
966
  back_to_conversations: "Zurück zur Konversationen",
966
967
  closed_conversations: "Geschlossene Konversationen"
967
- }, ae = {
968
+ }, oe = {
968
969
  write_a_message_placeholder: "Write a message...",
969
970
  your_issue_has_been_resolved: "Your issue has been resolved!",
970
971
  new_conversation: "New conversation",
@@ -980,7 +981,7 @@ const W = {
980
981
  no_conversations_yet: "No conversations yet",
981
982
  back_to_conversations: "Back to conversations",
982
983
  closed_conversations: "Closed conversations"
983
- }, oe = {
984
+ }, ne = {
984
985
  write_a_message_placeholder: "Escribe un mensaje...",
985
986
  your_issue_has_been_resolved: "¡Tu problema fue resuelto!",
986
987
  new_conversation: "Nueva conversación",
@@ -996,7 +997,7 @@ const W = {
996
997
  no_conversations_yet: "Sin conversaciones aún",
997
998
  back_to_conversations: "Volver a conversaciones",
998
999
  closed_conversations: "Conversaciones cerradas"
999
- }, ne = {
1000
+ }, ie = {
1000
1001
  write_a_message_placeholder: "Magsulat ng mensahe...",
1001
1002
  your_issue_has_been_resolved: "Nalutas na ang iyong isyu!",
1002
1003
  new_conversation: "Bagong usapan",
@@ -1012,7 +1013,7 @@ const W = {
1012
1013
  no_conversations_yet: "Wala pang mga usapan",
1013
1014
  back_to_conversations: "Bumalik sa mga usapan",
1014
1015
  closed_conversations: "Mga saradong usapan"
1015
- }, ie = {
1016
+ }, re = {
1016
1017
  write_a_message_placeholder: "Kirjoita viesti...",
1017
1018
  your_issue_has_been_resolved: "Ongelmasi on ratkaistu!",
1018
1019
  new_conversation: "Uusi keskustelu",
@@ -1028,7 +1029,7 @@ const W = {
1028
1029
  no_conversations_yet: "Ei vielä keskusteluja",
1029
1030
  back_to_conversations: "Takaisin keskusteluihin",
1030
1031
  closed_conversations: "Suljetut keskustelut"
1031
- }, re = {
1032
+ }, le = {
1032
1033
  write_a_message_placeholder: "Écrivez un message...",
1033
1034
  your_issue_has_been_resolved: "Votre problème a été résolu !",
1034
1035
  new_conversation: "Nouvelle conversation",
@@ -1044,7 +1045,7 @@ const W = {
1044
1045
  no_conversations_yet: "Aucune conversation pour le moment",
1045
1046
  back_to_conversations: "Retour aux conversations",
1046
1047
  closed_conversations: "Conversations fermées"
1047
- }, le = {
1048
+ }, ce = {
1048
1049
  write_a_message_placeholder: "एक संदेश लिखें...",
1049
1050
  your_issue_has_been_resolved: "आपकी समस्या हल हो गई है!",
1050
1051
  new_conversation: "नई बातचीत",
@@ -1060,7 +1061,7 @@ const W = {
1060
1061
  no_conversations_yet: "अभी तक कोई बातचीत नहीं",
1061
1062
  back_to_conversations: "बातचीत पर वापस जाएं",
1062
1063
  closed_conversations: "बंद बातचीत"
1063
- }, ce = {
1064
+ }, _e = {
1064
1065
  write_a_message_placeholder: "Scrivi un messaggio...",
1065
1066
  your_issue_has_been_resolved: "Il tuo problema è stato risolto!",
1066
1067
  new_conversation: "Nuova conversazione",
@@ -1076,7 +1077,7 @@ const W = {
1076
1077
  no_conversations_yet: "Nessuna conversazione ancora",
1077
1078
  back_to_conversations: "Torna alle conversazioni",
1078
1079
  closed_conversations: "Conversazioni chiuse"
1079
- }, _e = {
1080
+ }, he = {
1080
1081
  write_a_message_placeholder: "メッセージを入力...",
1081
1082
  your_issue_has_been_resolved: "問題が解決しました!",
1082
1083
  new_conversation: "新しい会話",
@@ -1092,7 +1093,7 @@ const W = {
1092
1093
  no_conversations_yet: "まだ会話がありません",
1093
1094
  back_to_conversations: "会話一覧に戻る",
1094
1095
  closed_conversations: "終了した会話"
1095
- }, he = {
1096
+ }, ue = {
1096
1097
  write_a_message_placeholder: "메시지를 입력하세요...",
1097
1098
  your_issue_has_been_resolved: "문제가 해결되었습니다!",
1098
1099
  new_conversation: "새 대화",
@@ -1108,7 +1109,7 @@ const W = {
1108
1109
  no_conversations_yet: "아직 대화가 없습니다",
1109
1110
  back_to_conversations: "대화 목록으로 돌아가기",
1110
1111
  closed_conversations: "종료된 대화"
1111
- }, ue = {
1112
+ }, de = {
1112
1113
  write_a_message_placeholder: "Schrijf een bericht...",
1113
1114
  your_issue_has_been_resolved: "Uw probleem is opgelost!",
1114
1115
  new_conversation: "Nieuw gesprek",
@@ -1124,7 +1125,7 @@ const W = {
1124
1125
  no_conversations_yet: "Nog geen gesprekken",
1125
1126
  back_to_conversations: "Terug naar gesprekken",
1126
1127
  closed_conversations: "Afgesloten gesprekken"
1127
- }, de = {
1128
+ }, ge = {
1128
1129
  write_a_message_placeholder: "Skriv en melding...",
1129
1130
  your_issue_has_been_resolved: "Problemet ditt er løst!",
1130
1131
  new_conversation: "Ny samtale",
@@ -1140,7 +1141,7 @@ const W = {
1140
1141
  no_conversations_yet: "Ingen samtaler ennå",
1141
1142
  back_to_conversations: "Tilbake til samtaler",
1142
1143
  closed_conversations: "Lukkede samtaler"
1143
- }, ge = {
1144
+ }, me = {
1144
1145
  write_a_message_placeholder: "Napisz wiadomość...",
1145
1146
  your_issue_has_been_resolved: "Twój problem został rozwiązany!",
1146
1147
  new_conversation: "Nowa rozmowa",
@@ -1156,7 +1157,7 @@ const W = {
1156
1157
  no_conversations_yet: "Jeszcze brak rozmów",
1157
1158
  back_to_conversations: "Powrót do rozmów",
1158
1159
  closed_conversations: "Zamknięte rozmowy"
1159
- }, me = {
1160
+ }, pe = {
1160
1161
  write_a_message_placeholder: "Escreva uma mensagem...",
1161
1162
  your_issue_has_been_resolved: "Seu problema foi resolvido!",
1162
1163
  new_conversation: "Nova conversa",
@@ -1172,7 +1173,7 @@ const W = {
1172
1173
  no_conversations_yet: "Nenhuma conversa ainda",
1173
1174
  back_to_conversations: "Voltar para conversas",
1174
1175
  closed_conversations: "Conversas fechadas"
1175
- }, pe = {
1176
+ }, ve = {
1176
1177
  write_a_message_placeholder: "Scrie un mesaj...",
1177
1178
  your_issue_has_been_resolved: "Problema ta a fost rezolvată!",
1178
1179
  new_conversation: "Conversație nouă",
@@ -1188,7 +1189,7 @@ const W = {
1188
1189
  no_conversations_yet: "Încă nu există conversații",
1189
1190
  back_to_conversations: "Înapoi la conversații",
1190
1191
  closed_conversations: "Conversații închise"
1191
- }, ve = {
1192
+ }, be = {
1192
1193
  write_a_message_placeholder: "Skriv ett meddelande...",
1193
1194
  your_issue_has_been_resolved: "Ditt problem har lösts!",
1194
1195
  new_conversation: "Ny konversation",
@@ -1204,7 +1205,7 @@ const W = {
1204
1205
  no_conversations_yet: "Inga konversationer ännu",
1205
1206
  back_to_conversations: "Tillbaka till konversationer",
1206
1207
  closed_conversations: "Stängda konversationer"
1207
- }, be = {
1208
+ }, fe = {
1208
1209
  write_a_message_placeholder: "Напишите сообщение...",
1209
1210
  your_issue_has_been_resolved: "Ваша проблема решена!",
1210
1211
  new_conversation: "Новый разговор",
@@ -1220,7 +1221,7 @@ const W = {
1220
1221
  no_conversations_yet: "Пока нет разговоров",
1221
1222
  back_to_conversations: "Назад к разговорам",
1222
1223
  closed_conversations: "Закрытые разговоры"
1223
- }, fe = {
1224
+ }, we = {
1224
1225
  write_a_message_placeholder: "เขียนข้อความ...",
1225
1226
  your_issue_has_been_resolved: "ปัญหาของคุณได้รับการแก้ไขแล้ว!",
1226
1227
  new_conversation: "การสนทนาใหม่",
@@ -1236,7 +1237,7 @@ const W = {
1236
1237
  no_conversations_yet: "ยังไม่มีการสนทนา",
1237
1238
  back_to_conversations: "กลับไปที่การสนทนา",
1238
1239
  closed_conversations: "การสนทนาที่ปิดแล้ว"
1239
- }, we = {
1240
+ }, ye = {
1240
1241
  write_a_message_placeholder: "Bir mesaj yazın...",
1241
1242
  your_issue_has_been_resolved: "Sorununuz çözüldü!",
1242
1243
  new_conversation: "Yeni konuşma",
@@ -1252,7 +1253,7 @@ const W = {
1252
1253
  no_conversations_yet: "Henüz konuşma yok",
1253
1254
  back_to_conversations: "Konuşmalara geri dön",
1254
1255
  closed_conversations: "Kapatılan konuşmalar"
1255
- }, ye = {
1256
+ }, ke = {
1256
1257
  write_a_message_placeholder: "پیغام لکھیں...",
1257
1258
  your_issue_has_been_resolved: "آپ کا مسئلہ حل ہو گیا ہے!",
1258
1259
  new_conversation: "نئی گفتگو",
@@ -1268,7 +1269,7 @@ const W = {
1268
1269
  no_conversations_yet: "ابھی تک کوئی گفتگو نہیں",
1269
1270
  back_to_conversations: "گفتگو پر واپس جائیں",
1270
1271
  closed_conversations: "بند گفتگو"
1271
- }, ke = {
1272
+ }, Se = {
1272
1273
  write_a_message_placeholder: "Viết tin nhắn...",
1273
1274
  your_issue_has_been_resolved: "Vấn đề của bạn đã được giải quyết!",
1274
1275
  new_conversation: "Cuộc trò chuyện mới",
@@ -1284,7 +1285,7 @@ const W = {
1284
1285
  no_conversations_yet: "Chưa có cuộc trò chuyện nào",
1285
1286
  back_to_conversations: "Quay lại cuộc trò chuyện",
1286
1287
  closed_conversations: "Cuộc trò chuyện đã đóng"
1287
- }, Se = {
1288
+ }, Ce = {
1288
1289
  write_a_message_placeholder: "写一条消息...",
1289
1290
  your_issue_has_been_resolved: "您的问题已解决!",
1290
1291
  new_conversation: "新对话",
@@ -1300,7 +1301,7 @@ const W = {
1300
1301
  no_conversations_yet: "暂无对话",
1301
1302
  back_to_conversations: "返回对话",
1302
1303
  closed_conversations: "已关闭的对话"
1303
- }, Ce = {
1304
+ }, xe = {
1304
1305
  write_a_message_placeholder: "Napišite poruku...",
1305
1306
  your_issue_has_been_resolved: "Vaš problem je riješen!",
1306
1307
  new_conversation: "Novi razgovor",
@@ -1316,7 +1317,7 @@ const W = {
1316
1317
  no_conversations_yet: "Još nema razgovora",
1317
1318
  back_to_conversations: "Natrag na razgovore",
1318
1319
  closed_conversations: "Zatvoreni razgovori"
1319
- }, xe = {
1320
+ }, ze = {
1320
1321
  write_a_message_placeholder: "Kirjuta sõnum...",
1321
1322
  your_issue_has_been_resolved: "Teie probleem on lahendatud!",
1322
1323
  new_conversation: "Uus vestlus",
@@ -1332,7 +1333,7 @@ const W = {
1332
1333
  no_conversations_yet: "Vestlusi pole veel",
1333
1334
  back_to_conversations: "Tagasi vestluste juurde",
1334
1335
  closed_conversations: "Suletud vestlused"
1335
- }, ze = {
1336
+ }, Ie = {
1336
1337
  write_a_message_placeholder: "Írjon üzenetet...",
1337
1338
  your_issue_has_been_resolved: "A problémája megoldódott!",
1338
1339
  new_conversation: "Új beszélgetés",
@@ -1348,7 +1349,7 @@ const W = {
1348
1349
  no_conversations_yet: "Még nincsenek beszélgetések",
1349
1350
  back_to_conversations: "Vissza a beszélgetésekhez",
1350
1351
  closed_conversations: "Lezárt beszélgetések"
1351
- }, Ie = {
1352
+ }, Pe = {
1352
1353
  write_a_message_placeholder: "Skrifaðu skilaboð...",
1353
1354
  your_issue_has_been_resolved: "Málið þitt hefur verið leyst!",
1354
1355
  new_conversation: "Nýtt samtal",
@@ -1364,7 +1365,7 @@ const W = {
1364
1365
  no_conversations_yet: "Engin samtöl ennþá",
1365
1366
  back_to_conversations: "Til baka í samtöl",
1366
1367
  closed_conversations: "Lokuð samtöl"
1367
- }, Pe = {
1368
+ }, je = {
1368
1369
  write_a_message_placeholder: "Rakstiet ziņojumu...",
1369
1370
  your_issue_has_been_resolved: "Jūsu problēma ir atrisināta!",
1370
1371
  new_conversation: "Jauna saruna",
@@ -1380,7 +1381,7 @@ const W = {
1380
1381
  no_conversations_yet: "Pagaidām nav sarunu",
1381
1382
  back_to_conversations: "Atpakaļ pie sarunām",
1382
1383
  closed_conversations: "Slēgtās sarunas"
1383
- }, je = {
1384
+ }, Ae = {
1384
1385
  write_a_message_placeholder: "Parašykite žinutę...",
1385
1386
  your_issue_has_been_resolved: "Jūsų problema išspręsta!",
1386
1387
  new_conversation: "Naujas pokalbis",
@@ -1412,7 +1413,7 @@ const W = {
1412
1413
  no_conversations_yet: "Nach keng Konversatiounen",
1413
1414
  back_to_conversations: "Zréck zu de Konversatiounen",
1414
1415
  closed_conversations: "Zougemaachte Konversatiounen"
1415
- }, Ae = {
1416
+ }, Me = {
1416
1417
  write_a_message_placeholder: "Ikteb messaġġ...",
1417
1418
  your_issue_has_been_resolved: "Il-problema tiegħek ġiet riżolta!",
1418
1419
  new_conversation: "Konversazzjoni ġdida",
@@ -1428,7 +1429,7 @@ const W = {
1428
1429
  no_conversations_yet: "Għad m'hemmx konversazzjonijiet",
1429
1430
  back_to_conversations: "Lura għall-konversazzjonijiet",
1430
1431
  closed_conversations: "Konversazzjonijiet magħluqa"
1431
- }, Me = {
1432
+ }, Ee = {
1432
1433
  write_a_message_placeholder: "Skriv en melding...",
1433
1434
  your_issue_has_been_resolved: "Saken din er løst!",
1434
1435
  new_conversation: "Ny samtale",
@@ -1444,7 +1445,7 @@ const W = {
1444
1445
  no_conversations_yet: "Ingen samtaler ennå",
1445
1446
  back_to_conversations: "Tilbake til samtaler",
1446
1447
  closed_conversations: "Lukkede samtaler"
1447
- }, Ee = {
1448
+ }, Le = {
1448
1449
  write_a_message_placeholder: "Napíšte správu...",
1449
1450
  your_issue_has_been_resolved: "Váš problém bol vyriešený!",
1450
1451
  new_conversation: "Nová konverzácia",
@@ -1460,58 +1461,58 @@ const W = {
1460
1461
  no_conversations_yet: "Zatiaľ žiadne konverzácie",
1461
1462
  back_to_conversations: "Späť na konverzácie",
1462
1463
  closed_conversations: "Uzavreté konverzácie"
1463
- }, N = {
1464
- ar: W,
1465
- bn: Z,
1466
- bg: X,
1467
- cs: Q,
1468
- da: ee,
1469
- de: se,
1470
- el: te,
1471
- en: ae,
1472
- es: oe,
1473
- et: xe,
1474
- fi: ie,
1475
- fil: ne,
1476
- fr: re,
1477
- hi: le,
1478
- hr: Ce,
1479
- hu: ze,
1480
- is: Ie,
1481
- it: ce,
1482
- ja: _e,
1483
- ko: he,
1464
+ }, O = {
1465
+ ar: Z,
1466
+ bn: X,
1467
+ bg: Q,
1468
+ cs: ee,
1469
+ da: te,
1470
+ de: ae,
1471
+ el: se,
1472
+ en: oe,
1473
+ es: ne,
1474
+ et: ze,
1475
+ fi: re,
1476
+ fil: ie,
1477
+ fr: le,
1478
+ hi: ce,
1479
+ hr: xe,
1480
+ hu: Ie,
1481
+ is: Pe,
1482
+ it: _e,
1483
+ ja: he,
1484
+ ko: ue,
1484
1485
  lb: Te,
1485
- lt: je,
1486
- lv: Pe,
1487
- mt: Ae,
1488
- nb: Me,
1489
- nl: ue,
1490
- no: de,
1491
- pl: ge,
1492
- pt: me,
1493
- ro: pe,
1494
- ru: be,
1495
- sk: Ee,
1496
- sv: ve,
1497
- th: fe,
1498
- tr: we,
1499
- ur: ye,
1500
- vi: ke,
1501
- "zh-cn": Se
1502
- }, Le = Object.keys(N);
1503
- function De(_) {
1504
- return Le.includes(_);
1486
+ lt: Ae,
1487
+ lv: je,
1488
+ mt: Me,
1489
+ nb: Ee,
1490
+ nl: de,
1491
+ no: ge,
1492
+ pl: me,
1493
+ pt: pe,
1494
+ ro: ve,
1495
+ ru: fe,
1496
+ sk: Le,
1497
+ sv: be,
1498
+ th: we,
1499
+ tr: ye,
1500
+ ur: ke,
1501
+ vi: Se,
1502
+ "zh-cn": Ce
1503
+ }, Ue = Object.keys(O);
1504
+ function Fe(_) {
1505
+ return Ue.includes(_);
1505
1506
  }
1506
- function Ve(_, o, i) {
1507
+ function Be(_, o, i) {
1507
1508
  var l;
1508
- return ((l = i == null ? void 0 : i[o]) == null ? void 0 : l[_]) || N[o][_] || "";
1509
+ return ((l = i == null ? void 0 : i[o]) == null ? void 0 : l[_]) || O[o][_] || "";
1509
1510
  }
1510
1511
  export {
1511
1512
  S as PrimitiveState,
1512
- M as WidgetCtx,
1513
- Ve as getTranslation,
1514
- B as isExhaustive,
1515
- De as isSupportedLanguage
1513
+ E as WidgetCtx,
1514
+ Be as getTranslation,
1515
+ K as isExhaustive,
1516
+ Fe as isSupportedLanguage
1516
1517
  };
1517
1518
  //# sourceMappingURL=index.js.map