szdl-utils-kit 0.2.25 → 0.2.27

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 DELETED
@@ -1,1567 +0,0 @@
1
- var fe = Object.defineProperty;
2
- var Ne = (y, A, e) => A in y ? fe(y, A, { enumerable: !0, configurable: !0, writable: !0, value: e }) : y[A] = e;
3
- var U = (y, A, e) => (Ne(y, typeof A != "symbol" ? A + "" : A, e), e), xt = (y, A, e) => {
4
- if (!A.has(y))
5
- throw TypeError("Cannot " + e);
6
- };
7
- var o = (y, A, e) => (xt(y, A, "read from private field"), e ? e.call(y) : A.get(y)), f = (y, A, e) => {
8
- if (A.has(y))
9
- throw TypeError("Cannot add the same private member more than once");
10
- A instanceof WeakSet ? A.add(y) : A.set(y, e);
11
- }, d = (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 _e = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
- function Oe(y) {
15
- return y && y.__esModule && Object.prototype.hasOwnProperty.call(y, "default") ? y.default : y;
16
- }
17
- var jt = { exports: {} };
18
- (function(y, A) {
19
- (function(e) {
20
- Array.prototype.indexOf || (Array.prototype.indexOf = function(t, s) {
21
- var h, l;
22
- for (h = s || 0, l = this.length; h < l; h += 1)
23
- if (this[h] === t)
24
- return h;
25
- return -1;
26
- });
27
- var n = this, r = function(t, s) {
28
- for (var h = t.toString(); h.length < s; )
29
- h = "0" + h;
30
- return h;
31
- }, a = 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
- }, c = function(t, s) {
34
- var h, l = "";
35
- return h = t.slice(s, s + 1), h !== "" && !isNaN(Number(h)) && (l += "%H"), h = t.charAt(s + 2), h !== "" && h === ":" && (l += h), h = t.slice(s + 3, s + 4), h !== "" && !isNaN(Number(h)) && (l += "%M"), h = t.charAt(s + 5), h !== "" && h === ":" && (l += h), h = t.slice(s + 6, s + 7), h !== "" && !isNaN(Number(h)) && (l += "%S"), l;
36
- }, O = function(t, s) {
37
- var h, l = [
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
- ], L;
44
- return !isNaN(Number(l[0])) && !isNaN(Number(l[2])) && !isNaN(Number(l[4])) ? (l[1] === "." && l[3] === "." ? h = "%d.%m.%Y" : l[1] === "-" && l[3] === "-" ? h = "%m-%d-%Y" : l[1] === "/" && l[3] === "/" && (h = "%m/%d/%Y"), h) : (L = [
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(L[0])) && !isNaN(Number(L[2])) && !isNaN(Number(L[4])) ? (L[1] === "-" && L[3] === "-" && (h = "%Y-%m-%d"), h) : "");
51
- }, u = n.tempus, i, T, E = n.navigator || {}, m = "en", N = {
52
- en: {
53
- JANUARY_SHORT: "Jan",
54
- FEBRUARY_SHORT: "Feb",
55
- MARCH_SHORT: "Mar",
56
- APRIL_SHORT: "Apr",
57
- MAY_SHORT: "May",
58
- JUNE_SHORT: "Jun",
59
- JULY_SHORT: "Jul",
60
- AUGUST_SHORT: "Aug",
61
- SEPTEMBER_SHORT: "Sep",
62
- OCTOBER_SHORT: "Oct",
63
- NOVEMBER_SHORT: "Nov",
64
- DECEMBER_SHORT: "Dec",
65
- JANUARY_LONG: "January",
66
- FEBRUARY_LONG: "February",
67
- MARCH_LONG: "March",
68
- APRIL_LONG: "April",
69
- MAY_LONG: "May",
70
- JUNE_LONG: "June",
71
- JULY_LONG: "July",
72
- AUGUST_LONG: "August",
73
- SEPTEMBER_LONG: "September",
74
- OCTOBER_LONG: "October",
75
- NOVEMBER_LONG: "November",
76
- DECEMBER_LONG: "December",
77
- SUNDAY_SHORT: "Sun",
78
- MONDAY_SHORT: "Mon",
79
- TUESDAY_SHORT: "Tue",
80
- WEDNESDAY_SHORT: "Wed",
81
- THURSDAY_SHORT: "Thu",
82
- FRIDAY_SHORT: "Fri",
83
- SATURDAY_SHORT: "Sat",
84
- SUNDAY_LONG: "Sunday",
85
- MONDAY_LONG: "Monday",
86
- TUESDAY_LONG: "Tuesday",
87
- WEDNESDAY_LONG: "Wednesday",
88
- THURSDAY_LONG: "Thursday",
89
- FRIDAY_LONG: "Friday",
90
- SATURDAY_LONG: "Saturday"
91
- },
92
- ru: {
93
- JANUARY_SHORT: "Янв",
94
- FEBRUARY_SHORT: "Фев",
95
- MARCH_SHORT: "Мар",
96
- APRIL_SHORT: "Апр",
97
- MAY_SHORT: "Май",
98
- JUNE_SHORT: "Июн",
99
- JULY_SHORT: "Июл",
100
- AUGUST_SHORT: "Авг",
101
- SEPTEMBER_SHORT: "Сен",
102
- OCTOBER_SHORT: "Окт",
103
- NOVEMBER_SHORT: "Ноя",
104
- DECEMBER_SHORT: "Дек",
105
- JANUARY_LONG: "Январь",
106
- FEBRUARY_LONG: "Февраль",
107
- MARCH_LONG: "Март",
108
- APRIL_LONG: "Апрель",
109
- MAY_LONG: "Май",
110
- JUNE_LONG: "Июнь",
111
- JULY_LONG: "Июль",
112
- AUGUST_LONG: "Август",
113
- SEPTEMBER_LONG: "Сентябрь",
114
- OCTOBER_LONG: "Октябрь",
115
- NOVEMBER_LONG: "Ноябрь",
116
- DECEMBER_LONG: "Декабрь",
117
- SUNDAY_SHORT: "Вс",
118
- MONDAY_SHORT: "Пн",
119
- TUESDAY_SHORT: "Вт",
120
- WEDNESDAY_SHORT: "Ср",
121
- THURSDAY_SHORT: "Чт",
122
- FRIDAY_SHORT: "Пт",
123
- SATURDAY_SHORT: "Сб",
124
- SUNDAY_LONG: "Воскресенье",
125
- MONDAY_LONG: "Понедельник",
126
- TUESDAY_LONG: "Вторник",
127
- WEDNESDAY_LONG: "Среда",
128
- THURSDAY_LONG: "Четверг",
129
- FRIDAY_LONG: "Пятница",
130
- SATURDAY_LONG: "Суббота"
131
- },
132
- ua: {
133
- JANUARY_SHORT: "Січ",
134
- FEBRUARY_SHORT: "Лют",
135
- MARCH_SHORT: "Берез",
136
- APRIL_SHORT: "Квіт",
137
- MAY_SHORT: "Трав",
138
- JUNE_SHORT: "Черв",
139
- JULY_SHORT: "Лип",
140
- AUGUST_SHORT: "Серп",
141
- SEPTEMBER_SHORT: "Верес",
142
- OCTOBER_SHORT: "Жовт",
143
- NOVEMBER_SHORT: "Листоп",
144
- DECEMBER_SHORT: "Груд",
145
- JANUARY_LONG: "Січень",
146
- FEBRUARY_LONG: "Лютий",
147
- MARCH_LONG: "Березень",
148
- APRIL_LONG: "Квітень",
149
- MAY_LONG: "Травень",
150
- JUNE_LONG: "Червень",
151
- JULY_LONG: "Липень",
152
- AUGUST_LONG: "Серпень",
153
- SEPTEMBER_LONG: "Вересень",
154
- OCTOBER_LONG: "Жовтень",
155
- NOVEMBER_LONG: "Листопад",
156
- DECEMBER_LONG: "Грудень",
157
- SUNDAY_SHORT: "Нд",
158
- MONDAY_SHORT: "Пн",
159
- TUESDAY_SHORT: "Вт",
160
- WEDNESDAY_SHORT: "Ср",
161
- THURSDAY_SHORT: "Чт",
162
- FRIDAY_SHORT: "Пт",
163
- SATURDAY_SHORT: "Сб",
164
- SUNDAY_LONG: "Неділя",
165
- MONDAY_LONG: "Понеділок",
166
- TUESDAY_LONG: "Вівторок",
167
- WEDNESDAY_LONG: "Середа",
168
- THURSDAY_LONG: "Четвер",
169
- FRIDAY_LONG: "П’ятниця",
170
- SATURDAY_LONG: "Субота"
171
- },
172
- de: {
173
- JANUARY_SHORT: "Jan",
174
- FEBRUARY_SHORT: "Feb",
175
- MARCH_SHORT: "März",
176
- APRIL_SHORT: "Apr",
177
- MAY_SHORT: "Mai",
178
- JUNE_SHORT: "Juni",
179
- JULY_SHORT: "Juli",
180
- AUGUST_SHORT: "Aug",
181
- SEPTEMBER_SHORT: "Sept",
182
- OCTOBER_SHORT: "Okt",
183
- NOVEMBER_SHORT: "Nov",
184
- DECEMBER_SHORT: "Dez",
185
- JANUARY_LONG: "Januar",
186
- FEBRUARY_LONG: "Februar",
187
- MARCH_LONG: "März",
188
- APRIL_LONG: "April",
189
- MAY_LONG: "Mai",
190
- JUNE_LONG: "Juni",
191
- JULY_LONG: "Juli",
192
- AUGUST_LONG: "August",
193
- SEPTEMBER_LONG: "September",
194
- OCTOBER_LONG: "Oktober",
195
- NOVEMBER_LONG: "November",
196
- DECEMBER_LONG: "Dezember",
197
- SUNDAY_SHORT: "So",
198
- MONDAY_SHORT: "Mo",
199
- TUESDAY_SHORT: "Di",
200
- WEDNESDAY_SHORT: "Mi",
201
- THURSDAY_SHORT: "Do",
202
- FRIDAY_SHORT: "Fr",
203
- SATURDAY_SHORT: "Sa",
204
- SUNDAY_LONG: "Sonntag",
205
- MONDAY_LONG: "Montag",
206
- TUESDAY_LONG: "Dienstag",
207
- WEDNESDAY_LONG: "Mittwoch",
208
- THURSDAY_LONG: "Donnerstag",
209
- FRIDAY_LONG: "Freitag",
210
- SATURDAY_LONG: "Samstag"
211
- }
212
- }, G = function() {
213
- return [
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
- ];
227
- }, at = function() {
228
- return [
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
- ];
242
- }, V = function() {
243
- return [
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
- ];
252
- }, J = function() {
253
- return [
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
- ];
262
- }, F, Mt, ct, lt, me = function(t, s, h) {
263
- var l;
264
- n.XMLHttpRequest ? l = new XMLHttpRequest() : l = new ActiveXObject("Microsoft.XMLHTTP"), l.onreadystatechange = function() {
265
- l.readyState === 4 && (l.status === 200 ? s && (n.JSON === e ? alert(`Please, include json2 into your project if you want use old browsers!
266
- https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.parse(l.responseText))) : h && h(l));
267
- }, l.open("GET", t, !1), l.send();
268
- }, I = {
269
- "%d": {
270
- format: function(t) {
271
- return r(t.day() || i.MIN_DAY, 2);
272
- },
273
- parse: function(t) {
274
- var s = Number(t);
275
- return { day: isNaN(s) ? e : s };
276
- },
277
- minLength: 2,
278
- maxLength: 2,
279
- type: "number"
280
- },
281
- "%m": {
282
- format: function(t) {
283
- return r(t.month() || i.MIN_MONTH, 2);
284
- },
285
- parse: function(t) {
286
- var s = Number(t);
287
- return { month: isNaN(s) ? e : s };
288
- },
289
- minLength: 2,
290
- maxLength: 2,
291
- type: "number"
292
- },
293
- "%Y": {
294
- format: function(t) {
295
- return r(t.year() || i.MIN_YEAR, 4);
296
- },
297
- parse: function(t) {
298
- var s = Number(t);
299
- return { year: isNaN(s) ? e : s };
300
- },
301
- minLength: 4,
302
- maxLength: 4,
303
- type: "number"
304
- },
305
- "%w": {
306
- format: function(t) {
307
- return t.dayOfWeek() || i.MIN_DAY_OF_WEEK;
308
- },
309
- parse: function() {
310
- return {};
311
- },
312
- minLength: 1,
313
- maxLength: 1,
314
- type: "number"
315
- },
316
- "%a": {
317
- format: function(t) {
318
- var s = t.dayOfWeek();
319
- return lt[s !== e ? s : i.MIN_DAY_OF_WEEK];
320
- },
321
- parse: function() {
322
- return {};
323
- },
324
- minLength: 1,
325
- maxLength: 999,
326
- type: "word"
327
- },
328
- "%A": {
329
- format: function(t) {
330
- var s = t.dayOfWeek();
331
- return ct[s !== e ? s : i.MIN_DAY_OF_WEEK];
332
- },
333
- parse: function() {
334
- return {};
335
- },
336
- minLength: 1,
337
- maxLength: 999,
338
- type: "word"
339
- },
340
- "%b": {
341
- format: function(t) {
342
- var s = i.options("monthFromZero") ? t.month() : t.month() - 1;
343
- return Mt[s !== e ? s : i.MIN_MONTH];
344
- },
345
- parse: function(t) {
346
- var s = i.monthNames().indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
347
- return { month: s !== -1 ? s : e };
348
- },
349
- minLength: 1,
350
- maxLength: 999,
351
- type: "word"
352
- },
353
- "%B": {
354
- format: function(t) {
355
- var s = i.options("monthFromZero") ? t.month() : t.month() - 1;
356
- return F[s !== e ? s : i.MIN_MONTH];
357
- },
358
- parse: function(t) {
359
- var s = i.monthNames(!0).indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
360
- return { month: s !== -1 ? s : e };
361
- },
362
- minLength: 1,
363
- maxLength: 999,
364
- type: "word"
365
- },
366
- "%H": {
367
- format: function(t) {
368
- return r(t.hours() || i.MIN_HOURS, 2);
369
- },
370
- parse: function(t) {
371
- var s = Number(t);
372
- return { hours: isNaN(s) ? e : s };
373
- },
374
- minLength: 2,
375
- maxLength: 2,
376
- type: "number"
377
- },
378
- "%M": {
379
- format: function(t) {
380
- return r(t.minutes() || i.MIN_MINUTES, 2);
381
- },
382
- parse: function(t) {
383
- var s = Number(t);
384
- return { minutes: isNaN(s) ? e : s };
385
- },
386
- minLength: 2,
387
- maxLength: 2,
388
- type: "number"
389
- },
390
- "%S": {
391
- format: function(t) {
392
- return r(t.seconds() || i.MIN_SECONDS, 2);
393
- },
394
- parse: function(t) {
395
- var s = Number(t);
396
- return { seconds: isNaN(s) ? e : s };
397
- },
398
- minLength: 2,
399
- maxLength: 2,
400
- type: "number"
401
- },
402
- "%s": {
403
- format: function(t) {
404
- return t.timestamp();
405
- },
406
- parse: function(t) {
407
- return isNaN(Number(t)) ? {} : i(Number(t)).get();
408
- },
409
- minLength: 1,
410
- maxLength: 20,
411
- type: "number"
412
- },
413
- "%F": {
414
- format: function(t) {
415
- return r(t.year() || i.MIN_YEAR, 4) + "-" + r(t.month() || i.MIN_MONTH, 2) + "-" + r(t.day() || i.MIN_DAY, 2);
416
- },
417
- parse: function(t) {
418
- var s = Number(t.slice(0, 4)), h = Number(t.slice(5, 7)), l = Number(t.slice(8, 10));
419
- return {
420
- year: s,
421
- month: h,
422
- day: l
423
- };
424
- },
425
- minLength: 10,
426
- maxLength: 10,
427
- type: "string"
428
- },
429
- "%D": {
430
- format: function(t) {
431
- return r(t.month() || i.MIN_MONTH, 2) + "/" + r(t.day() || i.MIN_DAY, 2) + "/" + r(t.year() || i.MIN_YEAR, 4);
432
- },
433
- parse: function(t) {
434
- var s = Number(t.slice(0, 2)), h = Number(t.slice(3, 5)), l = Number(t.slice(6, 10));
435
- return {
436
- year: l,
437
- month: s,
438
- day: h
439
- };
440
- },
441
- minLength: 10,
442
- maxLength: 10,
443
- type: "string"
444
- }
445
- }, pt = {
446
- useMilliseconds: !1,
447
- monthFromZero: !1
448
- }, R;
449
- R = function(t, s, h) {
450
- return this._d = /* @__PURE__ */ new Date(), this._i = {
451
- year: !1,
452
- month: !1,
453
- day: !1,
454
- hours: !1,
455
- minutes: !1,
456
- seconds: !1,
457
- milliseconds: !1
458
- }, t !== e && this.set(t, s, h), this;
459
- }, R.fn = R.prototype, R.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
- }, R.fn.year = function(t) {
463
- if (arguments.length !== 0)
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
- else
466
- return this._i.year === !1 ? this._d.getFullYear() : this._i.year;
467
- return this;
468
- }, R.fn.month = function(t) {
469
- if (arguments.length !== 0)
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
- else
472
- return this._i.month === !1 ? i.options("monthFromZero") ? this._d.getMonth() : this._d.getMonth() + 1 : this._i.month;
473
- return this;
474
- }, R.fn.day = function(t) {
475
- if (arguments.length !== 0)
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
- else
478
- return this._i.day === !1 ? this._d.getDate() : this._i.day;
479
- return this;
480
- }, R.fn.hours = function(t) {
481
- if (arguments.length !== 0)
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
- else
484
- return this._i.hours === !1 ? this._d.getHours() : this._i.hours;
485
- return this;
486
- }, R.fn.minutes = function(t) {
487
- if (arguments.length !== 0)
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
- else
490
- return this._i.minutes === !1 ? this._d.getMinutes() : this._i.minutes;
491
- return this;
492
- }, R.fn.seconds = function(t) {
493
- if (arguments.length !== 0)
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
- else
496
- return this._i.seconds === !1 ? this._d.getSeconds() : this._i.seconds;
497
- return this;
498
- }, R.fn.milliseconds = function(t) {
499
- if (arguments.length !== 0)
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
- else
502
- return this._i.milliseconds === !1 ? this._d.getMilliseconds() : this._i.milliseconds;
503
- return this;
504
- }, R.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
- }, R.fn.set = function(t, s, h) {
508
- if (this._i = {
509
- year: !1,
510
- month: !1,
511
- day: !1,
512
- hours: !1,
513
- minutes: !1,
514
- seconds: !1,
515
- milliseconds: !1
516
- }, t === e)
517
- return this._d = /* @__PURE__ */ new Date(), this;
518
- if (t instanceof Date)
519
- return this._d = t, this;
520
- if (typeof t == "number")
521
- return this._d = new Date(t * (i.options("useMilliseconds") ? 1 : 1e3)), this;
522
- if (typeof t == "object" && (t instanceof Array ? (this.day(i.MIN_DAY), this.year(t[0]), this.month(t[1]), this.day(t[2]), this.hours(t[3]), this.minutes(t[4]), this.seconds(t[5]), this.milliseconds(t[6])) : (this.day(i.MIN_DAY), this.year(t.year), this.month(t.month), this.day(t.day), this.hours(t.hours), this.minutes(t.minutes), this.seconds(t.seconds), this.milliseconds(t.milliseconds))), typeof t == "string") {
523
- var l, L = [], g, S, k = [], H = 0, D = 0, M, w, p = {}, b;
524
- if (t === e)
525
- return g = a(this, h), g === e && (this._i = {
526
- year: -1,
527
- month: -1,
528
- day: -1,
529
- hours: -1,
530
- minutes: -1,
531
- seconds: -1,
532
- milliseconds: -1
533
- }), g;
534
- for (s === e && (s = i.detectFormat(t)); H < s.length; ) {
535
- if (s.charAt(H) === "%") {
536
- if (S = s.charAt(H) + s.charAt(H + 1), I[S] !== e) {
537
- switch (M = 0, w = "", I[S].type) {
538
- case "number":
539
- for (; M < I[S].maxLength && D + M < t.length && !isNaN(Number(t.charAt(D + M))); )
540
- w += t.charAt(D + M), M += 1;
541
- break;
542
- case "word":
543
- for (; M < I[S].maxLength && D + M < t.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(D + M)); )
544
- w += t.charAt(D + M), M += 1;
545
- break;
546
- case "string":
547
- for (; M < I[S].maxLength && D + M < t.length; )
548
- w += t.charAt(D + M), M += 1;
549
- break;
550
- }
551
- if (M < I[S].minLength)
552
- return g = a(this, h), g === e && (this._i = {
553
- year: -1,
554
- month: -1,
555
- day: -1,
556
- hours: -1,
557
- minutes: -1,
558
- seconds: -1,
559
- milliseconds: -1
560
- }), g;
561
- L.push(S), k.push(w), M -= 1, D += M, H += 1;
562
- }
563
- } else if (t.charAt(D) !== s.charAt(H))
564
- return g = a(this, h), g === e && (this._i = {
565
- year: -1,
566
- month: -1,
567
- day: -1,
568
- hours: -1,
569
- minutes: -1,
570
- seconds: -1,
571
- milliseconds: -1
572
- }), g;
573
- H += 1, D += 1;
574
- }
575
- for (l in L)
576
- L.hasOwnProperty(l) && I.hasOwnProperty(L[l]) && (b = I[L[l]].parse(k[l]), 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
- });
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
- }
586
- return this;
587
- }, R.fn.leapYear = function() {
588
- var t = this.year();
589
- return t % 4 === 0 ? t % 100 === 0 ? t % 400 === 0 : !0 : !1;
590
- }, R.fn.timestamp = function(t) {
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
- }, R.fn.utc = function(t) {
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
- }, R.fn.dayOfWeek = function(t) {
595
- if (t === "long")
596
- return ct[this._d.getDay()];
597
- if (t === "short")
598
- return lt[this._d.getDay()];
599
- if (t === e)
600
- return this._d.getDay();
601
- if (t === 0 || t === "Sunday")
602
- return this.calc({ day: -this.dayOfWeek() });
603
- if (t === 1 || t === "Monday")
604
- return this.calc({ day: (this.dayOfWeek() === 0 ? -6 : 1) - this.dayOfWeek() });
605
- if (t === 2 || t === "Tuesday")
606
- return this.calc({ day: (this.dayOfWeek() === 0 ? -5 : 2) - this.dayOfWeek() });
607
- if (t === 3 || t === "Wednesday")
608
- return this.calc({ day: (this.dayOfWeek() === 0 ? -4 : 3) - this.dayOfWeek() });
609
- if (t === 4 || t === "Thursday")
610
- return this.calc({ day: (this.dayOfWeek() === 0 ? -3 : 4) - this.dayOfWeek() });
611
- if (t === 5 || t === "Friday")
612
- return this.calc({ day: (this.dayOfWeek() === 0 ? -2 : 5) - this.dayOfWeek() });
613
- if (t === 6 || t === "Saturday")
614
- return this.calc({ day: (this.dayOfWeek() === 0 ? -1 : 6) - this.dayOfWeek() });
615
- }, R.fn.timezone = function(t) {
616
- switch (t) {
617
- case "hours":
618
- return Math.floor(this._d.getTimezoneOffset() / 60);
619
- case "minutes":
620
- return this._d.getTimezoneOffset();
621
- default:
622
- return this._d.getTimezoneOffset() * 60;
623
- }
624
- }, R.fn.get = function(t) {
625
- switch (t) {
626
- case "Date":
627
- return new Date(
628
- this.year(),
629
- this.month() - (i.options("monthFromZero") ? 0 : 1),
630
- this.day(),
631
- this.hours(),
632
- this.minutes(),
633
- this.seconds(),
634
- this.milliseconds()
635
- );
636
- case "DateUTC":
637
- return new Date(Date.UTC(
638
- this.year(),
639
- this.month() - (i.options("monthFromZero") ? 0 : 1),
640
- this.day(),
641
- this.hours(),
642
- this.minutes(),
643
- this.seconds(),
644
- this.milliseconds()
645
- ));
646
- case "Array":
647
- return [
648
- this.year(),
649
- this.month(),
650
- this.day(),
651
- this.hours(),
652
- this.minutes(),
653
- this.seconds(),
654
- this.milliseconds()
655
- ];
656
- default:
657
- return {
658
- year: this.year(),
659
- month: this.month(),
660
- week: this.week(),
661
- day: this.day(),
662
- hours: this.hours(),
663
- minutes: this.minutes(),
664
- seconds: this.seconds(),
665
- milliseconds: this.milliseconds(),
666
- utc: this.utc(),
667
- dayOfWeek: this.dayOfWeek(),
668
- dayOfWeekShort: this.dayOfWeek("short"),
669
- dayOfWeekLong: this.dayOfWeek("long"),
670
- timestamp: this.timestamp()
671
- };
672
- }
673
- }, R.fn.format = function(t) {
674
- for (var s = 0, h = "", l; s < t.length; )
675
- t.charAt(s) === "%" ? (l = t.charAt(s) + t.charAt(s + 1), I[l] !== e ? (h += I[l].format(this), s += 1) : h += "%") : h += t.charAt(s), s += 1;
676
- return h;
677
- }, R.fn.valid = function() {
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
- }, R.fn.errors = function() {
680
- return this._i;
681
- }, R.fn.between = function(t, s) {
682
- var h = this.timestamp(), l = t.timestamp();
683
- switch (s) {
684
- case "year":
685
- return Math.floor((l - h) / 31556952);
686
- case "month":
687
- return Math.floor((l - h) / 2629746);
688
- case "day":
689
- return Math.floor((l - h) / 86400);
690
- case "hours":
691
- return Math.floor((l - h) / 3600);
692
- case "minutes":
693
- return Math.floor((l - h) / 60);
694
- case "seconds":
695
- return l - h;
696
- default:
697
- return e;
698
- }
699
- }, R.fn.calc = function(t) {
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, h) {
702
- return new R(t, s, 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, s) {
704
- if (t === e)
705
- return pt;
706
- if (pt.hasOwnProperty(t)) {
707
- if (s === e)
708
- return pt[t];
709
- pt[t] = s, t === "monthFromZero" && (i.MIN_MONTH = s ? 0 : 1, i.MAX_MONTH = s ? 11 : 12);
710
- }
711
- return e;
712
- }, i.noConflict = function() {
713
- return n.tempus = u, i;
714
- }, i.generate = function(t) {
715
- var s, h, l, L, g, S, k, H;
716
- if (typeof t.dateFrom != "number" && (t.dateFrom instanceof R ? s = t.dateFrom.utc() : s = i(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof R ? h = t.dateTo.utc() : h = i(t.dateTo, t.formatTo !== e ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? g = {
717
- year: 0,
718
- month: 0,
719
- day: 0,
720
- hours: 0,
721
- minutes: 0,
722
- seconds: t.period
723
- } : typeof t.period == "string" ? g = {
724
- year: t.period === "year" ? 1 : 0,
725
- month: t.period === "month" ? 1 : 0,
726
- day: t.period === "day" ? 1 : 0,
727
- hours: t.period === "hours" ? 1 : 0,
728
- minutes: t.period === "minutes" ? 1 : 0,
729
- seconds: t.period === "seconds" ? 1 : 0
730
- } : typeof t.period == "object" && (g = {
731
- year: t.period.year !== e ? t.period.year : 0,
732
- month: t.period.month !== e ? t.period.month : 0,
733
- day: t.period.day !== e ? t.period.day : 0,
734
- hours: t.period.hours !== e ? t.period.hours : 0,
735
- minutes: t.period.minutes !== e ? t.period.minutes : 0,
736
- seconds: t.period.seconds !== e ? t.period.seconds : 0
737
- }), t.groupBy === e ? S = t.asObject === !0 ? {} : [] : (S = [], S.push([]), k = i(s).get()[t.groupBy]), H = function(w, p, b) {
738
- return t.asObject === !0 ? t.format !== e ? w[i(p).format(t.format)] = {} : w[i(p).format("%F %H:%M:%S")] = {} : t.format !== e ? w.push(b ? null : i(p).format(t.format)) : w.push(b ? null : i(p)), w;
739
- }, t.groupBy !== e && t.fillNulls) {
740
- var D = {
741
- year: g.year ? -g.year : e,
742
- month: g.month ? -g.month : e,
743
- day: g.day ? -g.day : e,
744
- hours: g.hours ? -g.hours : e,
745
- minutes: g.minutes ? -g.minutes : e,
746
- seconds: g.seconds ? -g.seconds : e,
747
- milliseconds: g.milliseconds ? -g.milliseconds : e
748
- };
749
- for (l = i(s).calc(D).utc(); i(l).get()[t.groupBy] === k; )
750
- H(S[S.length - 1], l, !0), l = i(l).calc(D).utc();
751
- if (t.groupBy === "week") {
752
- var M = i(s).dayOfWeek();
753
- for (l = i(s).dayOfWeek(0).utc(); S[0].length < M && l < s; )
754
- H(S[S.length - 1], l, !0), l = i(l).calc(g).utc();
755
- }
756
- }
757
- for (; s <= h; )
758
- t.groupBy === e ? H(S, s) : i(s).get()[t.groupBy] === k ? H(S[S.length - 1], s) : (S.push([]), H(S[S.length - 1], s), k = i(s).get()[t.groupBy]), s = i(s).calc(g).utc();
759
- if (t.groupBy !== e && t.fillNulls)
760
- for (L = i(h).calc(g).utc(); i(L).get()[t.groupBy] === k; )
761
- H(S[S.length - 1], L, !0), L = i(L).calc(g).utc();
762
- return S;
763
- }, i.monthNames = function(t) {
764
- switch (t) {
765
- case "long":
766
- return F;
767
- default:
768
- return Mt;
769
- }
770
- }, i.dayNames = function(t) {
771
- switch (t) {
772
- case "long":
773
- return ct;
774
- default:
775
- return lt;
776
- }
777
- }, i.lang = function(t) {
778
- if (t !== e)
779
- m = t, N[m] === e && (m = "en"), F = G(), Mt = at(), ct = V(), lt = J();
780
- else
781
- return m;
782
- return e;
783
- }, i.availableLangs = function() {
784
- return Object.keys(N);
785
- }, i.registerFormat = function(t, s, h, l, L, g) {
786
- I[t] = {
787
- format: s,
788
- parse: h,
789
- minLength: l,
790
- maxLength: L,
791
- type: g
792
- };
793
- }, i.unregisterFormat = function(t) {
794
- delete I[t];
795
- }, i.detectFormat = function(t) {
796
- var s, h, l;
797
- return s = O(t, 0), s !== "" && (l = 10), h = t.charAt(l), (h === "T" || h === " ") && (s += h, l += 1), s += c(t, l), s;
798
- }, T = {
799
- TempusDate: R
800
- }, i.classes = function(t, s) {
801
- if (s === e)
802
- return T[t];
803
- T[t] = s;
804
- }, i.loadTranslations = function(t) {
805
- typeof t == "object" ? N = t : typeof t == "string" && me(t, function(s) {
806
- N = s;
807
- }, function(s) {
808
- });
809
- }, m = (E.language || E.systemLanguage || E.userLanguage || "en").substr(0, 2).toLowerCase(), N[m] === e && (m = "en"), F = G(), Mt = at(), ct = V(), lt = J(), y.exports && (A = y.exports = i), A.tempus = i;
810
- }).call(_e);
811
- })(jt, jt.exports);
812
- var ye = jt.exports;
813
- const Ht = /* @__PURE__ */ Oe(ye);
814
- var z, mt, K, Y, P, x, q, v, B, j, It, $, C, tt, et, rt, Dt, ft, Qt, Nt, Zt, _t, Vt, Ot, zt, yt, Kt, Ut, se, Gt, ie, dt, qt, gt, vt, Et, $t, nt, Yt, Tt, te, wt, re, At, ut, ot, Bt, Rt, ee;
815
- class X {
816
- constructor(A, e = {}) {
817
- f(this, rt);
818
- f(this, ft);
819
- f(this, Nt);
820
- f(this, _t);
821
- f(this, Ot);
822
- f(this, yt);
823
- f(this, Ut);
824
- f(this, Gt);
825
- f(this, dt);
826
- f(this, gt);
827
- f(this, Et);
828
- f(this, nt);
829
- f(this, Tt);
830
- f(this, wt);
831
- f(this, At);
832
- f(this, ot);
833
- f(this, Rt);
834
- f(this, z, null);
835
- f(this, mt, null);
836
- f(this, K, []);
837
- f(this, Y, {});
838
- f(this, P, 50);
839
- f(this, x, 50);
840
- f(this, q, !0);
841
- f(this, v, null);
842
- f(this, B, null);
843
- f(this, j, null);
844
- f(this, It, 100);
845
- f(this, $, "no");
846
- f(this, C, !1);
847
- f(this, tt, !1);
848
- f(this, et, !1);
849
- U(this, "errors", {});
850
- U(this, "answerData", {});
851
- d(this, z, A), d(this, mt, e);
852
- }
853
- get serial() {
854
- return o(this, C);
855
- }
856
- get limitCommandSerial() {
857
- return o(this, x);
858
- }
859
- set limitCommandSerial(A) {
860
- if (A < 10)
861
- throw new Error("limitCommandSerial не может быть меньше 10");
862
- A >= 10 && A < 50 && (d(this, P, A), d(this, x, A)), d(this, x, A);
863
- }
864
- setSerial() {
865
- d(this, C, !0), d(this, tt, !0), d(this, et, !1);
866
- }
867
- setParallel() {
868
- d(this, C, !1), d(this, tt, !1), d(this, et, !0);
869
- }
870
- stop() {
871
- d(this, q, !1);
872
- }
873
- async batch(A, e) {
874
- o(this, j) && _(this, ft, Qt).call(this), e && d(this, v, e), o(this, tt) === !1 && d(this, C, !1), Object.keys(A).length > o(this, x) && d(this, C, !0), d(this, q, !0), d(this, K, []), d(this, Y, {}), this.errors = {}, this.answerData = {};
875
- const n = _(this, _t, Vt).call(this, A);
876
- if (Object.keys(A).length < o(this, x)) {
877
- const r = n.map((a, c) => _(this, Ot, zt).call(this, a, n[c]));
878
- return Promise.allSettled(r).then((a) => {
879
- let c = {};
880
- for (let O of a)
881
- O.status === "fulfilled" && (c = { ...c, ...O.value });
882
- return c;
883
- });
884
- } else {
885
- let r = {}, a = 0, c = 1, O = Object.keys(A).length || 1, u = (i) => {
886
- a += Object.keys(i).length, c = Math.round(a / O * 100);
887
- };
888
- for (let [i, T] of Object.entries(n)) {
889
- let E = await _(this, Ot, zt).call(this, T, n[i], !0);
890
- u(T), e && e({ percent: c }), r = { ...r, ...E };
891
- }
892
- return r;
893
- }
894
- }
895
- async batchTotalCount(A, e) {
896
- d(this, Y, {}), this.errors = {};
897
- let n = 1, r = 0, a = Object.keys(A).length || 1, c = (u) => {
898
- r += Object.keys(u).length, n = Math.round(r / a * 100);
899
- };
900
- e && e({ percent: n });
901
- const O = _(this, _t, Vt).call(this, A);
902
- if (o(this, et)) {
903
- const u = O.map((i) => _(this, yt, Kt).call(this, i).then((T) => (c(i), e && e({ percent: n }), T)));
904
- return Promise.allSettled(u).then((i) => {
905
- let T = {};
906
- for (let E of i)
907
- E.status === "fulfilled" && (T = { ...T, ...E.value });
908
- return T;
909
- });
910
- } else {
911
- let u = {};
912
- for (let i of O) {
913
- let T = await _(this, yt, Kt).call(this, i);
914
- c(i), e && e({ percent: n }), u = { ...u, ...T };
915
- }
916
- return u;
917
- }
918
- }
919
- }
920
- z = new WeakMap(), mt = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), P = new WeakMap(), x = new WeakMap(), q = new WeakMap(), v = new WeakMap(), B = new WeakMap(), j = new WeakMap(), It = new WeakMap(), $ = new WeakMap(), C = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), rt = new WeakSet(), Dt = function() {
921
- let A = 0;
922
- if (!o(this, B))
923
- return Math.round(A);
924
- let e = 0, n = 0;
925
- return Object.values(o(this, B)).forEach((r) => {
926
- const { total: a, count: c } = r;
927
- e += a ?? 0, n += c ?? 0;
928
- }), e ? A = n / e * 100 : A = 100, { percent: Math.round(A), allCount: n, allTotal: e };
929
- }, ft = new WeakSet(), Qt = function() {
930
- clearInterval(o(this, j)), d(this, j, ""), d(this, B, ""), d(this, v, ""), d(this, $, "no");
931
- }, Nt = new WeakSet(), Zt = function({ key: A, value: e }) {
932
- const n = _(this, At, ut).call(this, e.data()), r = Array.isArray(n) ? n.length : 0, a = _(this, ot, Bt).call(this, e.total(), r);
933
- let c = 1;
934
- n && (c = r), o(this, v) && (o(this, B) || d(this, B, {}), o(this, B)[A] && o(this, B)[A].count && (c += o(this, B)[A].count), o(this, B)[A] = { total: a, count: c }, o(this, j) || d(this, j, setInterval(() => {
935
- const { percent: O, allCount: u, allTotal: i } = o(this, rt, Dt);
936
- (o(this, $) === "no" || o(this, $) < o(this, rt, Dt).percent) && (o(this, v).call(this, {
937
- data: o(this, B),
938
- percent: O,
939
- allCount: u,
940
- allTotal: i
941
- }), d(this, $, o(this, rt, Dt).percent)), O === 100 && _(this, ft, Qt).call(this);
942
- }, o(this, It))));
943
- }, _t = new WeakSet(), Vt = function(A) {
944
- const e = [], n = Object.entries(A);
945
- for (let r = 0; r < n.length; r += o(this, P)) {
946
- const a = n.slice(r, r + o(this, P));
947
- e.push(Object.fromEntries(a));
948
- }
949
- return e;
950
- }, Ot = new WeakSet(), zt = function(A, e, n) {
951
- return new Promise((r) => {
952
- const a = _(this, Tt, te).call(this, e), c = [];
953
- let O = 0, u = 0;
954
- o(this, z).call(this, A, (i) => {
955
- Object.entries(i).forEach(([T, E]) => {
956
- let m = {};
957
- const N = E.error();
958
- if (N) {
959
- let { query: { method: J }, answer: F } = E;
960
- this.errors[T] = { error: N, method: J }, O += 1;
961
- }
962
- if (E != null && E.answer && Object.keys(E.answer).length) {
963
- for (let [J, F] of Object.entries(E.answer))
964
- J != "result" && F && (m[J] = F);
965
- Object.keys(m).length && (this.answerData[T] = m);
966
- }
967
- const G = _(this, At, ut).call(this, E.data()), at = Array.isArray(G) ? G.length : 0, V = _(this, ot, Bt).call(this, E.total(), at);
968
- if (Array.isArray(G) ? o(this, Y)[T] = G : typeof G == "object" && G !== null && Object.keys(G).length === 0 ? o(this, Y)[T] = [] : o(this, Y)[T] = G, u += V, n || _(this, Nt, Zt).call(this, { key: T, value: E }), V > o(this, P) && V > at) {
969
- const J = Math.ceil(V / o(this, P)) - 1, F = Array.from({ length: J });
970
- c.push([T, a[T], F]);
971
- }
972
- }), u > 5e3 && o(this, tt) === !1 && o(this, et) === !1 && d(this, C, !0), O > 0 && _(this, Rt, ee).call(this), c.length ? (_(this, Ut, se).call(this, c), _(this, Gt, ie).call(this).then(() => r(_(this, nt, Yt).call(this)))) : r(_(this, nt, Yt).call(this));
973
- });
974
- });
975
- }, yt = new WeakSet(), Kt = function(A) {
976
- return new Promise((e) => {
977
- const n = _(this, Tt, te).call(this, A);
978
- let r = 0;
979
- o(this, z).call(this, n, (a) => {
980
- Object.entries(a).forEach(([c, O]) => {
981
- const u = O.error();
982
- u && (this.errors[c] = u, r += 1);
983
- const i = _(this, At, ut).call(this, O.data()), T = Array.isArray(i) ? i.length : 0, E = _(this, ot, Bt).call(this, O.total(), T);
984
- o(this, Y)[c] = E;
985
- }), r > 0 && _(this, Rt, ee).call(this), e(_(this, nt, Yt).call(this));
986
- });
987
- });
988
- }, Ut = new WeakSet(), se = function(A) {
989
- let e = [];
990
- A.forEach(([n, r, a]) => {
991
- a.forEach((c, O) => {
992
- const u = O + 1, i = o(this, P) * u, E = [[n, u].join("_"), _(this, wt, re).call(this, r, i)];
993
- e.length === o(this, P) ? (o(this, K).push(e), e = [E]) : e.push(E);
994
- });
995
- }), e.length && o(this, K).push(e);
996
- }, Gt = new WeakSet(), ie = function() {
997
- const A = [], e = [], n = (r) => {
998
- Object.entries(r).forEach(([a, c]) => {
999
- const [O] = a.split("_"), u = _(this, At, ut).call(this, c.data());
1000
- Array.isArray(u) && o(this, Y)[O].push(...u), _(this, Nt, Zt).call(this, { key: O, value: c });
1001
- });
1002
- };
1003
- return o(this, K).forEach((r, a) => {
1004
- const c = Object.fromEntries(r), O = () => new Promise((u) => o(this, z).call(this, c, (i) => {
1005
- o(this, C) ? n(i) : e[a] = i, u();
1006
- }));
1007
- A.push(O);
1008
- }), o(this, C) ? _(this, gt, vt).call(this, A) : _(this, Et, $t).call(this, A).then(() => {
1009
- e.forEach(n);
1010
- });
1011
- }, dt = new WeakSet(), qt = function() {
1012
- return new Promise((A) => setTimeout(A, 500));
1013
- }, gt = new WeakSet(), vt = function(A) {
1014
- if (!A.length)
1015
- return Promise.resolve();
1016
- const e = A.shift();
1017
- return Promise.allSettled([
1018
- e(),
1019
- _(this, dt, qt).call(this)
1020
- ]).then(() => o(this, q) ? _(this, gt, vt).call(this, A) : Promise.resolve());
1021
- }, Et = new WeakSet(), $t = function(A) {
1022
- if (!A.length)
1023
- return Promise.resolve();
1024
- const e = A.shift();
1025
- return _(this, dt, qt).call(this).then(() => e()).then(() => o(this, q) ? _(this, Et, $t).call(this, A) : Promise.resolve());
1026
- }, nt = new WeakSet(), Yt = function() {
1027
- return Object.entries(o(this, mt)).forEach(([A, e]) => {
1028
- o(this, Y)[A] && (o(this, Y)[A] = e(o(this, Y)[A]));
1029
- }), o(this, Y);
1030
- }, Tt = new WeakSet(), te = function(A) {
1031
- return Object.entries(A).reduce((e, [n, r]) => {
1032
- if (Array.isArray(r)) {
1033
- const [a, c = {}] = r;
1034
- e[n] = [a, c];
1035
- } else {
1036
- const { method: a, params: c = {} } = r;
1037
- e[n] = [a, c];
1038
- }
1039
- return e;
1040
- }, {});
1041
- }, wt = new WeakSet(), re = function(A, e) {
1042
- const [n, r] = A;
1043
- return [n, { start: e, ...r }];
1044
- }, At = new WeakSet(), ut = function(A) {
1045
- return ((A == null ? void 0 : A.items) || (A == null ? void 0 : A.documents)) ?? A;
1046
- }, ot = new WeakSet(), Bt = function(A, e) {
1047
- return A !== A && (A = 0), A === 0 && e === 0 ? 0 : A || e;
1048
- }, Rt = new WeakSet(), ee = function() {
1049
- console.group(`${this.constructor.name}: Ошибки в методах!`), Object.entries(this.errors).forEach(([A, e]) => {
1050
- console.info(`[${A}]`, e);
1051
- }), console.groupEnd();
1052
- };
1053
- var st;
1054
- class ne {
1055
- constructor() {
1056
- f(this, st, {});
1057
- }
1058
- get hash() {
1059
- return this.createHash(8);
1060
- }
1061
- /** Генератор хеш-кода */
1062
- createHash(A) {
1063
- let e = "abcdefghijklmnopqrstuvwxyz0123456789", n = "";
1064
- A = A || 6;
1065
- for (let r = 0; r < A; r++)
1066
- n += e.charAt(Math.floor(Math.random() * e.length));
1067
- return n;
1068
- }
1069
- /** Фильтр часто запускаемых действий */
1070
- actionFilter({ keyTimer: A, duration: e = 10, action: n }) {
1071
- o(this, st)[A] && (clearTimeout(o(this, st)[A]), o(this, st)[A] = null), n && (o(this, st)[A] = setTimeout(() => {
1072
- n();
1073
- }, e));
1074
- }
1075
- /** Включение режима NO-SLEEP */
1076
- async noSleep() {
1077
- let A = document.createElement("video");
1078
- A.classList.add("no-sleep"), A.addEventListener("loadeddata", () => {
1079
- A.style.position = "fixed", A.style.left = "-9999px", document.querySelector("body").append(A), A.play();
1080
- }), A.addEventListener("ended", () => {
1081
- this.actionFilter({
1082
- keyTimer: "no-sleep",
1083
- duration: 5e3,
1084
- action: () => A.play()
1085
- });
1086
- }), A.src = "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAP5tZGF0AAAAAQYAAADlZYiEE28FmH9jNWDBjI+Z/1tIBZsjfhbmcNNUpBFej0U3p+zhaJ3eemJRL2LUMa5tkidy6bp+eatLE3jBIY864TvaAmqEFCgLMTCwVbem1n3myAw9yDXQdR5HfU/8iYf+eneVnRf7Qx9M70XDUuPx1MJX671XJwAE0VAMpnhbcUDx0pTldvUX9KQPhkZNH3eyZHmObkAeyEJ2tl+BEBJIGc90BiqKL60+5EA6fXB6iG5UU/M5KsW8BNAAUw5CbRJIqohNk10fwKbUXwya03rqGkE8+wuYGtEbrVYXb+iOl1mHHVPLYQbIAAcGyAAHAAAFNG1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAAAAvAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAIldHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAFAAAAA8AAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAAAAAAAAAAAQAAAAABnW1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAQAAAAAAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAUhtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAEIc3RibAAAAKRzdHNkAAAAAAAAAAEAAACUYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAFAAPAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAC5hdmNDAU1AC//hABZnTUAL2wUH7ARAAAADAEAAAAQDxQq4AQAFaOrAZXIAAAAQcGFzcAAAAAEAAAABAAAAGHN0dHMAAAAAAAAAAQAAAAEAAAAAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAAO4AAAABAAAAFHN0Y28AAAAAAAAAAQAAADAAAAIadHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAgAAAAAAAAAvAAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAALwAAAAAAAQAAAAABkm1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAArEQAAAgAVcQAAAAAAC1oZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU291bmRIYW5kbGVyAAAAAT1taW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAQFzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAAC7gAAAAViBYCAgAISCAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAAACAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAgAAAAEAAAAUc3RzegAAAAAAAAAEAAAAAgAAABRzdGNvAAAAAAAAAAEAAAEeAAAAGnNncGQBAAAAcm9sbAAAAAIAAAAB//8AAAAcc2JncAAAAAByb2xsAAAAAQAAAAIAAAABAAAAgXVkdGEAAAB5bWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWR0YQAAAAAAAAAAAAAAAAAAAAAfa2V5cwAAAAAAAAABAAAAD21kdGFlbmNvZGVyAAAALWlsc3QAAAAlAAAAAQAAAB1kYXRhAAAAAQAAAABMYXZmNTguMTIuMTAw";
1087
- }
1088
- /** Скачать данные в JSON-файл */
1089
- downloadFileJson(A, e) {
1090
- let n = new Blob([JSON.stringify(A)], { type: "application/json" }), r = URL.createObjectURL(n), a = document.createElement("a");
1091
- a.style.display = "none", a.href = r, a.download = `${e}.json`, document.body.appendChild(a), a.click(), setTimeout(() => {
1092
- document.body.removeChild(a), URL.revokeObjectURL(r);
1093
- }, 200);
1094
- }
1095
- }
1096
- st = new WeakMap();
1097
- const bt = new ne();
1098
- var W, Q, Ct, it, St, Z, ht, Ft, oe, Lt, Ae, Pt, he, Wt, ae, Jt, ce;
1099
- class de {
1100
- constructor() {
1101
- f(this, Ft);
1102
- /** Вывод ошибок логера
1103
- * @param {'entity'} type - тип ошибки
1104
- */
1105
- f(this, Lt);
1106
- f(this, Pt);
1107
- f(this, Wt);
1108
- f(this, Jt);
1109
- f(this, W, "logger");
1110
- f(this, Q, !1);
1111
- f(this, Ct, 2e3);
1112
- f(this, it, /* @__PURE__ */ new Map());
1113
- f(this, St, {});
1114
- f(this, Z, null);
1115
- f(this, ht, !1);
1116
- /** Очистка хранилища элементов старше 'N' месяцев */
1117
- U(this, "periodClear", 3);
1118
- _(this, Ft, oe).call(this);
1119
- }
1120
- /** Инициализация логера */
1121
- async init() {
1122
- let A = new X(BX24.callBatch), { entityList: e } = await A.batch({
1123
- entityList: { method: "entity.get" }
1124
- });
1125
- if (e && Array.isArray(e))
1126
- if (e.find((r) => r.ENTITY == o(this, W)))
1127
- d(this, Q, !0);
1128
- else {
1129
- let { entityAdd: r } = await A.batch({
1130
- entityAdd: {
1131
- method: "entity.add",
1132
- params: {
1133
- ENTITY: o(this, W),
1134
- NAME: o(this, W),
1135
- ACCESS: { AU: "X" }
1136
- }
1137
- }
1138
- });
1139
- r && d(this, Q, !0);
1140
- }
1141
- return _(this, Wt, ae).call(this), o(this, Q);
1142
- }
1143
- /**
1144
- * @param {{ type: 'call'|'batch'|'batch-total-count';
1145
- * data: {
1146
- * method: string,
1147
- * params: { [key]: any }
1148
- * }|{ commandList: { [key]: any }
1149
- * }; }}
1150
- * @returns {string}
1151
- */
1152
- start({ type: A, data: e }) {
1153
- if (!o(this, Q)) {
1154
- _(this, Lt, Ae).call(this, "entity");
1155
- return;
1156
- }
1157
- const n = bt.hash;
1158
- return o(this, it).set(n, {
1159
- type: A,
1160
- data: e,
1161
- userInfo: o(this, St),
1162
- errorList: [],
1163
- status: "",
1164
- answer: null,
1165
- date: (/* @__PURE__ */ new Date()).getTime()
1166
- }), n;
1167
- }
1168
- /**
1169
- * @param {{
1170
- * key: string;
1171
- * errorList: any[];
1172
- * status: 'success'|'fail'|'fail-runtime',
1173
- * answer: { [key]: unknown } }}
1174
- */
1175
- stop({ key: A, errorList: e, status: n, answer: r }) {
1176
- if (!o(this, Q)) {
1177
- _(this, Lt, Ae).call(this, "entity");
1178
- return;
1179
- }
1180
- let a = o(this, it).get(A);
1181
- e && (a.errorList = e), n && (a.status = n), r && (a.answer = r), bt.actionFilter({
1182
- keyTimer: "add.entity.items",
1183
- duration: o(this, Ct),
1184
- action: async () => {
1185
- var c;
1186
- await _(this, Pt, he).call(this), (c = a == null ? void 0 : a.data) != null && c.updateList && d(this, ht, !0);
1187
- }
1188
- });
1189
- }
1190
- /**
1191
- * @param { ({percent}:{percent:number})=>{} } progressCall - коллбэк
1192
- */
1193
- async getEntityList(A) {
1194
- var r;
1195
- if ((r = o(this, Z)) != null && r.length && !o(this, ht))
1196
- return o(this, Z);
1197
- let e = new X(BX24.callBatch), { entityList: n } = await e.batch({
1198
- entityList: {
1199
- method: "entity.item.get",
1200
- params: {
1201
- ENTITY: o(this, W),
1202
- SORT: { ID: "DESC" }
1203
- }
1204
- }
1205
- }, A);
1206
- return n = n.map((a) => {
1207
- const { ID: c, DATE_CREATE: O, DETAIL_TEXT: u } = a;
1208
- return {
1209
- ...JSON.parse(u),
1210
- id: c,
1211
- dateCreate: O
1212
- };
1213
- }), d(this, ht, !1), n;
1214
- }
1215
- /** Выгрузка всех данных из хранилища в JSON-файл */
1216
- async downAllEntityJson() {
1217
- let A = await this.getEntityList(), e = Ht().format("%Y-%m-%d");
1218
- bt.downloadFileJson(A, `sdklogger-entity-data__${e}`);
1219
- }
1220
- }
1221
- W = new WeakMap(), Q = new WeakMap(), Ct = new WeakMap(), it = new WeakMap(), St = new WeakMap(), Z = new WeakMap(), ht = new WeakMap(), Ft = new WeakSet(), oe = async function() {
1222
- const A = new X(BX24.callBatch), e = BX24.isAdmin(), { curUser: n } = await A.batch({
1223
- curUser: { method: "user.current" }
1224
- });
1225
- d(this, St, { isAdmin: e, curUser: n });
1226
- }, Lt = new WeakSet(), Ae = function(A) {
1227
- A == "entity" && bt.actionFilter({
1228
- keyTimer: "error.logger.entity",
1229
- duration: 500,
1230
- action: () => {
1231
- console.error("Хранилище для логгера не инициализировано");
1232
- }
1233
- });
1234
- }, Pt = new WeakSet(), he = async function() {
1235
- let A = {}, e = new X(BX24.callBatch);
1236
- for (let [n, r] of o(this, it).entries())
1237
- r.status && (A[n] = {
1238
- method: "entity.item.add",
1239
- params: {
1240
- ENTITY: o(this, W),
1241
- NAME: o(this, W),
1242
- DETAIL_TEXT: JSON.stringify(r)
1243
- }
1244
- });
1245
- if (Object.keys(A).length) {
1246
- let n = await e.batch(A), { errors: r } = e;
1247
- for (let [a, c] of Object.entries({ ...n, ...r }))
1248
- o(this, it).delete(a);
1249
- return !0;
1250
- }
1251
- }, Wt = new WeakSet(), ae = async function() {
1252
- let A = new X(BX24.callBatch), { serverTime: e } = await A.batch({
1253
- serverTime: { method: "server.time" }
1254
- });
1255
- o(this, Z) || d(this, Z, await this.getEntityList());
1256
- let n = o(this, Z).filter((r) => {
1257
- let { dateCreate: a } = r;
1258
- return Ht(new Date(a)).between(Ht(new Date(e)), "month") >= this.periodClear;
1259
- });
1260
- _(this, Jt, ce).call(this, n);
1261
- }, Jt = new WeakSet(), ce = async function(A) {
1262
- let e = new X(BX24.callBatch), n = A.map((r) => {
1263
- let { id: a } = r;
1264
- return {
1265
- method: "entity.item.delete",
1266
- params: {
1267
- ENTITY: o(this, W),
1268
- ID: a
1269
- }
1270
- };
1271
- });
1272
- return await e.batch(n);
1273
- };
1274
- var kt, le, Xt, ue;
1275
- class Ee {
1276
- constructor(A) {
1277
- /** Запрос данных о приложении */
1278
- f(this, kt);
1279
- /** Запрос данных о текущем пользователе */
1280
- f(this, Xt);
1281
- U(this, "domain", "");
1282
- U(this, "isAdmin", !1);
1283
- U(this, "appInfo", null);
1284
- U(this, "appConst", null);
1285
- U(this, "userInfo", null);
1286
- U(this, "placeData", null);
1287
- U(this, "placeInfo", null);
1288
- U(this, "logger", new de());
1289
- this.appConst = A;
1290
- }
1291
- init() {
1292
- return new Promise((A) => {
1293
- let e = setInterval(() => {
1294
- window.BX24 && BX24.init(async () => {
1295
- console.info("init BX24"), clearInterval(e), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), await this.logger.init();
1296
- const [n, r] = await Promise.all([
1297
- _(this, kt, le).call(this),
1298
- _(this, Xt, ue).call(this)
1299
- ]);
1300
- this.appInfo = n, this.userInfo = r, new ne().noSleep(), A(!0);
1301
- });
1302
- }, 100);
1303
- });
1304
- }
1305
- userOption(A, e) {
1306
- return e ? BX24.userOption.set(A, e) : BX24.userOption.get(A);
1307
- }
1308
- /**
1309
- * @param {{
1310
- * method: string;
1311
- * params: any;
1312
- * updateList: {
1313
- * method: string,
1314
- * name: string,
1315
- * list: {
1316
- * id: string | number,
1317
- * fields: {
1318
- * [key: string]: {
1319
- * oldValue: string | number | string[] | number[],
1320
- * newValue: string | number | string[] | number[],
1321
- * }
1322
- * }
1323
- * }[]
1324
- * }[]
1325
- */
1326
- call({ method: A, params: e, updateList: n }) {
1327
- let r = this.logger.start({
1328
- type: "call",
1329
- data: { method: A, params: e, updateList: n }
1330
- });
1331
- return new Promise((a) => {
1332
- e || (e = {}), BX24.callMethod(A, e, (c) => {
1333
- let O = {};
1334
- if (c != null && c.answer)
1335
- for (let [u, i] of Object.entries(c.answer))
1336
- u != "result" && i && (O[u] = i);
1337
- if (c.error()) {
1338
- let u = c.error();
1339
- console.error(u), this.logger.stop({
1340
- answer: O,
1341
- key: r,
1342
- status: "fail",
1343
- errorList: [u.toSting()]
1344
- }), a(!1);
1345
- } else {
1346
- let u = c.data();
1347
- u != null && u.items && (u = u.items), this.logger.stop({
1348
- answer: O,
1349
- key: r,
1350
- status: "success"
1351
- }), a(u);
1352
- }
1353
- });
1354
- });
1355
- }
1356
- /**
1357
- * @param commandList - объект/массив команд
1358
- * @param progressCall - callback(data), в data приходят данные о загрузке данных
1359
- * @param {{
1360
- * updateList: {
1361
- * method: string,
1362
- * name: string,
1363
- * list: {
1364
- * id: string | number,
1365
- * fields: {
1366
- * [key: string]: {
1367
- * oldValue: string | number | string[] | number[],
1368
- * newValue: string | number | string[] | number[],
1369
- * }
1370
- * }
1371
- * }[]
1372
- * }[]
1373
- * }}
1374
- */
1375
- async batch(A, e, { updateList: n, errorCall: r, limitCommandSerial: a } = {}) {
1376
- let c = new X(BX24.callBatch), O = this.logger.start({
1377
- type: "batch",
1378
- data: { commandList: A, updateList: n }
1379
- });
1380
- a && (c.limitCommandSerial = a);
1381
- try {
1382
- let u = await c.batch(A, e);
1383
- if (Object.keys(c.errors).length) {
1384
- let i = Object.entries(c.errors).map(([T, E]) => {
1385
- var m;
1386
- return {
1387
- key: T,
1388
- error: `${E == null ? void 0 : E.method} ${(m = E == null ? void 0 : E.error) == null ? void 0 : m.toString()}`.trim()
1389
- };
1390
- });
1391
- r && r(c.errors), this.logger.stop({
1392
- key: O,
1393
- status: "fail",
1394
- errorList: i,
1395
- answer: c.answerData
1396
- });
1397
- } else
1398
- this.logger.stop({
1399
- key: O,
1400
- status: "success",
1401
- answer: c.answerData
1402
- });
1403
- return u;
1404
- } catch (u) {
1405
- let i = u == null ? void 0 : u.toString();
1406
- return this.logger.stop({
1407
- key: O,
1408
- status: "fail-runtime",
1409
- errorList: [i],
1410
- answer: c.answerData
1411
- }), console.error(u), !1;
1412
- }
1413
- }
1414
- /**
1415
- * @param commandList - объект/массив команд
1416
- * @param progressCall - callback(data), в data приходят данные о загрузке данных
1417
- */
1418
- async batchTotalCount(A, e) {
1419
- let n = new X(BX24.callBatch), r = this.logger.start({
1420
- type: "batch",
1421
- data: { commandList: A }
1422
- });
1423
- try {
1424
- let a = await n.batchTotalCount(A, e);
1425
- if (Object.keys(n.errors).length) {
1426
- let c = Object.entries(n.errors).map(([O, u]) => ({
1427
- key: O,
1428
- error: u.toSting()
1429
- }));
1430
- this.logger.stop({
1431
- key: r,
1432
- status: "fail",
1433
- errorList: c
1434
- });
1435
- } else
1436
- this.logger.stop({
1437
- key: r,
1438
- status: "success"
1439
- });
1440
- return a;
1441
- } catch (a) {
1442
- return this.logger.stop({
1443
- key: r,
1444
- status: "fail",
1445
- errorList: [a.toSting()]
1446
- }), console.error(a), !1;
1447
- }
1448
- }
1449
- /** Запрос данных о местах встройки приложения */
1450
- getPlacement() {
1451
- return this.call({ method: "placement.get" }).then((A) => (this.placeData || (this.placeData = A), A));
1452
- }
1453
- /** Встройка приложения в place */
1454
- async placementBind(A) {
1455
- this.placeData || (this.placeData = await this.getPlacement());
1456
- const { appName: e, pathApp: n } = this.appConst, r = this.placeData.map((c) => c.placement);
1457
- let a = this.placeData.find((c) => c.placement == A);
1458
- r.includes(A) ? a.handler != n && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[A] || this.placementUnBind(a).then(() => {
1459
- window.placementUnBind[A] || (window.placementUnBind[A] = !0, this.placementBind(A));
1460
- })) : this.call({
1461
- method: "placement.bind",
1462
- params: {
1463
- PLACEMENT: A,
1464
- HANDLER: n,
1465
- LANG_ALL: {
1466
- ru: {
1467
- TITLE: e
1468
- }
1469
- }
1470
- }
1471
- }).then((c) => {
1472
- c ? console.info("Приложение успешно встроено в", A) : console.warn("Приложение не может быть встроено в", A);
1473
- });
1474
- }
1475
- /** Отвязка встройки из place */
1476
- placementUnBind(A) {
1477
- const { pathApp: e, appName: n } = this.appConst;
1478
- return this.call({
1479
- method: "placement.unbind",
1480
- params: {
1481
- PLACEMENT: A,
1482
- HANDLER: e,
1483
- LANG_ALL: {
1484
- ru: {
1485
- TITLE: n
1486
- }
1487
- }
1488
- }
1489
- }).then((r) => (console.log("Встройка отвязана", A), r));
1490
- }
1491
- /** Чат-бот */
1492
- /* получение списка ботов */
1493
- getBotList() {
1494
- return this.call({
1495
- method: "imbot.bot.list",
1496
- params: {}
1497
- }).then((A) => {
1498
- let e = Object.values(A);
1499
- return console.log("chat-bot list:", e), e;
1500
- });
1501
- }
1502
- /* регистрация бота */
1503
- regBot({ code: A, type: e, name: n }) {
1504
- const { appName: r, pathApp: a, chatBotLogo: c } = this.appConst, O = this.appInfo.ID;
1505
- return this.call({
1506
- method: "imbot.register",
1507
- params: {
1508
- CODE: A ?? this.appInfo.CODE,
1509
- // Строковой идентификатор бота, уникальный в рамках вашего приложения (обяз.)
1510
- TYPE: e ?? "O",
1511
- // Тип бота, B - чат-бот, ответы поступают сразу, H - человек, ответы поступают с задержкой от 2-х до 10 секунд, O - чат-бот для Открытых линий, S - чат-бот с повышенными привилегиями (supervisor)
1512
- EVENT_HANDLER: a,
1513
- // Ссылка на обработчик событий, поступивших от сервера - см. Обработчики событий ниже (обяз).
1514
- OPENLINE: "Y",
1515
- // Включение режима поддержки Открытых линий, можно не указывать, если TYPE = 'O'
1516
- CLIENT_ID: "",
1517
- // строковый идентификатор чат-бота, используется только в режиме Вебхуков
1518
- PROPERTIES: {
1519
- // Личные данные чат-бота (обяз.)
1520
- NAME: `${n ?? r} - бот #${O}`,
1521
- // Имя чат-бота (обязательное одно из полей NAME или LAST_NAME)
1522
- LAST_NAME: "",
1523
- // Фамилия чат-бота (обязательное одно из полей NAME или LAST_NAME)
1524
- COLOR: "GREEN",
1525
- // Цвет чат-бота для мобильного приложения RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, PINK, LIME, BROWN, AZURE, KHAKI, SAND, MARENGO, GRAY, GRAPHITE
1526
- EMAIL: "",
1527
- // E-mail для связи. НЕЛЬЗЯ использовать e-mail, дублирующий e-mail реальных пользователей
1528
- PERSONAL_BIRTHDAY: Ht().format("%Y-%m-%d"),
1529
- // День рождения в формате YYYY-mm-dd
1530
- WORK_POSITION: "Почтальон",
1531
- // Занимаемая должность, используется как описание чат-бота
1532
- PERSONAL_WWW: "",
1533
- // Ссылка на сайт
1534
- PERSONAL_GENDER: "M",
1535
- // Пол чат-бота, допустимые значения M - мужской, F - женский, пусто, если не требуется указывать
1536
- PERSONAL_PHOTO: c ?? ""
1537
- // Аватар чат-бота - base64
1538
- }
1539
- }
1540
- }).then((u) => (console.log("Чат-бот добавлен", u), u));
1541
- }
1542
- /* Убрать регистрацию бота */
1543
- unRegBot(A) {
1544
- return this.call({
1545
- method: "imbot.unregister",
1546
- params: {
1547
- BOT_ID: A
1548
- }
1549
- }).then((e) => (console.log("чат-бот удален", e), e));
1550
- }
1551
- /* Получение данных логера */
1552
- getLoggerList(A) {
1553
- return this.logger.getEntityList(A);
1554
- }
1555
- }
1556
- kt = new WeakSet(), le = function() {
1557
- return this.call({ method: "app.info" });
1558
- }, Xt = new WeakSet(), ue = function() {
1559
- return this.call({ method: "user.current" });
1560
- };
1561
- export {
1562
- X as Batch,
1563
- Ee as BxBoot,
1564
- ne as BxHelper,
1565
- de as BxLogger,
1566
- Ht as tempus
1567
- };