szdl-utils-kit 0.2.23 → 0.2.24

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
@@ -18,8 +18,8 @@ var jt = { exports: {} };
18
18
  (function(y, A) {
19
19
  (function(e) {
20
20
  Array.prototype.indexOf || (Array.prototype.indexOf = function(t, s) {
21
- var h, l;
22
- for (h = s || 0, l = this.length; h < l; h += 1)
21
+ var h, c;
22
+ for (h = s || 0, c = this.length; h < c; h += 1)
23
23
  if (this[h] === t)
24
24
  return h;
25
25
  return -1;
@@ -30,18 +30,18 @@ var jt = { exports: {} };
30
30
  return h;
31
31
  }, a = function(t, s) {
32
32
  return s !== e ? (t.year(s.year() || s.year), t.month(s.month() || s.month), t.day(s.day() || s.day), t.hours(s.hours() || s.hours), t.minutes(s.minutes() || s.minutes), t.seconds(s.seconds() || s.seconds), t.milliseconds(s.milliseconds() || s.milliseconds), t) : e;
33
- }, c = function(t, s) {
34
- var h, l = "";
35
- return h = t.slice(s, s + 1), h !== "" && !isNaN(Number(h)) && (l += "%H"), h = t.charAt(s + 2), h !== "" && h === ":" && (l += h), h = t.slice(s + 3, s + 4), h !== "" && !isNaN(Number(h)) && (l += "%M"), h = t.charAt(s + 5), h !== "" && h === ":" && (l += h), h = t.slice(s + 6, s + 7), h !== "" && !isNaN(Number(h)) && (l += "%S"), l;
33
+ }, l = function(t, s) {
34
+ var h, c = "";
35
+ return h = t.slice(s, s + 1), h !== "" && !isNaN(Number(h)) && (c += "%H"), h = t.charAt(s + 2), h !== "" && h === ":" && (c += h), h = t.slice(s + 3, s + 4), h !== "" && !isNaN(Number(h)) && (c += "%M"), h = t.charAt(s + 5), h !== "" && h === ":" && (c += h), h = t.slice(s + 6, s + 7), h !== "" && !isNaN(Number(h)) && (c += "%S"), c;
36
36
  }, O = function(t, s) {
37
- var h, l = [
37
+ var h, c = [
38
38
  t.slice(s, s + 1),
39
39
  t.charAt(s + 2),
40
40
  t.slice(s + 3, s + 4),
41
41
  t.charAt(s + 5),
42
42
  t.slice(s + 6, s + 9)
43
43
  ], L;
44
- return !isNaN(Number(l[0])) && !isNaN(Number(l[2])) && !isNaN(Number(l[4])) ? (l[1] === "." && l[3] === "." ? h = "%d.%m.%Y" : l[1] === "-" && l[3] === "-" ? h = "%m-%d-%Y" : l[1] === "/" && l[3] === "/" && (h = "%m/%d/%Y"), h) : (L = [
44
+ return !isNaN(Number(c[0])) && !isNaN(Number(c[2])) && !isNaN(Number(c[4])) ? (c[1] === "." && c[3] === "." ? h = "%d.%m.%Y" : c[1] === "-" && c[3] === "-" ? h = "%m-%d-%Y" : c[1] === "/" && c[3] === "/" && (h = "%m/%d/%Y"), h) : (L = [
45
45
  t.slice(s, s + 3),
46
46
  t.charAt(s + 4),
47
47
  t.slice(s + 5, s + 6),
@@ -259,12 +259,12 @@ var jt = { exports: {} };
259
259
  N[m].FRIDAY_SHORT,
260
260
  N[m].SATURDAY_SHORT
261
261
  ];
262
- }, F, Mt, ct, lt, me = function(t, s, h) {
263
- var l;
264
- n.XMLHttpRequest ? l = new XMLHttpRequest() : l = new ActiveXObject("Microsoft.XMLHTTP"), l.onreadystatechange = function() {
265
- l.readyState === 4 && (l.status === 200 ? s && (n.JSON === e ? alert(`Please, include json2 into your project if you want use old browsers!
266
- https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.parse(l.responseText))) : h && h(l));
267
- }, l.open("GET", t, !1), l.send();
262
+ }, F, Mt, lt, ct, me = function(t, s, h) {
263
+ var c;
264
+ n.XMLHttpRequest ? c = new XMLHttpRequest() : c = new ActiveXObject("Microsoft.XMLHTTP"), c.onreadystatechange = function() {
265
+ c.readyState === 4 && (c.status === 200 ? s && (n.JSON === e ? alert(`Please, include json2 into your project if you want use old browsers!
266
+ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.parse(c.responseText))) : h && h(c));
267
+ }, c.open("GET", t, !1), c.send();
268
268
  }, I = {
269
269
  "%d": {
270
270
  format: function(t) {
@@ -316,7 +316,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
316
316
  "%a": {
317
317
  format: function(t) {
318
318
  var s = t.dayOfWeek();
319
- return lt[s !== e ? s : i.MIN_DAY_OF_WEEK];
319
+ return ct[s !== e ? s : i.MIN_DAY_OF_WEEK];
320
320
  },
321
321
  parse: function() {
322
322
  return {};
@@ -328,7 +328,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
328
328
  "%A": {
329
329
  format: function(t) {
330
330
  var s = t.dayOfWeek();
331
- return ct[s !== e ? s : i.MIN_DAY_OF_WEEK];
331
+ return lt[s !== e ? s : i.MIN_DAY_OF_WEEK];
332
332
  },
333
333
  parse: function() {
334
334
  return {};
@@ -415,11 +415,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
415
415
  return r(t.year() || i.MIN_YEAR, 4) + "-" + r(t.month() || i.MIN_MONTH, 2) + "-" + r(t.day() || i.MIN_DAY, 2);
416
416
  },
417
417
  parse: function(t) {
418
- var s = Number(t.slice(0, 4)), h = Number(t.slice(5, 7)), l = Number(t.slice(8, 10));
418
+ var s = Number(t.slice(0, 4)), h = Number(t.slice(5, 7)), c = Number(t.slice(8, 10));
419
419
  return {
420
420
  year: s,
421
421
  month: h,
422
- day: l
422
+ day: c
423
423
  };
424
424
  },
425
425
  minLength: 10,
@@ -431,9 +431,9 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
431
431
  return r(t.month() || i.MIN_MONTH, 2) + "/" + r(t.day() || i.MIN_DAY, 2) + "/" + r(t.year() || i.MIN_YEAR, 4);
432
432
  },
433
433
  parse: function(t) {
434
- var s = Number(t.slice(0, 2)), h = Number(t.slice(3, 5)), l = Number(t.slice(6, 10));
434
+ var s = Number(t.slice(0, 2)), h = Number(t.slice(3, 5)), c = Number(t.slice(6, 10));
435
435
  return {
436
- year: l,
436
+ year: c,
437
437
  month: s,
438
438
  day: h
439
439
  };
@@ -520,7 +520,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
520
520
  if (typeof t == "number")
521
521
  return this._d = new Date(t * (i.options("useMilliseconds") ? 1 : 1e3)), this;
522
522
  if (typeof t == "object" && (t instanceof Array ? (this.day(i.MIN_DAY), this.year(t[0]), this.month(t[1]), this.day(t[2]), this.hours(t[3]), this.minutes(t[4]), this.seconds(t[5]), this.milliseconds(t[6])) : (this.day(i.MIN_DAY), this.year(t.year), this.month(t.month), this.day(t.day), this.hours(t.hours), this.minutes(t.minutes), this.seconds(t.seconds), this.milliseconds(t.milliseconds))), typeof t == "string") {
523
- var l, L = [], g, S, k = [], H = 0, D = 0, M, w, p = {}, b;
523
+ var c, L = [], g, S, k = [], H = 0, D = 0, M, w, p = {}, b;
524
524
  if (t === e)
525
525
  return g = a(this, h), g === e && (this._i = {
526
526
  year: -1,
@@ -572,8 +572,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
572
572
  }), g;
573
573
  H += 1, D += 1;
574
574
  }
575
- for (l in L)
576
- L.hasOwnProperty(l) && I.hasOwnProperty(L[l]) && (b = I[L[l]].parse(k[l]), p = {
575
+ for (c in L)
576
+ L.hasOwnProperty(c) && I.hasOwnProperty(L[c]) && (b = I[L[c]].parse(k[c]), p = {
577
577
  year: b.year !== e ? b.year : p.year,
578
578
  month: b.month !== e ? b.month : p.month,
579
579
  day: b.day !== e ? b.day : p.day,
@@ -593,9 +593,9 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
593
593
  return arguments.length !== 0 ? (this._d = new Date(Number(t) * (i.options("useMilliseconds") ? 1 : 1e3)), this) : i.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
594
594
  }, R.fn.dayOfWeek = function(t) {
595
595
  if (t === "long")
596
- return ct[this._d.getDay()];
597
- if (t === "short")
598
596
  return lt[this._d.getDay()];
597
+ if (t === "short")
598
+ return ct[this._d.getDay()];
599
599
  if (t === e)
600
600
  return this._d.getDay();
601
601
  if (t === 0 || t === "Sunday")
@@ -671,28 +671,28 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
671
671
  };
672
672
  }
673
673
  }, R.fn.format = function(t) {
674
- for (var s = 0, h = "", l; s < t.length; )
675
- t.charAt(s) === "%" ? (l = t.charAt(s) + t.charAt(s + 1), I[l] !== e ? (h += I[l].format(this), s += 1) : h += "%") : h += t.charAt(s), s += 1;
674
+ for (var s = 0, h = "", c; s < t.length; )
675
+ t.charAt(s) === "%" ? (c = t.charAt(s) + t.charAt(s + 1), I[c] !== e ? (h += I[c].format(this), s += 1) : h += "%") : h += t.charAt(s), s += 1;
676
676
  return h;
677
677
  }, R.fn.valid = function() {
678
678
  return this._i.year === !1 && this._i.month === !1 && this._i.day === !1 && this._i.hours === !1 && this._i.minutes === !1 && this._i.seconds === !1 && this._i.milliseconds === !1;
679
679
  }, R.fn.errors = function() {
680
680
  return this._i;
681
681
  }, R.fn.between = function(t, s) {
682
- var h = this.timestamp(), l = t.timestamp();
682
+ var h = this.timestamp(), c = t.timestamp();
683
683
  switch (s) {
684
684
  case "year":
685
- return Math.floor((l - h) / 31556952);
685
+ return Math.floor((c - h) / 31556952);
686
686
  case "month":
687
- return Math.floor((l - h) / 2629746);
687
+ return Math.floor((c - h) / 2629746);
688
688
  case "day":
689
- return Math.floor((l - h) / 86400);
689
+ return Math.floor((c - h) / 86400);
690
690
  case "hours":
691
- return Math.floor((l - h) / 3600);
691
+ return Math.floor((c - h) / 3600);
692
692
  case "minutes":
693
- return Math.floor((l - h) / 60);
693
+ return Math.floor((c - h) / 60);
694
694
  case "seconds":
695
- return l - h;
695
+ return c - h;
696
696
  default:
697
697
  return e;
698
698
  }
@@ -712,7 +712,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
712
712
  }, i.noConflict = function() {
713
713
  return n.tempus = u, i;
714
714
  }, i.generate = function(t) {
715
- var s, h, l, L, g, S, k, H;
715
+ var s, h, c, L, g, S, k, H;
716
716
  if (typeof t.dateFrom != "number" && (t.dateFrom instanceof R ? s = t.dateFrom.utc() : s = i(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof R ? h = t.dateTo.utc() : h = i(t.dateTo, t.formatTo !== e ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? g = {
717
717
  year: 0,
718
718
  month: 0,
@@ -746,12 +746,12 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
746
746
  seconds: g.seconds ? -g.seconds : e,
747
747
  milliseconds: g.milliseconds ? -g.milliseconds : e
748
748
  };
749
- for (l = i(s).calc(D).utc(); i(l).get()[t.groupBy] === k; )
750
- H(S[S.length - 1], l, !0), l = i(l).calc(D).utc();
749
+ for (c = i(s).calc(D).utc(); i(c).get()[t.groupBy] === k; )
750
+ H(S[S.length - 1], c, !0), c = i(c).calc(D).utc();
751
751
  if (t.groupBy === "week") {
752
752
  var M = i(s).dayOfWeek();
753
- for (l = i(s).dayOfWeek(0).utc(); S[0].length < M && l < s; )
754
- H(S[S.length - 1], l, !0), l = i(l).calc(g).utc();
753
+ for (c = i(s).dayOfWeek(0).utc(); S[0].length < M && c < s; )
754
+ H(S[S.length - 1], c, !0), c = i(c).calc(g).utc();
755
755
  }
756
756
  }
757
757
  for (; s <= h; )
@@ -770,31 +770,31 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
770
770
  }, i.dayNames = function(t) {
771
771
  switch (t) {
772
772
  case "long":
773
- return ct;
774
- default:
775
773
  return lt;
774
+ default:
775
+ return ct;
776
776
  }
777
777
  }, i.lang = function(t) {
778
778
  if (t !== e)
779
- m = t, N[m] === e && (m = "en"), F = G(), Mt = at(), ct = V(), lt = J();
779
+ m = t, N[m] === e && (m = "en"), F = G(), Mt = at(), lt = V(), ct = J();
780
780
  else
781
781
  return m;
782
782
  return e;
783
783
  }, i.availableLangs = function() {
784
784
  return Object.keys(N);
785
- }, i.registerFormat = function(t, s, h, l, L, g) {
785
+ }, i.registerFormat = function(t, s, h, c, L, g) {
786
786
  I[t] = {
787
787
  format: s,
788
788
  parse: h,
789
- minLength: l,
789
+ minLength: c,
790
790
  maxLength: L,
791
791
  type: g
792
792
  };
793
793
  }, i.unregisterFormat = function(t) {
794
794
  delete I[t];
795
795
  }, i.detectFormat = function(t) {
796
- var s, h, l;
797
- return s = O(t, 0), s !== "" && (l = 10), h = t.charAt(l), (h === "T" || h === " ") && (s += h, l += 1), s += c(t, l), s;
796
+ var s, h, c;
797
+ return s = O(t, 0), s !== "" && (c = 10), h = t.charAt(c), (h === "T" || h === " ") && (s += h, c += 1), s += l(t, c), s;
798
798
  }, T = {
799
799
  TempusDate: R
800
800
  }, i.classes = function(t, s) {
@@ -806,7 +806,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
806
806
  N = s;
807
807
  }, function(s) {
808
808
  });
809
- }, m = (E.language || E.systemLanguage || E.userLanguage || "en").substr(0, 2).toLowerCase(), N[m] === e && (m = "en"), F = G(), Mt = at(), ct = V(), lt = J(), y.exports && (A = y.exports = i), A.tempus = i;
809
+ }, m = (E.language || E.systemLanguage || E.userLanguage || "en").substr(0, 2).toLowerCase(), N[m] === e && (m = "en"), F = G(), Mt = at(), lt = V(), ct = J(), y.exports && (A = y.exports = i), A.tempus = i;
810
810
  }).call(_e);
811
811
  })(jt, jt.exports);
812
812
  var ye = jt.exports;
@@ -874,33 +874,33 @@ class X {
874
874
  o(this, j) && _(this, ft, Qt).call(this), e && d(this, v, e), o(this, tt) === !1 && d(this, C, !1), Object.keys(A).length > o(this, x) && d(this, C, !0), d(this, q, !0), d(this, K, []), d(this, Y, {}), this.errors = {}, this.answerData = {};
875
875
  const n = _(this, _t, Vt).call(this, A);
876
876
  if (Object.keys(A).length < o(this, x)) {
877
- const r = n.map((a, c) => _(this, Ot, zt).call(this, a, n[c]));
877
+ const r = n.map((a, l) => _(this, Ot, zt).call(this, a, n[l]));
878
878
  return Promise.allSettled(r).then((a) => {
879
- let c = {};
879
+ let l = {};
880
880
  for (let O of a)
881
- O.status === "fulfilled" && (c = { ...c, ...O.value });
882
- return c;
881
+ O.status === "fulfilled" && (l = { ...l, ...O.value });
882
+ return l;
883
883
  });
884
884
  } else {
885
- let r = {}, a = 0, c = 1, O = Object.keys(A).length || 1, u = (i) => {
886
- a += Object.keys(i).length, c = Math.round(a / O * 100);
885
+ let r = {}, a = 0, l = 1, O = Object.keys(A).length || 1, u = (i) => {
886
+ a += Object.keys(i).length, l = Math.round(a / O * 100);
887
887
  };
888
888
  for (let [i, T] of Object.entries(n)) {
889
889
  let E = await _(this, Ot, zt).call(this, T, n[i], !0);
890
- u(T), e && e({ percent: c }), r = { ...r, ...E };
890
+ u(T), e && e({ percent: l }), r = { ...r, ...E };
891
891
  }
892
892
  return r;
893
893
  }
894
894
  }
895
895
  async batchTotalCount(A, e) {
896
896
  d(this, Y, {}), this.errors = {};
897
- let n = 1, r = 0, a = Object.keys(A).length || 1, c = (u) => {
897
+ let n = 1, r = 0, a = Object.keys(A).length || 1, l = (u) => {
898
898
  r += Object.keys(u).length, n = Math.round(r / a * 100);
899
899
  };
900
900
  e && e({ percent: n });
901
901
  const O = _(this, _t, Vt).call(this, A);
902
902
  if (o(this, et)) {
903
- const u = O.map((i) => _(this, yt, Kt).call(this, i).then((T) => (c(i), e && e({ percent: n }), T)));
903
+ const u = O.map((i) => _(this, yt, Kt).call(this, i).then((T) => (l(i), e && e({ percent: n }), T)));
904
904
  return Promise.allSettled(u).then((i) => {
905
905
  let T = {};
906
906
  for (let E of i)
@@ -911,7 +911,7 @@ class X {
911
911
  let u = {};
912
912
  for (let i of O) {
913
913
  let T = await _(this, yt, Kt).call(this, i);
914
- c(i), e && e({ percent: n }), u = { ...u, ...T };
914
+ l(i), e && e({ percent: n }), u = { ...u, ...T };
915
915
  }
916
916
  return u;
917
917
  }
@@ -923,15 +923,15 @@ z = new WeakMap(), mt = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), P =
923
923
  return Math.round(A);
924
924
  let e = 0, n = 0;
925
925
  return Object.values(o(this, B)).forEach((r) => {
926
- const { total: a, count: c } = r;
927
- e += a ?? 0, n += c ?? 0;
926
+ const { total: a, count: l } = r;
927
+ e += a ?? 0, n += l ?? 0;
928
928
  }), e ? A = n / e * 100 : A = 100, { percent: Math.round(A), allCount: n, allTotal: e };
929
929
  }, ft = new WeakSet(), Qt = function() {
930
930
  clearInterval(o(this, j)), d(this, j, ""), d(this, B, ""), d(this, v, ""), d(this, $, "no");
931
931
  }, Nt = new WeakSet(), Zt = function({ key: A, value: e }) {
932
932
  const n = _(this, At, ut).call(this, e.data()), r = Array.isArray(n) ? n.length : 0, a = _(this, ot, Bt).call(this, e.total(), r);
933
- let c = 1;
934
- n && (c = r), o(this, v) && (o(this, B) || d(this, B, {}), o(this, B)[A] && o(this, B)[A].count && (c += o(this, B)[A].count), o(this, B)[A] = { total: a, count: c }, o(this, j) || d(this, j, setInterval(() => {
933
+ let l = 1;
934
+ n && (l = r), o(this, v) && (o(this, B) || d(this, B, {}), o(this, B)[A] && o(this, B)[A].count && (l += o(this, B)[A].count), o(this, B)[A] = { total: a, count: l }, o(this, j) || d(this, j, setInterval(() => {
935
935
  const { percent: O, allCount: u, allTotal: i } = o(this, rt, Dt);
936
936
  (o(this, $) === "no" || o(this, $) < o(this, rt, Dt).percent) && (o(this, v).call(this, {
937
937
  data: o(this, B),
@@ -949,7 +949,7 @@ z = new WeakMap(), mt = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), P =
949
949
  return e;
950
950
  }, Ot = new WeakSet(), zt = function(A, e, n) {
951
951
  return new Promise((r) => {
952
- const a = _(this, Tt, te).call(this, e), c = [];
952
+ const a = _(this, Tt, te).call(this, e), l = [];
953
953
  let O = 0, u = 0;
954
954
  o(this, z).call(this, A, (i) => {
955
955
  Object.entries(i).forEach(([T, E]) => {
@@ -967,9 +967,9 @@ z = new WeakMap(), mt = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), P =
967
967
  const G = _(this, At, ut).call(this, E.data()), at = Array.isArray(G) ? G.length : 0, V = _(this, ot, Bt).call(this, E.total(), at);
968
968
  if (Array.isArray(G) ? o(this, Y)[T] = G : typeof G == "object" && G !== null && Object.keys(G).length === 0 ? o(this, Y)[T] = [] : o(this, Y)[T] = G, u += V, n || _(this, Nt, Zt).call(this, { key: T, value: E }), V > o(this, P) && V > at) {
969
969
  const J = Math.ceil(V / o(this, P)) - 1, F = Array.from({ length: J });
970
- c.push([T, a[T], F]);
970
+ l.push([T, a[T], F]);
971
971
  }
972
- }), u > 5e3 && o(this, tt) === !1 && o(this, et) === !1 && d(this, C, !0), O > 0 && _(this, Rt, ee).call(this), c.length ? (_(this, Ut, se).call(this, c), _(this, Gt, ie).call(this).then(() => r(_(this, nt, Yt).call(this)))) : r(_(this, nt, Yt).call(this));
972
+ }), u > 5e3 && o(this, tt) === !1 && o(this, et) === !1 && d(this, C, !0), O > 0 && _(this, Rt, ee).call(this), l.length ? (_(this, Ut, se).call(this, l), _(this, Gt, ie).call(this).then(() => r(_(this, nt, Yt).call(this)))) : r(_(this, nt, Yt).call(this));
973
973
  });
974
974
  });
975
975
  }, yt = new WeakSet(), Kt = function(A) {
@@ -977,31 +977,31 @@ z = new WeakMap(), mt = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), P =
977
977
  const n = _(this, Tt, te).call(this, A);
978
978
  let r = 0;
979
979
  o(this, z).call(this, n, (a) => {
980
- Object.entries(a).forEach(([c, O]) => {
980
+ Object.entries(a).forEach(([l, O]) => {
981
981
  const u = O.error();
982
- u && (this.errors[c] = u, r += 1);
982
+ u && (this.errors[l] = u, r += 1);
983
983
  const i = _(this, At, ut).call(this, O.data()), T = Array.isArray(i) ? i.length : 0, E = _(this, ot, Bt).call(this, O.total(), T);
984
- o(this, Y)[c] = E;
984
+ o(this, Y)[l] = E;
985
985
  }), r > 0 && _(this, Rt, ee).call(this), e(_(this, nt, Yt).call(this));
986
986
  });
987
987
  });
988
988
  }, Ut = new WeakSet(), se = function(A) {
989
989
  let e = [];
990
990
  A.forEach(([n, r, a]) => {
991
- a.forEach((c, O) => {
991
+ a.forEach((l, O) => {
992
992
  const u = O + 1, i = o(this, P) * u, E = [[n, u].join("_"), _(this, wt, re).call(this, r, i)];
993
993
  e.length === o(this, P) ? (o(this, K).push(e), e = [E]) : e.push(E);
994
994
  });
995
995
  }), e.length && o(this, K).push(e);
996
996
  }, Gt = new WeakSet(), ie = function() {
997
997
  const A = [], e = [], n = (r) => {
998
- Object.entries(r).forEach(([a, c]) => {
999
- const [O] = a.split("_"), u = _(this, At, ut).call(this, c.data());
1000
- Array.isArray(u) && o(this, Y)[O].push(...u), _(this, Nt, Zt).call(this, { key: O, value: c });
998
+ Object.entries(r).forEach(([a, l]) => {
999
+ const [O] = a.split("_"), u = _(this, At, ut).call(this, l.data());
1000
+ Array.isArray(u) && o(this, Y)[O].push(...u), _(this, Nt, Zt).call(this, { key: O, value: l });
1001
1001
  });
1002
1002
  };
1003
1003
  return o(this, K).forEach((r, a) => {
1004
- const c = Object.fromEntries(r), O = () => new Promise((u) => o(this, z).call(this, c, (i) => {
1004
+ const l = Object.fromEntries(r), O = () => new Promise((u) => o(this, z).call(this, l, (i) => {
1005
1005
  o(this, C) ? n(i) : e[a] = i, u();
1006
1006
  }));
1007
1007
  A.push(O);
@@ -1030,11 +1030,11 @@ z = new WeakMap(), mt = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), P =
1030
1030
  }, Tt = new WeakSet(), te = function(A) {
1031
1031
  return Object.entries(A).reduce((e, [n, r]) => {
1032
1032
  if (Array.isArray(r)) {
1033
- const [a, c = {}] = r;
1034
- e[n] = [a, c];
1033
+ const [a, l = {}] = r;
1034
+ e[n] = [a, l];
1035
1035
  } else {
1036
- const { method: a, params: c = {} } = r;
1037
- e[n] = [a, c];
1036
+ const { method: a, params: l = {} } = r;
1037
+ e[n] = [a, l];
1038
1038
  }
1039
1039
  return e;
1040
1040
  }, {});
@@ -1095,7 +1095,7 @@ class ne {
1095
1095
  }
1096
1096
  st = new WeakMap();
1097
1097
  const bt = new ne();
1098
- var W, Q, Ct, it, St, Z, ht, Ft, oe, Lt, Ae, Pt, he, Wt, ae, Jt, ce;
1098
+ var W, Q, Ct, it, St, Z, ht, Ft, oe, Lt, Ae, Pt, he, Wt, ae, Jt, le;
1099
1099
  class de {
1100
1100
  constructor() {
1101
1101
  f(this, Ft);
@@ -1182,8 +1182,8 @@ class de {
1182
1182
  keyTimer: "add.entity.items",
1183
1183
  duration: o(this, Ct),
1184
1184
  action: async () => {
1185
- var c;
1186
- await _(this, Pt, he).call(this), (c = a == null ? void 0 : a.data) != null && c.updateList && d(this, ht, !0);
1185
+ var l;
1186
+ await _(this, Pt, he).call(this), (l = a == null ? void 0 : a.data) != null && l.updateList && d(this, ht, !0);
1187
1187
  }
1188
1188
  });
1189
1189
  }
@@ -1204,10 +1204,10 @@ class de {
1204
1204
  }
1205
1205
  }, A);
1206
1206
  return n = n.map((a) => {
1207
- const { ID: c, DATE_CREATE: O, DETAIL_TEXT: u } = a;
1207
+ const { ID: l, DATE_CREATE: O, DETAIL_TEXT: u } = a;
1208
1208
  return {
1209
1209
  ...JSON.parse(u),
1210
- id: c,
1210
+ id: l,
1211
1211
  dateCreate: O
1212
1212
  };
1213
1213
  }), d(this, ht, !1), n;
@@ -1244,7 +1244,7 @@ W = new WeakMap(), Q = new WeakMap(), Ct = new WeakMap(), it = new WeakMap(), St
1244
1244
  });
1245
1245
  if (Object.keys(A).length) {
1246
1246
  let n = await e.batch(A), { errors: r } = e;
1247
- for (let [a, c] of Object.entries({ ...n, ...r }))
1247
+ for (let [a, l] of Object.entries({ ...n, ...r }))
1248
1248
  o(this, it).delete(a);
1249
1249
  return !0;
1250
1250
  }
@@ -1257,8 +1257,8 @@ W = new WeakMap(), Q = new WeakMap(), Ct = new WeakMap(), it = new WeakMap(), St
1257
1257
  let { dateCreate: a } = r;
1258
1258
  return Ht(new Date(a)).between(Ht(new Date(e)), "month") >= this.periodClear;
1259
1259
  });
1260
- _(this, Jt, ce).call(this, n);
1261
- }, Jt = new WeakSet(), ce = async function(A) {
1260
+ _(this, Jt, le).call(this, n);
1261
+ }, Jt = new WeakSet(), le = async function(A) {
1262
1262
  let e = new X(BX24.callBatch), n = A.map((r) => {
1263
1263
  let { id: a } = r;
1264
1264
  return {
@@ -1271,7 +1271,7 @@ W = new WeakMap(), Q = new WeakMap(), Ct = new WeakMap(), it = new WeakMap(), St
1271
1271
  });
1272
1272
  return await e.batch(n);
1273
1273
  };
1274
- var kt, le, Xt, ue;
1274
+ var kt, ce, Xt, ue;
1275
1275
  class Ee {
1276
1276
  constructor(A) {
1277
1277
  /** Запрос данных о приложении */
@@ -1294,7 +1294,7 @@ class Ee {
1294
1294
  window.BX24 && BX24.init(async () => {
1295
1295
  console.info("init BX24"), clearInterval(e), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), await this.logger.init();
1296
1296
  const [n, r] = await Promise.all([
1297
- _(this, kt, le).call(this),
1297
+ _(this, kt, ce).call(this),
1298
1298
  _(this, Xt, ue).call(this)
1299
1299
  ]);
1300
1300
  this.appInfo = n, this.userInfo = r, new ne().noSleep(), A(!0);
@@ -1329,13 +1329,13 @@ class Ee {
1329
1329
  data: { method: A, params: e, updateList: n }
1330
1330
  });
1331
1331
  return new Promise((a) => {
1332
- e || (e = {}), BX24.callMethod(A, e, function(c) {
1332
+ e || (e = {}), BX24.callMethod(A, e, (l) => {
1333
1333
  let O = {};
1334
- if (c != null && c.answer)
1335
- for (let [u, i] of Object.entries(c.answer))
1334
+ if (l != null && l.answer)
1335
+ for (let [u, i] of Object.entries(l.answer))
1336
1336
  u != "result" && i && (O[u] = i);
1337
- if (c.error()) {
1338
- let u = c.error();
1337
+ if (l.error()) {
1338
+ let u = l.error();
1339
1339
  console.error(u), this.logger.stop({
1340
1340
  answer: O,
1341
1341
  key: r,
@@ -1343,7 +1343,7 @@ class Ee {
1343
1343
  errorList: [u.toSting()]
1344
1344
  }), a(!1);
1345
1345
  } else {
1346
- let u = c.data();
1346
+ let u = l.data();
1347
1347
  u != null && u.items && (u = u.items), this.logger.stop({
1348
1348
  answer: O,
1349
1349
  key: r,
@@ -1373,32 +1373,32 @@ class Ee {
1373
1373
  * }}
1374
1374
  */
1375
1375
  async batch(A, e, { updateList: n, errorCall: r, limitCommandSerial: a } = {}) {
1376
- let c = new X(BX24.callBatch), O = this.logger.start({
1376
+ let l = new X(BX24.callBatch), O = this.logger.start({
1377
1377
  type: "batch",
1378
1378
  data: { commandList: A, updateList: n }
1379
1379
  });
1380
- a && (c.limitCommandSerial = a);
1380
+ a && (l.limitCommandSerial = a);
1381
1381
  try {
1382
- let u = await c.batch(A, e);
1383
- if (Object.keys(c.errors).length) {
1384
- let i = Object.entries(c.errors).map(([T, E]) => {
1382
+ let u = await l.batch(A, e);
1383
+ if (Object.keys(l.errors).length) {
1384
+ let i = Object.entries(l.errors).map(([T, E]) => {
1385
1385
  var m;
1386
1386
  return {
1387
1387
  key: T,
1388
1388
  error: `${E == null ? void 0 : E.method} ${(m = E == null ? void 0 : E.error) == null ? void 0 : m.toString()}`.trim()
1389
1389
  };
1390
1390
  });
1391
- r && r(c.errors), this.logger.stop({
1391
+ r && r(l.errors), this.logger.stop({
1392
1392
  key: O,
1393
1393
  status: "fail",
1394
1394
  errorList: i,
1395
- answer: c.answerData
1395
+ answer: l.answerData
1396
1396
  });
1397
1397
  } else
1398
1398
  this.logger.stop({
1399
1399
  key: O,
1400
1400
  status: "success",
1401
- answer: c.answerData
1401
+ answer: l.answerData
1402
1402
  });
1403
1403
  return u;
1404
1404
  } catch (u) {
@@ -1407,7 +1407,7 @@ class Ee {
1407
1407
  key: O,
1408
1408
  status: "fail-runtime",
1409
1409
  errorList: [i],
1410
- answer: c.answerData
1410
+ answer: l.answerData
1411
1411
  }), console.error(u), !1;
1412
1412
  }
1413
1413
  }
@@ -1423,14 +1423,14 @@ class Ee {
1423
1423
  try {
1424
1424
  let a = await n.batchTotalCount(A, e);
1425
1425
  if (Object.keys(n.errors).length) {
1426
- let c = Object.entries(n.errors).map(([O, u]) => ({
1426
+ let l = Object.entries(n.errors).map(([O, u]) => ({
1427
1427
  key: O,
1428
1428
  error: u.toSting()
1429
1429
  }));
1430
1430
  this.logger.stop({
1431
1431
  key: r,
1432
1432
  status: "fail",
1433
- errorList: c
1433
+ errorList: l
1434
1434
  });
1435
1435
  } else
1436
1436
  this.logger.stop({
@@ -1453,8 +1453,8 @@ class Ee {
1453
1453
  /** Встройка приложения в place */
1454
1454
  async placementBind(A) {
1455
1455
  this.placeData || (this.placeData = await this.getPlacement());
1456
- const { appName: e, pathApp: n } = this.appConst, r = this.placeData.map((c) => c.placement);
1457
- let a = this.placeData.find((c) => c.placement == A);
1456
+ const { appName: e, pathApp: n } = this.appConst, r = this.placeData.map((l) => l.placement);
1457
+ let a = this.placeData.find((l) => l.placement == A);
1458
1458
  r.includes(A) ? a.handler != n && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[A] || this.placementUnBind(a).then(() => {
1459
1459
  window.placementUnBind[A] || (window.placementUnBind[A] = !0, this.placementBind(A));
1460
1460
  })) : this.call({
@@ -1468,8 +1468,8 @@ class Ee {
1468
1468
  }
1469
1469
  }
1470
1470
  }
1471
- }).then((c) => {
1472
- c ? console.info("Приложение успешно встроено в", A) : console.warn("Приложение не может быть встроено в", A);
1471
+ }).then((l) => {
1472
+ l ? console.info("Приложение успешно встроено в", A) : console.warn("Приложение не может быть встроено в", A);
1473
1473
  });
1474
1474
  }
1475
1475
  /** Отвязка встройки из place */
@@ -1501,7 +1501,7 @@ class Ee {
1501
1501
  }
1502
1502
  /* регистрация бота */
1503
1503
  regBot({ code: A, type: e, name: n }) {
1504
- const { appName: r, pathApp: a, chatBotLogo: c } = this.appConst, O = this.appInfo.ID;
1504
+ const { appName: r, pathApp: a, chatBotLogo: l } = this.appConst, O = this.appInfo.ID;
1505
1505
  return this.call({
1506
1506
  method: "imbot.register",
1507
1507
  params: {
@@ -1533,7 +1533,7 @@ class Ee {
1533
1533
  // Ссылка на сайт
1534
1534
  PERSONAL_GENDER: "M",
1535
1535
  // Пол чат-бота, допустимые значения M - мужской, F - женский, пусто, если не требуется указывать
1536
- PERSONAL_PHOTO: c ?? ""
1536
+ PERSONAL_PHOTO: l ?? ""
1537
1537
  // Аватар чат-бота - base64
1538
1538
  }
1539
1539
  }
@@ -1553,7 +1553,7 @@ class Ee {
1553
1553
  return this.logger.getEntityList(A);
1554
1554
  }
1555
1555
  }
1556
- kt = new WeakSet(), le = function() {
1556
+ kt = new WeakSet(), ce = function() {
1557
1557
  return this.call({ method: "app.info" });
1558
1558
  }, Xt = new WeakSet(), ue = function() {
1559
1559
  return this.call({ method: "user.current" });
@@ -1,2 +1,2 @@
1
1
  var ge=Object.defineProperty;var Ee=(g,T,M)=>T in g?ge(g,T,{enumerable:!0,configurable:!0,writable:!0,value:M}):g[T]=M;var C=(g,T,M)=>(Ee(g,typeof T!="symbol"?T+"":T,M),M),zt=(g,T,M)=>{if(!T.has(g))throw TypeError("Cannot "+M)};var o=(g,T,M)=>(zt(g,T,"read from private field"),M?M.call(g):T.get(g)),f=(g,T,M)=>{if(T.has(g))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(g):T.set(g,M)},y=(g,T,M,ht)=>(zt(g,T,"write to private field"),ht?ht.call(g,M):T.set(g,M),M);var _=(g,T,M)=>(zt(g,T,"access private method"),M);(function(g,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(g=typeof globalThis<"u"?globalThis:g||self,T(g["szdl-utils-kit"]={}))})(this,function(g){var q,ft,v,B,J,Q,$,tt,U,Z,Bt,et,F,At,st,at,xt,Nt,Kt,_t,qt,Ot,vt,yt,$t,dt,te,It,he,Ut,ae,gt,ee,Et,Ae,Tt,se,lt,Qt,Rt,ie,Gt,le,it,Dt,ct,Zt,St,re,rt,k,V,wt,nt,Lt,z,ut,Ct,ce,Mt,ne,Ft,ue,Pt,me,Wt,fe,Jt,Ne,kt,_e;"use strict";var T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function M(G){return G&&G.__esModule&&Object.prototype.hasOwnProperty.call(G,"default")?G.default:G}var ht={exports:{}};(function(G,A){(function(e){Array.prototype.indexOf||(Array.prototype.indexOf=function(t,s){var h,c;for(h=s||0,c=this.length;h<c;h+=1)if(this[h]===t)return h;return-1});var n=this,r=function(t,s){for(var h=t.toString();h.length<s;)h="0"+h;return h},a=function(t,s){return s!==e?(t.year(s.year()||s.year),t.month(s.month()||s.month),t.day(s.day()||s.day),t.hours(s.hours()||s.hours),t.minutes(s.minutes()||s.minutes),t.seconds(s.seconds()||s.seconds),t.milliseconds(s.milliseconds()||s.milliseconds),t):e},l=function(t,s){var h,c="";return h=t.slice(s,s+1),h!==""&&!isNaN(Number(h))&&(c+="%H"),h=t.charAt(s+2),h!==""&&h===":"&&(c+=h),h=t.slice(s+3,s+4),h!==""&&!isNaN(Number(h))&&(c+="%M"),h=t.charAt(s+5),h!==""&&h===":"&&(c+=h),h=t.slice(s+6,s+7),h!==""&&!isNaN(Number(h))&&(c+="%S"),c},O=function(t,s){var h,c=[t.slice(s,s+1),t.charAt(s+2),t.slice(s+3,s+4),t.charAt(s+5),t.slice(s+6,s+9)],p;return!isNaN(Number(c[0]))&&!isNaN(Number(c[2]))&&!isNaN(Number(c[4]))?(c[1]==="."&&c[3]==="."?h="%d.%m.%Y":c[1]==="-"&&c[3]==="-"?h="%m-%d-%Y":c[1]==="/"&&c[3]==="/"&&(h="%m/%d/%Y"),h):(p=[t.slice(s,s+3),t.charAt(s+4),t.slice(s+5,s+6),t.charAt(s+7),t.slice(s+8,s+9)],!isNaN(Number(p[0]))&&!isNaN(Number(p[2]))&&!isNaN(Number(p[4]))?(p[1]==="-"&&p[3]==="-"&&(h="%Y-%m-%d"),h):"")},u=n.tempus,i,R,E=n.navigator||{},m="en",N={en:{JANUARY_SHORT:"Jan",FEBRUARY_SHORT:"Feb",MARCH_SHORT:"Mar",APRIL_SHORT:"Apr",MAY_SHORT:"May",JUNE_SHORT:"Jun",JULY_SHORT:"Jul",AUGUST_SHORT:"Aug",SEPTEMBER_SHORT:"Sep",OCTOBER_SHORT:"Oct",NOVEMBER_SHORT:"Nov",DECEMBER_SHORT:"Dec",JANUARY_LONG:"January",FEBRUARY_LONG:"February",MARCH_LONG:"March",APRIL_LONG:"April",MAY_LONG:"May",JUNE_LONG:"June",JULY_LONG:"July",AUGUST_LONG:"August",SEPTEMBER_LONG:"September",OCTOBER_LONG:"October",NOVEMBER_LONG:"November",DECEMBER_LONG:"December",SUNDAY_SHORT:"Sun",MONDAY_SHORT:"Mon",TUESDAY_SHORT:"Tue",WEDNESDAY_SHORT:"Wed",THURSDAY_SHORT:"Thu",FRIDAY_SHORT:"Fri",SATURDAY_SHORT:"Sat",SUNDAY_LONG:"Sunday",MONDAY_LONG:"Monday",TUESDAY_LONG:"Tuesday",WEDNESDAY_LONG:"Wednesday",THURSDAY_LONG:"Thursday",FRIDAY_LONG:"Friday",SATURDAY_LONG:"Saturday"},ru:{JANUARY_SHORT:"Янв",FEBRUARY_SHORT:"Фев",MARCH_SHORT:"Мар",APRIL_SHORT:"Апр",MAY_SHORT:"Май",JUNE_SHORT:"Июн",JULY_SHORT:"Июл",AUGUST_SHORT:"Авг",SEPTEMBER_SHORT:"Сен",OCTOBER_SHORT:"Окт",NOVEMBER_SHORT:"Ноя",DECEMBER_SHORT:"Дек",JANUARY_LONG:"Январь",FEBRUARY_LONG:"Февраль",MARCH_LONG:"Март",APRIL_LONG:"Апрель",MAY_LONG:"Май",JUNE_LONG:"Июнь",JULY_LONG:"Июль",AUGUST_LONG:"Август",SEPTEMBER_LONG:"Сентябрь",OCTOBER_LONG:"Октябрь",NOVEMBER_LONG:"Ноябрь",DECEMBER_LONG:"Декабрь",SUNDAY_SHORT:"Вс",MONDAY_SHORT:"Пн",TUESDAY_SHORT:"Вт",WEDNESDAY_SHORT:"Ср",THURSDAY_SHORT:"Чт",FRIDAY_SHORT:"Пт",SATURDAY_SHORT:"Сб",SUNDAY_LONG:"Воскресенье",MONDAY_LONG:"Понедельник",TUESDAY_LONG:"Вторник",WEDNESDAY_LONG:"Среда",THURSDAY_LONG:"Четверг",FRIDAY_LONG:"Пятница",SATURDAY_LONG:"Суббота"},ua:{JANUARY_SHORT:"Січ",FEBRUARY_SHORT:"Лют",MARCH_SHORT:"Берез",APRIL_SHORT:"Квіт",MAY_SHORT:"Трав",JUNE_SHORT:"Черв",JULY_SHORT:"Лип",AUGUST_SHORT:"Серп",SEPTEMBER_SHORT:"Верес",OCTOBER_SHORT:"Жовт",NOVEMBER_SHORT:"Листоп",DECEMBER_SHORT:"Груд",JANUARY_LONG:"Січень",FEBRUARY_LONG:"Лютий",MARCH_LONG:"Березень",APRIL_LONG:"Квітень",MAY_LONG:"Травень",JUNE_LONG:"Червень",JULY_LONG:"Липень",AUGUST_LONG:"Серпень",SEPTEMBER_LONG:"Вересень",OCTOBER_LONG:"Жовтень",NOVEMBER_LONG:"Листопад",DECEMBER_LONG:"Грудень",SUNDAY_SHORT:"Нд",MONDAY_SHORT:"Пн",TUESDAY_SHORT:"Вт",WEDNESDAY_SHORT:"Ср",THURSDAY_SHORT:"Чт",FRIDAY_SHORT:"Пт",SATURDAY_SHORT:"Сб",SUNDAY_LONG:"Неділя",MONDAY_LONG:"Понеділок",TUESDAY_LONG:"Вівторок",WEDNESDAY_LONG:"Середа",THURSDAY_LONG:"Четвер",FRIDAY_LONG:"П’ятниця",SATURDAY_LONG:"Субота"},de:{JANUARY_SHORT:"Jan",FEBRUARY_SHORT:"Feb",MARCH_SHORT:"März",APRIL_SHORT:"Apr",MAY_SHORT:"Mai",JUNE_SHORT:"Juni",JULY_SHORT:"Juli",AUGUST_SHORT:"Aug",SEPTEMBER_SHORT:"Sept",OCTOBER_SHORT:"Okt",NOVEMBER_SHORT:"Nov",DECEMBER_SHORT:"Dez",JANUARY_LONG:"Januar",FEBRUARY_LONG:"Februar",MARCH_LONG:"März",APRIL_LONG:"April",MAY_LONG:"Mai",JUNE_LONG:"Juni",JULY_LONG:"Juli",AUGUST_LONG:"August",SEPTEMBER_LONG:"September",OCTOBER_LONG:"Oktober",NOVEMBER_LONG:"November",DECEMBER_LONG:"Dezember",SUNDAY_SHORT:"So",MONDAY_SHORT:"Mo",TUESDAY_SHORT:"Di",WEDNESDAY_SHORT:"Mi",THURSDAY_SHORT:"Do",FRIDAY_SHORT:"Fr",SATURDAY_SHORT:"Sa",SUNDAY_LONG:"Sonntag",MONDAY_LONG:"Montag",TUESDAY_LONG:"Dienstag",WEDNESDAY_LONG:"Mittwoch",THURSDAY_LONG:"Donnerstag",FRIDAY_LONG:"Freitag",SATURDAY_LONG:"Samstag"}},P=function(){return[N[m].JANUARY_LONG,N[m].FEBRUARY_LONG,N[m].MARCH_LONG,N[m].APRIL_LONG,N[m].MAY_LONG,N[m].JUNE_LONG,N[m].JULY_LONG,N[m].AUGUST_LONG,N[m].SEPTEMBER_LONG,N[m].OCTOBER_LONG,N[m].NOVEMBER_LONG,N[m].DECEMBER_LONG]},pt=function(){return[N[m].JANUARY_SHORT,N[m].FEBRUARY_SHORT,N[m].MARCH_SHORT,N[m].APRIL_SHORT,N[m].MAY_SHORT,N[m].JUNE_SHORT,N[m].JULY_SHORT,N[m].AUGUST_SHORT,N[m].SEPTEMBER_SHORT,N[m].OCTOBER_SHORT,N[m].NOVEMBER_SHORT,N[m].DECEMBER_SHORT]},ot=function(){return[N[m].SUNDAY_LONG,N[m].MONDAY_LONG,N[m].TUESDAY_LONG,N[m].WEDNESDAY_LONG,N[m].THURSDAY_LONG,N[m].FRIDAY_LONG,N[m].SATURDAY_LONG]},x=function(){return[N[m].SUNDAY_SHORT,N[m].MONDAY_SHORT,N[m].TUESDAY_SHORT,N[m].WEDNESDAY_SHORT,N[m].THURSDAY_SHORT,N[m].FRIDAY_SHORT,N[m].SATURDAY_SHORT]},X,Xt,bt,Ht,de=function(t,s,h){var c;n.XMLHttpRequest?c=new XMLHttpRequest:c=new ActiveXObject("Microsoft.XMLHTTP"),c.onreadystatechange=function(){c.readyState===4&&(c.status===200?s&&(n.JSON===e?alert(`Please, include json2 into your project if you want use old browsers!
2
- https://github.com/douglascrockford/JSON-js/blob/master/json2.js`):s(JSON.parse(c.responseText))):h&&h(c))},c.open("GET",t,!1),c.send()},w={"%d":{format:function(t){return r(t.day()||i.MIN_DAY,2)},parse:function(t){var s=Number(t);return{day:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%m":{format:function(t){return r(t.month()||i.MIN_MONTH,2)},parse:function(t){var s=Number(t);return{month:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%Y":{format:function(t){return r(t.year()||i.MIN_YEAR,4)},parse:function(t){var s=Number(t);return{year:isNaN(s)?e:s}},minLength:4,maxLength:4,type:"number"},"%w":{format:function(t){return t.dayOfWeek()||i.MIN_DAY_OF_WEEK},parse:function(){return{}},minLength:1,maxLength:1,type:"number"},"%a":{format:function(t){var s=t.dayOfWeek();return Ht[s!==e?s:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%A":{format:function(t){var s=t.dayOfWeek();return bt[s!==e?s:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%b":{format:function(t){var s=i.options("monthFromZero")?t.month():t.month()-1;return Xt[s!==e?s:i.MIN_MONTH]},parse:function(t){var s=i.monthNames().indexOf(t)+(i.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%B":{format:function(t){var s=i.options("monthFromZero")?t.month():t.month()-1;return X[s!==e?s:i.MIN_MONTH]},parse:function(t){var s=i.monthNames(!0).indexOf(t)+(i.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%H":{format:function(t){return r(t.hours()||i.MIN_HOURS,2)},parse:function(t){var s=Number(t);return{hours:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%M":{format:function(t){return r(t.minutes()||i.MIN_MINUTES,2)},parse:function(t){var s=Number(t);return{minutes:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%S":{format:function(t){return r(t.seconds()||i.MIN_SECONDS,2)},parse:function(t){var s=Number(t);return{seconds:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%s":{format:function(t){return t.timestamp()},parse:function(t){return isNaN(Number(t))?{}:i(Number(t)).get()},minLength:1,maxLength:20,type:"number"},"%F":{format:function(t){return r(t.year()||i.MIN_YEAR,4)+"-"+r(t.month()||i.MIN_MONTH,2)+"-"+r(t.day()||i.MIN_DAY,2)},parse:function(t){var s=Number(t.slice(0,4)),h=Number(t.slice(5,7)),c=Number(t.slice(8,10));return{year:s,month:h,day:c}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(t){return r(t.month()||i.MIN_MONTH,2)+"/"+r(t.day()||i.MIN_DAY,2)+"/"+r(t.year()||i.MIN_YEAR,4)},parse:function(t){var s=Number(t.slice(0,2)),h=Number(t.slice(3,5)),c=Number(t.slice(6,10));return{year:c,month:s,day:h}},minLength:10,maxLength:10,type:"string"}},jt={useMilliseconds:!1,monthFromZero:!1},S;S=function(t,s,h){return this._d=new Date,this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t!==e&&this.set(t,s,h),this},S.fn=S.prototype,S.fn.dayCount=function(){var t=this.month(),s=i.MAX_DAY_IN_MONTHS[t-(i.options("monthFromZero")?0:1)];return this.leapYear()&&t===(i.options("monthFromZero")?1:2)&&(s+=1),s},S.fn.year=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_YEAR&&Number(t)<=i.MAX_YEAR?(this._d.setFullYear(Number(t)),this._i.year=!1):this._i.year=Number(t):(this._d.setFullYear(i.MIN_YEAR),this._i.year=!1);else return this._i.year===!1?this._d.getFullYear():this._i.year;return this},S.fn.month=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MONTH&&Number(t)<=i.MAX_MONTH?(this._d.setMonth(i.options("monthFromZero")?Number(t):Number(t)-1),this._i.month=!1):this._i.month=Number(t):(this._d.setMonth(i.options("monthFromZero")?i.MIN_MONTH:i.MIN_MONTH-1),this._i.month=!1);else return this._i.month===!1?i.options("monthFromZero")?this._d.getMonth():this._d.getMonth()+1:this._i.month;return this},S.fn.day=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_DAY&&Number(t)<=this.dayCount()?(this._d.setDate(Number(t)),this._i.day=!1):this._i.day=Number(t):(this._d.setDate(i.MIN_DAY),this._i.day=!1);else return this._i.day===!1?this._d.getDate():this._i.day;return this},S.fn.hours=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_HOURS&&Number(t)<=i.MAX_HOURS?(this._d.setHours(Number(t)),this._i.hours=!1):this._i.hours=Number(t):(this._d.setHours(i.MIN_HOURS),this._i.hours=!1);else return this._i.hours===!1?this._d.getHours():this._i.hours;return this},S.fn.minutes=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MINUTES&&Number(t)<=i.MAX_MINUTES?(this._d.setMinutes(Number(t)),this._i.minutes=!1):this._i.minutes=Number(t):(this._d.setMinutes(i.MIN_MINUTES),this._i.minutes=!1);else return this._i.minutes===!1?this._d.getMinutes():this._i.minutes;return this},S.fn.seconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_SECONDS&&Number(t)<=i.MAX_SECONDS?(this._d.setSeconds(Number(t)),this._i.seconds=!1):this._i.seconds=Number(t):(this._d.setSeconds(i.MIN_SECONDS),this._i.seconds=!1);else return this._i.seconds===!1?this._d.getSeconds():this._i.seconds;return this},S.fn.milliseconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MILLISECONDS&&Number(t)<=i.MAX_MILLISECONDS?(this._d.setMilliseconds(Number(t)),this._i.milliseconds=!1):this._i.milliseconds=Number(t):(this._d.setMilliseconds(i.MIN_MILLISECONDS),this._i.milliseconds=!1);else return this._i.milliseconds===!1?this._d.getMilliseconds():this._i.milliseconds;return this},S.fn.week=function(){var t=new Date(this.year(),0,1),s=i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc()*1e3;return Math.ceil(((s-t.getTime())/864e5+t.getDay()+1)/7)},S.fn.set=function(t,s,h){if(this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t===e)return this._d=new Date,this;if(t instanceof Date)return this._d=t,this;if(typeof t=="number")return this._d=new Date(t*(i.options("useMilliseconds")?1:1e3)),this;if(typeof t=="object"&&(t instanceof Array?(this.day(i.MIN_DAY),this.year(t[0]),this.month(t[1]),this.day(t[2]),this.hours(t[3]),this.minutes(t[4]),this.seconds(t[5]),this.milliseconds(t[6])):(this.day(i.MIN_DAY),this.year(t.year),this.month(t.month),this.day(t.day),this.hours(t.hours),this.minutes(t.minutes),this.seconds(t.seconds),this.milliseconds(t.milliseconds))),typeof t=="string"){var c,p=[],d,L,K=[],Y=0,I=0,b,W,H={},D;if(t===e)return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;for(s===e&&(s=i.detectFormat(t));Y<s.length;){if(s.charAt(Y)==="%"){if(L=s.charAt(Y)+s.charAt(Y+1),w[L]!==e){switch(b=0,W="",w[L].type){case"number":for(;b<w[L].maxLength&&I+b<t.length&&!isNaN(Number(t.charAt(I+b)));)W+=t.charAt(I+b),b+=1;break;case"word":for(;b<w[L].maxLength&&I+b<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(I+b));)W+=t.charAt(I+b),b+=1;break;case"string":for(;b<w[L].maxLength&&I+b<t.length;)W+=t.charAt(I+b),b+=1;break}if(b<w[L].minLength)return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;p.push(L),K.push(W),b-=1,I+=b,Y+=1}}else if(t.charAt(I)!==s.charAt(Y))return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;Y+=1,I+=1}for(c in p)p.hasOwnProperty(c)&&w.hasOwnProperty(p[c])&&(D=w[p[c]].parse(K[c]),H={year:D.year!==e?D.year:H.year,month:D.month!==e?D.month:H.month,day:D.day!==e?D.day:H.day,hours:D.hours!==e?D.hours:H.hours,minutes:D.minutes!==e?D.minutes:H.minutes,seconds:D.seconds!==e?D.seconds:H.seconds});this.day(i.MIN_DAY),this.year(H.year),this.month(H.month),this.day(H.day),this.hours(H.hours),this.minutes(H.minutes),this.seconds(H.seconds),this.milliseconds(H.milliseconds)}return this},S.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},S.fn.timestamp=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(i.options("useMilliseconds")?1:1e3)+this._d.getTimezoneOffset()*6e4),this):i.options("useMilliseconds")?this._d.getTime()-this._d.getTimezoneOffset()*6e4:Math.floor(this._d.getTime()/1e3)-this._d.getTimezoneOffset()*60},S.fn.utc=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(i.options("useMilliseconds")?1:1e3)),this):i.options("useMilliseconds")?this._d.getTime():Math.floor(this._d.getTime()/1e3)},S.fn.dayOfWeek=function(t){if(t==="long")return bt[this._d.getDay()];if(t==="short")return Ht[this._d.getDay()];if(t===e)return this._d.getDay();if(t===0||t==="Sunday")return this.calc({day:-this.dayOfWeek()});if(t===1||t==="Monday")return this.calc({day:(this.dayOfWeek()===0?-6:1)-this.dayOfWeek()});if(t===2||t==="Tuesday")return this.calc({day:(this.dayOfWeek()===0?-5:2)-this.dayOfWeek()});if(t===3||t==="Wednesday")return this.calc({day:(this.dayOfWeek()===0?-4:3)-this.dayOfWeek()});if(t===4||t==="Thursday")return this.calc({day:(this.dayOfWeek()===0?-3:4)-this.dayOfWeek()});if(t===5||t==="Friday")return this.calc({day:(this.dayOfWeek()===0?-2:5)-this.dayOfWeek()});if(t===6||t==="Saturday")return this.calc({day:(this.dayOfWeek()===0?-1:6)-this.dayOfWeek()})},S.fn.timezone=function(t){switch(t){case"hours":return Math.floor(this._d.getTimezoneOffset()/60);case"minutes":return this._d.getTimezoneOffset();default:return this._d.getTimezoneOffset()*60}},S.fn.get=function(t){switch(t){case"Date":return new Date(this.year(),this.month()-(i.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds());case"DateUTC":return new Date(Date.UTC(this.year(),this.month()-(i.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()));case"Array":return[this.year(),this.month(),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()];default:return{year:this.year(),month:this.month(),week:this.week(),day:this.day(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds(),utc:this.utc(),dayOfWeek:this.dayOfWeek(),dayOfWeekShort:this.dayOfWeek("short"),dayOfWeekLong:this.dayOfWeek("long"),timestamp:this.timestamp()}}},S.fn.format=function(t){for(var s=0,h="",c;s<t.length;)t.charAt(s)==="%"?(c=t.charAt(s)+t.charAt(s+1),w[c]!==e?(h+=w[c].format(this),s+=1):h+="%"):h+=t.charAt(s),s+=1;return h},S.fn.valid=function(){return this._i.year===!1&&this._i.month===!1&&this._i.day===!1&&this._i.hours===!1&&this._i.minutes===!1&&this._i.seconds===!1&&this._i.milliseconds===!1},S.fn.errors=function(){return this._i},S.fn.between=function(t,s){var h=this.timestamp(),c=t.timestamp();switch(s){case"year":return Math.floor((c-h)/31556952);case"month":return Math.floor((c-h)/2629746);case"day":return Math.floor((c-h)/86400);case"hours":return Math.floor((c-h)/3600);case"minutes":return Math.floor((c-h)/60);case"seconds":return c-h;default:return e}},S.fn.calc=function(t){return t.year!==e&&this._d.setFullYear(this._d.getFullYear()+t.year),t.month!==e&&this._d.setMonth(this._d.getMonth()+t.month),t.day!==e&&this._d.setDate(this._d.getDate()+t.day),t.hours!==e&&this._d.setHours(this._d.getHours()+t.hours),t.minutes!==e&&this._d.setMinutes(this._d.getMinutes()+t.minutes),t.seconds!==e&&this._d.setSeconds(this._d.getSeconds()+t.seconds),t.milliseconds!==e&&this._d.setMilliseconds(this._d.getMilliseconds()+t.milliseconds),this},i=function(t,s,h){return new S(t,s,h)},i.MIN_YEAR=1e3,i.MAX_YEAR=3e3,i.MIN_MONTH=1,i.MAX_MONTH=12,i.MIN_DAY=1,i.MAX_DAY_IN_MONTHS=[31,28,31,30,31,30,31,31,30,31,30,31],i.MIN_DAY_OF_WEEK=0,i.MAX_DAY_OF_WEEK=6,i.MIN_HOURS=0,i.MAX_HOURS=23,i.MIN_MINUTES=0,i.MAX_MINUTES=59,i.MIN_SECONDS=0,i.MAX_SECONDS=59,i.MIN_MILLISECONDS=0,i.MAX_MILLISECONDS=999,i.VERSION="0.2.18",i.options=function(t,s){if(t===e)return jt;if(jt.hasOwnProperty(t)){if(s===e)return jt[t];jt[t]=s,t==="monthFromZero"&&(i.MIN_MONTH=s?0:1,i.MAX_MONTH=s?11:12)}return e},i.noConflict=function(){return n.tempus=u,i},i.generate=function(t){var s,h,c,p,d,L,K,Y;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof S?s=t.dateFrom.utc():s=i(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof S?h=t.dateTo.utc():h=i(t.dateTo,t.formatTo!==e?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?d={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?d={year:t.period==="year"?1:0,month:t.period==="month"?1:0,day:t.period==="day"?1:0,hours:t.period==="hours"?1:0,minutes:t.period==="minutes"?1:0,seconds:t.period==="seconds"?1:0}:typeof t.period=="object"&&(d={year:t.period.year!==e?t.period.year:0,month:t.period.month!==e?t.period.month:0,day:t.period.day!==e?t.period.day:0,hours:t.period.hours!==e?t.period.hours:0,minutes:t.period.minutes!==e?t.period.minutes:0,seconds:t.period.seconds!==e?t.period.seconds:0}),t.groupBy===e?L=t.asObject===!0?{}:[]:(L=[],L.push([]),K=i(s).get()[t.groupBy]),Y=function(W,H,D){return t.asObject===!0?t.format!==e?W[i(H).format(t.format)]={}:W[i(H).format("%F %H:%M:%S")]={}:t.format!==e?W.push(D?null:i(H).format(t.format)):W.push(D?null:i(H)),W},t.groupBy!==e&&t.fillNulls){var I={year:d.year?-d.year:e,month:d.month?-d.month:e,day:d.day?-d.day:e,hours:d.hours?-d.hours:e,minutes:d.minutes?-d.minutes:e,seconds:d.seconds?-d.seconds:e,milliseconds:d.milliseconds?-d.milliseconds:e};for(c=i(s).calc(I).utc();i(c).get()[t.groupBy]===K;)Y(L[L.length-1],c,!0),c=i(c).calc(I).utc();if(t.groupBy==="week"){var b=i(s).dayOfWeek();for(c=i(s).dayOfWeek(0).utc();L[0].length<b&&c<s;)Y(L[L.length-1],c,!0),c=i(c).calc(d).utc()}}for(;s<=h;)t.groupBy===e?Y(L,s):i(s).get()[t.groupBy]===K?Y(L[L.length-1],s):(L.push([]),Y(L[L.length-1],s),K=i(s).get()[t.groupBy]),s=i(s).calc(d).utc();if(t.groupBy!==e&&t.fillNulls)for(p=i(h).calc(d).utc();i(p).get()[t.groupBy]===K;)Y(L[L.length-1],p,!0),p=i(p).calc(d).utc();return L},i.monthNames=function(t){switch(t){case"long":return X;default:return Xt}},i.dayNames=function(t){switch(t){case"long":return bt;default:return Ht}},i.lang=function(t){if(t!==e)m=t,N[m]===e&&(m="en"),X=P(),Xt=pt(),bt=ot(),Ht=x();else return m;return e},i.availableLangs=function(){return Object.keys(N)},i.registerFormat=function(t,s,h,c,p,d){w[t]={format:s,parse:h,minLength:c,maxLength:p,type:d}},i.unregisterFormat=function(t){delete w[t]},i.detectFormat=function(t){var s,h,c;return s=O(t,0),s!==""&&(c=10),h=t.charAt(c),(h==="T"||h===" ")&&(s+=h,c+=1),s+=l(t,c),s},R={TempusDate:S},i.classes=function(t,s){if(s===e)return R[t];R[t]=s},i.loadTranslations=function(t){typeof t=="object"?N=t:typeof t=="string"&&de(t,function(s){N=s},function(s){})},m=(E.language||E.systemLanguage||E.userLanguage||"en").substr(0,2).toLowerCase(),N[m]===e&&(m="en"),X=P(),Xt=pt(),bt=ot(),Ht=x(),G.exports&&(A=G.exports=i),A.tempus=i}).call(T)})(ht,ht.exports);var Oe=ht.exports;const mt=M(Oe);class j{constructor(A,e={}){f(this,at);f(this,Nt);f(this,_t);f(this,Ot);f(this,yt);f(this,dt);f(this,It);f(this,Ut);f(this,gt);f(this,Et);f(this,Tt);f(this,lt);f(this,Rt);f(this,Gt);f(this,it);f(this,ct);f(this,St);f(this,q,null);f(this,ft,null);f(this,v,[]);f(this,B,{});f(this,J,50);f(this,Q,50);f(this,$,!0);f(this,tt,null);f(this,U,null);f(this,Z,null);f(this,Bt,100);f(this,et,"no");f(this,F,!1);f(this,At,!1);f(this,st,!1);C(this,"errors",{});C(this,"answerData",{});y(this,q,A),y(this,ft,e)}get serial(){return o(this,F)}get limitCommandSerial(){return o(this,Q)}set limitCommandSerial(A){if(A<10)throw new Error("limitCommandSerial не может быть меньше 10");A>=10&&A<50&&(y(this,J,A),y(this,Q,A)),y(this,Q,A)}setSerial(){y(this,F,!0),y(this,At,!0),y(this,st,!1)}setParallel(){y(this,F,!1),y(this,At,!1),y(this,st,!0)}stop(){y(this,$,!1)}async batch(A,e){o(this,Z)&&_(this,Nt,Kt).call(this),e&&y(this,tt,e),o(this,At)===!1&&y(this,F,!1),Object.keys(A).length>o(this,Q)&&y(this,F,!0),y(this,$,!0),y(this,v,[]),y(this,B,{}),this.errors={},this.answerData={};const n=_(this,Ot,vt).call(this,A);if(Object.keys(A).length<o(this,Q)){const r=n.map((a,l)=>_(this,yt,$t).call(this,a,n[l]));return Promise.allSettled(r).then(a=>{let l={};for(let O of a)O.status==="fulfilled"&&(l={...l,...O.value});return l})}else{let r={},a=0,l=1,O=Object.keys(A).length||1,u=i=>{a+=Object.keys(i).length,l=Math.round(a/O*100)};for(let[i,R]of Object.entries(n)){let E=await _(this,yt,$t).call(this,R,n[i],!0);u(R),e&&e({percent:l}),r={...r,...E}}return r}}async batchTotalCount(A,e){y(this,B,{}),this.errors={};let n=1,r=0,a=Object.keys(A).length||1,l=u=>{r+=Object.keys(u).length,n=Math.round(r/a*100)};e&&e({percent:n});const O=_(this,Ot,vt).call(this,A);if(o(this,st)){const u=O.map(i=>_(this,dt,te).call(this,i).then(R=>(l(i),e&&e({percent:n}),R)));return Promise.allSettled(u).then(i=>{let R={};for(let E of i)E.status==="fulfilled"&&(R={...R,...E.value});return R})}else{let u={};for(let i of O){let R=await _(this,dt,te).call(this,i);l(i),e&&e({percent:n}),u={...u,...R}}return u}}}q=new WeakMap,ft=new WeakMap,v=new WeakMap,B=new WeakMap,J=new WeakMap,Q=new WeakMap,$=new WeakMap,tt=new WeakMap,U=new WeakMap,Z=new WeakMap,Bt=new WeakMap,et=new WeakMap,F=new WeakMap,At=new WeakMap,st=new WeakMap,at=new WeakSet,xt=function(){let A=0;if(!o(this,U))return Math.round(A);let e=0,n=0;return Object.values(o(this,U)).forEach(r=>{const{total:a,count:l}=r;e+=a??0,n+=l??0}),e?A=n/e*100:A=100,{percent:Math.round(A),allCount:n,allTotal:e}},Nt=new WeakSet,Kt=function(){clearInterval(o(this,Z)),y(this,Z,""),y(this,U,""),y(this,tt,""),y(this,et,"no")},_t=new WeakSet,qt=function({key:A,value:e}){const n=_(this,it,Dt).call(this,e.data()),r=Array.isArray(n)?n.length:0,a=_(this,ct,Zt).call(this,e.total(),r);let l=1;n&&(l=r),o(this,tt)&&(o(this,U)||y(this,U,{}),o(this,U)[A]&&o(this,U)[A].count&&(l+=o(this,U)[A].count),o(this,U)[A]={total:a,count:l},o(this,Z)||y(this,Z,setInterval(()=>{const{percent:O,allCount:u,allTotal:i}=o(this,at,xt);(o(this,et)==="no"||o(this,et)<o(this,at,xt).percent)&&(o(this,tt).call(this,{data:o(this,U),percent:O,allCount:u,allTotal:i}),y(this,et,o(this,at,xt).percent)),O===100&&_(this,Nt,Kt).call(this)},o(this,Bt))))},Ot=new WeakSet,vt=function(A){const e=[],n=Object.entries(A);for(let r=0;r<n.length;r+=o(this,J)){const a=n.slice(r,r+o(this,J));e.push(Object.fromEntries(a))}return e},yt=new WeakSet,$t=function(A,e,n){return new Promise(r=>{const a=_(this,Rt,ie).call(this,e),l=[];let O=0,u=0;o(this,q).call(this,A,i=>{Object.entries(i).forEach(([R,E])=>{let m={};const N=E.error();if(N){let{query:{method:x},answer:X}=E;this.errors[R]={error:N,method:x},O+=1}if(E!=null&&E.answer&&Object.keys(E.answer).length){for(let[x,X]of Object.entries(E.answer))x!="result"&&X&&(m[x]=X);Object.keys(m).length&&(this.answerData[R]=m)}const P=_(this,it,Dt).call(this,E.data()),pt=Array.isArray(P)?P.length:0,ot=_(this,ct,Zt).call(this,E.total(),pt);if(Array.isArray(P)?o(this,B)[R]=P:typeof P=="object"&&P!==null&&Object.keys(P).length===0?o(this,B)[R]=[]:o(this,B)[R]=P,u+=ot,n||_(this,_t,qt).call(this,{key:R,value:E}),ot>o(this,J)&&ot>pt){const x=Math.ceil(ot/o(this,J))-1,X=Array.from({length:x});l.push([R,a[R],X])}}),u>5e3&&o(this,At)===!1&&o(this,st)===!1&&y(this,F,!0),O>0&&_(this,St,re).call(this),l.length?(_(this,It,he).call(this,l),_(this,Ut,ae).call(this).then(()=>r(_(this,lt,Qt).call(this)))):r(_(this,lt,Qt).call(this))})})},dt=new WeakSet,te=function(A){return new Promise(e=>{const n=_(this,Rt,ie).call(this,A);let r=0;o(this,q).call(this,n,a=>{Object.entries(a).forEach(([l,O])=>{const u=O.error();u&&(this.errors[l]=u,r+=1);const i=_(this,it,Dt).call(this,O.data()),R=Array.isArray(i)?i.length:0,E=_(this,ct,Zt).call(this,O.total(),R);o(this,B)[l]=E}),r>0&&_(this,St,re).call(this),e(_(this,lt,Qt).call(this))})})},It=new WeakSet,he=function(A){let e=[];A.forEach(([n,r,a])=>{a.forEach((l,O)=>{const u=O+1,i=o(this,J)*u,E=[[n,u].join("_"),_(this,Gt,le).call(this,r,i)];e.length===o(this,J)?(o(this,v).push(e),e=[E]):e.push(E)})}),e.length&&o(this,v).push(e)},Ut=new WeakSet,ae=function(){const A=[],e=[],n=r=>{Object.entries(r).forEach(([a,l])=>{const[O]=a.split("_"),u=_(this,it,Dt).call(this,l.data());Array.isArray(u)&&o(this,B)[O].push(...u),_(this,_t,qt).call(this,{key:O,value:l})})};return o(this,v).forEach((r,a)=>{const l=Object.fromEntries(r),O=()=>new Promise(u=>o(this,q).call(this,l,i=>{o(this,F)?n(i):e[a]=i,u()}));A.push(O)}),o(this,F)?_(this,Et,Ae).call(this,A):_(this,Tt,se).call(this,A).then(()=>{e.forEach(n)})},gt=new WeakSet,ee=function(){return new Promise(A=>setTimeout(A,500))},Et=new WeakSet,Ae=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return Promise.allSettled([e(),_(this,gt,ee).call(this)]).then(()=>o(this,$)?_(this,Et,Ae).call(this,A):Promise.resolve())},Tt=new WeakSet,se=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return _(this,gt,ee).call(this).then(()=>e()).then(()=>o(this,$)?_(this,Tt,se).call(this,A):Promise.resolve())},lt=new WeakSet,Qt=function(){return Object.entries(o(this,ft)).forEach(([A,e])=>{o(this,B)[A]&&(o(this,B)[A]=e(o(this,B)[A]))}),o(this,B)},Rt=new WeakSet,ie=function(A){return Object.entries(A).reduce((e,[n,r])=>{if(Array.isArray(r)){const[a,l={}]=r;e[n]=[a,l]}else{const{method:a,params:l={}}=r;e[n]=[a,l]}return e},{})},Gt=new WeakSet,le=function(A,e){const[n,r]=A;return[n,{start:e,...r}]},it=new WeakSet,Dt=function(A){return((A==null?void 0:A.items)||(A==null?void 0:A.documents))??A},ct=new WeakSet,Zt=function(A,e){return A!==A&&(A=0),A===0&&e===0?0:A||e},St=new WeakSet,re=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([A,e])=>{console.info(`[${A}]`,e)}),console.groupEnd()};class Vt{constructor(){f(this,rt,{})}get hash(){return this.createHash(8)}createHash(A){let e="abcdefghijklmnopqrstuvwxyz0123456789",n="";A=A||6;for(let r=0;r<A;r++)n+=e.charAt(Math.floor(Math.random()*e.length));return n}actionFilter({keyTimer:A,duration:e=10,action:n}){o(this,rt)[A]&&(clearTimeout(o(this,rt)[A]),o(this,rt)[A]=null),n&&(o(this,rt)[A]=setTimeout(()=>{n()},e))}async noSleep(){let A=document.createElement("video");A.classList.add("no-sleep"),A.addEventListener("loadeddata",()=>{A.style.position="fixed",A.style.left="-9999px",document.querySelector("body").append(A),A.play()}),A.addEventListener("ended",()=>{this.actionFilter({keyTimer:"no-sleep",duration:5e3,action:()=>A.play()})}),A.src="data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAP5tZGF0AAAAAQYAAADlZYiEE28FmH9jNWDBjI+Z/1tIBZsjfhbmcNNUpBFej0U3p+zhaJ3eemJRL2LUMa5tkidy6bp+eatLE3jBIY864TvaAmqEFCgLMTCwVbem1n3myAw9yDXQdR5HfU/8iYf+eneVnRf7Qx9M70XDUuPx1MJX671XJwAE0VAMpnhbcUDx0pTldvUX9KQPhkZNH3eyZHmObkAeyEJ2tl+BEBJIGc90BiqKL60+5EA6fXB6iG5UU/M5KsW8BNAAUw5CbRJIqohNk10fwKbUXwya03rqGkE8+wuYGtEbrVYXb+iOl1mHHVPLYQbIAAcGyAAHAAAFNG1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAAAAvAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAIldHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAFAAAAA8AAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAAAAAAAAAAAQAAAAABnW1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAQAAAAAAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAUhtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAEIc3RibAAAAKRzdHNkAAAAAAAAAAEAAACUYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAFAAPAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAC5hdmNDAU1AC//hABZnTUAL2wUH7ARAAAADAEAAAAQDxQq4AQAFaOrAZXIAAAAQcGFzcAAAAAEAAAABAAAAGHN0dHMAAAAAAAAAAQAAAAEAAAAAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAAO4AAAABAAAAFHN0Y28AAAAAAAAAAQAAADAAAAIadHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAgAAAAAAAAAvAAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAALwAAAAAAAQAAAAABkm1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAArEQAAAgAVcQAAAAAAC1oZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU291bmRIYW5kbGVyAAAAAT1taW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAQFzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAAC7gAAAAViBYCAgAISCAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAAACAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAgAAAAEAAAAUc3RzegAAAAAAAAAEAAAAAgAAABRzdGNvAAAAAAAAAAEAAAEeAAAAGnNncGQBAAAAcm9sbAAAAAIAAAAB//8AAAAcc2JncAAAAAByb2xsAAAAAQAAAAIAAAABAAAAgXVkdGEAAAB5bWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWR0YQAAAAAAAAAAAAAAAAAAAAAfa2V5cwAAAAAAAAABAAAAD21kdGFlbmNvZGVyAAAALWlsc3QAAAAlAAAAAQAAAB1kYXRhAAAAAQAAAABMYXZmNTguMTIuMTAw"}downloadFileJson(A,e){let n=new Blob([JSON.stringify(A)],{type:"application/json"}),r=URL.createObjectURL(n),a=document.createElement("a");a.style.display="none",a.href=r,a.download=`${e}.json`,document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(r)},200)}}rt=new WeakMap;const Yt=new Vt;class oe{constructor(){f(this,Ct);f(this,Mt);f(this,Ft);f(this,Pt);f(this,Wt);f(this,k,"logger");f(this,V,!1);f(this,wt,2e3);f(this,nt,new Map);f(this,Lt,{});f(this,z,null);f(this,ut,!1);C(this,"periodClear",3);_(this,Ct,ce).call(this)}async init(){let A=new j(BX24.callBatch),{entityList:e}=await A.batch({entityList:{method:"entity.get"}});if(e!=null&&e.length)if(e.find(r=>r.ENTITY==o(this,k)))y(this,V,!0);else{let{entityAdd:r}=await A.batch({entityAdd:{method:"entity.add",params:{ENTITY:o(this,k),NAME:o(this,k),ACCESS:{AU:"X"}}}});r&&y(this,V,!0)}return _(this,Pt,me).call(this),o(this,V)}start({type:A,data:e}){if(!o(this,V)){_(this,Mt,ne).call(this,"entity");return}const n=Yt.hash;return o(this,nt).set(n,{type:A,data:e,userInfo:o(this,Lt),errorList:[],status:"",answer:null,date:new Date().getTime()}),n}stop({key:A,errorList:e,status:n,answer:r}){if(!o(this,V)){_(this,Mt,ne).call(this,"entity");return}let a=o(this,nt).get(A);e&&(a.errorList=e),n&&(a.status=n),r&&(a.answer=r),Yt.actionFilter({keyTimer:"add.entity.items",duration:o(this,wt),action:async()=>{var l;await _(this,Ft,ue).call(this),(l=a==null?void 0:a.data)!=null&&l.updateList&&y(this,ut,!0)}})}async getEntityList(A){var r;if((r=o(this,z))!=null&&r.length&&!o(this,ut))return o(this,z);let e=new j(BX24.callBatch),{entityList:n}=await e.batch({entityList:{method:"entity.item.get",params:{ENTITY:o(this,k),SORT:{ID:"DESC"}}}},A);return n=n.map(a=>{const{ID:l,DATE_CREATE:O,DETAIL_TEXT:u}=a;return{...JSON.parse(u),id:l,dateCreate:O}}),y(this,ut,!1),n}async downAllEntityJson(){let A=await this.getEntityList(),e=mt().format("%Y-%m-%d");Yt.downloadFileJson(A,`sdklogger-entity-data__${e}`)}}k=new WeakMap,V=new WeakMap,wt=new WeakMap,nt=new WeakMap,Lt=new WeakMap,z=new WeakMap,ut=new WeakMap,Ct=new WeakSet,ce=async function(){const A=new j(BX24.callBatch),e=BX24.isAdmin(),{curUser:n}=await A.batch({curUser:{method:"user.current"}});y(this,Lt,{isAdmin:e,curUser:n})},Mt=new WeakSet,ne=function(A){A=="entity"&&Yt.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},Ft=new WeakSet,ue=async function(){let A={},e=new j(BX24.callBatch);for(let[n,r]of o(this,nt).entries())r.status&&(A[n]={method:"entity.item.add",params:{ENTITY:o(this,k),NAME:o(this,k),DETAIL_TEXT:JSON.stringify(r)}});if(Object.keys(A).length){let n=await e.batch(A),{errors:r}=e;for(let[a,l]of Object.entries({...n,...r}))o(this,nt).delete(a);return!0}},Pt=new WeakSet,me=async function(){let A=new j(BX24.callBatch),{serverTime:e}=await A.batch({serverTime:{method:"server.time"}});o(this,z)||y(this,z,await this.getEntityList());let n=o(this,z).filter(r=>{let{dateCreate:a}=r;return mt(new Date(a)).between(mt(new Date(e)),"month")>=this.periodClear});_(this,Wt,fe).call(this,n)},Wt=new WeakSet,fe=async function(A){let e=new j(BX24.callBatch),n=A.map(r=>{let{id:a}=r;return{method:"entity.item.delete",params:{ENTITY:o(this,k),ID:a}}});return await e.batch(n)};class ye{constructor(A){f(this,Jt);f(this,kt);C(this,"domain","");C(this,"isAdmin",!1);C(this,"appInfo",null);C(this,"appConst",null);C(this,"userInfo",null);C(this,"placeData",null);C(this,"placeInfo",null);C(this,"logger",new oe);this.appConst=A}init(){return new Promise(A=>{let e=setInterval(()=>{window.BX24&&BX24.init(async()=>{console.info("init BX24"),clearInterval(e),this.domain=BX24.getDomain(),this.isAdmin=BX24.isAdmin(),this.placeInfo=BX24.placement.info(),await this.logger.init();const[n,r]=await Promise.all([_(this,Jt,Ne).call(this),_(this,kt,_e).call(this)]);this.appInfo=n,this.userInfo=r,new Vt().noSleep(),A(!0)})},100)})}userOption(A,e){return e?BX24.userOption.set(A,e):BX24.userOption.get(A)}call({method:A,params:e,updateList:n}){let r=this.logger.start({type:"call",data:{method:A,params:e,updateList:n}});return new Promise(a=>{e||(e={}),BX24.callMethod(A,e,function(l){let O={};if(l!=null&&l.answer)for(let[u,i]of Object.entries(l.answer))u!="result"&&i&&(O[u]=i);if(l.error()){let u=l.error();console.error(u),this.logger.stop({answer:O,key:r,status:"fail",errorList:[u.toSting()]}),a(!1)}else{let u=l.data();u!=null&&u.items&&(u=u.items),this.logger.stop({answer:O,key:r,status:"success"}),a(u)}})})}async batch(A,e,{updateList:n,errorCall:r,limitCommandSerial:a}={}){let l=new j(BX24.callBatch),O=this.logger.start({type:"batch",data:{commandList:A,updateList:n}});a&&(l.limitCommandSerial=a);try{let u=await l.batch(A,e);if(Object.keys(l.errors).length){let i=Object.entries(l.errors).map(([R,E])=>{var m;return{key:R,error:`${E==null?void 0:E.method} ${(m=E==null?void 0:E.error)==null?void 0:m.toString()}`.trim()}});r&&r(l.errors),this.logger.stop({key:O,status:"fail",errorList:i,answer:l.answerData})}else this.logger.stop({key:O,status:"success",answer:l.answerData});return u}catch(u){let i=u==null?void 0:u.toString();return this.logger.stop({key:O,status:"fail-runtime",errorList:[i],answer:l.answerData}),console.error(u),!1}}async batchTotalCount(A,e){let n=new j(BX24.callBatch),r=this.logger.start({type:"batch",data:{commandList:A}});try{let a=await n.batchTotalCount(A,e);if(Object.keys(n.errors).length){let l=Object.entries(n.errors).map(([O,u])=>({key:O,error:u.toSting()}));this.logger.stop({key:r,status:"fail",errorList:l})}else this.logger.stop({key:r,status:"success"});return a}catch(a){return this.logger.stop({key:r,status:"fail",errorList:[a.toSting()]}),console.error(a),!1}}getPlacement(){return this.call({method:"placement.get"}).then(A=>(this.placeData||(this.placeData=A),A))}async placementBind(A){this.placeData||(this.placeData=await this.getPlacement());const{appName:e,pathApp:n}=this.appConst,r=this.placeData.map(l=>l.placement);let a=this.placeData.find(l=>l.placement==A);r.includes(A)?a.handler!=n&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[A]||this.placementUnBind(a).then(()=>{window.placementUnBind[A]||(window.placementUnBind[A]=!0,this.placementBind(A))})):this.call({method:"placement.bind",params:{PLACEMENT:A,HANDLER:n,LANG_ALL:{ru:{TITLE:e}}}}).then(l=>{l?console.info("Приложение успешно встроено в",A):console.warn("Приложение не может быть встроено в",A)})}placementUnBind(A){const{pathApp:e,appName:n}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:A,HANDLER:e,LANG_ALL:{ru:{TITLE:n}}}}).then(r=>(console.log("Встройка отвязана",A),r))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(A=>{let e=Object.values(A);return console.log("chat-bot list:",e),e})}regBot({code:A,type:e,name:n}){const{appName:r,pathApp:a,chatBotLogo:l}=this.appConst,O=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:A??this.appInfo.CODE,TYPE:e??"O",EVENT_HANDLER:a,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${n??r} - бот #${O}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:mt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:l??""}}}).then(u=>(console.log("Чат-бот добавлен",u),u))}unRegBot(A){return this.call({method:"imbot.unregister",params:{BOT_ID:A}}).then(e=>(console.log("чат-бот удален",e),e))}getLoggerList(A){return this.logger.getEntityList(A)}}Jt=new WeakSet,Ne=function(){return this.call({method:"app.info"})},kt=new WeakSet,_e=function(){return this.call({method:"user.current"})},g.Batch=j,g.BxBoot=ye,g.BxHelper=Vt,g.BxLogger=oe,g.tempus=mt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
2
+ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`):s(JSON.parse(c.responseText))):h&&h(c))},c.open("GET",t,!1),c.send()},w={"%d":{format:function(t){return r(t.day()||i.MIN_DAY,2)},parse:function(t){var s=Number(t);return{day:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%m":{format:function(t){return r(t.month()||i.MIN_MONTH,2)},parse:function(t){var s=Number(t);return{month:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%Y":{format:function(t){return r(t.year()||i.MIN_YEAR,4)},parse:function(t){var s=Number(t);return{year:isNaN(s)?e:s}},minLength:4,maxLength:4,type:"number"},"%w":{format:function(t){return t.dayOfWeek()||i.MIN_DAY_OF_WEEK},parse:function(){return{}},minLength:1,maxLength:1,type:"number"},"%a":{format:function(t){var s=t.dayOfWeek();return Ht[s!==e?s:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%A":{format:function(t){var s=t.dayOfWeek();return bt[s!==e?s:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%b":{format:function(t){var s=i.options("monthFromZero")?t.month():t.month()-1;return Xt[s!==e?s:i.MIN_MONTH]},parse:function(t){var s=i.monthNames().indexOf(t)+(i.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%B":{format:function(t){var s=i.options("monthFromZero")?t.month():t.month()-1;return X[s!==e?s:i.MIN_MONTH]},parse:function(t){var s=i.monthNames(!0).indexOf(t)+(i.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%H":{format:function(t){return r(t.hours()||i.MIN_HOURS,2)},parse:function(t){var s=Number(t);return{hours:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%M":{format:function(t){return r(t.minutes()||i.MIN_MINUTES,2)},parse:function(t){var s=Number(t);return{minutes:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%S":{format:function(t){return r(t.seconds()||i.MIN_SECONDS,2)},parse:function(t){var s=Number(t);return{seconds:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%s":{format:function(t){return t.timestamp()},parse:function(t){return isNaN(Number(t))?{}:i(Number(t)).get()},minLength:1,maxLength:20,type:"number"},"%F":{format:function(t){return r(t.year()||i.MIN_YEAR,4)+"-"+r(t.month()||i.MIN_MONTH,2)+"-"+r(t.day()||i.MIN_DAY,2)},parse:function(t){var s=Number(t.slice(0,4)),h=Number(t.slice(5,7)),c=Number(t.slice(8,10));return{year:s,month:h,day:c}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(t){return r(t.month()||i.MIN_MONTH,2)+"/"+r(t.day()||i.MIN_DAY,2)+"/"+r(t.year()||i.MIN_YEAR,4)},parse:function(t){var s=Number(t.slice(0,2)),h=Number(t.slice(3,5)),c=Number(t.slice(6,10));return{year:c,month:s,day:h}},minLength:10,maxLength:10,type:"string"}},jt={useMilliseconds:!1,monthFromZero:!1},S;S=function(t,s,h){return this._d=new Date,this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t!==e&&this.set(t,s,h),this},S.fn=S.prototype,S.fn.dayCount=function(){var t=this.month(),s=i.MAX_DAY_IN_MONTHS[t-(i.options("monthFromZero")?0:1)];return this.leapYear()&&t===(i.options("monthFromZero")?1:2)&&(s+=1),s},S.fn.year=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_YEAR&&Number(t)<=i.MAX_YEAR?(this._d.setFullYear(Number(t)),this._i.year=!1):this._i.year=Number(t):(this._d.setFullYear(i.MIN_YEAR),this._i.year=!1);else return this._i.year===!1?this._d.getFullYear():this._i.year;return this},S.fn.month=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MONTH&&Number(t)<=i.MAX_MONTH?(this._d.setMonth(i.options("monthFromZero")?Number(t):Number(t)-1),this._i.month=!1):this._i.month=Number(t):(this._d.setMonth(i.options("monthFromZero")?i.MIN_MONTH:i.MIN_MONTH-1),this._i.month=!1);else return this._i.month===!1?i.options("monthFromZero")?this._d.getMonth():this._d.getMonth()+1:this._i.month;return this},S.fn.day=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_DAY&&Number(t)<=this.dayCount()?(this._d.setDate(Number(t)),this._i.day=!1):this._i.day=Number(t):(this._d.setDate(i.MIN_DAY),this._i.day=!1);else return this._i.day===!1?this._d.getDate():this._i.day;return this},S.fn.hours=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_HOURS&&Number(t)<=i.MAX_HOURS?(this._d.setHours(Number(t)),this._i.hours=!1):this._i.hours=Number(t):(this._d.setHours(i.MIN_HOURS),this._i.hours=!1);else return this._i.hours===!1?this._d.getHours():this._i.hours;return this},S.fn.minutes=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MINUTES&&Number(t)<=i.MAX_MINUTES?(this._d.setMinutes(Number(t)),this._i.minutes=!1):this._i.minutes=Number(t):(this._d.setMinutes(i.MIN_MINUTES),this._i.minutes=!1);else return this._i.minutes===!1?this._d.getMinutes():this._i.minutes;return this},S.fn.seconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_SECONDS&&Number(t)<=i.MAX_SECONDS?(this._d.setSeconds(Number(t)),this._i.seconds=!1):this._i.seconds=Number(t):(this._d.setSeconds(i.MIN_SECONDS),this._i.seconds=!1);else return this._i.seconds===!1?this._d.getSeconds():this._i.seconds;return this},S.fn.milliseconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MILLISECONDS&&Number(t)<=i.MAX_MILLISECONDS?(this._d.setMilliseconds(Number(t)),this._i.milliseconds=!1):this._i.milliseconds=Number(t):(this._d.setMilliseconds(i.MIN_MILLISECONDS),this._i.milliseconds=!1);else return this._i.milliseconds===!1?this._d.getMilliseconds():this._i.milliseconds;return this},S.fn.week=function(){var t=new Date(this.year(),0,1),s=i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc()*1e3;return Math.ceil(((s-t.getTime())/864e5+t.getDay()+1)/7)},S.fn.set=function(t,s,h){if(this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t===e)return this._d=new Date,this;if(t instanceof Date)return this._d=t,this;if(typeof t=="number")return this._d=new Date(t*(i.options("useMilliseconds")?1:1e3)),this;if(typeof t=="object"&&(t instanceof Array?(this.day(i.MIN_DAY),this.year(t[0]),this.month(t[1]),this.day(t[2]),this.hours(t[3]),this.minutes(t[4]),this.seconds(t[5]),this.milliseconds(t[6])):(this.day(i.MIN_DAY),this.year(t.year),this.month(t.month),this.day(t.day),this.hours(t.hours),this.minutes(t.minutes),this.seconds(t.seconds),this.milliseconds(t.milliseconds))),typeof t=="string"){var c,p=[],d,L,K=[],Y=0,I=0,b,W,H={},D;if(t===e)return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;for(s===e&&(s=i.detectFormat(t));Y<s.length;){if(s.charAt(Y)==="%"){if(L=s.charAt(Y)+s.charAt(Y+1),w[L]!==e){switch(b=0,W="",w[L].type){case"number":for(;b<w[L].maxLength&&I+b<t.length&&!isNaN(Number(t.charAt(I+b)));)W+=t.charAt(I+b),b+=1;break;case"word":for(;b<w[L].maxLength&&I+b<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(I+b));)W+=t.charAt(I+b),b+=1;break;case"string":for(;b<w[L].maxLength&&I+b<t.length;)W+=t.charAt(I+b),b+=1;break}if(b<w[L].minLength)return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;p.push(L),K.push(W),b-=1,I+=b,Y+=1}}else if(t.charAt(I)!==s.charAt(Y))return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;Y+=1,I+=1}for(c in p)p.hasOwnProperty(c)&&w.hasOwnProperty(p[c])&&(D=w[p[c]].parse(K[c]),H={year:D.year!==e?D.year:H.year,month:D.month!==e?D.month:H.month,day:D.day!==e?D.day:H.day,hours:D.hours!==e?D.hours:H.hours,minutes:D.minutes!==e?D.minutes:H.minutes,seconds:D.seconds!==e?D.seconds:H.seconds});this.day(i.MIN_DAY),this.year(H.year),this.month(H.month),this.day(H.day),this.hours(H.hours),this.minutes(H.minutes),this.seconds(H.seconds),this.milliseconds(H.milliseconds)}return this},S.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},S.fn.timestamp=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(i.options("useMilliseconds")?1:1e3)+this._d.getTimezoneOffset()*6e4),this):i.options("useMilliseconds")?this._d.getTime()-this._d.getTimezoneOffset()*6e4:Math.floor(this._d.getTime()/1e3)-this._d.getTimezoneOffset()*60},S.fn.utc=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(i.options("useMilliseconds")?1:1e3)),this):i.options("useMilliseconds")?this._d.getTime():Math.floor(this._d.getTime()/1e3)},S.fn.dayOfWeek=function(t){if(t==="long")return bt[this._d.getDay()];if(t==="short")return Ht[this._d.getDay()];if(t===e)return this._d.getDay();if(t===0||t==="Sunday")return this.calc({day:-this.dayOfWeek()});if(t===1||t==="Monday")return this.calc({day:(this.dayOfWeek()===0?-6:1)-this.dayOfWeek()});if(t===2||t==="Tuesday")return this.calc({day:(this.dayOfWeek()===0?-5:2)-this.dayOfWeek()});if(t===3||t==="Wednesday")return this.calc({day:(this.dayOfWeek()===0?-4:3)-this.dayOfWeek()});if(t===4||t==="Thursday")return this.calc({day:(this.dayOfWeek()===0?-3:4)-this.dayOfWeek()});if(t===5||t==="Friday")return this.calc({day:(this.dayOfWeek()===0?-2:5)-this.dayOfWeek()});if(t===6||t==="Saturday")return this.calc({day:(this.dayOfWeek()===0?-1:6)-this.dayOfWeek()})},S.fn.timezone=function(t){switch(t){case"hours":return Math.floor(this._d.getTimezoneOffset()/60);case"minutes":return this._d.getTimezoneOffset();default:return this._d.getTimezoneOffset()*60}},S.fn.get=function(t){switch(t){case"Date":return new Date(this.year(),this.month()-(i.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds());case"DateUTC":return new Date(Date.UTC(this.year(),this.month()-(i.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()));case"Array":return[this.year(),this.month(),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()];default:return{year:this.year(),month:this.month(),week:this.week(),day:this.day(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds(),utc:this.utc(),dayOfWeek:this.dayOfWeek(),dayOfWeekShort:this.dayOfWeek("short"),dayOfWeekLong:this.dayOfWeek("long"),timestamp:this.timestamp()}}},S.fn.format=function(t){for(var s=0,h="",c;s<t.length;)t.charAt(s)==="%"?(c=t.charAt(s)+t.charAt(s+1),w[c]!==e?(h+=w[c].format(this),s+=1):h+="%"):h+=t.charAt(s),s+=1;return h},S.fn.valid=function(){return this._i.year===!1&&this._i.month===!1&&this._i.day===!1&&this._i.hours===!1&&this._i.minutes===!1&&this._i.seconds===!1&&this._i.milliseconds===!1},S.fn.errors=function(){return this._i},S.fn.between=function(t,s){var h=this.timestamp(),c=t.timestamp();switch(s){case"year":return Math.floor((c-h)/31556952);case"month":return Math.floor((c-h)/2629746);case"day":return Math.floor((c-h)/86400);case"hours":return Math.floor((c-h)/3600);case"minutes":return Math.floor((c-h)/60);case"seconds":return c-h;default:return e}},S.fn.calc=function(t){return t.year!==e&&this._d.setFullYear(this._d.getFullYear()+t.year),t.month!==e&&this._d.setMonth(this._d.getMonth()+t.month),t.day!==e&&this._d.setDate(this._d.getDate()+t.day),t.hours!==e&&this._d.setHours(this._d.getHours()+t.hours),t.minutes!==e&&this._d.setMinutes(this._d.getMinutes()+t.minutes),t.seconds!==e&&this._d.setSeconds(this._d.getSeconds()+t.seconds),t.milliseconds!==e&&this._d.setMilliseconds(this._d.getMilliseconds()+t.milliseconds),this},i=function(t,s,h){return new S(t,s,h)},i.MIN_YEAR=1e3,i.MAX_YEAR=3e3,i.MIN_MONTH=1,i.MAX_MONTH=12,i.MIN_DAY=1,i.MAX_DAY_IN_MONTHS=[31,28,31,30,31,30,31,31,30,31,30,31],i.MIN_DAY_OF_WEEK=0,i.MAX_DAY_OF_WEEK=6,i.MIN_HOURS=0,i.MAX_HOURS=23,i.MIN_MINUTES=0,i.MAX_MINUTES=59,i.MIN_SECONDS=0,i.MAX_SECONDS=59,i.MIN_MILLISECONDS=0,i.MAX_MILLISECONDS=999,i.VERSION="0.2.18",i.options=function(t,s){if(t===e)return jt;if(jt.hasOwnProperty(t)){if(s===e)return jt[t];jt[t]=s,t==="monthFromZero"&&(i.MIN_MONTH=s?0:1,i.MAX_MONTH=s?11:12)}return e},i.noConflict=function(){return n.tempus=u,i},i.generate=function(t){var s,h,c,p,d,L,K,Y;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof S?s=t.dateFrom.utc():s=i(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof S?h=t.dateTo.utc():h=i(t.dateTo,t.formatTo!==e?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?d={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?d={year:t.period==="year"?1:0,month:t.period==="month"?1:0,day:t.period==="day"?1:0,hours:t.period==="hours"?1:0,minutes:t.period==="minutes"?1:0,seconds:t.period==="seconds"?1:0}:typeof t.period=="object"&&(d={year:t.period.year!==e?t.period.year:0,month:t.period.month!==e?t.period.month:0,day:t.period.day!==e?t.period.day:0,hours:t.period.hours!==e?t.period.hours:0,minutes:t.period.minutes!==e?t.period.minutes:0,seconds:t.period.seconds!==e?t.period.seconds:0}),t.groupBy===e?L=t.asObject===!0?{}:[]:(L=[],L.push([]),K=i(s).get()[t.groupBy]),Y=function(W,H,D){return t.asObject===!0?t.format!==e?W[i(H).format(t.format)]={}:W[i(H).format("%F %H:%M:%S")]={}:t.format!==e?W.push(D?null:i(H).format(t.format)):W.push(D?null:i(H)),W},t.groupBy!==e&&t.fillNulls){var I={year:d.year?-d.year:e,month:d.month?-d.month:e,day:d.day?-d.day:e,hours:d.hours?-d.hours:e,minutes:d.minutes?-d.minutes:e,seconds:d.seconds?-d.seconds:e,milliseconds:d.milliseconds?-d.milliseconds:e};for(c=i(s).calc(I).utc();i(c).get()[t.groupBy]===K;)Y(L[L.length-1],c,!0),c=i(c).calc(I).utc();if(t.groupBy==="week"){var b=i(s).dayOfWeek();for(c=i(s).dayOfWeek(0).utc();L[0].length<b&&c<s;)Y(L[L.length-1],c,!0),c=i(c).calc(d).utc()}}for(;s<=h;)t.groupBy===e?Y(L,s):i(s).get()[t.groupBy]===K?Y(L[L.length-1],s):(L.push([]),Y(L[L.length-1],s),K=i(s).get()[t.groupBy]),s=i(s).calc(d).utc();if(t.groupBy!==e&&t.fillNulls)for(p=i(h).calc(d).utc();i(p).get()[t.groupBy]===K;)Y(L[L.length-1],p,!0),p=i(p).calc(d).utc();return L},i.monthNames=function(t){switch(t){case"long":return X;default:return Xt}},i.dayNames=function(t){switch(t){case"long":return bt;default:return Ht}},i.lang=function(t){if(t!==e)m=t,N[m]===e&&(m="en"),X=P(),Xt=pt(),bt=ot(),Ht=x();else return m;return e},i.availableLangs=function(){return Object.keys(N)},i.registerFormat=function(t,s,h,c,p,d){w[t]={format:s,parse:h,minLength:c,maxLength:p,type:d}},i.unregisterFormat=function(t){delete w[t]},i.detectFormat=function(t){var s,h,c;return s=O(t,0),s!==""&&(c=10),h=t.charAt(c),(h==="T"||h===" ")&&(s+=h,c+=1),s+=l(t,c),s},R={TempusDate:S},i.classes=function(t,s){if(s===e)return R[t];R[t]=s},i.loadTranslations=function(t){typeof t=="object"?N=t:typeof t=="string"&&de(t,function(s){N=s},function(s){})},m=(E.language||E.systemLanguage||E.userLanguage||"en").substr(0,2).toLowerCase(),N[m]===e&&(m="en"),X=P(),Xt=pt(),bt=ot(),Ht=x(),G.exports&&(A=G.exports=i),A.tempus=i}).call(T)})(ht,ht.exports);var Oe=ht.exports;const mt=M(Oe);class j{constructor(A,e={}){f(this,at);f(this,Nt);f(this,_t);f(this,Ot);f(this,yt);f(this,dt);f(this,It);f(this,Ut);f(this,gt);f(this,Et);f(this,Tt);f(this,lt);f(this,Rt);f(this,Gt);f(this,it);f(this,ct);f(this,St);f(this,q,null);f(this,ft,null);f(this,v,[]);f(this,B,{});f(this,J,50);f(this,Q,50);f(this,$,!0);f(this,tt,null);f(this,U,null);f(this,Z,null);f(this,Bt,100);f(this,et,"no");f(this,F,!1);f(this,At,!1);f(this,st,!1);C(this,"errors",{});C(this,"answerData",{});y(this,q,A),y(this,ft,e)}get serial(){return o(this,F)}get limitCommandSerial(){return o(this,Q)}set limitCommandSerial(A){if(A<10)throw new Error("limitCommandSerial не может быть меньше 10");A>=10&&A<50&&(y(this,J,A),y(this,Q,A)),y(this,Q,A)}setSerial(){y(this,F,!0),y(this,At,!0),y(this,st,!1)}setParallel(){y(this,F,!1),y(this,At,!1),y(this,st,!0)}stop(){y(this,$,!1)}async batch(A,e){o(this,Z)&&_(this,Nt,Kt).call(this),e&&y(this,tt,e),o(this,At)===!1&&y(this,F,!1),Object.keys(A).length>o(this,Q)&&y(this,F,!0),y(this,$,!0),y(this,v,[]),y(this,B,{}),this.errors={},this.answerData={};const n=_(this,Ot,vt).call(this,A);if(Object.keys(A).length<o(this,Q)){const r=n.map((a,l)=>_(this,yt,$t).call(this,a,n[l]));return Promise.allSettled(r).then(a=>{let l={};for(let O of a)O.status==="fulfilled"&&(l={...l,...O.value});return l})}else{let r={},a=0,l=1,O=Object.keys(A).length||1,u=i=>{a+=Object.keys(i).length,l=Math.round(a/O*100)};for(let[i,R]of Object.entries(n)){let E=await _(this,yt,$t).call(this,R,n[i],!0);u(R),e&&e({percent:l}),r={...r,...E}}return r}}async batchTotalCount(A,e){y(this,B,{}),this.errors={};let n=1,r=0,a=Object.keys(A).length||1,l=u=>{r+=Object.keys(u).length,n=Math.round(r/a*100)};e&&e({percent:n});const O=_(this,Ot,vt).call(this,A);if(o(this,st)){const u=O.map(i=>_(this,dt,te).call(this,i).then(R=>(l(i),e&&e({percent:n}),R)));return Promise.allSettled(u).then(i=>{let R={};for(let E of i)E.status==="fulfilled"&&(R={...R,...E.value});return R})}else{let u={};for(let i of O){let R=await _(this,dt,te).call(this,i);l(i),e&&e({percent:n}),u={...u,...R}}return u}}}q=new WeakMap,ft=new WeakMap,v=new WeakMap,B=new WeakMap,J=new WeakMap,Q=new WeakMap,$=new WeakMap,tt=new WeakMap,U=new WeakMap,Z=new WeakMap,Bt=new WeakMap,et=new WeakMap,F=new WeakMap,At=new WeakMap,st=new WeakMap,at=new WeakSet,xt=function(){let A=0;if(!o(this,U))return Math.round(A);let e=0,n=0;return Object.values(o(this,U)).forEach(r=>{const{total:a,count:l}=r;e+=a??0,n+=l??0}),e?A=n/e*100:A=100,{percent:Math.round(A),allCount:n,allTotal:e}},Nt=new WeakSet,Kt=function(){clearInterval(o(this,Z)),y(this,Z,""),y(this,U,""),y(this,tt,""),y(this,et,"no")},_t=new WeakSet,qt=function({key:A,value:e}){const n=_(this,it,Dt).call(this,e.data()),r=Array.isArray(n)?n.length:0,a=_(this,ct,Zt).call(this,e.total(),r);let l=1;n&&(l=r),o(this,tt)&&(o(this,U)||y(this,U,{}),o(this,U)[A]&&o(this,U)[A].count&&(l+=o(this,U)[A].count),o(this,U)[A]={total:a,count:l},o(this,Z)||y(this,Z,setInterval(()=>{const{percent:O,allCount:u,allTotal:i}=o(this,at,xt);(o(this,et)==="no"||o(this,et)<o(this,at,xt).percent)&&(o(this,tt).call(this,{data:o(this,U),percent:O,allCount:u,allTotal:i}),y(this,et,o(this,at,xt).percent)),O===100&&_(this,Nt,Kt).call(this)},o(this,Bt))))},Ot=new WeakSet,vt=function(A){const e=[],n=Object.entries(A);for(let r=0;r<n.length;r+=o(this,J)){const a=n.slice(r,r+o(this,J));e.push(Object.fromEntries(a))}return e},yt=new WeakSet,$t=function(A,e,n){return new Promise(r=>{const a=_(this,Rt,ie).call(this,e),l=[];let O=0,u=0;o(this,q).call(this,A,i=>{Object.entries(i).forEach(([R,E])=>{let m={};const N=E.error();if(N){let{query:{method:x},answer:X}=E;this.errors[R]={error:N,method:x},O+=1}if(E!=null&&E.answer&&Object.keys(E.answer).length){for(let[x,X]of Object.entries(E.answer))x!="result"&&X&&(m[x]=X);Object.keys(m).length&&(this.answerData[R]=m)}const P=_(this,it,Dt).call(this,E.data()),pt=Array.isArray(P)?P.length:0,ot=_(this,ct,Zt).call(this,E.total(),pt);if(Array.isArray(P)?o(this,B)[R]=P:typeof P=="object"&&P!==null&&Object.keys(P).length===0?o(this,B)[R]=[]:o(this,B)[R]=P,u+=ot,n||_(this,_t,qt).call(this,{key:R,value:E}),ot>o(this,J)&&ot>pt){const x=Math.ceil(ot/o(this,J))-1,X=Array.from({length:x});l.push([R,a[R],X])}}),u>5e3&&o(this,At)===!1&&o(this,st)===!1&&y(this,F,!0),O>0&&_(this,St,re).call(this),l.length?(_(this,It,he).call(this,l),_(this,Ut,ae).call(this).then(()=>r(_(this,lt,Qt).call(this)))):r(_(this,lt,Qt).call(this))})})},dt=new WeakSet,te=function(A){return new Promise(e=>{const n=_(this,Rt,ie).call(this,A);let r=0;o(this,q).call(this,n,a=>{Object.entries(a).forEach(([l,O])=>{const u=O.error();u&&(this.errors[l]=u,r+=1);const i=_(this,it,Dt).call(this,O.data()),R=Array.isArray(i)?i.length:0,E=_(this,ct,Zt).call(this,O.total(),R);o(this,B)[l]=E}),r>0&&_(this,St,re).call(this),e(_(this,lt,Qt).call(this))})})},It=new WeakSet,he=function(A){let e=[];A.forEach(([n,r,a])=>{a.forEach((l,O)=>{const u=O+1,i=o(this,J)*u,E=[[n,u].join("_"),_(this,Gt,le).call(this,r,i)];e.length===o(this,J)?(o(this,v).push(e),e=[E]):e.push(E)})}),e.length&&o(this,v).push(e)},Ut=new WeakSet,ae=function(){const A=[],e=[],n=r=>{Object.entries(r).forEach(([a,l])=>{const[O]=a.split("_"),u=_(this,it,Dt).call(this,l.data());Array.isArray(u)&&o(this,B)[O].push(...u),_(this,_t,qt).call(this,{key:O,value:l})})};return o(this,v).forEach((r,a)=>{const l=Object.fromEntries(r),O=()=>new Promise(u=>o(this,q).call(this,l,i=>{o(this,F)?n(i):e[a]=i,u()}));A.push(O)}),o(this,F)?_(this,Et,Ae).call(this,A):_(this,Tt,se).call(this,A).then(()=>{e.forEach(n)})},gt=new WeakSet,ee=function(){return new Promise(A=>setTimeout(A,500))},Et=new WeakSet,Ae=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return Promise.allSettled([e(),_(this,gt,ee).call(this)]).then(()=>o(this,$)?_(this,Et,Ae).call(this,A):Promise.resolve())},Tt=new WeakSet,se=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return _(this,gt,ee).call(this).then(()=>e()).then(()=>o(this,$)?_(this,Tt,se).call(this,A):Promise.resolve())},lt=new WeakSet,Qt=function(){return Object.entries(o(this,ft)).forEach(([A,e])=>{o(this,B)[A]&&(o(this,B)[A]=e(o(this,B)[A]))}),o(this,B)},Rt=new WeakSet,ie=function(A){return Object.entries(A).reduce((e,[n,r])=>{if(Array.isArray(r)){const[a,l={}]=r;e[n]=[a,l]}else{const{method:a,params:l={}}=r;e[n]=[a,l]}return e},{})},Gt=new WeakSet,le=function(A,e){const[n,r]=A;return[n,{start:e,...r}]},it=new WeakSet,Dt=function(A){return((A==null?void 0:A.items)||(A==null?void 0:A.documents))??A},ct=new WeakSet,Zt=function(A,e){return A!==A&&(A=0),A===0&&e===0?0:A||e},St=new WeakSet,re=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([A,e])=>{console.info(`[${A}]`,e)}),console.groupEnd()};class Vt{constructor(){f(this,rt,{})}get hash(){return this.createHash(8)}createHash(A){let e="abcdefghijklmnopqrstuvwxyz0123456789",n="";A=A||6;for(let r=0;r<A;r++)n+=e.charAt(Math.floor(Math.random()*e.length));return n}actionFilter({keyTimer:A,duration:e=10,action:n}){o(this,rt)[A]&&(clearTimeout(o(this,rt)[A]),o(this,rt)[A]=null),n&&(o(this,rt)[A]=setTimeout(()=>{n()},e))}async noSleep(){let A=document.createElement("video");A.classList.add("no-sleep"),A.addEventListener("loadeddata",()=>{A.style.position="fixed",A.style.left="-9999px",document.querySelector("body").append(A),A.play()}),A.addEventListener("ended",()=>{this.actionFilter({keyTimer:"no-sleep",duration:5e3,action:()=>A.play()})}),A.src="data:video/mp4;base64,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"}downloadFileJson(A,e){let n=new Blob([JSON.stringify(A)],{type:"application/json"}),r=URL.createObjectURL(n),a=document.createElement("a");a.style.display="none",a.href=r,a.download=`${e}.json`,document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(r)},200)}}rt=new WeakMap;const Yt=new Vt;class oe{constructor(){f(this,Ct);f(this,Mt);f(this,Ft);f(this,Pt);f(this,Wt);f(this,k,"logger");f(this,V,!1);f(this,wt,2e3);f(this,nt,new Map);f(this,Lt,{});f(this,z,null);f(this,ut,!1);C(this,"periodClear",3);_(this,Ct,ce).call(this)}async init(){let A=new j(BX24.callBatch),{entityList:e}=await A.batch({entityList:{method:"entity.get"}});if(e!=null&&e.length)if(e.find(r=>r.ENTITY==o(this,k)))y(this,V,!0);else{let{entityAdd:r}=await A.batch({entityAdd:{method:"entity.add",params:{ENTITY:o(this,k),NAME:o(this,k),ACCESS:{AU:"X"}}}});r&&y(this,V,!0)}return _(this,Pt,me).call(this),o(this,V)}start({type:A,data:e}){if(!o(this,V)){_(this,Mt,ne).call(this,"entity");return}const n=Yt.hash;return o(this,nt).set(n,{type:A,data:e,userInfo:o(this,Lt),errorList:[],status:"",answer:null,date:new Date().getTime()}),n}stop({key:A,errorList:e,status:n,answer:r}){if(!o(this,V)){_(this,Mt,ne).call(this,"entity");return}let a=o(this,nt).get(A);e&&(a.errorList=e),n&&(a.status=n),r&&(a.answer=r),Yt.actionFilter({keyTimer:"add.entity.items",duration:o(this,wt),action:async()=>{var l;await _(this,Ft,ue).call(this),(l=a==null?void 0:a.data)!=null&&l.updateList&&y(this,ut,!0)}})}async getEntityList(A){var r;if((r=o(this,z))!=null&&r.length&&!o(this,ut))return o(this,z);let e=new j(BX24.callBatch),{entityList:n}=await e.batch({entityList:{method:"entity.item.get",params:{ENTITY:o(this,k),SORT:{ID:"DESC"}}}},A);return n=n.map(a=>{const{ID:l,DATE_CREATE:O,DETAIL_TEXT:u}=a;return{...JSON.parse(u),id:l,dateCreate:O}}),y(this,ut,!1),n}async downAllEntityJson(){let A=await this.getEntityList(),e=mt().format("%Y-%m-%d");Yt.downloadFileJson(A,`sdklogger-entity-data__${e}`)}}k=new WeakMap,V=new WeakMap,wt=new WeakMap,nt=new WeakMap,Lt=new WeakMap,z=new WeakMap,ut=new WeakMap,Ct=new WeakSet,ce=async function(){const A=new j(BX24.callBatch),e=BX24.isAdmin(),{curUser:n}=await A.batch({curUser:{method:"user.current"}});y(this,Lt,{isAdmin:e,curUser:n})},Mt=new WeakSet,ne=function(A){A=="entity"&&Yt.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},Ft=new WeakSet,ue=async function(){let A={},e=new j(BX24.callBatch);for(let[n,r]of o(this,nt).entries())r.status&&(A[n]={method:"entity.item.add",params:{ENTITY:o(this,k),NAME:o(this,k),DETAIL_TEXT:JSON.stringify(r)}});if(Object.keys(A).length){let n=await e.batch(A),{errors:r}=e;for(let[a,l]of Object.entries({...n,...r}))o(this,nt).delete(a);return!0}},Pt=new WeakSet,me=async function(){let A=new j(BX24.callBatch),{serverTime:e}=await A.batch({serverTime:{method:"server.time"}});o(this,z)||y(this,z,await this.getEntityList());let n=o(this,z).filter(r=>{let{dateCreate:a}=r;return mt(new Date(a)).between(mt(new Date(e)),"month")>=this.periodClear});_(this,Wt,fe).call(this,n)},Wt=new WeakSet,fe=async function(A){let e=new j(BX24.callBatch),n=A.map(r=>{let{id:a}=r;return{method:"entity.item.delete",params:{ENTITY:o(this,k),ID:a}}});return await e.batch(n)};class ye{constructor(A){f(this,Jt);f(this,kt);C(this,"domain","");C(this,"isAdmin",!1);C(this,"appInfo",null);C(this,"appConst",null);C(this,"userInfo",null);C(this,"placeData",null);C(this,"placeInfo",null);C(this,"logger",new oe);this.appConst=A}init(){return new Promise(A=>{let e=setInterval(()=>{window.BX24&&BX24.init(async()=>{console.info("init BX24"),clearInterval(e),this.domain=BX24.getDomain(),this.isAdmin=BX24.isAdmin(),this.placeInfo=BX24.placement.info(),await this.logger.init();const[n,r]=await Promise.all([_(this,Jt,Ne).call(this),_(this,kt,_e).call(this)]);this.appInfo=n,this.userInfo=r,new Vt().noSleep(),A(!0)})},100)})}userOption(A,e){return e?BX24.userOption.set(A,e):BX24.userOption.get(A)}call({method:A,params:e,updateList:n}){let r=this.logger.start({type:"call",data:{method:A,params:e,updateList:n}});return new Promise(a=>{e||(e={}),BX24.callMethod(A,e,l=>{let O={};if(l!=null&&l.answer)for(let[u,i]of Object.entries(l.answer))u!="result"&&i&&(O[u]=i);if(l.error()){let u=l.error();console.error(u),this.logger.stop({answer:O,key:r,status:"fail",errorList:[u.toSting()]}),a(!1)}else{let u=l.data();u!=null&&u.items&&(u=u.items),this.logger.stop({answer:O,key:r,status:"success"}),a(u)}})})}async batch(A,e,{updateList:n,errorCall:r,limitCommandSerial:a}={}){let l=new j(BX24.callBatch),O=this.logger.start({type:"batch",data:{commandList:A,updateList:n}});a&&(l.limitCommandSerial=a);try{let u=await l.batch(A,e);if(Object.keys(l.errors).length){let i=Object.entries(l.errors).map(([R,E])=>{var m;return{key:R,error:`${E==null?void 0:E.method} ${(m=E==null?void 0:E.error)==null?void 0:m.toString()}`.trim()}});r&&r(l.errors),this.logger.stop({key:O,status:"fail",errorList:i,answer:l.answerData})}else this.logger.stop({key:O,status:"success",answer:l.answerData});return u}catch(u){let i=u==null?void 0:u.toString();return this.logger.stop({key:O,status:"fail-runtime",errorList:[i],answer:l.answerData}),console.error(u),!1}}async batchTotalCount(A,e){let n=new j(BX24.callBatch),r=this.logger.start({type:"batch",data:{commandList:A}});try{let a=await n.batchTotalCount(A,e);if(Object.keys(n.errors).length){let l=Object.entries(n.errors).map(([O,u])=>({key:O,error:u.toSting()}));this.logger.stop({key:r,status:"fail",errorList:l})}else this.logger.stop({key:r,status:"success"});return a}catch(a){return this.logger.stop({key:r,status:"fail",errorList:[a.toSting()]}),console.error(a),!1}}getPlacement(){return this.call({method:"placement.get"}).then(A=>(this.placeData||(this.placeData=A),A))}async placementBind(A){this.placeData||(this.placeData=await this.getPlacement());const{appName:e,pathApp:n}=this.appConst,r=this.placeData.map(l=>l.placement);let a=this.placeData.find(l=>l.placement==A);r.includes(A)?a.handler!=n&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[A]||this.placementUnBind(a).then(()=>{window.placementUnBind[A]||(window.placementUnBind[A]=!0,this.placementBind(A))})):this.call({method:"placement.bind",params:{PLACEMENT:A,HANDLER:n,LANG_ALL:{ru:{TITLE:e}}}}).then(l=>{l?console.info("Приложение успешно встроено в",A):console.warn("Приложение не может быть встроено в",A)})}placementUnBind(A){const{pathApp:e,appName:n}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:A,HANDLER:e,LANG_ALL:{ru:{TITLE:n}}}}).then(r=>(console.log("Встройка отвязана",A),r))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(A=>{let e=Object.values(A);return console.log("chat-bot list:",e),e})}regBot({code:A,type:e,name:n}){const{appName:r,pathApp:a,chatBotLogo:l}=this.appConst,O=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:A??this.appInfo.CODE,TYPE:e??"O",EVENT_HANDLER:a,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${n??r} - бот #${O}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:mt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:l??""}}}).then(u=>(console.log("Чат-бот добавлен",u),u))}unRegBot(A){return this.call({method:"imbot.unregister",params:{BOT_ID:A}}).then(e=>(console.log("чат-бот удален",e),e))}getLoggerList(A){return this.logger.getEntityList(A)}}Jt=new WeakSet,Ne=function(){return this.call({method:"app.info"})},kt=new WeakSet,_e=function(){return this.call({method:"user.current"})},g.Batch=j,g.BxBoot=ye,g.BxHelper=Vt,g.BxLogger=oe,g.tempus=mt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "szdl-utils-kit",
3
3
  "description": "utils-kit library",
4
4
  "private": false,
5
- "version": "0.2.23",
5
+ "version": "0.2.24",
6
6
  "type": "module",
7
7
  "author": "Stanislav Ovv",
8
8
  "license": "BSD",