szdl-utils-kit 0.2.17 → 0.2.18
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 +393 -387
- package/dist/index.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var C = (y, A, e) => (
|
|
1
|
+
var me = Object.defineProperty;
|
|
2
|
+
var fe = (y, A, e) => A in y ? me(y, A, { enumerable: !0, configurable: !0, writable: !0, value: e }) : y[A] = e;
|
|
3
|
+
var C = (y, A, e) => (fe(y, typeof A != "symbol" ? A + "" : A, e), e), Xt = (y, A, e) => {
|
|
4
4
|
if (!A.has(y))
|
|
5
5
|
throw TypeError("Cannot " + e);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var o = (y, A, e) => (Xt(y, A, "read from private field"), e ? e.call(y) : A.get(y)), N = (y, A, e) => {
|
|
8
8
|
if (A.has(y))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
A instanceof WeakSet ? A.add(y) : A.set(y, e);
|
|
11
|
-
},
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
function
|
|
11
|
+
}, E = (y, A, e, n) => (Xt(y, A, "write to private field"), n ? n.call(y, e) : A.set(y, e), e);
|
|
12
|
+
var _ = (y, A, e) => (Xt(y, A, "access private method"), e);
|
|
13
|
+
var Ne = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
14
|
+
function _e(y) {
|
|
15
15
|
return y && y.__esModule && Object.prototype.hasOwnProperty.call(y, "default") ? y.default : y;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
17
|
+
var xt = { exports: {} };
|
|
18
18
|
(function(y, A) {
|
|
19
19
|
(function(e) {
|
|
20
20
|
Array.prototype.indexOf || (Array.prototype.indexOf = function(t, s) {
|
|
21
|
-
var
|
|
22
|
-
for (
|
|
23
|
-
if (this[
|
|
24
|
-
return
|
|
21
|
+
var a, c;
|
|
22
|
+
for (a = s || 0, c = this.length; a < c; a += 1)
|
|
23
|
+
if (this[a] === t)
|
|
24
|
+
return a;
|
|
25
25
|
return -1;
|
|
26
26
|
});
|
|
27
27
|
var n = this, i = function(t, s) {
|
|
28
|
-
for (var
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
},
|
|
28
|
+
for (var a = t.toString(); a.length < s; )
|
|
29
|
+
a = "0" + a;
|
|
30
|
+
return a;
|
|
31
|
+
}, h = 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
33
|
}, l = function(t, s) {
|
|
34
|
-
var
|
|
35
|
-
return
|
|
36
|
-
},
|
|
37
|
-
var
|
|
34
|
+
var a, c = "";
|
|
35
|
+
return a = t.slice(s, s + 1), a !== "" && !isNaN(Number(a)) && (c += "%H"), a = t.charAt(s + 2), a !== "" && a === ":" && (c += a), a = t.slice(s + 3, s + 4), a !== "" && !isNaN(Number(a)) && (c += "%M"), a = t.charAt(s + 5), a !== "" && a === ":" && (c += a), a = t.slice(s + 6, s + 7), a !== "" && !isNaN(Number(a)) && (c += "%S"), c;
|
|
36
|
+
}, O = function(t, s) {
|
|
37
|
+
var a, 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
|
], M;
|
|
44
|
-
return !isNaN(Number(c[0])) && !isNaN(Number(c[2])) && !isNaN(Number(c[4])) ? (c[1] === "." && c[3] === "." ?
|
|
44
|
+
return !isNaN(Number(c[0])) && !isNaN(Number(c[2])) && !isNaN(Number(c[4])) ? (c[1] === "." && c[3] === "." ? a = "%d.%m.%Y" : c[1] === "-" && c[3] === "-" ? a = "%m-%d-%Y" : c[1] === "/" && c[3] === "/" && (a = "%m/%d/%Y"), a) : (M = [
|
|
45
45
|
t.slice(s, s + 3),
|
|
46
46
|
t.charAt(s + 4),
|
|
47
47
|
t.slice(s + 5, s + 6),
|
|
48
48
|
t.charAt(s + 7),
|
|
49
49
|
t.slice(s + 8, s + 9)
|
|
50
|
-
], !isNaN(Number(M[0])) && !isNaN(Number(M[2])) && !isNaN(Number(M[4])) ? (M[1] === "-" && M[3] === "-" && (
|
|
51
|
-
},
|
|
50
|
+
], !isNaN(Number(M[0])) && !isNaN(Number(M[2])) && !isNaN(Number(M[4])) ? (M[1] === "-" && M[3] === "-" && (a = "%Y-%m-%d"), a) : "");
|
|
51
|
+
}, u = n.tempus, r, g, S = n.navigator || {}, m = "en", f = {
|
|
52
52
|
en: {
|
|
53
53
|
JANUARY_SHORT: "Jan",
|
|
54
54
|
FEBRUARY_SHORT: "Feb",
|
|
@@ -211,59 +211,59 @@ var Xt = { exports: {} };
|
|
|
211
211
|
}
|
|
212
212
|
}, G = function() {
|
|
213
213
|
return [
|
|
214
|
-
f[
|
|
215
|
-
f[
|
|
216
|
-
f[
|
|
217
|
-
f[
|
|
218
|
-
f[
|
|
219
|
-
f[
|
|
220
|
-
f[
|
|
221
|
-
f[
|
|
222
|
-
f[
|
|
223
|
-
f[
|
|
224
|
-
f[
|
|
225
|
-
f[
|
|
214
|
+
f[m].JANUARY_LONG,
|
|
215
|
+
f[m].FEBRUARY_LONG,
|
|
216
|
+
f[m].MARCH_LONG,
|
|
217
|
+
f[m].APRIL_LONG,
|
|
218
|
+
f[m].MAY_LONG,
|
|
219
|
+
f[m].JUNE_LONG,
|
|
220
|
+
f[m].JULY_LONG,
|
|
221
|
+
f[m].AUGUST_LONG,
|
|
222
|
+
f[m].SEPTEMBER_LONG,
|
|
223
|
+
f[m].OCTOBER_LONG,
|
|
224
|
+
f[m].NOVEMBER_LONG,
|
|
225
|
+
f[m].DECEMBER_LONG
|
|
226
226
|
];
|
|
227
|
-
},
|
|
227
|
+
}, at = function() {
|
|
228
228
|
return [
|
|
229
|
-
f[
|
|
230
|
-
f[
|
|
231
|
-
f[
|
|
232
|
-
f[
|
|
233
|
-
f[
|
|
234
|
-
f[
|
|
235
|
-
f[
|
|
236
|
-
f[
|
|
237
|
-
f[
|
|
238
|
-
f[
|
|
239
|
-
f[
|
|
240
|
-
f[
|
|
229
|
+
f[m].JANUARY_SHORT,
|
|
230
|
+
f[m].FEBRUARY_SHORT,
|
|
231
|
+
f[m].MARCH_SHORT,
|
|
232
|
+
f[m].APRIL_SHORT,
|
|
233
|
+
f[m].MAY_SHORT,
|
|
234
|
+
f[m].JUNE_SHORT,
|
|
235
|
+
f[m].JULY_SHORT,
|
|
236
|
+
f[m].AUGUST_SHORT,
|
|
237
|
+
f[m].SEPTEMBER_SHORT,
|
|
238
|
+
f[m].OCTOBER_SHORT,
|
|
239
|
+
f[m].NOVEMBER_SHORT,
|
|
240
|
+
f[m].DECEMBER_SHORT
|
|
241
241
|
];
|
|
242
|
-
},
|
|
242
|
+
}, V = function() {
|
|
243
243
|
return [
|
|
244
|
-
f[
|
|
245
|
-
f[
|
|
246
|
-
f[
|
|
247
|
-
f[
|
|
248
|
-
f[
|
|
249
|
-
f[
|
|
250
|
-
f[
|
|
244
|
+
f[m].SUNDAY_LONG,
|
|
245
|
+
f[m].MONDAY_LONG,
|
|
246
|
+
f[m].TUESDAY_LONG,
|
|
247
|
+
f[m].WEDNESDAY_LONG,
|
|
248
|
+
f[m].THURSDAY_LONG,
|
|
249
|
+
f[m].FRIDAY_LONG,
|
|
250
|
+
f[m].SATURDAY_LONG
|
|
251
251
|
];
|
|
252
252
|
}, J = function() {
|
|
253
253
|
return [
|
|
254
|
-
f[
|
|
255
|
-
f[
|
|
256
|
-
f[
|
|
257
|
-
f[
|
|
258
|
-
f[
|
|
259
|
-
f[
|
|
260
|
-
f[
|
|
254
|
+
f[m].SUNDAY_SHORT,
|
|
255
|
+
f[m].MONDAY_SHORT,
|
|
256
|
+
f[m].TUESDAY_SHORT,
|
|
257
|
+
f[m].WEDNESDAY_SHORT,
|
|
258
|
+
f[m].THURSDAY_SHORT,
|
|
259
|
+
f[m].FRIDAY_SHORT,
|
|
260
|
+
f[m].SATURDAY_SHORT
|
|
261
261
|
];
|
|
262
|
-
}, P,
|
|
262
|
+
}, P, Mt, ht, ct, ue = function(t, s, a) {
|
|
263
263
|
var c;
|
|
264
264
|
n.XMLHttpRequest ? c = new XMLHttpRequest() : c = new ActiveXObject("Microsoft.XMLHTTP"), c.onreadystatechange = function() {
|
|
265
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))) :
|
|
266
|
+
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.parse(c.responseText))) : a && a(c));
|
|
267
267
|
}, c.open("GET", t, !1), c.send();
|
|
268
268
|
}, I = {
|
|
269
269
|
"%d": {
|
|
@@ -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
|
|
319
|
+
return ct[s !== e ? s : r.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
|
|
331
|
+
return ht[s !== e ? s : r.MIN_DAY_OF_WEEK];
|
|
332
332
|
},
|
|
333
333
|
parse: function() {
|
|
334
334
|
return {};
|
|
@@ -340,7 +340,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
340
340
|
"%b": {
|
|
341
341
|
format: function(t) {
|
|
342
342
|
var s = r.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
343
|
-
return
|
|
343
|
+
return Mt[s !== e ? s : r.MIN_MONTH];
|
|
344
344
|
},
|
|
345
345
|
parse: function(t) {
|
|
346
346
|
var s = r.monthNames().indexOf(t) + (r.options("monthFromZero") ? 0 : 1);
|
|
@@ -415,10 +415,10 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
415
415
|
return i(t.year() || r.MIN_YEAR, 4) + "-" + i(t.month() || r.MIN_MONTH, 2) + "-" + i(t.day() || r.MIN_DAY, 2);
|
|
416
416
|
},
|
|
417
417
|
parse: function(t) {
|
|
418
|
-
var s = Number(t.slice(0, 4)),
|
|
418
|
+
var s = Number(t.slice(0, 4)), a = Number(t.slice(5, 7)), c = Number(t.slice(8, 10));
|
|
419
419
|
return {
|
|
420
420
|
year: s,
|
|
421
|
-
month:
|
|
421
|
+
month: a,
|
|
422
422
|
day: c
|
|
423
423
|
};
|
|
424
424
|
},
|
|
@@ -431,22 +431,22 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
431
431
|
return i(t.month() || r.MIN_MONTH, 2) + "/" + i(t.day() || r.MIN_DAY, 2) + "/" + i(t.year() || r.MIN_YEAR, 4);
|
|
432
432
|
},
|
|
433
433
|
parse: function(t) {
|
|
434
|
-
var s = Number(t.slice(0, 2)),
|
|
434
|
+
var s = Number(t.slice(0, 2)), a = Number(t.slice(3, 5)), c = Number(t.slice(6, 10));
|
|
435
435
|
return {
|
|
436
436
|
year: c,
|
|
437
437
|
month: s,
|
|
438
|
-
day:
|
|
438
|
+
day: a
|
|
439
439
|
};
|
|
440
440
|
},
|
|
441
441
|
minLength: 10,
|
|
442
442
|
maxLength: 10,
|
|
443
443
|
type: "string"
|
|
444
444
|
}
|
|
445
|
-
},
|
|
445
|
+
}, Lt = {
|
|
446
446
|
useMilliseconds: !1,
|
|
447
447
|
monthFromZero: !1
|
|
448
|
-
},
|
|
449
|
-
|
|
448
|
+
}, T;
|
|
449
|
+
T = function(t, s, a) {
|
|
450
450
|
return this._d = /* @__PURE__ */ new Date(), this._i = {
|
|
451
451
|
year: !1,
|
|
452
452
|
month: !1,
|
|
@@ -455,56 +455,56 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
455
455
|
minutes: !1,
|
|
456
456
|
seconds: !1,
|
|
457
457
|
milliseconds: !1
|
|
458
|
-
}, t !== e && this.set(t, s,
|
|
459
|
-
},
|
|
458
|
+
}, t !== e && this.set(t, s, a), this;
|
|
459
|
+
}, T.fn = T.prototype, T.fn.dayCount = function() {
|
|
460
460
|
var t = this.month(), s = r.MAX_DAY_IN_MONTHS[t - (r.options("monthFromZero") ? 0 : 1)];
|
|
461
461
|
return this.leapYear() && t === (r.options("monthFromZero") ? 1 : 2) && (s += 1), s;
|
|
462
|
-
},
|
|
462
|
+
}, T.fn.year = function(t) {
|
|
463
463
|
if (arguments.length !== 0)
|
|
464
464
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_YEAR && Number(t) <= r.MAX_YEAR ? (this._d.setFullYear(Number(t)), this._i.year = !1) : this._i.year = Number(t) : (this._d.setFullYear(r.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
|
-
},
|
|
468
|
+
}, T.fn.month = function(t) {
|
|
469
469
|
if (arguments.length !== 0)
|
|
470
470
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_MONTH && Number(t) <= r.MAX_MONTH ? (this._d.setMonth(r.options("monthFromZero") ? Number(t) : Number(t) - 1), this._i.month = !1) : this._i.month = Number(t) : (this._d.setMonth(r.options("monthFromZero") ? r.MIN_MONTH : r.MIN_MONTH - 1), this._i.month = !1);
|
|
471
471
|
else
|
|
472
472
|
return this._i.month === !1 ? r.options("monthFromZero") ? this._d.getMonth() : this._d.getMonth() + 1 : this._i.month;
|
|
473
473
|
return this;
|
|
474
|
-
},
|
|
474
|
+
}, T.fn.day = function(t) {
|
|
475
475
|
if (arguments.length !== 0)
|
|
476
476
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_DAY && Number(t) <= this.dayCount() ? (this._d.setDate(Number(t)), this._i.day = !1) : this._i.day = Number(t) : (this._d.setDate(r.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
|
-
},
|
|
480
|
+
}, T.fn.hours = function(t) {
|
|
481
481
|
if (arguments.length !== 0)
|
|
482
482
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_HOURS && Number(t) <= r.MAX_HOURS ? (this._d.setHours(Number(t)), this._i.hours = !1) : this._i.hours = Number(t) : (this._d.setHours(r.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
|
-
},
|
|
486
|
+
}, T.fn.minutes = function(t) {
|
|
487
487
|
if (arguments.length !== 0)
|
|
488
488
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_MINUTES && Number(t) <= r.MAX_MINUTES ? (this._d.setMinutes(Number(t)), this._i.minutes = !1) : this._i.minutes = Number(t) : (this._d.setMinutes(r.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
|
-
},
|
|
492
|
+
}, T.fn.seconds = function(t) {
|
|
493
493
|
if (arguments.length !== 0)
|
|
494
494
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_SECONDS && Number(t) <= r.MAX_SECONDS ? (this._d.setSeconds(Number(t)), this._i.seconds = !1) : this._i.seconds = Number(t) : (this._d.setSeconds(r.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
|
-
},
|
|
498
|
+
}, T.fn.milliseconds = function(t) {
|
|
499
499
|
if (arguments.length !== 0)
|
|
500
500
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_MILLISECONDS && Number(t) <= r.MAX_MILLISECONDS ? (this._d.setMilliseconds(Number(t)), this._i.milliseconds = !1) : this._i.milliseconds = Number(t) : (this._d.setMilliseconds(r.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
|
-
},
|
|
504
|
+
}, T.fn.week = function() {
|
|
505
505
|
var t = new Date(this.year(), 0, 1), s = r(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
|
|
506
506
|
return Math.ceil(((s - t.getTime()) / 864e5 + t.getDay() + 1) / 7);
|
|
507
|
-
},
|
|
507
|
+
}, T.fn.set = function(t, s, a) {
|
|
508
508
|
if (this._i = {
|
|
509
509
|
year: !1,
|
|
510
510
|
month: !1,
|
|
@@ -522,7 +522,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
522
522
|
if (typeof t == "object" && (t instanceof Array ? (this.day(r.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(r.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
523
|
var c, M = [], d, R, X = [], H = 0, D = 0, L, w, p = {}, b;
|
|
524
524
|
if (t === e)
|
|
525
|
-
return d =
|
|
525
|
+
return d = h(this, a), d === e && (this._i = {
|
|
526
526
|
year: -1,
|
|
527
527
|
month: -1,
|
|
528
528
|
day: -1,
|
|
@@ -549,7 +549,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
549
549
|
break;
|
|
550
550
|
}
|
|
551
551
|
if (L < I[R].minLength)
|
|
552
|
-
return d =
|
|
552
|
+
return d = h(this, a), d === e && (this._i = {
|
|
553
553
|
year: -1,
|
|
554
554
|
month: -1,
|
|
555
555
|
day: -1,
|
|
@@ -561,7 +561,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
561
561
|
M.push(R), X.push(w), L -= 1, D += L, H += 1;
|
|
562
562
|
}
|
|
563
563
|
} else if (t.charAt(D) !== s.charAt(H))
|
|
564
|
-
return d =
|
|
564
|
+
return d = h(this, a), d === e && (this._i = {
|
|
565
565
|
year: -1,
|
|
566
566
|
month: -1,
|
|
567
567
|
day: -1,
|
|
@@ -584,18 +584,18 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
584
584
|
this.day(r.MIN_DAY), this.year(p.year), this.month(p.month), this.day(p.day), this.hours(p.hours), this.minutes(p.minutes), this.seconds(p.seconds), this.milliseconds(p.milliseconds);
|
|
585
585
|
}
|
|
586
586
|
return this;
|
|
587
|
-
},
|
|
587
|
+
}, T.fn.leapYear = function() {
|
|
588
588
|
var t = this.year();
|
|
589
589
|
return t % 4 === 0 ? t % 100 === 0 ? t % 400 === 0 : !0 : !1;
|
|
590
|
-
},
|
|
590
|
+
}, T.fn.timestamp = function(t) {
|
|
591
591
|
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (r.options("useMilliseconds") ? 1 : 1e3) + this._d.getTimezoneOffset() * 6e4), this) : r.options("useMilliseconds") ? this._d.getTime() - this._d.getTimezoneOffset() * 6e4 : Math.floor(this._d.getTime() / 1e3) - this._d.getTimezoneOffset() * 60;
|
|
592
|
-
},
|
|
592
|
+
}, T.fn.utc = function(t) {
|
|
593
593
|
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (r.options("useMilliseconds") ? 1 : 1e3)), this) : r.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
|
|
594
|
-
},
|
|
594
|
+
}, T.fn.dayOfWeek = function(t) {
|
|
595
595
|
if (t === "long")
|
|
596
|
-
return at[this._d.getDay()];
|
|
597
|
-
if (t === "short")
|
|
598
596
|
return ht[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")
|
|
@@ -612,7 +612,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
612
612
|
return this.calc({ day: (this.dayOfWeek() === 0 ? -2 : 5) - this.dayOfWeek() });
|
|
613
613
|
if (t === 6 || t === "Saturday")
|
|
614
614
|
return this.calc({ day: (this.dayOfWeek() === 0 ? -1 : 6) - this.dayOfWeek() });
|
|
615
|
-
},
|
|
615
|
+
}, T.fn.timezone = function(t) {
|
|
616
616
|
switch (t) {
|
|
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`) : s(JSON.pars
|
|
|
621
621
|
default:
|
|
622
622
|
return this._d.getTimezoneOffset() * 60;
|
|
623
623
|
}
|
|
624
|
-
},
|
|
624
|
+
}, T.fn.get = function(t) {
|
|
625
625
|
switch (t) {
|
|
626
626
|
case "Date":
|
|
627
627
|
return new Date(
|
|
@@ -670,50 +670,50 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
670
670
|
timestamp: this.timestamp()
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
},
|
|
674
|
-
for (var s = 0,
|
|
675
|
-
t.charAt(s) === "%" ? (c = t.charAt(s) + t.charAt(s + 1), I[c] !== e ? (
|
|
676
|
-
return
|
|
677
|
-
},
|
|
673
|
+
}, T.fn.format = function(t) {
|
|
674
|
+
for (var s = 0, a = "", c; s < t.length; )
|
|
675
|
+
t.charAt(s) === "%" ? (c = t.charAt(s) + t.charAt(s + 1), I[c] !== e ? (a += I[c].format(this), s += 1) : a += "%") : a += t.charAt(s), s += 1;
|
|
676
|
+
return a;
|
|
677
|
+
}, T.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
|
+
}, T.fn.errors = function() {
|
|
680
680
|
return this._i;
|
|
681
|
-
},
|
|
682
|
-
var
|
|
681
|
+
}, T.fn.between = function(t, s) {
|
|
682
|
+
var a = this.timestamp(), c = t.timestamp();
|
|
683
683
|
switch (s) {
|
|
684
684
|
case "year":
|
|
685
|
-
return Math.floor((c -
|
|
685
|
+
return Math.floor((c - a) / 31556952);
|
|
686
686
|
case "month":
|
|
687
|
-
return Math.floor((c -
|
|
687
|
+
return Math.floor((c - a) / 2629746);
|
|
688
688
|
case "day":
|
|
689
|
-
return Math.floor((c -
|
|
689
|
+
return Math.floor((c - a) / 86400);
|
|
690
690
|
case "hours":
|
|
691
|
-
return Math.floor((c -
|
|
691
|
+
return Math.floor((c - a) / 3600);
|
|
692
692
|
case "minutes":
|
|
693
|
-
return Math.floor((c -
|
|
693
|
+
return Math.floor((c - a) / 60);
|
|
694
694
|
case "seconds":
|
|
695
|
-
return c -
|
|
695
|
+
return c - a;
|
|
696
696
|
default:
|
|
697
697
|
return e;
|
|
698
698
|
}
|
|
699
|
-
},
|
|
699
|
+
}, T.fn.calc = function(t) {
|
|
700
700
|
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;
|
|
701
|
-
}, r = function(t, s,
|
|
702
|
-
return new
|
|
701
|
+
}, r = function(t, s, a) {
|
|
702
|
+
return new T(t, s, a);
|
|
703
703
|
}, r.MIN_YEAR = 1e3, r.MAX_YEAR = 3e3, r.MIN_MONTH = 1, r.MAX_MONTH = 12, r.MIN_DAY = 1, r.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], r.MIN_DAY_OF_WEEK = 0, r.MAX_DAY_OF_WEEK = 6, r.MIN_HOURS = 0, r.MAX_HOURS = 23, r.MIN_MINUTES = 0, r.MAX_MINUTES = 59, r.MIN_SECONDS = 0, r.MAX_SECONDS = 59, r.MIN_MILLISECONDS = 0, r.MAX_MILLISECONDS = 999, r.VERSION = "0.2.18", r.options = function(t, s) {
|
|
704
704
|
if (t === e)
|
|
705
|
-
return
|
|
706
|
-
if (
|
|
705
|
+
return Lt;
|
|
706
|
+
if (Lt.hasOwnProperty(t)) {
|
|
707
707
|
if (s === e)
|
|
708
|
-
return
|
|
709
|
-
|
|
708
|
+
return Lt[t];
|
|
709
|
+
Lt[t] = s, t === "monthFromZero" && (r.MIN_MONTH = s ? 0 : 1, r.MAX_MONTH = s ? 11 : 12);
|
|
710
710
|
}
|
|
711
711
|
return e;
|
|
712
712
|
}, r.noConflict = function() {
|
|
713
|
-
return n.tempus =
|
|
713
|
+
return n.tempus = u, r;
|
|
714
714
|
}, r.generate = function(t) {
|
|
715
|
-
var s,
|
|
716
|
-
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof
|
|
715
|
+
var s, a, c, M, d, R, X, H;
|
|
716
|
+
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof T ? s = t.dateFrom.utc() : s = r(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof T ? a = t.dateTo.utc() : a = r(t.dateTo, t.formatTo !== e ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? d = {
|
|
717
717
|
year: 0,
|
|
718
718
|
month: 0,
|
|
719
719
|
day: 0,
|
|
@@ -754,10 +754,10 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
754
754
|
H(R[R.length - 1], c, !0), c = r(c).calc(d).utc();
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
for (; s <=
|
|
757
|
+
for (; s <= a; )
|
|
758
758
|
t.groupBy === e ? H(R, s) : r(s).get()[t.groupBy] === X ? H(R[R.length - 1], s) : (R.push([]), H(R[R.length - 1], s), X = r(s).get()[t.groupBy]), s = r(s).calc(d).utc();
|
|
759
759
|
if (t.groupBy !== e && t.fillNulls)
|
|
760
|
-
for (M = r(
|
|
760
|
+
for (M = r(a).calc(d).utc(); r(M).get()[t.groupBy] === X; )
|
|
761
761
|
H(R[R.length - 1], M, !0), M = r(M).calc(d).utc();
|
|
762
762
|
return R;
|
|
763
763
|
}, r.monthNames = function(t) {
|
|
@@ -765,27 +765,27 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
765
765
|
case "long":
|
|
766
766
|
return P;
|
|
767
767
|
default:
|
|
768
|
-
return
|
|
768
|
+
return Mt;
|
|
769
769
|
}
|
|
770
770
|
}, r.dayNames = function(t) {
|
|
771
771
|
switch (t) {
|
|
772
772
|
case "long":
|
|
773
|
-
return at;
|
|
774
|
-
default:
|
|
775
773
|
return ht;
|
|
774
|
+
default:
|
|
775
|
+
return ct;
|
|
776
776
|
}
|
|
777
777
|
}, r.lang = function(t) {
|
|
778
778
|
if (t !== e)
|
|
779
|
-
|
|
779
|
+
m = t, f[m] === e && (m = "en"), P = G(), Mt = at(), ht = V(), ct = J();
|
|
780
780
|
else
|
|
781
|
-
return
|
|
781
|
+
return m;
|
|
782
782
|
return e;
|
|
783
783
|
}, r.availableLangs = function() {
|
|
784
784
|
return Object.keys(f);
|
|
785
|
-
}, r.registerFormat = function(t, s,
|
|
785
|
+
}, r.registerFormat = function(t, s, a, c, M, d) {
|
|
786
786
|
I[t] = {
|
|
787
787
|
format: s,
|
|
788
|
-
parse:
|
|
788
|
+
parse: a,
|
|
789
789
|
minLength: c,
|
|
790
790
|
maxLength: M,
|
|
791
791
|
type: d
|
|
@@ -793,258 +793,258 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
793
793
|
}, r.unregisterFormat = function(t) {
|
|
794
794
|
delete I[t];
|
|
795
795
|
}, r.detectFormat = function(t) {
|
|
796
|
-
var s,
|
|
797
|
-
return s =
|
|
798
|
-
},
|
|
799
|
-
TempusDate:
|
|
796
|
+
var s, a, c;
|
|
797
|
+
return s = O(t, 0), s !== "" && (c = 10), a = t.charAt(c), (a === "T" || a === " ") && (s += a, c += 1), s += l(t, c), s;
|
|
798
|
+
}, g = {
|
|
799
|
+
TempusDate: T
|
|
800
800
|
}, r.classes = function(t, s) {
|
|
801
801
|
if (s === e)
|
|
802
|
-
return
|
|
803
|
-
|
|
802
|
+
return g[t];
|
|
803
|
+
g[t] = s;
|
|
804
804
|
}, r.loadTranslations = function(t) {
|
|
805
|
-
typeof t == "object" ? f = t : typeof t == "string" &&
|
|
805
|
+
typeof t == "object" ? f = t : typeof t == "string" && ue(t, function(s) {
|
|
806
806
|
f = s;
|
|
807
807
|
}, function(s) {
|
|
808
808
|
});
|
|
809
|
-
},
|
|
810
|
-
}).call(
|
|
811
|
-
})(
|
|
812
|
-
var
|
|
813
|
-
const
|
|
814
|
-
var
|
|
809
|
+
}, m = (S.language || S.systemLanguage || S.userLanguage || "en").substr(0, 2).toLowerCase(), f[m] === e && (m = "en"), P = G(), Mt = at(), ht = V(), ct = J(), y.exports && (A = y.exports = r), A.tempus = r;
|
|
810
|
+
}).call(Ne);
|
|
811
|
+
})(xt, xt.exports);
|
|
812
|
+
var Oe = xt.exports;
|
|
813
|
+
const bt = /* @__PURE__ */ _e(Oe);
|
|
814
|
+
var z, ut, K, Y, k, q, v, B, j, Bt, $, F, tt, et, it, Ht, mt, jt, ft, Qt, Nt, Zt, _t, Vt, Ot, zt, It, Ae, Ut, se, yt, Kt, dt, qt, Et, vt, nt, Dt, gt, $t, Gt, re, At, lt, ot, Yt, Tt, te;
|
|
815
815
|
class x {
|
|
816
816
|
constructor(A, e = {}) {
|
|
817
|
-
N(this,
|
|
818
|
-
N(this, ut);
|
|
817
|
+
N(this, it);
|
|
819
818
|
N(this, mt);
|
|
820
819
|
N(this, ft);
|
|
821
820
|
N(this, Nt);
|
|
822
821
|
N(this, _t);
|
|
823
|
-
N(this, Bt);
|
|
824
|
-
N(this, It);
|
|
825
822
|
N(this, Ot);
|
|
823
|
+
N(this, It);
|
|
824
|
+
N(this, Ut);
|
|
826
825
|
N(this, yt);
|
|
827
826
|
N(this, dt);
|
|
828
|
-
N(this, it);
|
|
829
827
|
N(this, Et);
|
|
830
|
-
N(this, Ut);
|
|
831
|
-
N(this, et);
|
|
832
828
|
N(this, nt);
|
|
833
829
|
N(this, gt);
|
|
834
|
-
N(this,
|
|
835
|
-
N(this,
|
|
836
|
-
N(this,
|
|
830
|
+
N(this, Gt);
|
|
831
|
+
N(this, At);
|
|
832
|
+
N(this, ot);
|
|
833
|
+
N(this, Tt);
|
|
834
|
+
N(this, z, null);
|
|
835
|
+
N(this, ut, null);
|
|
836
|
+
N(this, K, []);
|
|
837
837
|
N(this, Y, {});
|
|
838
838
|
N(this, k, 50);
|
|
839
|
-
N(this,
|
|
840
|
-
N(this,
|
|
839
|
+
N(this, q, !0);
|
|
840
|
+
N(this, v, null);
|
|
841
841
|
N(this, B, null);
|
|
842
842
|
N(this, j, null);
|
|
843
|
-
N(this,
|
|
844
|
-
N(this,
|
|
843
|
+
N(this, Bt, 100);
|
|
844
|
+
N(this, $, "no");
|
|
845
845
|
N(this, F, !1);
|
|
846
|
-
N(this, $, !1);
|
|
847
846
|
N(this, tt, !1);
|
|
847
|
+
N(this, et, !1);
|
|
848
848
|
C(this, "errors", {});
|
|
849
849
|
C(this, "answerData", {});
|
|
850
|
-
|
|
850
|
+
E(this, z, A), E(this, ut, e);
|
|
851
851
|
}
|
|
852
852
|
get serial() {
|
|
853
|
-
return
|
|
853
|
+
return o(this, F);
|
|
854
854
|
}
|
|
855
855
|
setSerial() {
|
|
856
|
-
|
|
856
|
+
E(this, F, !0), E(this, tt, !0), E(this, et, !1);
|
|
857
857
|
}
|
|
858
858
|
setParallel() {
|
|
859
|
-
|
|
859
|
+
E(this, F, !1), E(this, tt, !1), E(this, et, !0);
|
|
860
860
|
}
|
|
861
861
|
stop() {
|
|
862
|
-
|
|
862
|
+
E(this, q, !1);
|
|
863
863
|
}
|
|
864
864
|
async batch(A, e) {
|
|
865
|
-
|
|
866
|
-
const n =
|
|
865
|
+
o(this, j) && _(this, mt, jt).call(this), e && E(this, v, e), o(this, tt) === !1 && E(this, F, !1), Object.keys(A).length > 500 && E(this, F, !0), E(this, q, !0), E(this, K, []), E(this, Y, {}), this.errors = {}, this.answerData = {};
|
|
866
|
+
const n = _(this, Nt, Zt).call(this, A);
|
|
867
867
|
if (Object.keys(A).length < 500) {
|
|
868
|
-
const i = n.map((
|
|
869
|
-
return Promise.allSettled(i).then((
|
|
868
|
+
const i = n.map((h, l) => _(this, _t, Vt).call(this, h, n[l]));
|
|
869
|
+
return Promise.allSettled(i).then((h) => {
|
|
870
870
|
let l = {};
|
|
871
|
-
for (let
|
|
872
|
-
|
|
871
|
+
for (let O of h)
|
|
872
|
+
O.status === "fulfilled" && (l = { ...l, ...O.value });
|
|
873
873
|
return l;
|
|
874
874
|
});
|
|
875
875
|
} else {
|
|
876
|
-
let i = {},
|
|
877
|
-
|
|
876
|
+
let i = {}, h = 0, l = 1, O = Object.keys(A).length || 1, u = (r) => {
|
|
877
|
+
h += Object.keys(r).length, l = Math.round(h / O * 100);
|
|
878
878
|
};
|
|
879
|
-
for (let [r,
|
|
880
|
-
let S = await
|
|
881
|
-
|
|
879
|
+
for (let [r, g] of Object.entries(n)) {
|
|
880
|
+
let S = await _(this, _t, Vt).call(this, g, n[r], !0);
|
|
881
|
+
u(g), e && e({ percent: l }), i = { ...i, ...S };
|
|
882
882
|
}
|
|
883
883
|
return i;
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
async batchTotalCount(A, e) {
|
|
887
|
-
|
|
888
|
-
let n = 1, i = 0,
|
|
889
|
-
i += Object.keys(
|
|
887
|
+
E(this, Y, {}), this.errors = {};
|
|
888
|
+
let n = 1, i = 0, h = Object.keys(A).length || 1, l = (u) => {
|
|
889
|
+
i += Object.keys(u).length, n = Math.round(i / h * 100);
|
|
890
890
|
};
|
|
891
891
|
e && e({ percent: n });
|
|
892
|
-
const
|
|
893
|
-
if (
|
|
894
|
-
const
|
|
895
|
-
return Promise.allSettled(
|
|
896
|
-
let
|
|
892
|
+
const O = _(this, Nt, Zt).call(this, A);
|
|
893
|
+
if (o(this, et)) {
|
|
894
|
+
const u = O.map((r) => _(this, Ot, zt).call(this, r).then((g) => (l(r), e && e({ percent: n }), g)));
|
|
895
|
+
return Promise.allSettled(u).then((r) => {
|
|
896
|
+
let g = {};
|
|
897
897
|
for (let S of r)
|
|
898
|
-
S.status === "fulfilled" && (
|
|
899
|
-
return
|
|
898
|
+
S.status === "fulfilled" && (g = { ...g, ...S.value });
|
|
899
|
+
return g;
|
|
900
900
|
});
|
|
901
901
|
} else {
|
|
902
|
-
let
|
|
903
|
-
for (let r of
|
|
904
|
-
let
|
|
905
|
-
l(r), e && e({ percent: n }),
|
|
902
|
+
let u = {};
|
|
903
|
+
for (let r of O) {
|
|
904
|
+
let g = await _(this, Ot, zt).call(this, r);
|
|
905
|
+
l(r), e && e({ percent: n }), u = { ...u, ...g };
|
|
906
906
|
}
|
|
907
|
-
return
|
|
907
|
+
return u;
|
|
908
908
|
}
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
|
-
|
|
911
|
+
z = new WeakMap(), ut = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), k = new WeakMap(), q = new WeakMap(), v = new WeakMap(), B = new WeakMap(), j = new WeakMap(), Bt = new WeakMap(), $ = new WeakMap(), F = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), it = new WeakSet(), Ht = function() {
|
|
912
912
|
let A = 0;
|
|
913
|
-
if (!
|
|
913
|
+
if (!o(this, B))
|
|
914
914
|
return Math.round(A);
|
|
915
915
|
let e = 0, n = 0;
|
|
916
|
-
return Object.values(
|
|
917
|
-
const { total:
|
|
918
|
-
e +=
|
|
916
|
+
return Object.values(o(this, B)).forEach((i) => {
|
|
917
|
+
const { total: h, count: l } = i;
|
|
918
|
+
e += h ?? 0, n += l ?? 0;
|
|
919
919
|
}), e ? A = n / e * 100 : A = 100, { percent: Math.round(A), allCount: n, allTotal: e };
|
|
920
|
-
},
|
|
921
|
-
clearInterval(
|
|
922
|
-
},
|
|
923
|
-
const n =
|
|
920
|
+
}, mt = new WeakSet(), jt = function() {
|
|
921
|
+
clearInterval(o(this, j)), E(this, j, ""), E(this, B, ""), E(this, v, ""), E(this, $, "no");
|
|
922
|
+
}, ft = new WeakSet(), Qt = function({ key: A, value: e }) {
|
|
923
|
+
const n = _(this, At, lt).call(this, e.data()), i = Array.isArray(n) ? n.length : 0, h = _(this, ot, Yt).call(this, e.total(), i);
|
|
924
924
|
let l = 1;
|
|
925
|
-
n && (l = i),
|
|
926
|
-
const { percent:
|
|
927
|
-
(
|
|
928
|
-
data:
|
|
929
|
-
percent:
|
|
930
|
-
allCount:
|
|
925
|
+
n && (l = i), o(this, v) && (o(this, B) || E(this, B, {}), o(this, B)[A] && o(this, B)[A].count && (l += o(this, B)[A].count), o(this, B)[A] = { total: h, count: l }, o(this, j) || E(this, j, setInterval(() => {
|
|
926
|
+
const { percent: O, allCount: u, allTotal: r } = o(this, it, Ht);
|
|
927
|
+
(o(this, $) === "no" || o(this, $) < o(this, it, Ht).percent) && (o(this, v).call(this, {
|
|
928
|
+
data: o(this, B),
|
|
929
|
+
percent: O,
|
|
930
|
+
allCount: u,
|
|
931
931
|
allTotal: r
|
|
932
|
-
}),
|
|
933
|
-
},
|
|
934
|
-
},
|
|
932
|
+
}), E(this, $, o(this, it, Ht).percent)), O === 100 && _(this, mt, jt).call(this);
|
|
933
|
+
}, o(this, Bt))));
|
|
934
|
+
}, Nt = new WeakSet(), Zt = function(A) {
|
|
935
935
|
const e = [], n = Object.entries(A);
|
|
936
|
-
for (let i = 0; i < n.length; i +=
|
|
937
|
-
const
|
|
938
|
-
e.push(Object.fromEntries(
|
|
936
|
+
for (let i = 0; i < n.length; i += o(this, k)) {
|
|
937
|
+
const h = n.slice(i, i + o(this, k));
|
|
938
|
+
e.push(Object.fromEntries(h));
|
|
939
939
|
}
|
|
940
940
|
return e;
|
|
941
|
-
},
|
|
941
|
+
}, _t = new WeakSet(), Vt = function(A, e, n) {
|
|
942
942
|
return new Promise((i) => {
|
|
943
|
-
const
|
|
944
|
-
let
|
|
945
|
-
|
|
946
|
-
Object.entries(r).forEach(([
|
|
947
|
-
let
|
|
943
|
+
const h = _(this, gt, $t).call(this, e), l = [];
|
|
944
|
+
let O = 0, u = 0;
|
|
945
|
+
o(this, z).call(this, A, (r) => {
|
|
946
|
+
Object.entries(r).forEach(([g, S]) => {
|
|
947
|
+
let m = {};
|
|
948
948
|
const f = S.error();
|
|
949
949
|
if (f) {
|
|
950
950
|
let { query: { method: J }, answer: P } = S;
|
|
951
|
-
this.errors[
|
|
951
|
+
this.errors[g] = { error: f, method: J }, O += 1;
|
|
952
952
|
}
|
|
953
953
|
if (S != null && S.answer && Object.keys(S.answer).length) {
|
|
954
954
|
for (let [J, P] of Object.entries(S.answer))
|
|
955
|
-
J != "result" && P && (
|
|
956
|
-
Object.keys(
|
|
955
|
+
J != "result" && P && (m[J] = P);
|
|
956
|
+
Object.keys(m).length && (this.answerData[g] = m);
|
|
957
957
|
}
|
|
958
|
-
const G =
|
|
959
|
-
if (Array.isArray(G) ?
|
|
960
|
-
const J = Math.ceil(
|
|
961
|
-
l.push([
|
|
958
|
+
const G = _(this, At, lt).call(this, S.data()), at = Array.isArray(G) ? G.length : 0, V = _(this, ot, Yt).call(this, S.total(), at);
|
|
959
|
+
if (Array.isArray(G) ? o(this, Y)[g] = G : typeof G == "object" && G !== null && Object.keys(G).length === 0 ? o(this, Y)[g] = [] : o(this, Y)[g] = G, u += V, n || _(this, ft, Qt).call(this, { key: g, value: S }), V > o(this, k) && V > at) {
|
|
960
|
+
const J = Math.ceil(V / o(this, k)) - 1, P = Array.from({ length: J });
|
|
961
|
+
l.push([g, h[g], P]);
|
|
962
962
|
}
|
|
963
|
-
}),
|
|
963
|
+
}), u > 5e3 && o(this, tt) === !1 && o(this, et) === !1 && E(this, F, !0), O > 0 && _(this, Tt, te).call(this), l.length ? (_(this, It, Ae).call(this, l), _(this, Ut, se).call(this).then(() => i(_(this, nt, Dt).call(this)))) : i(_(this, nt, Dt).call(this));
|
|
964
964
|
});
|
|
965
965
|
});
|
|
966
|
-
},
|
|
966
|
+
}, Ot = new WeakSet(), zt = function(A) {
|
|
967
967
|
return new Promise((e) => {
|
|
968
|
-
const n =
|
|
968
|
+
const n = _(this, gt, $t).call(this, A);
|
|
969
969
|
let i = 0;
|
|
970
|
-
|
|
971
|
-
Object.entries(
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
const r =
|
|
975
|
-
|
|
976
|
-
}), i > 0 &&
|
|
970
|
+
o(this, z).call(this, n, (h) => {
|
|
971
|
+
Object.entries(h).forEach(([l, O]) => {
|
|
972
|
+
const u = O.error();
|
|
973
|
+
u && (this.errors[l] = u, i += 1);
|
|
974
|
+
const r = _(this, At, lt).call(this, O.data()), g = Array.isArray(r) ? r.length : 0, S = _(this, ot, Yt).call(this, O.total(), g);
|
|
975
|
+
o(this, Y)[l] = S;
|
|
976
|
+
}), i > 0 && _(this, Tt, te).call(this), e(_(this, nt, Dt).call(this));
|
|
977
977
|
});
|
|
978
978
|
});
|
|
979
|
-
},
|
|
979
|
+
}, It = new WeakSet(), Ae = function(A) {
|
|
980
980
|
let e = [];
|
|
981
|
-
A.forEach(([n, i,
|
|
982
|
-
|
|
983
|
-
const
|
|
984
|
-
e.length ===
|
|
981
|
+
A.forEach(([n, i, h]) => {
|
|
982
|
+
h.forEach((l, O) => {
|
|
983
|
+
const u = O + 1, r = o(this, k) * u, S = [[n, u].join("_"), _(this, Gt, re).call(this, i, r)];
|
|
984
|
+
e.length === o(this, k) ? (o(this, K).push(e), e = [S]) : e.push(S);
|
|
985
985
|
});
|
|
986
|
-
}), e.length &&
|
|
987
|
-
},
|
|
986
|
+
}), e.length && o(this, K).push(e);
|
|
987
|
+
}, Ut = new WeakSet(), se = function() {
|
|
988
988
|
const A = [], e = [], n = (i) => {
|
|
989
|
-
Object.entries(i).forEach(([
|
|
990
|
-
const [
|
|
991
|
-
Array.isArray(
|
|
989
|
+
Object.entries(i).forEach(([h, l]) => {
|
|
990
|
+
const [O] = h.split("_"), u = _(this, At, lt).call(this, l.data());
|
|
991
|
+
Array.isArray(u) && o(this, Y)[O].push(...u), _(this, ft, Qt).call(this, { key: O, value: l });
|
|
992
992
|
});
|
|
993
993
|
};
|
|
994
|
-
return
|
|
995
|
-
const l = Object.fromEntries(i),
|
|
996
|
-
|
|
994
|
+
return o(this, K).forEach((i, h) => {
|
|
995
|
+
const l = Object.fromEntries(i), O = () => new Promise((u) => o(this, z).call(this, l, (r) => {
|
|
996
|
+
o(this, F) ? n(r) : e[h] = r, u();
|
|
997
997
|
}));
|
|
998
|
-
A.push(
|
|
999
|
-
}),
|
|
998
|
+
A.push(O);
|
|
999
|
+
}), o(this, F) ? _(this, dt, qt).call(this, A) : _(this, Et, vt).call(this, A).then(() => {
|
|
1000
1000
|
e.forEach(n);
|
|
1001
1001
|
});
|
|
1002
|
-
},
|
|
1002
|
+
}, yt = new WeakSet(), Kt = function() {
|
|
1003
1003
|
return new Promise((A) => setTimeout(A, 500));
|
|
1004
|
-
},
|
|
1004
|
+
}, dt = new WeakSet(), qt = function(A) {
|
|
1005
1005
|
if (!A.length)
|
|
1006
1006
|
return Promise.resolve();
|
|
1007
1007
|
const e = A.shift();
|
|
1008
1008
|
return Promise.allSettled([
|
|
1009
1009
|
e(),
|
|
1010
|
-
|
|
1011
|
-
]).then(() =>
|
|
1012
|
-
},
|
|
1010
|
+
_(this, yt, Kt).call(this)
|
|
1011
|
+
]).then(() => o(this, q) ? _(this, dt, qt).call(this, A) : Promise.resolve());
|
|
1012
|
+
}, Et = new WeakSet(), vt = function(A) {
|
|
1013
1013
|
if (!A.length)
|
|
1014
1014
|
return Promise.resolve();
|
|
1015
1015
|
const e = A.shift();
|
|
1016
|
-
return
|
|
1017
|
-
},
|
|
1018
|
-
return Object.entries(
|
|
1019
|
-
|
|
1020
|
-
}),
|
|
1021
|
-
},
|
|
1016
|
+
return _(this, yt, Kt).call(this).then(() => e()).then(() => o(this, q) ? _(this, Et, vt).call(this, A) : Promise.resolve());
|
|
1017
|
+
}, nt = new WeakSet(), Dt = function() {
|
|
1018
|
+
return Object.entries(o(this, ut)).forEach(([A, e]) => {
|
|
1019
|
+
o(this, Y)[A] && (o(this, Y)[A] = e(o(this, Y)[A]));
|
|
1020
|
+
}), o(this, Y);
|
|
1021
|
+
}, gt = new WeakSet(), $t = function(A) {
|
|
1022
1022
|
return Object.entries(A).reduce((e, [n, i]) => {
|
|
1023
1023
|
if (Array.isArray(i)) {
|
|
1024
|
-
const [
|
|
1025
|
-
e[n] = [
|
|
1024
|
+
const [h, l = {}] = i;
|
|
1025
|
+
e[n] = [h, l];
|
|
1026
1026
|
} else {
|
|
1027
|
-
const { method:
|
|
1028
|
-
e[n] = [
|
|
1027
|
+
const { method: h, params: l = {} } = i;
|
|
1028
|
+
e[n] = [h, l];
|
|
1029
1029
|
}
|
|
1030
1030
|
return e;
|
|
1031
1031
|
}, {});
|
|
1032
|
-
},
|
|
1032
|
+
}, Gt = new WeakSet(), re = function(A, e) {
|
|
1033
1033
|
const [n, i] = A;
|
|
1034
1034
|
return [n, { start: e, ...i }];
|
|
1035
|
-
},
|
|
1035
|
+
}, At = new WeakSet(), lt = function(A) {
|
|
1036
1036
|
return ((A == null ? void 0 : A.items) || (A == null ? void 0 : A.documents)) ?? A;
|
|
1037
|
-
},
|
|
1037
|
+
}, ot = new WeakSet(), Yt = function(A, e) {
|
|
1038
1038
|
return A !== A && (A = 0), A === 0 && e === 0 ? 0 : A || e;
|
|
1039
|
-
},
|
|
1039
|
+
}, Tt = new WeakSet(), te = function() {
|
|
1040
1040
|
console.group(`${this.constructor.name}: Ошибки в методах!`), Object.entries(this.errors).forEach(([A, e]) => {
|
|
1041
1041
|
console.info(`[${A}]`, e.toString());
|
|
1042
1042
|
}), console.groupEnd();
|
|
1043
1043
|
};
|
|
1044
|
-
var
|
|
1045
|
-
class
|
|
1044
|
+
var st;
|
|
1045
|
+
class ie {
|
|
1046
1046
|
constructor() {
|
|
1047
|
-
N(this,
|
|
1047
|
+
N(this, st, {});
|
|
1048
1048
|
}
|
|
1049
1049
|
get hash() {
|
|
1050
1050
|
return this.createHash(8);
|
|
@@ -1059,7 +1059,7 @@ class re {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
/** Фильтр часто запускаемых действий */
|
|
1061
1061
|
actionFilter({ keyTimer: A, duration: e = 10, action: n }) {
|
|
1062
|
-
|
|
1062
|
+
o(this, st)[A] && (clearTimeout(o(this, st)[A]), o(this, st)[A] = null), n && (o(this, st)[A] = setTimeout(() => {
|
|
1063
1063
|
n();
|
|
1064
1064
|
}, e));
|
|
1065
1065
|
}
|
|
@@ -1078,33 +1078,34 @@ class re {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
/** Скачать данные в JSON-файл */
|
|
1080
1080
|
downloadFileJson(A, e) {
|
|
1081
|
-
let n = new Blob([JSON.stringify(A)], { type: "application/json" }), i = URL.createObjectURL(n),
|
|
1082
|
-
|
|
1083
|
-
document.body.removeChild(
|
|
1081
|
+
let n = new Blob([JSON.stringify(A)], { type: "application/json" }), i = URL.createObjectURL(n), h = document.createElement("a");
|
|
1082
|
+
h.style.display = "none", h.href = i, h.download = `${e}.json`, document.body.appendChild(h), h.click(), setTimeout(() => {
|
|
1083
|
+
document.body.removeChild(h), URL.revokeObjectURL(i);
|
|
1084
1084
|
}, 200);
|
|
1085
1085
|
}
|
|
1086
1086
|
}
|
|
1087
|
-
|
|
1088
|
-
const
|
|
1089
|
-
var W, Q,
|
|
1090
|
-
class
|
|
1087
|
+
st = new WeakMap();
|
|
1088
|
+
const pt = new ie();
|
|
1089
|
+
var W, Q, wt, rt, Rt, Z, Ct, ne, St, ee, Ft, oe, Pt, ae, Wt, he;
|
|
1090
|
+
class ye {
|
|
1091
1091
|
constructor() {
|
|
1092
|
-
N(this,
|
|
1092
|
+
N(this, Ct);
|
|
1093
1093
|
/** Вывод ошибок логера
|
|
1094
1094
|
* @param {'entity'} type - тип ошибки
|
|
1095
1095
|
*/
|
|
1096
|
-
N(this,
|
|
1097
|
-
N(this, Ct);
|
|
1096
|
+
N(this, St);
|
|
1098
1097
|
N(this, Ft);
|
|
1099
1098
|
N(this, Pt);
|
|
1099
|
+
N(this, Wt);
|
|
1100
1100
|
N(this, W, "logger");
|
|
1101
1101
|
N(this, Q, !1);
|
|
1102
|
-
N(this,
|
|
1103
|
-
N(this,
|
|
1104
|
-
N(this,
|
|
1102
|
+
N(this, wt, 2e3);
|
|
1103
|
+
N(this, rt, /* @__PURE__ */ new Map());
|
|
1104
|
+
N(this, Rt, {});
|
|
1105
|
+
N(this, Z, null);
|
|
1105
1106
|
/** Очистка хранилища элементов старше 'N' месяцев */
|
|
1106
1107
|
C(this, "periodClear", 3);
|
|
1107
|
-
|
|
1108
|
+
_(this, Ct, ne).call(this);
|
|
1108
1109
|
}
|
|
1109
1110
|
/** Инициализация логера */
|
|
1110
1111
|
async init() {
|
|
@@ -1112,22 +1113,22 @@ class Oe {
|
|
|
1112
1113
|
entityList: { method: "entity.get" }
|
|
1113
1114
|
});
|
|
1114
1115
|
if (e != null && e.length)
|
|
1115
|
-
if (e.find((i) => i.ENTITY ==
|
|
1116
|
-
|
|
1116
|
+
if (e.find((i) => i.ENTITY == o(this, W)))
|
|
1117
|
+
E(this, Q, !0);
|
|
1117
1118
|
else {
|
|
1118
1119
|
let { entityAdd: i } = await A.batch({
|
|
1119
1120
|
entityAdd: {
|
|
1120
1121
|
method: "entity.add",
|
|
1121
1122
|
params: {
|
|
1122
|
-
ENTITY:
|
|
1123
|
-
NAME:
|
|
1123
|
+
ENTITY: o(this, W),
|
|
1124
|
+
NAME: o(this, W),
|
|
1124
1125
|
ACCESS: { AU: "X" }
|
|
1125
1126
|
}
|
|
1126
1127
|
}
|
|
1127
1128
|
});
|
|
1128
|
-
i &&
|
|
1129
|
+
i && E(this, Q, !0);
|
|
1129
1130
|
}
|
|
1130
|
-
return
|
|
1131
|
+
return _(this, Pt, ae).call(this), o(this, Q);
|
|
1131
1132
|
}
|
|
1132
1133
|
/**
|
|
1133
1134
|
* @param {{ type: 'call'|'batch'|'batch-total-count';
|
|
@@ -1139,15 +1140,15 @@ class Oe {
|
|
|
1139
1140
|
* @returns {string}
|
|
1140
1141
|
*/
|
|
1141
1142
|
start({ type: A, data: e }) {
|
|
1142
|
-
if (!
|
|
1143
|
-
|
|
1143
|
+
if (!o(this, Q)) {
|
|
1144
|
+
_(this, St, ee).call(this, "entity");
|
|
1144
1145
|
return;
|
|
1145
1146
|
}
|
|
1146
|
-
const n =
|
|
1147
|
-
return
|
|
1147
|
+
const n = pt.hash;
|
|
1148
|
+
return o(this, rt).set(n, {
|
|
1148
1149
|
type: A,
|
|
1149
1150
|
data: e,
|
|
1150
|
-
userInfo:
|
|
1151
|
+
userInfo: o(this, Rt),
|
|
1151
1152
|
errorList: [],
|
|
1152
1153
|
status: "",
|
|
1153
1154
|
answer: null,
|
|
@@ -1162,16 +1163,16 @@ class Oe {
|
|
|
1162
1163
|
* answer: { [key]: unknown } }}
|
|
1163
1164
|
*/
|
|
1164
1165
|
stop({ key: A, errorList: e, status: n, answer: i }) {
|
|
1165
|
-
if (!
|
|
1166
|
-
|
|
1166
|
+
if (!o(this, Q)) {
|
|
1167
|
+
_(this, St, ee).call(this, "entity");
|
|
1167
1168
|
return;
|
|
1168
1169
|
}
|
|
1169
|
-
let
|
|
1170
|
-
e && (
|
|
1170
|
+
let h = o(this, rt).get(A);
|
|
1171
|
+
e && (h.errorList = e), n && (h.status = n), i && (h.answer = i), pt.actionFilter({
|
|
1171
1172
|
keyTimer: "add.entity.items",
|
|
1172
|
-
duration:
|
|
1173
|
+
duration: o(this, wt),
|
|
1173
1174
|
action: () => {
|
|
1174
|
-
|
|
1175
|
+
_(this, Ft, oe).call(this);
|
|
1175
1176
|
}
|
|
1176
1177
|
});
|
|
1177
1178
|
}
|
|
@@ -1179,88 +1180,93 @@ class Oe {
|
|
|
1179
1180
|
* @param { ({percent}:{percent:number})=>{} } progressCall - коллбэк
|
|
1180
1181
|
*/
|
|
1181
1182
|
async getEntityList(A) {
|
|
1183
|
+
var i;
|
|
1184
|
+
if ((i = o(this, Z)) != null && i.length)
|
|
1185
|
+
return o(this, Z);
|
|
1182
1186
|
let e = new x(BX24.callBatch), { entityList: n } = await e.batch({
|
|
1183
1187
|
entityList: {
|
|
1184
1188
|
method: "entity.item.get",
|
|
1185
1189
|
params: {
|
|
1186
|
-
ENTITY:
|
|
1190
|
+
ENTITY: o(this, W),
|
|
1187
1191
|
SORT: { ID: "DESC" }
|
|
1188
1192
|
}
|
|
1189
1193
|
}
|
|
1190
1194
|
}, A);
|
|
1191
|
-
return n = n.map((
|
|
1192
|
-
const { ID:
|
|
1195
|
+
return n = n.map((h) => {
|
|
1196
|
+
const { ID: l, DATE_CREATE: O, DETAIL_TEXT: u } = h;
|
|
1193
1197
|
return {
|
|
1194
|
-
...JSON.parse(
|
|
1195
|
-
id:
|
|
1196
|
-
dateCreate:
|
|
1198
|
+
...JSON.parse(u),
|
|
1199
|
+
id: l,
|
|
1200
|
+
dateCreate: O
|
|
1197
1201
|
};
|
|
1198
1202
|
}), n;
|
|
1199
1203
|
}
|
|
1200
1204
|
/** Выгрузка всех данных из хранилища в JSON-файл */
|
|
1201
1205
|
async downAllEntityJson() {
|
|
1202
|
-
let A = await this.getEntityList(), e =
|
|
1203
|
-
|
|
1206
|
+
let A = await this.getEntityList(), e = bt().format("%Y-%m-%d");
|
|
1207
|
+
pt.downloadFileJson(A, `sdklogger-entity-data__${e}`);
|
|
1204
1208
|
}
|
|
1205
1209
|
}
|
|
1206
|
-
W = new WeakMap(), Q = new WeakMap(),
|
|
1210
|
+
W = new WeakMap(), Q = new WeakMap(), wt = new WeakMap(), rt = new WeakMap(), Rt = new WeakMap(), Z = new WeakMap(), Ct = new WeakSet(), ne = async function() {
|
|
1207
1211
|
const A = new x(BX24.callBatch), e = BX24.isAdmin(), { curUser: n } = await A.batch({
|
|
1208
1212
|
curUser: { method: "user.current" }
|
|
1209
1213
|
});
|
|
1210
|
-
|
|
1211
|
-
},
|
|
1212
|
-
A == "entity" &&
|
|
1214
|
+
E(this, Rt, { isAdmin: e, curUser: n });
|
|
1215
|
+
}, St = new WeakSet(), ee = function(A) {
|
|
1216
|
+
A == "entity" && pt.actionFilter({
|
|
1213
1217
|
keyTimer: "error.logger.entity",
|
|
1214
1218
|
duration: 500,
|
|
1215
1219
|
action: () => {
|
|
1216
1220
|
console.error("Хранилище для логгера не инициализировано");
|
|
1217
1221
|
}
|
|
1218
1222
|
});
|
|
1219
|
-
},
|
|
1223
|
+
}, Ft = new WeakSet(), oe = async function() {
|
|
1220
1224
|
let A = {}, e = new x(BX24.callBatch);
|
|
1221
|
-
for (let [n, i] of
|
|
1225
|
+
for (let [n, i] of o(this, rt).entries())
|
|
1222
1226
|
i.status && (A[n] = {
|
|
1223
1227
|
method: "entity.item.add",
|
|
1224
1228
|
params: {
|
|
1225
|
-
ENTITY:
|
|
1226
|
-
NAME:
|
|
1229
|
+
ENTITY: o(this, W),
|
|
1230
|
+
NAME: o(this, W),
|
|
1227
1231
|
DETAIL_TEXT: JSON.stringify(i)
|
|
1228
1232
|
}
|
|
1229
1233
|
});
|
|
1230
1234
|
if (Object.keys(A).length) {
|
|
1231
1235
|
let n = await e.batch(A), { errors: i } = e;
|
|
1232
|
-
for (let [
|
|
1233
|
-
|
|
1236
|
+
for (let [h, l] of Object.entries({ ...n, ...i }))
|
|
1237
|
+
o(this, rt).delete(h);
|
|
1234
1238
|
}
|
|
1235
|
-
},
|
|
1236
|
-
let A = new x(BX24.callBatch),
|
|
1239
|
+
}, Pt = new WeakSet(), ae = async function() {
|
|
1240
|
+
let A = new x(BX24.callBatch), { serverTime: e } = await A.batch({
|
|
1237
1241
|
serverTime: { method: "server.time" }
|
|
1238
|
-
}), i = e.filter((a) => {
|
|
1239
|
-
let { dateCreate: l } = a;
|
|
1240
|
-
return pt(new Date(l)).between(pt(new Date(n)), "month") >= this.periodClear;
|
|
1241
1242
|
});
|
|
1242
|
-
|
|
1243
|
-
|
|
1243
|
+
o(this, Z) || E(this, Z, await this.getEntityList());
|
|
1244
|
+
let n = o(this, Z).filter((i) => {
|
|
1245
|
+
let { dateCreate: h } = i;
|
|
1246
|
+
return bt(new Date(h)).between(bt(new Date(e)), "month") >= this.periodClear;
|
|
1247
|
+
});
|
|
1248
|
+
_(this, Wt, he).call(this, n);
|
|
1249
|
+
}, Wt = new WeakSet(), he = async function(A) {
|
|
1244
1250
|
let e = new x(BX24.callBatch), n = A.map((i) => {
|
|
1245
|
-
let { id:
|
|
1251
|
+
let { id: h } = i;
|
|
1246
1252
|
return {
|
|
1247
1253
|
method: "entity.item.delete",
|
|
1248
1254
|
params: {
|
|
1249
|
-
ENTITY:
|
|
1250
|
-
ID:
|
|
1255
|
+
ENTITY: o(this, W),
|
|
1256
|
+
ID: h
|
|
1251
1257
|
}
|
|
1252
1258
|
};
|
|
1253
1259
|
});
|
|
1254
1260
|
return await e.batch(n);
|
|
1255
1261
|
};
|
|
1256
|
-
const U = new
|
|
1257
|
-
var
|
|
1258
|
-
class
|
|
1262
|
+
const U = new ye();
|
|
1263
|
+
var Jt, ce, kt, le;
|
|
1264
|
+
class Ee {
|
|
1259
1265
|
constructor(A) {
|
|
1260
1266
|
/** Запрос данных о приложении */
|
|
1261
|
-
N(this, Wt);
|
|
1262
|
-
/** Запрос данных о текущем пользователе */
|
|
1263
1267
|
N(this, Jt);
|
|
1268
|
+
/** Запрос данных о текущем пользователе */
|
|
1269
|
+
N(this, kt);
|
|
1264
1270
|
C(this, "domain", "");
|
|
1265
1271
|
C(this, "isAdmin", !1);
|
|
1266
1272
|
C(this, "appInfo", null);
|
|
@@ -1276,10 +1282,10 @@ class de {
|
|
|
1276
1282
|
window.BX24 && BX24.init(async () => {
|
|
1277
1283
|
console.info("init BX24"), clearInterval(e), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), await U.init();
|
|
1278
1284
|
const [n, i] = await Promise.all([
|
|
1279
|
-
|
|
1280
|
-
|
|
1285
|
+
_(this, Jt, ce).call(this),
|
|
1286
|
+
_(this, kt, le).call(this)
|
|
1281
1287
|
]);
|
|
1282
|
-
this.appInfo = n, this.userInfo = i, new
|
|
1288
|
+
this.appInfo = n, this.userInfo = i, new ie().noSleep(), A(!0);
|
|
1283
1289
|
});
|
|
1284
1290
|
}, 100);
|
|
1285
1291
|
});
|
|
@@ -1310,27 +1316,27 @@ class de {
|
|
|
1310
1316
|
type: "call",
|
|
1311
1317
|
data: { method: A, params: e, updateList: n }
|
|
1312
1318
|
});
|
|
1313
|
-
return new Promise((
|
|
1319
|
+
return new Promise((h) => {
|
|
1314
1320
|
e || (e = {}), BX24.callMethod(A, e, function(l) {
|
|
1315
|
-
let
|
|
1321
|
+
let O = {};
|
|
1316
1322
|
if (l != null && l.answer)
|
|
1317
|
-
for (let [
|
|
1318
|
-
|
|
1323
|
+
for (let [u, r] of Object.entries(l.answer))
|
|
1324
|
+
u != "result" && r && (O[u] = r);
|
|
1319
1325
|
if (l.error()) {
|
|
1320
|
-
let
|
|
1321
|
-
console.error(
|
|
1322
|
-
answer:
|
|
1326
|
+
let u = l.error();
|
|
1327
|
+
console.error(u), U.stop({
|
|
1328
|
+
answer: O,
|
|
1323
1329
|
key: i,
|
|
1324
1330
|
status: "fail",
|
|
1325
|
-
errorList: [
|
|
1326
|
-
}),
|
|
1331
|
+
errorList: [u.toSting()]
|
|
1332
|
+
}), h(!1);
|
|
1327
1333
|
} else {
|
|
1328
|
-
let
|
|
1329
|
-
|
|
1330
|
-
answer:
|
|
1334
|
+
let u = l.data();
|
|
1335
|
+
u != null && u.items && (u = u.items), U.stop({
|
|
1336
|
+
answer: O,
|
|
1331
1337
|
key: i,
|
|
1332
1338
|
status: "success"
|
|
1333
|
-
}),
|
|
1339
|
+
}), h(u);
|
|
1334
1340
|
}
|
|
1335
1341
|
});
|
|
1336
1342
|
});
|
|
@@ -1355,37 +1361,37 @@ class de {
|
|
|
1355
1361
|
* }}
|
|
1356
1362
|
*/
|
|
1357
1363
|
async batch(A, e, { updateList: n, errorCall: i } = {}) {
|
|
1358
|
-
let
|
|
1364
|
+
let h = new x(BX24.callBatch), l = U.start({
|
|
1359
1365
|
type: "batch",
|
|
1360
1366
|
data: { commandList: A, updateList: n }
|
|
1361
1367
|
});
|
|
1362
1368
|
try {
|
|
1363
|
-
let
|
|
1364
|
-
if (Object.keys(
|
|
1365
|
-
let
|
|
1369
|
+
let O = await h.batch(A, e);
|
|
1370
|
+
if (Object.keys(h.errors).length) {
|
|
1371
|
+
let u = Object.entries(h.errors).map(([r, g]) => ({
|
|
1366
1372
|
key: r,
|
|
1367
|
-
error:
|
|
1373
|
+
error: g.toSting()
|
|
1368
1374
|
}));
|
|
1369
|
-
i && i(
|
|
1375
|
+
i && i(h.errors), U.stop({
|
|
1370
1376
|
key: l,
|
|
1371
1377
|
status: "fail",
|
|
1372
|
-
errorList:
|
|
1373
|
-
answer:
|
|
1378
|
+
errorList: u,
|
|
1379
|
+
answer: h.answerData
|
|
1374
1380
|
});
|
|
1375
1381
|
} else
|
|
1376
1382
|
U.stop({
|
|
1377
1383
|
key: l,
|
|
1378
1384
|
status: "success",
|
|
1379
|
-
answer:
|
|
1385
|
+
answer: h.answerData
|
|
1380
1386
|
});
|
|
1381
|
-
return
|
|
1382
|
-
} catch (
|
|
1387
|
+
return O;
|
|
1388
|
+
} catch (O) {
|
|
1383
1389
|
return U.stop({
|
|
1384
1390
|
key: l,
|
|
1385
1391
|
status: "fail-runtime",
|
|
1386
|
-
errorList: [
|
|
1387
|
-
answer:
|
|
1388
|
-
}), console.error(
|
|
1392
|
+
errorList: [O.toSting()],
|
|
1393
|
+
answer: h.answerData
|
|
1394
|
+
}), console.error(O), !1;
|
|
1389
1395
|
}
|
|
1390
1396
|
}
|
|
1391
1397
|
/**
|
|
@@ -1398,11 +1404,11 @@ class de {
|
|
|
1398
1404
|
data: { commandList: A }
|
|
1399
1405
|
});
|
|
1400
1406
|
try {
|
|
1401
|
-
let
|
|
1407
|
+
let h = await n.batchTotalCount(A, e);
|
|
1402
1408
|
if (Object.keys(n.errors).length) {
|
|
1403
|
-
let l = Object.entries(n.errors).map(([
|
|
1404
|
-
key:
|
|
1405
|
-
error:
|
|
1409
|
+
let l = Object.entries(n.errors).map(([O, u]) => ({
|
|
1410
|
+
key: O,
|
|
1411
|
+
error: u.toSting()
|
|
1406
1412
|
}));
|
|
1407
1413
|
U.stop({
|
|
1408
1414
|
key: i,
|
|
@@ -1414,13 +1420,13 @@ class de {
|
|
|
1414
1420
|
key: i,
|
|
1415
1421
|
status: "success"
|
|
1416
1422
|
});
|
|
1417
|
-
return
|
|
1418
|
-
} catch (
|
|
1423
|
+
return h;
|
|
1424
|
+
} catch (h) {
|
|
1419
1425
|
return U.stop({
|
|
1420
1426
|
key: i,
|
|
1421
1427
|
status: "fail",
|
|
1422
|
-
errorList: [
|
|
1423
|
-
}), console.error(
|
|
1428
|
+
errorList: [h.toSting()]
|
|
1429
|
+
}), console.error(h), !1;
|
|
1424
1430
|
}
|
|
1425
1431
|
}
|
|
1426
1432
|
/** Запрос данных о местах встройки приложения */
|
|
@@ -1431,8 +1437,8 @@ class de {
|
|
|
1431
1437
|
async placementBind(A) {
|
|
1432
1438
|
this.placeData || (this.placeData = await this.getPlacement());
|
|
1433
1439
|
const { appName: e, pathApp: n } = this.appConst, i = this.placeData.map((l) => l.placement);
|
|
1434
|
-
let
|
|
1435
|
-
i.includes(A) ?
|
|
1440
|
+
let h = this.placeData.find((l) => l.placement == A);
|
|
1441
|
+
i.includes(A) ? h.handler != n && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[A] || this.placementUnBind(h).then(() => {
|
|
1436
1442
|
window.placementUnBind[A] || (window.placementUnBind[A] = !0, this.placementBind(A));
|
|
1437
1443
|
})) : this.call({
|
|
1438
1444
|
method: "placement.bind",
|
|
@@ -1478,7 +1484,7 @@ class de {
|
|
|
1478
1484
|
}
|
|
1479
1485
|
/* регистрация бота */
|
|
1480
1486
|
regBot({ code: A, type: e, name: n }) {
|
|
1481
|
-
const { appName: i, pathApp:
|
|
1487
|
+
const { appName: i, pathApp: h, chatBotLogo: l } = this.appConst, O = this.appInfo.ID;
|
|
1482
1488
|
return this.call({
|
|
1483
1489
|
method: "imbot.register",
|
|
1484
1490
|
params: {
|
|
@@ -1486,7 +1492,7 @@ class de {
|
|
|
1486
1492
|
// Строковой идентификатор бота, уникальный в рамках вашего приложения (обяз.)
|
|
1487
1493
|
TYPE: e ?? "O",
|
|
1488
1494
|
// Тип бота, B - чат-бот, ответы поступают сразу, H - человек, ответы поступают с задержкой от 2-х до 10 секунд, O - чат-бот для Открытых линий, S - чат-бот с повышенными привилегиями (supervisor)
|
|
1489
|
-
EVENT_HANDLER:
|
|
1495
|
+
EVENT_HANDLER: h,
|
|
1490
1496
|
// Ссылка на обработчик событий, поступивших от сервера - см. Обработчики событий ниже (обяз).
|
|
1491
1497
|
OPENLINE: "Y",
|
|
1492
1498
|
// Включение режима поддержки Открытых линий, можно не указывать, если TYPE = 'O'
|
|
@@ -1494,7 +1500,7 @@ class de {
|
|
|
1494
1500
|
// строковый идентификатор чат-бота, используется только в режиме Вебхуков
|
|
1495
1501
|
PROPERTIES: {
|
|
1496
1502
|
// Личные данные чат-бота (обяз.)
|
|
1497
|
-
NAME: `${n ?? i} - бот #${
|
|
1503
|
+
NAME: `${n ?? i} - бот #${O}`,
|
|
1498
1504
|
// Имя чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
1499
1505
|
LAST_NAME: "",
|
|
1500
1506
|
// Фамилия чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
@@ -1502,7 +1508,7 @@ class de {
|
|
|
1502
1508
|
// Цвет чат-бота для мобильного приложения RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, PINK, LIME, BROWN, AZURE, KHAKI, SAND, MARENGO, GRAY, GRAPHITE
|
|
1503
1509
|
EMAIL: "",
|
|
1504
1510
|
// E-mail для связи. НЕЛЬЗЯ использовать e-mail, дублирующий e-mail реальных пользователей
|
|
1505
|
-
PERSONAL_BIRTHDAY:
|
|
1511
|
+
PERSONAL_BIRTHDAY: bt().format("%Y-%m-%d"),
|
|
1506
1512
|
// День рождения в формате YYYY-mm-dd
|
|
1507
1513
|
WORK_POSITION: "Почтальон",
|
|
1508
1514
|
// Занимаемая должность, используется как описание чат-бота
|
|
@@ -1514,7 +1520,7 @@ class de {
|
|
|
1514
1520
|
// Аватар чат-бота - base64
|
|
1515
1521
|
}
|
|
1516
1522
|
}
|
|
1517
|
-
}).then((
|
|
1523
|
+
}).then((u) => (console.log("Чат-бот добавлен", u), u));
|
|
1518
1524
|
}
|
|
1519
1525
|
/* Убрать регистрацию бота */
|
|
1520
1526
|
unRegBot(A) {
|
|
@@ -1526,15 +1532,15 @@ class de {
|
|
|
1526
1532
|
}).then((e) => (console.log("чат-бот удален", e), e));
|
|
1527
1533
|
}
|
|
1528
1534
|
}
|
|
1529
|
-
|
|
1535
|
+
Jt = new WeakSet(), ce = function() {
|
|
1530
1536
|
return this.call({ method: "app.info" });
|
|
1531
|
-
},
|
|
1537
|
+
}, kt = new WeakSet(), le = function() {
|
|
1532
1538
|
return this.call({ method: "user.current" });
|
|
1533
1539
|
};
|
|
1534
1540
|
export {
|
|
1535
1541
|
x as Batch,
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1542
|
+
Ee as BxBoot,
|
|
1543
|
+
ie as BxHelper,
|
|
1544
|
+
ye as BxLogger,
|
|
1545
|
+
bt as tempus
|
|
1540
1546
|
};
|