szdl-utils-kit 0.3.30 → 0.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var ke = Object.defineProperty;
2
2
  var Ce = (d, e, t) => e in d ? ke(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
3
- var D = (d, e, t) => (Ce(d, typeof e != "symbol" ? e + "" : e, t), t), Qt = (d, e, t) => {
3
+ var S = (d, e, t) => (Ce(d, typeof e != "symbol" ? e + "" : e, t), t), Qt = (d, e, t) => {
4
4
  if (!e.has(d))
5
5
  throw TypeError("Cannot " + t);
6
6
  };
@@ -10,16 +10,16 @@ var L = (d, e, t) => (Qt(d, e, "read from private field"), t ? t.call(d) : e.get
10
10
  e instanceof WeakSet ? e.add(d) : e.set(d, t);
11
11
  }, x = (d, e, t, r) => (Qt(d, e, "write to private field"), r ? r.call(d, t) : e.set(d, t), t);
12
12
  var N = (d, e, t) => (Qt(d, e, "access private method"), t);
13
- var we = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
- function Be(d) {
13
+ var Be = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
+ function we(d) {
15
15
  return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
16
16
  }
17
17
  var $t = { exports: {} };
18
18
  (function(d, e) {
19
19
  (function(t) {
20
20
  Array.prototype.indexOf || (Array.prototype.indexOf = function(s, o) {
21
- var g, p;
22
- for (g = o || 0, p = this.length; g < p; g += 1)
21
+ var g, y;
22
+ for (g = o || 0, y = this.length; g < y; g += 1)
23
23
  if (this[g] === s)
24
24
  return g;
25
25
  return -1;
@@ -31,17 +31,17 @@ var $t = { exports: {} };
31
31
  }, a = function(s, o) {
32
32
  return o !== t ? (s.year(o.year() || o.year), s.month(o.month() || o.month), s.day(o.day() || o.day), s.hours(o.hours() || o.hours), s.minutes(o.minutes() || o.minutes), s.seconds(o.seconds() || o.seconds), s.milliseconds(o.milliseconds() || o.milliseconds), s) : t;
33
33
  }, l = function(s, o) {
34
- var g, p = "";
35
- return g = s.slice(o, o + 1), g !== "" && !isNaN(Number(g)) && (p += "%H"), g = s.charAt(o + 2), g !== "" && g === ":" && (p += g), g = s.slice(o + 3, o + 4), g !== "" && !isNaN(Number(g)) && (p += "%M"), g = s.charAt(o + 5), g !== "" && g === ":" && (p += g), g = s.slice(o + 6, o + 7), g !== "" && !isNaN(Number(g)) && (p += "%S"), p;
34
+ var g, y = "";
35
+ return g = s.slice(o, o + 1), g !== "" && !isNaN(Number(g)) && (y += "%H"), g = s.charAt(o + 2), g !== "" && g === ":" && (y += g), g = s.slice(o + 3, o + 4), g !== "" && !isNaN(Number(g)) && (y += "%M"), g = s.charAt(o + 5), g !== "" && g === ":" && (y += g), g = s.slice(o + 6, o + 7), g !== "" && !isNaN(Number(g)) && (y += "%S"), y;
36
36
  }, h = function(s, o) {
37
- var g, p = [
37
+ var g, y = [
38
38
  s.slice(o, o + 1),
39
39
  s.charAt(o + 2),
40
40
  s.slice(o + 3, o + 4),
41
41
  s.charAt(o + 5),
42
42
  s.slice(o + 6, o + 9)
43
43
  ], U;
44
- return !isNaN(Number(p[0])) && !isNaN(Number(p[2])) && !isNaN(Number(p[4])) ? (p[1] === "." && p[3] === "." ? g = "%d.%m.%Y" : p[1] === "-" && p[3] === "-" ? g = "%m-%d-%Y" : p[1] === "/" && p[3] === "/" && (g = "%m/%d/%Y"), g) : (U = [
44
+ return !isNaN(Number(y[0])) && !isNaN(Number(y[2])) && !isNaN(Number(y[4])) ? (y[1] === "." && y[3] === "." ? g = "%d.%m.%Y" : y[1] === "-" && y[3] === "-" ? g = "%m-%d-%Y" : y[1] === "/" && y[3] === "/" && (g = "%m/%d/%Y"), g) : (U = [
45
45
  s.slice(o, o + 3),
46
46
  s.charAt(o + 4),
47
47
  s.slice(o + 5, o + 6),
@@ -249,7 +249,7 @@ var $t = { exports: {} };
249
249
  c[A].FRIDAY_LONG,
250
250
  c[A].SATURDAY_LONG
251
251
  ];
252
- }, I = function() {
252
+ }, D = function() {
253
253
  return [
254
254
  c[A].SUNDAY_SHORT,
255
255
  c[A].MONDAY_SHORT,
@@ -259,13 +259,13 @@ var $t = { exports: {} };
259
259
  c[A].FRIDAY_SHORT,
260
260
  c[A].SATURDAY_SHORT
261
261
  ];
262
- }, T, y, k, b, H = function(s, o, g) {
263
- var p;
264
- r.XMLHttpRequest ? p = new XMLHttpRequest() : p = new ActiveXObject("Microsoft.XMLHTTP"), p.onreadystatechange = function() {
265
- p.readyState === 4 && (p.status === 200 ? o && (r.JSON === t ? alert(`Please, include json2 into your project if you want use old browsers!
266
- https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.parse(p.responseText))) : g && g(p));
267
- }, p.open("GET", s, !1), p.send();
268
- }, w = {
262
+ }, T, p, k, b, H = function(s, o, g) {
263
+ var y;
264
+ r.XMLHttpRequest ? y = new XMLHttpRequest() : y = new ActiveXObject("Microsoft.XMLHTTP"), y.onreadystatechange = function() {
265
+ y.readyState === 4 && (y.status === 200 ? o && (r.JSON === t ? alert(`Please, include json2 into your project if you want use old browsers!
266
+ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.parse(y.responseText))) : g && g(y));
267
+ }, y.open("GET", s, !1), y.send();
268
+ }, B = {
269
269
  "%d": {
270
270
  format: function(s) {
271
271
  return i(s.day() || n.MIN_DAY, 2);
@@ -340,7 +340,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
340
340
  "%b": {
341
341
  format: function(s) {
342
342
  var o = n.options("monthFromZero") ? s.month() : s.month() - 1;
343
- return y[o !== t ? o : n.MIN_MONTH];
343
+ return p[o !== t ? o : n.MIN_MONTH];
344
344
  },
345
345
  parse: function(s) {
346
346
  var o = n.monthNames().indexOf(s) + (n.options("monthFromZero") ? 0 : 1);
@@ -415,11 +415,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
415
415
  return i(s.year() || n.MIN_YEAR, 4) + "-" + i(s.month() || n.MIN_MONTH, 2) + "-" + i(s.day() || n.MIN_DAY, 2);
416
416
  },
417
417
  parse: function(s) {
418
- var o = Number(s.slice(0, 4)), g = Number(s.slice(5, 7)), p = Number(s.slice(8, 10));
418
+ var o = Number(s.slice(0, 4)), g = Number(s.slice(5, 7)), y = Number(s.slice(8, 10));
419
419
  return {
420
420
  year: o,
421
421
  month: g,
422
- day: p
422
+ day: y
423
423
  };
424
424
  },
425
425
  minLength: 10,
@@ -431,9 +431,9 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
431
431
  return i(s.month() || n.MIN_MONTH, 2) + "/" + i(s.day() || n.MIN_DAY, 2) + "/" + i(s.year() || n.MIN_YEAR, 4);
432
432
  },
433
433
  parse: function(s) {
434
- var o = Number(s.slice(0, 2)), g = Number(s.slice(3, 5)), p = Number(s.slice(6, 10));
434
+ var o = Number(s.slice(0, 2)), g = Number(s.slice(3, 5)), y = Number(s.slice(6, 10));
435
435
  return {
436
- year: p,
436
+ year: y,
437
437
  month: o,
438
438
  day: g
439
439
  };
@@ -442,11 +442,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
442
442
  maxLength: 10,
443
443
  type: "string"
444
444
  }
445
- }, B = {
445
+ }, w = {
446
446
  useMilliseconds: !1,
447
447
  monthFromZero: !1
448
- }, M;
449
- M = function(s, o, g) {
448
+ }, I;
449
+ I = function(s, o, g) {
450
450
  return this._d = /* @__PURE__ */ new Date(), this._i = {
451
451
  year: !1,
452
452
  month: !1,
@@ -456,55 +456,55 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
456
456
  seconds: !1,
457
457
  milliseconds: !1
458
458
  }, s !== t && this.set(s, o, g), this;
459
- }, M.fn = M.prototype, M.fn.dayCount = function() {
459
+ }, I.fn = I.prototype, I.fn.dayCount = function() {
460
460
  var s = this.month(), o = n.MAX_DAY_IN_MONTHS[s - (n.options("monthFromZero") ? 0 : 1)];
461
461
  return this.leapYear() && s === (n.options("monthFromZero") ? 1 : 2) && (o += 1), o;
462
- }, M.fn.year = function(s) {
462
+ }, I.fn.year = function(s) {
463
463
  if (arguments.length !== 0)
464
464
  (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_YEAR && Number(s) <= n.MAX_YEAR ? (this._d.setFullYear(Number(s)), this._i.year = !1) : this._i.year = Number(s) : (this._d.setFullYear(n.MIN_YEAR), this._i.year = !1);
465
465
  else
466
466
  return this._i.year === !1 ? this._d.getFullYear() : this._i.year;
467
467
  return this;
468
- }, M.fn.month = function(s) {
468
+ }, I.fn.month = function(s) {
469
469
  if (arguments.length !== 0)
470
470
  (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_MONTH && Number(s) <= n.MAX_MONTH ? (this._d.setMonth(n.options("monthFromZero") ? Number(s) : Number(s) - 1), this._i.month = !1) : this._i.month = Number(s) : (this._d.setMonth(n.options("monthFromZero") ? n.MIN_MONTH : n.MIN_MONTH - 1), this._i.month = !1);
471
471
  else
472
472
  return this._i.month === !1 ? n.options("monthFromZero") ? this._d.getMonth() : this._d.getMonth() + 1 : this._i.month;
473
473
  return this;
474
- }, M.fn.day = function(s) {
474
+ }, I.fn.day = function(s) {
475
475
  if (arguments.length !== 0)
476
476
  (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_DAY && Number(s) <= this.dayCount() ? (this._d.setDate(Number(s)), this._i.day = !1) : this._i.day = Number(s) : (this._d.setDate(n.MIN_DAY), this._i.day = !1);
477
477
  else
478
478
  return this._i.day === !1 ? this._d.getDate() : this._i.day;
479
479
  return this;
480
- }, M.fn.hours = function(s) {
480
+ }, I.fn.hours = function(s) {
481
481
  if (arguments.length !== 0)
482
482
  (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_HOURS && Number(s) <= n.MAX_HOURS ? (this._d.setHours(Number(s)), this._i.hours = !1) : this._i.hours = Number(s) : (this._d.setHours(n.MIN_HOURS), this._i.hours = !1);
483
483
  else
484
484
  return this._i.hours === !1 ? this._d.getHours() : this._i.hours;
485
485
  return this;
486
- }, M.fn.minutes = function(s) {
486
+ }, I.fn.minutes = function(s) {
487
487
  if (arguments.length !== 0)
488
488
  (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_MINUTES && Number(s) <= n.MAX_MINUTES ? (this._d.setMinutes(Number(s)), this._i.minutes = !1) : this._i.minutes = Number(s) : (this._d.setMinutes(n.MIN_MINUTES), this._i.minutes = !1);
489
489
  else
490
490
  return this._i.minutes === !1 ? this._d.getMinutes() : this._i.minutes;
491
491
  return this;
492
- }, M.fn.seconds = function(s) {
492
+ }, I.fn.seconds = function(s) {
493
493
  if (arguments.length !== 0)
494
494
  (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_SECONDS && Number(s) <= n.MAX_SECONDS ? (this._d.setSeconds(Number(s)), this._i.seconds = !1) : this._i.seconds = Number(s) : (this._d.setSeconds(n.MIN_SECONDS), this._i.seconds = !1);
495
495
  else
496
496
  return this._i.seconds === !1 ? this._d.getSeconds() : this._i.seconds;
497
497
  return this;
498
- }, M.fn.milliseconds = function(s) {
498
+ }, I.fn.milliseconds = function(s) {
499
499
  if (arguments.length !== 0)
500
500
  (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_MILLISECONDS && Number(s) <= n.MAX_MILLISECONDS ? (this._d.setMilliseconds(Number(s)), this._i.milliseconds = !1) : this._i.milliseconds = Number(s) : (this._d.setMilliseconds(n.MIN_MILLISECONDS), this._i.milliseconds = !1);
501
501
  else
502
502
  return this._i.milliseconds === !1 ? this._d.getMilliseconds() : this._i.milliseconds;
503
503
  return this;
504
- }, M.fn.week = function() {
504
+ }, I.fn.week = function() {
505
505
  var s = new Date(this.year(), 0, 1), o = n(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
506
506
  return Math.ceil(((o - s.getTime()) / 864e5 + s.getDay() + 1) / 7);
507
- }, M.fn.set = function(s, o, g) {
507
+ }, I.fn.set = function(s, o, g) {
508
508
  if (this._i = {
509
509
  year: !1,
510
510
  month: !1,
@@ -520,9 +520,9 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
520
520
  if (typeof s == "number")
521
521
  return this._d = new Date(s * (n.options("useMilliseconds") ? 1 : 1e3)), this;
522
522
  if (typeof s == "object" && (s instanceof Array ? (this.day(n.MIN_DAY), this.year(s[0]), this.month(s[1]), this.day(s[2]), this.hours(s[3]), this.minutes(s[4]), this.seconds(s[5]), this.milliseconds(s[6])) : (this.day(n.MIN_DAY), this.year(s.year), this.month(s.month), this.day(s.day), this.hours(s.hours), this.minutes(s.minutes), this.seconds(s.seconds), this.milliseconds(s.milliseconds))), typeof s == "string") {
523
- var p, U = [], S, C, Z = [], W = 0, F = 0, P, X, G = {}, Y;
523
+ var y, U = [], M, C, Z = [], W = 0, F = 0, P, X, G = {}, Y;
524
524
  if (s === t)
525
- return S = a(this, g), S === t && (this._i = {
525
+ return M = a(this, g), M === t && (this._i = {
526
526
  year: -1,
527
527
  month: -1,
528
528
  day: -1,
@@ -530,26 +530,26 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
530
530
  minutes: -1,
531
531
  seconds: -1,
532
532
  milliseconds: -1
533
- }), S;
533
+ }), M;
534
534
  for (o === t && (o = n.detectFormat(s)); W < o.length; ) {
535
535
  if (o.charAt(W) === "%") {
536
- if (C = o.charAt(W) + o.charAt(W + 1), w[C] !== t) {
537
- switch (P = 0, X = "", w[C].type) {
536
+ if (C = o.charAt(W) + o.charAt(W + 1), B[C] !== t) {
537
+ switch (P = 0, X = "", B[C].type) {
538
538
  case "number":
539
- for (; P < w[C].maxLength && F + P < s.length && !isNaN(Number(s.charAt(F + P))); )
539
+ for (; P < B[C].maxLength && F + P < s.length && !isNaN(Number(s.charAt(F + P))); )
540
540
  X += s.charAt(F + P), P += 1;
541
541
  break;
542
542
  case "word":
543
- for (; P < w[C].maxLength && F + P < s.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(s.charAt(F + P)); )
543
+ for (; P < B[C].maxLength && F + P < s.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(s.charAt(F + P)); )
544
544
  X += s.charAt(F + P), P += 1;
545
545
  break;
546
546
  case "string":
547
- for (; P < w[C].maxLength && F + P < s.length; )
547
+ for (; P < B[C].maxLength && F + P < s.length; )
548
548
  X += s.charAt(F + P), P += 1;
549
549
  break;
550
550
  }
551
- if (P < w[C].minLength)
552
- return S = a(this, g), S === t && (this._i = {
551
+ if (P < B[C].minLength)
552
+ return M = a(this, g), M === t && (this._i = {
553
553
  year: -1,
554
554
  month: -1,
555
555
  day: -1,
@@ -557,11 +557,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
557
557
  minutes: -1,
558
558
  seconds: -1,
559
559
  milliseconds: -1
560
- }), S;
560
+ }), M;
561
561
  U.push(C), Z.push(X), P -= 1, F += P, W += 1;
562
562
  }
563
563
  } else if (s.charAt(F) !== o.charAt(W))
564
- return S = a(this, g), S === t && (this._i = {
564
+ return M = a(this, g), M === t && (this._i = {
565
565
  year: -1,
566
566
  month: -1,
567
567
  day: -1,
@@ -569,11 +569,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
569
569
  minutes: -1,
570
570
  seconds: -1,
571
571
  milliseconds: -1
572
- }), S;
572
+ }), M;
573
573
  W += 1, F += 1;
574
574
  }
575
- for (p in U)
576
- U.hasOwnProperty(p) && w.hasOwnProperty(U[p]) && (Y = w[U[p]].parse(Z[p]), G = {
575
+ for (y in U)
576
+ U.hasOwnProperty(y) && B.hasOwnProperty(U[y]) && (Y = B[U[y]].parse(Z[y]), G = {
577
577
  year: Y.year !== t ? Y.year : G.year,
578
578
  month: Y.month !== t ? Y.month : G.month,
579
579
  day: Y.day !== t ? Y.day : G.day,
@@ -584,14 +584,14 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
584
584
  this.day(n.MIN_DAY), this.year(G.year), this.month(G.month), this.day(G.day), this.hours(G.hours), this.minutes(G.minutes), this.seconds(G.seconds), this.milliseconds(G.milliseconds);
585
585
  }
586
586
  return this;
587
- }, M.fn.leapYear = function() {
587
+ }, I.fn.leapYear = function() {
588
588
  var s = this.year();
589
589
  return s % 4 === 0 ? s % 100 === 0 ? s % 400 === 0 : !0 : !1;
590
- }, M.fn.timestamp = function(s) {
590
+ }, I.fn.timestamp = function(s) {
591
591
  return arguments.length !== 0 ? (this._d = new Date(Number(s) * (n.options("useMilliseconds") ? 1 : 1e3) + this._d.getTimezoneOffset() * 6e4), this) : n.options("useMilliseconds") ? this._d.getTime() - this._d.getTimezoneOffset() * 6e4 : Math.floor(this._d.getTime() / 1e3) - this._d.getTimezoneOffset() * 60;
592
- }, M.fn.utc = function(s) {
592
+ }, I.fn.utc = function(s) {
593
593
  return arguments.length !== 0 ? (this._d = new Date(Number(s) * (n.options("useMilliseconds") ? 1 : 1e3)), this) : n.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
594
- }, M.fn.dayOfWeek = function(s) {
594
+ }, I.fn.dayOfWeek = function(s) {
595
595
  if (s === "long")
596
596
  return k[this._d.getDay()];
597
597
  if (s === "short")
@@ -612,7 +612,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
612
612
  return this.calc({ day: (this.dayOfWeek() === 0 ? -2 : 5) - this.dayOfWeek() });
613
613
  if (s === 6 || s === "Saturday")
614
614
  return this.calc({ day: (this.dayOfWeek() === 0 ? -1 : 6) - this.dayOfWeek() });
615
- }, M.fn.timezone = function(s) {
615
+ }, I.fn.timezone = function(s) {
616
616
  switch (s) {
617
617
  case "hours":
618
618
  return Math.floor(this._d.getTimezoneOffset() / 60);
@@ -621,7 +621,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
621
621
  default:
622
622
  return this._d.getTimezoneOffset() * 60;
623
623
  }
624
- }, M.fn.get = function(s) {
624
+ }, I.fn.get = function(s) {
625
625
  switch (s) {
626
626
  case "Date":
627
627
  return new Date(
@@ -670,64 +670,64 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
670
670
  timestamp: this.timestamp()
671
671
  };
672
672
  }
673
- }, M.fn.format = function(s) {
674
- for (var o = 0, g = "", p; o < s.length; )
675
- s.charAt(o) === "%" ? (p = s.charAt(o) + s.charAt(o + 1), w[p] !== t ? (g += w[p].format(this), o += 1) : g += "%") : g += s.charAt(o), o += 1;
673
+ }, I.fn.format = function(s) {
674
+ for (var o = 0, g = "", y; o < s.length; )
675
+ s.charAt(o) === "%" ? (y = s.charAt(o) + s.charAt(o + 1), B[y] !== t ? (g += B[y].format(this), o += 1) : g += "%") : g += s.charAt(o), o += 1;
676
676
  return g;
677
- }, M.fn.valid = function() {
677
+ }, I.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
- }, M.fn.errors = function() {
679
+ }, I.fn.errors = function() {
680
680
  return this._i;
681
- }, M.fn.between = function(s, o) {
682
- var g = this.timestamp(), p = s.timestamp();
681
+ }, I.fn.between = function(s, o) {
682
+ var g = this.timestamp(), y = s.timestamp();
683
683
  switch (o) {
684
684
  case "year":
685
- return Math.floor((p - g) / 31556952);
685
+ return Math.floor((y - g) / 31556952);
686
686
  case "month":
687
- return Math.floor((p - g) / 2629746);
687
+ return Math.floor((y - g) / 2629746);
688
688
  case "day":
689
- return Math.floor((p - g) / 86400);
689
+ return Math.floor((y - g) / 86400);
690
690
  case "hours":
691
- return Math.floor((p - g) / 3600);
691
+ return Math.floor((y - g) / 3600);
692
692
  case "minutes":
693
- return Math.floor((p - g) / 60);
693
+ return Math.floor((y - g) / 60);
694
694
  case "seconds":
695
- return p - g;
695
+ return y - g;
696
696
  default:
697
697
  return t;
698
698
  }
699
- }, M.fn.calc = function(s) {
699
+ }, I.fn.calc = function(s) {
700
700
  return s.year !== t && this._d.setFullYear(this._d.getFullYear() + s.year), s.month !== t && this._d.setMonth(this._d.getMonth() + s.month), s.day !== t && this._d.setDate(this._d.getDate() + s.day), s.hours !== t && this._d.setHours(this._d.getHours() + s.hours), s.minutes !== t && this._d.setMinutes(this._d.getMinutes() + s.minutes), s.seconds !== t && this._d.setSeconds(this._d.getSeconds() + s.seconds), s.milliseconds !== t && this._d.setMilliseconds(this._d.getMilliseconds() + s.milliseconds), this;
701
701
  }, n = function(s, o, g) {
702
- return new M(s, o, g);
702
+ return new I(s, o, g);
703
703
  }, n.MIN_YEAR = 1e3, n.MAX_YEAR = 3e3, n.MIN_MONTH = 1, n.MAX_MONTH = 12, n.MIN_DAY = 1, n.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], n.MIN_DAY_OF_WEEK = 0, n.MAX_DAY_OF_WEEK = 6, n.MIN_HOURS = 0, n.MAX_HOURS = 23, n.MIN_MINUTES = 0, n.MAX_MINUTES = 59, n.MIN_SECONDS = 0, n.MAX_SECONDS = 59, n.MIN_MILLISECONDS = 0, n.MAX_MILLISECONDS = 999, n.VERSION = "0.2.18", n.options = function(s, o) {
704
704
  if (s === t)
705
- return B;
706
- if (B.hasOwnProperty(s)) {
705
+ return w;
706
+ if (w.hasOwnProperty(s)) {
707
707
  if (o === t)
708
- return B[s];
709
- B[s] = o, s === "monthFromZero" && (n.MIN_MONTH = o ? 0 : 1, n.MAX_MONTH = o ? 11 : 12);
708
+ return w[s];
709
+ w[s] = o, s === "monthFromZero" && (n.MIN_MONTH = o ? 0 : 1, n.MAX_MONTH = o ? 11 : 12);
710
710
  }
711
711
  return t;
712
712
  }, n.noConflict = function() {
713
713
  return r.tempus = u, n;
714
714
  }, n.generate = function(s) {
715
- var o, g, p, U, S, C, Z, W;
716
- if (typeof s.dateFrom != "number" && (s.dateFrom instanceof M ? o = s.dateFrom.utc() : o = n(s.dateFrom, s.formatFrom).utc()), typeof s.dateTo != "number" && (s.dateTo instanceof M ? g = s.dateTo.utc() : g = n(s.dateTo, s.formatTo !== t ? s.formatTo : s.formatFrom).utc()), typeof s.period == "number" ? S = {
715
+ var o, g, y, U, M, C, Z, W;
716
+ if (typeof s.dateFrom != "number" && (s.dateFrom instanceof I ? o = s.dateFrom.utc() : o = n(s.dateFrom, s.formatFrom).utc()), typeof s.dateTo != "number" && (s.dateTo instanceof I ? g = s.dateTo.utc() : g = n(s.dateTo, s.formatTo !== t ? s.formatTo : s.formatFrom).utc()), typeof s.period == "number" ? M = {
717
717
  year: 0,
718
718
  month: 0,
719
719
  day: 0,
720
720
  hours: 0,
721
721
  minutes: 0,
722
722
  seconds: s.period
723
- } : typeof s.period == "string" ? S = {
723
+ } : typeof s.period == "string" ? M = {
724
724
  year: s.period === "year" ? 1 : 0,
725
725
  month: s.period === "month" ? 1 : 0,
726
726
  day: s.period === "day" ? 1 : 0,
727
727
  hours: s.period === "hours" ? 1 : 0,
728
728
  minutes: s.period === "minutes" ? 1 : 0,
729
729
  seconds: s.period === "seconds" ? 1 : 0
730
- } : typeof s.period == "object" && (S = {
730
+ } : typeof s.period == "object" && (M = {
731
731
  year: s.period.year !== t ? s.period.year : 0,
732
732
  month: s.period.month !== t ? s.period.month : 0,
733
733
  day: s.period.day !== t ? s.period.day : 0,
@@ -738,34 +738,34 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
738
738
  return s.asObject === !0 ? s.format !== t ? X[n(G).format(s.format)] = {} : X[n(G).format("%F %H:%M:%S")] = {} : s.format !== t ? X.push(Y ? null : n(G).format(s.format)) : X.push(Y ? null : n(G)), X;
739
739
  }, s.groupBy !== t && s.fillNulls) {
740
740
  var F = {
741
- year: S.year ? -S.year : t,
742
- month: S.month ? -S.month : t,
743
- day: S.day ? -S.day : t,
744
- hours: S.hours ? -S.hours : t,
745
- minutes: S.minutes ? -S.minutes : t,
746
- seconds: S.seconds ? -S.seconds : t,
747
- milliseconds: S.milliseconds ? -S.milliseconds : t
741
+ year: M.year ? -M.year : t,
742
+ month: M.month ? -M.month : t,
743
+ day: M.day ? -M.day : t,
744
+ hours: M.hours ? -M.hours : t,
745
+ minutes: M.minutes ? -M.minutes : t,
746
+ seconds: M.seconds ? -M.seconds : t,
747
+ milliseconds: M.milliseconds ? -M.milliseconds : t
748
748
  };
749
- for (p = n(o).calc(F).utc(); n(p).get()[s.groupBy] === Z; )
750
- W(C[C.length - 1], p, !0), p = n(p).calc(F).utc();
749
+ for (y = n(o).calc(F).utc(); n(y).get()[s.groupBy] === Z; )
750
+ W(C[C.length - 1], y, !0), y = n(y).calc(F).utc();
751
751
  if (s.groupBy === "week") {
752
752
  var P = n(o).dayOfWeek();
753
- for (p = n(o).dayOfWeek(0).utc(); C[0].length < P && p < o; )
754
- W(C[C.length - 1], p, !0), p = n(p).calc(S).utc();
753
+ for (y = n(o).dayOfWeek(0).utc(); C[0].length < P && y < o; )
754
+ W(C[C.length - 1], y, !0), y = n(y).calc(M).utc();
755
755
  }
756
756
  }
757
757
  for (; o <= g; )
758
- s.groupBy === t ? W(C, o) : n(o).get()[s.groupBy] === Z ? W(C[C.length - 1], o) : (C.push([]), W(C[C.length - 1], o), Z = n(o).get()[s.groupBy]), o = n(o).calc(S).utc();
758
+ s.groupBy === t ? W(C, o) : n(o).get()[s.groupBy] === Z ? W(C[C.length - 1], o) : (C.push([]), W(C[C.length - 1], o), Z = n(o).get()[s.groupBy]), o = n(o).calc(M).utc();
759
759
  if (s.groupBy !== t && s.fillNulls)
760
- for (U = n(g).calc(S).utc(); n(U).get()[s.groupBy] === Z; )
761
- W(C[C.length - 1], U, !0), U = n(U).calc(S).utc();
760
+ for (U = n(g).calc(M).utc(); n(U).get()[s.groupBy] === Z; )
761
+ W(C[C.length - 1], U, !0), U = n(U).calc(M).utc();
762
762
  return C;
763
763
  }, n.monthNames = function(s) {
764
764
  switch (s) {
765
765
  case "long":
766
766
  return T;
767
767
  default:
768
- return y;
768
+ return p;
769
769
  }
770
770
  }, n.dayNames = function(s) {
771
771
  switch (s) {
@@ -776,27 +776,27 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
776
776
  }
777
777
  }, n.lang = function(s) {
778
778
  if (s !== t)
779
- A = s, c[A] === t && (A = "en"), T = O(), y = _(), k = R(), b = I();
779
+ A = s, c[A] === t && (A = "en"), T = O(), p = _(), k = R(), b = D();
780
780
  else
781
781
  return A;
782
782
  return t;
783
783
  }, n.availableLangs = function() {
784
784
  return Object.keys(c);
785
- }, n.registerFormat = function(s, o, g, p, U, S) {
786
- w[s] = {
785
+ }, n.registerFormat = function(s, o, g, y, U, M) {
786
+ B[s] = {
787
787
  format: o,
788
788
  parse: g,
789
- minLength: p,
789
+ minLength: y,
790
790
  maxLength: U,
791
- type: S
791
+ type: M
792
792
  };
793
793
  }, n.unregisterFormat = function(s) {
794
- delete w[s];
794
+ delete B[s];
795
795
  }, n.detectFormat = function(s) {
796
- var o, g, p;
797
- return o = h(s, 0), o !== "" && (p = 10), g = s.charAt(p), (g === "T" || g === " ") && (o += g, p += 1), o += l(s, p), o;
796
+ var o, g, y;
797
+ return o = h(s, 0), o !== "" && (y = 10), g = s.charAt(y), (g === "T" || g === " ") && (o += g, y += 1), o += l(s, y), o;
798
798
  }, m = {
799
- TempusDate: M
799
+ TempusDate: I
800
800
  }, n.classes = function(s, o) {
801
801
  if (o === t)
802
802
  return m[s];
@@ -806,12 +806,12 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
806
806
  c = o;
807
807
  }, function(o) {
808
808
  });
809
- }, A = (f.language || f.systemLanguage || f.userLanguage || "en").substr(0, 2).toLowerCase(), c[A] === t && (A = "en"), T = O(), y = _(), k = R(), b = I(), d.exports && (e = d.exports = n), e.tempus = n;
810
- }).call(we);
809
+ }, A = (f.language || f.systemLanguage || f.userLanguage || "en").substr(0, 2).toLowerCase(), c[A] === t && (A = "en"), T = O(), p = _(), k = R(), b = D(), d.exports && (e = d.exports = n), e.tempus = n;
810
+ }).call(Be);
811
811
  })($t, $t.exports);
812
812
  var He = $t.exports;
813
- const Lt = /* @__PURE__ */ Be(He);
814
- var It, he, Dt, kt, Ct, wt, At, bt, Bt, ue, Ht, fe, et, ft, z, tt, gt, te, st, dt, Ut, de, Pt, me, lt, Mt, yt, ee, pt, se;
813
+ const Lt = /* @__PURE__ */ we(He);
814
+ var St, he, Dt, kt, Ct, Bt, At, bt, wt, ue, Ht, fe, et, ft, z, tt, gt, te, st, dt, Ut, de, Pt, me, lt, It, pt, ee, yt, se;
815
815
  const J = class J {
816
816
  constructor(e) {
817
817
  /**
@@ -820,7 +820,7 @@ const J = class J {
820
820
  * формула sum(count)/sum(total)×chunkRate (один длинный list, batchTotalCount, смешанные batch).
821
821
  * @returns {boolean}
822
822
  */
823
- E(this, It);
823
+ E(this, St);
824
824
  /**
825
825
  * Одно обновление колбэка прогресса, если снимок изменился.
826
826
  * @returns {void}
@@ -832,7 +832,7 @@ const J = class J {
832
832
  * @param {{percent: number, allCount: number, allTotal: number}} snapshot - Текущий снимок прогресса.
833
833
  * @returns {boolean} `true`, если нужно отправить callback прогресса.
834
834
  */
835
- E(this, Bt);
835
+ E(this, wt);
836
836
  /**
837
837
  * Уведомляет подписчиков о текущем состоянии лимита.
838
838
  *
@@ -896,13 +896,13 @@ const J = class J {
896
896
  */
897
897
  E(this, Pt);
898
898
  E(this, lt);
899
- E(this, yt);
899
+ E(this, pt);
900
900
  /**
901
901
  * Resets mutable runtime state before each public batch run.
902
902
  * @param {Function} progressCall - Progress callback for current run.
903
903
  * @returns {void}
904
904
  */
905
- E(this, pt);
905
+ E(this, yt);
906
906
  typeof e == "function" ? (this.callBatch = e, this.callMethod = null) : (this.callBatch = (e == null ? void 0 : e.callBatch) || null, this.callMethod = (e == null ? void 0 : e.callMethod) || null), this.result = {}, this.errors = {}, this.errorMessages = {}, this.timeLimit = {
907
907
  limit: !1,
908
908
  date: void 0,
@@ -917,7 +917,7 @@ const J = class J {
917
917
  if (!this.progressData)
918
918
  return { percent: 0, allCount: 0, allTotal: 0 };
919
919
  const e = this.totalBatchCommands || 0;
920
- if (e > 0 && Array.isArray(this.batchCommandKeyOrder) && this.batchCommandKeyOrder.length && N(this, It, he).call(this)) {
920
+ if (e > 0 && Array.isArray(this.batchCommandKeyOrder) && this.batchCommandKeyOrder.length && N(this, St, he).call(this)) {
921
921
  let u = 0;
922
922
  for (const c of this.batchCommandKeyOrder) {
923
923
  const O = this.progressData[c];
@@ -1159,7 +1159,7 @@ const J = class J {
1159
1159
  * @returns {Promise<Object>}
1160
1160
  */
1161
1161
  async batch(e, t, r = {}) {
1162
- N(this, pt, se).call(this, t);
1162
+ N(this, yt, se).call(this, t);
1163
1163
  const i = {}, a = {}, l = {};
1164
1164
  for (const [m, f] of Object.entries(e)) {
1165
1165
  const A = this.arrayChunk(f);
@@ -1210,7 +1210,7 @@ const J = class J {
1210
1210
  delete i[c];
1211
1211
  i[m] = A;
1212
1212
  }
1213
- return N(this, yt, ee).call(this, i), t && t({ percent: 100 }), Promise.resolve(i);
1213
+ return N(this, pt, ee).call(this, i), t && t({ percent: 100 }), Promise.resolve(i);
1214
1214
  }
1215
1215
  /**
1216
1216
  * Выполняет батч-запрос и возвращает только количество элементов для каждой команды.
@@ -1222,7 +1222,7 @@ const J = class J {
1222
1222
  * @returns {Promise<Object>} Объект с количеством элементов для каждого ключа
1223
1223
  */
1224
1224
  async batchTotalCount(e, t) {
1225
- N(this, pt, se).call(this, t);
1225
+ N(this, yt, se).call(this, t);
1226
1226
  const r = {}, i = {}, a = {};
1227
1227
  for (const [u, n] of Object.entries(e)) {
1228
1228
  const m = this.arrayChunk(n);
@@ -1258,11 +1258,11 @@ const J = class J {
1258
1258
  if (!this.canContinue)
1259
1259
  return;
1260
1260
  if (c.error()) {
1261
- N(this, lt, Mt).call(this, A, c), r[A] = 0;
1261
+ N(this, lt, It).call(this, A, c), r[A] = 0;
1262
1262
  continue;
1263
1263
  }
1264
- const O = this.getData(c.data()), _ = Array.isArray(O) ? O.length : 0, I = typeof c.total == "function" && c.total() !== void 0 ? c.total() : _;
1265
- r[A] = I, this.setProgressData({ key: A, value: c, type: "count" });
1264
+ const O = this.getData(c.data()), _ = Array.isArray(O) ? O.length : 0, D = typeof c.total == "function" && c.total() !== void 0 ? c.total() : _;
1265
+ r[A] = D, this.setProgressData({ key: A, value: c, type: "count" });
1266
1266
  }
1267
1267
  await N(this, z, tt).call(this, f, !m);
1268
1268
  });
@@ -1274,7 +1274,7 @@ const J = class J {
1274
1274
  r[f] !== void 0 && (m += r[f] || 0), delete r[f];
1275
1275
  r[u] = m;
1276
1276
  }
1277
- return Object.entries(this.errors).length && (N(this, yt, ee).call(this, r), this.errorLogger()), t && t({ percent: 100 }), Promise.resolve(r);
1277
+ return Object.entries(this.errors).length && (N(this, pt, ee).call(this, r), this.errorLogger()), t && t({ percent: 100 }), Promise.resolve(r);
1278
1278
  }
1279
1279
  /**
1280
1280
  * Выполняет одиночный REST-вызов с таймаутом и авто-повтором после лимит-паузы.
@@ -1367,23 +1367,23 @@ const J = class J {
1367
1367
  for (const [A, c] of Object.entries(m)) {
1368
1368
  if (!this.canContinue)
1369
1369
  return;
1370
- c.error() && (N(this, lt, Mt).call(this, A, c), h = !0);
1371
- const O = this.getData(c.data()), _ = Array.isArray(O) ? O.length : 0, R = typeof c.total == "function" && c.total() !== void 0, I = R ? c.total() : _;
1372
- t === "count" ? this.result[A] ? this.result[A] += _ : this.result[A] = I : this.result[A] = O, this.setProgressData({ key: A, value: c, type: t });
1373
- const T = e[A], y = Array.isArray(T) ? T[0] : T == null ? void 0 : T.method, k = typeof y == "string" && (y.includes(".list") || y.endsWith("getlist") || y === "user.get" || y === "entity.item.get" || y === "sonet_group.get"), b = t === "count" ? !R && _ === this.limit : k ? _ === this.limit : I > this.limit && I > _, H = t !== "count" && y === "entity.item.get" && _ === this.limit && !b, w = b || H;
1374
- if (!u && (!this.canContinue || w)) {
1375
- let B = e[A];
1376
- if (Array.isArray(B)) {
1377
- const [M, s = {}] = B;
1378
- B = [M, s];
1370
+ c.error() && (N(this, lt, It).call(this, A, c), h = !0);
1371
+ const O = this.getData(c.data()), _ = Array.isArray(O) ? O.length : 0, R = typeof c.total == "function" && c.total() !== void 0, D = R ? c.total() : _;
1372
+ t === "count" ? this.result[A] ? this.result[A] += _ : this.result[A] = D : this.result[A] = O, this.setProgressData({ key: A, value: c, type: t });
1373
+ const T = e[A], p = Array.isArray(T) ? T[0] : T == null ? void 0 : T.method, k = typeof p == "string" && (p.includes(".list") || p.endsWith("getlist") || p === "user.get" || p === "entity.item.get" || p === "sonet_group.get"), b = t === "count" ? !R && _ === this.limit : k ? _ === this.limit : D > this.limit && D > _, H = t !== "count" && p === "entity.item.get" && _ === this.limit && !b, B = b || H;
1374
+ if (!u && (!this.canContinue || B)) {
1375
+ let w = e[A];
1376
+ if (Array.isArray(w)) {
1377
+ const [I, s = {}] = w;
1378
+ w = [I, s];
1379
1379
  } else {
1380
- const { method: M, params: s = {} } = B;
1381
- B = [M, s];
1380
+ const { method: I, params: s = {} } = w;
1381
+ w = [I, s];
1382
1382
  }
1383
1383
  l.push([
1384
1384
  A,
1385
- B,
1386
- I,
1385
+ w,
1386
+ D,
1387
1387
  { entityItemGetScan: H }
1388
1388
  ]);
1389
1389
  }
@@ -1403,68 +1403,68 @@ const J = class J {
1403
1403
  * @param {{oneBatch?: boolean}} [options] - Опции выполнения payload.
1404
1404
  */
1405
1405
  async batchPayload(e, t, r = {}) {
1406
- const i = !!(r != null && r.oneBatch), a = (O, _, R, I) => {
1406
+ const i = !!(r != null && r.oneBatch), a = (O, _, R, D) => {
1407
1407
  let T = "ID";
1408
1408
  this.result[O][this.result[O].length - 1].ID || (T = "id");
1409
- let y = `${T}`;
1410
- if (JSON.stringify(I[1]).toLocaleLowerCase().includes('"id":"desc"') ? y = "<" + y : y = ">" + y, _ === 1 || R.length === 0)
1409
+ let p = `${T}`;
1410
+ if (JSON.stringify(D[1]).toLocaleLowerCase().includes('"id":"desc"') ? p = "<" + p : p = ">" + p, _ === 1 || R.length === 0)
1411
1411
  return {
1412
- field: y,
1412
+ field: p,
1413
1413
  id: this.result[O][this.result[O].length - 1][T]
1414
1414
  };
1415
1415
  let b = "";
1416
- const [H, w] = I;
1416
+ const [H, B] = D;
1417
1417
  return (H === "tasks.task.list" || H === "task.item.list") && (b = "[tasks]"), ["crm.item.list", "crm.stagehistory.list"].includes(H) && (b = "[items]"), H === "crm.type.list" && (b = "[types]"), H === "socialnetwork.api.workgroup.list" && (b = "[workgroups]"), {
1418
- field: y,
1418
+ field: p,
1419
1419
  id: `$result[${[O, _ - 1].join("__")}]${b}[49][${T}]`
1420
1420
  };
1421
1421
  }, l = (O, _) => {
1422
- const [R, I] = O;
1423
- let T = JSON.parse(JSON.stringify(I)), y;
1422
+ const [R, D] = O;
1423
+ let T = JSON.parse(JSON.stringify(D)), p;
1424
1424
  if (R === "task.item.list") {
1425
1425
  T = [...T];
1426
- const [k, b, H, w] = T;
1426
+ const [k, b, H, B] = T;
1427
1427
  return b[_.field] = _.id, [R, T];
1428
1428
  }
1429
- return ["user.get", "sonet_group.get"].includes(R) || T.FILTER ? (T.FILTER || (T.FILTER = {}), y = T.FILTER) : (T.filter || (T.filter = {}), y = T.filter), [
1429
+ return ["user.get", "sonet_group.get"].includes(R) || T.FILTER ? (T.FILTER || (T.FILTER = {}), p = T.FILTER) : (T.filter || (T.filter = {}), p = T.filter), [
1430
1430
  "socialnetwork.api.workgroup.list",
1431
1431
  "tasks.task.list"
1432
- ].includes(R) ? y[">ID"] = _.id : y[_.field] = _.id, [R, { ...T, start: -1 }];
1432
+ ].includes(R) ? p[">ID"] = _.id : p[_.field] = _.id, [R, { ...T, start: -1 }];
1433
1433
  }, h = (O) => {
1434
1434
  Object.entries(O).forEach(([_, R]) => {
1435
- const [I] = _.split("__"), T = this.getData(R.data());
1436
- Array.isArray(T) && (t === "count" ? this.result[I] += T.length : this.result[I].push(...T)), R.error() && N(this, lt, Mt).call(this, I, R), this.setProgressData({ key: I, value: R, type: t });
1435
+ const [D] = _.split("__"), T = this.getData(R.data());
1436
+ Array.isArray(T) && (t === "count" ? this.result[D] += T.length : this.result[D].push(...T)), R.error() && N(this, lt, It).call(this, D, R), this.setProgressData({ key: D, value: R, type: t });
1437
1437
  });
1438
1438
  }, u = (O, _) => {
1439
1439
  if (!Array.isArray(O) || O.length === 0)
1440
1440
  return null;
1441
1441
  const R = O[O.length - 1];
1442
- let I = "ID";
1443
- R.ID || (I = "id");
1444
- let T = I;
1445
- return JSON.stringify(_[1]).toLocaleLowerCase().includes('"id":"desc"') ? T = "<" + T : T = ">" + T, { field: T, id: R[I] };
1442
+ let D = "ID";
1443
+ R.ID || (D = "id");
1444
+ let T = D;
1445
+ return JSON.stringify(_[1]).toLocaleLowerCase().includes('"id":"desc"') ? T = "<" + T : T = ">" + T, { field: T, id: R[D] };
1446
1446
  }, n = 1e4, m = async (O, _) => {
1447
- var R, I;
1447
+ var R, D;
1448
1448
  for (let T = 1; this.canContinue && T <= n; T++) {
1449
- const y = this.result[O], k = u(y, _);
1449
+ const p = this.result[O], k = u(p, _);
1450
1450
  if (!k)
1451
1451
  break;
1452
1452
  const b = `${O}__page_${T}`, H = l(_, k);
1453
- let w = null;
1453
+ let B = null;
1454
1454
  await N(this, st, dt).call(this, { [b]: H }, async (o) => {
1455
- w = o, h(o);
1455
+ B = o, h(o);
1456
1456
  });
1457
- const B = w == null ? void 0 : w[b];
1458
- if ((R = B == null ? void 0 : B.error) != null && R.call(B)) {
1459
- await N(this, z, tt).call(this, w, !1);
1457
+ const w = B == null ? void 0 : B[b];
1458
+ if ((R = w == null ? void 0 : w.error) != null && R.call(w)) {
1459
+ await N(this, z, tt).call(this, B, !1);
1460
1460
  break;
1461
1461
  }
1462
- const M = this.getData((I = B == null ? void 0 : B.data) == null ? void 0 : I.call(B));
1463
- if ((Array.isArray(M) ? M.length : 0) === 0) {
1464
- await N(this, z, tt).call(this, w, !1);
1462
+ const I = this.getData((D = w == null ? void 0 : w.data) == null ? void 0 : D.call(w));
1463
+ if ((Array.isArray(I) ? I.length : 0) === 0) {
1464
+ await N(this, z, tt).call(this, B, !1);
1465
1465
  break;
1466
1466
  }
1467
- await N(this, z, tt).call(this, w, T < n);
1467
+ await N(this, z, tt).call(this, B, T < n);
1468
1468
  }
1469
1469
  };
1470
1470
  let f = [], A = 0;
@@ -1474,7 +1474,7 @@ const J = class J {
1474
1474
  for await (const O of e) {
1475
1475
  if (!this.canContinue)
1476
1476
  return;
1477
- const [_, R, I, T = {}] = O;
1477
+ const [_, R, D, T = {}] = O;
1478
1478
  if (T.entityItemGetScan || !i) {
1479
1479
  if (await c(!0))
1480
1480
  return;
@@ -1483,12 +1483,12 @@ const J = class J {
1483
1483
  await m(_, R);
1484
1484
  continue;
1485
1485
  }
1486
- let y = 1;
1487
- for (; I > y * this.limit; ) {
1488
- const k = [_, y].join("__"), b = a(_, y, f, R);
1486
+ let p = 1;
1487
+ for (; D > p * this.limit; ) {
1488
+ const k = [_, p].join("__"), b = a(_, p, f, R);
1489
1489
  if (f.push([k, l(R, b)]), i && f.length === 49 && await c(!0) || f.length % 50 === 0 && await c(!0))
1490
1490
  return;
1491
- y++;
1491
+ p++;
1492
1492
  }
1493
1493
  }
1494
1494
  await c(!1);
@@ -1502,7 +1502,7 @@ const J = class J {
1502
1502
  }), console.groupEnd();
1503
1503
  }
1504
1504
  };
1505
- It = new WeakSet(), he = function() {
1505
+ St = new WeakSet(), he = function() {
1506
1506
  const e = this.totalBatchCommands || 0, t = this.batchCommandMethods;
1507
1507
  if (e < L(J, Dt) || !Array.isArray(t) || t.length !== e)
1508
1508
  return !1;
@@ -1511,18 +1511,18 @@ It = new WeakSet(), he = function() {
1511
1511
  const i = t.filter(
1512
1512
  (a) => typeof a == "string" && a.includes(".list")
1513
1513
  ).length;
1514
- return i >= L(J, Ct) && i / e >= L(J, wt);
1515
- }, Dt = new WeakMap(), kt = new WeakMap(), Ct = new WeakMap(), wt = new WeakMap(), At = new WeakSet(), bt = function() {
1514
+ return i >= L(J, Ct) && i / e >= L(J, Bt);
1515
+ }, Dt = new WeakMap(), kt = new WeakMap(), Ct = new WeakMap(), Bt = new WeakMap(), At = new WeakSet(), bt = function() {
1516
1516
  if (!this.progressCall || !this.progressData)
1517
1517
  return;
1518
1518
  const { percent: e, allCount: t, allTotal: r } = this.progressPercent, i = { percent: e, allCount: t, allTotal: r };
1519
- N(this, Bt, ue).call(this, i) && (this.progressCall({
1519
+ N(this, wt, ue).call(this, i) && (this.progressCall({
1520
1520
  data: this.progressData,
1521
1521
  percent: e,
1522
1522
  allCount: t,
1523
1523
  allTotal: r
1524
1524
  }), this.lastProgressSnapshot = i);
1525
- }, Bt = new WeakSet(), ue = function(e) {
1525
+ }, wt = new WeakSet(), ue = function(e) {
1526
1526
  return this.lastProgressSnapshot ? this.lastProgressSnapshot.percent !== e.percent || this.lastProgressSnapshot.allCount !== e.allCount || this.lastProgressSnapshot.allTotal !== e.allTotal : !0;
1527
1527
  }, Ht = new WeakSet(), fe = function() {
1528
1528
  const e = {
@@ -1662,17 +1662,17 @@ It = new WeakSet(), he = function() {
1662
1662
  code: i || h,
1663
1663
  message: h
1664
1664
  };
1665
- }, lt = new WeakSet(), Mt = function(e, t) {
1665
+ }, lt = new WeakSet(), It = function(e, t) {
1666
1666
  const { code: r, message: i } = N(this, Pt, me).call(this, t);
1667
1667
  this.errors[e] = r, this.errorMessages[e] = i;
1668
- }, yt = new WeakSet(), ee = function(e) {
1668
+ }, pt = new WeakSet(), ee = function(e) {
1669
1669
  Object.entries(this.errors).length && (e.errorsList = { ...this.errors }, Object.entries(this.errorMessages).length && (e.errorsListMessages = { ...this.errorMessages }));
1670
- }, pt = new WeakSet(), se = function(e) {
1670
+ }, yt = new WeakSet(), se = function(e) {
1671
1671
  this.clearProgressData(), this.progressCall = typeof e == "function" ? e : "", this.canContinue = !0, this.result = {}, this.errors = {}, this.errorMessages = {}, this.chunkRate = 1, this.totalProgress = 0, this.batchCommandKeyOrder = [], this.totalBatchCommands = 0, this.batchCommandMethods = [], this.setTimeLimitState(!1, void 0);
1672
1672
  }, /** Не включать вес по командам для совсем маленьких batch. */
1673
1673
  E(J, Dt, 5), /** Явный сигнал: много отдельных выборок сделок по фильтрам. */
1674
1674
  E(J, kt, 5), /** Достаточно «list»-методов в пачке и доля list от всех команд. */
1675
- E(J, Ct, 8), E(J, wt, 0.65);
1675
+ E(J, Ct, 8), E(J, Bt, 0.65);
1676
1676
  let K = J;
1677
1677
  var rt;
1678
1678
  class ge {
@@ -1746,7 +1746,7 @@ class ge {
1746
1746
  }
1747
1747
  rt = new WeakMap();
1748
1748
  const Zt = new ge();
1749
- var j, Q, it, ct, Nt, V, v, nt, ht, Gt, ye, Ot, re, Yt, pe, Wt, Ne, xt, Oe;
1749
+ var j, Q, it, ct, Nt, V, v, nt, ht, Gt, pe, Ot, re, Yt, ye, Wt, Ne, xt, Oe;
1750
1750
  class Ue {
1751
1751
  constructor() {
1752
1752
  /** user.current — только при первом реальном использовании (сохранение лога, выгрузка). */
@@ -1768,7 +1768,7 @@ class Ue {
1768
1768
  E(this, nt, !1);
1769
1769
  E(this, ht, !1);
1770
1770
  /** Очистка хранилища элементов старше 'N' месяцев */
1771
- D(this, "periodClear", 3);
1771
+ S(this, "periodClear", 3);
1772
1772
  }
1773
1773
  /** Инициализация логера */
1774
1774
  async init() {
@@ -1851,7 +1851,7 @@ class Ue {
1851
1851
  console.error(`Не найдены данные логирования для ключа: ${e}`);
1852
1852
  return;
1853
1853
  }
1854
- t && (a.errorList = t), r && (a.status = r), i && (a.answer = i), await N(this, Gt, ye).call(this), a.userInfo = L(this, ct), await N(this, Yt, pe).call(this), (l = a == null ? void 0 : a.data) != null && l.updateList && x(this, nt, !0), x(this, ht, !1);
1854
+ t && (a.errorList = t), r && (a.status = r), i && (a.answer = i), await N(this, Gt, pe).call(this), a.userInfo = L(this, ct), await N(this, Yt, ye).call(this), (l = a == null ? void 0 : a.data) != null && l.updateList && x(this, nt, !0), x(this, ht, !1);
1855
1855
  }
1856
1856
  /**
1857
1857
  * @param { ({percent}:{percent:number})=>{} } progressCall - коллбэк
@@ -1914,7 +1914,7 @@ class Ue {
1914
1914
  }
1915
1915
  }
1916
1916
  }
1917
- j = new WeakMap(), Q = new WeakMap(), it = new WeakMap(), ct = new WeakMap(), Nt = new WeakMap(), V = new WeakMap(), v = new WeakMap(), nt = new WeakMap(), ht = new WeakMap(), Gt = new WeakSet(), ye = async function() {
1917
+ j = new WeakMap(), Q = new WeakMap(), it = new WeakMap(), ct = new WeakMap(), Nt = new WeakMap(), V = new WeakMap(), v = new WeakMap(), nt = new WeakMap(), ht = new WeakMap(), Gt = new WeakSet(), pe = async function() {
1918
1918
  if (!L(this, Nt))
1919
1919
  return L(this, V) ? L(this, V) : (x(this, V, (async () => {
1920
1920
  try {
@@ -1939,7 +1939,7 @@ j = new WeakMap(), Q = new WeakMap(), it = new WeakMap(), ct = new WeakMap(), Nt
1939
1939
  console.error("Хранилище для логгера не инициализировано");
1940
1940
  }
1941
1941
  });
1942
- }, Yt = new WeakSet(), pe = async function() {
1942
+ }, Yt = new WeakSet(), ye = async function() {
1943
1943
  try {
1944
1944
  let e = {}, t = new K(BX24.callBatch);
1945
1945
  for (let [r, i] of L(this, it).entries())
@@ -2042,7 +2042,7 @@ function ie(d) {
2042
2042
  const e = Pe();
2043
2043
  return e ? (d.appConst.pathApp = e, e) : le(d.appConst.pathApp ?? "");
2044
2044
  }
2045
- var ut, St, Ft, Te, _t, ne, vt, Ee, Xt, Re, Jt, Le, $, ot, Tt, ae, jt, be, Et, oe, Kt, Me;
2045
+ var ut, Mt, Ft, Te, _t, ne, vt, Ee, Xt, Re, Jt, Le, $, ot, Tt, ae, jt, be, Et, oe, Kt, Ie;
2046
2046
  class Je {
2047
2047
  /**
2048
2048
  * @param {Object} appConst - Константы приложения
@@ -2094,20 +2094,20 @@ class Je {
2094
2094
  * @private
2095
2095
  */
2096
2096
  E(this, Kt);
2097
- D(this, "domain", "");
2098
- D(this, "isAdmin", !1);
2099
- D(this, "appInfo", null);
2100
- D(this, "appConst", null);
2101
- D(this, "userInfo", null);
2102
- D(this, "placeData", null);
2103
- D(this, "placeInfo", null);
2104
- D(this, "logger", !1);
2105
- D(this, "timeLimit", {
2097
+ S(this, "domain", "");
2098
+ S(this, "isAdmin", !1);
2099
+ S(this, "appInfo", null);
2100
+ S(this, "appConst", null);
2101
+ S(this, "userInfo", null);
2102
+ S(this, "placeData", null);
2103
+ S(this, "placeInfo", null);
2104
+ S(this, "logger", !1);
2105
+ S(this, "timeLimit", {
2106
2106
  limit: !1,
2107
2107
  date: void 0,
2108
2108
  pauseMs: void 0
2109
2109
  });
2110
- D(this, "batchClient", null);
2110
+ S(this, "batchClient", null);
2111
2111
  this.appConst = e;
2112
2112
  }
2113
2113
  /**
@@ -2117,7 +2117,7 @@ class Je {
2117
2117
  * @returns {() => void} Функция отписки.
2118
2118
  */
2119
2119
  subscribeTimeLimit(e) {
2120
- return N(this, ut, St).call(this).subscribeTimeLimit(e);
2120
+ return N(this, ut, Mt).call(this).subscribeTimeLimit(e);
2121
2121
  }
2122
2122
  /**
2123
2123
  * Единая инициализация: внутри автоматически выбирается ветка обычного приложения или
@@ -2216,7 +2216,7 @@ class Je {
2216
2216
  const h = new Error("BX24 is not initialized");
2217
2217
  throw console.error(h), h;
2218
2218
  }
2219
- const l = await N(this, ut, St).call(this).call({ method: e, params: t });
2219
+ const l = await N(this, ut, Mt).call(this).call({ method: e, params: t });
2220
2220
  return l.success ? (await N(this, $, ot).call(this, i, {
2221
2221
  answer: l.answer,
2222
2222
  status: "success"
@@ -2312,7 +2312,7 @@ class Je {
2312
2312
  i = i.filter(
2313
2313
  (c) => c.placement !== "PAGE_BACKGROUND_WORKER" && c.placement !== "PAGE_BACKGROUND_WORKER_ALL"
2314
2314
  );
2315
- const a = N(this, Kt, Me).call(this, r), l = new Set(i.map((c) => c.placement));
2315
+ const a = N(this, Kt, Ie).call(this, r), l = new Set(i.map((c) => c.placement));
2316
2316
  for (const c of a)
2317
2317
  l.has(c.placement) || i.push({ placement: c.placement });
2318
2318
  if (i.length === 0)
@@ -2325,16 +2325,16 @@ class Je {
2325
2325
  for (let c = 0; c < i.length; c++) {
2326
2326
  const { placement: O, options: _ } = i[c], R = f.get(O) || [];
2327
2327
  if (R.some(
2328
- (y) => y.handler === r
2328
+ (p) => p.handler === r
2329
2329
  ))
2330
2330
  continue;
2331
2331
  const T = R.filter(
2332
- (y) => y.handler !== r
2332
+ (p) => p.handler !== r
2333
2333
  );
2334
- for (const y of T)
2334
+ for (const p of T)
2335
2335
  m.push({
2336
2336
  placement: O,
2337
- handler: y.handler
2337
+ handler: p.handler
2338
2338
  });
2339
2339
  n[`bind_${c}`] = {
2340
2340
  method: "placement.bind",
@@ -2445,7 +2445,7 @@ class Je {
2445
2445
  return this.logger.getEntityList(e);
2446
2446
  }
2447
2447
  }
2448
- ut = new WeakSet(), St = function() {
2448
+ ut = new WeakSet(), Mt = function() {
2449
2449
  return this.batchClient || (this.batchClient = new K({
2450
2450
  callBatch: BX24.callBatch,
2451
2451
  callMethod: BX24.callMethod
@@ -2487,7 +2487,7 @@ ut = new WeakSet(), St = function() {
2487
2487
  updateList: a,
2488
2488
  batchOptions: l
2489
2489
  }) {
2490
- const h = N(this, ut, St).call(this), u = a ? this.logger.start({
2490
+ const h = N(this, ut, Mt).call(this), u = a ? this.logger.start({
2491
2491
  type: e,
2492
2492
  data: e === "batch" ? { commandList: t, updateList: a } : { commandList: t }
2493
2493
  }) : void 0;
@@ -2542,10 +2542,10 @@ ut = new WeakSet(), St = function() {
2542
2542
  return Array.isArray(e) ? t = e.map(
2543
2543
  (r) => typeof r == "string" ? { placement: r } : r
2544
2544
  ) : typeof e == "string" ? t = [{ placement: e }] : t = [e], t;
2545
- }, Kt = new WeakSet(), Me = function(e) {
2545
+ }, Kt = new WeakSet(), Ie = function(e) {
2546
2546
  return this.placeData ? this.placeData.filter((t) => !(t.placement === "PAGE_BACKGROUND_WORKER" || !t.handler || t.handler.includes(e))) : [];
2547
2547
  };
2548
- const Se = "szdl-utils-kit|";
2548
+ const Me = "szdl-utils-kit|";
2549
2549
  function Ge() {
2550
2550
  if (typeof sessionStorage > "u")
2551
2551
  return `ephemeral-${Date.now()}-${Math.random().toString(16).slice(2)}`;
@@ -2559,7 +2559,7 @@ const Vt = /* @__PURE__ */ new Map();
2559
2559
  function We(d = "default") {
2560
2560
  if (typeof BroadcastChannel > "u")
2561
2561
  return null;
2562
- const e = `${Se}bc:${d}`;
2562
+ const e = `${Me}bc:${d}`;
2563
2563
  return Vt.has(e) || Vt.set(e, new BroadcastChannel(e)), Vt.get(e);
2564
2564
  }
2565
2565
  function ce(d, e) {
@@ -2576,7 +2576,7 @@ function ce(d, e) {
2576
2576
  }
2577
2577
  }
2578
2578
  async function xe(d, e, t = {}) {
2579
- const { ifAvailable: r = !1 } = t, i = typeof d == "string" && d.length > 0 ? d : "default", a = `${Se}${i}`;
2579
+ const { ifAvailable: r = !1 } = t, i = typeof d == "string" && d.length > 0 ? d : "default", a = `${Me}${i}`;
2580
2580
  return Ye() ? navigator.locks.request(
2581
2581
  a,
2582
2582
  { mode: "exclusive", ifAvailable: !!r },
@@ -2631,7 +2631,7 @@ function ve(d = {}) {
2631
2631
  }
2632
2632
  return e;
2633
2633
  }
2634
- var qt, Ie, Rt, Ae, at, mt, zt, De;
2634
+ var qt, Se, Rt, Ae, at, mt, zt, De;
2635
2635
  class je {
2636
2636
  constructor(e) {
2637
2637
  E(this, qt);
@@ -2644,29 +2644,31 @@ class je {
2644
2644
  E(this, at);
2645
2645
  /** Имя Web Lock для подтверждения лидерства. */
2646
2646
  E(this, zt);
2647
- D(this, "entityName", "tabs");
2648
- D(this, "maxTabs", 20);
2649
- D(this, "tabList", []);
2650
- D(this, "id", 0);
2651
- D(this, "hasStarted", !1);
2652
- D(this, "heartbeat");
2653
- D(this, "runHeartbeat");
2654
- D(this, "startDelay", 0);
2655
- D(this, "activeMaxPause", q.activeMaxPauseMs);
2656
- D(this, "quickCleanupThreshold", q.quickCleanupThresholdMs);
2657
- D(this, "pollInterval", q.pollIntervalMs);
2658
- D(this, "pollIntervalBase", q.pollIntervalMs);
2659
- D(this, "pollIntervalJitter", q.pollIntervalJitterMs);
2660
- D(this, "leaderConfirmDelay", q.leaderConfirmDelayMs);
2661
- D(this, "leaderHeartbeatMs", null);
2662
- D(this, "sessionId", `${Date.now()}-${Math.random().toString(16).slice(2)}`);
2663
- D(this, "continueCondition");
2664
- D(this, "defaultContinueBackground", () => !0);
2647
+ S(this, "entityName", "tabs");
2648
+ S(this, "maxTabs", 20);
2649
+ S(this, "tabList", []);
2650
+ S(this, "id", 0);
2651
+ S(this, "hasStarted", !1);
2652
+ S(this, "heartbeat");
2653
+ S(this, "runHeartbeat");
2654
+ S(this, "startDelay", 0);
2655
+ S(this, "activeMaxPause", q.activeMaxPauseMs);
2656
+ S(this, "quickCleanupThreshold", q.quickCleanupThresholdMs);
2657
+ S(this, "pollInterval", q.pollIntervalMs);
2658
+ S(this, "pollIntervalBase", q.pollIntervalMs);
2659
+ S(this, "pollIntervalJitter", q.pollIntervalJitterMs);
2660
+ S(this, "leaderConfirmDelay", q.leaderConfirmDelayMs);
2661
+ S(this, "leaderHeartbeatMs", null);
2662
+ S(this, "sessionId", `${Date.now()}-${Math.random().toString(16).slice(2)}`);
2663
+ S(this, "continueCondition");
2664
+ S(this, "defaultContinueBackground", () => !0);
2665
2665
  /** @type {'user' | 'portal'} */
2666
- D(this, "coordinationScope", "user");
2666
+ S(this, "coordinationScope", "user");
2667
2667
  /** Привязывать общую встройку PAGE_BACKGROUND_WORKER без USER_ID. @default true */
2668
- D(this, "bindGeneralPlacement", !0);
2669
- var n, m, f;
2668
+ S(this, "bindGeneralPlacement", !0);
2669
+ /** @type {boolean | ((worker: BackgroundWorker) => boolean | Promise<boolean>) | undefined} */
2670
+ S(this, "ensureAdminPlacementsBeforeAppInit");
2671
+ var m, f, A;
2670
2672
  if (!e) {
2671
2673
  console.error("BackgroundWorker: Нет опций конструктора");
2672
2674
  return;
@@ -2678,9 +2680,10 @@ class je {
2678
2680
  continueBackground: a,
2679
2681
  timing: l,
2680
2682
  coordinationScope: h,
2681
- bindGeneralPlacement: u
2683
+ bindGeneralPlacement: u,
2684
+ ensureAdminPlacementsBeforeAppInit: n
2682
2685
  } = e;
2683
- this.bx = r, this.appInit = t, this.users = i, this.coordinationScope = Fe(h), this.bindGeneralPlacement = u !== !1, N(this, qt, Ie).call(this, l), ie(r), this.appPath = N(this, Rt, Ae).call(this, ((n = r == null ? void 0 : r.appConst) == null ? void 0 : n.pathApp) ?? ""), this.appName = ((m = r == null ? void 0 : r.appConst) == null ? void 0 : m.appName) ?? "", this.appCodeName = ((f = r == null ? void 0 : r.appConst) == null ? void 0 : f.appCodeName) ?? "", this.start = /* @__PURE__ */ new Date(), this.continueCondition = typeof a == "function" ? a : this.defaultContinueBackground;
2686
+ this.bx = r, this.appInit = t, this.users = i, this.coordinationScope = Fe(h), this.bindGeneralPlacement = u !== !1, this.ensureAdminPlacementsBeforeAppInit = n, N(this, qt, Se).call(this, l), ie(r), this.appPath = N(this, Rt, Ae).call(this, ((m = r == null ? void 0 : r.appConst) == null ? void 0 : m.pathApp) ?? ""), this.appName = ((f = r == null ? void 0 : r.appConst) == null ? void 0 : f.appName) ?? "", this.appCodeName = ((A = r == null ? void 0 : r.appConst) == null ? void 0 : A.appCodeName) ?? "", this.start = /* @__PURE__ */ new Date(), this.continueCondition = typeof a == "function" ? a : this.defaultContinueBackground;
2684
2687
  }
2685
2688
  async init() {
2686
2689
  if (!this.appInit) {
@@ -2954,7 +2957,7 @@ class je {
2954
2957
  i
2955
2958
  );
2956
2959
  try {
2957
- await this.appInit();
2960
+ await this._ensurePlacementsBeforeAppInitIfNeeded(), await this.appInit();
2958
2961
  } catch (a) {
2959
2962
  console.error("BackgroundWorker: appInit failed", a);
2960
2963
  }
@@ -2965,8 +2968,26 @@ class je {
2965
2968
  "BackgroundWorker: runAsLeader пропущен — Web Lock у другой вкладки (подтверждение лидерства)"
2966
2969
  );
2967
2970
  }
2971
+ /**
2972
+ * Перепривязка PAGE_BACKGROUND_WORKER перед appInit, если приложение запросило.
2973
+ * Ошибки не прерывают appInit.
2974
+ * @internal
2975
+ */
2976
+ async _ensurePlacementsBeforeAppInitIfNeeded() {
2977
+ var r;
2978
+ const e = this.ensureAdminPlacementsBeforeAppInit;
2979
+ if (!(!e || !((r = this.bx) != null && r.isAdmin) || !(typeof e == "function" ? await Promise.resolve(e(this)) : e)))
2980
+ try {
2981
+ await this.ensureAdminPlacements();
2982
+ } catch (i) {
2983
+ console.error(
2984
+ "BackgroundWorker: ensureAdminPlacements before appInit failed",
2985
+ i
2986
+ );
2987
+ }
2988
+ }
2968
2989
  async setBackgroundWorkerAll() {
2969
- var _, R, I, T;
2990
+ var _, R, D, T;
2970
2991
  if (!((_ = this.bx) != null && _.isAdmin)) {
2971
2992
  console.log(
2972
2993
  "BackgroundWorker: setBackgroundWorkerAll доступен только админам"
@@ -2974,7 +2995,7 @@ class je {
2974
2995
  return;
2975
2996
  }
2976
2997
  (R = this.users) != null && R.length || await this.getEntityData(), ie(this.bx);
2977
- const e = N(this, Rt, Ae).call(this, ((T = (I = this.bx) == null ? void 0 : I.appConst) == null ? void 0 : T.pathApp) ?? "");
2998
+ const e = N(this, Rt, Ae).call(this, ((T = (D = this.bx) == null ? void 0 : D.appConst) == null ? void 0 : T.pathApp) ?? "");
2978
2999
  if (!e) {
2979
3000
  console.error(
2980
3001
  "BackgroundWorker: setBackgroundWorkerAll — нет валидного pathApp, привязка PAGE_BACKGROUND_WORKER пропущена"
@@ -2985,44 +3006,44 @@ class je {
2985
3006
  () => this.bx.getPlacement()
2986
3007
  ), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
2987
3008
  let a = null;
2988
- (t || []).forEach((y) => {
2989
- if (y.placement !== "PAGE_BACKGROUND_WORKER")
3009
+ (t || []).forEach((p) => {
3010
+ if (p.placement !== "PAGE_BACKGROUND_WORKER")
2990
3011
  return;
2991
- if (y.userId || y.handler && y.handler.includes("USER_ID=")) {
2992
- const b = y.userId || (y.handler ? this.extractUserIdFromHandler(y.handler) : null);
3012
+ if (p.userId || p.handler && p.handler.includes("USER_ID=")) {
3013
+ const b = p.userId || (p.handler ? this.extractUserIdFromHandler(p.handler) : null);
2993
3014
  if (b) {
2994
3015
  const H = +b;
2995
- r.set(H, y), i.has(H) || i.set(H, []), i.get(H).push(y);
3016
+ r.set(H, p), i.has(H) || i.set(H, []), i.get(H).push(p);
2996
3017
  }
2997
3018
  } else
2998
- a = y;
3019
+ a = p;
2999
3020
  });
3000
3021
  const l = await this.resolveAdmins(), h = await this.getEligibleUsersForBackgroundWorker(l);
3001
- h.sort((y, k) => {
3002
- const b = y.LAST_LOGIN ? new Date(y.LAST_LOGIN) : /* @__PURE__ */ new Date(0);
3022
+ h.sort((p, k) => {
3023
+ const b = p.LAST_LOGIN ? new Date(p.LAST_LOGIN) : /* @__PURE__ */ new Date(0);
3003
3024
  return (k.LAST_LOGIN ? new Date(k.LAST_LOGIN) : /* @__PURE__ */ new Date(0)) - b;
3004
3025
  });
3005
- const u = 10, n = h.slice(0, u), m = n.filter((y) => {
3006
- const k = r.get(+y.ID);
3026
+ const u = 10, n = h.slice(0, u), m = n.filter((p) => {
3027
+ const k = r.get(+p.ID);
3007
3028
  if (!k)
3008
3029
  return !0;
3009
- const b = `${e}?USER_ID=${y.ID}/`;
3030
+ const b = `${e}?USER_ID=${p.ID}/`;
3010
3031
  return k.handler !== b;
3011
3032
  }), f = [];
3012
- for (const [y] of r) {
3013
- const k = +y || 0;
3033
+ for (const [p] of r) {
3034
+ const k = +p || 0;
3014
3035
  h.find((H) => +H.ID === k) || f.push(k);
3015
3036
  }
3016
- for (const y of n) {
3017
- const k = r.get(+y.ID);
3037
+ for (const p of n) {
3038
+ const k = r.get(+p.ID);
3018
3039
  if (!k)
3019
3040
  continue;
3020
- const b = `${e}?USER_ID=${y.ID}/`;
3021
- k.handler !== b && f.push(+y.ID);
3041
+ const b = `${e}?USER_ID=${p.ID}/`;
3042
+ k.handler !== b && f.push(+p.ID);
3022
3043
  }
3023
3044
  const A = [], c = [...new Set(f)];
3024
- for (const y of c) {
3025
- const k = i.get(+y) || [];
3045
+ for (const p of c) {
3046
+ const k = i.get(+p) || [];
3026
3047
  for (const b of k)
3027
3048
  b != null && b.handler && A.push({
3028
3049
  method: "placement.unbind",
@@ -3040,17 +3061,17 @@ class je {
3040
3061
  HANDLER: a.handler || `${e}`
3041
3062
  }
3042
3063
  });
3043
- for (const y of m)
3064
+ for (const p of m)
3044
3065
  A.push({
3045
3066
  method: "placement.bind",
3046
3067
  params: {
3047
3068
  PLACEMENT: "PAGE_BACKGROUND_WORKER",
3048
- HANDLER: `${e}?USER_ID=${y.ID}/`,
3069
+ HANDLER: `${e}?USER_ID=${p.ID}/`,
3049
3070
  LANG_ALL: { ru: { TITLE: this.appName } },
3050
3071
  OPTIONS: {
3051
- errorHandlerUrl: `${e}?USER_ID=${y.ID}/`
3072
+ errorHandlerUrl: `${e}?USER_ID=${p.ID}/`
3052
3073
  },
3053
- USER_ID: y.ID
3074
+ USER_ID: p.ID
3054
3075
  }
3055
3076
  });
3056
3077
  this.bindGeneralPlacement && (!a || O) && A.push({
@@ -3064,7 +3085,7 @@ class je {
3064
3085
  }), A.length ? await this.safeCall(
3065
3086
  () => this.bx.batch(
3066
3087
  Object.fromEntries(
3067
- A.map((y, k) => [`placement_${k}`, y])
3088
+ A.map((p, k) => [`placement_${k}`, p])
3068
3089
  )
3069
3090
  )
3070
3091
  ) : console.log("setBackgroundWorkerAll: Нет операций");
@@ -3143,7 +3164,7 @@ class je {
3143
3164
  }
3144
3165
  }
3145
3166
  }
3146
- qt = new WeakSet(), Ie = function(e) {
3167
+ qt = new WeakSet(), Se = function(e) {
3147
3168
  const t = ve(e);
3148
3169
  this.startDelay = t.startDelayMs, this.leaderConfirmDelay = t.leaderConfirmDelayMs, this.activeMaxPause = t.activeMaxPauseMs, this.quickCleanupThreshold = t.quickCleanupThresholdMs, this.pollIntervalBase = t.pollIntervalMs, this.pollIntervalJitter = t.pollIntervalJitterMs, this.pollInterval = t.pollIntervalMs + (t.pollIntervalJitterMs > 0 ? Math.floor(Math.random() * t.pollIntervalJitterMs) : 0), this.leaderHeartbeatMs = t.leaderHeartbeatMs;
3149
3170
  const r = t.pollIntervalMs + t.pollIntervalJitterMs + t.leaderConfirmDelayMs;