szdl-utils-kit 0.1.4 → 0.2.1

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,54 +1,54 @@
1
- var Zt = Object.defineProperty;
2
- var zt = (A, r, e) => r in A ? Zt(A, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : A[r] = e;
3
- var F = (A, r, e) => (zt(A, typeof r != "symbol" ? r + "" : r, e), e), Ht = (A, r, e) => {
4
- if (!r.has(A))
1
+ var ue = Object.defineProperty;
2
+ var me = (A, s, e) => s in A ? ue(A, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : A[s] = e;
3
+ var w = (A, s, e) => (me(A, typeof s != "symbol" ? s + "" : s, e), e), Jt = (A, s, e) => {
4
+ if (!s.has(A))
5
5
  throw TypeError("Cannot " + e);
6
6
  };
7
- var u = (A, r, e) => (Ht(A, r, "read from private field"), e ? e.call(A) : r.get(A)), _ = (A, r, e) => {
8
- if (r.has(A))
7
+ var a = (A, s, e) => (Jt(A, s, "read from private field"), e ? e.call(A) : s.get(A)), _ = (A, s, e) => {
8
+ if (s.has(A))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- r instanceof WeakSet ? r.add(A) : r.set(A, e);
11
- }, y = (A, r, e, a) => (Ht(A, r, "write to private field"), a ? a.call(A, e) : r.set(A, e), e);
12
- var N = (A, r, e) => (Ht(A, r, "access private method"), e);
13
- var Kt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
- function Qt(A) {
10
+ s instanceof WeakSet ? s.add(A) : s.set(A, e);
11
+ }, g = (A, s, e, o) => (Jt(A, s, "write to private field"), o ? o.call(A, e) : s.set(A, e), e);
12
+ var O = (A, s, e) => (Jt(A, s, "access private method"), e);
13
+ var fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
+ function Ne(A) {
15
15
  return A && A.__esModule && Object.prototype.hasOwnProperty.call(A, "default") ? A.default : A;
16
16
  }
17
- var bt = { exports: {} };
18
- (function(A, r) {
17
+ var Xt = { exports: {} };
18
+ (function(A, s) {
19
19
  (function(e) {
20
- Array.prototype.indexOf || (Array.prototype.indexOf = function(t, s) {
21
- var n, o;
22
- for (n = s || 0, o = this.length; n < o; n += 1)
23
- if (this[n] === t)
24
- return n;
20
+ Array.prototype.indexOf || (Array.prototype.indexOf = function(t, r) {
21
+ var h, c;
22
+ for (h = r || 0, c = this.length; h < c; h += 1)
23
+ if (this[h] === t)
24
+ return h;
25
25
  return -1;
26
26
  });
27
- var a = this, h = function(t, s) {
28
- for (var n = t.toString(); n.length < s; )
29
- n = "0" + n;
30
- return n;
31
- }, l = function(t, s) {
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
- }, f = function(t, s) {
34
- var n, o = "";
35
- return n = t.slice(s, s + 1), n !== "" && !isNaN(Number(n)) && (o += "%H"), n = t.charAt(s + 2), n !== "" && n === ":" && (o += n), n = t.slice(s + 3, s + 4), n !== "" && !isNaN(Number(n)) && (o += "%M"), n = t.charAt(s + 5), n !== "" && n === ":" && (o += n), n = t.slice(s + 6, s + 7), n !== "" && !isNaN(Number(n)) && (o += "%S"), o;
36
- }, R = function(t, s) {
37
- var n, o = [
38
- t.slice(s, s + 1),
39
- t.charAt(s + 2),
40
- t.slice(s + 3, s + 4),
41
- t.charAt(s + 5),
42
- t.slice(s + 6, s + 9)
43
- ], g;
44
- return !isNaN(Number(o[0])) && !isNaN(Number(o[2])) && !isNaN(Number(o[4])) ? (o[1] === "." && o[3] === "." ? n = "%d.%m.%Y" : o[1] === "-" && o[3] === "-" ? n = "%m-%d-%Y" : o[1] === "/" && o[3] === "/" && (n = "%m/%d/%Y"), n) : (g = [
45
- t.slice(s, s + 3),
46
- t.charAt(s + 4),
47
- t.slice(s + 5, s + 6),
48
- t.charAt(s + 7),
49
- t.slice(s + 8, s + 9)
50
- ], !isNaN(Number(g[0])) && !isNaN(Number(g[2])) && !isNaN(Number(g[4])) ? (g[1] === "-" && g[3] === "-" && (n = "%Y-%m-%d"), n) : "");
51
- }, S = a.tempus, i, M, p = a.navigator || {}, c = "en", m = {
27
+ var o = this, n = function(t, r) {
28
+ for (var h = t.toString(); h.length < r; )
29
+ h = "0" + h;
30
+ return h;
31
+ }, u = function(t, r) {
32
+ return r !== e ? (t.year(r.year() || r.year), t.month(r.month() || r.month), t.day(r.day() || r.day), t.hours(r.hours() || r.hours), t.minutes(r.minutes() || r.minutes), t.seconds(r.seconds() || r.seconds), t.milliseconds(r.milliseconds() || r.milliseconds), t) : e;
33
+ }, l = function(t, r) {
34
+ var h, c = "";
35
+ return h = t.slice(r, r + 1), h !== "" && !isNaN(Number(h)) && (c += "%H"), h = t.charAt(r + 2), h !== "" && h === ":" && (c += h), h = t.slice(r + 3, r + 4), h !== "" && !isNaN(Number(h)) && (c += "%M"), h = t.charAt(r + 5), h !== "" && h === ":" && (c += h), h = t.slice(r + 6, r + 7), h !== "" && !isNaN(Number(h)) && (c += "%S"), c;
36
+ }, y = function(t, r) {
37
+ var h, c = [
38
+ t.slice(r, r + 1),
39
+ t.charAt(r + 2),
40
+ t.slice(r + 3, r + 4),
41
+ t.charAt(r + 5),
42
+ t.slice(r + 6, r + 9)
43
+ ], M;
44
+ return !isNaN(Number(c[0])) && !isNaN(Number(c[2])) && !isNaN(Number(c[4])) ? (c[1] === "." && c[3] === "." ? h = "%d.%m.%Y" : c[1] === "-" && c[3] === "-" ? h = "%m-%d-%Y" : c[1] === "/" && c[3] === "/" && (h = "%m/%d/%Y"), h) : (M = [
45
+ t.slice(r, r + 3),
46
+ t.charAt(r + 4),
47
+ t.slice(r + 5, r + 6),
48
+ t.charAt(r + 7),
49
+ t.slice(r + 8, r + 9)
50
+ ], !isNaN(Number(M[0])) && !isNaN(Number(M[2])) && !isNaN(Number(M[4])) ? (M[1] === "-" && M[3] === "-" && (h = "%Y-%m-%d"), h) : "");
51
+ }, f = o.tempus, i, R, d = o.navigator || {}, m = "en", N = {
52
52
  en: {
53
53
  JANUARY_SHORT: "Jan",
54
54
  FEBRUARY_SHORT: "Feb",
@@ -209,70 +209,70 @@ var bt = { exports: {} };
209
209
  FRIDAY_LONG: "Freitag",
210
210
  SATURDAY_LONG: "Samstag"
211
211
  }
212
- }, $ = function() {
212
+ }, W = function() {
213
213
  return [
214
- m[c].JANUARY_LONG,
215
- m[c].FEBRUARY_LONG,
216
- m[c].MARCH_LONG,
217
- m[c].APRIL_LONG,
218
- m[c].MAY_LONG,
219
- m[c].JUNE_LONG,
220
- m[c].JULY_LONG,
221
- m[c].AUGUST_LONG,
222
- m[c].SEPTEMBER_LONG,
223
- m[c].OCTOBER_LONG,
224
- m[c].NOVEMBER_LONG,
225
- m[c].DECEMBER_LONG
214
+ N[m].JANUARY_LONG,
215
+ N[m].FEBRUARY_LONG,
216
+ N[m].MARCH_LONG,
217
+ N[m].APRIL_LONG,
218
+ N[m].MAY_LONG,
219
+ N[m].JUNE_LONG,
220
+ N[m].JULY_LONG,
221
+ N[m].AUGUST_LONG,
222
+ N[m].SEPTEMBER_LONG,
223
+ N[m].OCTOBER_LONG,
224
+ N[m].NOVEMBER_LONG,
225
+ N[m].DECEMBER_LONG
226
226
  ];
227
- }, J = function() {
227
+ }, ht = function() {
228
228
  return [
229
- m[c].JANUARY_SHORT,
230
- m[c].FEBRUARY_SHORT,
231
- m[c].MARCH_SHORT,
232
- m[c].APRIL_SHORT,
233
- m[c].MAY_SHORT,
234
- m[c].JUNE_SHORT,
235
- m[c].JULY_SHORT,
236
- m[c].AUGUST_SHORT,
237
- m[c].SEPTEMBER_SHORT,
238
- m[c].OCTOBER_SHORT,
239
- m[c].NOVEMBER_SHORT,
240
- m[c].DECEMBER_SHORT
229
+ N[m].JANUARY_SHORT,
230
+ N[m].FEBRUARY_SHORT,
231
+ N[m].MARCH_SHORT,
232
+ N[m].APRIL_SHORT,
233
+ N[m].MAY_SHORT,
234
+ N[m].JUNE_SHORT,
235
+ N[m].JULY_SHORT,
236
+ N[m].AUGUST_SHORT,
237
+ N[m].SEPTEMBER_SHORT,
238
+ N[m].OCTOBER_SHORT,
239
+ N[m].NOVEMBER_SHORT,
240
+ N[m].DECEMBER_SHORT
241
241
  ];
242
- }, Nt = function() {
242
+ }, V = function() {
243
243
  return [
244
- m[c].SUNDAY_LONG,
245
- m[c].MONDAY_LONG,
246
- m[c].TUESDAY_LONG,
247
- m[c].WEDNESDAY_LONG,
248
- m[c].THURSDAY_LONG,
249
- m[c].FRIDAY_LONG,
250
- m[c].SATURDAY_LONG
244
+ N[m].SUNDAY_LONG,
245
+ N[m].MONDAY_LONG,
246
+ N[m].TUESDAY_LONG,
247
+ N[m].WEDNESDAY_LONG,
248
+ N[m].THURSDAY_LONG,
249
+ N[m].FRIDAY_LONG,
250
+ N[m].SATURDAY_LONG
251
251
  ];
252
- }, _t = function() {
252
+ }, Z = function() {
253
253
  return [
254
- m[c].SUNDAY_SHORT,
255
- m[c].MONDAY_SHORT,
256
- m[c].TUESDAY_SHORT,
257
- m[c].WEDNESDAY_SHORT,
258
- m[c].THURSDAY_SHORT,
259
- m[c].FRIDAY_SHORT,
260
- m[c].SATURDAY_SHORT
254
+ N[m].SUNDAY_SHORT,
255
+ N[m].MONDAY_SHORT,
256
+ N[m].TUESDAY_SHORT,
257
+ N[m].WEDNESDAY_SHORT,
258
+ N[m].THURSDAY_SHORT,
259
+ N[m].FRIDAY_SHORT,
260
+ N[m].SATURDAY_SHORT
261
261
  ];
262
- }, Ot, At, tt, et, Vt = function(t, s, n) {
263
- var o;
264
- a.XMLHttpRequest ? o = new XMLHttpRequest() : o = new ActiveXObject("Microsoft.XMLHTTP"), o.onreadystatechange = function() {
265
- o.readyState === 4 && (o.status === 200 ? s && (a.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(o.responseText))) : n && n(o));
267
- }, o.open("GET", t, !1), o.send();
268
- }, U = {
262
+ }, F, dt, at, ct, le = function(t, r, h) {
263
+ var c;
264
+ o.XMLHttpRequest ? c = new XMLHttpRequest() : c = new ActiveXObject("Microsoft.XMLHTTP"), c.onreadystatechange = function() {
265
+ c.readyState === 4 && (c.status === 200 ? r && (o.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`) : r(JSON.parse(c.responseText))) : h && h(c));
267
+ }, c.open("GET", t, !1), c.send();
268
+ }, I = {
269
269
  "%d": {
270
270
  format: function(t) {
271
- return h(t.day() || i.MIN_DAY, 2);
271
+ return n(t.day() || i.MIN_DAY, 2);
272
272
  },
273
273
  parse: function(t) {
274
- var s = Number(t);
275
- return { day: isNaN(s) ? e : s };
274
+ var r = Number(t);
275
+ return { day: isNaN(r) ? e : r };
276
276
  },
277
277
  minLength: 2,
278
278
  maxLength: 2,
@@ -280,11 +280,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
280
280
  },
281
281
  "%m": {
282
282
  format: function(t) {
283
- return h(t.month() || i.MIN_MONTH, 2);
283
+ return n(t.month() || i.MIN_MONTH, 2);
284
284
  },
285
285
  parse: function(t) {
286
- var s = Number(t);
287
- return { month: isNaN(s) ? e : s };
286
+ var r = Number(t);
287
+ return { month: isNaN(r) ? e : r };
288
288
  },
289
289
  minLength: 2,
290
290
  maxLength: 2,
@@ -292,11 +292,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
292
292
  },
293
293
  "%Y": {
294
294
  format: function(t) {
295
- return h(t.year() || i.MIN_YEAR, 4);
295
+ return n(t.year() || i.MIN_YEAR, 4);
296
296
  },
297
297
  parse: function(t) {
298
- var s = Number(t);
299
- return { year: isNaN(s) ? e : s };
298
+ var r = Number(t);
299
+ return { year: isNaN(r) ? e : r };
300
300
  },
301
301
  minLength: 4,
302
302
  maxLength: 4,
@@ -315,8 +315,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
315
315
  },
316
316
  "%a": {
317
317
  format: function(t) {
318
- var s = t.dayOfWeek();
319
- return et[s !== e ? s : i.MIN_DAY_OF_WEEK];
318
+ var r = t.dayOfWeek();
319
+ return ct[r !== e ? r : i.MIN_DAY_OF_WEEK];
320
320
  },
321
321
  parse: function() {
322
322
  return {};
@@ -327,8 +327,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
327
327
  },
328
328
  "%A": {
329
329
  format: function(t) {
330
- var s = t.dayOfWeek();
331
- return tt[s !== e ? s : i.MIN_DAY_OF_WEEK];
330
+ var r = t.dayOfWeek();
331
+ return at[r !== e ? r : i.MIN_DAY_OF_WEEK];
332
332
  },
333
333
  parse: function() {
334
334
  return {};
@@ -339,12 +339,12 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
339
339
  },
340
340
  "%b": {
341
341
  format: function(t) {
342
- var s = i.options("monthFromZero") ? t.month() : t.month() - 1;
343
- return At[s !== e ? s : i.MIN_MONTH];
342
+ var r = i.options("monthFromZero") ? t.month() : t.month() - 1;
343
+ return dt[r !== e ? r : i.MIN_MONTH];
344
344
  },
345
345
  parse: function(t) {
346
- var s = i.monthNames().indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
347
- return { month: s !== -1 ? s : e };
346
+ var r = i.monthNames().indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
347
+ return { month: r !== -1 ? r : e };
348
348
  },
349
349
  minLength: 1,
350
350
  maxLength: 999,
@@ -352,12 +352,12 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
352
352
  },
353
353
  "%B": {
354
354
  format: function(t) {
355
- var s = i.options("monthFromZero") ? t.month() : t.month() - 1;
356
- return Ot[s !== e ? s : i.MIN_MONTH];
355
+ var r = i.options("monthFromZero") ? t.month() : t.month() - 1;
356
+ return F[r !== e ? r : i.MIN_MONTH];
357
357
  },
358
358
  parse: function(t) {
359
- var s = i.monthNames(!0).indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
360
- return { month: s !== -1 ? s : e };
359
+ var r = i.monthNames(!0).indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
360
+ return { month: r !== -1 ? r : e };
361
361
  },
362
362
  minLength: 1,
363
363
  maxLength: 999,
@@ -365,11 +365,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
365
365
  },
366
366
  "%H": {
367
367
  format: function(t) {
368
- return h(t.hours() || i.MIN_HOURS, 2);
368
+ return n(t.hours() || i.MIN_HOURS, 2);
369
369
  },
370
370
  parse: function(t) {
371
- var s = Number(t);
372
- return { hours: isNaN(s) ? e : s };
371
+ var r = Number(t);
372
+ return { hours: isNaN(r) ? e : r };
373
373
  },
374
374
  minLength: 2,
375
375
  maxLength: 2,
@@ -377,11 +377,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
377
377
  },
378
378
  "%M": {
379
379
  format: function(t) {
380
- return h(t.minutes() || i.MIN_MINUTES, 2);
380
+ return n(t.minutes() || i.MIN_MINUTES, 2);
381
381
  },
382
382
  parse: function(t) {
383
- var s = Number(t);
384
- return { minutes: isNaN(s) ? e : s };
383
+ var r = Number(t);
384
+ return { minutes: isNaN(r) ? e : r };
385
385
  },
386
386
  minLength: 2,
387
387
  maxLength: 2,
@@ -389,11 +389,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
389
389
  },
390
390
  "%S": {
391
391
  format: function(t) {
392
- return h(t.seconds() || i.MIN_SECONDS, 2);
392
+ return n(t.seconds() || i.MIN_SECONDS, 2);
393
393
  },
394
394
  parse: function(t) {
395
- var s = Number(t);
396
- return { seconds: isNaN(s) ? e : s };
395
+ var r = Number(t);
396
+ return { seconds: isNaN(r) ? e : r };
397
397
  },
398
398
  minLength: 2,
399
399
  maxLength: 2,
@@ -412,14 +412,14 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
412
412
  },
413
413
  "%F": {
414
414
  format: function(t) {
415
- return h(t.year() || i.MIN_YEAR, 4) + "-" + h(t.month() || i.MIN_MONTH, 2) + "-" + h(t.day() || i.MIN_DAY, 2);
415
+ return n(t.year() || i.MIN_YEAR, 4) + "-" + n(t.month() || i.MIN_MONTH, 2) + "-" + n(t.day() || i.MIN_DAY, 2);
416
416
  },
417
417
  parse: function(t) {
418
- var s = Number(t.slice(0, 4)), n = Number(t.slice(5, 7)), o = Number(t.slice(8, 10));
418
+ var r = Number(t.slice(0, 4)), h = Number(t.slice(5, 7)), c = Number(t.slice(8, 10));
419
419
  return {
420
- year: s,
421
- month: n,
422
- day: o
420
+ year: r,
421
+ month: h,
422
+ day: c
423
423
  };
424
424
  },
425
425
  minLength: 10,
@@ -428,25 +428,25 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
428
428
  },
429
429
  "%D": {
430
430
  format: function(t) {
431
- return h(t.month() || i.MIN_MONTH, 2) + "/" + h(t.day() || i.MIN_DAY, 2) + "/" + h(t.year() || i.MIN_YEAR, 4);
431
+ return n(t.month() || i.MIN_MONTH, 2) + "/" + n(t.day() || i.MIN_DAY, 2) + "/" + n(t.year() || i.MIN_YEAR, 4);
432
432
  },
433
433
  parse: function(t) {
434
- var s = Number(t.slice(0, 2)), n = Number(t.slice(3, 5)), o = Number(t.slice(6, 10));
434
+ var r = Number(t.slice(0, 2)), h = Number(t.slice(3, 5)), c = Number(t.slice(6, 10));
435
435
  return {
436
- year: o,
437
- month: s,
438
- day: n
436
+ year: c,
437
+ month: r,
438
+ day: h
439
439
  };
440
440
  },
441
441
  minLength: 10,
442
442
  maxLength: 10,
443
443
  type: "string"
444
444
  }
445
- }, St = {
445
+ }, Mt = {
446
446
  useMilliseconds: !1,
447
447
  monthFromZero: !1
448
- }, T;
449
- T = function(t, s, n) {
448
+ }, S;
449
+ S = function(t, r, h) {
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, n), this;
459
- }, T.fn = T.prototype, T.fn.dayCount = function() {
460
- var t = this.month(), s = i.MAX_DAY_IN_MONTHS[t - (i.options("monthFromZero") ? 0 : 1)];
461
- return this.leapYear() && t === (i.options("monthFromZero") ? 1 : 2) && (s += 1), s;
462
- }, T.fn.year = function(t) {
458
+ }, t !== e && this.set(t, r, h), this;
459
+ }, S.fn = S.prototype, S.fn.dayCount = function() {
460
+ var t = this.month(), r = i.MAX_DAY_IN_MONTHS[t - (i.options("monthFromZero") ? 0 : 1)];
461
+ return this.leapYear() && t === (i.options("monthFromZero") ? 1 : 2) && (r += 1), r;
462
+ }, S.fn.year = function(t) {
463
463
  if (arguments.length !== 0)
464
464
  (typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_YEAR && Number(t) <= i.MAX_YEAR ? (this._d.setFullYear(Number(t)), this._i.year = !1) : this._i.year = Number(t) : (this._d.setFullYear(i.MIN_YEAR), this._i.year = !1);
465
465
  else
466
466
  return this._i.year === !1 ? this._d.getFullYear() : this._i.year;
467
467
  return this;
468
- }, T.fn.month = function(t) {
468
+ }, S.fn.month = function(t) {
469
469
  if (arguments.length !== 0)
470
470
  (typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_MONTH && Number(t) <= i.MAX_MONTH ? (this._d.setMonth(i.options("monthFromZero") ? Number(t) : Number(t) - 1), this._i.month = !1) : this._i.month = Number(t) : (this._d.setMonth(i.options("monthFromZero") ? i.MIN_MONTH : i.MIN_MONTH - 1), this._i.month = !1);
471
471
  else
472
472
  return this._i.month === !1 ? i.options("monthFromZero") ? this._d.getMonth() : this._d.getMonth() + 1 : this._i.month;
473
473
  return this;
474
- }, T.fn.day = function(t) {
474
+ }, S.fn.day = function(t) {
475
475
  if (arguments.length !== 0)
476
476
  (typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_DAY && Number(t) <= this.dayCount() ? (this._d.setDate(Number(t)), this._i.day = !1) : this._i.day = Number(t) : (this._d.setDate(i.MIN_DAY), this._i.day = !1);
477
477
  else
478
478
  return this._i.day === !1 ? this._d.getDate() : this._i.day;
479
479
  return this;
480
- }, T.fn.hours = function(t) {
480
+ }, S.fn.hours = function(t) {
481
481
  if (arguments.length !== 0)
482
482
  (typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_HOURS && Number(t) <= i.MAX_HOURS ? (this._d.setHours(Number(t)), this._i.hours = !1) : this._i.hours = Number(t) : (this._d.setHours(i.MIN_HOURS), this._i.hours = !1);
483
483
  else
484
484
  return this._i.hours === !1 ? this._d.getHours() : this._i.hours;
485
485
  return this;
486
- }, T.fn.minutes = function(t) {
486
+ }, S.fn.minutes = function(t) {
487
487
  if (arguments.length !== 0)
488
488
  (typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_MINUTES && Number(t) <= i.MAX_MINUTES ? (this._d.setMinutes(Number(t)), this._i.minutes = !1) : this._i.minutes = Number(t) : (this._d.setMinutes(i.MIN_MINUTES), this._i.minutes = !1);
489
489
  else
490
490
  return this._i.minutes === !1 ? this._d.getMinutes() : this._i.minutes;
491
491
  return this;
492
- }, T.fn.seconds = function(t) {
492
+ }, S.fn.seconds = function(t) {
493
493
  if (arguments.length !== 0)
494
494
  (typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_SECONDS && Number(t) <= i.MAX_SECONDS ? (this._d.setSeconds(Number(t)), this._i.seconds = !1) : this._i.seconds = Number(t) : (this._d.setSeconds(i.MIN_SECONDS), this._i.seconds = !1);
495
495
  else
496
496
  return this._i.seconds === !1 ? this._d.getSeconds() : this._i.seconds;
497
497
  return this;
498
- }, T.fn.milliseconds = function(t) {
498
+ }, S.fn.milliseconds = function(t) {
499
499
  if (arguments.length !== 0)
500
500
  (typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_MILLISECONDS && Number(t) <= i.MAX_MILLISECONDS ? (this._d.setMilliseconds(Number(t)), this._i.milliseconds = !1) : this._i.milliseconds = Number(t) : (this._d.setMilliseconds(i.MIN_MILLISECONDS), this._i.milliseconds = !1);
501
501
  else
502
502
  return this._i.milliseconds === !1 ? this._d.getMilliseconds() : this._i.milliseconds;
503
503
  return this;
504
- }, T.fn.week = function() {
505
- var t = new Date(this.year(), 0, 1), s = i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
506
- return Math.ceil(((s - t.getTime()) / 864e5 + t.getDay() + 1) / 7);
507
- }, T.fn.set = function(t, s, n) {
504
+ }, S.fn.week = function() {
505
+ var t = new Date(this.year(), 0, 1), r = i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
506
+ return Math.ceil(((r - t.getTime()) / 864e5 + t.getDay() + 1) / 7);
507
+ }, S.fn.set = function(t, r, h) {
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`) : s(JSON.pars
520
520
  if (typeof t == "number")
521
521
  return this._d = new Date(t * (i.options("useMilliseconds") ? 1 : 1e3)), this;
522
522
  if (typeof t == "object" && (t instanceof Array ? (this.day(i.MIN_DAY), this.year(t[0]), this.month(t[1]), this.day(t[2]), this.hours(t[3]), this.minutes(t[4]), this.seconds(t[5]), this.milliseconds(t[6])) : (this.day(i.MIN_DAY), this.year(t.year), this.month(t.month), this.day(t.day), this.hours(t.hours), this.minutes(t.minutes), this.seconds(t.seconds), this.milliseconds(t.milliseconds))), typeof t == "string") {
523
- var o, g = [], O, E, P = [], b = 0, Y = 0, L, G, d = {}, H;
523
+ var c, M = [], T, E, X = [], D = 0, H = 0, L, B, p = {}, b;
524
524
  if (t === e)
525
- return O = l(this, n), O === e && (this._i = {
525
+ return T = u(this, h), T === e && (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`) : s(JSON.pars
530
530
  minutes: -1,
531
531
  seconds: -1,
532
532
  milliseconds: -1
533
- }), O;
534
- for (s === e && (s = i.detectFormat(t)); b < s.length; ) {
535
- if (s.charAt(b) === "%") {
536
- if (E = s.charAt(b) + s.charAt(b + 1), U[E] !== e) {
537
- switch (L = 0, G = "", U[E].type) {
533
+ }), T;
534
+ for (r === e && (r = i.detectFormat(t)); D < r.length; ) {
535
+ if (r.charAt(D) === "%") {
536
+ if (E = r.charAt(D) + r.charAt(D + 1), I[E] !== e) {
537
+ switch (L = 0, B = "", I[E].type) {
538
538
  case "number":
539
- for (; L < U[E].maxLength && Y + L < t.length && !isNaN(Number(t.charAt(Y + L))); )
540
- G += t.charAt(Y + L), L += 1;
539
+ for (; L < I[E].maxLength && H + L < t.length && !isNaN(Number(t.charAt(H + L))); )
540
+ B += t.charAt(H + L), L += 1;
541
541
  break;
542
542
  case "word":
543
- for (; L < U[E].maxLength && Y + L < t.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(Y + L)); )
544
- G += t.charAt(Y + L), L += 1;
543
+ for (; L < I[E].maxLength && H + L < t.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(H + L)); )
544
+ B += t.charAt(H + L), L += 1;
545
545
  break;
546
546
  case "string":
547
- for (; L < U[E].maxLength && Y + L < t.length; )
548
- G += t.charAt(Y + L), L += 1;
547
+ for (; L < I[E].maxLength && H + L < t.length; )
548
+ B += t.charAt(H + L), L += 1;
549
549
  break;
550
550
  }
551
- if (L < U[E].minLength)
552
- return O = l(this, n), O === e && (this._i = {
551
+ if (L < I[E].minLength)
552
+ return T = u(this, h), T === e && (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`) : s(JSON.pars
557
557
  minutes: -1,
558
558
  seconds: -1,
559
559
  milliseconds: -1
560
- }), O;
561
- g.push(E), P.push(G), L -= 1, Y += L, b += 1;
560
+ }), T;
561
+ M.push(E), X.push(B), L -= 1, H += L, D += 1;
562
562
  }
563
- } else if (t.charAt(Y) !== s.charAt(b))
564
- return O = l(this, n), O === e && (this._i = {
563
+ } else if (t.charAt(H) !== r.charAt(D))
564
+ return T = u(this, h), T === e && (this._i = {
565
565
  year: -1,
566
566
  month: -1,
567
567
  day: -1,
@@ -569,33 +569,33 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
569
569
  minutes: -1,
570
570
  seconds: -1,
571
571
  milliseconds: -1
572
- }), O;
573
- b += 1, Y += 1;
572
+ }), T;
573
+ D += 1, H += 1;
574
574
  }
575
- for (o in g)
576
- g.hasOwnProperty(o) && U.hasOwnProperty(g[o]) && (H = U[g[o]].parse(P[o]), d = {
577
- year: H.year !== e ? H.year : d.year,
578
- month: H.month !== e ? H.month : d.month,
579
- day: H.day !== e ? H.day : d.day,
580
- hours: H.hours !== e ? H.hours : d.hours,
581
- minutes: H.minutes !== e ? H.minutes : d.minutes,
582
- seconds: H.seconds !== e ? H.seconds : d.seconds
575
+ for (c in M)
576
+ M.hasOwnProperty(c) && I.hasOwnProperty(M[c]) && (b = I[M[c]].parse(X[c]), p = {
577
+ year: b.year !== e ? b.year : p.year,
578
+ month: b.month !== e ? b.month : p.month,
579
+ day: b.day !== e ? b.day : p.day,
580
+ hours: b.hours !== e ? b.hours : p.hours,
581
+ minutes: b.minutes !== e ? b.minutes : p.minutes,
582
+ seconds: b.seconds !== e ? b.seconds : p.seconds
583
583
  });
584
- this.day(i.MIN_DAY), this.year(d.year), this.month(d.month), this.day(d.day), this.hours(d.hours), this.minutes(d.minutes), this.seconds(d.seconds), this.milliseconds(d.milliseconds);
584
+ this.day(i.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
- }, T.fn.leapYear = function() {
587
+ }, S.fn.leapYear = function() {
588
588
  var t = this.year();
589
589
  return t % 4 === 0 ? t % 100 === 0 ? t % 400 === 0 : !0 : !1;
590
- }, T.fn.timestamp = function(t) {
590
+ }, S.fn.timestamp = function(t) {
591
591
  return arguments.length !== 0 ? (this._d = new Date(Number(t) * (i.options("useMilliseconds") ? 1 : 1e3) + this._d.getTimezoneOffset() * 6e4), this) : i.options("useMilliseconds") ? this._d.getTime() - this._d.getTimezoneOffset() * 6e4 : Math.floor(this._d.getTime() / 1e3) - this._d.getTimezoneOffset() * 60;
592
- }, T.fn.utc = function(t) {
592
+ }, S.fn.utc = function(t) {
593
593
  return arguments.length !== 0 ? (this._d = new Date(Number(t) * (i.options("useMilliseconds") ? 1 : 1e3)), this) : i.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
594
- }, T.fn.dayOfWeek = function(t) {
594
+ }, S.fn.dayOfWeek = function(t) {
595
595
  if (t === "long")
596
- return tt[this._d.getDay()];
596
+ return at[this._d.getDay()];
597
597
  if (t === "short")
598
- return et[this._d.getDay()];
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
- }, T.fn.timezone = function(t) {
615
+ }, S.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
- }, T.fn.get = function(t) {
624
+ }, S.fn.get = function(t) {
625
625
  switch (t) {
626
626
  case "Date":
627
627
  return new Date(
@@ -670,409 +670,628 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
670
670
  timestamp: this.timestamp()
671
671
  };
672
672
  }
673
- }, T.fn.format = function(t) {
674
- for (var s = 0, n = "", o; s < t.length; )
675
- t.charAt(s) === "%" ? (o = t.charAt(s) + t.charAt(s + 1), U[o] !== e ? (n += U[o].format(this), s += 1) : n += "%") : n += t.charAt(s), s += 1;
676
- return n;
677
- }, T.fn.valid = function() {
673
+ }, S.fn.format = function(t) {
674
+ for (var r = 0, h = "", c; r < t.length; )
675
+ t.charAt(r) === "%" ? (c = t.charAt(r) + t.charAt(r + 1), I[c] !== e ? (h += I[c].format(this), r += 1) : h += "%") : h += t.charAt(r), r += 1;
676
+ return h;
677
+ }, S.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
- }, T.fn.errors = function() {
679
+ }, S.fn.errors = function() {
680
680
  return this._i;
681
- }, T.fn.between = function(t, s) {
682
- var n = this.timestamp(), o = t.timestamp();
683
- switch (s) {
681
+ }, S.fn.between = function(t, r) {
682
+ var h = this.timestamp(), c = t.timestamp();
683
+ switch (r) {
684
684
  case "year":
685
- return Math.floor((o - n) / 31556952);
685
+ return Math.floor((c - h) / 31556952);
686
686
  case "month":
687
- return Math.floor((o - n) / 2629746);
687
+ return Math.floor((c - h) / 2629746);
688
688
  case "day":
689
- return Math.floor((o - n) / 86400);
689
+ return Math.floor((c - h) / 86400);
690
690
  case "hours":
691
- return Math.floor((o - n) / 3600);
691
+ return Math.floor((c - h) / 3600);
692
692
  case "minutes":
693
- return Math.floor((o - n) / 60);
693
+ return Math.floor((c - h) / 60);
694
694
  case "seconds":
695
- return o - n;
695
+ return c - h;
696
696
  default:
697
697
  return e;
698
698
  }
699
- }, T.fn.calc = function(t) {
699
+ }, S.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
- }, i = function(t, s, n) {
702
- return new T(t, s, n);
703
- }, i.MIN_YEAR = 1e3, i.MAX_YEAR = 3e3, i.MIN_MONTH = 1, i.MAX_MONTH = 12, i.MIN_DAY = 1, i.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], i.MIN_DAY_OF_WEEK = 0, i.MAX_DAY_OF_WEEK = 6, i.MIN_HOURS = 0, i.MAX_HOURS = 23, i.MIN_MINUTES = 0, i.MAX_MINUTES = 59, i.MIN_SECONDS = 0, i.MAX_SECONDS = 59, i.MIN_MILLISECONDS = 0, i.MAX_MILLISECONDS = 999, i.VERSION = "0.2.18", i.options = function(t, s) {
701
+ }, i = function(t, r, h) {
702
+ return new S(t, r, h);
703
+ }, i.MIN_YEAR = 1e3, i.MAX_YEAR = 3e3, i.MIN_MONTH = 1, i.MAX_MONTH = 12, i.MIN_DAY = 1, i.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], i.MIN_DAY_OF_WEEK = 0, i.MAX_DAY_OF_WEEK = 6, i.MIN_HOURS = 0, i.MAX_HOURS = 23, i.MIN_MINUTES = 0, i.MAX_MINUTES = 59, i.MIN_SECONDS = 0, i.MAX_SECONDS = 59, i.MIN_MILLISECONDS = 0, i.MAX_MILLISECONDS = 999, i.VERSION = "0.2.18", i.options = function(t, r) {
704
704
  if (t === e)
705
- return St;
706
- if (St.hasOwnProperty(t)) {
707
- if (s === e)
708
- return St[t];
709
- St[t] = s, t === "monthFromZero" && (i.MIN_MONTH = s ? 0 : 1, i.MAX_MONTH = s ? 11 : 12);
705
+ return Mt;
706
+ if (Mt.hasOwnProperty(t)) {
707
+ if (r === e)
708
+ return Mt[t];
709
+ Mt[t] = r, t === "monthFromZero" && (i.MIN_MONTH = r ? 0 : 1, i.MAX_MONTH = r ? 11 : 12);
710
710
  }
711
711
  return e;
712
712
  }, i.noConflict = function() {
713
- return a.tempus = S, i;
713
+ return o.tempus = f, i;
714
714
  }, i.generate = function(t) {
715
- var s, n, o, g, O, E, P, b;
716
- if (typeof t.dateFrom != "number" && (t.dateFrom instanceof T ? s = t.dateFrom.utc() : s = i(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof T ? n = t.dateTo.utc() : n = i(t.dateTo, t.formatTo !== e ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? O = {
715
+ var r, h, c, M, T, E, X, D;
716
+ if (typeof t.dateFrom != "number" && (t.dateFrom instanceof S ? r = t.dateFrom.utc() : r = i(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof S ? h = t.dateTo.utc() : h = i(t.dateTo, t.formatTo !== e ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? T = {
717
717
  year: 0,
718
718
  month: 0,
719
719
  day: 0,
720
720
  hours: 0,
721
721
  minutes: 0,
722
722
  seconds: t.period
723
- } : typeof t.period == "string" ? O = {
723
+ } : typeof t.period == "string" ? T = {
724
724
  year: t.period === "year" ? 1 : 0,
725
725
  month: t.period === "month" ? 1 : 0,
726
726
  day: t.period === "day" ? 1 : 0,
727
727
  hours: t.period === "hours" ? 1 : 0,
728
728
  minutes: t.period === "minutes" ? 1 : 0,
729
729
  seconds: t.period === "seconds" ? 1 : 0
730
- } : typeof t.period == "object" && (O = {
730
+ } : typeof t.period == "object" && (T = {
731
731
  year: t.period.year !== e ? t.period.year : 0,
732
732
  month: t.period.month !== e ? t.period.month : 0,
733
733
  day: t.period.day !== e ? t.period.day : 0,
734
734
  hours: t.period.hours !== e ? t.period.hours : 0,
735
735
  minutes: t.period.minutes !== e ? t.period.minutes : 0,
736
736
  seconds: t.period.seconds !== e ? t.period.seconds : 0
737
- }), t.groupBy === e ? E = t.asObject === !0 ? {} : [] : (E = [], E.push([]), P = i(s).get()[t.groupBy]), b = function(G, d, H) {
738
- return t.asObject === !0 ? t.format !== e ? G[i(d).format(t.format)] = {} : G[i(d).format("%F %H:%M:%S")] = {} : t.format !== e ? G.push(H ? null : i(d).format(t.format)) : G.push(H ? null : i(d)), G;
737
+ }), t.groupBy === e ? E = t.asObject === !0 ? {} : [] : (E = [], E.push([]), X = i(r).get()[t.groupBy]), D = function(B, p, b) {
738
+ return t.asObject === !0 ? t.format !== e ? B[i(p).format(t.format)] = {} : B[i(p).format("%F %H:%M:%S")] = {} : t.format !== e ? B.push(b ? null : i(p).format(t.format)) : B.push(b ? null : i(p)), B;
739
739
  }, t.groupBy !== e && t.fillNulls) {
740
- var Y = {
741
- year: O.year ? -O.year : e,
742
- month: O.month ? -O.month : e,
743
- day: O.day ? -O.day : e,
744
- hours: O.hours ? -O.hours : e,
745
- minutes: O.minutes ? -O.minutes : e,
746
- seconds: O.seconds ? -O.seconds : e,
747
- milliseconds: O.milliseconds ? -O.milliseconds : e
740
+ var H = {
741
+ year: T.year ? -T.year : e,
742
+ month: T.month ? -T.month : e,
743
+ day: T.day ? -T.day : e,
744
+ hours: T.hours ? -T.hours : e,
745
+ minutes: T.minutes ? -T.minutes : e,
746
+ seconds: T.seconds ? -T.seconds : e,
747
+ milliseconds: T.milliseconds ? -T.milliseconds : e
748
748
  };
749
- for (o = i(s).calc(Y).utc(); i(o).get()[t.groupBy] === P; )
750
- b(E[E.length - 1], o, !0), o = i(o).calc(Y).utc();
749
+ for (c = i(r).calc(H).utc(); i(c).get()[t.groupBy] === X; )
750
+ D(E[E.length - 1], c, !0), c = i(c).calc(H).utc();
751
751
  if (t.groupBy === "week") {
752
- var L = i(s).dayOfWeek();
753
- for (o = i(s).dayOfWeek(0).utc(); E[0].length < L && o < s; )
754
- b(E[E.length - 1], o, !0), o = i(o).calc(O).utc();
752
+ var L = i(r).dayOfWeek();
753
+ for (c = i(r).dayOfWeek(0).utc(); E[0].length < L && c < r; )
754
+ D(E[E.length - 1], c, !0), c = i(c).calc(T).utc();
755
755
  }
756
756
  }
757
- for (; s <= n; )
758
- t.groupBy === e ? b(E, s) : i(s).get()[t.groupBy] === P ? b(E[E.length - 1], s) : (E.push([]), b(E[E.length - 1], s), P = i(s).get()[t.groupBy]), s = i(s).calc(O).utc();
757
+ for (; r <= h; )
758
+ t.groupBy === e ? D(E, r) : i(r).get()[t.groupBy] === X ? D(E[E.length - 1], r) : (E.push([]), D(E[E.length - 1], r), X = i(r).get()[t.groupBy]), r = i(r).calc(T).utc();
759
759
  if (t.groupBy !== e && t.fillNulls)
760
- for (g = i(n).calc(O).utc(); i(g).get()[t.groupBy] === P; )
761
- b(E[E.length - 1], g, !0), g = i(g).calc(O).utc();
760
+ for (M = i(h).calc(T).utc(); i(M).get()[t.groupBy] === X; )
761
+ D(E[E.length - 1], M, !0), M = i(M).calc(T).utc();
762
762
  return E;
763
763
  }, i.monthNames = function(t) {
764
764
  switch (t) {
765
765
  case "long":
766
- return Ot;
766
+ return F;
767
767
  default:
768
- return At;
768
+ return dt;
769
769
  }
770
770
  }, i.dayNames = function(t) {
771
771
  switch (t) {
772
772
  case "long":
773
- return tt;
773
+ return at;
774
774
  default:
775
- return et;
775
+ return ct;
776
776
  }
777
777
  }, i.lang = function(t) {
778
778
  if (t !== e)
779
- c = t, m[c] === e && (c = "en"), Ot = $(), At = J(), tt = Nt(), et = _t();
779
+ m = t, N[m] === e && (m = "en"), F = W(), dt = ht(), at = V(), ct = Z();
780
780
  else
781
- return c;
781
+ return m;
782
782
  return e;
783
783
  }, i.availableLangs = function() {
784
- return Object.keys(m);
785
- }, i.registerFormat = function(t, s, n, o, g, O) {
786
- U[t] = {
787
- format: s,
788
- parse: n,
789
- minLength: o,
790
- maxLength: g,
791
- type: O
784
+ return Object.keys(N);
785
+ }, i.registerFormat = function(t, r, h, c, M, T) {
786
+ I[t] = {
787
+ format: r,
788
+ parse: h,
789
+ minLength: c,
790
+ maxLength: M,
791
+ type: T
792
792
  };
793
793
  }, i.unregisterFormat = function(t) {
794
- delete U[t];
794
+ delete I[t];
795
795
  }, i.detectFormat = function(t) {
796
- var s, n, o;
797
- return s = R(t, 0), s !== "" && (o = 10), n = t.charAt(o), (n === "T" || n === " ") && (s += n, o += 1), s += f(t, o), s;
798
- }, M = {
799
- TempusDate: T
800
- }, i.classes = function(t, s) {
801
- if (s === e)
802
- return M[t];
803
- M[t] = s;
796
+ var r, h, c;
797
+ return r = y(t, 0), r !== "" && (c = 10), h = t.charAt(c), (h === "T" || h === " ") && (r += h, c += 1), r += l(t, c), r;
798
+ }, R = {
799
+ TempusDate: S
800
+ }, i.classes = function(t, r) {
801
+ if (r === e)
802
+ return R[t];
803
+ R[t] = r;
804
804
  }, i.loadTranslations = function(t) {
805
- typeof t == "object" ? m = t : typeof t == "string" && Vt(t, function(s) {
806
- m = s;
807
- }, function(s) {
805
+ typeof t == "object" ? N = t : typeof t == "string" && le(t, function(r) {
806
+ N = r;
807
+ }, function(r) {
808
808
  });
809
- }, c = (p.language || p.systemLanguage || p.userLanguage || "en").substr(0, 2).toLowerCase(), m[c] === e && (c = "en"), Ot = $(), At = J(), tt = Nt(), et = _t(), A.exports && (r = A.exports = i), r.tempus = i;
810
- }).call(Kt);
811
- })(bt, bt.exports);
812
- var qt = bt.exports;
813
- const vt = /* @__PURE__ */ Qt(qt);
814
- var x, it, X, I, W, C, j, k, D, w, Et, V, B, Z, z, Q, Rt, rt, Yt, nt, Dt, ot, Ut, ht, It, at, Gt, Mt, Jt, gt, xt, ut, Bt, ct, Ct, mt, Pt, q, Tt, lt, Ft, Lt, Xt, K, st, v, yt, ft, Wt;
815
- class wt {
816
- constructor(r, e = {}) {
817
- _(this, Q);
818
- _(this, rt);
809
+ }, m = (d.language || d.systemLanguage || d.userLanguage || "en").substr(0, 2).toLowerCase(), N[m] === e && (m = "en"), F = W(), dt = ht(), at = V(), ct = Z(), A.exports && (s = A.exports = i), s.tempus = i;
810
+ }).call(fe);
811
+ })(Xt, Xt.exports);
812
+ var _e = Xt.exports;
813
+ const jt = /* @__PURE__ */ Ne(_e);
814
+ var z, ut, K, Y, J, q, Q, U, k, Dt, v, C, $, tt, it, Lt, mt, kt, ft, xt, Nt, Vt, _t, Zt, Ot, zt, Ht, ee, Yt, se, yt, Kt, At, qt, Tt, Qt, nt, pt, St, vt, Ut, re, et, lt, ot, bt, gt, $t;
815
+ class j {
816
+ constructor(s, e = {}) {
817
+ _(this, it);
818
+ _(this, mt);
819
+ _(this, ft);
820
+ _(this, Nt);
821
+ _(this, _t);
822
+ _(this, Ot);
823
+ _(this, Ht);
824
+ _(this, Yt);
825
+ _(this, yt);
826
+ _(this, At);
827
+ _(this, Tt);
819
828
  _(this, nt);
829
+ _(this, St);
830
+ _(this, Ut);
831
+ _(this, et);
820
832
  _(this, ot);
821
- _(this, ht);
822
- _(this, at);
823
- _(this, Mt);
824
833
  _(this, gt);
825
- _(this, ut);
826
- _(this, ct);
827
- _(this, mt);
828
- _(this, q);
829
- _(this, lt);
830
- _(this, Lt);
831
- _(this, K);
832
- _(this, v);
833
- _(this, ft);
834
- _(this, x, null);
835
- _(this, it, null);
836
- _(this, X, []);
837
- _(this, I, {});
838
- _(this, W, {});
839
- _(this, C, 50);
840
- _(this, j, !0);
834
+ _(this, z, null);
835
+ _(this, ut, null);
836
+ _(this, K, []);
837
+ _(this, Y, {});
838
+ _(this, J, 50);
839
+ _(this, q, !0);
840
+ _(this, Q, null);
841
+ _(this, U, null);
841
842
  _(this, k, null);
842
- _(this, D, null);
843
- _(this, w, null);
844
- _(this, Et, 100);
845
- _(this, V, "no");
846
- _(this, B, !1);
847
- _(this, Z, !1);
848
- _(this, z, !1);
849
- y(this, x, r), y(this, it, e);
843
+ _(this, Dt, 100);
844
+ _(this, v, "no");
845
+ _(this, C, !1);
846
+ _(this, $, !1);
847
+ _(this, tt, !1);
848
+ w(this, "errors", {});
849
+ w(this, "answerData", {});
850
+ g(this, z, s), g(this, ut, e);
850
851
  }
851
852
  get serial() {
852
- return u(this, B);
853
+ return a(this, C);
853
854
  }
854
855
  setSerial() {
855
- y(this, B, !0), y(this, Z, !0), y(this, z, !1);
856
+ g(this, C, !0), g(this, $, !0), g(this, tt, !1);
856
857
  }
857
858
  setParallel() {
858
- y(this, B, !1), y(this, Z, !1), y(this, z, !0);
859
+ g(this, C, !1), g(this, $, !1), g(this, tt, !0);
859
860
  }
860
861
  stop() {
861
- y(this, j, !1);
862
+ g(this, q, !1);
862
863
  }
863
- async batch(r, e) {
864
- u(this, w) && N(this, rt, Yt).call(this), e && y(this, k, e), u(this, Z) === !1 && y(this, B, !1), Object.keys(r).length > 500 && y(this, B, !0), y(this, j, !0), y(this, X, []), y(this, I, {}), y(this, W, {});
865
- const a = N(this, ot, Ut).call(this, r);
866
- if (Object.keys(r).length < 500) {
867
- const h = a.map((l, f) => N(this, ht, It).call(this, l, a[f]));
868
- return Promise.allSettled(h).then((l) => {
869
- let f = {};
870
- for (let R of l)
871
- R.status === "fulfilled" && (f = { ...f, ...R.value });
872
- return f;
864
+ async batch(s, e) {
865
+ a(this, k) && O(this, mt, kt).call(this), e && g(this, Q, e), a(this, $) === !1 && g(this, C, !1), Object.keys(s).length > 500 && g(this, C, !0), g(this, q, !0), g(this, K, []), g(this, Y, {}), this.errors = {}, this.answerData = {};
866
+ const o = O(this, Nt, Vt).call(this, s);
867
+ if (Object.keys(s).length < 500) {
868
+ const n = o.map((u, l) => O(this, _t, Zt).call(this, u, o[l]));
869
+ return Promise.allSettled(n).then((u) => {
870
+ let l = {};
871
+ for (let y of u)
872
+ y.status === "fulfilled" && (l = { ...l, ...y.value });
873
+ return l;
873
874
  });
874
875
  } else {
875
- let h = {}, l = 0, f = 1, R = Object.keys(r).length || 1, S = (i) => {
876
- l += Object.keys(i).length, f = Math.round(l / R * 100);
876
+ let n = {}, u = 0, l = 1, y = Object.keys(s).length || 1, f = (i) => {
877
+ u += Object.keys(i).length, l = Math.round(u / y * 100);
877
878
  };
878
- for (let [i, M] of Object.entries(a)) {
879
- let p = await N(this, ht, It).call(this, M, a[i], !0);
880
- S(M), e && e({ percent: f }), h = { ...h, ...p };
879
+ for (let [i, R] of Object.entries(o)) {
880
+ let d = await O(this, _t, Zt).call(this, R, o[i], !0);
881
+ f(R), e && e({ percent: l }), n = { ...n, ...d };
881
882
  }
882
- return h;
883
+ return n;
883
884
  }
884
885
  }
885
- async batchTotalCount(r, e) {
886
- y(this, I, {}), y(this, W, {});
887
- let a = 1, h = 0, l = Object.keys(r).length || 1, f = (S) => {
888
- h += Object.keys(S).length, a = Math.round(h / l * 100);
886
+ async batchTotalCount(s, e) {
887
+ g(this, Y, {}), this.errors = {};
888
+ let o = 1, n = 0, u = Object.keys(s).length || 1, l = (f) => {
889
+ n += Object.keys(f).length, o = Math.round(n / u * 100);
889
890
  };
890
- e && e({ percent: a });
891
- const R = N(this, ot, Ut).call(this, r);
892
- if (u(this, z)) {
893
- const S = R.map((i) => N(this, at, Gt).call(this, i).then((M) => (f(i), e && e({ percent: a }), M)));
894
- return Promise.allSettled(S).then((i) => {
895
- let M = {};
896
- for (let p of i)
897
- p.status === "fulfilled" && (M = { ...M, ...p.value });
898
- return M;
891
+ e && e({ percent: o });
892
+ const y = O(this, Nt, Vt).call(this, s);
893
+ if (a(this, tt)) {
894
+ const f = y.map((i) => O(this, Ot, zt).call(this, i).then((R) => (l(i), e && e({ percent: o }), R)));
895
+ return Promise.allSettled(f).then((i) => {
896
+ let R = {};
897
+ for (let d of i)
898
+ d.status === "fulfilled" && (R = { ...R, ...d.value });
899
+ return R;
899
900
  });
900
901
  } else {
901
- let S = {};
902
- for (let i of R) {
903
- let M = await N(this, at, Gt).call(this, i);
904
- f(i), e && e({ percent: a }), S = { ...S, ...M };
902
+ let f = {};
903
+ for (let i of y) {
904
+ let R = await O(this, Ot, zt).call(this, i);
905
+ l(i), e && e({ percent: o }), f = { ...f, ...R };
905
906
  }
906
- return S;
907
+ return f;
907
908
  }
908
909
  }
909
910
  }
910
- x = new WeakMap(), it = new WeakMap(), X = new WeakMap(), I = new WeakMap(), W = new WeakMap(), C = new WeakMap(), j = new WeakMap(), k = new WeakMap(), D = new WeakMap(), w = new WeakMap(), Et = new WeakMap(), V = new WeakMap(), B = new WeakMap(), Z = new WeakMap(), z = new WeakMap(), Q = new WeakSet(), Rt = function() {
911
- let r = 0;
912
- if (!u(this, D))
913
- return Math.round(r);
914
- let e = 0, a = 0;
915
- return Object.values(u(this, D)).forEach((h) => {
916
- const { total: l, count: f } = h;
917
- e += l ?? 0, a += f ?? 0;
918
- }), e ? r = a / e * 100 : r = 100, { percent: Math.round(r), allCount: a, allTotal: e };
919
- }, rt = new WeakSet(), Yt = function() {
920
- clearInterval(u(this, w)), y(this, w, ""), y(this, D, ""), y(this, k, ""), y(this, V, "no");
921
- }, nt = new WeakSet(), Dt = function({ key: r, value: e }) {
922
- const a = N(this, K, st).call(this, e.data()), h = Array.isArray(a) ? a.length : 0, l = N(this, v, yt).call(this, e.total(), h);
923
- let f = 1;
924
- a && (f = h), u(this, k) && (u(this, D) || y(this, D, {}), u(this, D)[r] && u(this, D)[r].count && (f += u(this, D)[r].count), u(this, D)[r] = { total: l, count: f }, u(this, w) || y(this, w, setInterval(() => {
925
- const { percent: R, allCount: S, allTotal: i } = u(this, Q, Rt);
926
- (u(this, V) === "no" || u(this, V) < u(this, Q, Rt).percent) && (u(this, k).call(this, {
927
- data: u(this, D),
928
- percent: R,
929
- allCount: S,
911
+ z = new WeakMap(), ut = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), J = new WeakMap(), q = new WeakMap(), Q = new WeakMap(), U = new WeakMap(), k = new WeakMap(), Dt = new WeakMap(), v = new WeakMap(), C = new WeakMap(), $ = new WeakMap(), tt = new WeakMap(), it = new WeakSet(), Lt = function() {
912
+ let s = 0;
913
+ if (!a(this, U))
914
+ return Math.round(s);
915
+ let e = 0, o = 0;
916
+ return Object.values(a(this, U)).forEach((n) => {
917
+ const { total: u, count: l } = n;
918
+ e += u ?? 0, o += l ?? 0;
919
+ }), e ? s = o / e * 100 : s = 100, { percent: Math.round(s), allCount: o, allTotal: e };
920
+ }, mt = new WeakSet(), kt = function() {
921
+ clearInterval(a(this, k)), g(this, k, ""), g(this, U, ""), g(this, Q, ""), g(this, v, "no");
922
+ }, ft = new WeakSet(), xt = function({ key: s, value: e }) {
923
+ const o = O(this, et, lt).call(this, e.data()), n = Array.isArray(o) ? o.length : 0, u = O(this, ot, bt).call(this, e.total(), n);
924
+ let l = 1;
925
+ o && (l = n), a(this, Q) && (a(this, U) || g(this, U, {}), a(this, U)[s] && a(this, U)[s].count && (l += a(this, U)[s].count), a(this, U)[s] = { total: u, count: l }, a(this, k) || g(this, k, setInterval(() => {
926
+ const { percent: y, allCount: f, allTotal: i } = a(this, it, Lt);
927
+ (a(this, v) === "no" || a(this, v) < a(this, it, Lt).percent) && (a(this, Q).call(this, {
928
+ data: a(this, U),
929
+ percent: y,
930
+ allCount: f,
930
931
  allTotal: i
931
- }), y(this, V, u(this, Q, Rt).percent)), R === 100 && N(this, rt, Yt).call(this);
932
- }, u(this, Et))));
933
- }, ot = new WeakSet(), Ut = function(r) {
934
- const e = [], a = Object.entries(r);
935
- for (let h = 0; h < a.length; h += u(this, C)) {
936
- const l = a.slice(h, h + u(this, C));
937
- e.push(Object.fromEntries(l));
932
+ }), g(this, v, a(this, it, Lt).percent)), y === 100 && O(this, mt, kt).call(this);
933
+ }, a(this, Dt))));
934
+ }, Nt = new WeakSet(), Vt = function(s) {
935
+ const e = [], o = Object.entries(s);
936
+ for (let n = 0; n < o.length; n += a(this, J)) {
937
+ const u = o.slice(n, n + a(this, J));
938
+ e.push(Object.fromEntries(u));
938
939
  }
939
940
  return e;
940
- }, ht = new WeakSet(), It = function(r, e, a) {
941
- return new Promise((h) => {
942
- const l = N(this, lt, Ft).call(this, e), f = [];
943
- let R = 0, S = 0;
944
- u(this, x).call(this, r, (i) => {
945
- Object.entries(i).forEach(([M, p]) => {
946
- const c = p.error();
947
- c && (u(this, W)[M] = c, R += 1);
948
- const m = N(this, K, st).call(this, p.data()), $ = Array.isArray(m) ? m.length : 0, J = N(this, v, yt).call(this, p.total(), $);
949
- if (u(this, I)[M] = m, S += J, a || N(this, nt, Dt).call(this, { key: M, value: p }), J > u(this, C) && J > $) {
950
- const Nt = Math.ceil(J / u(this, C)) - 1, _t = Array.from({ length: Nt });
951
- f.push([M, l[M], _t]);
941
+ }, _t = new WeakSet(), Zt = function(s, e, o) {
942
+ return new Promise((n) => {
943
+ const u = O(this, St, vt).call(this, e), l = [];
944
+ let y = 0, f = 0;
945
+ a(this, z).call(this, s, (i) => {
946
+ Object.entries(i).forEach(([R, d]) => {
947
+ let m = {};
948
+ const N = d.error();
949
+ if (N && (this.errors[R] = N, y += 1), d != null && d.answer && Object.keys(d.answer).length) {
950
+ for (let [Z, F] of Object.entries(d.answer))
951
+ Z != "result" && F && (m[Z] = F);
952
+ Object.keys(m).length && (this.answerData[R] = m);
952
953
  }
953
- }), S > 5e3 && u(this, Z) === !1 && u(this, z) === !1 && y(this, B, !0), R > 0 && N(this, ft, Wt).call(this), f.length ? (N(this, Mt, Jt).call(this, f), N(this, gt, xt).call(this).then(() => h(N(this, q, Tt).call(this)))) : h(N(this, q, Tt).call(this));
954
+ const W = O(this, et, lt).call(this, d.data()), ht = Array.isArray(W) ? W.length : 0, V = O(this, ot, bt).call(this, d.total(), ht);
955
+ if (Array.isArray(W) ? a(this, Y)[R] = W : a(this, Y)[R] = Object.values(W), f += V, o || O(this, ft, xt).call(this, { key: R, value: d }), V > a(this, J) && V > ht) {
956
+ const Z = Math.ceil(V / a(this, J)) - 1, F = Array.from({ length: Z });
957
+ l.push([R, u[R], F]);
958
+ }
959
+ }), f > 5e3 && a(this, $) === !1 && a(this, tt) === !1 && g(this, C, !0), y > 0 && O(this, gt, $t).call(this), l.length ? (O(this, Ht, ee).call(this, l), O(this, Yt, se).call(this).then(() => n(O(this, nt, pt).call(this)))) : n(O(this, nt, pt).call(this));
954
960
  });
955
961
  });
956
- }, at = new WeakSet(), Gt = function(r) {
962
+ }, Ot = new WeakSet(), zt = function(s) {
957
963
  return new Promise((e) => {
958
- const a = N(this, lt, Ft).call(this, r);
959
- let h = 0;
960
- u(this, x).call(this, a, (l) => {
961
- Object.entries(l).forEach(([f, R]) => {
962
- const S = R.error();
963
- S && (u(this, W)[f] = S, h += 1);
964
- const i = N(this, K, st).call(this, R.data()), M = Array.isArray(i) ? i.length : 0, p = N(this, v, yt).call(this, R.total(), M);
965
- u(this, I)[f] = p;
966
- }), h > 0 && N(this, ft, Wt).call(this), e(N(this, q, Tt).call(this));
964
+ const o = O(this, St, vt).call(this, s);
965
+ let n = 0;
966
+ a(this, z).call(this, o, (u) => {
967
+ Object.entries(u).forEach(([l, y]) => {
968
+ const f = y.error();
969
+ f && (this.errors[l] = f, n += 1);
970
+ const i = O(this, et, lt).call(this, y.data()), R = Array.isArray(i) ? i.length : 0, d = O(this, ot, bt).call(this, y.total(), R);
971
+ a(this, Y)[l] = d;
972
+ }), n > 0 && O(this, gt, $t).call(this), e(O(this, nt, pt).call(this));
967
973
  });
968
974
  });
969
- }, Mt = new WeakSet(), Jt = function(r) {
975
+ }, Ht = new WeakSet(), ee = function(s) {
970
976
  let e = [];
971
- r.forEach(([a, h, l]) => {
972
- l.forEach((f, R) => {
973
- const S = R + 1, i = u(this, C) * S, p = [[a, S].join("_"), N(this, Lt, Xt).call(this, h, i)];
974
- e.length === u(this, C) ? (u(this, X).push(e), e = [p]) : e.push(p);
977
+ s.forEach(([o, n, u]) => {
978
+ u.forEach((l, y) => {
979
+ const f = y + 1, i = a(this, J) * f, d = [[o, f].join("_"), O(this, Ut, re).call(this, n, i)];
980
+ e.length === a(this, J) ? (a(this, K).push(e), e = [d]) : e.push(d);
975
981
  });
976
- }), e.length && u(this, X).push(e);
977
- }, gt = new WeakSet(), xt = function() {
978
- const r = [], e = [], a = (h) => {
979
- Object.entries(h).forEach(([l, f]) => {
980
- const [R] = l.split("_"), S = N(this, K, st).call(this, f.data());
981
- Array.isArray(S) && u(this, I)[R].push(...S), N(this, nt, Dt).call(this, { key: R, value: f });
982
+ }), e.length && a(this, K).push(e);
983
+ }, Yt = new WeakSet(), se = function() {
984
+ const s = [], e = [], o = (n) => {
985
+ Object.entries(n).forEach(([u, l]) => {
986
+ const [y] = u.split("_"), f = O(this, et, lt).call(this, l.data());
987
+ Array.isArray(f) && a(this, Y)[y].push(...f), O(this, ft, xt).call(this, { key: y, value: l });
982
988
  });
983
989
  };
984
- return u(this, X).forEach((h, l) => {
985
- const f = Object.fromEntries(h), R = () => new Promise((S) => u(this, x).call(this, f, (i) => {
986
- u(this, B) ? a(i) : e[l] = i, S();
990
+ return a(this, K).forEach((n, u) => {
991
+ const l = Object.fromEntries(n), y = () => new Promise((f) => a(this, z).call(this, l, (i) => {
992
+ a(this, C) ? o(i) : e[u] = i, f();
987
993
  }));
988
- r.push(R);
989
- }), u(this, B) ? N(this, ct, Ct).call(this, r) : N(this, mt, Pt).call(this, r).then(() => {
990
- e.forEach(a);
994
+ s.push(y);
995
+ }), a(this, C) ? O(this, At, qt).call(this, s) : O(this, Tt, Qt).call(this, s).then(() => {
996
+ e.forEach(o);
991
997
  });
992
- }, ut = new WeakSet(), Bt = function() {
993
- return new Promise((r) => setTimeout(r, 500));
994
- }, ct = new WeakSet(), Ct = function(r) {
995
- if (!r.length)
998
+ }, yt = new WeakSet(), Kt = function() {
999
+ return new Promise((s) => setTimeout(s, 500));
1000
+ }, At = new WeakSet(), qt = function(s) {
1001
+ if (!s.length)
996
1002
  return Promise.resolve();
997
- const e = r.shift();
1003
+ const e = s.shift();
998
1004
  return Promise.allSettled([
999
1005
  e(),
1000
- N(this, ut, Bt).call(this)
1001
- ]).then(() => u(this, j) ? N(this, ct, Ct).call(this, r) : Promise.resolve());
1002
- }, mt = new WeakSet(), Pt = function(r) {
1003
- if (!r.length)
1006
+ O(this, yt, Kt).call(this)
1007
+ ]).then(() => a(this, q) ? O(this, At, qt).call(this, s) : Promise.resolve());
1008
+ }, Tt = new WeakSet(), Qt = function(s) {
1009
+ if (!s.length)
1004
1010
  return Promise.resolve();
1005
- const e = r.shift();
1006
- return N(this, ut, Bt).call(this).then(() => e()).then(() => u(this, j) ? N(this, mt, Pt).call(this, r) : Promise.resolve());
1007
- }, q = new WeakSet(), Tt = function() {
1008
- return Object.entries(u(this, it)).forEach(([r, e]) => {
1009
- u(this, I)[r] && (u(this, I)[r] = e(u(this, I)[r]));
1010
- }), u(this, I);
1011
- }, lt = new WeakSet(), Ft = function(r) {
1012
- return Object.entries(r).reduce((e, [a, h]) => {
1013
- if (Array.isArray(h)) {
1014
- const [l, f = {}] = h;
1015
- e[a] = [l, f];
1011
+ const e = s.shift();
1012
+ return O(this, yt, Kt).call(this).then(() => e()).then(() => a(this, q) ? O(this, Tt, Qt).call(this, s) : Promise.resolve());
1013
+ }, nt = new WeakSet(), pt = function() {
1014
+ return Object.entries(a(this, ut)).forEach(([s, e]) => {
1015
+ a(this, Y)[s] && (a(this, Y)[s] = e(a(this, Y)[s]));
1016
+ }), a(this, Y);
1017
+ }, St = new WeakSet(), vt = function(s) {
1018
+ return Object.entries(s).reduce((e, [o, n]) => {
1019
+ if (Array.isArray(n)) {
1020
+ const [u, l = {}] = n;
1021
+ e[o] = [u, l];
1016
1022
  } else {
1017
- const { method: l, params: f = {} } = h;
1018
- e[a] = [l, f];
1023
+ const { method: u, params: l = {} } = n;
1024
+ e[o] = [u, l];
1019
1025
  }
1020
1026
  return e;
1021
1027
  }, {});
1022
- }, Lt = new WeakSet(), Xt = function(r, e) {
1023
- const [a, h] = r;
1024
- return [a, { start: e, ...h }];
1025
- }, K = new WeakSet(), st = function(r) {
1026
- return ((r == null ? void 0 : r.items) || (r == null ? void 0 : r.documents)) ?? r;
1027
- }, v = new WeakSet(), yt = function(r, e) {
1028
- return r !== r && (r = 0), r === 0 && e === 0 ? 0 : r || e;
1029
- }, ft = new WeakSet(), Wt = function() {
1030
- console.group(`${this.constructor.name}: Ошибки в методах!`), Object.entries(u(this, W)).forEach(([r, e]) => {
1031
- console.info(`[${r}]`, e.toString());
1028
+ }, Ut = new WeakSet(), re = function(s, e) {
1029
+ const [o, n] = s;
1030
+ return [o, { start: e, ...n }];
1031
+ }, et = new WeakSet(), lt = function(s) {
1032
+ return ((s == null ? void 0 : s.items) || (s == null ? void 0 : s.documents)) ?? s;
1033
+ }, ot = new WeakSet(), bt = function(s, e) {
1034
+ return s !== s && (s = 0), s === 0 && e === 0 ? 0 : s || e;
1035
+ }, gt = new WeakSet(), $t = function() {
1036
+ console.group(`${this.constructor.name}: Ошибки в методах!`), Object.entries(this.errors).forEach(([s, e]) => {
1037
+ console.info(`[${s}]`, e.toString());
1032
1038
  }), console.groupEnd();
1033
1039
  };
1034
- var dt, jt, pt, kt;
1035
- class te {
1036
- constructor(r) {
1040
+ var st;
1041
+ class Oe {
1042
+ constructor() {
1043
+ _(this, st, {});
1044
+ }
1045
+ get hash() {
1046
+ return this.createHash(8);
1047
+ }
1048
+ /** Генератор хеш-кода */
1049
+ createHash(s) {
1050
+ let e = "abcdefghijklmnopqrstuvwxyz0123456789", o = "";
1051
+ s = s || 6;
1052
+ for (let n = 0; n < s; n++)
1053
+ o += e.charAt(Math.floor(Math.random() * e.length));
1054
+ return o;
1055
+ }
1056
+ /** Фильтр часто запускаемых действий */
1057
+ actionFilter({ keyTimer: s, duration: e = 10, action: o }) {
1058
+ a(this, st)[s] && (clearTimeout(a(this, st)[s]), a(this, st)[s] = null), o && (a(this, st)[s] = setTimeout(() => {
1059
+ o();
1060
+ }, e));
1061
+ }
1062
+ }
1063
+ st = new WeakMap();
1064
+ const Wt = new Oe();
1065
+ var P, x, It, rt, Et, Gt, ie, Rt, te, Bt, ne, wt, oe, Ct, he;
1066
+ class ye {
1067
+ constructor() {
1068
+ _(this, Gt);
1069
+ /** Вывод ошибок логера
1070
+ * @param {'entity'} type - тип ошибки
1071
+ */
1072
+ _(this, Rt);
1073
+ _(this, Bt);
1074
+ _(this, wt);
1075
+ _(this, Ct);
1076
+ _(this, P, "logger");
1077
+ _(this, x, !1);
1078
+ _(this, It, 2e3);
1079
+ _(this, rt, /* @__PURE__ */ new Map());
1080
+ _(this, Et, {});
1081
+ /** Очистка хранилища элементов старше 'N' месяцев */
1082
+ w(this, "periodClear", 3);
1083
+ O(this, Gt, ie).call(this);
1084
+ }
1085
+ /** Инициализация логера */
1086
+ async init() {
1087
+ let s = new j(BX24.callBatch), { entityList: e } = await s.batch({
1088
+ entityList: { method: "entity.get" }
1089
+ });
1090
+ if (console.log(e), e != null && e.length)
1091
+ if (e.find((n) => n.ENTITY == a(this, P)))
1092
+ g(this, x, !0);
1093
+ else {
1094
+ let { entityAdd: n } = await s.batch({
1095
+ entityAdd: {
1096
+ method: "entity.add",
1097
+ params: {
1098
+ ENTITY: a(this, P),
1099
+ NAME: a(this, P),
1100
+ ACCESS: { AU: "X" }
1101
+ }
1102
+ }
1103
+ });
1104
+ n && g(this, x, !0);
1105
+ }
1106
+ return O(this, wt, oe).call(this), a(this, x);
1107
+ }
1108
+ /**
1109
+ * @param {{ type: 'call'|'batch'|'batch-total-count';
1110
+ * data: {
1111
+ * method: string,
1112
+ * params: { [key]: any }
1113
+ * }|{ commandList: { [key]: any }
1114
+ * }; }}
1115
+ * @returns {string}
1116
+ */
1117
+ start({ type: s, data: e }) {
1118
+ if (!a(this, x)) {
1119
+ O(this, Rt, te).call(this, "entity");
1120
+ return;
1121
+ }
1122
+ const o = Wt.hash;
1123
+ return a(this, rt).set(o, {
1124
+ type: s,
1125
+ data: e,
1126
+ userInfo: a(this, Et),
1127
+ errorList: [],
1128
+ status: "",
1129
+ answer: null,
1130
+ date: (/* @__PURE__ */ new Date()).getTime()
1131
+ }), o;
1132
+ }
1133
+ /**
1134
+ * @param {{
1135
+ * key: string;
1136
+ * errorList: any[];
1137
+ * status: 'success'|'fail'|'fail-runtime',
1138
+ * answer: { [key]: unknown } }}
1139
+ */
1140
+ stop({ key: s, errorList: e, status: o, answer: n }) {
1141
+ if (!a(this, x)) {
1142
+ O(this, Rt, te).call(this, "entity");
1143
+ return;
1144
+ }
1145
+ let u = a(this, rt).get(s);
1146
+ e && (u.errorList = e), o && (u.status = o), n && (u.answer = n), Wt.actionFilter({
1147
+ keyTimer: "add.entity.items",
1148
+ duration: a(this, It),
1149
+ action: () => {
1150
+ O(this, Bt, ne).call(this);
1151
+ }
1152
+ });
1153
+ }
1154
+ async getEntityList() {
1155
+ let s = new j(BX24.callBatch), { entityList: e } = await s.batch({
1156
+ entityList: {
1157
+ method: "entity.item.get",
1158
+ params: {
1159
+ ENTITY: a(this, P)
1160
+ }
1161
+ }
1162
+ });
1163
+ return e = e.map((o) => {
1164
+ const { ID: n, DATE_CREATE: u, DETAIL_TEXT: l } = o;
1165
+ return {
1166
+ ...JSON.parse(l),
1167
+ id: n,
1168
+ dateCreate: u
1169
+ };
1170
+ }), console.log("entityList", e), e;
1171
+ }
1172
+ }
1173
+ P = new WeakMap(), x = new WeakMap(), It = new WeakMap(), rt = new WeakMap(), Et = new WeakMap(), Gt = new WeakSet(), ie = async function() {
1174
+ const s = new j(BX24.callBatch), e = BX24.isAdmin(), { curUser: o } = await s.batch({
1175
+ curUser: { method: "user.current" }
1176
+ });
1177
+ g(this, Et, { isAdmin: e, curUser: o });
1178
+ }, Rt = new WeakSet(), te = function(s) {
1179
+ s == "entity" && Wt.actionFilter({
1180
+ keyTimer: "error.logger.entity",
1181
+ duration: 500,
1182
+ action: () => {
1183
+ console.error("Хранилище для логгера не инициализировано");
1184
+ }
1185
+ });
1186
+ }, Bt = new WeakSet(), ne = async function() {
1187
+ let s = {}, e = new j(BX24.callBatch);
1188
+ for (let [o, n] of a(this, rt).entries())
1189
+ n.status && (s[o] = {
1190
+ method: "entity.item.add",
1191
+ params: {
1192
+ ENTITY: a(this, P),
1193
+ NAME: a(this, P),
1194
+ DETAIL_TEXT: JSON.stringify(n)
1195
+ }
1196
+ });
1197
+ if (Object.keys(s).length) {
1198
+ let o = await e.batch(s), { errors: n } = e;
1199
+ for (let [u, l] of Object.entries({ ...o, ...n }))
1200
+ a(this, rt).delete(u);
1201
+ }
1202
+ }, wt = new WeakSet(), oe = async function() {
1203
+ let s = new j(BX24.callBatch), e = await this.getEntityList(), { serverTime: o } = await s.batch({
1204
+ serverTime: { method: "server.time" }
1205
+ }), n = e.filter((u) => {
1206
+ let { dateCreate: l } = u;
1207
+ return jt(new Date(l)).between(jt(new Date(o)), "month") >= this.periodClear;
1208
+ });
1209
+ O(this, Ct, he).call(this, n);
1210
+ }, Ct = new WeakSet(), he = async function(s) {
1211
+ let e = new j(BX24.callBatch), o = s.map((n) => {
1212
+ let { id: u } = n;
1213
+ return {
1214
+ method: "entity.item.delete",
1215
+ params: {
1216
+ ENTITY: a(this, P),
1217
+ ID: u
1218
+ }
1219
+ };
1220
+ });
1221
+ return await e.batch(o);
1222
+ };
1223
+ const G = new ye();
1224
+ var Pt, ae, Ft, ce;
1225
+ class Te {
1226
+ constructor(s) {
1037
1227
  /** Запрос данных о приложении */
1038
- _(this, dt);
1228
+ _(this, Pt);
1039
1229
  /** Запрос данных о текущем пользователе */
1040
- _(this, pt);
1041
- F(this, "domain", "");
1042
- F(this, "isAdmin", !1);
1043
- F(this, "appInfo", null);
1044
- F(this, "appConst", null);
1045
- F(this, "userInfo", null);
1046
- F(this, "placeData", null);
1047
- F(this, "placeInfo", null);
1048
- this.appConst = r;
1230
+ _(this, Ft);
1231
+ w(this, "domain", "");
1232
+ w(this, "isAdmin", !1);
1233
+ w(this, "appInfo", null);
1234
+ w(this, "appConst", null);
1235
+ w(this, "userInfo", null);
1236
+ w(this, "placeData", null);
1237
+ w(this, "placeInfo", null);
1238
+ this.appConst = s;
1049
1239
  }
1050
1240
  init() {
1051
- return new Promise((r) => {
1241
+ return new Promise((s) => {
1052
1242
  let e = setInterval(() => {
1053
1243
  window.BX24 && BX24.init(async () => {
1054
- console.info("init BX24"), clearInterval(e), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info();
1055
- const [a, h] = await Promise.all([
1056
- N(this, dt, jt).call(this),
1057
- N(this, pt, kt).call(this)
1244
+ console.info("init BX24"), clearInterval(e), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), await G.init();
1245
+ const [o, n] = await Promise.all([
1246
+ O(this, Pt, ae).call(this),
1247
+ O(this, Ft, ce).call(this)
1058
1248
  ]);
1059
- this.appInfo = a, this.userInfo = h, r(!0);
1249
+ this.appInfo = o, this.userInfo = n, s(!0);
1060
1250
  });
1061
1251
  }, 100);
1062
1252
  });
1063
1253
  }
1064
- userOption(r, e) {
1065
- return e ? BX24.userOption.set(r, e) : BX24.userOption.get(r);
1254
+ userOption(s, e) {
1255
+ return e ? BX24.userOption.set(s, e) : BX24.userOption.get(s);
1066
1256
  }
1067
- call({ method: r, params: e }) {
1068
- return new Promise((a) => {
1069
- e || (e = {}), BX24.callMethod(r, e, function(h) {
1070
- if (h.error()) {
1071
- let l = h.error();
1072
- console.error(l), a(!1);
1257
+ /**
1258
+ * @param {{
1259
+ * method: string;
1260
+ * params: any;
1261
+ * updateList: {
1262
+ * method: string,
1263
+ * list: {
1264
+ * id: string | number,
1265
+ * fields: { [key: string]: string | number | string[] | number[] }
1266
+ * }[]
1267
+ * }[]
1268
+ */
1269
+ call({ method: s, params: e, updateList: o }) {
1270
+ let n = G.start({
1271
+ type: "call",
1272
+ data: { method: s, params: e, updateList: o }
1273
+ });
1274
+ return new Promise((u) => {
1275
+ e || (e = {}), BX24.callMethod(s, e, function(l) {
1276
+ let y = {};
1277
+ if (l != null && l.answer)
1278
+ for (let [f, i] of Object.entries(l.answer))
1279
+ f != "result" && i && (y[f] = i);
1280
+ if (l.error()) {
1281
+ let f = l.error();
1282
+ console.error(f), G.stop({
1283
+ answer: y,
1284
+ key: n,
1285
+ status: "fail",
1286
+ errorList: [f.toSting()]
1287
+ }), u(!1);
1073
1288
  } else {
1074
- let l = h.data();
1075
- l != null && l.items && (l = l.items), a(l);
1289
+ let f = l.data();
1290
+ f != null && f.items && (f = f.items), G.stop({
1291
+ answer: y,
1292
+ key: n,
1293
+ status: "success"
1294
+ }), u(f);
1076
1295
  }
1077
1296
  });
1078
1297
  });
@@ -1080,58 +1299,124 @@ class te {
1080
1299
  /**
1081
1300
  * @param commandList - объект/массив команд
1082
1301
  * @param progressCall - callback(data), в data приходят данные о загрузке данных
1302
+ * @param {{ updateList: {
1303
+ * method: string,
1304
+ * list: {
1305
+ * id: string | number,
1306
+ * fields: { [key: string]: string | number | string[] | number[] }
1307
+ * }[]
1308
+ * }[] }}
1083
1309
  */
1084
- batch(r, e) {
1085
- return new wt(BX24.callBatch).batch(r, e);
1310
+ async batch(s, e, { updateList: o } = {}) {
1311
+ let n = new j(BX24.callBatch), u = G.start({
1312
+ type: "batch",
1313
+ data: { commandList: s, updateList: o }
1314
+ });
1315
+ try {
1316
+ let l = await n.batch(s, e);
1317
+ if (Object.keys(n.errors).length) {
1318
+ let y = Object.entries(n.errors).map(([f, i]) => ({
1319
+ key: f,
1320
+ error: i.toSting()
1321
+ }));
1322
+ G.stop({
1323
+ key: u,
1324
+ status: "fail",
1325
+ errorList: y,
1326
+ answer: n.answerData
1327
+ });
1328
+ } else
1329
+ G.stop({
1330
+ key: u,
1331
+ status: "success",
1332
+ answer: n.answerData
1333
+ });
1334
+ return l;
1335
+ } catch (l) {
1336
+ return G.stop({
1337
+ key: u,
1338
+ status: "fail-runtime",
1339
+ errorList: [l.toSting()],
1340
+ answer: n.answerData
1341
+ }), console.error(l), !1;
1342
+ }
1086
1343
  }
1087
1344
  /**
1088
1345
  * @param commandList - объект/массив команд
1089
1346
  * @param progressCall - callback(data), в data приходят данные о загрузке данных
1090
1347
  */
1091
- batchTotalCount(r, e) {
1092
- return new wt(BX24.callBatch).batchTotalCount(r, e);
1348
+ async batchTotalCount(s, e) {
1349
+ let o = new j(BX24.callBatch), n = G.start({
1350
+ type: "batch",
1351
+ data: { commandList: s }
1352
+ });
1353
+ try {
1354
+ let u = await o.batchTotalCount(s, e);
1355
+ if (Object.keys(o.errors).length) {
1356
+ let l = Object.entries(o.errors).map(([y, f]) => ({
1357
+ key: y,
1358
+ error: f.toSting()
1359
+ }));
1360
+ G.stop({
1361
+ key: n,
1362
+ status: "fail",
1363
+ errorList: l
1364
+ });
1365
+ } else
1366
+ G.stop({
1367
+ key: n,
1368
+ status: "success"
1369
+ });
1370
+ return u;
1371
+ } catch (u) {
1372
+ return G.stop({
1373
+ key: n,
1374
+ status: "fail",
1375
+ errorList: [u.toSting()]
1376
+ }), console.error(u), !1;
1377
+ }
1093
1378
  }
1094
1379
  /** Запрос данных о местах встройки приложения */
1095
1380
  getPlacement() {
1096
- return this.call({ method: "placement.get" }).then((r) => (this.placeData || (this.placeData = r), r));
1381
+ return this.call({ method: "placement.get" }).then((s) => (this.placeData || (this.placeData = s), s));
1097
1382
  }
1098
1383
  /** Встройка приложения в place */
1099
- async placementBind(r) {
1384
+ async placementBind(s) {
1100
1385
  this.placeData || (this.placeData = await this.getPlacement());
1101
- const { appName: e, pathApp: a } = this.appConst, h = this.placeData.map((f) => f.placement);
1102
- let l = this.placeData.find((f) => f.placement == r);
1103
- h.includes(r) ? l.handler != a && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[r] || this.placementUnBind(l).then(() => {
1104
- window.placementUnBind[r] || (window.placementUnBind[r] = !0, this.placementBind(r));
1386
+ const { appName: e, pathApp: o } = this.appConst, n = this.placeData.map((l) => l.placement);
1387
+ let u = this.placeData.find((l) => l.placement == s);
1388
+ n.includes(s) ? u.handler != o && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[s] || this.placementUnBind(u).then(() => {
1389
+ window.placementUnBind[s] || (window.placementUnBind[s] = !0, this.placementBind(s));
1105
1390
  })) : this.call({
1106
1391
  method: "placement.bind",
1107
1392
  params: {
1108
- PLACEMENT: r,
1109
- HANDLER: a,
1393
+ PLACEMENT: s,
1394
+ HANDLER: o,
1110
1395
  LANG_ALL: {
1111
1396
  ru: {
1112
1397
  TITLE: e
1113
1398
  }
1114
1399
  }
1115
1400
  }
1116
- }).then((f) => {
1117
- f ? console.info("Приложение успешно встроено в", r) : console.warn("Приложение не может быть встроено в", r);
1401
+ }).then((l) => {
1402
+ l ? console.info("Приложение успешно встроено в", s) : console.warn("Приложение не может быть встроено в", s);
1118
1403
  });
1119
1404
  }
1120
1405
  /** Отвязка встройки из place */
1121
- placementUnBind(r) {
1122
- const { pathApp: e, appName: a } = this.appConst;
1406
+ placementUnBind(s) {
1407
+ const { pathApp: e, appName: o } = this.appConst;
1123
1408
  return this.call({
1124
1409
  method: "placement.unbind",
1125
1410
  params: {
1126
- PLACEMENT: r,
1411
+ PLACEMENT: s,
1127
1412
  HANDLER: e,
1128
1413
  LANG_ALL: {
1129
1414
  ru: {
1130
- TITLE: a
1415
+ TITLE: o
1131
1416
  }
1132
1417
  }
1133
1418
  }
1134
- }).then((h) => (console.log("Встройка отвязана", r), h));
1419
+ }).then((n) => (console.log("Встройка отвязана", s), n));
1135
1420
  }
1136
1421
  /** Чат-бот */
1137
1422
  /* получение списка ботов */
@@ -1139,22 +1424,22 @@ class te {
1139
1424
  return this.call({
1140
1425
  method: "imbot.bot.list",
1141
1426
  params: {}
1142
- }).then((r) => {
1143
- let e = Object.values(r);
1427
+ }).then((s) => {
1428
+ let e = Object.values(s);
1144
1429
  return console.log("chat-bot list:", e), e;
1145
1430
  });
1146
1431
  }
1147
1432
  /* регистрация бота */
1148
- regBot({ code: r, type: e, name: a }) {
1149
- const { appName: h, pathApp: l, chatBotLogo: f } = this.appConst, R = this.appInfo.ID;
1433
+ regBot({ code: s, type: e, name: o }) {
1434
+ const { appName: n, pathApp: u, chatBotLogo: l } = this.appConst, y = this.appInfo.ID;
1150
1435
  return this.call({
1151
1436
  method: "imbot.register",
1152
1437
  params: {
1153
- CODE: r ?? this.appInfo.CODE,
1438
+ CODE: s ?? this.appInfo.CODE,
1154
1439
  // Строковой идентификатор бота, уникальный в рамках вашего приложения (обяз.)
1155
1440
  TYPE: e ?? "O",
1156
1441
  // Тип бота, B - чат-бот, ответы поступают сразу, H - человек, ответы поступают с задержкой от 2-х до 10 секунд, O - чат-бот для Открытых линий, S - чат-бот с повышенными привилегиями (supervisor)
1157
- EVENT_HANDLER: l,
1442
+ EVENT_HANDLER: u,
1158
1443
  // Ссылка на обработчик событий, поступивших от сервера - см. Обработчики событий ниже (обяз).
1159
1444
  OPENLINE: "Y",
1160
1445
  // Включение режима поддержки Открытых линий, можно не указывать, если TYPE = 'O'
@@ -1162,7 +1447,7 @@ class te {
1162
1447
  // строковый идентификатор чат-бота, используется только в режиме Вебхуков
1163
1448
  PROPERTIES: {
1164
1449
  // Личные данные чат-бота (обяз.)
1165
- NAME: `${a ?? h} - бот #${R}`,
1450
+ NAME: `${o ?? n} - бот #${y}`,
1166
1451
  // Имя чат-бота (обязательное одно из полей NAME или LAST_NAME)
1167
1452
  LAST_NAME: "",
1168
1453
  // Фамилия чат-бота (обязательное одно из полей NAME или LAST_NAME)
@@ -1170,7 +1455,7 @@ class te {
1170
1455
  // Цвет чат-бота для мобильного приложения RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, PINK, LIME, BROWN, AZURE, KHAKI, SAND, MARENGO, GRAY, GRAPHITE
1171
1456
  EMAIL: "",
1172
1457
  // E-mail для связи. НЕЛЬЗЯ использовать e-mail, дублирующий e-mail реальных пользователей
1173
- PERSONAL_BIRTHDAY: vt().format("%Y-%m-%d"),
1458
+ PERSONAL_BIRTHDAY: jt().format("%Y-%m-%d"),
1174
1459
  // День рождения в формате YYYY-mm-dd
1175
1460
  WORK_POSITION: "Почтальон",
1176
1461
  // Занимаемая должность, используется как описание чат-бота
@@ -1178,29 +1463,31 @@ class te {
1178
1463
  // Ссылка на сайт
1179
1464
  PERSONAL_GENDER: "M",
1180
1465
  // Пол чат-бота, допустимые значения M - мужской, F - женский, пусто, если не требуется указывать
1181
- PERSONAL_PHOTO: f ?? ""
1466
+ PERSONAL_PHOTO: l ?? ""
1182
1467
  // Аватар чат-бота - base64
1183
1468
  }
1184
1469
  }
1185
- }).then((S) => (console.log("Чат-бот добавлен", S), S));
1470
+ }).then((f) => (console.log("Чат-бот добавлен", f), f));
1186
1471
  }
1187
1472
  /* Убрать регистрацию бота */
1188
- unRegBot(r) {
1473
+ unRegBot(s) {
1189
1474
  return this.call({
1190
1475
  method: "imbot.unregister",
1191
1476
  params: {
1192
- BOT_ID: r
1477
+ BOT_ID: s
1193
1478
  }
1194
1479
  }).then((e) => (console.log("чат-бот удален", e), e));
1195
1480
  }
1196
1481
  }
1197
- dt = new WeakSet(), jt = function() {
1482
+ Pt = new WeakSet(), ae = function() {
1198
1483
  return this.call({ method: "app.info" });
1199
- }, pt = new WeakSet(), kt = function() {
1484
+ }, Ft = new WeakSet(), ce = function() {
1200
1485
  return this.call({ method: "user.current" });
1201
1486
  };
1202
1487
  export {
1203
- wt as Batch,
1204
- te as BxBoot,
1205
- vt as tempus
1488
+ j as Batch,
1489
+ Te as BxBoot,
1490
+ Oe as BxHelper,
1491
+ ye as BxLogger,
1492
+ jt as tempus
1206
1493
  };