@bcc-code/vue-bcc-chat-ui 5.6.1 → 5.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78382,543 +78382,107 @@ function ha() {
78382
78382
  function NS(e) {
78383
78383
  x2 = e, e ? localStorage.setItem(`${Xr().appId}:loginAccessToken`, e) : localStorage.removeItem(`${Xr().appId}:loginAccessToken`);
78384
78384
  }
78385
- var Ch = /* @__PURE__ */ ((e) => (e.DEBUG = "Debug", e.INFO = "Info", e.WARN = "Warn", e.ERROR = "Error", e))(Ch || {});
78386
- const u_ = 1e3, Ym = 32e3;
78387
- var ji, di, El, hu, $o, mh, gu, k2, a1;
78388
- class yat {
78389
- constructor() {
78390
- xi(this, $o);
78391
- xi(this, ji, []);
78392
- xi(this, di);
78393
- xi(this, El);
78394
- xi(this, hu);
78395
- xi(this, gu);
78396
- Va(this, El, window.crypto.randomUUID()), Va(this, di, u_), cr(this, $o, k2).call(this);
78397
- }
78398
- debug(t, r) {
78399
- cr(this, $o, mh).call(this, Ch.DEBUG, t, r);
78400
- }
78401
- info(t, r) {
78402
- cr(this, $o, mh).call(this, Ch.INFO, t, r);
78403
- }
78404
- warn(t, r) {
78405
- cr(this, $o, mh).call(this, Ch.WARN, t, r);
78406
- }
78407
- error(t, r) {
78408
- cr(this, $o, mh).call(this, Ch.ERROR, t, r);
78409
- }
78410
- setCallback(t) {
78411
- Va(this, hu, t);
78412
- }
78413
- ensureLogSendingLoop() {
78414
- (Tr(this, gu) === void 0 || Date.now() - Tr(this, gu) > Ym + 1e3) && cr(this, $o, k2).call(this);
78415
- }
78385
+ function Ci(e) {
78386
+ return Array.isArray ? Array.isArray(e) : s1(e) === "[object Array]";
78416
78387
  }
78417
- ji = new WeakMap(), di = new WeakMap(), El = new WeakMap(), hu = new WeakMap(), $o = new WeakSet(), mh = function(t, r, n) {
78418
- const a = structuredClone(n) ?? {};
78419
- a.chatVersion = "5.6.1";
78420
- const i = {
78421
- logUid: window.crypto.randomUUID(),
78422
- correlationUid: Tr(this, El),
78423
- message: r,
78424
- severity: t,
78425
- userMetadata: a,
78426
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
78427
- };
78428
- if (Tr(this, ji).push(i), Tr(this, hu))
78429
- try {
78430
- Tr(this, hu).call(this, i);
78431
- } catch {
78432
- }
78433
- this.ensureLogSendingLoop();
78434
- }, gu = new WeakMap(), k2 = async function() {
78435
- Va(this, gu, Date.now());
78436
- let t = !1;
78437
- try {
78438
- t = await cr(this, $o, a1).call(this);
78439
- } catch {
78440
- t = !1;
78441
- }
78442
- t ? Va(this, di, u_) : (Va(this, di, Tr(this, di) * 2), Tr(this, di) > Ym && Va(this, di, Ym)), setTimeout(cr(this, $o, k2).bind(this), Tr(this, di));
78443
- }, a1 = async function() {
78444
- if (!Tr(this, ji).length)
78445
- return !0;
78446
- try {
78447
- const t = structuredClone(Tr(this, ji)), r = ha(), n = r ? {
78448
- Authorization: `Bearer ${r}`,
78449
- "X-Logger-Instance-Id": Tr(this, El)
78450
- } : {
78451
- "X-Logger-Instance-Id": Tr(this, El)
78452
- };
78453
- if ((await fetch(`${Xr().chatApiBaseUrl}/chats/logs`, {
78454
- method: "POST",
78455
- headers: n,
78456
- body: JSON.stringify(t)
78457
- })).ok) {
78458
- const i = t.map((l) => l.logUid), o = Tr(this, ji).filter((l) => !i.includes(l.logUid));
78459
- return Va(this, ji, o), !0;
78460
- }
78461
- } catch (t) {
78462
- this.warn("cannot send logs", { error: t });
78463
- }
78464
- return !1;
78465
- };
78466
- const rn = new yat(), i1 = 2e3, Hm = 1e4, Cv = X("online"), DS = X("online"), Vi = Gt({
78467
- get: () => Cv.value,
78468
- set: (e) => {
78469
- Cv.value = e, e === "online" ? s1() : (DS.value = "offline", _at());
78470
- }
78471
- }), mv = Gt(() => {
78472
- switch (Vi.value) {
78473
- case "online":
78474
- return DS.value;
78475
- case "offline":
78476
- return "offline";
78477
- }
78478
- });
78479
- function Ei(e) {
78480
- DS.value = e, e === "offline" && Cv.value === "online" && s1();
78388
+ function yat(e) {
78389
+ if (typeof e == "string")
78390
+ return e;
78391
+ let t = e + "";
78392
+ return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
78481
78393
  }
78482
- let RS, W2 = !1, LS = !1;
78483
- function s1() {
78484
- LS = !1, W2 || (l1(), W2 = !0);
78394
+ function _at(e) {
78395
+ return e == null ? "" : yat(e);
78485
78396
  }
78486
- function _at() {
78487
- LS = !0;
78397
+ function Na(e) {
78398
+ return typeof e == "string";
78488
78399
  }
78489
- function Mat() {
78490
- const e = new AbortController();
78491
- RS("https://app.cometchat.com/", {
78492
- method: "HEAD",
78493
- mode: "no-cors",
78494
- signal: e.signal
78495
- }).catch(() => {
78496
- Ei("offline");
78497
- }), setTimeout(() => {
78498
- e.abort();
78499
- }, i1);
78400
+ function a1(e) {
78401
+ return typeof e == "number";
78500
78402
  }
78501
- function l1() {
78502
- let e = !1;
78503
- const t = new AbortController();
78504
- let r = Date.now();
78505
- RS("https://app.cometchat.com/", {
78506
- method: "HEAD",
78507
- mode: "no-cors",
78508
- signal: t.signal
78509
- }).then(() => {
78510
- e = !0, W2 = !1, Ei("online"), Mat();
78511
- }).catch(() => {
78512
- let n = Date.now();
78513
- if (e = !0, rn.debug("Connection ping failed. Device seems offline."), Ei("offline"), LS) W2 = !1;
78514
- else {
78515
- let a = n - r, i = Hm - a > 0 ? Hm - a : 0;
78516
- window.setTimeout(l1, i);
78517
- }
78518
- }), setTimeout(() => {
78519
- e || (rn.debug("Device seems offline. Ping didn't return within threshold."), Ei("offline"));
78520
- }, i1), setTimeout(() => {
78521
- e || (rn.debug("Ping hang up."), t.abort());
78522
- }, Hm);
78403
+ function Mat(e) {
78404
+ return e === !0 || e === !1 || bat(e) && s1(e) == "[object Boolean]";
78405
+ }
78406
+ function i1(e) {
78407
+ return typeof e == "object";
78523
78408
  }
78524
78409
  function bat(e) {
78525
- RS = e, Vi.value = window.navigator.onLine ? "online" : "offline", window.addEventListener("online", () => {
78526
- Vi.value = "online";
78527
- }), window.addEventListener("offline", () => {
78528
- Vi.value = "offline";
78529
- });
78410
+ return i1(e) && e !== null;
78530
78411
  }
78531
- let c_ = !1;
78532
- const pi = /* @__PURE__ */ new Map();
78533
- function Oat(e) {
78534
- return Array.from(pi.values()).filter((a) => {
78535
- let i = a.message.getReceiver();
78536
- return (typeof i == "string" ? i : i instanceof ee.User ? i.getUid() : i.getGuid()) === e;
78537
- }).map((a) => {
78538
- const i = a.message, o = i.getData() || {};
78539
- return o.entities = o.entities || {}, o.entities.sender = o.entities.sender || a.message.getSender(), o.entities.sender.entityType = "user", i.setData(o), i;
78540
- });
78412
+ function Fo(e) {
78413
+ return e != null;
78541
78414
  }
78542
- function Nat() {
78543
- c_ || (c_ = !0, g.CometChatMessageEvents.ccMessageSent.subscribe(Dat));
78415
+ function Ym(e) {
78416
+ return !e.trim().length;
78544
78417
  }
78545
- async function Dat({ message: e, status: t }) {
78546
- if (t === g.MessageStatus.inprogress) {
78547
- pi.set(e.getMuid(), {
78548
- message: e,
78549
- msgMetadata: e.getMetadata(),
78550
- sentTime: /* @__PURE__ */ new Date()
78418
+ function s1(e) {
78419
+ return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
78420
+ }
78421
+ const Oat = "Incorrect 'index' type", Nat = (e) => `Invalid value for key ${e}`, Dat = (e) => `Pattern length exceeds max of ${e}.`, Rat = (e) => `Missing ${e} property in key`, Lat = (e) => `Property 'weight' in key '${e}' must be a positive integer`, u_ = Object.prototype.hasOwnProperty;
78422
+ class wat {
78423
+ constructor(t) {
78424
+ this._keys = [], this._keyMap = {};
78425
+ let r = 0;
78426
+ t.forEach((n) => {
78427
+ let a = l1(n);
78428
+ this._keys.push(a), this._keyMap[a.id] = a, r += a.weight;
78429
+ }), this._keys.forEach((n) => {
78430
+ n.weight /= r;
78551
78431
  });
78552
- return;
78553
78432
  }
78554
- if (t === g.MessageStatus.success) {
78555
- u1(e);
78556
- return;
78433
+ get(t) {
78434
+ return this._keyMap[t];
78435
+ }
78436
+ keys() {
78437
+ return this._keys;
78438
+ }
78439
+ toJSON() {
78440
+ return JSON.stringify(this._keys);
78557
78441
  }
78558
- const r = Rat(e.getMuid());
78559
- r && e.setMetadata(r.msgMetadata), await wS();
78560
78442
  }
78561
- function u1(e) {
78562
- const t = e.getMuid();
78563
- pi.delete(t), pi.forEach((r, n) => {
78564
- r.message.getMuid() === t && pi.delete(n);
78565
- });
78443
+ function l1(e) {
78444
+ let t = null, r = null, n = null, a = 1, i = null;
78445
+ if (Na(e) || Ci(e))
78446
+ n = e, t = c_(e), r = Cv(e);
78447
+ else {
78448
+ if (!u_.call(e, "name"))
78449
+ throw new Error(Rat("name"));
78450
+ const o = e.name;
78451
+ if (n = o, u_.call(e, "weight") && (a = e.weight, a <= 0))
78452
+ throw new Error(Lat(o));
78453
+ t = c_(o), r = Cv(o), i = e.getFn;
78454
+ }
78455
+ return { path: t, id: r, weight: a, src: n, getFn: i };
78566
78456
  }
78567
- function Rat(e) {
78568
- const t = pi.get(e);
78569
- if (t)
78570
- return t;
78571
- for (const [r, n] of pi)
78572
- if (n.message && n.message.getMuid() === e)
78573
- return n;
78574
- return null;
78457
+ function c_(e) {
78458
+ return Ci(e) ? e : e.split(".");
78575
78459
  }
78576
- const Lat = 1e4, wat = 45e3, c1 = 1e3, xat = Date.now();
78577
- let T2 = 0, lu = !1, d_ = setTimeout(wS, c1);
78578
- async function wS() {
78579
- if (clearTimeout(d_), d_ = setTimeout(wS, c1), !lu) {
78580
- if (jn.onlineMode.value == "offline") {
78581
- T2 = 0;
78582
- return;
78583
- } else
78584
- T2 === 0 && (T2 = Date.now());
78585
- lu = !0;
78586
- try {
78587
- if (pi.size === 0) return;
78588
- const e = Array.from(pi.values());
78589
- e.sort((t, r) => t.sentTime > r.sentTime ? 1 : -1);
78590
- for (const t of e) {
78591
- const r = t.message, n = r.getType(), a = Date.now() - Math.max(T2, t.sentTime.getTime());
78592
- if (n === ee.CometChat.MESSAGE_TYPE.TEXT && a < Lat) {
78593
- lu = !1;
78594
- return;
78595
- } else if (n !== ee.CometChat.MESSAGE_TYPE.TEXT && a < wat) {
78596
- lu = !1;
78597
- return;
78598
- }
78599
- let i = r.getReceiver(), o = typeof i == "string" ? i : i instanceof ee.User ? i.getUid() : i.getGuid();
78600
- r.setReceiverId(o);
78601
- const s = await new ee.CometChat.MessagesRequestBuilder().setTags([r.getMuid()]).setGUID(o).setTimestamp(xat).setLimit(1).build().fetchPrevious();
78602
- if (s.length === 1 && s[0].getMuid() === r.getMuid()) {
78603
- u1(r), g.CometChatMessageEvents.ccMessageSent.next({
78604
- message: s[0],
78605
- status: g.MessageStatus.success
78606
- }), lu = !1;
78460
+ function Cv(e) {
78461
+ return Ci(e) ? e.join(".") : e;
78462
+ }
78463
+ function xat(e, t) {
78464
+ let r = [], n = !1;
78465
+ const a = (i, o, l) => {
78466
+ if (Fo(i))
78467
+ if (!o[l])
78468
+ r.push(i);
78469
+ else {
78470
+ let s = o[l];
78471
+ const u = i[s];
78472
+ if (!Fo(u))
78607
78473
  return;
78608
- }
78609
- const u = await ee.CometChat.sendMessage(r);
78610
- g.CometChatMessageEvents.ccMessageSent.next({
78611
- message: u,
78612
- status: g.MessageStatus.success
78613
- });
78474
+ if (l === o.length - 1 && (Na(u) || a1(u) || Mat(u)))
78475
+ r.push(_at(u));
78476
+ else if (Ci(u)) {
78477
+ n = !0;
78478
+ for (let d = 0, h = u.length; d < h; d += 1)
78479
+ a(u[d], o, l + 1);
78480
+ } else o.length && a(u, o, l + 1);
78614
78481
  }
78615
- } finally {
78616
- lu = !1;
78617
- }
78618
- }
78482
+ };
78483
+ return a(e, Na(t) ? t.split(".") : t, 0), n ? r : r[0];
78619
78484
  }
78620
- const kat = /^[0-9a-f]+\.apiclient-[a-z]+\.cometchat\.io$/, jo = {
78621
- groupMessages: /^\/v3\.0\/groups\/(?<groupId>[^\/]+)\/messages\/?$/,
78622
- threadMessages: /^\/v3\.0\/messages\/(?<messageId>[^\/]+)\/thread\/?$/,
78623
- message: /^\/v3\.0\/messages\/(?<messageId>[^\/]+)\/?$/,
78624
- conversations: /^\/v3\.0\/conversations\/?$/,
78625
- group: /^\/v3\.0\/groups\/(?<groupId>[^\/]+)\/?$/
78626
- };
78627
- function h_(e, t) {
78628
- return async function(r, n) {
78629
- let a = Uat(r, n);
78630
- if (a.url.host === "metrics-eu.cometchat.io") try {
78631
- const o = await e(r, n);
78632
- return Ei("online"), o;
78633
- } catch (o) {
78634
- throw Ei("offline"), o;
78635
- }
78636
- if (a.method !== "GET" || !kat.test(a.url.host) || a.url.pathname.match(jo.groupMessages) && a.query.tags)
78637
- return e(r, n);
78638
- if (Vi.value === "offline")
78639
- return g_(a, t);
78640
- let i;
78641
- if (i = a.url.pathname.match(jo.groupMessages)) {
78642
- let o = i.groups.groupId, l = await y1(o), s = a.url.search;
78643
- if ((l == null ? void 0 : l.getMetadata()).isChannel && !(l != null && l.getHasJoined()) && jn.getGroupMessages.value === void 0)
78644
- n = n || {}, r = Xr().chatApiBaseUrl + "/chats/messages/" + o + s, n.headers = {
78645
- "Content-Type": "application/json",
78646
- Authorization: `Bearer ${ha()}`
78647
- };
78648
- else if (jn.getGroupMessages.value && !(l != null && l.getHasJoined()))
78649
- try {
78650
- let u = await jn.getGroupMessages.value(o, s);
78651
- return new Response(JSON.stringify(u));
78652
- } catch (u) {
78653
- throw rn.error('"Failed to execute groupMessagesGetter function: ', { error: u }), u;
78654
- }
78655
- }
78656
- try {
78657
- const o = await e(r, n);
78658
- Ei("online");
78659
- let l;
78660
- try {
78661
- l = await o.clone().json();
78662
- } catch {
78663
- return o;
78664
- }
78665
- if (l.data)
78666
- try {
78667
- jo.groupMessages.test(a.url.pathname) || jo.threadMessages.test(a.url.pathname) ? t.saveMessages(l.data) : jo.message.test(a.url.pathname) ? t.saveMessages([l.data]) : jo.conversations.test(a.url.pathname) ? t.saveConversations(l.data) : jo.group.test(a.url.pathname) && t.saveGroup(l.data);
78668
- } catch (s) {
78669
- rn.error("error saving request response: ", { error: s });
78670
- }
78671
- if (jn.loadMessageId.value && jo.groupMessages.test(a.url.pathname)) {
78672
- try {
78673
- const s = jn.loadMessageId.value;
78674
- let u = l.data, d = 1, h = l.meta.pagination.total_pages;
78675
- for (; h != d && !u.find((m) => m.id === s); ) {
78676
- const E = await (await e(r + `&id=${l.data[0].id}&sentAt=${l.data[0].sentAt}`, n)).json();
78677
- u = E.data.concat(u), l.data = u, h = E.meta.pagination.total_pages, d = E.meta.pagination.current_page;
78678
- }
78679
- } catch (s) {
78680
- return jn.loadMessageId.value = void 0, rn.error("Error fetching additional messages", { fetchError: s }), o;
78681
- }
78682
- return jn.scrollToMessageId.value = jn.loadMessageId.value, jn.loadMessageId.value = void 0, new Response(JSON.stringify(l));
78683
- }
78684
- return o;
78685
- } catch {
78686
- return Ei("offline"), g_(a, t);
78687
- }
78688
- };
78689
- }
78690
- function g_(e, t) {
78691
- let r, n;
78692
- if (r = e.url.pathname.match(jo.groupMessages)) {
78693
- let i = {
78694
- per_page: parseInt(e.query.per_page || "30", 10),
78695
- affix: e.query.affix,
78696
- id: e.query.id,
78697
- sent_at: e.query.sentAt ? parseInt(e.query.sentAt, 10) : void 0
78698
- };
78699
- if (!e.query.unread || e.query.unread !== "1") {
78700
- const o = t.getGroupMessages(r.groups.groupId, i), l = r.groups.groupId, s = Oat(l) || [], u = o.data || [];
78701
- for (var a = 0; a < s.length; a++) {
78702
- const d = s[a];
78703
- u.push(d);
78704
- }
78705
- n = {
78706
- data: [...u],
78707
- meta: {
78708
- pagination: {
78709
- total: o.total,
78710
- count: o.data.length,
78711
- per_page: i.per_page,
78712
- current_page: 1,
78713
- total_pages: o.data.length < i.per_page ? 1 : 2
78714
- },
78715
- cursor: {
78716
- sentAt: i.sent_at || (o.data && o.data.length > 0 ? o.data.slice(-1)[0].sentAt : null),
78717
- id: i.id || (o.data && o.data.length > 0 ? o.data.slice(-1)[0].id : null),
78718
- affix: i.affix
78719
- }
78720
- }
78721
- };
78722
- } else
78723
- n = {
78724
- data: [],
78725
- meta: {
78726
- pagination: {
78727
- total: 0,
78728
- count: 0,
78729
- per_page: i.per_page,
78730
- current_page: 1,
78731
- total_pages: 1
78732
- }
78733
- }
78734
- };
78735
- } else if (r = e.url.pathname.match(jo.threadMessages)) {
78736
- let i = {
78737
- per_page: parseInt(e.query.per_page || "30", 10),
78738
- affix: e.query.affix,
78739
- id: e.query.id,
78740
- sent_at: e.query.sentAt ? parseInt(e.query.sentAt, 10) : void 0
78741
- };
78742
- const o = t.getThreadMessages(r.groups.messageId, i);
78743
- n = {
78744
- data: o.data,
78745
- meta: {
78746
- pagination: {
78747
- total: o.total,
78748
- count: o.data.length,
78749
- per_page: i.per_page,
78750
- current_page: 1,
78751
- total_pages: o.data.length < i.per_page ? 1 : 2
78752
- },
78753
- cursor: {
78754
- sentAt: i.sent_at || (o.data && o.data.length > 0 ? o.data.slice(-1)[0].sentAt : null),
78755
- id: i.id || (o.data && o.data.length > 0 ? o.data.slice(-1)[0].id : null),
78756
- affix: i.affix
78757
- }
78758
- }
78759
- };
78760
- } else if (r = e.url.pathname.match(jo.message))
78761
- n = {
78762
- data: t.getMessage(r.groups.messageId).data
78763
- };
78764
- else if (r = e.url.pathname.match(jo.conversations)) {
78765
- let i = {
78766
- per_page: parseInt(e.query.per_page || "30", 10),
78767
- page: parseInt(e.query.page || "1", 10)
78768
- }, o = t.getConversations(i);
78769
- n = {
78770
- data: o.data,
78771
- meta: {
78772
- pagination: {
78773
- total: o.total,
78774
- count: o.data.length,
78775
- per_page: i.per_page,
78776
- current_page: i.page,
78777
- total_pages: o.data.length < i.per_page ? 1 : 2
78778
- }
78779
- }
78780
- };
78781
- } else (r = e.url.pathname.match(jo.group)) && (t.getGroup(r.groups.groupId) === null ? n = {
78782
- error: {
78783
- message: `The group with guid ${r.groups.groupId} does found in cache. `,
78784
- devMessage: `The group with GUID ${r.groups.groupId} does not exist in cache.`,
78785
- source: "chat-api",
78786
- code: "ERR_GUID_NOT_FOUND_IN_CACHE"
78787
- }
78788
- } : n = {
78789
- data: t.getGroup(r.groups.groupId)
78790
- });
78791
- return new Response(JSON.stringify(n));
78792
- }
78793
- function Uat(e, t) {
78794
- var a;
78795
- let r;
78796
- typeof e == "string" ? r = new URL(e) : e instanceof URL && (r = e);
78797
- const n = {
78798
- url: r,
78799
- query: {},
78800
- // Query parameters
78801
- method: ((a = t == null ? void 0 : t.method) == null ? void 0 : a.toUpperCase()) || "GET"
78802
- // HTTP method
78803
- };
78804
- return r.searchParams.forEach((i, o) => {
78805
- n.query[o] = i;
78806
- }), n;
78807
- }
78808
- function Pat(e, t) {
78809
- return function(r) {
78810
- if (e === null) return;
78811
- Ei("online");
78812
- let n;
78813
- try {
78814
- n = JSON.parse(r.data);
78815
- } catch {
78816
- return e.call(this, r);
78817
- }
78818
- return n.type === "message" && t.saveMessages([n.body]), e.call(this, r);
78819
- };
78820
- }
78821
- function Ci(e) {
78822
- return Array.isArray ? Array.isArray(e) : g1(e) === "[object Array]";
78823
- }
78824
- function Bat(e) {
78825
- if (typeof e == "string")
78826
- return e;
78827
- let t = e + "";
78828
- return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
78829
- }
78830
- function Gat(e) {
78831
- return e == null ? "" : Bat(e);
78832
- }
78833
- function Na(e) {
78834
- return typeof e == "string";
78835
- }
78836
- function d1(e) {
78837
- return typeof e == "number";
78838
- }
78839
- function jat(e) {
78840
- return e === !0 || e === !1 || Fat(e) && g1(e) == "[object Boolean]";
78841
- }
78842
- function h1(e) {
78843
- return typeof e == "object";
78844
- }
78845
- function Fat(e) {
78846
- return h1(e) && e !== null;
78847
- }
78848
- function Fo(e) {
78849
- return e != null;
78850
- }
78851
- function Km(e) {
78852
- return !e.trim().length;
78853
- }
78854
- function g1(e) {
78855
- return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
78856
- }
78857
- const zat = "Incorrect 'index' type", $at = (e) => `Invalid value for key ${e}`, Vat = (e) => `Pattern length exceeds max of ${e}.`, Yat = (e) => `Missing ${e} property in key`, Hat = (e) => `Property 'weight' in key '${e}' must be a positive integer`, E_ = Object.prototype.hasOwnProperty;
78858
- class Kat {
78859
- constructor(t) {
78860
- this._keys = [], this._keyMap = {};
78861
- let r = 0;
78862
- t.forEach((n) => {
78863
- let a = E1(n);
78864
- this._keys.push(a), this._keyMap[a.id] = a, r += a.weight;
78865
- }), this._keys.forEach((n) => {
78866
- n.weight /= r;
78867
- });
78868
- }
78869
- get(t) {
78870
- return this._keyMap[t];
78871
- }
78872
- keys() {
78873
- return this._keys;
78874
- }
78875
- toJSON() {
78876
- return JSON.stringify(this._keys);
78877
- }
78878
- }
78879
- function E1(e) {
78880
- let t = null, r = null, n = null, a = 1, i = null;
78881
- if (Na(e) || Ci(e))
78882
- n = e, t = p_(e), r = vv(e);
78883
- else {
78884
- if (!E_.call(e, "name"))
78885
- throw new Error(Yat("name"));
78886
- const o = e.name;
78887
- if (n = o, E_.call(e, "weight") && (a = e.weight, a <= 0))
78888
- throw new Error(Hat(o));
78889
- t = p_(o), r = vv(o), i = e.getFn;
78890
- }
78891
- return { path: t, id: r, weight: a, src: n, getFn: i };
78892
- }
78893
- function p_(e) {
78894
- return Ci(e) ? e : e.split(".");
78895
- }
78896
- function vv(e) {
78897
- return Ci(e) ? e.join(".") : e;
78898
- }
78899
- function Wat(e, t) {
78900
- let r = [], n = !1;
78901
- const a = (i, o, l) => {
78902
- if (Fo(i))
78903
- if (!o[l])
78904
- r.push(i);
78905
- else {
78906
- let s = o[l];
78907
- const u = i[s];
78908
- if (!Fo(u))
78909
- return;
78910
- if (l === o.length - 1 && (Na(u) || d1(u) || jat(u)))
78911
- r.push(Gat(u));
78912
- else if (Ci(u)) {
78913
- n = !0;
78914
- for (let d = 0, h = u.length; d < h; d += 1)
78915
- a(u[d], o, l + 1);
78916
- } else o.length && a(u, o, l + 1);
78917
- }
78918
- };
78919
- return a(e, Na(t) ? t.split(".") : t, 0), n ? r : r[0];
78920
- }
78921
- const Qat = {
78485
+ const kat = {
78922
78486
  // Whether the matches should be included in the result set. When `true`, each record in the result
78923
78487
  // set will include the indices of the matched characters.
78924
78488
  // These can consequently be used for highlighting purposes.
@@ -78928,7 +78492,7 @@ const Qat = {
78928
78492
  findAllMatches: !1,
78929
78493
  // Minimum number of characters that must be matched before a result is considered a match
78930
78494
  minMatchCharLength: 1
78931
- }, Jat = {
78495
+ }, Uat = {
78932
78496
  // When `true`, the algorithm continues searching to the end of the input even if a perfect
78933
78497
  // match is found before the end of the same input.
78934
78498
  isCaseSensitive: !1,
@@ -78942,7 +78506,7 @@ const Qat = {
78942
78506
  shouldSort: !0,
78943
78507
  // Default sort function: sort by ascending score, ascending index
78944
78508
  sortFn: (e, t) => e.score === t.score ? e.idx < t.idx ? -1 : 1 : e.score < t.score ? -1 : 1
78945
- }, qat = {
78509
+ }, Pat = {
78946
78510
  // Approximately where in the text is the pattern expected to be found?
78947
78511
  location: 0,
78948
78512
  // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
@@ -78954,12 +78518,12 @@ const Qat = {
78954
78518
  // the exact location specified, a threshold of '1000' would require a perfect match
78955
78519
  // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
78956
78520
  distance: 100
78957
- }, Zat = {
78521
+ }, Bat = {
78958
78522
  // When `true`, it enables the use of unix-like search commands
78959
78523
  useExtendedSearch: !1,
78960
78524
  // The get function to use when fetching an object's properties.
78961
78525
  // The default will search nested paths *ie foo.bar.baz*
78962
- getFn: Wat,
78526
+ getFn: xat,
78963
78527
  // When `true`, search will ignore `location` and `distance`, so it won't matter
78964
78528
  // where in the string the pattern appears.
78965
78529
  // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
@@ -78972,17 +78536,17 @@ const Qat = {
78972
78536
  fieldNormWeight: 1
78973
78537
  };
78974
78538
  var An = {
78975
- ...Jat,
78976
- ...Qat,
78977
- ...qat,
78978
- ...Zat
78539
+ ...Uat,
78540
+ ...kat,
78541
+ ...Pat,
78542
+ ...Bat
78979
78543
  };
78980
- const Xat = /[^ ]+/g;
78981
- function eit(e = 1, t = 3) {
78544
+ const Gat = /[^ ]+/g;
78545
+ function jat(e = 1, t = 3) {
78982
78546
  const r = /* @__PURE__ */ new Map(), n = Math.pow(10, t);
78983
78547
  return {
78984
78548
  get(a) {
78985
- const i = a.match(Xat).length;
78549
+ const i = a.match(Gat).length;
78986
78550
  if (r.has(i))
78987
78551
  return r.get(i);
78988
78552
  const o = 1 / Math.pow(i, 0.5 * e), l = parseFloat(Math.round(o * n) / n);
@@ -78993,12 +78557,12 @@ function eit(e = 1, t = 3) {
78993
78557
  }
78994
78558
  };
78995
78559
  }
78996
- class xS {
78560
+ class DS {
78997
78561
  constructor({
78998
78562
  getFn: t = An.getFn,
78999
78563
  fieldNormWeight: r = An.fieldNormWeight
79000
78564
  } = {}) {
79001
- this.norm = eit(r, 3), this.getFn = t, this.isCreated = !1, this.setIndexRecords();
78565
+ this.norm = jat(r, 3), this.getFn = t, this.isCreated = !1, this.setIndexRecords();
79002
78566
  }
79003
78567
  setSources(t = []) {
79004
78568
  this.docs = t;
@@ -79036,7 +78600,7 @@ class xS {
79036
78600
  return this.records.length;
79037
78601
  }
79038
78602
  _addString(t, r) {
79039
- if (!Fo(t) || Km(t))
78603
+ if (!Fo(t) || Ym(t))
79040
78604
  return;
79041
78605
  let n = {
79042
78606
  v: t,
@@ -79056,7 +78620,7 @@ class xS {
79056
78620
  for (; s.length; ) {
79057
78621
  const { nestedArrIndex: u, value: d } = s.pop();
79058
78622
  if (Fo(d))
79059
- if (Na(d) && !Km(d)) {
78623
+ if (Na(d) && !Ym(d)) {
79060
78624
  let h = {
79061
78625
  v: d,
79062
78626
  i: u,
@@ -79071,7 +78635,7 @@ class xS {
79071
78635
  });
79072
78636
  }
79073
78637
  n.$[i] = l;
79074
- } else if (Na(o) && !Km(o)) {
78638
+ } else if (Na(o) && !Ym(o)) {
79075
78639
  let l = {
79076
78640
  v: o,
79077
78641
  n: this.norm.get(o)
@@ -79088,15 +78652,15 @@ class xS {
79088
78652
  };
79089
78653
  }
79090
78654
  }
79091
- function p1(e, t, { getFn: r = An.getFn, fieldNormWeight: n = An.fieldNormWeight } = {}) {
79092
- const a = new xS({ getFn: r, fieldNormWeight: n });
79093
- return a.setKeys(e.map(E1)), a.setSources(t), a.create(), a;
78655
+ function u1(e, t, { getFn: r = An.getFn, fieldNormWeight: n = An.fieldNormWeight } = {}) {
78656
+ const a = new DS({ getFn: r, fieldNormWeight: n });
78657
+ return a.setKeys(e.map(l1)), a.setSources(t), a.create(), a;
79094
78658
  }
79095
- function tit(e, { getFn: t = An.getFn, fieldNormWeight: r = An.fieldNormWeight } = {}) {
79096
- const { keys: n, records: a } = e, i = new xS({ getFn: t, fieldNormWeight: r });
78659
+ function Fat(e, { getFn: t = An.getFn, fieldNormWeight: r = An.fieldNormWeight } = {}) {
78660
+ const { keys: n, records: a } = e, i = new DS({ getFn: t, fieldNormWeight: r });
79097
78661
  return i.setKeys(n), i.setIndexRecords(a), i;
79098
78662
  }
79099
- function y2(e, {
78663
+ function T2(e, {
79100
78664
  errors: t = 0,
79101
78665
  currentLocation: r = 0,
79102
78666
  expectedLocation: n = 0,
@@ -79109,7 +78673,7 @@ function y2(e, {
79109
78673
  const l = Math.abs(n - r);
79110
78674
  return a ? o + l / a : l ? 1 : o;
79111
78675
  }
79112
- function nit(e = [], t = An.minMatchCharLength) {
78676
+ function zat(e = [], t = An.minMatchCharLength) {
79113
78677
  let r = [], n = -1, a = -1, i = 0;
79114
78678
  for (let o = e.length; i < o; i += 1) {
79115
78679
  let l = e[i];
@@ -79118,7 +78682,7 @@ function nit(e = [], t = An.minMatchCharLength) {
79118
78682
  return e[i - 1] && i - n >= t && r.push([n, i - 1]), r;
79119
78683
  }
79120
78684
  const ll = 32;
79121
- function rit(e, t, r, {
78685
+ function $at(e, t, r, {
79122
78686
  location: n = An.location,
79123
78687
  distance: a = An.distance,
79124
78688
  threshold: i = An.threshold,
@@ -79128,13 +78692,13 @@ function rit(e, t, r, {
79128
78692
  ignoreLocation: u = An.ignoreLocation
79129
78693
  } = {}) {
79130
78694
  if (t.length > ll)
79131
- throw new Error(Vat(ll));
78695
+ throw new Error(Dat(ll));
79132
78696
  const d = t.length, h = e.length, C = Math.max(0, Math.min(n, h));
79133
78697
  let E = i, m = C;
79134
78698
  const A = l > 1 || s, S = A ? Array(h) : [];
79135
78699
  let T;
79136
78700
  for (; (T = e.indexOf(t, m)) > -1; ) {
79137
- let b = y2(t, {
78701
+ let b = T2(t, {
79138
78702
  currentLocation: T,
79139
78703
  expectedLocation: C,
79140
78704
  distance: a,
@@ -79152,7 +78716,7 @@ function rit(e, t, r, {
79152
78716
  for (let b = 0; b < d; b += 1) {
79153
78717
  let P = 0, z = N;
79154
78718
  for (; P < z; )
79155
- y2(t, {
78719
+ T2(t, {
79156
78720
  errors: b,
79157
78721
  currentLocation: C + z,
79158
78722
  expectedLocation: C,
@@ -79164,7 +78728,7 @@ function rit(e, t, r, {
79164
78728
  se[oe + 1] = (1 << b) - 1;
79165
78729
  for (let Ee = oe; Ee >= W; Ee -= 1) {
79166
78730
  let pe = Ee - 1, de = r[e.charAt(pe)];
79167
- if (A && (S[pe] = +!!de), se[Ee] = (se[Ee + 1] << 1 | 1) & de, b && (se[Ee] |= (y[Ee + 1] | y[Ee]) << 1 | 1 | y[Ee + 1]), se[Ee] & L && (p = y2(t, {
78731
+ if (A && (S[pe] = +!!de), se[Ee] = (se[Ee + 1] << 1 | 1) & de, b && (se[Ee] |= (y[Ee + 1] | y[Ee]) << 1 | 1 | y[Ee + 1]), se[Ee] & L && (p = T2(t, {
79168
78732
  errors: b,
79169
78733
  currentLocation: pe,
79170
78734
  expectedLocation: C,
@@ -79176,7 +78740,7 @@ function rit(e, t, r, {
79176
78740
  W = Math.max(1, 2 * C - m);
79177
78741
  }
79178
78742
  }
79179
- if (y2(t, {
78743
+ if (T2(t, {
79180
78744
  errors: b + 1,
79181
78745
  currentLocation: C,
79182
78746
  expectedLocation: C,
@@ -79192,12 +78756,12 @@ function rit(e, t, r, {
79192
78756
  score: Math.max(1e-3, p)
79193
78757
  };
79194
78758
  if (A) {
79195
- const b = nit(S, l);
78759
+ const b = zat(S, l);
79196
78760
  b.length ? s && (R.indices = b) : R.isMatch = !1;
79197
78761
  }
79198
78762
  return R;
79199
78763
  }
79200
- function oit(e) {
78764
+ function Vat(e) {
79201
78765
  let t = {};
79202
78766
  for (let r = 0, n = e.length; r < n; r += 1) {
79203
78767
  const a = e.charAt(r);
@@ -79205,8 +78769,8 @@ function oit(e) {
79205
78769
  }
79206
78770
  return t;
79207
78771
  }
79208
- const Q2 = String.prototype.normalize ? (e) => e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "") : (e) => e;
79209
- class C1 {
78772
+ const W2 = String.prototype.normalize ? (e) => e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "") : (e) => e;
78773
+ class c1 {
79210
78774
  constructor(t, {
79211
78775
  location: r = An.location,
79212
78776
  threshold: n = An.threshold,
@@ -79228,12 +78792,12 @@ class C1 {
79228
78792
  isCaseSensitive: s,
79229
78793
  ignoreDiacritics: u,
79230
78794
  ignoreLocation: d
79231
- }, t = s ? t : t.toLowerCase(), t = u ? Q2(t) : t, this.pattern = t, this.chunks = [], !this.pattern.length)
78795
+ }, t = s ? t : t.toLowerCase(), t = u ? W2(t) : t, this.pattern = t, this.chunks = [], !this.pattern.length)
79232
78796
  return;
79233
78797
  const h = (E, m) => {
79234
78798
  this.chunks.push({
79235
78799
  pattern: E,
79236
- alphabet: oit(E),
78800
+ alphabet: Vat(E),
79237
78801
  startIndex: m
79238
78802
  });
79239
78803
  }, C = this.pattern.length;
@@ -79251,7 +78815,7 @@ class C1 {
79251
78815
  }
79252
78816
  searchIn(t) {
79253
78817
  const { isCaseSensitive: r, ignoreDiacritics: n, includeMatches: a } = this.options;
79254
- if (t = r ? t : t.toLowerCase(), t = n ? Q2(t) : t, this.pattern === t) {
78818
+ if (t = r ? t : t.toLowerCase(), t = n ? W2(t) : t, this.pattern === t) {
79255
78819
  let A = {
79256
78820
  isMatch: !0,
79257
78821
  score: 0
@@ -79268,7 +78832,7 @@ class C1 {
79268
78832
  } = this.options;
79269
78833
  let h = [], C = 0, E = !1;
79270
78834
  this.chunks.forEach(({ pattern: A, alphabet: S, startIndex: T }) => {
79271
- const { isMatch: y, score: p, indices: N } = rit(t, A, S, {
78835
+ const { isMatch: y, score: p, indices: N } = $at(t, A, S, {
79272
78836
  location: i + T,
79273
78837
  distance: o,
79274
78838
  threshold: l,
@@ -79291,19 +78855,19 @@ class Zi {
79291
78855
  this.pattern = t;
79292
78856
  }
79293
78857
  static isMultiMatch(t) {
79294
- return C_(t, this.multiRegex);
78858
+ return d_(t, this.multiRegex);
79295
78859
  }
79296
78860
  static isSingleMatch(t) {
79297
- return C_(t, this.singleRegex);
78861
+ return d_(t, this.singleRegex);
79298
78862
  }
79299
78863
  search() {
79300
78864
  }
79301
78865
  }
79302
- function C_(e, t) {
78866
+ function d_(e, t) {
79303
78867
  const r = e.match(t);
79304
78868
  return r ? r[1] : null;
79305
78869
  }
79306
- class ait extends Zi {
78870
+ class Yat extends Zi {
79307
78871
  constructor(t) {
79308
78872
  super(t);
79309
78873
  }
@@ -79325,7 +78889,7 @@ class ait extends Zi {
79325
78889
  };
79326
78890
  }
79327
78891
  }
79328
- class iit extends Zi {
78892
+ class Hat extends Zi {
79329
78893
  constructor(t) {
79330
78894
  super(t);
79331
78895
  }
@@ -79347,7 +78911,7 @@ class iit extends Zi {
79347
78911
  };
79348
78912
  }
79349
78913
  }
79350
- class sit extends Zi {
78914
+ class Kat extends Zi {
79351
78915
  constructor(t) {
79352
78916
  super(t);
79353
78917
  }
@@ -79369,7 +78933,7 @@ class sit extends Zi {
79369
78933
  };
79370
78934
  }
79371
78935
  }
79372
- class lit extends Zi {
78936
+ class Wat extends Zi {
79373
78937
  constructor(t) {
79374
78938
  super(t);
79375
78939
  }
@@ -79391,7 +78955,7 @@ class lit extends Zi {
79391
78955
  };
79392
78956
  }
79393
78957
  }
79394
- class uit extends Zi {
78958
+ class Qat extends Zi {
79395
78959
  constructor(t) {
79396
78960
  super(t);
79397
78961
  }
@@ -79413,7 +78977,7 @@ class uit extends Zi {
79413
78977
  };
79414
78978
  }
79415
78979
  }
79416
- class cit extends Zi {
78980
+ class Jat extends Zi {
79417
78981
  constructor(t) {
79418
78982
  super(t);
79419
78983
  }
@@ -79435,7 +78999,7 @@ class cit extends Zi {
79435
78999
  };
79436
79000
  }
79437
79001
  }
79438
- class m1 extends Zi {
79002
+ class d1 extends Zi {
79439
79003
  constructor(t, {
79440
79004
  location: r = An.location,
79441
79005
  threshold: n = An.threshold,
@@ -79447,7 +79011,7 @@ class m1 extends Zi {
79447
79011
  ignoreDiacritics: u = An.ignoreDiacritics,
79448
79012
  ignoreLocation: d = An.ignoreLocation
79449
79013
  } = {}) {
79450
- super(t), this._bitapSearch = new C1(t, {
79014
+ super(t), this._bitapSearch = new c1(t, {
79451
79015
  location: r,
79452
79016
  threshold: n,
79453
79017
  distance: a,
@@ -79472,7 +79036,7 @@ class m1 extends Zi {
79472
79036
  return this._bitapSearch.searchIn(t);
79473
79037
  }
79474
79038
  }
79475
- class v1 extends Zi {
79039
+ class h1 extends Zi {
79476
79040
  constructor(t) {
79477
79041
  super(t);
79478
79042
  }
@@ -79498,30 +79062,30 @@ class v1 extends Zi {
79498
79062
  };
79499
79063
  }
79500
79064
  }
79501
- const Sv = [
79502
- ait,
79503
- v1,
79504
- sit,
79505
- lit,
79506
- cit,
79507
- uit,
79508
- iit,
79509
- m1
79510
- ], m_ = Sv.length, dit = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, hit = "|";
79511
- function git(e, t = {}) {
79512
- return e.split(hit).map((r) => {
79513
- let n = r.trim().split(dit).filter((i) => i && !!i.trim()), a = [];
79065
+ const mv = [
79066
+ Yat,
79067
+ h1,
79068
+ Kat,
79069
+ Wat,
79070
+ Jat,
79071
+ Qat,
79072
+ Hat,
79073
+ d1
79074
+ ], h_ = mv.length, qat = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, Zat = "|";
79075
+ function Xat(e, t = {}) {
79076
+ return e.split(Zat).map((r) => {
79077
+ let n = r.trim().split(qat).filter((i) => i && !!i.trim()), a = [];
79514
79078
  for (let i = 0, o = n.length; i < o; i += 1) {
79515
79079
  const l = n[i];
79516
79080
  let s = !1, u = -1;
79517
- for (; !s && ++u < m_; ) {
79518
- const d = Sv[u];
79081
+ for (; !s && ++u < h_; ) {
79082
+ const d = mv[u];
79519
79083
  let h = d.isMultiMatch(l);
79520
79084
  h && (a.push(new d(h, t)), s = !0);
79521
79085
  }
79522
79086
  if (!s)
79523
- for (u = -1; ++u < m_; ) {
79524
- const d = Sv[u];
79087
+ for (u = -1; ++u < h_; ) {
79088
+ const d = mv[u];
79525
79089
  let h = d.isSingleMatch(l);
79526
79090
  if (h) {
79527
79091
  a.push(new d(h, t));
@@ -79532,8 +79096,8 @@ function git(e, t = {}) {
79532
79096
  return a;
79533
79097
  });
79534
79098
  }
79535
- const Eit = /* @__PURE__ */ new Set([m1.type, v1.type]);
79536
- class pit {
79099
+ const eit = /* @__PURE__ */ new Set([d1.type, h1.type]);
79100
+ class tit {
79537
79101
  constructor(t, {
79538
79102
  isCaseSensitive: r = An.isCaseSensitive,
79539
79103
  ignoreDiacritics: n = An.ignoreDiacritics,
@@ -79555,7 +79119,7 @@ class pit {
79555
79119
  location: s,
79556
79120
  threshold: u,
79557
79121
  distance: d
79558
- }, t = r ? t : t.toLowerCase(), t = n ? Q2(t) : t, this.pattern = t, this.query = git(this.pattern, this.options);
79122
+ }, t = r ? t : t.toLowerCase(), t = n ? W2(t) : t, this.pattern = t, this.query = Xat(this.pattern, this.options);
79559
79123
  }
79560
79124
  static condition(t, r) {
79561
79125
  return r.useExtendedSearch;
@@ -79568,7 +79132,7 @@ class pit {
79568
79132
  score: 1
79569
79133
  };
79570
79134
  const { includeMatches: n, isCaseSensitive: a, ignoreDiacritics: i } = this.options;
79571
- t = a ? t : t.toLowerCase(), t = i ? Q2(t) : t;
79135
+ t = a ? t : t.toLowerCase(), t = i ? W2(t) : t;
79572
79136
  let o = 0, l = [], s = 0;
79573
79137
  for (let u = 0, d = r.length; u < d; u += 1) {
79574
79138
  const h = r[u];
@@ -79578,7 +79142,7 @@ class pit {
79578
79142
  if (A) {
79579
79143
  if (o += 1, s += T, n) {
79580
79144
  const y = m.constructor.type;
79581
- Eit.has(y) ? l = [...l, ...S] : l.push(S);
79145
+ eit.has(y) ? l = [...l, ...S] : l.push(S);
79582
79146
  }
79583
79147
  } else {
79584
79148
  s = 0, o = 0, l.length = 0;
@@ -79599,44 +79163,44 @@ class pit {
79599
79163
  };
79600
79164
  }
79601
79165
  }
79602
- const Av = [];
79603
- function Cit(...e) {
79604
- Av.push(...e);
79166
+ const vv = [];
79167
+ function nit(...e) {
79168
+ vv.push(...e);
79605
79169
  }
79606
- function fv(e, t) {
79607
- for (let r = 0, n = Av.length; r < n; r += 1) {
79608
- let a = Av[r];
79170
+ function Sv(e, t) {
79171
+ for (let r = 0, n = vv.length; r < n; r += 1) {
79172
+ let a = vv[r];
79609
79173
  if (a.condition(e, t))
79610
79174
  return new a(e, t);
79611
79175
  }
79612
- return new C1(e, t);
79176
+ return new c1(e, t);
79613
79177
  }
79614
- const J2 = {
79178
+ const Q2 = {
79615
79179
  AND: "$and",
79616
79180
  OR: "$or"
79617
- }, Iv = {
79181
+ }, Av = {
79618
79182
  PATH: "$path",
79619
79183
  PATTERN: "$val"
79620
- }, Tv = (e) => !!(e[J2.AND] || e[J2.OR]), mit = (e) => !!e[Iv.PATH], vit = (e) => !Ci(e) && h1(e) && !Tv(e), v_ = (e) => ({
79621
- [J2.AND]: Object.keys(e).map((t) => ({
79184
+ }, fv = (e) => !!(e[Q2.AND] || e[Q2.OR]), rit = (e) => !!e[Av.PATH], oit = (e) => !Ci(e) && i1(e) && !fv(e), g_ = (e) => ({
79185
+ [Q2.AND]: Object.keys(e).map((t) => ({
79622
79186
  [t]: e[t]
79623
79187
  }))
79624
79188
  });
79625
- function S1(e, t, { auto: r = !0 } = {}) {
79189
+ function g1(e, t, { auto: r = !0 } = {}) {
79626
79190
  const n = (a) => {
79627
79191
  let i = Object.keys(a);
79628
- const o = mit(a);
79629
- if (!o && i.length > 1 && !Tv(a))
79630
- return n(v_(a));
79631
- if (vit(a)) {
79632
- const s = o ? a[Iv.PATH] : i[0], u = o ? a[Iv.PATTERN] : a[s];
79192
+ const o = rit(a);
79193
+ if (!o && i.length > 1 && !fv(a))
79194
+ return n(g_(a));
79195
+ if (oit(a)) {
79196
+ const s = o ? a[Av.PATH] : i[0], u = o ? a[Av.PATTERN] : a[s];
79633
79197
  if (!Na(u))
79634
- throw new Error($at(s));
79198
+ throw new Error(Nat(s));
79635
79199
  const d = {
79636
- keyId: vv(s),
79200
+ keyId: Cv(s),
79637
79201
  pattern: u
79638
79202
  };
79639
- return r && (d.searcher = fv(u, t)), d;
79203
+ return r && (d.searcher = Sv(u, t)), d;
79640
79204
  }
79641
79205
  let l = {
79642
79206
  children: [],
@@ -79649,9 +79213,9 @@ function S1(e, t, { auto: r = !0 } = {}) {
79649
79213
  });
79650
79214
  }), l;
79651
79215
  };
79652
- return Tv(e) || (e = v_(e)), n(e);
79216
+ return fv(e) || (e = g_(e)), n(e);
79653
79217
  }
79654
- function Sit(e, { ignoreFieldNorm: t = An.ignoreFieldNorm }) {
79218
+ function ait(e, { ignoreFieldNorm: t = An.ignoreFieldNorm }) {
79655
79219
  e.forEach((r) => {
79656
79220
  let n = 1;
79657
79221
  r.matches.forEach(({ key: a, norm: i, score: o }) => {
@@ -79663,7 +79227,7 @@ function Sit(e, { ignoreFieldNorm: t = An.ignoreFieldNorm }) {
79663
79227
  }), r.score = n;
79664
79228
  });
79665
79229
  }
79666
- function Ait(e, t) {
79230
+ function iit(e, t) {
79667
79231
  const r = e.matches;
79668
79232
  t.matches = [], Fo(r) && r.forEach((n) => {
79669
79233
  if (!Fo(n.indices) || !n.indices.length)
@@ -79676,15 +79240,15 @@ function Ait(e, t) {
79676
79240
  n.key && (o.key = n.key.src), n.idx > -1 && (o.refIndex = n.idx), t.matches.push(o);
79677
79241
  });
79678
79242
  }
79679
- function fit(e, t) {
79243
+ function sit(e, t) {
79680
79244
  t.score = e.score;
79681
79245
  }
79682
- function Iit(e, t, {
79246
+ function lit(e, t, {
79683
79247
  includeMatches: r = An.includeMatches,
79684
79248
  includeScore: n = An.includeScore
79685
79249
  } = {}) {
79686
79250
  const a = [];
79687
- return r && a.push(Ait), n && a.push(fit), e.map((i) => {
79251
+ return r && a.push(iit), n && a.push(sit), e.map((i) => {
79688
79252
  const { idx: o } = i, l = {
79689
79253
  item: t[o],
79690
79254
  refIndex: o
@@ -79696,12 +79260,12 @@ function Iit(e, t, {
79696
79260
  }
79697
79261
  class Sl {
79698
79262
  constructor(t, r = {}, n) {
79699
- this.options = { ...An, ...r }, this.options.useExtendedSearch, this._keyStore = new Kat(this.options.keys), this.setCollection(t, n);
79263
+ this.options = { ...An, ...r }, this.options.useExtendedSearch, this._keyStore = new wat(this.options.keys), this.setCollection(t, n);
79700
79264
  }
79701
79265
  setCollection(t, r) {
79702
- if (this._docs = t, r && !(r instanceof xS))
79703
- throw new Error(zat);
79704
- this._myIndex = r || p1(this.options.keys, this._docs, {
79266
+ if (this._docs = t, r && !(r instanceof DS))
79267
+ throw new Error(Oat);
79268
+ this._myIndex = r || u1(this.options.keys, this._docs, {
79705
79269
  getFn: this.options.getFn,
79706
79270
  fieldNormWeight: this.options.fieldNormWeight
79707
79271
  });
@@ -79732,13 +79296,13 @@ class Sl {
79732
79296
  ignoreFieldNorm: l
79733
79297
  } = this.options;
79734
79298
  let s = Na(t) ? Na(this._docs[0]) ? this._searchStringList(t) : this._searchObjectList(t) : this._searchLogical(t);
79735
- return Sit(s, { ignoreFieldNorm: l }), i && s.sort(o), d1(r) && r > -1 && (s = s.slice(0, r)), Iit(s, this._docs, {
79299
+ return ait(s, { ignoreFieldNorm: l }), i && s.sort(o), a1(r) && r > -1 && (s = s.slice(0, r)), lit(s, this._docs, {
79736
79300
  includeMatches: n,
79737
79301
  includeScore: a
79738
79302
  });
79739
79303
  }
79740
79304
  _searchStringList(t) {
79741
- const r = fv(t, this.options), { records: n } = this._myIndex, a = [];
79305
+ const r = Sv(t, this.options), { records: n } = this._myIndex, a = [];
79742
79306
  return n.forEach(({ v: i, i: o, n: l }) => {
79743
79307
  if (!Fo(i))
79744
79308
  return;
@@ -79751,7 +79315,7 @@ class Sl {
79751
79315
  }), a;
79752
79316
  }
79753
79317
  _searchLogical(t) {
79754
- const r = S1(t, this.options), n = (l, s, u) => {
79318
+ const r = g1(t, this.options), n = (l, s, u) => {
79755
79319
  if (!l.children) {
79756
79320
  const { keyId: h, searcher: C } = l, E = this._findMatches({
79757
79321
  key: this._keyStore.get(h),
@@ -79771,7 +79335,7 @@ class Sl {
79771
79335
  const E = l.children[h], m = n(E, s, u);
79772
79336
  if (m.length)
79773
79337
  d.push(...m);
79774
- else if (l.operator === J2.AND)
79338
+ else if (l.operator === Q2.AND)
79775
79339
  return [];
79776
79340
  }
79777
79341
  return d;
@@ -79786,7 +79350,7 @@ class Sl {
79786
79350
  }), o;
79787
79351
  }
79788
79352
  _searchObjectList(t) {
79789
- const r = fv(t, this.options), { keys: n, records: a } = this._myIndex, i = [];
79353
+ const r = Sv(t, this.options), { keys: n, records: a } = this._myIndex, i = [];
79790
79354
  return a.forEach(({ $: o, i: l }) => {
79791
79355
  if (!Fo(o))
79792
79356
  return;
@@ -79832,11 +79396,447 @@ class Sl {
79832
79396
  }
79833
79397
  }
79834
79398
  Sl.version = "7.1.0";
79835
- Sl.createIndex = p1;
79836
- Sl.parseIndex = tit;
79399
+ Sl.createIndex = u1;
79400
+ Sl.parseIndex = Fat;
79837
79401
  Sl.config = An;
79838
- Sl.parseQuery = S1;
79839
- Cit(pit);
79402
+ Sl.parseQuery = g1;
79403
+ nit(tit);
79404
+ var Ch = /* @__PURE__ */ ((e) => (e.DEBUG = "Debug", e.INFO = "Info", e.WARN = "Warn", e.ERROR = "Error", e))(Ch || {});
79405
+ const E_ = 1e3, Hm = 32e3;
79406
+ var ji, di, El, hu, $o, mh, gu, k2, E1;
79407
+ class uit {
79408
+ constructor() {
79409
+ xi(this, $o);
79410
+ xi(this, ji, []);
79411
+ xi(this, di);
79412
+ xi(this, El);
79413
+ xi(this, hu);
79414
+ xi(this, gu);
79415
+ Va(this, El, window.crypto.randomUUID()), Va(this, di, E_), cr(this, $o, k2).call(this);
79416
+ }
79417
+ debug(t, r) {
79418
+ cr(this, $o, mh).call(this, Ch.DEBUG, t, r);
79419
+ }
79420
+ info(t, r) {
79421
+ cr(this, $o, mh).call(this, Ch.INFO, t, r);
79422
+ }
79423
+ warn(t, r) {
79424
+ cr(this, $o, mh).call(this, Ch.WARN, t, r);
79425
+ }
79426
+ error(t, r) {
79427
+ cr(this, $o, mh).call(this, Ch.ERROR, t, r);
79428
+ }
79429
+ setCallback(t) {
79430
+ Va(this, hu, t);
79431
+ }
79432
+ ensureLogSendingLoop() {
79433
+ (Tr(this, gu) === void 0 || Date.now() - Tr(this, gu) > Hm + 1e3) && cr(this, $o, k2).call(this);
79434
+ }
79435
+ }
79436
+ ji = new WeakMap(), di = new WeakMap(), El = new WeakMap(), hu = new WeakMap(), $o = new WeakSet(), mh = function(t, r, n) {
79437
+ const a = structuredClone(n) ?? {};
79438
+ a.chatVersion = "5.6.2";
79439
+ const i = {
79440
+ logUid: window.crypto.randomUUID(),
79441
+ correlationUid: Tr(this, El),
79442
+ message: r,
79443
+ severity: t,
79444
+ userMetadata: a,
79445
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
79446
+ };
79447
+ if (Tr(this, ji).push(i), Tr(this, hu))
79448
+ try {
79449
+ Tr(this, hu).call(this, i);
79450
+ } catch {
79451
+ }
79452
+ this.ensureLogSendingLoop();
79453
+ }, gu = new WeakMap(), k2 = async function() {
79454
+ Va(this, gu, Date.now());
79455
+ let t = !1;
79456
+ try {
79457
+ t = await cr(this, $o, E1).call(this);
79458
+ } catch {
79459
+ t = !1;
79460
+ }
79461
+ t ? Va(this, di, E_) : (Va(this, di, Tr(this, di) * 2), Tr(this, di) > Hm && Va(this, di, Hm)), setTimeout(cr(this, $o, k2).bind(this), Tr(this, di));
79462
+ }, E1 = async function() {
79463
+ if (!Tr(this, ji).length)
79464
+ return !0;
79465
+ try {
79466
+ const t = structuredClone(Tr(this, ji)), r = ha(), n = r ? {
79467
+ Authorization: `Bearer ${r}`,
79468
+ "X-Logger-Instance-Id": Tr(this, El)
79469
+ } : {
79470
+ "X-Logger-Instance-Id": Tr(this, El)
79471
+ };
79472
+ if ((await fetch(`${Xr().chatApiBaseUrl}/chats/logs`, {
79473
+ method: "POST",
79474
+ headers: n,
79475
+ body: JSON.stringify(t)
79476
+ })).ok) {
79477
+ const i = t.map((l) => l.logUid), o = Tr(this, ji).filter((l) => !i.includes(l.logUid));
79478
+ return Va(this, ji, o), !0;
79479
+ }
79480
+ } catch (t) {
79481
+ this.warn("cannot send logs", { error: t });
79482
+ }
79483
+ return !1;
79484
+ };
79485
+ const rn = new uit(), p1 = 2e3, Km = 1e4, Iv = X("online"), RS = X("online"), Vi = Gt({
79486
+ get: () => Iv.value,
79487
+ set: (e) => {
79488
+ Iv.value = e, e === "online" ? C1() : (RS.value = "offline", cit());
79489
+ }
79490
+ }), Tv = Gt(() => {
79491
+ switch (Vi.value) {
79492
+ case "online":
79493
+ return RS.value;
79494
+ case "offline":
79495
+ return "offline";
79496
+ }
79497
+ });
79498
+ function Ei(e) {
79499
+ RS.value = e, e === "offline" && Iv.value === "online" && C1();
79500
+ }
79501
+ let LS, J2 = !1, wS = !1;
79502
+ function C1() {
79503
+ wS = !1, J2 || (m1(), J2 = !0);
79504
+ }
79505
+ function cit() {
79506
+ wS = !0;
79507
+ }
79508
+ function dit() {
79509
+ const e = new AbortController();
79510
+ LS("https://app.cometchat.com/", {
79511
+ method: "HEAD",
79512
+ mode: "no-cors",
79513
+ signal: e.signal
79514
+ }).catch(() => {
79515
+ Ei("offline");
79516
+ }), setTimeout(() => {
79517
+ e.abort();
79518
+ }, p1);
79519
+ }
79520
+ function m1() {
79521
+ let e = !1;
79522
+ const t = new AbortController();
79523
+ let r = Date.now();
79524
+ LS("https://app.cometchat.com/", {
79525
+ method: "HEAD",
79526
+ mode: "no-cors",
79527
+ signal: t.signal
79528
+ }).then(() => {
79529
+ e = !0, J2 = !1, Ei("online"), dit();
79530
+ }).catch(() => {
79531
+ let n = Date.now();
79532
+ if (e = !0, rn.debug("Connection ping failed. Device seems offline."), Ei("offline"), wS) J2 = !1;
79533
+ else {
79534
+ let a = n - r, i = Km - a > 0 ? Km - a : 0;
79535
+ window.setTimeout(m1, i);
79536
+ }
79537
+ }), setTimeout(() => {
79538
+ e || (rn.debug("Device seems offline. Ping didn't return within threshold."), Ei("offline"));
79539
+ }, p1), setTimeout(() => {
79540
+ e || (rn.debug("Ping hang up."), t.abort());
79541
+ }, Km);
79542
+ }
79543
+ function hit(e) {
79544
+ LS = e, Vi.value = window.navigator.onLine ? "online" : "offline", window.addEventListener("online", () => {
79545
+ Vi.value = "online";
79546
+ }), window.addEventListener("offline", () => {
79547
+ Vi.value = "offline";
79548
+ });
79549
+ }
79550
+ let p_ = !1;
79551
+ const pi = /* @__PURE__ */ new Map();
79552
+ function git(e) {
79553
+ return Array.from(pi.values()).filter((a) => {
79554
+ let i = a.message.getReceiver();
79555
+ return (typeof i == "string" ? i : i instanceof ee.User ? i.getUid() : i.getGuid()) === e;
79556
+ }).map((a) => {
79557
+ const i = a.message, o = i.getData() || {};
79558
+ return o.entities = o.entities || {}, o.entities.sender = o.entities.sender || a.message.getSender(), o.entities.sender.entityType = "user", i.setData(o), i;
79559
+ });
79560
+ }
79561
+ function Eit() {
79562
+ p_ || (p_ = !0, g.CometChatMessageEvents.ccMessageSent.subscribe(pit));
79563
+ }
79564
+ async function pit({ message: e, status: t }) {
79565
+ if (t === g.MessageStatus.inprogress) {
79566
+ pi.set(e.getMuid(), {
79567
+ message: e,
79568
+ msgMetadata: e.getMetadata(),
79569
+ sentTime: /* @__PURE__ */ new Date()
79570
+ });
79571
+ return;
79572
+ }
79573
+ if (t === g.MessageStatus.success) {
79574
+ v1(e);
79575
+ return;
79576
+ }
79577
+ const r = Cit(e.getMuid());
79578
+ r && e.setMetadata(r.msgMetadata), await xS();
79579
+ }
79580
+ function v1(e) {
79581
+ const t = e.getMuid();
79582
+ pi.delete(t), pi.forEach((r, n) => {
79583
+ r.message.getMuid() === t && pi.delete(n);
79584
+ });
79585
+ }
79586
+ function Cit(e) {
79587
+ const t = pi.get(e);
79588
+ if (t)
79589
+ return t;
79590
+ for (const [r, n] of pi)
79591
+ if (n.message && n.message.getMuid() === e)
79592
+ return n;
79593
+ return null;
79594
+ }
79595
+ const mit = 1e4, vit = 45e3, S1 = 1e3, Sit = Date.now();
79596
+ let y2 = 0, lu = !1, C_ = setTimeout(xS, S1);
79597
+ async function xS() {
79598
+ if (clearTimeout(C_), C_ = setTimeout(xS, S1), !lu) {
79599
+ if (jn.onlineMode.value == "offline") {
79600
+ y2 = 0;
79601
+ return;
79602
+ } else
79603
+ y2 === 0 && (y2 = Date.now());
79604
+ lu = !0;
79605
+ try {
79606
+ if (pi.size === 0) return;
79607
+ const e = Array.from(pi.values());
79608
+ e.sort((t, r) => t.sentTime > r.sentTime ? 1 : -1);
79609
+ for (const t of e) {
79610
+ const r = t.message, n = r.getType(), a = Date.now() - Math.max(y2, t.sentTime.getTime());
79611
+ if (n === ee.CometChat.MESSAGE_TYPE.TEXT && a < mit) {
79612
+ lu = !1;
79613
+ return;
79614
+ } else if (n !== ee.CometChat.MESSAGE_TYPE.TEXT && a < vit) {
79615
+ lu = !1;
79616
+ return;
79617
+ }
79618
+ let i = r.getReceiver(), o = typeof i == "string" ? i : i instanceof ee.User ? i.getUid() : i.getGuid();
79619
+ r.setReceiverId(o);
79620
+ const s = await new ee.CometChat.MessagesRequestBuilder().setTags([r.getMuid()]).setGUID(o).setTimestamp(Sit).setLimit(1).build().fetchPrevious();
79621
+ if (s.length === 1 && s[0].getMuid() === r.getMuid()) {
79622
+ v1(r), g.CometChatMessageEvents.ccMessageSent.next({
79623
+ message: s[0],
79624
+ status: g.MessageStatus.success
79625
+ }), lu = !1;
79626
+ return;
79627
+ }
79628
+ const u = await ee.CometChat.sendMessage(r);
79629
+ g.CometChatMessageEvents.ccMessageSent.next({
79630
+ message: u,
79631
+ status: g.MessageStatus.success
79632
+ });
79633
+ }
79634
+ } finally {
79635
+ lu = !1;
79636
+ }
79637
+ }
79638
+ }
79639
+ const Ait = /^[0-9a-f]+\.apiclient-[a-z]+\.cometchat\.io$/, jo = {
79640
+ groupMessages: /^\/v3\.0\/groups\/(?<groupId>[^\/]+)\/messages\/?$/,
79641
+ threadMessages: /^\/v3\.0\/messages\/(?<messageId>[^\/]+)\/thread\/?$/,
79642
+ message: /^\/v3\.0\/messages\/(?<messageId>[^\/]+)\/?$/,
79643
+ conversations: /^\/v3\.0\/conversations\/?$/,
79644
+ group: /^\/v3\.0\/groups\/(?<groupId>[^\/]+)\/?$/
79645
+ };
79646
+ function m_(e, t) {
79647
+ return async function(r, n) {
79648
+ let a = fit(r, n);
79649
+ if (a.url.host === "metrics-eu.cometchat.io") try {
79650
+ const o = await e(r, n);
79651
+ return Ei("online"), o;
79652
+ } catch (o) {
79653
+ throw Ei("offline"), o;
79654
+ }
79655
+ if (a.method !== "GET" || !Ait.test(a.url.host) || a.url.pathname.match(jo.groupMessages) && a.query.tags)
79656
+ return e(r, n);
79657
+ if (Vi.value === "offline")
79658
+ return v_(a, t);
79659
+ let i;
79660
+ if (i = a.url.pathname.match(jo.groupMessages)) {
79661
+ let o = i.groups.groupId, l = await y1(o), s = a.url.search;
79662
+ if ((l == null ? void 0 : l.getMetadata()).isChannel && !(l != null && l.getHasJoined()) && jn.getGroupMessages.value === void 0)
79663
+ n = n || {}, r = Xr().chatApiBaseUrl + "/chats/messages/" + o + s, n.headers = {
79664
+ "Content-Type": "application/json",
79665
+ Authorization: `Bearer ${ha()}`
79666
+ };
79667
+ else if (jn.getGroupMessages.value && !(l != null && l.getHasJoined()))
79668
+ try {
79669
+ let u = await jn.getGroupMessages.value(o, s);
79670
+ return new Response(JSON.stringify(u));
79671
+ } catch (u) {
79672
+ throw rn.error('"Failed to execute groupMessagesGetter function: ', { error: u }), u;
79673
+ }
79674
+ }
79675
+ try {
79676
+ const o = await e(r, n);
79677
+ Ei("online");
79678
+ let l;
79679
+ try {
79680
+ l = await o.clone().json();
79681
+ } catch {
79682
+ return o;
79683
+ }
79684
+ if (l.data)
79685
+ try {
79686
+ jo.groupMessages.test(a.url.pathname) || jo.threadMessages.test(a.url.pathname) ? t.saveMessages(l.data) : jo.message.test(a.url.pathname) ? t.saveMessages([l.data]) : jo.conversations.test(a.url.pathname) ? t.saveConversations(l.data) : jo.group.test(a.url.pathname) && t.saveGroup(l.data);
79687
+ } catch (s) {
79688
+ rn.error("error saving request response: ", { error: s });
79689
+ }
79690
+ if (jn.loadMessageId.value && jo.groupMessages.test(a.url.pathname)) {
79691
+ try {
79692
+ const s = jn.loadMessageId.value;
79693
+ let u = l.data, d = 1, h = l.meta.pagination.total_pages;
79694
+ for (; h != d && !u.find((m) => m.id === s); ) {
79695
+ const E = await (await e(r + `&id=${l.data[0].id}&sentAt=${l.data[0].sentAt}`, n)).json();
79696
+ u = E.data.concat(u), l.data = u, h = E.meta.pagination.total_pages, d = E.meta.pagination.current_page;
79697
+ }
79698
+ } catch (s) {
79699
+ return jn.loadMessageId.value = void 0, rn.error("Error fetching additional messages", { fetchError: s }), o;
79700
+ }
79701
+ return jn.scrollToMessageId.value = jn.loadMessageId.value, jn.loadMessageId.value = void 0, new Response(JSON.stringify(l));
79702
+ }
79703
+ return o;
79704
+ } catch {
79705
+ return Ei("offline"), v_(a, t);
79706
+ }
79707
+ };
79708
+ }
79709
+ function v_(e, t) {
79710
+ let r, n;
79711
+ if (r = e.url.pathname.match(jo.groupMessages)) {
79712
+ let i = {
79713
+ per_page: parseInt(e.query.per_page || "30", 10),
79714
+ affix: e.query.affix,
79715
+ id: e.query.id,
79716
+ sent_at: e.query.sentAt ? parseInt(e.query.sentAt, 10) : void 0
79717
+ };
79718
+ if (!e.query.unread || e.query.unread !== "1") {
79719
+ const o = t.getGroupMessages(r.groups.groupId, i), l = r.groups.groupId, s = git(l) || [], u = o.data || [];
79720
+ for (var a = 0; a < s.length; a++) {
79721
+ const d = s[a];
79722
+ u.push(d);
79723
+ }
79724
+ n = {
79725
+ data: [...u],
79726
+ meta: {
79727
+ pagination: {
79728
+ total: o.total,
79729
+ count: o.data.length,
79730
+ per_page: i.per_page,
79731
+ current_page: 1,
79732
+ total_pages: o.data.length < i.per_page ? 1 : 2
79733
+ },
79734
+ cursor: {
79735
+ sentAt: i.sent_at || (o.data && o.data.length > 0 ? o.data.slice(-1)[0].sentAt : null),
79736
+ id: i.id || (o.data && o.data.length > 0 ? o.data.slice(-1)[0].id : null),
79737
+ affix: i.affix
79738
+ }
79739
+ }
79740
+ };
79741
+ } else
79742
+ n = {
79743
+ data: [],
79744
+ meta: {
79745
+ pagination: {
79746
+ total: 0,
79747
+ count: 0,
79748
+ per_page: i.per_page,
79749
+ current_page: 1,
79750
+ total_pages: 1
79751
+ }
79752
+ }
79753
+ };
79754
+ } else if (r = e.url.pathname.match(jo.threadMessages)) {
79755
+ let i = {
79756
+ per_page: parseInt(e.query.per_page || "30", 10),
79757
+ affix: e.query.affix,
79758
+ id: e.query.id,
79759
+ sent_at: e.query.sentAt ? parseInt(e.query.sentAt, 10) : void 0
79760
+ };
79761
+ const o = t.getThreadMessages(r.groups.messageId, i);
79762
+ n = {
79763
+ data: o.data,
79764
+ meta: {
79765
+ pagination: {
79766
+ total: o.total,
79767
+ count: o.data.length,
79768
+ per_page: i.per_page,
79769
+ current_page: 1,
79770
+ total_pages: o.data.length < i.per_page ? 1 : 2
79771
+ },
79772
+ cursor: {
79773
+ sentAt: i.sent_at || (o.data && o.data.length > 0 ? o.data.slice(-1)[0].sentAt : null),
79774
+ id: i.id || (o.data && o.data.length > 0 ? o.data.slice(-1)[0].id : null),
79775
+ affix: i.affix
79776
+ }
79777
+ }
79778
+ };
79779
+ } else if (r = e.url.pathname.match(jo.message))
79780
+ n = {
79781
+ data: t.getMessage(r.groups.messageId).data
79782
+ };
79783
+ else if (r = e.url.pathname.match(jo.conversations)) {
79784
+ let i = {
79785
+ per_page: parseInt(e.query.per_page || "30", 10),
79786
+ page: parseInt(e.query.page || "1", 10)
79787
+ }, o = t.getConversations(i);
79788
+ n = {
79789
+ data: o.data,
79790
+ meta: {
79791
+ pagination: {
79792
+ total: o.total,
79793
+ count: o.data.length,
79794
+ per_page: i.per_page,
79795
+ current_page: i.page,
79796
+ total_pages: o.data.length < i.per_page ? 1 : 2
79797
+ }
79798
+ }
79799
+ };
79800
+ } else (r = e.url.pathname.match(jo.group)) && (t.getGroup(r.groups.groupId) === null ? n = {
79801
+ error: {
79802
+ message: `The group with guid ${r.groups.groupId} does found in cache. `,
79803
+ devMessage: `The group with GUID ${r.groups.groupId} does not exist in cache.`,
79804
+ source: "chat-api",
79805
+ code: "ERR_GUID_NOT_FOUND_IN_CACHE"
79806
+ }
79807
+ } : n = {
79808
+ data: t.getGroup(r.groups.groupId)
79809
+ });
79810
+ return new Response(JSON.stringify(n));
79811
+ }
79812
+ function fit(e, t) {
79813
+ var a;
79814
+ let r;
79815
+ typeof e == "string" ? r = new URL(e) : e instanceof URL && (r = e);
79816
+ const n = {
79817
+ url: r,
79818
+ query: {},
79819
+ // Query parameters
79820
+ method: ((a = t == null ? void 0 : t.method) == null ? void 0 : a.toUpperCase()) || "GET"
79821
+ // HTTP method
79822
+ };
79823
+ return r.searchParams.forEach((i, o) => {
79824
+ n.query[o] = i;
79825
+ }), n;
79826
+ }
79827
+ function Iit(e, t) {
79828
+ return function(r) {
79829
+ if (e === null) return;
79830
+ Ei("online");
79831
+ let n;
79832
+ try {
79833
+ n = JSON.parse(r.data);
79834
+ } catch {
79835
+ return e.call(this, r);
79836
+ }
79837
+ return n.type === "message" && t.saveMessages([n.body]), e.call(this, r);
79838
+ };
79839
+ }
79840
79840
  var Ln, yv, il, _v, vh, Mv, U2, bv, Ov, Nv, Dv, P2;
79841
79841
  class Tit {
79842
79842
  constructor(t = "cometchat") {
@@ -79991,17 +79991,17 @@ Ln = new WeakSet(), yv = function(t, r) {
79991
79991
  const yit = /^[0-9a-f]+\.websocket-[a-z]+\.cometchat\.io$/;
79992
79992
  let S_ = !1, A_ = !1, oo;
79993
79993
  function _it() {
79994
- bat(window.fetch), oo = new Tit();
79994
+ hit(window.fetch), oo = new Tit();
79995
79995
  try {
79996
79996
  S_ || (typeof ServiceWorkerGlobalScope < "u" && self instanceof ServiceWorkerGlobalScope ? self.addEventListener("fetch", (e) => {
79997
- e.respondWith(h_(self.fetch, oo)(e.request.url, e.request));
79998
- }) : window.fetch = h_(window.fetch, oo)), S_ = !0;
79997
+ e.respondWith(m_(self.fetch, oo)(e.request.url, e.request));
79998
+ }) : window.fetch = m_(window.fetch, oo)), S_ = !0;
79999
79999
  } catch (e) {
80000
80000
  rn.error("cannot instal offline caching", { error: e });
80001
80001
  }
80002
80002
  A_ || (WebSocket.prototype.send = /* @__PURE__ */ function(e) {
80003
80003
  return function(t) {
80004
- return yit.test(new URL(this.url).host) && (this.onmessage = Pat(this.onmessage, oo)), this.send = e, e.call(this, t);
80004
+ return yit.test(new URL(this.url).host) && (this.onmessage = Iit(this.onmessage, oo)), this.send = e, e.call(this, t);
80005
80005
  };
80006
80006
  }(WebSocket.prototype.send)), A_ = !0;
80007
80007
  }
@@ -86515,7 +86515,7 @@ const pO = X(!1);
86515
86515
  let CO = X(void 0), tct = X(void 0), nct = X(void 0);
86516
86516
  async function rct(e, t) {
86517
86517
  try {
86518
- t.loggerCallback && rn.setCallback(t.loggerCallback), rn.debug("Initializing chat"), o1(t.environment), await Hut(), Nat(), R1(t.themeMode), e.provide("theme", { theme: pl }), e.component("bcc-chat-message-bubble", D1), e.component("bcc-reply-box", Tst), t.accessToken && (typeof t.accessToken == "string" ? Lv.login(t.accessToken) : t.accessToken.value && Lv.login(t.accessToken.value)), _st(t.language), _it(), pO.value = !0;
86518
+ t.loggerCallback && rn.setCallback(t.loggerCallback), rn.debug("Initializing chat"), o1(t.environment), await Hut(), Eit(), R1(t.themeMode), e.provide("theme", { theme: pl }), e.component("bcc-chat-message-bubble", D1), e.component("bcc-reply-box", Tst), t.accessToken && (typeof t.accessToken == "string" ? Lv.login(t.accessToken) : t.accessToken.value && Lv.login(t.accessToken.value)), _st(t.language), _it(), pO.value = !0;
86519
86519
  } catch (r) {
86520
86520
  throw rn.error("Failed to initialize chat", { error: r }), r;
86521
86521
  } finally {
@@ -86539,7 +86539,7 @@ const jn = {
86539
86539
  loadMessageId: tct,
86540
86540
  scrollToMessageId: nct,
86541
86541
  onlineMode: Vi,
86542
- onlineStatus: mv
86542
+ onlineStatus: Tv
86543
86543
  };
86544
86544
  function F_(e, t) {
86545
86545
  const r = document.querySelector(e);
@@ -87186,7 +87186,7 @@ const Act = {
87186
87186
  s.value && s.value.length ? l("groupMembersFetched", s.value) : l("groupMembersFetched", []);
87187
87187
  }), fn(() => {
87188
87188
  rn.debug("Mounting chat", { chatUid: r.chatUid }), setTimeout(() => {
87189
- !a.value && !i.value ? rn.error("Chat not loaded after 5 seconds", { chatUid: r.chatUid, connected: jn.connected.value, loggedIn: _o.value, onlineMode: Vi.value, onlineStatus: mv.value, initialized: jn.initialized.value }) : rn.debug("Chat successfully loaded", { chatUid: r.chatUid, connected: jn.connected.value, loggedIn: _o.value, onlineMode: Vi.value, onlineStatus: mv.value, initialized: jn.initialized.value });
87189
+ !a.value && !i.value ? rn.error("Chat not loaded after 5 seconds", { chatUid: r.chatUid, connected: jn.connected.value, loggedIn: _o.value, onlineMode: Vi.value, onlineStatus: Tv.value, initialized: jn.initialized.value }) : rn.debug("Chat successfully loaded", { chatUid: r.chatUid, connected: jn.connected.value, loggedIn: _o.value, onlineMode: Vi.value, onlineStatus: Tv.value, initialized: jn.initialized.value });
87190
87190
  }, 5e3), F_(".bcc-chat-message-list-wrapper", [
87191
87191
  {
87192
87192
  selector: ".cc__text",