dev-classes 1.4.18 → 1.4.22
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/README.md
CHANGED
|
@@ -92,6 +92,7 @@ interface DateProcessingProps{
|
|
|
92
92
|
hasDateLessPeriods(a:string, b: string, c:string, d?:{dateMinMax: '<=' | '>=' | '<' | '>'}):Record<'one' | 'two', boolean>
|
|
93
93
|
getDi(a:string, b: string):number
|
|
94
94
|
getDifferenceDates(a:string, b: string):number
|
|
95
|
+
calculateTimeDifference(a:string, b: string):Record<'days' | 'hours' | 'minutes' | 'seconds' | 'totalSeconds', number> & Record<'formatted' | 'formattedShort', string>
|
|
95
96
|
hasDateLessInNumber(a:string, b: string, c:number):boolean
|
|
96
97
|
correctionCurrentYear(a:[string], b?:number):string[]
|
|
97
98
|
getChunkFromDate(a:string, b:'day' | 'month' | 'year', c?:{isBeforeZero:boolean}):string
|
|
@@ -1,38 +1,49 @@
|
|
|
1
1
|
import { DateProcessingProps } from './DateProcessing.types';
|
|
2
2
|
export declare class DateProcessing {
|
|
3
|
-
static getActiveColorClassInDiffDate: DateProcessingProps[
|
|
4
|
-
static getClassByDifferenceDay: DateProcessingProps[
|
|
5
|
-
static getMinMaxDate: DateProcessingProps[
|
|
6
|
-
static splitDateFromTime: DateProcessingProps[
|
|
7
|
-
static getCorrectDateAndTime: DateProcessingProps[
|
|
8
|
-
static reverseDate: DateProcessingProps[
|
|
9
|
-
static correctionDataISO8601: DateProcessingProps[
|
|
10
|
-
static isDateDMY: DateProcessingProps[
|
|
3
|
+
static getActiveColorClassInDiffDate: DateProcessingProps["getActiveColorClassInDiffDate"];
|
|
4
|
+
static getClassByDifferenceDay: DateProcessingProps["getClassByDifferenceDay"];
|
|
5
|
+
static getMinMaxDate: DateProcessingProps["getMinMaxDate"];
|
|
6
|
+
static splitDateFromTime: DateProcessingProps["splitDateFromTime"];
|
|
7
|
+
static getCorrectDateAndTime: DateProcessingProps["getCorrectDateAndTime"];
|
|
8
|
+
static reverseDate: DateProcessingProps["reverseDate"];
|
|
9
|
+
static correctionDataISO8601: DateProcessingProps["correctionDataISO8601"];
|
|
10
|
+
static isDateDMY: DateProcessingProps["isDateDMY"];
|
|
11
11
|
static isDateISO8601: (date: string) => boolean;
|
|
12
|
-
static correctionDateAndRemoveYear: DateProcessingProps[
|
|
13
|
-
static correctionDateWithOutCurrentYear: DateProcessingProps[
|
|
14
|
-
static correctionShortYear: DateProcessingProps[
|
|
15
|
-
static correctionDate: DateProcessingProps[
|
|
16
|
-
static hasDateLessPeriod: DateProcessingProps[
|
|
17
|
-
static hasDateLessPeriods: DateProcessingProps[
|
|
18
|
-
static getDifferenceDates: DateProcessingProps[
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
static
|
|
30
|
-
static
|
|
12
|
+
static correctionDateAndRemoveYear: DateProcessingProps["correctionDateAndRemoveYear"];
|
|
13
|
+
static correctionDateWithOutCurrentYear: DateProcessingProps["correctionDateWithOutCurrentYear"];
|
|
14
|
+
static correctionShortYear: DateProcessingProps["correctionShortYear"];
|
|
15
|
+
static correctionDate: DateProcessingProps["correctionDate"];
|
|
16
|
+
static hasDateLessPeriod: DateProcessingProps["hasDateLessPeriod"];
|
|
17
|
+
static hasDateLessPeriods: DateProcessingProps["hasDateLessPeriods"];
|
|
18
|
+
static getDifferenceDates: DateProcessingProps["getDifferenceDates"];
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} startISODateTime - Начальная дата и время в ISO формате или формате 'YYYY-MM-DD HH:mm:ss'
|
|
21
|
+
* Пример: '2024-01-15T11:20:00' или '2024-01-15 11:20:00'
|
|
22
|
+
* @param {string} endISODateTime - Конечная дата и время в ISO формате или формате 'YYYY-MM-DD HH:mm:ss'
|
|
23
|
+
* Пример: '2024-02-16T11:27:36' или '2024-02-16 11:27:36'
|
|
24
|
+
* @returns {TimeDifferenceResult} Объект с результатами
|
|
25
|
+
* @example
|
|
26
|
+
* // Разница в 32 дня, 0 часов, 7 минут, 36 секунд
|
|
27
|
+
* getTimeDifference('2024-01-15T11:20:00', '2024-02-16T11:27:36');
|
|
28
|
+
*/
|
|
29
|
+
static calculateTimeDifference: DateProcessingProps["calculateTimeDifference"];
|
|
30
|
+
static hasDateLessInNumber: DateProcessingProps["hasDateLessInNumber"];
|
|
31
|
+
static correctionCurrentYear: DateProcessingProps["correctionCurrentYear"];
|
|
32
|
+
static getChunkFromDate: DateProcessingProps["getChunkFromDate"];
|
|
33
|
+
static getNameMonthByNumber: DateProcessingProps["getNameMonthByNumber"];
|
|
34
|
+
static minMaxMountStr: DateProcessingProps["minMaxMountStr"];
|
|
35
|
+
static getDatesToCurrentDate: DateProcessingProps["getDatesToCurrentDate"];
|
|
36
|
+
static getDayOfWeek: DateProcessingProps["getDayOfWeek"];
|
|
37
|
+
static cropSecond: DateProcessingProps["cropSecond"];
|
|
38
|
+
static getRenderDate: DateProcessingProps["getRenderDate"];
|
|
39
|
+
static getCurrentDate: DateProcessingProps["getCurrentDate"];
|
|
40
|
+
static getCurrentYear: DateProcessingProps["getCurrentYear"];
|
|
41
|
+
static getDaysInMonth: DateProcessingProps["getDaysInMonth"];
|
|
31
42
|
/**
|
|
32
43
|
*
|
|
33
44
|
* @param date example: '2022-01-01'
|
|
34
45
|
* @param config example: {day: 1, month: 1, year: 1}
|
|
35
46
|
* @returns example: '2023-02-02'
|
|
36
47
|
*/
|
|
37
|
-
static getDateDeviation: DateProcessingProps[
|
|
48
|
+
static getDateDeviation: DateProcessingProps["getDateDeviation"];
|
|
38
49
|
}
|
|
@@ -28,6 +28,7 @@ export interface DateProcessingProps {
|
|
|
28
28
|
}): Record<'one' | 'two', boolean>;
|
|
29
29
|
getDi(a: string, b: string): number;
|
|
30
30
|
getDifferenceDates(a: string, b: string): number;
|
|
31
|
+
calculateTimeDifference(a: string, b: string): Record<'days' | 'hours' | 'minutes' | 'seconds' | 'totalSeconds', number> & Record<'formatted' | 'formattedShort', string>;
|
|
31
32
|
hasDateLessInNumber(a: string, b: string, c: number): boolean;
|
|
32
33
|
correctionCurrentYear(a: [string], b?: number): string[];
|
|
33
34
|
getChunkFromDate(a: string, b: 'day' | 'month' | 'year', c?: {
|
package/dist/index.js
CHANGED
|
@@ -39,28 +39,28 @@ c(p, "hsvToRgb", (e, t, s) => {
|
|
|
39
39
|
c(p, "rgbaToHsla", (e, t, s, n = 1) => {
|
|
40
40
|
e /= 255, t /= 255, s /= 255;
|
|
41
41
|
const o = Math.max(e, t, s), i = Math.min(e, t, s);
|
|
42
|
-
let a = 0,
|
|
42
|
+
let a = 0, u;
|
|
43
43
|
const l = (o + i) / 2;
|
|
44
44
|
if (o === i)
|
|
45
|
-
a =
|
|
45
|
+
a = u = 0;
|
|
46
46
|
else {
|
|
47
|
-
const
|
|
48
|
-
switch (
|
|
47
|
+
const f = o - i;
|
|
48
|
+
switch (u = l > 0.5 ? f / (2 - o - i) : f / (o + i), o) {
|
|
49
49
|
case e:
|
|
50
|
-
a = (t - s) /
|
|
50
|
+
a = (t - s) / f + (t < s ? 6 : 0);
|
|
51
51
|
break;
|
|
52
52
|
case t:
|
|
53
|
-
a = (s - e) /
|
|
53
|
+
a = (s - e) / f + 2;
|
|
54
54
|
break;
|
|
55
55
|
case s:
|
|
56
|
-
a = (e - t) /
|
|
56
|
+
a = (e - t) / f + 4;
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
59
59
|
a /= 6;
|
|
60
60
|
}
|
|
61
61
|
return {
|
|
62
62
|
h: a * 360,
|
|
63
|
-
s:
|
|
63
|
+
s: u * 100,
|
|
64
64
|
l: l * 100,
|
|
65
65
|
a: n
|
|
66
66
|
};
|
|
@@ -80,12 +80,12 @@ c(p, "hslaToRgba", (e, t, s, n) => {
|
|
|
80
80
|
if (t === 0)
|
|
81
81
|
o = i = a = s;
|
|
82
82
|
else {
|
|
83
|
-
const
|
|
83
|
+
const u = function(y, w, d) {
|
|
84
84
|
return d < 0 && (d += 1), d > 1 && (d -= 1), d < 0.16666666666666666 ? y + (w - y) * 6 * d : d < 0.5 ? w : d < 0.6666666666666666 ? y + (w - y) * (0.6666666666666666 - d) * 6 : y;
|
|
85
|
-
}, l = s < 0.5 ? s * (1 + t) : s + t - s * t,
|
|
86
|
-
o = f
|
|
85
|
+
}, l = s < 0.5 ? s * (1 + t) : s + t - s * t, f = 2 * s - l;
|
|
86
|
+
o = u(f, l, e + 1 / 3), i = u(f, l, e), a = u(f, l, e - 1 / 3);
|
|
87
87
|
}
|
|
88
|
-
return [o, i, a, n].map((
|
|
88
|
+
return [o, i, a, n].map((u) => Math.round(u * 255));
|
|
89
89
|
}), c(p, "hslaStringToRgba", (e) => {
|
|
90
90
|
const t = e.slice(5, -1).split(", "), s = Number(t.pop()), n = t.map((o) => o.endsWith("%") ? +o.slice(0, -1) : +o);
|
|
91
91
|
return p.hslaToRgba(n[0], n[1], n[2], s);
|
|
@@ -131,13 +131,13 @@ c(p, "mixColors", (e, t, s) => {
|
|
|
131
131
|
return s;
|
|
132
132
|
const a = e[1] ? Math.min(1.5 * o[1] / e[1], 1) : 0;
|
|
133
133
|
o[0] = Math.min(360, o[0] + t[0] - e[0]), o[1] = e[1] ? Math.min(1, o[1] * t[1] / e[1]) : 0, o[2] = e[2] ? Math.min(1, o[2] * (1 - a + a * t[2] / e[2])) : 0;
|
|
134
|
-
let
|
|
135
|
-
const l = p.calculateBrightness(s),
|
|
136
|
-
if (n ? l >
|
|
137
|
-
const w = 0.4 * l /
|
|
138
|
-
|
|
134
|
+
let u = p.hsvToRgb(...o);
|
|
135
|
+
const l = p.calculateBrightness(s), f = p.calculateBrightness(u);
|
|
136
|
+
if (n ? l > f : l < f) {
|
|
137
|
+
const w = 0.4 * l / f + 0.6;
|
|
138
|
+
u = p.changeBrightness(u, w);
|
|
139
139
|
}
|
|
140
|
-
return
|
|
140
|
+
return u;
|
|
141
141
|
}), c(p, "changeBrightness", (e, t) => e.map((s) => p.clamp(Math.round(s * t), 0, 255))), c(p, "hexBrightness", (e, t) => {
|
|
142
142
|
const s = p.hexToRgb(e), n = p.changeBrightness(s, t), [o, i, a] = n;
|
|
143
143
|
return p.rgbToHex(o, i, a);
|
|
@@ -231,6 +231,27 @@ c(_DateProcessing, "getActiveColorClassInDiffDate", (r, e, t) => {
|
|
|
231
231
|
})), c(_DateProcessing, "getDifferenceDates", (r, e) => {
|
|
232
232
|
const t = new Date(_DateProcessing.correctionDataISO8601(r)), s = new Date(_DateProcessing.correctionDataISO8601(e)), n = 1e3 * 60 * 60 * 24, o = s.getTime() - t.getTime();
|
|
233
233
|
return Math.round(o / n);
|
|
234
|
+
}), /**
|
|
235
|
+
* @param {string} startISODateTime - Начальная дата и время в ISO формате или формате 'YYYY-MM-DD HH:mm:ss'
|
|
236
|
+
* Пример: '2024-01-15T11:20:00' или '2024-01-15 11:20:00'
|
|
237
|
+
* @param {string} endISODateTime - Конечная дата и время в ISO формате или формате 'YYYY-MM-DD HH:mm:ss'
|
|
238
|
+
* Пример: '2024-02-16T11:27:36' или '2024-02-16 11:27:36'
|
|
239
|
+
* @returns {TimeDifferenceResult} Объект с результатами
|
|
240
|
+
* @example
|
|
241
|
+
* // Разница в 32 дня, 0 часов, 7 минут, 36 секунд
|
|
242
|
+
* getTimeDifference('2024-01-15T11:20:00', '2024-02-16T11:27:36');
|
|
243
|
+
*/
|
|
244
|
+
c(_DateProcessing, "calculateTimeDifference", (r, e) => {
|
|
245
|
+
const t = new Date(r), n = new Date(e) - t, o = Math.floor(n / 1e3), i = Math.floor(o / (3600 * 24)), a = Math.floor(o % (3600 * 24) / 3600), u = Math.floor(o % 3600 / 60), l = o % 60;
|
|
246
|
+
return {
|
|
247
|
+
totalSeconds: o,
|
|
248
|
+
formatted: `${i} дней ${a.toString().padStart(2, "0")}:${u.toString().padStart(2, "0")}:${l.toString().padStart(2, "0")}`,
|
|
249
|
+
formattedShort: `${a.toString().padStart(2, "0")}:${u.toString().padStart(2, "0")}:${l.toString().padStart(2, "0")}`,
|
|
250
|
+
days: i,
|
|
251
|
+
hours: a,
|
|
252
|
+
minutes: u,
|
|
253
|
+
seconds: l
|
|
254
|
+
};
|
|
234
255
|
}), c(_DateProcessing, "hasDateLessInNumber", (r, e, t) => {
|
|
235
256
|
const s = _DateProcessing.getDifferenceDates(r, e);
|
|
236
257
|
return t <= s;
|
|
@@ -249,11 +270,7 @@ c(_DateProcessing, "getActiveColorClassInDiffDate", (r, e, t) => {
|
|
|
249
270
|
return s[0];
|
|
250
271
|
}
|
|
251
272
|
}), c(_DateProcessing, "getNameMonthByNumber", (r) => r > 0 && r < 13 ? itemsMonths[Number(r) - 1] : itemsMonths[0]), c(_DateProcessing, "minMaxMountStr", (r) => ({
|
|
252
|
-
minMaxMonth: _DateProcessing.getNameMonthByNumber(
|
|
253
|
-
Number(_DateProcessing.getChunkFromDate(r.minDate, "month", { isBeforeZero: !1 }))
|
|
254
|
-
) + " - " + _DateProcessing.getNameMonthByNumber(
|
|
255
|
-
Number(_DateProcessing.getChunkFromDate(r.maxDate, "month", { isBeforeZero: !1 }))
|
|
256
|
-
)
|
|
273
|
+
minMaxMonth: _DateProcessing.getNameMonthByNumber(Number(_DateProcessing.getChunkFromDate(r.minDate, "month", { isBeforeZero: !1 }))) + " - " + _DateProcessing.getNameMonthByNumber(Number(_DateProcessing.getChunkFromDate(r.maxDate, "month", { isBeforeZero: !1 })))
|
|
257
274
|
})), c(_DateProcessing, "getDatesToCurrentDate", (r) => r.filter((e) => _DateProcessing.hasDateLessPeriod(e, _DateProcessing.getCurrentDate()))), c(_DateProcessing, "getDayOfWeek", (r) => {
|
|
258
275
|
let e = _DateProcessing.correctionDataISO8601(r);
|
|
259
276
|
const t = new Date(e).getDay();
|
|
@@ -274,7 +291,7 @@ c(_DateProcessing, "getActiveColorClassInDiffDate", (r, e, t) => {
|
|
|
274
291
|
const r = /* @__PURE__ */ new Date(), e = _DateProcessing.getCurrentYear(), t = r.toJSON().split("T")[0].slice(5);
|
|
275
292
|
return `${e}-${t}`;
|
|
276
293
|
}), c(_DateProcessing, "getCurrentYear", () => (/* @__PURE__ */ new Date()).getFullYear()), c(_DateProcessing, "getDaysInMonth", (r, e) => new Date(e, r, 0).getDate()), /**
|
|
277
|
-
*
|
|
294
|
+
*
|
|
278
295
|
* @param date example: '2022-01-01'
|
|
279
296
|
* @param config example: {day: 1, month: 1, year: 1}
|
|
280
297
|
* @returns example: '2023-02-02'
|
|
@@ -295,14 +312,14 @@ class DelaysPromise {
|
|
|
295
312
|
}, n = (h) => {
|
|
296
313
|
t != null && t.controlAction && (t == null || t.controlAction(h));
|
|
297
314
|
};
|
|
298
|
-
let o = !0, i, a,
|
|
315
|
+
let o = !0, i, a, u;
|
|
299
316
|
const l = (h = !0) => {
|
|
300
317
|
const y = "Ручное завершение startActionEvery";
|
|
301
|
-
o = !1, clearInterval(i), s(null), h ? a && a({ status: h, msg: y + ": (true)" }) :
|
|
318
|
+
o = !1, clearInterval(i), s(null), h ? a && a({ status: h, msg: y + ": (true)" }) : u && u({ status: h, msg: y + ": (false)" });
|
|
302
319
|
};
|
|
303
320
|
return {
|
|
304
321
|
promise: new Promise((h, y) => {
|
|
305
|
-
a = h,
|
|
322
|
+
a = h, u = y;
|
|
306
323
|
let w = 0, d = 0;
|
|
307
324
|
i = setInterval(
|
|
308
325
|
() => {
|
|
@@ -337,7 +354,7 @@ class DelaysPromise {
|
|
|
337
354
|
}).catch((l) => {
|
|
338
355
|
i === 1 && (i = 0, a.msg = l, o(l));
|
|
339
356
|
});
|
|
340
|
-
let
|
|
357
|
+
let u = setInterval(() => {
|
|
341
358
|
if (i === 1) {
|
|
342
359
|
if (i = 0, typeof t == "function") {
|
|
343
360
|
o({ status: !1, msg: "", ...t(a) });
|
|
@@ -345,7 +362,7 @@ class DelaysPromise {
|
|
|
345
362
|
}
|
|
346
363
|
o({ status: !1, msg: "oneOfPromise reject" });
|
|
347
364
|
}
|
|
348
|
-
clearInterval(
|
|
365
|
+
clearInterval(u);
|
|
349
366
|
}, s * 1e3);
|
|
350
367
|
}));
|
|
351
368
|
}
|
|
@@ -548,8 +565,8 @@ const toJSONObject = (r) => {
|
|
|
548
565
|
e[n] = s;
|
|
549
566
|
const o = isArray(s) ? [] : {};
|
|
550
567
|
return forEach(s, (i, a) => {
|
|
551
|
-
const
|
|
552
|
-
!isUndefined(
|
|
568
|
+
const u = t(i, n + 1);
|
|
569
|
+
!isUndefined(u) && (o[a] = u);
|
|
553
570
|
}), e[n] = void 0, o;
|
|
554
571
|
}
|
|
555
572
|
}
|
|
@@ -669,8 +686,8 @@ Object.defineProperties(AxiosError, descriptors);
|
|
|
669
686
|
Object.defineProperty(prototype$1, "isAxiosError", { value: !0 });
|
|
670
687
|
AxiosError.from = (r, e, t, s, n, o) => {
|
|
671
688
|
const i = Object.create(prototype$1);
|
|
672
|
-
return utils$1.toFlatObject(r, i, function(
|
|
673
|
-
return
|
|
689
|
+
return utils$1.toFlatObject(r, i, function(u) {
|
|
690
|
+
return u !== Error.prototype;
|
|
674
691
|
}, (a) => a !== "isAxiosError"), AxiosError.call(i, r.message, e, t, s, n), i.cause = r, i.name = r.name, o && Object.assign(i, o), i;
|
|
675
692
|
};
|
|
676
693
|
const httpAdapter = null;
|
|
@@ -701,7 +718,7 @@ function toFormData(r, e, t) {
|
|
|
701
718
|
}, !1, function(g, m) {
|
|
702
719
|
return !utils$1.isUndefined(m[g]);
|
|
703
720
|
});
|
|
704
|
-
const s = t.metaTokens, n = t.visitor ||
|
|
721
|
+
const s = t.metaTokens, n = t.visitor || f, o = t.dots, i = t.indexes, u = (t.Blob || typeof Blob < "u" && Blob) && utils$1.isSpecCompliantForm(e);
|
|
705
722
|
if (!utils$1.isFunction(n))
|
|
706
723
|
throw new TypeError("visitor must be a function");
|
|
707
724
|
function l(d) {
|
|
@@ -709,11 +726,11 @@ function toFormData(r, e, t) {
|
|
|
709
726
|
return "";
|
|
710
727
|
if (utils$1.isDate(d))
|
|
711
728
|
return d.toISOString();
|
|
712
|
-
if (!
|
|
729
|
+
if (!u && utils$1.isBlob(d))
|
|
713
730
|
throw new AxiosError("Blob is not supported. Use a Buffer instead.");
|
|
714
|
-
return utils$1.isArrayBuffer(d) || utils$1.isTypedArray(d) ?
|
|
731
|
+
return utils$1.isArrayBuffer(d) || utils$1.isTypedArray(d) ? u && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
|
|
715
732
|
}
|
|
716
|
-
function
|
|
733
|
+
function f(d, g, m) {
|
|
717
734
|
let D = d;
|
|
718
735
|
if (d && !m && typeof d == "object") {
|
|
719
736
|
if (utils$1.endsWith(g, "{}"))
|
|
@@ -730,7 +747,7 @@ function toFormData(r, e, t) {
|
|
|
730
747
|
return isVisitable(d) ? !0 : (e.append(renderKey(m, g, o), l(d)), !1);
|
|
731
748
|
}
|
|
732
749
|
const h = [], y = Object.assign(predicates, {
|
|
733
|
-
defaultVisitor:
|
|
750
|
+
defaultVisitor: f,
|
|
734
751
|
convertValue: l,
|
|
735
752
|
isVisitable
|
|
736
753
|
});
|
|
@@ -898,8 +915,8 @@ function formDataToJSON(r) {
|
|
|
898
915
|
let i = t[o++];
|
|
899
916
|
if (i === "__proto__")
|
|
900
917
|
return !0;
|
|
901
|
-
const a = Number.isFinite(+i),
|
|
902
|
-
return i = !i && utils$1.isArray(n) ? n.length : i,
|
|
918
|
+
const a = Number.isFinite(+i), u = o >= t.length;
|
|
919
|
+
return i = !i && utils$1.isArray(n) ? n.length : i, u ? (utils$1.hasOwnProp(n, i) ? n[i] = [n[i], s] : n[i] = s, !a) : ((!n[i] || !utils$1.isObject(n[i])) && (n[i] = []), e(t, s, n[i], o) && utils$1.isArray(n[i]) && (n[i] = arrayToObject(n[i])), !a);
|
|
903
920
|
}
|
|
904
921
|
if (utils$1.isFormData(r) && utils$1.isFunction(r.entries)) {
|
|
905
922
|
const t = {};
|
|
@@ -937,10 +954,10 @@ const defaults = {
|
|
|
937
954
|
if (s.indexOf("application/x-www-form-urlencoded") > -1)
|
|
938
955
|
return toURLEncodedForm(e, this.formSerializer).toString();
|
|
939
956
|
if ((a = utils$1.isFileList(e)) || s.indexOf("multipart/form-data") > -1) {
|
|
940
|
-
const
|
|
957
|
+
const u = this.env && this.env.FormData;
|
|
941
958
|
return toFormData(
|
|
942
959
|
a ? { "files[]": e } : e,
|
|
943
|
-
|
|
960
|
+
u && new u(),
|
|
944
961
|
this.formSerializer
|
|
945
962
|
);
|
|
946
963
|
}
|
|
@@ -1058,21 +1075,21 @@ class AxiosHeaders {
|
|
|
1058
1075
|
}
|
|
1059
1076
|
set(e, t, s) {
|
|
1060
1077
|
const n = this;
|
|
1061
|
-
function o(a,
|
|
1062
|
-
const
|
|
1063
|
-
if (!
|
|
1078
|
+
function o(a, u, l) {
|
|
1079
|
+
const f = normalizeHeader(u);
|
|
1080
|
+
if (!f)
|
|
1064
1081
|
throw new Error("header name must be a non-empty string");
|
|
1065
|
-
const h = utils$1.findKey(n,
|
|
1066
|
-
(!h || n[h] === void 0 || l === !0 || l === void 0 && n[h] !== !1) && (n[h ||
|
|
1082
|
+
const h = utils$1.findKey(n, f);
|
|
1083
|
+
(!h || n[h] === void 0 || l === !0 || l === void 0 && n[h] !== !1) && (n[h || u] = normalizeValue(a));
|
|
1067
1084
|
}
|
|
1068
|
-
const i = (a,
|
|
1085
|
+
const i = (a, u) => utils$1.forEach(a, (l, f) => o(l, f, u));
|
|
1069
1086
|
if (utils$1.isPlainObject(e) || e instanceof this.constructor)
|
|
1070
1087
|
i(e, t);
|
|
1071
1088
|
else if (utils$1.isString(e) && (e = e.trim()) && !isValidHeaderName(e))
|
|
1072
1089
|
i(parseHeaders(e), t);
|
|
1073
1090
|
else if (utils$1.isHeaders(e))
|
|
1074
|
-
for (const [a,
|
|
1075
|
-
o(
|
|
1091
|
+
for (const [a, u] of e.entries())
|
|
1092
|
+
o(u, a, s);
|
|
1076
1093
|
else
|
|
1077
1094
|
e != null && o(t, e, s);
|
|
1078
1095
|
return this;
|
|
@@ -1216,26 +1233,26 @@ function speedometer(r, e) {
|
|
|
1216
1233
|
r = r || 10;
|
|
1217
1234
|
const t = new Array(r), s = new Array(r);
|
|
1218
1235
|
let n = 0, o = 0, i;
|
|
1219
|
-
return e = e !== void 0 ? e : 1e3, function(
|
|
1220
|
-
const l = Date.now(),
|
|
1221
|
-
i || (i = l), t[n] =
|
|
1236
|
+
return e = e !== void 0 ? e : 1e3, function(u) {
|
|
1237
|
+
const l = Date.now(), f = s[o];
|
|
1238
|
+
i || (i = l), t[n] = u, s[n] = l;
|
|
1222
1239
|
let h = o, y = 0;
|
|
1223
1240
|
for (; h !== n; )
|
|
1224
1241
|
y += t[h++], h = h % r;
|
|
1225
1242
|
if (n = (n + 1) % r, n === o && (o = (o + 1) % r), l - i < e)
|
|
1226
1243
|
return;
|
|
1227
|
-
const w =
|
|
1244
|
+
const w = f && l - f;
|
|
1228
1245
|
return w ? Math.round(y * 1e3 / w) : void 0;
|
|
1229
1246
|
};
|
|
1230
1247
|
}
|
|
1231
1248
|
function throttle(r, e) {
|
|
1232
1249
|
let t = 0, s = 1e3 / e, n, o;
|
|
1233
|
-
const i = (l,
|
|
1234
|
-
t =
|
|
1250
|
+
const i = (l, f = Date.now()) => {
|
|
1251
|
+
t = f, n = null, o && (clearTimeout(o), o = null), r.apply(null, l);
|
|
1235
1252
|
};
|
|
1236
1253
|
return [(...l) => {
|
|
1237
|
-
const
|
|
1238
|
-
h >= s ? i(l,
|
|
1254
|
+
const f = Date.now(), h = f - t;
|
|
1255
|
+
h >= s ? i(l, f) : (n = l, o || (o = setTimeout(() => {
|
|
1239
1256
|
o = null, i(n);
|
|
1240
1257
|
}, s - h)));
|
|
1241
1258
|
}, () => n && i(n)];
|
|
@@ -1244,15 +1261,15 @@ const progressEventReducer = (r, e, t = 3) => {
|
|
|
1244
1261
|
let s = 0;
|
|
1245
1262
|
const n = speedometer(50, 250);
|
|
1246
1263
|
return throttle((o) => {
|
|
1247
|
-
const i = o.loaded, a = o.lengthComputable ? o.total : void 0,
|
|
1264
|
+
const i = o.loaded, a = o.lengthComputable ? o.total : void 0, u = i - s, l = n(u), f = i <= a;
|
|
1248
1265
|
s = i;
|
|
1249
1266
|
const h = {
|
|
1250
1267
|
loaded: i,
|
|
1251
1268
|
total: a,
|
|
1252
1269
|
progress: a ? i / a : void 0,
|
|
1253
|
-
bytes:
|
|
1270
|
+
bytes: u,
|
|
1254
1271
|
rate: l || void 0,
|
|
1255
|
-
estimated: l && a &&
|
|
1272
|
+
estimated: l && a && f ? (a - i) / l : void 0,
|
|
1256
1273
|
event: o,
|
|
1257
1274
|
lengthComputable: a != null,
|
|
1258
1275
|
[e ? "download" : "upload"]: !0
|
|
@@ -1337,34 +1354,34 @@ const headersToObject = (r) => r instanceof AxiosHeaders$1 ? { ...r } : r;
|
|
|
1337
1354
|
function mergeConfig(r, e) {
|
|
1338
1355
|
e = e || {};
|
|
1339
1356
|
const t = {};
|
|
1340
|
-
function s(l,
|
|
1341
|
-
return utils$1.isPlainObject(l) && utils$1.isPlainObject(
|
|
1357
|
+
function s(l, f, h) {
|
|
1358
|
+
return utils$1.isPlainObject(l) && utils$1.isPlainObject(f) ? utils$1.merge.call({ caseless: h }, l, f) : utils$1.isPlainObject(f) ? utils$1.merge({}, f) : utils$1.isArray(f) ? f.slice() : f;
|
|
1342
1359
|
}
|
|
1343
|
-
function n(l,
|
|
1344
|
-
if (utils$1.isUndefined(
|
|
1360
|
+
function n(l, f, h) {
|
|
1361
|
+
if (utils$1.isUndefined(f)) {
|
|
1345
1362
|
if (!utils$1.isUndefined(l))
|
|
1346
1363
|
return s(void 0, l, h);
|
|
1347
1364
|
} else
|
|
1348
|
-
return s(l,
|
|
1365
|
+
return s(l, f, h);
|
|
1349
1366
|
}
|
|
1350
|
-
function o(l,
|
|
1351
|
-
if (!utils$1.isUndefined(
|
|
1352
|
-
return s(void 0,
|
|
1367
|
+
function o(l, f) {
|
|
1368
|
+
if (!utils$1.isUndefined(f))
|
|
1369
|
+
return s(void 0, f);
|
|
1353
1370
|
}
|
|
1354
|
-
function i(l,
|
|
1355
|
-
if (utils$1.isUndefined(
|
|
1371
|
+
function i(l, f) {
|
|
1372
|
+
if (utils$1.isUndefined(f)) {
|
|
1356
1373
|
if (!utils$1.isUndefined(l))
|
|
1357
1374
|
return s(void 0, l);
|
|
1358
1375
|
} else
|
|
1359
|
-
return s(void 0,
|
|
1376
|
+
return s(void 0, f);
|
|
1360
1377
|
}
|
|
1361
|
-
function a(l,
|
|
1378
|
+
function a(l, f, h) {
|
|
1362
1379
|
if (h in e)
|
|
1363
|
-
return s(l,
|
|
1380
|
+
return s(l, f);
|
|
1364
1381
|
if (h in r)
|
|
1365
1382
|
return s(void 0, l);
|
|
1366
1383
|
}
|
|
1367
|
-
const
|
|
1384
|
+
const u = {
|
|
1368
1385
|
url: o,
|
|
1369
1386
|
method: o,
|
|
1370
1387
|
data: o,
|
|
@@ -1393,11 +1410,11 @@ function mergeConfig(r, e) {
|
|
|
1393
1410
|
socketPath: i,
|
|
1394
1411
|
responseEncoding: i,
|
|
1395
1412
|
validateStatus: a,
|
|
1396
|
-
headers: (l,
|
|
1413
|
+
headers: (l, f) => n(headersToObject(l), headersToObject(f), !0)
|
|
1397
1414
|
};
|
|
1398
|
-
return utils$1.forEach(Object.keys(Object.assign({}, r, e)), function(
|
|
1399
|
-
const h = f
|
|
1400
|
-
utils$1.isUndefined(y) && h !== a || (t[
|
|
1415
|
+
return utils$1.forEach(Object.keys(Object.assign({}, r, e)), function(f) {
|
|
1416
|
+
const h = u[f] || n, y = h(r[f], e[f], f);
|
|
1417
|
+
utils$1.isUndefined(y) && h !== a || (t[f] = y);
|
|
1401
1418
|
}), t;
|
|
1402
1419
|
}
|
|
1403
1420
|
const resolveConfig = (r) => {
|
|
@@ -1407,13 +1424,13 @@ const resolveConfig = (r) => {
|
|
|
1407
1424
|
"Authorization",
|
|
1408
1425
|
"Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))
|
|
1409
1426
|
);
|
|
1410
|
-
let
|
|
1427
|
+
let u;
|
|
1411
1428
|
if (utils$1.isFormData(t)) {
|
|
1412
1429
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv)
|
|
1413
1430
|
i.setContentType(void 0);
|
|
1414
|
-
else if ((
|
|
1415
|
-
const [l, ...
|
|
1416
|
-
i.setContentType([l || "multipart/form-data", ...
|
|
1431
|
+
else if ((u = i.getContentType()) !== !1) {
|
|
1432
|
+
const [l, ...f] = u ? u.split(";").map((h) => h.trim()).filter(Boolean) : [];
|
|
1433
|
+
i.setContentType([l || "multipart/form-data", ...f].join("; "));
|
|
1417
1434
|
}
|
|
1418
1435
|
}
|
|
1419
1436
|
if (platform.hasStandardBrowserEnv && (s && utils$1.isFunction(s) && (s = s(e)), s || s !== !1 && isURLSameOrigin(e.url))) {
|
|
@@ -1426,9 +1443,9 @@ const resolveConfig = (r) => {
|
|
|
1426
1443
|
const n = resolveConfig(r);
|
|
1427
1444
|
let o = n.data;
|
|
1428
1445
|
const i = AxiosHeaders$1.from(n.headers).normalize();
|
|
1429
|
-
let { responseType: a, onUploadProgress:
|
|
1446
|
+
let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = n, f, h, y, w, d;
|
|
1430
1447
|
function g() {
|
|
1431
|
-
w && w(), d && d(), n.cancelToken && n.cancelToken.unsubscribe(
|
|
1448
|
+
w && w(), d && d(), n.cancelToken && n.cancelToken.unsubscribe(f), n.signal && n.signal.removeEventListener("abort", f);
|
|
1432
1449
|
}
|
|
1433
1450
|
let m = new XMLHttpRequest();
|
|
1434
1451
|
m.open(n.method.toUpperCase(), n.url, !0), m.timeout = n.timeout;
|
|
@@ -1468,9 +1485,9 @@ const resolveConfig = (r) => {
|
|
|
1468
1485
|
)), m = null;
|
|
1469
1486
|
}, o === void 0 && i.setContentType(null), "setRequestHeader" in m && utils$1.forEach(i.toJSON(), function(T, x) {
|
|
1470
1487
|
m.setRequestHeader(x, T);
|
|
1471
|
-
}), utils$1.isUndefined(n.withCredentials) || (m.withCredentials = !!n.withCredentials), a && a !== "json" && (m.responseType = n.responseType), l && ([y, d] = progressEventReducer(l, !0), m.addEventListener("progress", y)),
|
|
1488
|
+
}), utils$1.isUndefined(n.withCredentials) || (m.withCredentials = !!n.withCredentials), a && a !== "json" && (m.responseType = n.responseType), l && ([y, d] = progressEventReducer(l, !0), m.addEventListener("progress", y)), u && m.upload && ([h, w] = progressEventReducer(u), m.upload.addEventListener("progress", h), m.upload.addEventListener("loadend", w)), (n.cancelToken || n.signal) && (f = (E) => {
|
|
1472
1489
|
m && (s(!E || E.type ? new CanceledError(null, r, m) : E), m.abort(), m = null);
|
|
1473
|
-
}, n.cancelToken && n.cancelToken.subscribe(
|
|
1490
|
+
}, n.cancelToken && n.cancelToken.subscribe(f), n.signal && (n.signal.aborted ? f() : n.signal.addEventListener("abort", f)));
|
|
1474
1491
|
const A = parseProtocol(n.url);
|
|
1475
1492
|
if (A && platform.protocols.indexOf(A) === -1) {
|
|
1476
1493
|
s(new AxiosError("Unsupported protocol " + A + ":", AxiosError.ERR_BAD_REQUEST, r));
|
|
@@ -1485,8 +1502,8 @@ const resolveConfig = (r) => {
|
|
|
1485
1502
|
const o = function(l) {
|
|
1486
1503
|
if (!n) {
|
|
1487
1504
|
n = !0, a();
|
|
1488
|
-
const
|
|
1489
|
-
s.abort(
|
|
1505
|
+
const f = l instanceof Error ? l : this.reason;
|
|
1506
|
+
s.abort(f instanceof AxiosError ? f : new CanceledError(f instanceof Error ? f.message : f));
|
|
1490
1507
|
}
|
|
1491
1508
|
};
|
|
1492
1509
|
let i = e && setTimeout(() => {
|
|
@@ -1498,8 +1515,8 @@ const resolveConfig = (r) => {
|
|
|
1498
1515
|
}), r = null);
|
|
1499
1516
|
};
|
|
1500
1517
|
r.forEach((l) => l.addEventListener("abort", o));
|
|
1501
|
-
const { signal:
|
|
1502
|
-
return
|
|
1518
|
+
const { signal: u } = s;
|
|
1519
|
+
return u.unsubscribe = () => utils$1.asap(a), u;
|
|
1503
1520
|
}
|
|
1504
1521
|
}, composeSignals$1 = composeSignals, streamChunk = function* (r, e) {
|
|
1505
1522
|
let t = r.byteLength;
|
|
@@ -1531,29 +1548,29 @@ const resolveConfig = (r) => {
|
|
|
1531
1548
|
}
|
|
1532
1549
|
}, trackStream = (r, e, t, s) => {
|
|
1533
1550
|
const n = readBytes(r, e);
|
|
1534
|
-
let o = 0, i, a = (
|
|
1535
|
-
i || (i = !0, s && s(
|
|
1551
|
+
let o = 0, i, a = (u) => {
|
|
1552
|
+
i || (i = !0, s && s(u));
|
|
1536
1553
|
};
|
|
1537
1554
|
return new ReadableStream({
|
|
1538
|
-
async pull(
|
|
1555
|
+
async pull(u) {
|
|
1539
1556
|
try {
|
|
1540
|
-
const { done: l, value:
|
|
1557
|
+
const { done: l, value: f } = await n.next();
|
|
1541
1558
|
if (l) {
|
|
1542
|
-
a(),
|
|
1559
|
+
a(), u.close();
|
|
1543
1560
|
return;
|
|
1544
1561
|
}
|
|
1545
|
-
let h =
|
|
1562
|
+
let h = f.byteLength;
|
|
1546
1563
|
if (t) {
|
|
1547
1564
|
let y = o += h;
|
|
1548
1565
|
t(y);
|
|
1549
1566
|
}
|
|
1550
|
-
|
|
1567
|
+
u.enqueue(new Uint8Array(f));
|
|
1551
1568
|
} catch (l) {
|
|
1552
1569
|
throw a(l), l;
|
|
1553
1570
|
}
|
|
1554
1571
|
},
|
|
1555
|
-
cancel(
|
|
1556
|
-
return a(
|
|
1572
|
+
cancel(u) {
|
|
1573
|
+
return a(u), n.return();
|
|
1557
1574
|
}
|
|
1558
1575
|
}, {
|
|
1559
1576
|
highWaterMark: 2
|
|
@@ -1610,9 +1627,9 @@ const getBodyLength = async (r) => {
|
|
|
1610
1627
|
cancelToken: o,
|
|
1611
1628
|
timeout: i,
|
|
1612
1629
|
onDownloadProgress: a,
|
|
1613
|
-
onUploadProgress:
|
|
1630
|
+
onUploadProgress: u,
|
|
1614
1631
|
responseType: l,
|
|
1615
|
-
headers:
|
|
1632
|
+
headers: f,
|
|
1616
1633
|
withCredentials: h = "same-origin",
|
|
1617
1634
|
fetchOptions: y
|
|
1618
1635
|
} = resolveConfig(r);
|
|
@@ -1623,16 +1640,16 @@ const getBodyLength = async (r) => {
|
|
|
1623
1640
|
});
|
|
1624
1641
|
let m;
|
|
1625
1642
|
try {
|
|
1626
|
-
if (
|
|
1643
|
+
if (u && supportsRequestStream && t !== "get" && t !== "head" && (m = await resolveBodyLength(f, s)) !== 0) {
|
|
1627
1644
|
let x = new Request(e, {
|
|
1628
1645
|
method: "POST",
|
|
1629
1646
|
body: s,
|
|
1630
1647
|
duplex: "half"
|
|
1631
1648
|
}), O;
|
|
1632
|
-
if (utils$1.isFormData(s) && (O = x.headers.get("content-type")) &&
|
|
1649
|
+
if (utils$1.isFormData(s) && (O = x.headers.get("content-type")) && f.setContentType(O), x.body) {
|
|
1633
1650
|
const [$, k] = progressEventDecorator(
|
|
1634
1651
|
m,
|
|
1635
|
-
progressEventReducer(asyncDecorator(
|
|
1652
|
+
progressEventReducer(asyncDecorator(u))
|
|
1636
1653
|
);
|
|
1637
1654
|
s = trackStream(x.body, DEFAULT_CHUNK_SIZE, $, k);
|
|
1638
1655
|
}
|
|
@@ -1643,7 +1660,7 @@ const getBodyLength = async (r) => {
|
|
|
1643
1660
|
...y,
|
|
1644
1661
|
signal: w,
|
|
1645
1662
|
method: t.toUpperCase(),
|
|
1646
|
-
headers:
|
|
1663
|
+
headers: f.normalize().toJSON(),
|
|
1647
1664
|
body: s,
|
|
1648
1665
|
duplex: "half",
|
|
1649
1666
|
credentials: D ? h : void 0
|
|
@@ -1717,7 +1734,7 @@ const renderReason = (r) => `- ${r}`, isResolvedHandle = (r) => utils$1.isFuncti
|
|
|
1717
1734
|
}
|
|
1718
1735
|
if (!s) {
|
|
1719
1736
|
const o = Object.entries(n).map(
|
|
1720
|
-
([a,
|
|
1737
|
+
([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1721
1738
|
);
|
|
1722
1739
|
let i = e ? o.length > 1 ? `since :
|
|
1723
1740
|
` + o.map(renderReason).join(`
|
|
@@ -1786,9 +1803,9 @@ function assertOptions(r, e, t) {
|
|
|
1786
1803
|
for (; n-- > 0; ) {
|
|
1787
1804
|
const o = s[n], i = e[o];
|
|
1788
1805
|
if (i) {
|
|
1789
|
-
const a = r[o],
|
|
1790
|
-
if (
|
|
1791
|
-
throw new AxiosError("option " + o + " must be " +
|
|
1806
|
+
const a = r[o], u = a === void 0 || i(a, o, r);
|
|
1807
|
+
if (u !== !0)
|
|
1808
|
+
throw new AxiosError("option " + o + " must be " + u, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1792
1809
|
continue;
|
|
1793
1810
|
}
|
|
1794
1811
|
if (t !== !0)
|
|
@@ -1855,20 +1872,20 @@ class Axios {
|
|
|
1855
1872
|
}
|
|
1856
1873
|
), t.headers = AxiosHeaders$1.concat(i, o);
|
|
1857
1874
|
const a = [];
|
|
1858
|
-
let
|
|
1875
|
+
let u = !0;
|
|
1859
1876
|
this.interceptors.request.forEach(function(g) {
|
|
1860
|
-
typeof g.runWhen == "function" && g.runWhen(t) === !1 || (
|
|
1877
|
+
typeof g.runWhen == "function" && g.runWhen(t) === !1 || (u = u && g.synchronous, a.unshift(g.fulfilled, g.rejected));
|
|
1861
1878
|
});
|
|
1862
1879
|
const l = [];
|
|
1863
1880
|
this.interceptors.response.forEach(function(g) {
|
|
1864
1881
|
l.push(g.fulfilled, g.rejected);
|
|
1865
1882
|
});
|
|
1866
|
-
let
|
|
1867
|
-
if (!
|
|
1883
|
+
let f, h = 0, y;
|
|
1884
|
+
if (!u) {
|
|
1868
1885
|
const d = [dispatchRequest.bind(this), void 0];
|
|
1869
|
-
for (d.unshift.apply(d, a), d.push.apply(d, l), y = d.length,
|
|
1870
|
-
|
|
1871
|
-
return
|
|
1886
|
+
for (d.unshift.apply(d, a), d.push.apply(d, l), y = d.length, f = Promise.resolve(t); h < y; )
|
|
1887
|
+
f = f.then(d[h++], d[h++]);
|
|
1888
|
+
return f;
|
|
1872
1889
|
}
|
|
1873
1890
|
y = a.length;
|
|
1874
1891
|
let w = t;
|
|
@@ -1882,13 +1899,13 @@ class Axios {
|
|
|
1882
1899
|
}
|
|
1883
1900
|
}
|
|
1884
1901
|
try {
|
|
1885
|
-
|
|
1902
|
+
f = dispatchRequest.call(this, w);
|
|
1886
1903
|
} catch (d) {
|
|
1887
1904
|
return Promise.reject(d);
|
|
1888
1905
|
}
|
|
1889
1906
|
for (h = 0, y = l.length; h < y; )
|
|
1890
|
-
|
|
1891
|
-
return
|
|
1907
|
+
f = f.then(l[h++], l[h++]);
|
|
1908
|
+
return f;
|
|
1892
1909
|
}
|
|
1893
1910
|
getUri(e) {
|
|
1894
1911
|
e = mergeConfig(this.defaults, e);
|
|
@@ -2124,18 +2141,18 @@ function init(r, e) {
|
|
|
2124
2141
|
if (!(typeof document > "u")) {
|
|
2125
2142
|
i = assign({}, e, i), typeof i.expires == "number" && (i.expires = new Date(Date.now() + i.expires * 864e5)), i.expires && (i.expires = i.expires.toUTCString()), n = encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
2126
2143
|
var a = "";
|
|
2127
|
-
for (var
|
|
2128
|
-
i[
|
|
2144
|
+
for (var u in i)
|
|
2145
|
+
i[u] && (a += "; " + u, i[u] !== !0 && (a += "=" + i[u].split(";")[0]));
|
|
2129
2146
|
return document.cookie = n + "=" + r.write(o, n) + a;
|
|
2130
2147
|
}
|
|
2131
2148
|
}
|
|
2132
2149
|
function s(n) {
|
|
2133
2150
|
if (!(typeof document > "u" || arguments.length && !n)) {
|
|
2134
2151
|
for (var o = document.cookie ? document.cookie.split("; ") : [], i = {}, a = 0; a < o.length; a++) {
|
|
2135
|
-
var
|
|
2152
|
+
var u = o[a].split("="), l = u.slice(1).join("=");
|
|
2136
2153
|
try {
|
|
2137
|
-
var
|
|
2138
|
-
if (i[
|
|
2154
|
+
var f = decodeURIComponent(u[0]);
|
|
2155
|
+
if (i[f] = r.read(l, f), n === f)
|
|
2139
2156
|
break;
|
|
2140
2157
|
} catch {
|
|
2141
2158
|
}
|
|
@@ -2217,8 +2234,8 @@ const R = class R {
|
|
|
2217
2234
|
};
|
|
2218
2235
|
c(R, "events", (e, t, s, n = "") => new Promise((o, i) => {
|
|
2219
2236
|
let a = 0;
|
|
2220
|
-
for (let [
|
|
2221
|
-
a++, e === "add" ? t.addEventListener(
|
|
2237
|
+
for (let [u, l] of s)
|
|
2238
|
+
a++, e === "add" ? t.addEventListener(u, l) : t.removeEventListener(u, l), a === s.length && o("");
|
|
2222
2239
|
})), c(R, "sortDataByAlphabet", (e, t) => e.sort((s, n) => n[t].trim() < s[t].trim() ? 1 : -1)), c(R, "sortDataByDate", (e, t) => {
|
|
2223
2240
|
e.sort((s, n) => R.hasDateLessPeriod(n[t], s[t]) ? 1 : -1);
|
|
2224
2241
|
}), c(R, "sortDataByDateAndTime", (e, t) => {
|
|
@@ -2295,13 +2312,13 @@ c(S, "keyCookie", "AuthCookie"), c(S, "cookieOptions", {}), c(S, "registerReques
|
|
|
2295
2312
|
cookie: S.getAuthCookies()
|
|
2296
2313
|
},
|
|
2297
2314
|
timeout: 6e4
|
|
2298
|
-
}, a = Utils.deepMerge(i, t),
|
|
2315
|
+
}, a = Utils.deepMerge(i, t), u = 520, l = "", f = {
|
|
2299
2316
|
url: e,
|
|
2300
|
-
statusCode:
|
|
2317
|
+
statusCode: u,
|
|
2301
2318
|
msg: l,
|
|
2302
2319
|
isErr: !0,
|
|
2303
2320
|
request: a,
|
|
2304
|
-
errExt: { message: l, status:
|
|
2321
|
+
errExt: { message: l, status: u }
|
|
2305
2322
|
}, { cordova: h } = window;
|
|
2306
2323
|
if (h != null && h.cordova && ((y = h == null ? void 0 : h.plugin) != null && y.http)) {
|
|
2307
2324
|
const { http: w } = h == null ? void 0 : h.plugin;
|
|
@@ -2324,7 +2341,7 @@ c(S, "keyCookie", "AuthCookie"), c(S, "cookieOptions", {}), c(S, "registerReques
|
|
|
2324
2341
|
O.message = k, O.data = $, g.msg = S.errorsHandler.gerErrorByStatusCordovaHttp(D, m);
|
|
2325
2342
|
} else
|
|
2326
2343
|
typeof E == "string" && (O.message = E);
|
|
2327
|
-
n({ ...
|
|
2344
|
+
n({ ...f, ...g, errExt: O });
|
|
2328
2345
|
}
|
|
2329
2346
|
);
|
|
2330
2347
|
} else
|
|
@@ -2336,14 +2353,14 @@ c(S, "keyCookie", "AuthCookie"), c(S, "cookieOptions", {}), c(S, "registerReques
|
|
|
2336
2353
|
const d = S.errorsHandler.handleError(w), { code: g, config: m, status: D, message: A, response: E, stack: T } = w, x = {
|
|
2337
2354
|
code: g,
|
|
2338
2355
|
config: m,
|
|
2339
|
-
status: D ||
|
|
2356
|
+
status: D || u,
|
|
2340
2357
|
message: A,
|
|
2341
2358
|
headers: E == null ? void 0 : E.headers,
|
|
2342
2359
|
statusText: E == null ? void 0 : E.statusText,
|
|
2343
2360
|
data: E == null ? void 0 : E.data,
|
|
2344
2361
|
stack: T
|
|
2345
2362
|
};
|
|
2346
|
-
n({ ...
|
|
2363
|
+
n({ ...f, ...d, errExt: x });
|
|
2347
2364
|
});
|
|
2348
2365
|
})), c(S, "getAuthCookies", () => {
|
|
2349
2366
|
var s;
|
|
@@ -2497,33 +2514,33 @@ const b = class b {
|
|
|
2497
2514
|
const { url: s, ...n } = t;
|
|
2498
2515
|
return new Promise((o, i) => {
|
|
2499
2516
|
b.getIsInit() || b.init();
|
|
2500
|
-
const
|
|
2517
|
+
const u = b.getIsNetwork(), l = {
|
|
2501
2518
|
url: s,
|
|
2502
2519
|
keyAction: e,
|
|
2503
|
-
isErr: !
|
|
2504
|
-
msg:
|
|
2505
|
-
isReq:
|
|
2506
|
-
statusCode:
|
|
2520
|
+
isErr: !u,
|
|
2521
|
+
msg: u ? "" : "Нет интернета",
|
|
2522
|
+
isReq: u,
|
|
2523
|
+
statusCode: u ? 0 : 520,
|
|
2507
2524
|
isReload: !1
|
|
2508
2525
|
};
|
|
2509
|
-
if (b.events.publish("fetch", l),
|
|
2510
|
-
apiRequest.requestInServer(s, n).then((
|
|
2526
|
+
if (b.events.publish("fetch", l), u) {
|
|
2527
|
+
apiRequest.requestInServer(s, n).then((f) => {
|
|
2511
2528
|
const h = {
|
|
2512
2529
|
isReq: !1,
|
|
2513
2530
|
isReload: !0,
|
|
2514
2531
|
isErr: !1,
|
|
2515
2532
|
keyAction: e,
|
|
2516
2533
|
msg: "",
|
|
2517
|
-
...
|
|
2534
|
+
...f
|
|
2518
2535
|
};
|
|
2519
2536
|
b.events.publish("fetch", h), o(h);
|
|
2520
|
-
}).catch((
|
|
2537
|
+
}).catch((f) => {
|
|
2521
2538
|
const h = {
|
|
2522
2539
|
//TODO: Проверить. dataErr не верно возвращает
|
|
2523
2540
|
isReq: !1,
|
|
2524
2541
|
isReload: !1,
|
|
2525
2542
|
keyAction: e,
|
|
2526
|
-
...
|
|
2543
|
+
...f
|
|
2527
2544
|
};
|
|
2528
2545
|
b.events.publish("fetch", h), i(h);
|
|
2529
2546
|
});
|
|
@@ -2629,7 +2646,7 @@ class NetworkStatusTracker {
|
|
|
2629
2646
|
this.controllersEvents = { ...this.controllersEvents, ...e };
|
|
2630
2647
|
}
|
|
2631
2648
|
startEvents(e) {
|
|
2632
|
-
var a,
|
|
2649
|
+
var a, u, l, f;
|
|
2633
2650
|
const { isActiveEvents: t } = this.getState();
|
|
2634
2651
|
if (t)
|
|
2635
2652
|
return;
|
|
@@ -2645,10 +2662,10 @@ class NetworkStatusTracker {
|
|
|
2645
2662
|
this.updateState(!0, e);
|
|
2646
2663
|
}, { signal: (a = s.online) == null ? void 0 : a.signal }), window.addEventListener("offline", () => {
|
|
2647
2664
|
this.updateState(!1, e);
|
|
2648
|
-
}, { signal: (
|
|
2665
|
+
}, { signal: (u = s.offline) == null ? void 0 : u.signal }), (l = this.getConnection()) != null && l.addEventListener && this.getConnection().addEventListener("change", () => {
|
|
2649
2666
|
const h = this.getConnection(), y = this.getTypeNetwork(h, null), w = this.getIsNetwork(y);
|
|
2650
2667
|
this.updateState(w, e);
|
|
2651
|
-
}, { signal: (
|
|
2668
|
+
}, { signal: (f = s.change) == null ? void 0 : f.signal });
|
|
2652
2669
|
}
|
|
2653
2670
|
stopEvents() {
|
|
2654
2671
|
const { isActiveEvents: e } = this.getState();
|