dev-classes 1.4.39 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -1
- package/dist/classes/BrowserUtils/BrowserUtils.d.ts +5 -0
- package/dist/classes/BrowserUtils/index.d.ts +1 -0
- package/dist/classes/NetworkStatusTracker/NetworkStatusTracker.d.ts +4 -3
- package/dist/classes/NetworkStatusTracker/NetworkStatusTracker.types.d.ts +1 -1
- package/dist/classes/NetworkStatusTracker/index.d.ts +0 -1
- package/dist/classes/Timer/Timer.d.ts +43 -0
- package/dist/classes/Timer/index.d.ts +1 -0
- package/dist/classes/Utils/NetworkInformation/index.d.ts +0 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1134 -984
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var M = (
|
|
3
|
-
var c = (
|
|
1
|
+
var k = Object.defineProperty;
|
|
2
|
+
var M = (s, e, t) => e in s ? k(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var c = (s, e, t) => (M(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
const h = class h {
|
|
5
5
|
static isBrightAndVivid(e) {
|
|
6
|
-
const [t,
|
|
7
|
-
return
|
|
6
|
+
const [t, r, n] = this.hexToRgb(e), i = this.rgbaToHsla(t, r, n, 1);
|
|
7
|
+
return i.l >= this.MIN_LIGHTNESS && i.s >= this.MIN_SATURATION;
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
/*Проверить свои методы и возможно исключить т.к. функционал возможно повторяется */
|
|
11
11
|
c(h, "componentToHex", (e) => {
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
}), c(h, "rgbToHex", (e, t,
|
|
12
|
+
const r = Math.max(0, Math.min(255, Math.round(e))).toString(16);
|
|
13
|
+
return r.length == 1 ? "0" + r : r;
|
|
14
|
+
}), c(h, "rgbToHex", (e, t, r) => "#" + h.componentToHex(e) + h.componentToHex(t) + h.componentToHex(r)), // static rgbToHex: ColorProps["rgbToHex"] = (r: number, g: number, b: number) => {
|
|
15
15
|
// const toHex = (n: number): string => {
|
|
16
16
|
// const hex = Math.round(n).toString(16);
|
|
17
17
|
// return hex.length === 1 ? "0" + hex : hex;
|
|
@@ -22,39 +22,39 @@ c(h, "componentToHex", (e) => {
|
|
|
22
22
|
* r, g, b in [0, 255]
|
|
23
23
|
* @returns h in [0,360) and s, v in [0,1]
|
|
24
24
|
*/
|
|
25
|
-
c(h, "rgbToHsv", (e, t,
|
|
26
|
-
e /= 255, t /= 255,
|
|
27
|
-
const n = Math.max(e, t,
|
|
28
|
-
return [60 * (
|
|
25
|
+
c(h, "rgbToHsv", (e, t, r) => {
|
|
26
|
+
e /= 255, t /= 255, r /= 255;
|
|
27
|
+
const n = Math.max(e, t, r), i = n - Math.min(e, t, r), o = i && (n === e ? (t - r) / i : n == t ? 2 + (r - e) / i : 4 + (e - t) / i);
|
|
28
|
+
return [60 * (o < 0 ? o + 6 : o), n && i / n, n];
|
|
29
29
|
}), /**
|
|
30
30
|
* @param h [0, 360]
|
|
31
31
|
* @param s [0, 1]
|
|
32
32
|
* @param v [0, 1]
|
|
33
33
|
* @returns r, g, b in [0, 255]
|
|
34
34
|
*/
|
|
35
|
-
c(h, "hsvToRgb", (e, t,
|
|
36
|
-
const n = (
|
|
35
|
+
c(h, "hsvToRgb", (e, t, r) => {
|
|
36
|
+
const n = (i, o = (i + e / 60) % 6) => Math.round((r - r * t * Math.max(Math.min(o, 4 - o, 1), 0)) * 255);
|
|
37
37
|
return [n(5), n(3), n(1)];
|
|
38
38
|
}), /**
|
|
39
39
|
* @returns h [0, 360], s [0, 100], l [0, 100], a [0, 1]
|
|
40
40
|
*/
|
|
41
|
-
c(h, "rgbaToHsla", (e, t,
|
|
42
|
-
e /= 255, t /= 255,
|
|
43
|
-
const
|
|
41
|
+
c(h, "rgbaToHsla", (e, t, r, n = 1) => {
|
|
42
|
+
e /= 255, t /= 255, r /= 255;
|
|
43
|
+
const i = Math.max(e, t, r), o = Math.min(e, t, r);
|
|
44
44
|
let a = 0, u;
|
|
45
|
-
const l = (
|
|
46
|
-
if (
|
|
45
|
+
const l = (i + o) / 2;
|
|
46
|
+
if (i === o)
|
|
47
47
|
a = u = 0;
|
|
48
48
|
else {
|
|
49
|
-
const f =
|
|
50
|
-
switch (u = l > 0.5 ? f / (2 -
|
|
49
|
+
const f = i - o;
|
|
50
|
+
switch (u = l > 0.5 ? f / (2 - i - o) : f / (i + o), i) {
|
|
51
51
|
case e:
|
|
52
|
-
a = (t -
|
|
52
|
+
a = (t - r) / f + (t < r ? 6 : 0);
|
|
53
53
|
break;
|
|
54
54
|
case t:
|
|
55
|
-
a = (
|
|
55
|
+
a = (r - e) / f + 2;
|
|
56
56
|
break;
|
|
57
|
-
case
|
|
57
|
+
case r:
|
|
58
58
|
a = (e - t) / f + 4;
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
@@ -75,94 +75,94 @@ c(h, "rgbaToHsla", (e, t, s, n = 1) => {
|
|
|
75
75
|
* @param {number} l The lightness [0, 1]
|
|
76
76
|
* @return {Array} The RGB representation [0, 255]
|
|
77
77
|
*/
|
|
78
|
-
c(h, "hslaToRgba", (e, t,
|
|
79
|
-
e /= 360, t /= 100,
|
|
80
|
-
let
|
|
78
|
+
c(h, "hslaToRgba", (e, t, r, n) => {
|
|
79
|
+
e /= 360, t /= 100, r /= 100;
|
|
80
|
+
let i, o, a;
|
|
81
81
|
if (t === 0)
|
|
82
|
-
|
|
82
|
+
i = o = a = r;
|
|
83
83
|
else {
|
|
84
|
-
const u = function(
|
|
85
|
-
return d < 0 && (d += 1), d > 1 && (d -= 1), d < 0.16666666666666666 ?
|
|
86
|
-
}, l =
|
|
87
|
-
|
|
84
|
+
const u = function(b, w, d) {
|
|
85
|
+
return d < 0 && (d += 1), d > 1 && (d -= 1), d < 0.16666666666666666 ? b + (w - b) * 6 * d : d < 0.5 ? w : d < 0.6666666666666666 ? b + (w - b) * (0.6666666666666666 - d) * 6 : b;
|
|
86
|
+
}, l = r < 0.5 ? r * (1 + t) : r + t - r * t, f = 2 * r - l;
|
|
87
|
+
i = u(f, l, e + 1 / 3), o = u(f, l, e), a = u(f, l, e - 1 / 3);
|
|
88
88
|
}
|
|
89
|
-
return [
|
|
89
|
+
return [i, o, a, n].map((u) => Math.round(u * 255));
|
|
90
90
|
}), c(h, "hslaStringToRgba", (e) => {
|
|
91
|
-
const t = e.slice(5, -1).split(", "),
|
|
92
|
-
return h.hslaToRgba(n[0], n[1], n[2],
|
|
91
|
+
const t = e.slice(5, -1).split(", "), r = Number(t.pop()), n = t.map((i) => i.endsWith("%") ? +i.slice(0, -1) : +i);
|
|
92
|
+
return h.hslaToRgba(n[0], n[1], n[2], r);
|
|
93
93
|
}), c(h, "hexaToRgba", (e, t) => {
|
|
94
|
-
const
|
|
94
|
+
const r = [], n = e[0] === "#" ? 1 : 0;
|
|
95
95
|
if (e.length === 5 + n && (e = (n ? "#" : "") + "0" + e.slice(n)), e.length === 3 + n)
|
|
96
|
-
for (let
|
|
97
|
-
|
|
96
|
+
for (let i = n; i < e.length; ++i)
|
|
97
|
+
r.push(parseInt(e[i] + e[i], 16));
|
|
98
98
|
else if (e.length === 4 + n) {
|
|
99
|
-
for (let
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
for (let i = n; i < e.length - 1; ++i)
|
|
100
|
+
r.push(parseInt(e[i] + e[i], 16));
|
|
101
|
+
r.push(parseInt(e[e.length - 1], 16));
|
|
102
102
|
} else
|
|
103
|
-
for (let
|
|
104
|
-
|
|
105
|
-
return t &&
|
|
103
|
+
for (let i = n; i < e.length; i += 2)
|
|
104
|
+
r.push(parseInt(e.slice(i, i + 2), 16));
|
|
105
|
+
return t && r.length === 4 && (r[3] = Math.round(r[3] / 255 * 100) / 100), r;
|
|
106
106
|
}), c(h, "hexaToHsla", (e) => {
|
|
107
107
|
const t = h.hexaToRgba(e);
|
|
108
108
|
return h.rgbaToHsla(t[0], t[1], t[2], t[3]);
|
|
109
109
|
}), c(h, "hexToRgb", (e) => h.hexaToRgba(e.slice(0, 7))), c(h, "rgbaToHexa", (e) => {
|
|
110
|
-
const t = [...e],
|
|
111
|
-
return "#" + t.map((
|
|
110
|
+
const t = [...e], r = t.pop(), n = Math.round(Math.min(Math.max(r ?? 1, 0), 1) * 255);
|
|
111
|
+
return "#" + t.map((i) => ("0" + i.toString(16)).slice(-2)).join("") + n.toString(16);
|
|
112
112
|
}), c(h, "hslaStringToHexa", (e) => h.rgbaToHexa(h.hslaStringToRgba(e))), c(h, "hslaStringToHex", (e) => h.hslaStringToHexa(e).slice(0, -2)), /**
|
|
113
113
|
* @param weight [0, 1]
|
|
114
114
|
*/
|
|
115
|
-
c(h, "mixColors", (e, t,
|
|
115
|
+
c(h, "mixColors", (e, t, r) => {
|
|
116
116
|
const n = new Array(3);
|
|
117
|
-
for (let
|
|
118
|
-
const
|
|
119
|
-
n[
|
|
117
|
+
for (let i = 0; i < 3; ++i) {
|
|
118
|
+
const o = e[i], a = t[i];
|
|
119
|
+
n[i] = Math.floor(a + (o - a) * r);
|
|
120
120
|
}
|
|
121
121
|
return n;
|
|
122
122
|
}), c(h, "getRgbByTypeBrightness", (e) => ({
|
|
123
123
|
BT601: [0.299, 0.587, 0.114],
|
|
124
124
|
BT709: [0.2126, 0.7152, 0.0722],
|
|
125
125
|
BT2020: [0.2627, 0.678, 0.0593]
|
|
126
|
-
})[e]), c(h, "getAverageColor", (e, t) => e.map((
|
|
127
|
-
const n = h.rgbToHsv(...t),
|
|
128
|
-
return n[0] = Math.min(360,
|
|
129
|
-
}), c(h, "changeColorAccent", (e, t,
|
|
130
|
-
const
|
|
131
|
-
if (Math.min(Math.abs(
|
|
132
|
-
return
|
|
133
|
-
const a = e[1] ? Math.min(1.5 *
|
|
134
|
-
|
|
135
|
-
let u = h.hsvToRgb(...
|
|
136
|
-
const l = h.calculateBrightness(
|
|
126
|
+
})[e]), c(h, "getAverageColor", (e, t) => e.map((r, n) => Math.round((r + t[n]) / 2))), c(h, "getAccentColor", (e, t, r) => {
|
|
127
|
+
const n = h.rgbToHsv(...t), i = h.rgbToHsv(...r), o = Math.min(1.5 * n[1] / e[1], 1);
|
|
128
|
+
return n[0] = Math.min(360, i[0] - n[0] + e[0]), n[1] = Math.min(1, i[1] * e[1] / n[1]), n[2] = Math.min(1, (i[2] / n[2] + o - 1) * e[2] / o), n[2] < 0.3 ? r : h.hsvToRgb(...n);
|
|
129
|
+
}), c(h, "changeColorAccent", (e, t, r, n) => {
|
|
130
|
+
const i = h.rgbToHsv(...r);
|
|
131
|
+
if (Math.min(Math.abs(i[0] - e[0]), Math.abs(i[0] - e[0] - 360)) > 30)
|
|
132
|
+
return r;
|
|
133
|
+
const a = e[1] ? Math.min(1.5 * i[1] / e[1], 1) : 0;
|
|
134
|
+
i[0] = Math.min(360, i[0] + t[0] - e[0]), i[1] = e[1] ? Math.min(1, i[1] * t[1] / e[1]) : 0, i[2] = e[2] ? Math.min(1, i[2] * (1 - a + a * t[2] / e[2])) : 0;
|
|
135
|
+
let u = h.hsvToRgb(...i);
|
|
136
|
+
const l = h.calculateBrightness(r), f = h.calculateBrightness(u);
|
|
137
137
|
if (n ? l > f : l < f) {
|
|
138
|
-
const
|
|
139
|
-
u = h.changeBrightness(u,
|
|
138
|
+
const w = 0.4 * l / f + 0.6;
|
|
139
|
+
u = h.changeBrightness(u, w);
|
|
140
140
|
}
|
|
141
141
|
return u;
|
|
142
|
-
}), c(h, "changeBrightness", (e, t) => e.map((
|
|
143
|
-
const
|
|
144
|
-
return h.rgbToHex(
|
|
142
|
+
}), c(h, "changeBrightness", (e, t) => e.map((r) => h.clamp(Math.round(r * t), 0, 255))), c(h, "hexBrightness", (e, t) => {
|
|
143
|
+
const r = h.hexToRgb(e), n = h.changeBrightness(r, t), [i, o, a] = n;
|
|
144
|
+
return h.rgbToHex(i, o, a);
|
|
145
145
|
}), c(h, "getHexColorFromTelegramColor", (e) => {
|
|
146
146
|
const t = (e < 0 ? 16777215 + e : e).toString(16);
|
|
147
147
|
return "#" + (t.length >= 6 ? t : "0".repeat(6 - t.length) + t);
|
|
148
148
|
}), c(h, "getRgbColorFromTelegramColor", (e) => h.hexToRgb(h.getHexColorFromTelegramColor(e))), c(h, "rgbaToRgb", (e, t) => {
|
|
149
|
-
const
|
|
150
|
-
return e.slice(0, 3).map((n,
|
|
149
|
+
const r = e[3];
|
|
150
|
+
return e.slice(0, 3).map((n, i) => h.clamp(Math.round((r * (n / 255) + r * (t[i] / 255)) * 255), 0, 255));
|
|
151
151
|
}), c(h, "calculateBrightness", (e, t = "BT709") => {
|
|
152
|
-
const [
|
|
153
|
-
return
|
|
152
|
+
const [r, n, i] = e, o = h.getRgbByTypeBrightness(t);
|
|
153
|
+
return o[0] * r / 255 + o[1] * n / 255 + o[2] * i / 255;
|
|
154
154
|
}), c(h, "getTextColor", (e) => e > 0.5 ? [0, 0, 0] : [255, 255, 255]), c(h, "MIN_SATURATION", 50), c(h, "MIN_LIGHTNESS", 44), c(h, "calculateOpacity", (e, t) => {
|
|
155
|
-
const
|
|
155
|
+
const r = e > 0.5 ? 0 : 1, n = (e - r + t) / t;
|
|
156
156
|
return +Math.max(0.5, Math.min(0.64, n)).toFixed(2);
|
|
157
157
|
}), c(h, "increaseSaturation", (e, t = 1.3) => {
|
|
158
158
|
if (typeof e == "string") {
|
|
159
|
-
const
|
|
159
|
+
const r = h.hexToRgb(e), [n, i, o] = h.rgbToHsv(...r), a = Math.min(1, i * t), u = h.hsvToRgb(n, a, o);
|
|
160
160
|
return h.rgbToHex(...u);
|
|
161
161
|
} else {
|
|
162
|
-
const [
|
|
163
|
-
return h.hsvToRgb(
|
|
162
|
+
const [r, n, i] = h.rgbToHsv(e[0], e[1], e[2]), o = Math.min(1, n * t);
|
|
163
|
+
return h.hsvToRgb(r, o, i);
|
|
164
164
|
}
|
|
165
|
-
}), c(h, "clamp", (e, t,
|
|
165
|
+
}), c(h, "clamp", (e, t, r) => Math.min(r, Math.max(t, e))), c(h, "isHex", (e) => {
|
|
166
166
|
if (typeof e != "string")
|
|
167
167
|
return !1;
|
|
168
168
|
const t = e.replace(/^#/, "");
|
|
@@ -177,25 +177,25 @@ c(h, "mixColors", (e, t, s) => {
|
|
|
177
177
|
// Темный канал
|
|
178
178
|
];
|
|
179
179
|
for (let t = e.length - 1; t > 0; t--) {
|
|
180
|
-
const
|
|
181
|
-
[e[t], e[
|
|
180
|
+
const r = Math.floor(Math.random() * (t + 1));
|
|
181
|
+
[e[t], e[r]] = [e[r], e[t]];
|
|
182
182
|
}
|
|
183
183
|
return `#${e[0].toString(16).padStart(2, "0")}${e[1].toString(16).padStart(2, "0")}${e[2].toString(16).padStart(2, "0")}`;
|
|
184
184
|
}), c(h, "generateRGB", () => Array.from({ length: 3 }, () => Math.floor(Math.random() * 128 + 128))), c(h, "brightColor", (e = 1.3) => {
|
|
185
|
-
let t = 0,
|
|
185
|
+
let t = 0, r;
|
|
186
186
|
do {
|
|
187
|
-
const [n,
|
|
188
|
-
if (
|
|
187
|
+
const [n, i, o] = h.generateRGB();
|
|
188
|
+
if (r = `#${n.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}${o.toString(16).padStart(2, "0")}`, r = h.increaseSaturation(r, e), t++, t > 100)
|
|
189
189
|
break;
|
|
190
|
-
} while (!h.isBrightAndVivid(
|
|
191
|
-
return
|
|
192
|
-
}), c(h, "hslToHex", (e, t,
|
|
193
|
-
const n = h.hslaToRgba(e, t,
|
|
194
|
-
return h.rgbToHex(
|
|
190
|
+
} while (!h.isBrightAndVivid(r));
|
|
191
|
+
return r;
|
|
192
|
+
}), c(h, "hslToHex", (e, t, r) => {
|
|
193
|
+
const n = h.hslaToRgba(e, t, r, 1), [i, o, a] = n.slice(0, 3);
|
|
194
|
+
return h.rgbToHex(i, o, a);
|
|
195
195
|
}), c(h, "generatePleasantColor", (e = {}) => {
|
|
196
|
-
const { baseColor: t, saturation:
|
|
196
|
+
const { baseColor: t, saturation: r = 50, lightness: n = 50, hueShift: i = 0, randomize: o = !1 } = e;
|
|
197
197
|
let a, u, l;
|
|
198
|
-
return t ? (a = (h.hexaToHsla(t).h +
|
|
198
|
+
return t ? (a = (h.hexaToHsla(t).h + i) % 360, o ? (u = Math.max(30, Math.min(90, r + (Math.random() * 40 - 20))), l = Math.max(40, Math.min(80, n + (Math.random() * 30 - 15)))) : (u = r, l = n)) : (a = Math.floor(Math.random() * 360), u = r + Math.random() * 20, l = n + Math.random() * 20), (a >= 20 && a <= 50 || a >= 60 && a <= 140) && (a = (a + 100) % 360), n < 100 && (u = Math.max(u, 15), l > 95 && (l = 95 - Math.random() * 10), u < 20 && l > 90 && (a = (a + 180) % 360, u = Math.max(25, u))), h.hslToHex(a, u, l);
|
|
199
199
|
}), c(h, "generate", {
|
|
200
200
|
rgb: h.generateRGB,
|
|
201
201
|
hex: h.generateHex,
|
|
@@ -207,62 +207,62 @@ c(h, "mixColors", (e, t, s) => {
|
|
|
207
207
|
let Color = h;
|
|
208
208
|
const itemsMonths = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], itemsWeek = ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], _DateProcessing = class _DateProcessing {
|
|
209
209
|
};
|
|
210
|
-
c(_DateProcessing, "getActiveColorClassInDiffDate", (
|
|
211
|
-
let
|
|
212
|
-
return
|
|
213
|
-
}), c(_DateProcessing, "getClassByDifferenceDay", (
|
|
214
|
-
let t = "",
|
|
215
|
-
for (let n = 0; n <
|
|
216
|
-
let
|
|
217
|
-
const
|
|
218
|
-
if (
|
|
219
|
-
t =
|
|
210
|
+
c(_DateProcessing, "getActiveColorClassInDiffDate", (s, e, t) => {
|
|
211
|
+
let r = "";
|
|
212
|
+
return s && e && _DateProcessing.hasDateLessPeriod(s, e) && (r = t), r;
|
|
213
|
+
}), c(_DateProcessing, "getClassByDifferenceDay", (s, e) => {
|
|
214
|
+
let t = "", r = e.sort((n, i) => n.diffDay - i.diffDay);
|
|
215
|
+
for (let n = 0; n < r.length; n++) {
|
|
216
|
+
let i = r[n];
|
|
217
|
+
const o = _DateProcessing.getDifferenceDates(s, _DateProcessing.getCurrentDate());
|
|
218
|
+
if (i.diffDay < o) {
|
|
219
|
+
t = i.className;
|
|
220
220
|
break;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
return t;
|
|
224
|
-
}), c(_DateProcessing, "getMinMaxDate", (
|
|
225
|
-
let
|
|
226
|
-
return /^\d{2}\.\d{2}\.\d{4}$/.test(
|
|
227
|
-
}), c(_DateProcessing, "splitDateFromTime", (
|
|
228
|
-
let e =
|
|
229
|
-
e && e[0] === ":" ? [t,
|
|
224
|
+
}), c(_DateProcessing, "getMinMaxDate", (s, e, t) => {
|
|
225
|
+
let r = { minDate: "", maxDate: "", minMaxMonth: "" };
|
|
226
|
+
return /^\d{2}\.\d{2}\.\d{4}$/.test(s) || /^\d{2}\.\d{2}$/.test(s) ? (!e && !t ? (r.minDate = s, r.maxDate = s) : e ? t ? e && t && (r.minDate = _DateProcessing.hasDateLessPeriod(s, e, { dateMinMax: "<=" }) ? s : e, r.maxDate = _DateProcessing.hasDateLessPeriod(s, t, { dateMinMax: ">=" }) ? s : t) : (r.minDate = _DateProcessing.hasDateLessPeriod(s, e, { dateMinMax: "<=" }) ? s : e, r.maxDate = s) : (r.minDate = s, r.maxDate = _DateProcessing.hasDateLessPeriod(s, t, { dateMinMax: ">=" }) ? s : t), { ...r, ..._DateProcessing.minMaxMountStr(r) }) : (console.error('функция getMinMaxDate >> формат дат не соответствует формату: "дд.мм.гггг"'), { minDate: e, maxDate: t, ..._DateProcessing.minMaxMountStr(r) });
|
|
227
|
+
}), c(_DateProcessing, "splitDateFromTime", (s) => s.split(s.includes("T") ? "T" : " ")), c(_DateProcessing, "getCorrectDateAndTime", (s) => {
|
|
228
|
+
let e = s.match(/\D/), t, r;
|
|
229
|
+
e && e[0] === ":" ? [t, r] = _DateProcessing.splitDateFromTime(s) : [r, t] = _DateProcessing.splitDateFromTime(s), r = _DateProcessing.correctionDateAndRemoveYear(r, { isYear: !0 });
|
|
230
230
|
let n = t.split(":");
|
|
231
|
-
return n.length === 3 && (n.length = 2, t = n.join(":")), [
|
|
232
|
-
}), c(_DateProcessing, "reverseDate", (
|
|
231
|
+
return n.length === 3 && (n.length = 2, t = n.join(":")), [r, t];
|
|
232
|
+
}), c(_DateProcessing, "reverseDate", (s) => s.split("-").reverse().join("-")), c(_DateProcessing, "correctionDataISO8601", (s) => {
|
|
233
233
|
let e = "";
|
|
234
|
-
if (_DateProcessing.isDateDMY(
|
|
235
|
-
let [t,
|
|
234
|
+
if (_DateProcessing.isDateDMY(s)) {
|
|
235
|
+
let [t, r] = _DateProcessing.splitDateFromTime(s);
|
|
236
236
|
e = t.split(".").reverse().join("-");
|
|
237
|
-
} else if (_DateProcessing.isDateISO8601(
|
|
238
|
-
e =
|
|
237
|
+
} else if (_DateProcessing.isDateISO8601(s))
|
|
238
|
+
e = s;
|
|
239
239
|
else
|
|
240
|
-
throw new Error(`функция correctionDataISO8601 >> date не корректна: ${
|
|
240
|
+
throw new Error(`функция correctionDataISO8601 >> date не корректна: ${s}. Требуется один из форматов: дд.мм.гггг | дд.мм.гггг мм:чч | гггг-мм-дд `);
|
|
241
241
|
return e;
|
|
242
|
-
}), c(_DateProcessing, "isDateDMY", (
|
|
242
|
+
}), c(_DateProcessing, "isDateDMY", (s) => /^\d{2}\.\d{2}\.\d{4}$/.test(s) || /^\d{2}\.\d{2}\.\d{4}\s\d{2}:\d{2}$/.test(s)), c(_DateProcessing, "isDateISO8601", (s) => /^\d{4}-\d{2}-\d{2}$/.test(s) || /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(s)), c(_DateProcessing, "correctionDateAndRemoveYear", (s, e) => {
|
|
243
243
|
const t = !!(e != null && e.isYear);
|
|
244
|
-
|
|
245
|
-
let
|
|
246
|
-
return t || (n =
|
|
247
|
-
}), c(_DateProcessing, "correctionDateWithOutCurrentYear", (
|
|
244
|
+
s = _DateProcessing.correctionDataISO8601(s);
|
|
245
|
+
let r = s.split("-").reverse(), n = r;
|
|
246
|
+
return t || (n = r.slice(0, 2)), n.join(".");
|
|
247
|
+
}), c(_DateProcessing, "correctionDateWithOutCurrentYear", (s, e) => {
|
|
248
248
|
const t = !!(e != null && e.shortYear);
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
return
|
|
252
|
-
}), c(_DateProcessing, "correctionShortYear", (
|
|
253
|
-
const e = _DateProcessing.splitDateFromTime(
|
|
249
|
+
s = _DateProcessing.correctionDataISO8601(s);
|
|
250
|
+
const r = +_DateProcessing.getChunkFromDate(s, "year") == +_DateProcessing.getChunkFromDate(_DateProcessing.getCurrentDate(), "year");
|
|
251
|
+
return r ? _DateProcessing.correctionDateAndRemoveYear(s, { isYear: !r }) : t ? _DateProcessing.correctionShortYear(s) : _DateProcessing.correctionDateAndRemoveYear(s, { isYear: !0 });
|
|
252
|
+
}), c(_DateProcessing, "correctionShortYear", (s) => {
|
|
253
|
+
const e = _DateProcessing.splitDateFromTime(s)[0].split("-").reverse(), t = e.splice(-1);
|
|
254
254
|
return `${e.join(".")}.${t[0].slice(2)}`;
|
|
255
|
-
}), c(_DateProcessing, "correctionDate", (
|
|
255
|
+
}), c(_DateProcessing, "correctionDate", (s, e) => (s = _DateProcessing.correctionDataISO8601(s), e != null && e.isRemoveYear ? _DateProcessing.correctionDateAndRemoveYear(s) : e != null && e.shortYear ? e != null && e.withOutCurrentYear ? _DateProcessing.correctionDateWithOutCurrentYear(s, { shortYear: !0 }) : _DateProcessing.correctionShortYear(s) : e != null && e.withOutCurrentYear ? _DateProcessing.correctionDateWithOutCurrentYear(s) : _DateProcessing.correctionDateAndRemoveYear(s, { isYear: !0 }))), c(_DateProcessing, "hasDateLessPeriod", (date, period, option) => {
|
|
256
256
|
const dateMinMax = option != null && option.dateMinMax ? option == null ? void 0 : option.dateMinMax : "<=";
|
|
257
257
|
date = _DateProcessing.correctionDataISO8601(date), period = _DateProcessing.correctionDataISO8601(period);
|
|
258
258
|
const str = `${Math.floor(Number(new Date(date)))} ${dateMinMax} ${Math.floor(Number(new Date(period)))}`, result = eval(str);
|
|
259
259
|
return result;
|
|
260
|
-
}), c(_DateProcessing, "hasDateLessPeriods", (
|
|
261
|
-
one: _DateProcessing.hasDateLessPeriod(
|
|
262
|
-
two: _DateProcessing.hasDateLessPeriod(e, t,
|
|
263
|
-
})), c(_DateProcessing, "getDifferenceDates", (
|
|
264
|
-
const t = new Date(_DateProcessing.correctionDataISO8601(
|
|
265
|
-
return Math.round(
|
|
260
|
+
}), c(_DateProcessing, "hasDateLessPeriods", (s, e, t, r) => ({
|
|
261
|
+
one: _DateProcessing.hasDateLessPeriod(s, t, r),
|
|
262
|
+
two: _DateProcessing.hasDateLessPeriod(e, t, r)
|
|
263
|
+
})), c(_DateProcessing, "getDifferenceDates", (s, e) => {
|
|
264
|
+
const t = new Date(_DateProcessing.correctionDataISO8601(s)), r = new Date(_DateProcessing.correctionDataISO8601(e)), n = 1e3 * 60 * 60 * 24, i = r.getTime() - t.getTime();
|
|
265
|
+
return Math.round(i / n);
|
|
266
266
|
}), /**
|
|
267
267
|
* @param {string} startISODateTime - Начальная дата и время в ISO формате или формате 'YYYY-MM-DD HH:mm:ss'
|
|
268
268
|
* Пример: '2024-01-15T11:20:00' или '2024-01-15 11:20:00'
|
|
@@ -273,43 +273,43 @@ c(_DateProcessing, "getActiveColorClassInDiffDate", (r, e, t) => {
|
|
|
273
273
|
* // Разница в 32 дня, 0 часов, 7 минут, 36 секунд
|
|
274
274
|
* getTimeDifference('2024-01-15T11:20:00', '2024-02-16T11:27:36');
|
|
275
275
|
*/
|
|
276
|
-
c(_DateProcessing, "calculateTimeDifference", (
|
|
277
|
-
const t = new Date(
|
|
276
|
+
c(_DateProcessing, "calculateTimeDifference", (s, e) => {
|
|
277
|
+
const t = new Date(s), n = new Date(e) - t, i = Math.floor(n / 1e3), o = Math.floor(i / (3600 * 24)), a = Math.floor(i % (3600 * 24) / 3600), u = Math.floor(i % 3600 / 60), l = i % 60;
|
|
278
278
|
return {
|
|
279
|
-
totalSeconds:
|
|
280
|
-
formatted: `${
|
|
279
|
+
totalSeconds: i,
|
|
280
|
+
formatted: `${o} дней ${a.toString().padStart(2, "0")}:${u.toString().padStart(2, "0")}:${l.toString().padStart(2, "0")}`,
|
|
281
281
|
formattedShort: `${a.toString().padStart(2, "0")}:${u.toString().padStart(2, "0")}:${l.toString().padStart(2, "0")}`,
|
|
282
|
-
days:
|
|
282
|
+
days: o,
|
|
283
283
|
hours: a,
|
|
284
284
|
minutes: u,
|
|
285
285
|
seconds: l
|
|
286
286
|
};
|
|
287
|
-
}), c(_DateProcessing, "hasDateLessInNumber", (
|
|
288
|
-
const
|
|
289
|
-
return t <=
|
|
290
|
-
}), c(_DateProcessing, "correctionCurrentYear", (
|
|
291
|
-
const t = /* @__PURE__ */ new Date(),
|
|
292
|
-
return
|
|
293
|
-
}), c(_DateProcessing, "getChunkFromDate", (
|
|
294
|
-
|
|
295
|
-
const
|
|
287
|
+
}), c(_DateProcessing, "hasDateLessInNumber", (s, e, t) => {
|
|
288
|
+
const r = _DateProcessing.getDifferenceDates(s, e);
|
|
289
|
+
return t <= r;
|
|
290
|
+
}), c(_DateProcessing, "correctionCurrentYear", (s, e) => {
|
|
291
|
+
const t = /* @__PURE__ */ new Date(), r = e || t.getFullYear();
|
|
292
|
+
return s.map((n) => _DateProcessing.hasDateLessPeriod(`${e}-${n}`, t.toJSON().split("T")[0], { dateMinMax: ">" }) ? `${r - 1}-${n}` : `${e}-${n}`);
|
|
293
|
+
}), c(_DateProcessing, "getChunkFromDate", (s, e, t) => {
|
|
294
|
+
s = _DateProcessing.correctionDataISO8601(s);
|
|
295
|
+
const r = s.split("-");
|
|
296
296
|
switch (e) {
|
|
297
297
|
case "day":
|
|
298
|
-
return t != null && t.isBeforeZero ?
|
|
298
|
+
return t != null && t.isBeforeZero ? r[2] : String(parseInt(r[2]));
|
|
299
299
|
case "month":
|
|
300
|
-
return t != null && t.isBeforeZero ?
|
|
300
|
+
return t != null && t.isBeforeZero ? r[1] : String(parseInt(r[1]));
|
|
301
301
|
case "year":
|
|
302
|
-
return
|
|
302
|
+
return r[0];
|
|
303
303
|
}
|
|
304
|
-
}), c(_DateProcessing, "getNameMonthByNumber", (
|
|
305
|
-
minMaxMonth: _DateProcessing.getNameMonthByNumber(Number(_DateProcessing.getChunkFromDate(
|
|
306
|
-
})), c(_DateProcessing, "getDatesToCurrentDate", (
|
|
307
|
-
let e = _DateProcessing.correctionDataISO8601(
|
|
304
|
+
}), c(_DateProcessing, "getNameMonthByNumber", (s) => s > 0 && s < 13 ? itemsMonths[Number(s) - 1] : itemsMonths[0]), c(_DateProcessing, "minMaxMountStr", (s) => ({
|
|
305
|
+
minMaxMonth: _DateProcessing.getNameMonthByNumber(Number(_DateProcessing.getChunkFromDate(s.minDate, "month", { isBeforeZero: !1 }))) + " - " + _DateProcessing.getNameMonthByNumber(Number(_DateProcessing.getChunkFromDate(s.maxDate, "month", { isBeforeZero: !1 })))
|
|
306
|
+
})), c(_DateProcessing, "getDatesToCurrentDate", (s) => s.filter((e) => _DateProcessing.hasDateLessPeriod(e, _DateProcessing.getCurrentDate()))), c(_DateProcessing, "getDayOfWeek", (s) => {
|
|
307
|
+
let e = _DateProcessing.correctionDataISO8601(s);
|
|
308
308
|
const t = new Date(e).getDay();
|
|
309
309
|
return isNaN(t) ? null : itemsWeek[t];
|
|
310
|
-
}), c(_DateProcessing, "cropSecond", (
|
|
311
|
-
const t = !!(e != null && e.withOutCurrentYear),
|
|
312
|
-
switch (_DateProcessing.getDifferenceDates(
|
|
310
|
+
}), c(_DateProcessing, "cropSecond", (s) => s.replace(/:\w+$/, "")), c(_DateProcessing, "getRenderDate", (s, e) => {
|
|
311
|
+
const t = !!(e != null && e.withOutCurrentYear), r = _DateProcessing.getCurrentDate();
|
|
312
|
+
switch (_DateProcessing.getDifferenceDates(s, r)) {
|
|
313
313
|
case 0:
|
|
314
314
|
return "Сегодня";
|
|
315
315
|
case 1:
|
|
@@ -317,20 +317,20 @@ c(_DateProcessing, "calculateTimeDifference", (r, e) => {
|
|
|
317
317
|
case 2:
|
|
318
318
|
return "Позавчера";
|
|
319
319
|
default:
|
|
320
|
-
return _DateProcessing.correctionDate(
|
|
320
|
+
return _DateProcessing.correctionDate(s, { shortYear: !0, withOutCurrentYear: t });
|
|
321
321
|
}
|
|
322
322
|
}), c(_DateProcessing, "getCurrentDate", () => {
|
|
323
|
-
const
|
|
323
|
+
const s = /* @__PURE__ */ new Date(), e = _DateProcessing.getCurrentYear(), t = s.toJSON().split("T")[0].slice(5);
|
|
324
324
|
return `${e}-${t}`;
|
|
325
|
-
}), c(_DateProcessing, "getCurrentYear", () => (/* @__PURE__ */ new Date()).getFullYear()), c(_DateProcessing, "getDaysInMonth", (
|
|
325
|
+
}), c(_DateProcessing, "getCurrentYear", () => (/* @__PURE__ */ new Date()).getFullYear()), c(_DateProcessing, "getDaysInMonth", (s, e) => new Date(e, s, 0).getDate()), /**
|
|
326
326
|
*
|
|
327
327
|
* @param date example: '2022-01-01'
|
|
328
328
|
* @param config example: {day: 1, month: 1, year: 1}
|
|
329
329
|
* @returns example: '2023-02-02'
|
|
330
330
|
*/
|
|
331
|
-
c(_DateProcessing, "getDateDeviation", (
|
|
332
|
-
const t = _DateProcessing.correctionDataISO8601(
|
|
333
|
-
return
|
|
331
|
+
c(_DateProcessing, "getDateDeviation", (s, e) => {
|
|
332
|
+
const t = _DateProcessing.correctionDataISO8601(s), r = new Date(t), { day: n, month: i, year: o } = e;
|
|
333
|
+
return o && r.setFullYear(r.getFullYear() + o), i && r.setMonth(r.getMonth() + i), n && r.setDate(r.getDate() + n), r.toISOString().slice(0, 10);
|
|
334
334
|
});
|
|
335
335
|
let DateProcessing = _DateProcessing;
|
|
336
336
|
class DelaysPromise {
|
|
@@ -339,63 +339,63 @@ class DelaysPromise {
|
|
|
339
339
|
interval: 5e3
|
|
340
340
|
});
|
|
341
341
|
c(this, "startActionEvery", (e, t = this.defaultProps) => {
|
|
342
|
-
const
|
|
342
|
+
const r = (m) => {
|
|
343
343
|
t != null && t.watchIdInterval && (t == null || t.watchIdInterval(m));
|
|
344
344
|
}, n = (m) => {
|
|
345
345
|
t != null && t.controlAction && (t == null || t.controlAction(m));
|
|
346
346
|
};
|
|
347
|
-
let
|
|
347
|
+
let i = !0, o, a, u;
|
|
348
348
|
const l = (m = !0) => {
|
|
349
|
-
const
|
|
350
|
-
|
|
349
|
+
const b = "Ручное завершение startActionEvery";
|
|
350
|
+
i = !1, clearInterval(o), r(null), m ? a && a({ status: m, msg: b + ": (true)" }) : u && u({ status: m, msg: b + ": (false)" });
|
|
351
351
|
};
|
|
352
352
|
return {
|
|
353
|
-
promise: new Promise((m,
|
|
354
|
-
a = m, u =
|
|
355
|
-
let
|
|
356
|
-
|
|
353
|
+
promise: new Promise((m, b) => {
|
|
354
|
+
a = m, u = b;
|
|
355
|
+
let w = 0, d = 0;
|
|
356
|
+
o = setInterval(
|
|
357
357
|
() => {
|
|
358
|
-
if (
|
|
359
|
-
|
|
358
|
+
if (w += t.interval, d += 1, t != null && t.cutoffTime && w > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < d) {
|
|
359
|
+
i = !1, clearInterval(o), r(null), b({ status: !1, msg: Error("Время загрузки истекло") });
|
|
360
360
|
return;
|
|
361
361
|
}
|
|
362
|
-
e() && (
|
|
362
|
+
e() && (i = !1, clearInterval(o), r(null), m({ status: !0, msg: "cb вернул true" }));
|
|
363
363
|
},
|
|
364
364
|
t.interval < 200 ? 200 : t.interval
|
|
365
|
-
),
|
|
366
|
-
getIsActiveEvent: () =>
|
|
365
|
+
), r(o), n({
|
|
366
|
+
getIsActiveEvent: () => i,
|
|
367
367
|
stop: l
|
|
368
368
|
});
|
|
369
369
|
}),
|
|
370
370
|
stop: l
|
|
371
371
|
};
|
|
372
372
|
});
|
|
373
|
-
c(this, "oneOf", (e, t, { second:
|
|
373
|
+
c(this, "oneOf", (e, t, { second: r }) => {
|
|
374
374
|
let n = 1;
|
|
375
375
|
e().then(() => {
|
|
376
376
|
n === 1 && (n = 0);
|
|
377
377
|
});
|
|
378
|
-
let
|
|
379
|
-
n === 1 && t(), clearInterval(
|
|
380
|
-
},
|
|
378
|
+
let i = setInterval(() => {
|
|
379
|
+
n === 1 && t(), clearInterval(i);
|
|
380
|
+
}, r * 1e3);
|
|
381
381
|
});
|
|
382
|
-
c(this, "oneOfPromise", (e, t, { second:
|
|
383
|
-
let
|
|
382
|
+
c(this, "oneOfPromise", (e, t, { second: r }) => new Promise((n, i) => {
|
|
383
|
+
let o = 1, a = { status: !1, msg: "" };
|
|
384
384
|
e().then((l) => {
|
|
385
|
-
|
|
385
|
+
o === 1 && (o = 0, n(l));
|
|
386
386
|
}).catch((l) => {
|
|
387
|
-
|
|
387
|
+
o === 1 && (o = 0, a.msg = l, i(l));
|
|
388
388
|
});
|
|
389
389
|
let u = setInterval(() => {
|
|
390
|
-
if (
|
|
391
|
-
if (
|
|
392
|
-
|
|
390
|
+
if (o === 1) {
|
|
391
|
+
if (o = 0, typeof t == "function") {
|
|
392
|
+
i({ status: !1, msg: "", ...t(a) });
|
|
393
393
|
return;
|
|
394
394
|
}
|
|
395
|
-
|
|
395
|
+
i({ status: !1, msg: "oneOfPromise reject" });
|
|
396
396
|
}
|
|
397
397
|
clearInterval(u);
|
|
398
|
-
},
|
|
398
|
+
}, r * 1e3);
|
|
399
399
|
}));
|
|
400
400
|
}
|
|
401
401
|
}
|
|
@@ -411,8 +411,8 @@ c($, "startSrt", "data:application/"), c($, "applications", {
|
|
|
411
411
|
pdf: `${$.startSrt}pdf;`,
|
|
412
412
|
csv: `${$.startSrt}vnd.ms-excel;`
|
|
413
413
|
}), c($, "download", (e) => {
|
|
414
|
-
const { format: t, name:
|
|
415
|
-
|
|
414
|
+
const { format: t, name: r, base64: n } = e, i = `${$.getDataApplication(t)}base64,${n}`, o = document.createElement("a"), a = `${r}.${t}`;
|
|
415
|
+
o.href = i, o.download = a, o.click();
|
|
416
416
|
});
|
|
417
417
|
let File = $;
|
|
418
418
|
class NetworkInformation {
|
|
@@ -425,8 +425,8 @@ class NetworkInformation {
|
|
|
425
425
|
return e ? "cordova" : "pc";
|
|
426
426
|
}
|
|
427
427
|
run(e) {
|
|
428
|
-
const t = this.getSystem(),
|
|
429
|
-
|
|
428
|
+
const t = this.getSystem(), r = this.listNetworkInformation.find((n) => n.getControls().system === t);
|
|
429
|
+
r ? r.getControls().addWatchers(e) : console.error("NetworkInformation не активен на данной платформе");
|
|
430
430
|
}
|
|
431
431
|
stop() {
|
|
432
432
|
this.listNetworkInformation.forEach((e) => {
|
|
@@ -434,129 +434,129 @@ class NetworkInformation {
|
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
function bind(
|
|
437
|
+
function bind(s, e) {
|
|
438
438
|
return function() {
|
|
439
|
-
return
|
|
439
|
+
return s.apply(e, arguments);
|
|
440
440
|
};
|
|
441
441
|
}
|
|
442
|
-
const { toString } = Object.prototype, { getPrototypeOf } = Object, kindOf = /* @__PURE__ */ ((
|
|
442
|
+
const { toString } = Object.prototype, { getPrototypeOf } = Object, kindOf = /* @__PURE__ */ ((s) => (e) => {
|
|
443
443
|
const t = toString.call(e);
|
|
444
|
-
return
|
|
445
|
-
})(/* @__PURE__ */ Object.create(null)), kindOfTest = (
|
|
446
|
-
function isBuffer(
|
|
447
|
-
return
|
|
444
|
+
return s[t] || (s[t] = t.slice(8, -1).toLowerCase());
|
|
445
|
+
})(/* @__PURE__ */ Object.create(null)), kindOfTest = (s) => (s = s.toLowerCase(), (e) => kindOf(e) === s), typeOfTest = (s) => (e) => typeof e === s, { isArray } = Array, isUndefined = typeOfTest("undefined");
|
|
446
|
+
function isBuffer(s) {
|
|
447
|
+
return s !== null && !isUndefined(s) && s.constructor !== null && !isUndefined(s.constructor) && isFunction(s.constructor.isBuffer) && s.constructor.isBuffer(s);
|
|
448
448
|
}
|
|
449
449
|
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
450
|
-
function isArrayBufferView(
|
|
450
|
+
function isArrayBufferView(s) {
|
|
451
451
|
let e;
|
|
452
|
-
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(
|
|
452
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(s) : e = s && s.buffer && isArrayBuffer(s.buffer), e;
|
|
453
453
|
}
|
|
454
|
-
const isString = typeOfTest("string"), isFunction = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (
|
|
455
|
-
if (kindOf(
|
|
454
|
+
const isString = typeOfTest("string"), isFunction = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (s) => s !== null && typeof s == "object", isBoolean = (s) => s === !0 || s === !1, isPlainObject = (s) => {
|
|
455
|
+
if (kindOf(s) !== "object")
|
|
456
456
|
return !1;
|
|
457
|
-
const e = getPrototypeOf(
|
|
458
|
-
return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in
|
|
459
|
-
}, isDate = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (
|
|
457
|
+
const e = getPrototypeOf(s);
|
|
458
|
+
return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in s) && !(Symbol.iterator in s);
|
|
459
|
+
}, isDate = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (s) => isObject(s) && isFunction(s.pipe), isFormData = (s) => {
|
|
460
460
|
let e;
|
|
461
|
-
return
|
|
462
|
-
e === "object" && isFunction(
|
|
463
|
-
}, isURLSearchParams = kindOfTest("URLSearchParams"), [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest), trim = (
|
|
464
|
-
function forEach(
|
|
465
|
-
if (
|
|
461
|
+
return s && (typeof FormData == "function" && s instanceof FormData || isFunction(s.append) && ((e = kindOf(s)) === "formdata" || // detect form-data instance
|
|
462
|
+
e === "object" && isFunction(s.toString) && s.toString() === "[object FormData]"));
|
|
463
|
+
}, isURLSearchParams = kindOfTest("URLSearchParams"), [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest), trim = (s) => s.trim ? s.trim() : s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
464
|
+
function forEach(s, e, { allOwnKeys: t = !1 } = {}) {
|
|
465
|
+
if (s === null || typeof s > "u")
|
|
466
466
|
return;
|
|
467
|
-
let
|
|
468
|
-
if (typeof
|
|
469
|
-
for (
|
|
470
|
-
e.call(null, r
|
|
467
|
+
let r, n;
|
|
468
|
+
if (typeof s != "object" && (s = [s]), isArray(s))
|
|
469
|
+
for (r = 0, n = s.length; r < n; r++)
|
|
470
|
+
e.call(null, s[r], r, s);
|
|
471
471
|
else {
|
|
472
|
-
const
|
|
472
|
+
const i = t ? Object.getOwnPropertyNames(s) : Object.keys(s), o = i.length;
|
|
473
473
|
let a;
|
|
474
|
-
for (
|
|
475
|
-
a =
|
|
474
|
+
for (r = 0; r < o; r++)
|
|
475
|
+
a = i[r], e.call(null, s[a], a, s);
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
|
-
function findKey(
|
|
478
|
+
function findKey(s, e) {
|
|
479
479
|
e = e.toLowerCase();
|
|
480
|
-
const t = Object.keys(
|
|
481
|
-
let
|
|
482
|
-
for (;
|
|
483
|
-
if (n = t[
|
|
480
|
+
const t = Object.keys(s);
|
|
481
|
+
let r = t.length, n;
|
|
482
|
+
for (; r-- > 0; )
|
|
483
|
+
if (n = t[r], e === n.toLowerCase())
|
|
484
484
|
return n;
|
|
485
485
|
return null;
|
|
486
486
|
}
|
|
487
|
-
const _global = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, isContextDefined = (
|
|
487
|
+
const _global = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, isContextDefined = (s) => !isUndefined(s) && s !== _global;
|
|
488
488
|
function merge() {
|
|
489
|
-
const { caseless:
|
|
490
|
-
const
|
|
491
|
-
isPlainObject(e[
|
|
489
|
+
const { caseless: s } = isContextDefined(this) && this || {}, e = {}, t = (r, n) => {
|
|
490
|
+
const i = s && findKey(e, n) || n;
|
|
491
|
+
isPlainObject(e[i]) && isPlainObject(r) ? e[i] = merge(e[i], r) : isPlainObject(r) ? e[i] = merge({}, r) : isArray(r) ? e[i] = r.slice() : e[i] = r;
|
|
492
492
|
};
|
|
493
|
-
for (let
|
|
494
|
-
arguments[
|
|
493
|
+
for (let r = 0, n = arguments.length; r < n; r++)
|
|
494
|
+
arguments[r] && forEach(arguments[r], t);
|
|
495
495
|
return e;
|
|
496
496
|
}
|
|
497
|
-
const extend = (
|
|
498
|
-
t && isFunction(n) ?
|
|
499
|
-
}, { allOwnKeys:
|
|
500
|
-
|
|
497
|
+
const extend = (s, e, t, { allOwnKeys: r } = {}) => (forEach(e, (n, i) => {
|
|
498
|
+
t && isFunction(n) ? s[i] = bind(n, t) : s[i] = n;
|
|
499
|
+
}, { allOwnKeys: r }), s), stripBOM = (s) => (s.charCodeAt(0) === 65279 && (s = s.slice(1)), s), inherits = (s, e, t, r) => {
|
|
500
|
+
s.prototype = Object.create(e.prototype, r), s.prototype.constructor = s, Object.defineProperty(s, "super", {
|
|
501
501
|
value: e.prototype
|
|
502
|
-
}), t && Object.assign(
|
|
503
|
-
}, toFlatObject = (
|
|
504
|
-
let n,
|
|
502
|
+
}), t && Object.assign(s.prototype, t);
|
|
503
|
+
}, toFlatObject = (s, e, t, r) => {
|
|
504
|
+
let n, i, o;
|
|
505
505
|
const a = {};
|
|
506
|
-
if (e = e || {},
|
|
506
|
+
if (e = e || {}, s == null)
|
|
507
507
|
return e;
|
|
508
508
|
do {
|
|
509
|
-
for (n = Object.getOwnPropertyNames(
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
} while (
|
|
509
|
+
for (n = Object.getOwnPropertyNames(s), i = n.length; i-- > 0; )
|
|
510
|
+
o = n[i], (!r || r(o, s, e)) && !a[o] && (e[o] = s[o], a[o] = !0);
|
|
511
|
+
s = t !== !1 && getPrototypeOf(s);
|
|
512
|
+
} while (s && (!t || t(s, e)) && s !== Object.prototype);
|
|
513
513
|
return e;
|
|
514
|
-
}, endsWith = (
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
return
|
|
518
|
-
}, toArray = (
|
|
519
|
-
if (!
|
|
514
|
+
}, endsWith = (s, e, t) => {
|
|
515
|
+
s = String(s), (t === void 0 || t > s.length) && (t = s.length), t -= e.length;
|
|
516
|
+
const r = s.indexOf(e, t);
|
|
517
|
+
return r !== -1 && r === t;
|
|
518
|
+
}, toArray = (s) => {
|
|
519
|
+
if (!s)
|
|
520
520
|
return null;
|
|
521
|
-
if (isArray(
|
|
522
|
-
return
|
|
523
|
-
let e =
|
|
521
|
+
if (isArray(s))
|
|
522
|
+
return s;
|
|
523
|
+
let e = s.length;
|
|
524
524
|
if (!isNumber(e))
|
|
525
525
|
return null;
|
|
526
526
|
const t = new Array(e);
|
|
527
527
|
for (; e-- > 0; )
|
|
528
|
-
t[e] =
|
|
528
|
+
t[e] = s[e];
|
|
529
529
|
return t;
|
|
530
|
-
}, isTypedArray = /* @__PURE__ */ ((
|
|
531
|
-
const
|
|
530
|
+
}, isTypedArray = /* @__PURE__ */ ((s) => (e) => s && e instanceof s)(typeof Uint8Array < "u" && getPrototypeOf(Uint8Array)), forEachEntry = (s, e) => {
|
|
531
|
+
const r = (s && s[Symbol.iterator]).call(s);
|
|
532
532
|
let n;
|
|
533
|
-
for (; (n =
|
|
534
|
-
const
|
|
535
|
-
e.call(
|
|
533
|
+
for (; (n = r.next()) && !n.done; ) {
|
|
534
|
+
const i = n.value;
|
|
535
|
+
e.call(s, i[0], i[1]);
|
|
536
536
|
}
|
|
537
|
-
}, matchAll = (
|
|
537
|
+
}, matchAll = (s, e) => {
|
|
538
538
|
let t;
|
|
539
|
-
const
|
|
540
|
-
for (; (t =
|
|
541
|
-
|
|
542
|
-
return
|
|
543
|
-
}, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (
|
|
539
|
+
const r = [];
|
|
540
|
+
for (; (t = s.exec(e)) !== null; )
|
|
541
|
+
r.push(t);
|
|
542
|
+
return r;
|
|
543
|
+
}, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (s) => s.toLowerCase().replace(
|
|
544
544
|
/[-_\s]([a-z\d])(\w*)/g,
|
|
545
|
-
function(t,
|
|
546
|
-
return
|
|
547
|
-
}
|
|
548
|
-
), hasOwnProperty = (({ hasOwnProperty:
|
|
549
|
-
const t = Object.getOwnPropertyDescriptors(
|
|
550
|
-
forEach(t, (n,
|
|
551
|
-
let
|
|
552
|
-
(
|
|
553
|
-
}), Object.defineProperties(
|
|
554
|
-
}, freezeMethods = (
|
|
555
|
-
reduceDescriptors(
|
|
556
|
-
if (isFunction(
|
|
545
|
+
function(t, r, n) {
|
|
546
|
+
return r.toUpperCase() + n;
|
|
547
|
+
}
|
|
548
|
+
), hasOwnProperty = (({ hasOwnProperty: s }) => (e, t) => s.call(e, t))(Object.prototype), isRegExp = kindOfTest("RegExp"), reduceDescriptors = (s, e) => {
|
|
549
|
+
const t = Object.getOwnPropertyDescriptors(s), r = {};
|
|
550
|
+
forEach(t, (n, i) => {
|
|
551
|
+
let o;
|
|
552
|
+
(o = e(n, i, s)) !== !1 && (r[i] = o || n);
|
|
553
|
+
}), Object.defineProperties(s, r);
|
|
554
|
+
}, freezeMethods = (s) => {
|
|
555
|
+
reduceDescriptors(s, (e, t) => {
|
|
556
|
+
if (isFunction(s) && ["arguments", "caller", "callee"].indexOf(t) !== -1)
|
|
557
557
|
return !1;
|
|
558
|
-
const
|
|
559
|
-
if (isFunction(
|
|
558
|
+
const r = s[t];
|
|
559
|
+
if (isFunction(r)) {
|
|
560
560
|
if (e.enumerable = !1, "writable" in e) {
|
|
561
561
|
e.writable = !1;
|
|
562
562
|
return;
|
|
@@ -566,49 +566,49 @@ const extend = (r, e, t, { allOwnKeys: s } = {}) => (forEach(e, (n, o) => {
|
|
|
566
566
|
});
|
|
567
567
|
}
|
|
568
568
|
});
|
|
569
|
-
}, toObjectSet = (
|
|
570
|
-
const t = {},
|
|
571
|
-
n.forEach((
|
|
572
|
-
t[
|
|
569
|
+
}, toObjectSet = (s, e) => {
|
|
570
|
+
const t = {}, r = (n) => {
|
|
571
|
+
n.forEach((i) => {
|
|
572
|
+
t[i] = !0;
|
|
573
573
|
});
|
|
574
574
|
};
|
|
575
|
-
return isArray(
|
|
575
|
+
return isArray(s) ? r(s) : r(String(s).split(e)), t;
|
|
576
576
|
}, noop = () => {
|
|
577
|
-
}, toFiniteNumber = (
|
|
577
|
+
}, toFiniteNumber = (s, e) => s != null && Number.isFinite(s = +s) ? s : e, ALPHA = "abcdefghijklmnopqrstuvwxyz", DIGIT = "0123456789", ALPHABET = {
|
|
578
578
|
DIGIT,
|
|
579
579
|
ALPHA,
|
|
580
580
|
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
581
|
-
}, generateString = (
|
|
581
|
+
}, generateString = (s = 16, e = ALPHABET.ALPHA_DIGIT) => {
|
|
582
582
|
let t = "";
|
|
583
|
-
const { length:
|
|
584
|
-
for (;
|
|
585
|
-
t += e[Math.random() *
|
|
583
|
+
const { length: r } = e;
|
|
584
|
+
for (; s--; )
|
|
585
|
+
t += e[Math.random() * r | 0];
|
|
586
586
|
return t;
|
|
587
587
|
};
|
|
588
|
-
function isSpecCompliantForm(
|
|
589
|
-
return !!(
|
|
588
|
+
function isSpecCompliantForm(s) {
|
|
589
|
+
return !!(s && isFunction(s.append) && s[Symbol.toStringTag] === "FormData" && s[Symbol.iterator]);
|
|
590
590
|
}
|
|
591
|
-
const toJSONObject = (
|
|
592
|
-
const e = new Array(10), t = (
|
|
593
|
-
if (isObject(
|
|
594
|
-
if (e.indexOf(
|
|
591
|
+
const toJSONObject = (s) => {
|
|
592
|
+
const e = new Array(10), t = (r, n) => {
|
|
593
|
+
if (isObject(r)) {
|
|
594
|
+
if (e.indexOf(r) >= 0)
|
|
595
595
|
return;
|
|
596
|
-
if (!("toJSON" in
|
|
597
|
-
e[n] =
|
|
598
|
-
const
|
|
599
|
-
return forEach(
|
|
600
|
-
const u = t(
|
|
601
|
-
!isUndefined(u) && (
|
|
602
|
-
}), e[n] = void 0,
|
|
596
|
+
if (!("toJSON" in r)) {
|
|
597
|
+
e[n] = r;
|
|
598
|
+
const i = isArray(r) ? [] : {};
|
|
599
|
+
return forEach(r, (o, a) => {
|
|
600
|
+
const u = t(o, n + 1);
|
|
601
|
+
!isUndefined(u) && (i[a] = u);
|
|
602
|
+
}), e[n] = void 0, i;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
return
|
|
605
|
+
return r;
|
|
606
606
|
};
|
|
607
|
-
return t(
|
|
608
|
-
}, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (
|
|
609
|
-
n === _global &&
|
|
607
|
+
return t(s, 0);
|
|
608
|
+
}, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (s) => s && (isObject(s) || isFunction(s)) && isFunction(s.then) && isFunction(s.catch), _setImmediate = ((s, e) => s ? setImmediate : e ? ((t, r) => (_global.addEventListener("message", ({ source: n, data: i }) => {
|
|
609
|
+
n === _global && i === t && r.length && r.shift()();
|
|
610
610
|
}, !1), (n) => {
|
|
611
|
-
|
|
611
|
+
r.push(n), _global.postMessage(t, "*");
|
|
612
612
|
}))(`axios@${Math.random()}`, []) : (t) => setTimeout(t))(
|
|
613
613
|
typeof setImmediate == "function",
|
|
614
614
|
isFunction(_global.postMessage)
|
|
@@ -672,11 +672,11 @@ const toJSONObject = (r) => {
|
|
|
672
672
|
setImmediate: _setImmediate,
|
|
673
673
|
asap
|
|
674
674
|
};
|
|
675
|
-
function AxiosError(
|
|
676
|
-
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message =
|
|
675
|
+
function AxiosError(s, e, t, r, n) {
|
|
676
|
+
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = s, this.name = "AxiosError", e && (this.code = e), t && (this.config = t), r && (this.request = r), n && (this.response = n, this.status = n.status ? n.status : null);
|
|
677
677
|
}
|
|
678
678
|
utils$1.inherits(AxiosError, Error, {
|
|
679
|
-
toJSON: function
|
|
679
|
+
toJSON: function s() {
|
|
680
680
|
return {
|
|
681
681
|
// Standard
|
|
682
682
|
message: this.message,
|
|
@@ -711,37 +711,37 @@ const prototype$1 = AxiosError.prototype, descriptors = {};
|
|
|
711
711
|
"ERR_NOT_SUPPORT",
|
|
712
712
|
"ERR_INVALID_URL"
|
|
713
713
|
// eslint-disable-next-line func-names
|
|
714
|
-
].forEach((
|
|
715
|
-
descriptors[
|
|
714
|
+
].forEach((s) => {
|
|
715
|
+
descriptors[s] = { value: s };
|
|
716
716
|
});
|
|
717
717
|
Object.defineProperties(AxiosError, descriptors);
|
|
718
718
|
Object.defineProperty(prototype$1, "isAxiosError", { value: !0 });
|
|
719
|
-
AxiosError.from = (
|
|
720
|
-
const
|
|
721
|
-
return utils$1.toFlatObject(
|
|
719
|
+
AxiosError.from = (s, e, t, r, n, i) => {
|
|
720
|
+
const o = Object.create(prototype$1);
|
|
721
|
+
return utils$1.toFlatObject(s, o, function(u) {
|
|
722
722
|
return u !== Error.prototype;
|
|
723
|
-
}, (a) => a !== "isAxiosError"), AxiosError.call(
|
|
723
|
+
}, (a) => a !== "isAxiosError"), AxiosError.call(o, s.message, e, t, r, n), o.cause = s, o.name = s.name, i && Object.assign(o, i), o;
|
|
724
724
|
};
|
|
725
725
|
const httpAdapter = null;
|
|
726
|
-
function isVisitable(
|
|
727
|
-
return utils$1.isPlainObject(
|
|
726
|
+
function isVisitable(s) {
|
|
727
|
+
return utils$1.isPlainObject(s) || utils$1.isArray(s);
|
|
728
728
|
}
|
|
729
|
-
function removeBrackets(
|
|
730
|
-
return utils$1.endsWith(
|
|
729
|
+
function removeBrackets(s) {
|
|
730
|
+
return utils$1.endsWith(s, "[]") ? s.slice(0, -2) : s;
|
|
731
731
|
}
|
|
732
|
-
function renderKey(
|
|
733
|
-
return
|
|
734
|
-
return n = removeBrackets(n), !t &&
|
|
732
|
+
function renderKey(s, e, t) {
|
|
733
|
+
return s ? s.concat(e).map(function(n, i) {
|
|
734
|
+
return n = removeBrackets(n), !t && i ? "[" + n + "]" : n;
|
|
735
735
|
}).join(t ? "." : "") : e;
|
|
736
736
|
}
|
|
737
|
-
function isFlatArray(
|
|
738
|
-
return utils$1.isArray(
|
|
737
|
+
function isFlatArray(s) {
|
|
738
|
+
return utils$1.isArray(s) && !s.some(isVisitable);
|
|
739
739
|
}
|
|
740
|
-
const predicates = utils$1.toFlatObject(utils$1, {}, null, function
|
|
740
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function s(e) {
|
|
741
741
|
return /^is[A-Z]/.test(e);
|
|
742
742
|
});
|
|
743
|
-
function toFormData(
|
|
744
|
-
if (!utils$1.isObject(
|
|
743
|
+
function toFormData(s, e, t) {
|
|
744
|
+
if (!utils$1.isObject(s))
|
|
745
745
|
throw new TypeError("target must be an object");
|
|
746
746
|
e = e || new FormData(), t = utils$1.toFlatObject(t, {
|
|
747
747
|
metaTokens: !0,
|
|
@@ -750,7 +750,7 @@ function toFormData(r, e, t) {
|
|
|
750
750
|
}, !1, function(g, p) {
|
|
751
751
|
return !utils$1.isUndefined(p[g]);
|
|
752
752
|
});
|
|
753
|
-
const
|
|
753
|
+
const r = t.metaTokens, n = t.visitor || f, i = t.dots, o = t.indexes, u = (t.Blob || typeof Blob < "u" && Blob) && utils$1.isSpecCompliantForm(e);
|
|
754
754
|
if (!utils$1.isFunction(n))
|
|
755
755
|
throw new TypeError("visitor must be a function");
|
|
756
756
|
function l(d) {
|
|
@@ -766,24 +766,24 @@ function toFormData(r, e, t) {
|
|
|
766
766
|
let D = d;
|
|
767
767
|
if (d && !p && typeof d == "object") {
|
|
768
768
|
if (utils$1.endsWith(g, "{}"))
|
|
769
|
-
g =
|
|
769
|
+
g = r ? g : g.slice(0, -2), d = JSON.stringify(d);
|
|
770
770
|
else if (utils$1.isArray(d) && isFlatArray(d) || (utils$1.isFileList(d) || utils$1.endsWith(g, "[]")) && (D = utils$1.toArray(d)))
|
|
771
771
|
return g = removeBrackets(g), D.forEach(function(S, O) {
|
|
772
772
|
!(utils$1.isUndefined(S) || S === null) && e.append(
|
|
773
773
|
// eslint-disable-next-line no-nested-ternary
|
|
774
|
-
|
|
774
|
+
o === !0 ? renderKey([g], O, i) : o === null ? g : g + "[]",
|
|
775
775
|
l(S)
|
|
776
776
|
);
|
|
777
777
|
}), !1;
|
|
778
778
|
}
|
|
779
|
-
return isVisitable(d) ? !0 : (e.append(renderKey(p, g,
|
|
779
|
+
return isVisitable(d) ? !0 : (e.append(renderKey(p, g, i), l(d)), !1);
|
|
780
780
|
}
|
|
781
|
-
const m = [],
|
|
781
|
+
const m = [], b = Object.assign(predicates, {
|
|
782
782
|
defaultVisitor: f,
|
|
783
783
|
convertValue: l,
|
|
784
784
|
isVisitable
|
|
785
785
|
});
|
|
786
|
-
function
|
|
786
|
+
function w(d, g) {
|
|
787
787
|
if (!utils$1.isUndefined(d)) {
|
|
788
788
|
if (m.indexOf(d) !== -1)
|
|
789
789
|
throw Error("Circular reference detected in " + g.join("."));
|
|
@@ -793,16 +793,16 @@ function toFormData(r, e, t) {
|
|
|
793
793
|
D,
|
|
794
794
|
utils$1.isString(A) ? A.trim() : A,
|
|
795
795
|
g,
|
|
796
|
-
|
|
797
|
-
)) === !0 &&
|
|
796
|
+
b
|
|
797
|
+
)) === !0 && w(D, g ? g.concat(A) : [A]);
|
|
798
798
|
}), m.pop();
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
|
-
if (!utils$1.isObject(
|
|
801
|
+
if (!utils$1.isObject(s))
|
|
802
802
|
throw new TypeError("data must be an object");
|
|
803
|
-
return
|
|
803
|
+
return w(s), e;
|
|
804
804
|
}
|
|
805
|
-
function encode$1(
|
|
805
|
+
function encode$1(s) {
|
|
806
806
|
const e = {
|
|
807
807
|
"!": "%21",
|
|
808
808
|
"'": "%27",
|
|
@@ -812,38 +812,38 @@ function encode$1(r) {
|
|
|
812
812
|
"%20": "+",
|
|
813
813
|
"%00": "\0"
|
|
814
814
|
};
|
|
815
|
-
return encodeURIComponent(
|
|
816
|
-
return e[
|
|
815
|
+
return encodeURIComponent(s).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
816
|
+
return e[r];
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
|
-
function AxiosURLSearchParams(
|
|
820
|
-
this._pairs = [],
|
|
819
|
+
function AxiosURLSearchParams(s, e) {
|
|
820
|
+
this._pairs = [], s && toFormData(s, this, e);
|
|
821
821
|
}
|
|
822
822
|
const prototype = AxiosURLSearchParams.prototype;
|
|
823
|
-
prototype.append = function
|
|
823
|
+
prototype.append = function s(e, t) {
|
|
824
824
|
this._pairs.push([e, t]);
|
|
825
825
|
};
|
|
826
|
-
prototype.toString = function
|
|
827
|
-
const t = e ? function(
|
|
828
|
-
return e.call(this,
|
|
826
|
+
prototype.toString = function s(e) {
|
|
827
|
+
const t = e ? function(r) {
|
|
828
|
+
return e.call(this, r, encode$1);
|
|
829
829
|
} : encode$1;
|
|
830
830
|
return this._pairs.map(function(n) {
|
|
831
831
|
return t(n[0]) + "=" + t(n[1]);
|
|
832
832
|
}, "").join("&");
|
|
833
833
|
};
|
|
834
|
-
function encode(
|
|
835
|
-
return encodeURIComponent(
|
|
834
|
+
function encode(s) {
|
|
835
|
+
return encodeURIComponent(s).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
836
836
|
}
|
|
837
|
-
function buildURL(
|
|
837
|
+
function buildURL(s, e, t) {
|
|
838
838
|
if (!e)
|
|
839
|
-
return
|
|
840
|
-
const
|
|
841
|
-
let
|
|
842
|
-
if (n ?
|
|
843
|
-
const
|
|
844
|
-
|
|
839
|
+
return s;
|
|
840
|
+
const r = t && t.encode || encode, n = t && t.serialize;
|
|
841
|
+
let i;
|
|
842
|
+
if (n ? i = n(e, t) : i = utils$1.isURLSearchParams(e) ? e.toString() : new AxiosURLSearchParams(e, t).toString(r), i) {
|
|
843
|
+
const o = s.indexOf("#");
|
|
844
|
+
o !== -1 && (s = s.slice(0, o)), s += (s.indexOf("?") === -1 ? "?" : "&") + i;
|
|
845
845
|
}
|
|
846
|
-
return
|
|
846
|
+
return s;
|
|
847
847
|
}
|
|
848
848
|
class InterceptorManager {
|
|
849
849
|
constructor() {
|
|
@@ -857,12 +857,12 @@ class InterceptorManager {
|
|
|
857
857
|
*
|
|
858
858
|
* @return {Number} An ID used to remove interceptor later
|
|
859
859
|
*/
|
|
860
|
-
use(e, t,
|
|
860
|
+
use(e, t, r) {
|
|
861
861
|
return this.handlers.push({
|
|
862
862
|
fulfilled: e,
|
|
863
863
|
rejected: t,
|
|
864
|
-
synchronous:
|
|
865
|
-
runWhen:
|
|
864
|
+
synchronous: r ? r.synchronous : !1,
|
|
865
|
+
runWhen: r ? r.runWhen : null
|
|
866
866
|
}), this.handlers.length - 1;
|
|
867
867
|
}
|
|
868
868
|
/**
|
|
@@ -894,8 +894,8 @@ class InterceptorManager {
|
|
|
894
894
|
* @returns {void}
|
|
895
895
|
*/
|
|
896
896
|
forEach(e) {
|
|
897
|
-
utils$1.forEach(this.handlers, function(
|
|
898
|
-
|
|
897
|
+
utils$1.forEach(this.handlers, function(r) {
|
|
898
|
+
r !== null && e(r);
|
|
899
899
|
});
|
|
900
900
|
}
|
|
901
901
|
}
|
|
@@ -923,57 +923,57 @@ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", or
|
|
|
923
923
|
...utils,
|
|
924
924
|
...platform$1
|
|
925
925
|
};
|
|
926
|
-
function toURLEncodedForm(
|
|
927
|
-
return toFormData(
|
|
928
|
-
visitor: function(t,
|
|
929
|
-
return platform.isNode && utils$1.isBuffer(t) ? (this.append(
|
|
926
|
+
function toURLEncodedForm(s, e) {
|
|
927
|
+
return toFormData(s, new platform.classes.URLSearchParams(), Object.assign({
|
|
928
|
+
visitor: function(t, r, n, i) {
|
|
929
|
+
return platform.isNode && utils$1.isBuffer(t) ? (this.append(r, t.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
|
|
930
930
|
}
|
|
931
931
|
}, e));
|
|
932
932
|
}
|
|
933
|
-
function parsePropPath(
|
|
934
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g,
|
|
933
|
+
function parsePropPath(s) {
|
|
934
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, s).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
|
|
935
935
|
}
|
|
936
|
-
function arrayToObject(
|
|
937
|
-
const e = {}, t = Object.keys(
|
|
938
|
-
let
|
|
936
|
+
function arrayToObject(s) {
|
|
937
|
+
const e = {}, t = Object.keys(s);
|
|
938
|
+
let r;
|
|
939
939
|
const n = t.length;
|
|
940
|
-
let
|
|
941
|
-
for (
|
|
942
|
-
|
|
940
|
+
let i;
|
|
941
|
+
for (r = 0; r < n; r++)
|
|
942
|
+
i = t[r], e[i] = s[i];
|
|
943
943
|
return e;
|
|
944
944
|
}
|
|
945
|
-
function formDataToJSON(
|
|
946
|
-
function e(t,
|
|
947
|
-
let
|
|
948
|
-
if (
|
|
945
|
+
function formDataToJSON(s) {
|
|
946
|
+
function e(t, r, n, i) {
|
|
947
|
+
let o = t[i++];
|
|
948
|
+
if (o === "__proto__")
|
|
949
949
|
return !0;
|
|
950
|
-
const a = Number.isFinite(+
|
|
951
|
-
return
|
|
950
|
+
const a = Number.isFinite(+o), u = i >= t.length;
|
|
951
|
+
return o = !o && utils$1.isArray(n) ? n.length : o, u ? (utils$1.hasOwnProp(n, o) ? n[o] = [n[o], r] : n[o] = r, !a) : ((!n[o] || !utils$1.isObject(n[o])) && (n[o] = []), e(t, r, n[o], i) && utils$1.isArray(n[o]) && (n[o] = arrayToObject(n[o])), !a);
|
|
952
952
|
}
|
|
953
|
-
if (utils$1.isFormData(
|
|
953
|
+
if (utils$1.isFormData(s) && utils$1.isFunction(s.entries)) {
|
|
954
954
|
const t = {};
|
|
955
|
-
return utils$1.forEachEntry(
|
|
956
|
-
e(parsePropPath(
|
|
955
|
+
return utils$1.forEachEntry(s, (r, n) => {
|
|
956
|
+
e(parsePropPath(r), n, t, 0);
|
|
957
957
|
}), t;
|
|
958
958
|
}
|
|
959
959
|
return null;
|
|
960
960
|
}
|
|
961
|
-
function stringifySafely(
|
|
962
|
-
if (utils$1.isString(
|
|
961
|
+
function stringifySafely(s, e, t) {
|
|
962
|
+
if (utils$1.isString(s))
|
|
963
963
|
try {
|
|
964
|
-
return (e || JSON.parse)(
|
|
965
|
-
} catch (
|
|
966
|
-
if (
|
|
967
|
-
throw
|
|
964
|
+
return (e || JSON.parse)(s), utils$1.trim(s);
|
|
965
|
+
} catch (r) {
|
|
966
|
+
if (r.name !== "SyntaxError")
|
|
967
|
+
throw r;
|
|
968
968
|
}
|
|
969
|
-
return (t || JSON.stringify)(
|
|
969
|
+
return (t || JSON.stringify)(s);
|
|
970
970
|
}
|
|
971
971
|
const defaults = {
|
|
972
972
|
transitional: transitionalDefaults,
|
|
973
973
|
adapter: ["xhr", "http", "fetch"],
|
|
974
|
-
transformRequest: [function
|
|
975
|
-
const
|
|
976
|
-
if (
|
|
974
|
+
transformRequest: [function s(e, t) {
|
|
975
|
+
const r = t.getContentType() || "", n = r.indexOf("application/json") > -1, i = utils$1.isObject(e);
|
|
976
|
+
if (i && utils$1.isHTMLForm(e) && (e = new FormData(e)), utils$1.isFormData(e))
|
|
977
977
|
return n ? JSON.stringify(formDataToJSON(e)) : e;
|
|
978
978
|
if (utils$1.isArrayBuffer(e) || utils$1.isBuffer(e) || utils$1.isStream(e) || utils$1.isFile(e) || utils$1.isBlob(e) || utils$1.isReadableStream(e))
|
|
979
979
|
return e;
|
|
@@ -982,10 +982,10 @@ const defaults = {
|
|
|
982
982
|
if (utils$1.isURLSearchParams(e))
|
|
983
983
|
return t.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
|
|
984
984
|
let a;
|
|
985
|
-
if (
|
|
986
|
-
if (
|
|
985
|
+
if (i) {
|
|
986
|
+
if (r.indexOf("application/x-www-form-urlencoded") > -1)
|
|
987
987
|
return toURLEncodedForm(e, this.formSerializer).toString();
|
|
988
|
-
if ((a = utils$1.isFileList(e)) ||
|
|
988
|
+
if ((a = utils$1.isFileList(e)) || r.indexOf("multipart/form-data") > -1) {
|
|
989
989
|
const u = this.env && this.env.FormData;
|
|
990
990
|
return toFormData(
|
|
991
991
|
a ? { "files[]": e } : e,
|
|
@@ -994,18 +994,18 @@ const defaults = {
|
|
|
994
994
|
);
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
|
-
return
|
|
997
|
+
return i || n ? (t.setContentType("application/json", !1), stringifySafely(e)) : e;
|
|
998
998
|
}],
|
|
999
|
-
transformResponse: [function
|
|
1000
|
-
const t = this.transitional || defaults.transitional,
|
|
999
|
+
transformResponse: [function s(e) {
|
|
1000
|
+
const t = this.transitional || defaults.transitional, r = t && t.forcedJSONParsing, n = this.responseType === "json";
|
|
1001
1001
|
if (utils$1.isResponse(e) || utils$1.isReadableStream(e))
|
|
1002
1002
|
return e;
|
|
1003
|
-
if (e && utils$1.isString(e) && (
|
|
1004
|
-
const
|
|
1003
|
+
if (e && utils$1.isString(e) && (r && !this.responseType || n)) {
|
|
1004
|
+
const o = !(t && t.silentJSONParsing) && n;
|
|
1005
1005
|
try {
|
|
1006
1006
|
return JSON.parse(e);
|
|
1007
1007
|
} catch (a) {
|
|
1008
|
-
if (
|
|
1008
|
+
if (o)
|
|
1009
1009
|
throw a.name === "SyntaxError" ? AxiosError.from(a, AxiosError.ERR_BAD_RESPONSE, this, null, this.response) : a;
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
@@ -1024,7 +1024,7 @@ const defaults = {
|
|
|
1024
1024
|
FormData: platform.classes.FormData,
|
|
1025
1025
|
Blob: platform.classes.Blob
|
|
1026
1026
|
},
|
|
1027
|
-
validateStatus: function
|
|
1027
|
+
validateStatus: function s(e) {
|
|
1028
1028
|
return e >= 200 && e < 300;
|
|
1029
1029
|
},
|
|
1030
1030
|
headers: {
|
|
@@ -1034,8 +1034,8 @@ const defaults = {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
1036
|
};
|
|
1037
|
-
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (
|
|
1038
|
-
defaults.headers[
|
|
1037
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (s) => {
|
|
1038
|
+
defaults.headers[s] = {};
|
|
1039
1039
|
});
|
|
1040
1040
|
const defaults$1 = defaults, ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1041
1041
|
"age",
|
|
@@ -1055,47 +1055,47 @@ const defaults$1 = defaults, ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
1055
1055
|
"referer",
|
|
1056
1056
|
"retry-after",
|
|
1057
1057
|
"user-agent"
|
|
1058
|
-
]), parseHeaders = (
|
|
1058
|
+
]), parseHeaders = (s) => {
|
|
1059
1059
|
const e = {};
|
|
1060
|
-
let t,
|
|
1061
|
-
return
|
|
1062
|
-
`).forEach(function(
|
|
1063
|
-
n =
|
|
1060
|
+
let t, r, n;
|
|
1061
|
+
return s && s.split(`
|
|
1062
|
+
`).forEach(function(o) {
|
|
1063
|
+
n = o.indexOf(":"), t = o.substring(0, n).trim().toLowerCase(), r = o.substring(n + 1).trim(), !(!t || e[t] && ignoreDuplicateOf[t]) && (t === "set-cookie" ? e[t] ? e[t].push(r) : e[t] = [r] : e[t] = e[t] ? e[t] + ", " + r : r);
|
|
1064
1064
|
}), e;
|
|
1065
1065
|
}, $internals = Symbol("internals");
|
|
1066
|
-
function normalizeHeader(
|
|
1067
|
-
return
|
|
1066
|
+
function normalizeHeader(s) {
|
|
1067
|
+
return s && String(s).trim().toLowerCase();
|
|
1068
1068
|
}
|
|
1069
|
-
function normalizeValue(
|
|
1070
|
-
return
|
|
1069
|
+
function normalizeValue(s) {
|
|
1070
|
+
return s === !1 || s == null ? s : utils$1.isArray(s) ? s.map(normalizeValue) : String(s);
|
|
1071
1071
|
}
|
|
1072
|
-
function parseTokens(
|
|
1072
|
+
function parseTokens(s) {
|
|
1073
1073
|
const e = /* @__PURE__ */ Object.create(null), t = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1074
|
-
let
|
|
1075
|
-
for (;
|
|
1076
|
-
e[
|
|
1074
|
+
let r;
|
|
1075
|
+
for (; r = t.exec(s); )
|
|
1076
|
+
e[r[1]] = r[2];
|
|
1077
1077
|
return e;
|
|
1078
1078
|
}
|
|
1079
|
-
const isValidHeaderName = (
|
|
1080
|
-
function matchHeaderValue(
|
|
1081
|
-
if (utils$1.isFunction(
|
|
1082
|
-
return
|
|
1079
|
+
const isValidHeaderName = (s) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(s.trim());
|
|
1080
|
+
function matchHeaderValue(s, e, t, r, n) {
|
|
1081
|
+
if (utils$1.isFunction(r))
|
|
1082
|
+
return r.call(this, e, t);
|
|
1083
1083
|
if (n && (e = t), !!utils$1.isString(e)) {
|
|
1084
|
-
if (utils$1.isString(
|
|
1085
|
-
return e.indexOf(
|
|
1086
|
-
if (utils$1.isRegExp(
|
|
1087
|
-
return
|
|
1084
|
+
if (utils$1.isString(r))
|
|
1085
|
+
return e.indexOf(r) !== -1;
|
|
1086
|
+
if (utils$1.isRegExp(r))
|
|
1087
|
+
return r.test(e);
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
|
-
function formatHeader(
|
|
1091
|
-
return
|
|
1090
|
+
function formatHeader(s) {
|
|
1091
|
+
return s.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, t, r) => t.toUpperCase() + r);
|
|
1092
1092
|
}
|
|
1093
|
-
function buildAccessors(
|
|
1093
|
+
function buildAccessors(s, e) {
|
|
1094
1094
|
const t = utils$1.toCamelCase(" " + e);
|
|
1095
|
-
["get", "set", "has"].forEach((
|
|
1096
|
-
Object.defineProperty(
|
|
1097
|
-
value: function(n,
|
|
1098
|
-
return this[
|
|
1095
|
+
["get", "set", "has"].forEach((r) => {
|
|
1096
|
+
Object.defineProperty(s, r + t, {
|
|
1097
|
+
value: function(n, i, o) {
|
|
1098
|
+
return this[r].call(this, e, n, i, o);
|
|
1099
1099
|
},
|
|
1100
1100
|
configurable: !0
|
|
1101
1101
|
});
|
|
@@ -1105,38 +1105,38 @@ class AxiosHeaders {
|
|
|
1105
1105
|
constructor(e) {
|
|
1106
1106
|
e && this.set(e);
|
|
1107
1107
|
}
|
|
1108
|
-
set(e, t,
|
|
1108
|
+
set(e, t, r) {
|
|
1109
1109
|
const n = this;
|
|
1110
|
-
function
|
|
1110
|
+
function i(a, u, l) {
|
|
1111
1111
|
const f = normalizeHeader(u);
|
|
1112
1112
|
if (!f)
|
|
1113
1113
|
throw new Error("header name must be a non-empty string");
|
|
1114
1114
|
const m = utils$1.findKey(n, f);
|
|
1115
1115
|
(!m || n[m] === void 0 || l === !0 || l === void 0 && n[m] !== !1) && (n[m || u] = normalizeValue(a));
|
|
1116
1116
|
}
|
|
1117
|
-
const
|
|
1117
|
+
const o = (a, u) => utils$1.forEach(a, (l, f) => i(l, f, u));
|
|
1118
1118
|
if (utils$1.isPlainObject(e) || e instanceof this.constructor)
|
|
1119
|
-
|
|
1119
|
+
o(e, t);
|
|
1120
1120
|
else if (utils$1.isString(e) && (e = e.trim()) && !isValidHeaderName(e))
|
|
1121
|
-
|
|
1121
|
+
o(parseHeaders(e), t);
|
|
1122
1122
|
else if (utils$1.isHeaders(e))
|
|
1123
1123
|
for (const [a, u] of e.entries())
|
|
1124
|
-
|
|
1124
|
+
i(u, a, r);
|
|
1125
1125
|
else
|
|
1126
|
-
e != null &&
|
|
1126
|
+
e != null && i(t, e, r);
|
|
1127
1127
|
return this;
|
|
1128
1128
|
}
|
|
1129
1129
|
get(e, t) {
|
|
1130
1130
|
if (e = normalizeHeader(e), e) {
|
|
1131
|
-
const
|
|
1132
|
-
if (
|
|
1133
|
-
const n = this[
|
|
1131
|
+
const r = utils$1.findKey(this, e);
|
|
1132
|
+
if (r) {
|
|
1133
|
+
const n = this[r];
|
|
1134
1134
|
if (!t)
|
|
1135
1135
|
return n;
|
|
1136
1136
|
if (t === !0)
|
|
1137
1137
|
return parseTokens(n);
|
|
1138
1138
|
if (utils$1.isFunction(t))
|
|
1139
|
-
return t.call(this, n,
|
|
1139
|
+
return t.call(this, n, r);
|
|
1140
1140
|
if (utils$1.isRegExp(t))
|
|
1141
1141
|
return t.exec(n);
|
|
1142
1142
|
throw new TypeError("parser must be boolean|regexp|function");
|
|
@@ -1145,41 +1145,41 @@ class AxiosHeaders {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
has(e, t) {
|
|
1147
1147
|
if (e = normalizeHeader(e), e) {
|
|
1148
|
-
const
|
|
1149
|
-
return !!(
|
|
1148
|
+
const r = utils$1.findKey(this, e);
|
|
1149
|
+
return !!(r && this[r] !== void 0 && (!t || matchHeaderValue(this, this[r], r, t)));
|
|
1150
1150
|
}
|
|
1151
1151
|
return !1;
|
|
1152
1152
|
}
|
|
1153
1153
|
delete(e, t) {
|
|
1154
|
-
const
|
|
1154
|
+
const r = this;
|
|
1155
1155
|
let n = !1;
|
|
1156
|
-
function o
|
|
1157
|
-
if (
|
|
1158
|
-
const a = utils$1.findKey(
|
|
1159
|
-
a && (!t || matchHeaderValue(
|
|
1156
|
+
function i(o) {
|
|
1157
|
+
if (o = normalizeHeader(o), o) {
|
|
1158
|
+
const a = utils$1.findKey(r, o);
|
|
1159
|
+
a && (!t || matchHeaderValue(r, r[a], a, t)) && (delete r[a], n = !0);
|
|
1160
1160
|
}
|
|
1161
1161
|
}
|
|
1162
|
-
return utils$1.isArray(e) ? e.forEach(
|
|
1162
|
+
return utils$1.isArray(e) ? e.forEach(i) : i(e), n;
|
|
1163
1163
|
}
|
|
1164
1164
|
clear(e) {
|
|
1165
1165
|
const t = Object.keys(this);
|
|
1166
|
-
let
|
|
1167
|
-
for (;
|
|
1168
|
-
const
|
|
1169
|
-
(!e || matchHeaderValue(this, this[
|
|
1166
|
+
let r = t.length, n = !1;
|
|
1167
|
+
for (; r--; ) {
|
|
1168
|
+
const i = t[r];
|
|
1169
|
+
(!e || matchHeaderValue(this, this[i], i, e, !0)) && (delete this[i], n = !0);
|
|
1170
1170
|
}
|
|
1171
1171
|
return n;
|
|
1172
1172
|
}
|
|
1173
1173
|
normalize(e) {
|
|
1174
|
-
const t = this,
|
|
1175
|
-
return utils$1.forEach(this, (n,
|
|
1176
|
-
const
|
|
1177
|
-
if (
|
|
1178
|
-
t[
|
|
1174
|
+
const t = this, r = {};
|
|
1175
|
+
return utils$1.forEach(this, (n, i) => {
|
|
1176
|
+
const o = utils$1.findKey(r, i);
|
|
1177
|
+
if (o) {
|
|
1178
|
+
t[o] = normalizeValue(n), delete t[i];
|
|
1179
1179
|
return;
|
|
1180
1180
|
}
|
|
1181
|
-
const a = e ? formatHeader(
|
|
1182
|
-
a !==
|
|
1181
|
+
const a = e ? formatHeader(i) : String(i).trim();
|
|
1182
|
+
a !== i && delete t[i], t[a] = normalizeValue(n), r[a] = !0;
|
|
1183
1183
|
}), this;
|
|
1184
1184
|
}
|
|
1185
1185
|
concat(...e) {
|
|
@@ -1187,8 +1187,8 @@ class AxiosHeaders {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
toJSON(e) {
|
|
1189
1189
|
const t = /* @__PURE__ */ Object.create(null);
|
|
1190
|
-
return utils$1.forEach(this, (
|
|
1191
|
-
|
|
1190
|
+
return utils$1.forEach(this, (r, n) => {
|
|
1191
|
+
r != null && r !== !1 && (t[n] = e && utils$1.isArray(r) ? r.join(", ") : r);
|
|
1192
1192
|
}), t;
|
|
1193
1193
|
}
|
|
1194
1194
|
[Symbol.iterator]() {
|
|
@@ -1205,51 +1205,51 @@ class AxiosHeaders {
|
|
|
1205
1205
|
return e instanceof this ? e : new this(e);
|
|
1206
1206
|
}
|
|
1207
1207
|
static concat(e, ...t) {
|
|
1208
|
-
const
|
|
1209
|
-
return t.forEach((n) =>
|
|
1208
|
+
const r = new this(e);
|
|
1209
|
+
return t.forEach((n) => r.set(n)), r;
|
|
1210
1210
|
}
|
|
1211
1211
|
static accessor(e) {
|
|
1212
|
-
const
|
|
1212
|
+
const r = (this[$internals] = this[$internals] = {
|
|
1213
1213
|
accessors: {}
|
|
1214
1214
|
}).accessors, n = this.prototype;
|
|
1215
|
-
function o
|
|
1216
|
-
const a = normalizeHeader(
|
|
1217
|
-
|
|
1215
|
+
function i(o) {
|
|
1216
|
+
const a = normalizeHeader(o);
|
|
1217
|
+
r[a] || (buildAccessors(n, o), r[a] = !0);
|
|
1218
1218
|
}
|
|
1219
|
-
return utils$1.isArray(e) ? e.forEach(
|
|
1219
|
+
return utils$1.isArray(e) ? e.forEach(i) : i(e), this;
|
|
1220
1220
|
}
|
|
1221
1221
|
}
|
|
1222
1222
|
AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1223
|
-
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value:
|
|
1223
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value: s }, e) => {
|
|
1224
1224
|
let t = e[0].toUpperCase() + e.slice(1);
|
|
1225
1225
|
return {
|
|
1226
|
-
get: () =>
|
|
1227
|
-
set(
|
|
1228
|
-
this[t] =
|
|
1226
|
+
get: () => s,
|
|
1227
|
+
set(r) {
|
|
1228
|
+
this[t] = r;
|
|
1229
1229
|
}
|
|
1230
1230
|
};
|
|
1231
1231
|
});
|
|
1232
1232
|
utils$1.freezeMethods(AxiosHeaders);
|
|
1233
1233
|
const AxiosHeaders$1 = AxiosHeaders;
|
|
1234
|
-
function transformData(
|
|
1235
|
-
const t = this || defaults$1,
|
|
1236
|
-
let
|
|
1237
|
-
return utils$1.forEach(
|
|
1238
|
-
|
|
1239
|
-
}), n.normalize(),
|
|
1234
|
+
function transformData(s, e) {
|
|
1235
|
+
const t = this || defaults$1, r = e || t, n = AxiosHeaders$1.from(r.headers);
|
|
1236
|
+
let i = r.data;
|
|
1237
|
+
return utils$1.forEach(s, function(a) {
|
|
1238
|
+
i = a.call(t, i, n.normalize(), e ? e.status : void 0);
|
|
1239
|
+
}), n.normalize(), i;
|
|
1240
1240
|
}
|
|
1241
|
-
function isCancel(
|
|
1242
|
-
return !!(
|
|
1241
|
+
function isCancel(s) {
|
|
1242
|
+
return !!(s && s.__CANCEL__);
|
|
1243
1243
|
}
|
|
1244
|
-
function CanceledError(
|
|
1245
|
-
AxiosError.call(this,
|
|
1244
|
+
function CanceledError(s, e, t) {
|
|
1245
|
+
AxiosError.call(this, s ?? "canceled", AxiosError.ERR_CANCELED, e, t), this.name = "CanceledError";
|
|
1246
1246
|
}
|
|
1247
1247
|
utils$1.inherits(CanceledError, AxiosError, {
|
|
1248
1248
|
__CANCEL__: !0
|
|
1249
1249
|
});
|
|
1250
|
-
function settle(
|
|
1251
|
-
const
|
|
1252
|
-
!t.status || !
|
|
1250
|
+
function settle(s, e, t) {
|
|
1251
|
+
const r = t.config.validateStatus;
|
|
1252
|
+
!t.status || !r || r(t.status) ? s(t) : e(new AxiosError(
|
|
1253
1253
|
"Request failed with status code " + t.status,
|
|
1254
1254
|
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(t.status / 100) - 4],
|
|
1255
1255
|
t.config,
|
|
@@ -1257,73 +1257,73 @@ function settle(r, e, t) {
|
|
|
1257
1257
|
t
|
|
1258
1258
|
));
|
|
1259
1259
|
}
|
|
1260
|
-
function parseProtocol(
|
|
1261
|
-
const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(
|
|
1260
|
+
function parseProtocol(s) {
|
|
1261
|
+
const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(s);
|
|
1262
1262
|
return e && e[1] || "";
|
|
1263
1263
|
}
|
|
1264
|
-
function speedometer(
|
|
1265
|
-
|
|
1266
|
-
const t = new Array(
|
|
1267
|
-
let n = 0,
|
|
1264
|
+
function speedometer(s, e) {
|
|
1265
|
+
s = s || 10;
|
|
1266
|
+
const t = new Array(s), r = new Array(s);
|
|
1267
|
+
let n = 0, i = 0, o;
|
|
1268
1268
|
return e = e !== void 0 ? e : 1e3, function(u) {
|
|
1269
|
-
const l = Date.now(), f =
|
|
1270
|
-
|
|
1271
|
-
let m =
|
|
1269
|
+
const l = Date.now(), f = r[i];
|
|
1270
|
+
o || (o = l), t[n] = u, r[n] = l;
|
|
1271
|
+
let m = i, b = 0;
|
|
1272
1272
|
for (; m !== n; )
|
|
1273
|
-
|
|
1274
|
-
if (n = (n + 1) %
|
|
1273
|
+
b += t[m++], m = m % s;
|
|
1274
|
+
if (n = (n + 1) % s, n === i && (i = (i + 1) % s), l - o < e)
|
|
1275
1275
|
return;
|
|
1276
|
-
const
|
|
1277
|
-
return
|
|
1276
|
+
const w = f && l - f;
|
|
1277
|
+
return w ? Math.round(b * 1e3 / w) : void 0;
|
|
1278
1278
|
};
|
|
1279
1279
|
}
|
|
1280
|
-
function throttle(
|
|
1281
|
-
let t = 0,
|
|
1282
|
-
const
|
|
1283
|
-
t = f, n = null,
|
|
1280
|
+
function throttle(s, e) {
|
|
1281
|
+
let t = 0, r = 1e3 / e, n, i;
|
|
1282
|
+
const o = (l, f = Date.now()) => {
|
|
1283
|
+
t = f, n = null, i && (clearTimeout(i), i = null), s.apply(null, l);
|
|
1284
1284
|
};
|
|
1285
1285
|
return [(...l) => {
|
|
1286
1286
|
const f = Date.now(), m = f - t;
|
|
1287
|
-
m >=
|
|
1288
|
-
|
|
1289
|
-
},
|
|
1290
|
-
}, () => n &&
|
|
1287
|
+
m >= r ? o(l, f) : (n = l, i || (i = setTimeout(() => {
|
|
1288
|
+
i = null, o(n);
|
|
1289
|
+
}, r - m)));
|
|
1290
|
+
}, () => n && o(n)];
|
|
1291
1291
|
}
|
|
1292
|
-
const progressEventReducer = (
|
|
1293
|
-
let
|
|
1292
|
+
const progressEventReducer = (s, e, t = 3) => {
|
|
1293
|
+
let r = 0;
|
|
1294
1294
|
const n = speedometer(50, 250);
|
|
1295
|
-
return throttle((
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1295
|
+
return throttle((i) => {
|
|
1296
|
+
const o = i.loaded, a = i.lengthComputable ? i.total : void 0, u = o - r, l = n(u), f = o <= a;
|
|
1297
|
+
r = o;
|
|
1298
1298
|
const m = {
|
|
1299
|
-
loaded:
|
|
1299
|
+
loaded: o,
|
|
1300
1300
|
total: a,
|
|
1301
|
-
progress: a ?
|
|
1301
|
+
progress: a ? o / a : void 0,
|
|
1302
1302
|
bytes: u,
|
|
1303
1303
|
rate: l || void 0,
|
|
1304
|
-
estimated: l && a && f ? (a -
|
|
1305
|
-
event:
|
|
1304
|
+
estimated: l && a && f ? (a - o) / l : void 0,
|
|
1305
|
+
event: i,
|
|
1306
1306
|
lengthComputable: a != null,
|
|
1307
1307
|
[e ? "download" : "upload"]: !0
|
|
1308
1308
|
};
|
|
1309
|
-
|
|
1309
|
+
s(m);
|
|
1310
1310
|
}, t);
|
|
1311
|
-
}, progressEventDecorator = (
|
|
1312
|
-
const t =
|
|
1313
|
-
return [(
|
|
1311
|
+
}, progressEventDecorator = (s, e) => {
|
|
1312
|
+
const t = s != null;
|
|
1313
|
+
return [(r) => e[0]({
|
|
1314
1314
|
lengthComputable: t,
|
|
1315
|
-
total:
|
|
1316
|
-
loaded:
|
|
1315
|
+
total: s,
|
|
1316
|
+
loaded: r
|
|
1317
1317
|
}), e[1]];
|
|
1318
|
-
}, asyncDecorator = (
|
|
1318
|
+
}, asyncDecorator = (s) => (...e) => utils$1.asap(() => s(...e)), isURLSameOrigin = platform.hasStandardBrowserEnv ? (
|
|
1319
1319
|
// Standard browser envs have full support of the APIs needed to test
|
|
1320
1320
|
// whether the request URL is of the same origin as current location.
|
|
1321
|
-
function
|
|
1321
|
+
function s() {
|
|
1322
1322
|
const e = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent), t = document.createElement("a");
|
|
1323
|
-
let
|
|
1324
|
-
function n(
|
|
1325
|
-
let
|
|
1326
|
-
return e && (t.setAttribute("href",
|
|
1323
|
+
let r;
|
|
1324
|
+
function n(i) {
|
|
1325
|
+
let o = i;
|
|
1326
|
+
return e && (t.setAttribute("href", o), o = t.href), t.setAttribute("href", o), {
|
|
1327
1327
|
href: t.href,
|
|
1328
1328
|
protocol: t.protocol ? t.protocol.replace(/:$/, "") : "",
|
|
1329
1329
|
host: t.host,
|
|
@@ -1334,14 +1334,14 @@ const progressEventReducer = (r, e, t = 3) => {
|
|
|
1334
1334
|
pathname: t.pathname.charAt(0) === "/" ? t.pathname : "/" + t.pathname
|
|
1335
1335
|
};
|
|
1336
1336
|
}
|
|
1337
|
-
return
|
|
1338
|
-
const a = utils$1.isString(
|
|
1339
|
-
return a.protocol ===
|
|
1337
|
+
return r = n(window.location.href), function(o) {
|
|
1338
|
+
const a = utils$1.isString(o) ? n(o) : o;
|
|
1339
|
+
return a.protocol === r.protocol && a.host === r.host;
|
|
1340
1340
|
};
|
|
1341
1341
|
}()
|
|
1342
1342
|
) : (
|
|
1343
1343
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
1344
|
-
/* @__PURE__ */ function
|
|
1344
|
+
/* @__PURE__ */ function s() {
|
|
1345
1345
|
return function() {
|
|
1346
1346
|
return !0;
|
|
1347
1347
|
};
|
|
@@ -1349,16 +1349,16 @@ const progressEventReducer = (r, e, t = 3) => {
|
|
|
1349
1349
|
), cookies = platform.hasStandardBrowserEnv ? (
|
|
1350
1350
|
// Standard browser envs support document.cookie
|
|
1351
1351
|
{
|
|
1352
|
-
write(
|
|
1353
|
-
const
|
|
1354
|
-
utils$1.isNumber(t) &&
|
|
1352
|
+
write(s, e, t, r, n, i) {
|
|
1353
|
+
const o = [s + "=" + encodeURIComponent(e)];
|
|
1354
|
+
utils$1.isNumber(t) && o.push("expires=" + new Date(t).toGMTString()), utils$1.isString(r) && o.push("path=" + r), utils$1.isString(n) && o.push("domain=" + n), i === !0 && o.push("secure"), document.cookie = o.join("; ");
|
|
1355
1355
|
},
|
|
1356
|
-
read(
|
|
1357
|
-
const e = document.cookie.match(new RegExp("(^|;\\s*)(" +
|
|
1356
|
+
read(s) {
|
|
1357
|
+
const e = document.cookie.match(new RegExp("(^|;\\s*)(" + s + ")=([^;]*)"));
|
|
1358
1358
|
return e ? decodeURIComponent(e[3]) : null;
|
|
1359
1359
|
},
|
|
1360
|
-
remove(
|
|
1361
|
-
this.write(
|
|
1360
|
+
remove(s) {
|
|
1361
|
+
this.write(s, "", Date.now() - 864e5);
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
1364
|
) : (
|
|
@@ -1373,111 +1373,111 @@ const progressEventReducer = (r, e, t = 3) => {
|
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
1375
1375
|
);
|
|
1376
|
-
function isAbsoluteURL(
|
|
1377
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(
|
|
1376
|
+
function isAbsoluteURL(s) {
|
|
1377
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(s);
|
|
1378
1378
|
}
|
|
1379
|
-
function combineURLs(
|
|
1380
|
-
return e ?
|
|
1379
|
+
function combineURLs(s, e) {
|
|
1380
|
+
return e ? s.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : s;
|
|
1381
1381
|
}
|
|
1382
|
-
function buildFullPath(
|
|
1383
|
-
return
|
|
1382
|
+
function buildFullPath(s, e) {
|
|
1383
|
+
return s && !isAbsoluteURL(e) ? combineURLs(s, e) : e;
|
|
1384
1384
|
}
|
|
1385
|
-
const headersToObject = (
|
|
1386
|
-
function mergeConfig(
|
|
1385
|
+
const headersToObject = (s) => s instanceof AxiosHeaders$1 ? { ...s } : s;
|
|
1386
|
+
function mergeConfig(s, e) {
|
|
1387
1387
|
e = e || {};
|
|
1388
1388
|
const t = {};
|
|
1389
|
-
function
|
|
1389
|
+
function r(l, f, m) {
|
|
1390
1390
|
return utils$1.isPlainObject(l) && utils$1.isPlainObject(f) ? utils$1.merge.call({ caseless: m }, l, f) : utils$1.isPlainObject(f) ? utils$1.merge({}, f) : utils$1.isArray(f) ? f.slice() : f;
|
|
1391
1391
|
}
|
|
1392
1392
|
function n(l, f, m) {
|
|
1393
1393
|
if (utils$1.isUndefined(f)) {
|
|
1394
1394
|
if (!utils$1.isUndefined(l))
|
|
1395
|
-
return
|
|
1395
|
+
return r(void 0, l, m);
|
|
1396
1396
|
} else
|
|
1397
|
-
return
|
|
1397
|
+
return r(l, f, m);
|
|
1398
1398
|
}
|
|
1399
|
-
function
|
|
1399
|
+
function i(l, f) {
|
|
1400
1400
|
if (!utils$1.isUndefined(f))
|
|
1401
|
-
return
|
|
1401
|
+
return r(void 0, f);
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1403
|
+
function o(l, f) {
|
|
1404
1404
|
if (utils$1.isUndefined(f)) {
|
|
1405
1405
|
if (!utils$1.isUndefined(l))
|
|
1406
|
-
return
|
|
1406
|
+
return r(void 0, l);
|
|
1407
1407
|
} else
|
|
1408
|
-
return
|
|
1408
|
+
return r(void 0, f);
|
|
1409
1409
|
}
|
|
1410
1410
|
function a(l, f, m) {
|
|
1411
1411
|
if (m in e)
|
|
1412
|
-
return
|
|
1413
|
-
if (m in
|
|
1414
|
-
return
|
|
1412
|
+
return r(l, f);
|
|
1413
|
+
if (m in s)
|
|
1414
|
+
return r(void 0, l);
|
|
1415
1415
|
}
|
|
1416
1416
|
const u = {
|
|
1417
|
-
url:
|
|
1418
|
-
method:
|
|
1419
|
-
data:
|
|
1420
|
-
baseURL:
|
|
1421
|
-
transformRequest:
|
|
1422
|
-
transformResponse:
|
|
1423
|
-
paramsSerializer:
|
|
1424
|
-
timeout:
|
|
1425
|
-
timeoutMessage:
|
|
1426
|
-
withCredentials:
|
|
1427
|
-
withXSRFToken:
|
|
1428
|
-
adapter:
|
|
1429
|
-
responseType:
|
|
1430
|
-
xsrfCookieName:
|
|
1431
|
-
xsrfHeaderName:
|
|
1432
|
-
onUploadProgress:
|
|
1433
|
-
onDownloadProgress:
|
|
1434
|
-
decompress:
|
|
1435
|
-
maxContentLength:
|
|
1436
|
-
maxBodyLength:
|
|
1437
|
-
beforeRedirect:
|
|
1438
|
-
transport:
|
|
1439
|
-
httpAgent:
|
|
1440
|
-
httpsAgent:
|
|
1441
|
-
cancelToken:
|
|
1442
|
-
socketPath:
|
|
1443
|
-
responseEncoding:
|
|
1417
|
+
url: i,
|
|
1418
|
+
method: i,
|
|
1419
|
+
data: i,
|
|
1420
|
+
baseURL: o,
|
|
1421
|
+
transformRequest: o,
|
|
1422
|
+
transformResponse: o,
|
|
1423
|
+
paramsSerializer: o,
|
|
1424
|
+
timeout: o,
|
|
1425
|
+
timeoutMessage: o,
|
|
1426
|
+
withCredentials: o,
|
|
1427
|
+
withXSRFToken: o,
|
|
1428
|
+
adapter: o,
|
|
1429
|
+
responseType: o,
|
|
1430
|
+
xsrfCookieName: o,
|
|
1431
|
+
xsrfHeaderName: o,
|
|
1432
|
+
onUploadProgress: o,
|
|
1433
|
+
onDownloadProgress: o,
|
|
1434
|
+
decompress: o,
|
|
1435
|
+
maxContentLength: o,
|
|
1436
|
+
maxBodyLength: o,
|
|
1437
|
+
beforeRedirect: o,
|
|
1438
|
+
transport: o,
|
|
1439
|
+
httpAgent: o,
|
|
1440
|
+
httpsAgent: o,
|
|
1441
|
+
cancelToken: o,
|
|
1442
|
+
socketPath: o,
|
|
1443
|
+
responseEncoding: o,
|
|
1444
1444
|
validateStatus: a,
|
|
1445
1445
|
headers: (l, f) => n(headersToObject(l), headersToObject(f), !0)
|
|
1446
1446
|
};
|
|
1447
|
-
return utils$1.forEach(Object.keys(Object.assign({},
|
|
1448
|
-
const m = u[f] || n,
|
|
1449
|
-
utils$1.isUndefined(
|
|
1447
|
+
return utils$1.forEach(Object.keys(Object.assign({}, s, e)), function(f) {
|
|
1448
|
+
const m = u[f] || n, b = m(s[f], e[f], f);
|
|
1449
|
+
utils$1.isUndefined(b) && m !== a || (t[f] = b);
|
|
1450
1450
|
}), t;
|
|
1451
1451
|
}
|
|
1452
|
-
const resolveConfig = (
|
|
1453
|
-
const e = mergeConfig({},
|
|
1454
|
-
let { data: t, withXSRFToken:
|
|
1455
|
-
e.headers =
|
|
1452
|
+
const resolveConfig = (s) => {
|
|
1453
|
+
const e = mergeConfig({}, s);
|
|
1454
|
+
let { data: t, withXSRFToken: r, xsrfHeaderName: n, xsrfCookieName: i, headers: o, auth: a } = e;
|
|
1455
|
+
e.headers = o = AxiosHeaders$1.from(o), e.url = buildURL(buildFullPath(e.baseURL, e.url), s.params, s.paramsSerializer), a && o.set(
|
|
1456
1456
|
"Authorization",
|
|
1457
1457
|
"Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))
|
|
1458
1458
|
);
|
|
1459
1459
|
let u;
|
|
1460
1460
|
if (utils$1.isFormData(t)) {
|
|
1461
1461
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv)
|
|
1462
|
-
|
|
1463
|
-
else if ((u =
|
|
1462
|
+
o.setContentType(void 0);
|
|
1463
|
+
else if ((u = o.getContentType()) !== !1) {
|
|
1464
1464
|
const [l, ...f] = u ? u.split(";").map((m) => m.trim()).filter(Boolean) : [];
|
|
1465
|
-
|
|
1465
|
+
o.setContentType([l || "multipart/form-data", ...f].join("; "));
|
|
1466
1466
|
}
|
|
1467
1467
|
}
|
|
1468
|
-
if (platform.hasStandardBrowserEnv && (
|
|
1469
|
-
const l = n &&
|
|
1470
|
-
l &&
|
|
1468
|
+
if (platform.hasStandardBrowserEnv && (r && utils$1.isFunction(r) && (r = r(e)), r || r !== !1 && isURLSameOrigin(e.url))) {
|
|
1469
|
+
const l = n && i && cookies.read(i);
|
|
1470
|
+
l && o.set(n, l);
|
|
1471
1471
|
}
|
|
1472
1472
|
return e;
|
|
1473
|
-
}, isXHRAdapterSupported = typeof XMLHttpRequest < "u", xhrAdapter = isXHRAdapterSupported && function(
|
|
1474
|
-
return new Promise(function(t,
|
|
1475
|
-
const n = resolveConfig(
|
|
1476
|
-
let
|
|
1477
|
-
const
|
|
1478
|
-
let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = n, f, m,
|
|
1473
|
+
}, isXHRAdapterSupported = typeof XMLHttpRequest < "u", xhrAdapter = isXHRAdapterSupported && function(s) {
|
|
1474
|
+
return new Promise(function(t, r) {
|
|
1475
|
+
const n = resolveConfig(s);
|
|
1476
|
+
let i = n.data;
|
|
1477
|
+
const o = AxiosHeaders$1.from(n.headers).normalize();
|
|
1478
|
+
let { responseType: a, onUploadProgress: u, onDownloadProgress: l } = n, f, m, b, w, d;
|
|
1479
1479
|
function g() {
|
|
1480
|
-
|
|
1480
|
+
w && w(), d && d(), n.cancelToken && n.cancelToken.unsubscribe(f), n.signal && n.signal.removeEventListener("abort", f);
|
|
1481
1481
|
}
|
|
1482
1482
|
let p = new XMLHttpRequest();
|
|
1483
1483
|
p.open(n.method.toUpperCase(), n.url, !0), p.timeout = n.timeout;
|
|
@@ -1486,102 +1486,102 @@ const resolveConfig = (r) => {
|
|
|
1486
1486
|
return;
|
|
1487
1487
|
const S = AxiosHeaders$1.from(
|
|
1488
1488
|
"getAllResponseHeaders" in p && p.getAllResponseHeaders()
|
|
1489
|
-
),
|
|
1489
|
+
), T = {
|
|
1490
1490
|
data: !a || a === "text" || a === "json" ? p.responseText : p.response,
|
|
1491
1491
|
status: p.status,
|
|
1492
1492
|
statusText: p.statusText,
|
|
1493
1493
|
headers: S,
|
|
1494
|
-
config:
|
|
1494
|
+
config: s,
|
|
1495
1495
|
request: p
|
|
1496
1496
|
};
|
|
1497
1497
|
settle(function(C) {
|
|
1498
1498
|
t(C), g();
|
|
1499
1499
|
}, function(C) {
|
|
1500
|
-
|
|
1501
|
-
},
|
|
1500
|
+
r(C), g();
|
|
1501
|
+
}, T), p = null;
|
|
1502
1502
|
}
|
|
1503
1503
|
"onloadend" in p ? p.onloadend = D : p.onreadystatechange = function() {
|
|
1504
1504
|
!p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(D);
|
|
1505
1505
|
}, p.onabort = function() {
|
|
1506
|
-
p && (
|
|
1506
|
+
p && (r(new AxiosError("Request aborted", AxiosError.ECONNABORTED, s, p)), p = null);
|
|
1507
1507
|
}, p.onerror = function() {
|
|
1508
|
-
|
|
1508
|
+
r(new AxiosError("Network Error", AxiosError.ERR_NETWORK, s, p)), p = null;
|
|
1509
1509
|
}, p.ontimeout = function() {
|
|
1510
1510
|
let O = n.timeout ? "timeout of " + n.timeout + "ms exceeded" : "timeout exceeded";
|
|
1511
|
-
const
|
|
1512
|
-
n.timeoutErrorMessage && (O = n.timeoutErrorMessage),
|
|
1511
|
+
const T = n.transitional || transitionalDefaults;
|
|
1512
|
+
n.timeoutErrorMessage && (O = n.timeoutErrorMessage), r(new AxiosError(
|
|
1513
1513
|
O,
|
|
1514
|
-
|
|
1515
|
-
|
|
1514
|
+
T.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
1515
|
+
s,
|
|
1516
1516
|
p
|
|
1517
1517
|
)), p = null;
|
|
1518
|
-
},
|
|
1519
|
-
p.setRequestHeader(
|
|
1520
|
-
}), utils$1.isUndefined(n.withCredentials) || (p.withCredentials = !!n.withCredentials), a && a !== "json" && (p.responseType = n.responseType), l && ([
|
|
1521
|
-
p && (
|
|
1518
|
+
}, i === void 0 && o.setContentType(null), "setRequestHeader" in p && utils$1.forEach(o.toJSON(), function(O, T) {
|
|
1519
|
+
p.setRequestHeader(T, O);
|
|
1520
|
+
}), utils$1.isUndefined(n.withCredentials) || (p.withCredentials = !!n.withCredentials), a && a !== "json" && (p.responseType = n.responseType), l && ([b, d] = progressEventReducer(l, !0), p.addEventListener("progress", b)), u && p.upload && ([m, w] = progressEventReducer(u), p.upload.addEventListener("progress", m), p.upload.addEventListener("loadend", w)), (n.cancelToken || n.signal) && (f = (S) => {
|
|
1521
|
+
p && (r(!S || S.type ? new CanceledError(null, s, p) : S), p.abort(), p = null);
|
|
1522
1522
|
}, n.cancelToken && n.cancelToken.subscribe(f), n.signal && (n.signal.aborted ? f() : n.signal.addEventListener("abort", f)));
|
|
1523
1523
|
const A = parseProtocol(n.url);
|
|
1524
1524
|
if (A && platform.protocols.indexOf(A) === -1) {
|
|
1525
|
-
|
|
1525
|
+
r(new AxiosError("Unsupported protocol " + A + ":", AxiosError.ERR_BAD_REQUEST, s));
|
|
1526
1526
|
return;
|
|
1527
1527
|
}
|
|
1528
|
-
p.send(
|
|
1528
|
+
p.send(i || null);
|
|
1529
1529
|
});
|
|
1530
|
-
}, composeSignals = (
|
|
1531
|
-
const { length: t } =
|
|
1530
|
+
}, composeSignals = (s, e) => {
|
|
1531
|
+
const { length: t } = s = s ? s.filter(Boolean) : [];
|
|
1532
1532
|
if (e || t) {
|
|
1533
|
-
let
|
|
1534
|
-
const
|
|
1533
|
+
let r = new AbortController(), n;
|
|
1534
|
+
const i = function(l) {
|
|
1535
1535
|
if (!n) {
|
|
1536
1536
|
n = !0, a();
|
|
1537
1537
|
const f = l instanceof Error ? l : this.reason;
|
|
1538
|
-
|
|
1538
|
+
r.abort(f instanceof AxiosError ? f : new CanceledError(f instanceof Error ? f.message : f));
|
|
1539
1539
|
}
|
|
1540
1540
|
};
|
|
1541
|
-
let
|
|
1542
|
-
|
|
1541
|
+
let o = e && setTimeout(() => {
|
|
1542
|
+
o = null, i(new AxiosError(`timeout ${e} of ms exceeded`, AxiosError.ETIMEDOUT));
|
|
1543
1543
|
}, e);
|
|
1544
1544
|
const a = () => {
|
|
1545
|
-
|
|
1546
|
-
l.unsubscribe ? l.unsubscribe(
|
|
1547
|
-
}),
|
|
1545
|
+
s && (o && clearTimeout(o), o = null, s.forEach((l) => {
|
|
1546
|
+
l.unsubscribe ? l.unsubscribe(i) : l.removeEventListener("abort", i);
|
|
1547
|
+
}), s = null);
|
|
1548
1548
|
};
|
|
1549
|
-
|
|
1550
|
-
const { signal: u } =
|
|
1549
|
+
s.forEach((l) => l.addEventListener("abort", i));
|
|
1550
|
+
const { signal: u } = r;
|
|
1551
1551
|
return u.unsubscribe = () => utils$1.asap(a), u;
|
|
1552
1552
|
}
|
|
1553
|
-
}, composeSignals$1 = composeSignals, streamChunk = function* (
|
|
1554
|
-
let t =
|
|
1553
|
+
}, composeSignals$1 = composeSignals, streamChunk = function* (s, e) {
|
|
1554
|
+
let t = s.byteLength;
|
|
1555
1555
|
if (!e || t < e) {
|
|
1556
|
-
yield
|
|
1556
|
+
yield s;
|
|
1557
1557
|
return;
|
|
1558
1558
|
}
|
|
1559
|
-
let
|
|
1560
|
-
for (;
|
|
1561
|
-
n =
|
|
1562
|
-
}, readBytes = async function* (
|
|
1563
|
-
for await (const t of readStream(
|
|
1559
|
+
let r = 0, n;
|
|
1560
|
+
for (; r < t; )
|
|
1561
|
+
n = r + e, yield s.slice(r, n), r = n;
|
|
1562
|
+
}, readBytes = async function* (s, e) {
|
|
1563
|
+
for await (const t of readStream(s))
|
|
1564
1564
|
yield* streamChunk(t, e);
|
|
1565
|
-
}, readStream = async function* (
|
|
1566
|
-
if (
|
|
1567
|
-
yield*
|
|
1565
|
+
}, readStream = async function* (s) {
|
|
1566
|
+
if (s[Symbol.asyncIterator]) {
|
|
1567
|
+
yield* s;
|
|
1568
1568
|
return;
|
|
1569
1569
|
}
|
|
1570
|
-
const e =
|
|
1570
|
+
const e = s.getReader();
|
|
1571
1571
|
try {
|
|
1572
1572
|
for (; ; ) {
|
|
1573
|
-
const { done: t, value:
|
|
1573
|
+
const { done: t, value: r } = await e.read();
|
|
1574
1574
|
if (t)
|
|
1575
1575
|
break;
|
|
1576
|
-
yield
|
|
1576
|
+
yield r;
|
|
1577
1577
|
}
|
|
1578
1578
|
} finally {
|
|
1579
1579
|
await e.cancel();
|
|
1580
1580
|
}
|
|
1581
|
-
}, trackStream = (
|
|
1582
|
-
const n = readBytes(
|
|
1583
|
-
let
|
|
1584
|
-
|
|
1581
|
+
}, trackStream = (s, e, t, r) => {
|
|
1582
|
+
const n = readBytes(s, e);
|
|
1583
|
+
let i = 0, o, a = (u) => {
|
|
1584
|
+
o || (o = !0, r && r(u));
|
|
1585
1585
|
};
|
|
1586
1586
|
return new ReadableStream({
|
|
1587
1587
|
async pull(u) {
|
|
@@ -1593,8 +1593,8 @@ const resolveConfig = (r) => {
|
|
|
1593
1593
|
}
|
|
1594
1594
|
let m = f.byteLength;
|
|
1595
1595
|
if (t) {
|
|
1596
|
-
let
|
|
1597
|
-
t(
|
|
1596
|
+
let b = i += m;
|
|
1597
|
+
t(b);
|
|
1598
1598
|
}
|
|
1599
1599
|
u.enqueue(new Uint8Array(f));
|
|
1600
1600
|
} catch (l) {
|
|
@@ -1607,241 +1607,241 @@ const resolveConfig = (r) => {
|
|
|
1607
1607
|
}, {
|
|
1608
1608
|
highWaterMark: 2
|
|
1609
1609
|
});
|
|
1610
|
-
}, isFetchSupported = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", isReadableStreamSupported = isFetchSupported && typeof ReadableStream == "function", encodeText = isFetchSupported && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((
|
|
1610
|
+
}, isFetchSupported = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", isReadableStreamSupported = isFetchSupported && typeof ReadableStream == "function", encodeText = isFetchSupported && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((s) => (e) => s.encode(e))(new TextEncoder()) : async (s) => new Uint8Array(await new Response(s).arrayBuffer())), test = (s, ...e) => {
|
|
1611
1611
|
try {
|
|
1612
|
-
return !!
|
|
1612
|
+
return !!s(...e);
|
|
1613
1613
|
} catch {
|
|
1614
1614
|
return !1;
|
|
1615
1615
|
}
|
|
1616
1616
|
}, supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
1617
|
-
let
|
|
1617
|
+
let s = !1;
|
|
1618
1618
|
const e = new Request(platform.origin, {
|
|
1619
1619
|
body: new ReadableStream(),
|
|
1620
1620
|
method: "POST",
|
|
1621
1621
|
get duplex() {
|
|
1622
|
-
return
|
|
1622
|
+
return s = !0, "half";
|
|
1623
1623
|
}
|
|
1624
1624
|
}).headers.has("Content-Type");
|
|
1625
|
-
return
|
|
1625
|
+
return s && !e;
|
|
1626
1626
|
}), DEFAULT_CHUNK_SIZE = 64 * 1024, supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body)), resolvers = {
|
|
1627
|
-
stream: supportsResponseStream && ((
|
|
1627
|
+
stream: supportsResponseStream && ((s) => s.body)
|
|
1628
1628
|
};
|
|
1629
|
-
isFetchSupported && ((
|
|
1629
|
+
isFetchSupported && ((s) => {
|
|
1630
1630
|
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
|
|
1631
|
-
!resolvers[e] && (resolvers[e] = utils$1.isFunction(
|
|
1632
|
-
throw new AxiosError(`Response type '${e}' is not supported`, AxiosError.ERR_NOT_SUPPORT,
|
|
1631
|
+
!resolvers[e] && (resolvers[e] = utils$1.isFunction(s[e]) ? (t) => t[e]() : (t, r) => {
|
|
1632
|
+
throw new AxiosError(`Response type '${e}' is not supported`, AxiosError.ERR_NOT_SUPPORT, r);
|
|
1633
1633
|
});
|
|
1634
1634
|
});
|
|
1635
1635
|
})(new Response());
|
|
1636
|
-
const getBodyLength = async (
|
|
1637
|
-
if (
|
|
1636
|
+
const getBodyLength = async (s) => {
|
|
1637
|
+
if (s == null)
|
|
1638
1638
|
return 0;
|
|
1639
|
-
if (utils$1.isBlob(
|
|
1640
|
-
return
|
|
1641
|
-
if (utils$1.isSpecCompliantForm(
|
|
1639
|
+
if (utils$1.isBlob(s))
|
|
1640
|
+
return s.size;
|
|
1641
|
+
if (utils$1.isSpecCompliantForm(s))
|
|
1642
1642
|
return (await new Request(platform.origin, {
|
|
1643
1643
|
method: "POST",
|
|
1644
|
-
body:
|
|
1644
|
+
body: s
|
|
1645
1645
|
}).arrayBuffer()).byteLength;
|
|
1646
|
-
if (utils$1.isArrayBufferView(
|
|
1647
|
-
return
|
|
1648
|
-
if (utils$1.isURLSearchParams(
|
|
1649
|
-
return (await encodeText(
|
|
1650
|
-
}, resolveBodyLength = async (
|
|
1651
|
-
const t = utils$1.toFiniteNumber(
|
|
1646
|
+
if (utils$1.isArrayBufferView(s) || utils$1.isArrayBuffer(s))
|
|
1647
|
+
return s.byteLength;
|
|
1648
|
+
if (utils$1.isURLSearchParams(s) && (s = s + ""), utils$1.isString(s))
|
|
1649
|
+
return (await encodeText(s)).byteLength;
|
|
1650
|
+
}, resolveBodyLength = async (s, e) => {
|
|
1651
|
+
const t = utils$1.toFiniteNumber(s.getContentLength());
|
|
1652
1652
|
return t ?? getBodyLength(e);
|
|
1653
|
-
}, fetchAdapter = isFetchSupported && (async (
|
|
1653
|
+
}, fetchAdapter = isFetchSupported && (async (s) => {
|
|
1654
1654
|
let {
|
|
1655
1655
|
url: e,
|
|
1656
1656
|
method: t,
|
|
1657
|
-
data:
|
|
1657
|
+
data: r,
|
|
1658
1658
|
signal: n,
|
|
1659
|
-
cancelToken:
|
|
1660
|
-
timeout:
|
|
1659
|
+
cancelToken: i,
|
|
1660
|
+
timeout: o,
|
|
1661
1661
|
onDownloadProgress: a,
|
|
1662
1662
|
onUploadProgress: u,
|
|
1663
1663
|
responseType: l,
|
|
1664
1664
|
headers: f,
|
|
1665
1665
|
withCredentials: m = "same-origin",
|
|
1666
|
-
fetchOptions:
|
|
1667
|
-
} = resolveConfig(
|
|
1666
|
+
fetchOptions: b
|
|
1667
|
+
} = resolveConfig(s);
|
|
1668
1668
|
l = l ? (l + "").toLowerCase() : "text";
|
|
1669
|
-
let
|
|
1670
|
-
const g =
|
|
1671
|
-
|
|
1669
|
+
let w = composeSignals$1([n, i && i.toAbortSignal()], o), d;
|
|
1670
|
+
const g = w && w.unsubscribe && (() => {
|
|
1671
|
+
w.unsubscribe();
|
|
1672
1672
|
});
|
|
1673
1673
|
let p;
|
|
1674
1674
|
try {
|
|
1675
|
-
if (u && supportsRequestStream && t !== "get" && t !== "head" && (p = await resolveBodyLength(f,
|
|
1676
|
-
let
|
|
1675
|
+
if (u && supportsRequestStream && t !== "get" && t !== "head" && (p = await resolveBodyLength(f, r)) !== 0) {
|
|
1676
|
+
let T = new Request(e, {
|
|
1677
1677
|
method: "POST",
|
|
1678
|
-
body:
|
|
1678
|
+
body: r,
|
|
1679
1679
|
duplex: "half"
|
|
1680
|
-
}),
|
|
1681
|
-
if (utils$1.isFormData(
|
|
1682
|
-
const [C,
|
|
1680
|
+
}), R;
|
|
1681
|
+
if (utils$1.isFormData(r) && (R = T.headers.get("content-type")) && f.setContentType(R), T.body) {
|
|
1682
|
+
const [C, v] = progressEventDecorator(
|
|
1683
1683
|
p,
|
|
1684
1684
|
progressEventReducer(asyncDecorator(u))
|
|
1685
1685
|
);
|
|
1686
|
-
|
|
1686
|
+
r = trackStream(T.body, DEFAULT_CHUNK_SIZE, C, v);
|
|
1687
1687
|
}
|
|
1688
1688
|
}
|
|
1689
1689
|
utils$1.isString(m) || (m = m ? "include" : "omit");
|
|
1690
1690
|
const D = "credentials" in Request.prototype;
|
|
1691
1691
|
d = new Request(e, {
|
|
1692
|
-
...
|
|
1693
|
-
signal:
|
|
1692
|
+
...b,
|
|
1693
|
+
signal: w,
|
|
1694
1694
|
method: t.toUpperCase(),
|
|
1695
1695
|
headers: f.normalize().toJSON(),
|
|
1696
|
-
body:
|
|
1696
|
+
body: r,
|
|
1697
1697
|
duplex: "half",
|
|
1698
1698
|
credentials: D ? m : void 0
|
|
1699
1699
|
});
|
|
1700
1700
|
let A = await fetch(d);
|
|
1701
1701
|
const S = supportsResponseStream && (l === "stream" || l === "response");
|
|
1702
1702
|
if (supportsResponseStream && (a || S && g)) {
|
|
1703
|
-
const
|
|
1704
|
-
["status", "statusText", "headers"].forEach((
|
|
1705
|
-
|
|
1703
|
+
const T = {};
|
|
1704
|
+
["status", "statusText", "headers"].forEach((N) => {
|
|
1705
|
+
T[N] = A[N];
|
|
1706
1706
|
});
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1707
|
+
const R = utils$1.toFiniteNumber(A.headers.get("content-length")), [C, v] = a && progressEventDecorator(
|
|
1708
|
+
R,
|
|
1709
1709
|
progressEventReducer(asyncDecorator(a), !0)
|
|
1710
1710
|
) || [];
|
|
1711
1711
|
A = new Response(
|
|
1712
1712
|
trackStream(A.body, DEFAULT_CHUNK_SIZE, C, () => {
|
|
1713
|
-
|
|
1713
|
+
v && v(), g && g();
|
|
1714
1714
|
}),
|
|
1715
|
-
|
|
1715
|
+
T
|
|
1716
1716
|
);
|
|
1717
1717
|
}
|
|
1718
1718
|
l = l || "text";
|
|
1719
|
-
let O = await resolvers[utils$1.findKey(resolvers, l) || "text"](A,
|
|
1720
|
-
return !S && g && g(), await new Promise((
|
|
1721
|
-
settle(
|
|
1719
|
+
let O = await resolvers[utils$1.findKey(resolvers, l) || "text"](A, s);
|
|
1720
|
+
return !S && g && g(), await new Promise((T, R) => {
|
|
1721
|
+
settle(T, R, {
|
|
1722
1722
|
data: O,
|
|
1723
1723
|
headers: AxiosHeaders$1.from(A.headers),
|
|
1724
1724
|
status: A.status,
|
|
1725
1725
|
statusText: A.statusText,
|
|
1726
|
-
config:
|
|
1726
|
+
config: s,
|
|
1727
1727
|
request: d
|
|
1728
1728
|
});
|
|
1729
1729
|
});
|
|
1730
1730
|
} catch (D) {
|
|
1731
1731
|
throw g && g(), D && D.name === "TypeError" && /fetch/i.test(D.message) ? Object.assign(
|
|
1732
|
-
new AxiosError("Network Error", AxiosError.ERR_NETWORK,
|
|
1732
|
+
new AxiosError("Network Error", AxiosError.ERR_NETWORK, s, d),
|
|
1733
1733
|
{
|
|
1734
1734
|
cause: D.cause || D
|
|
1735
1735
|
}
|
|
1736
|
-
) : AxiosError.from(D, D && D.code,
|
|
1736
|
+
) : AxiosError.from(D, D && D.code, s, d);
|
|
1737
1737
|
}
|
|
1738
1738
|
}), knownAdapters = {
|
|
1739
1739
|
http: httpAdapter,
|
|
1740
1740
|
xhr: xhrAdapter,
|
|
1741
1741
|
fetch: fetchAdapter
|
|
1742
1742
|
};
|
|
1743
|
-
utils$1.forEach(knownAdapters, (
|
|
1744
|
-
if (
|
|
1743
|
+
utils$1.forEach(knownAdapters, (s, e) => {
|
|
1744
|
+
if (s) {
|
|
1745
1745
|
try {
|
|
1746
|
-
Object.defineProperty(
|
|
1746
|
+
Object.defineProperty(s, "name", { value: e });
|
|
1747
1747
|
} catch {
|
|
1748
1748
|
}
|
|
1749
|
-
Object.defineProperty(
|
|
1749
|
+
Object.defineProperty(s, "adapterName", { value: e });
|
|
1750
1750
|
}
|
|
1751
1751
|
});
|
|
1752
|
-
const renderReason = (
|
|
1753
|
-
getAdapter: (
|
|
1754
|
-
|
|
1755
|
-
const { length: e } =
|
|
1756
|
-
let t,
|
|
1752
|
+
const renderReason = (s) => `- ${s}`, isResolvedHandle = (s) => utils$1.isFunction(s) || s === null || s === !1, adapters = {
|
|
1753
|
+
getAdapter: (s) => {
|
|
1754
|
+
s = utils$1.isArray(s) ? s : [s];
|
|
1755
|
+
const { length: e } = s;
|
|
1756
|
+
let t, r;
|
|
1757
1757
|
const n = {};
|
|
1758
|
-
for (let
|
|
1759
|
-
t =
|
|
1760
|
-
let
|
|
1761
|
-
if (
|
|
1762
|
-
throw new AxiosError(`Unknown adapter '${
|
|
1763
|
-
if (
|
|
1758
|
+
for (let i = 0; i < e; i++) {
|
|
1759
|
+
t = s[i];
|
|
1760
|
+
let o;
|
|
1761
|
+
if (r = t, !isResolvedHandle(t) && (r = knownAdapters[(o = String(t)).toLowerCase()], r === void 0))
|
|
1762
|
+
throw new AxiosError(`Unknown adapter '${o}'`);
|
|
1763
|
+
if (r)
|
|
1764
1764
|
break;
|
|
1765
|
-
n[
|
|
1765
|
+
n[o || "#" + i] = r;
|
|
1766
1766
|
}
|
|
1767
|
-
if (!
|
|
1768
|
-
const
|
|
1767
|
+
if (!r) {
|
|
1768
|
+
const i = Object.entries(n).map(
|
|
1769
1769
|
([a, u]) => `adapter ${a} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1770
1770
|
);
|
|
1771
|
-
let
|
|
1772
|
-
` +
|
|
1773
|
-
`) : " " + renderReason(
|
|
1771
|
+
let o = e ? i.length > 1 ? `since :
|
|
1772
|
+
` + i.map(renderReason).join(`
|
|
1773
|
+
`) : " " + renderReason(i[0]) : "as no adapter specified";
|
|
1774
1774
|
throw new AxiosError(
|
|
1775
|
-
"There is no suitable adapter to dispatch the request " +
|
|
1775
|
+
"There is no suitable adapter to dispatch the request " + o,
|
|
1776
1776
|
"ERR_NOT_SUPPORT"
|
|
1777
1777
|
);
|
|
1778
1778
|
}
|
|
1779
|
-
return
|
|
1779
|
+
return r;
|
|
1780
1780
|
},
|
|
1781
1781
|
adapters: knownAdapters
|
|
1782
1782
|
};
|
|
1783
|
-
function throwIfCancellationRequested(
|
|
1784
|
-
if (
|
|
1785
|
-
throw new CanceledError(null,
|
|
1783
|
+
function throwIfCancellationRequested(s) {
|
|
1784
|
+
if (s.cancelToken && s.cancelToken.throwIfRequested(), s.signal && s.signal.aborted)
|
|
1785
|
+
throw new CanceledError(null, s);
|
|
1786
1786
|
}
|
|
1787
|
-
function dispatchRequest(
|
|
1788
|
-
return throwIfCancellationRequested(
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
), ["post", "put", "patch"].indexOf(
|
|
1792
|
-
return throwIfCancellationRequested(
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
),
|
|
1797
|
-
}, function(
|
|
1798
|
-
return isCancel(
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
),
|
|
1787
|
+
function dispatchRequest(s) {
|
|
1788
|
+
return throwIfCancellationRequested(s), s.headers = AxiosHeaders$1.from(s.headers), s.data = transformData.call(
|
|
1789
|
+
s,
|
|
1790
|
+
s.transformRequest
|
|
1791
|
+
), ["post", "put", "patch"].indexOf(s.method) !== -1 && s.headers.setContentType("application/x-www-form-urlencoded", !1), adapters.getAdapter(s.adapter || defaults$1.adapter)(s).then(function(r) {
|
|
1792
|
+
return throwIfCancellationRequested(s), r.data = transformData.call(
|
|
1793
|
+
s,
|
|
1794
|
+
s.transformResponse,
|
|
1795
|
+
r
|
|
1796
|
+
), r.headers = AxiosHeaders$1.from(r.headers), r;
|
|
1797
|
+
}, function(r) {
|
|
1798
|
+
return isCancel(r) || (throwIfCancellationRequested(s), r && r.response && (r.response.data = transformData.call(
|
|
1799
|
+
s,
|
|
1800
|
+
s.transformResponse,
|
|
1801
|
+
r.response
|
|
1802
|
+
), r.response.headers = AxiosHeaders$1.from(r.response.headers))), Promise.reject(r);
|
|
1803
1803
|
});
|
|
1804
1804
|
}
|
|
1805
1805
|
const VERSION = "1.7.7", validators$1 = {};
|
|
1806
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach((
|
|
1807
|
-
validators$1[
|
|
1808
|
-
return typeof
|
|
1806
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((s, e) => {
|
|
1807
|
+
validators$1[s] = function(r) {
|
|
1808
|
+
return typeof r === s || "a" + (e < 1 ? "n " : " ") + s;
|
|
1809
1809
|
};
|
|
1810
1810
|
});
|
|
1811
1811
|
const deprecatedWarnings = {};
|
|
1812
|
-
validators$1.transitional = function
|
|
1813
|
-
function n(
|
|
1814
|
-
return "[Axios v" + VERSION + "] Transitional option '" +
|
|
1812
|
+
validators$1.transitional = function s(e, t, r) {
|
|
1813
|
+
function n(i, o) {
|
|
1814
|
+
return "[Axios v" + VERSION + "] Transitional option '" + i + "'" + o + (r ? ". " + r : "");
|
|
1815
1815
|
}
|
|
1816
|
-
return (
|
|
1816
|
+
return (i, o, a) => {
|
|
1817
1817
|
if (e === !1)
|
|
1818
1818
|
throw new AxiosError(
|
|
1819
|
-
n(
|
|
1819
|
+
n(o, " has been removed" + (t ? " in " + t : "")),
|
|
1820
1820
|
AxiosError.ERR_DEPRECATED
|
|
1821
1821
|
);
|
|
1822
|
-
return t && !deprecatedWarnings[
|
|
1822
|
+
return t && !deprecatedWarnings[o] && (deprecatedWarnings[o] = !0, console.warn(
|
|
1823
1823
|
n(
|
|
1824
|
-
|
|
1824
|
+
o,
|
|
1825
1825
|
" has been deprecated since v" + t + " and will be removed in the near future"
|
|
1826
1826
|
)
|
|
1827
|
-
)), e ? e(
|
|
1827
|
+
)), e ? e(i, o, a) : !0;
|
|
1828
1828
|
};
|
|
1829
1829
|
};
|
|
1830
|
-
function assertOptions(
|
|
1831
|
-
if (typeof
|
|
1830
|
+
function assertOptions(s, e, t) {
|
|
1831
|
+
if (typeof s != "object")
|
|
1832
1832
|
throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1833
|
-
const
|
|
1834
|
-
let n =
|
|
1833
|
+
const r = Object.keys(s);
|
|
1834
|
+
let n = r.length;
|
|
1835
1835
|
for (; n-- > 0; ) {
|
|
1836
|
-
const
|
|
1837
|
-
if (
|
|
1838
|
-
const a =
|
|
1836
|
+
const i = r[n], o = e[i];
|
|
1837
|
+
if (o) {
|
|
1838
|
+
const a = s[i], u = a === void 0 || o(a, i, s);
|
|
1839
1839
|
if (u !== !0)
|
|
1840
|
-
throw new AxiosError("option " +
|
|
1840
|
+
throw new AxiosError("option " + i + " must be " + u, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1841
1841
|
continue;
|
|
1842
1842
|
}
|
|
1843
1843
|
if (t !== !0)
|
|
1844
|
-
throw new AxiosError("Unknown option " +
|
|
1844
|
+
throw new AxiosError("Unknown option " + i, AxiosError.ERR_BAD_OPTION);
|
|
1845
1845
|
}
|
|
1846
1846
|
}
|
|
1847
1847
|
const validator = {
|
|
@@ -1866,24 +1866,24 @@ class Axios {
|
|
|
1866
1866
|
async request(e, t) {
|
|
1867
1867
|
try {
|
|
1868
1868
|
return await this._request(e, t);
|
|
1869
|
-
} catch (
|
|
1870
|
-
if (
|
|
1869
|
+
} catch (r) {
|
|
1870
|
+
if (r instanceof Error) {
|
|
1871
1871
|
let n;
|
|
1872
1872
|
Error.captureStackTrace ? Error.captureStackTrace(n = {}) : n = new Error();
|
|
1873
|
-
const
|
|
1873
|
+
const i = n.stack ? n.stack.replace(/^.+\n/, "") : "";
|
|
1874
1874
|
try {
|
|
1875
|
-
|
|
1876
|
-
` +
|
|
1875
|
+
r.stack ? i && !String(r.stack).endsWith(i.replace(/^.+\n.+\n/, "")) && (r.stack += `
|
|
1876
|
+
` + i) : r.stack = i;
|
|
1877
1877
|
} catch {
|
|
1878
1878
|
}
|
|
1879
1879
|
}
|
|
1880
|
-
throw
|
|
1880
|
+
throw r;
|
|
1881
1881
|
}
|
|
1882
1882
|
}
|
|
1883
1883
|
_request(e, t) {
|
|
1884
1884
|
typeof e == "string" ? (t = t || {}, t.url = e) : t = e || {}, t = mergeConfig(this.defaults, t);
|
|
1885
|
-
const { transitional:
|
|
1886
|
-
|
|
1885
|
+
const { transitional: r, paramsSerializer: n, headers: i } = t;
|
|
1886
|
+
r !== void 0 && validator.assertOptions(r, {
|
|
1887
1887
|
silentJSONParsing: validators.transitional(validators.boolean),
|
|
1888
1888
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
1889
1889
|
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
@@ -1893,16 +1893,16 @@ class Axios {
|
|
|
1893
1893
|
encode: validators.function,
|
|
1894
1894
|
serialize: validators.function
|
|
1895
1895
|
}, !0)), t.method = (t.method || this.defaults.method || "get").toLowerCase();
|
|
1896
|
-
let
|
|
1897
|
-
|
|
1898
|
-
|
|
1896
|
+
let o = i && utils$1.merge(
|
|
1897
|
+
i.common,
|
|
1898
|
+
i[t.method]
|
|
1899
1899
|
);
|
|
1900
|
-
|
|
1900
|
+
i && utils$1.forEach(
|
|
1901
1901
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1902
1902
|
(d) => {
|
|
1903
|
-
delete
|
|
1903
|
+
delete i[d];
|
|
1904
1904
|
}
|
|
1905
|
-
), t.headers = AxiosHeaders$1.concat(
|
|
1905
|
+
), t.headers = AxiosHeaders$1.concat(o, i);
|
|
1906
1906
|
const a = [];
|
|
1907
1907
|
let u = !0;
|
|
1908
1908
|
this.interceptors.request.forEach(function(g) {
|
|
@@ -1912,30 +1912,30 @@ class Axios {
|
|
|
1912
1912
|
this.interceptors.response.forEach(function(g) {
|
|
1913
1913
|
l.push(g.fulfilled, g.rejected);
|
|
1914
1914
|
});
|
|
1915
|
-
let f, m = 0,
|
|
1915
|
+
let f, m = 0, b;
|
|
1916
1916
|
if (!u) {
|
|
1917
1917
|
const d = [dispatchRequest.bind(this), void 0];
|
|
1918
|
-
for (d.unshift.apply(d, a), d.push.apply(d, l),
|
|
1918
|
+
for (d.unshift.apply(d, a), d.push.apply(d, l), b = d.length, f = Promise.resolve(t); m < b; )
|
|
1919
1919
|
f = f.then(d[m++], d[m++]);
|
|
1920
1920
|
return f;
|
|
1921
1921
|
}
|
|
1922
|
-
|
|
1923
|
-
let
|
|
1924
|
-
for (m = 0; m <
|
|
1922
|
+
b = a.length;
|
|
1923
|
+
let w = t;
|
|
1924
|
+
for (m = 0; m < b; ) {
|
|
1925
1925
|
const d = a[m++], g = a[m++];
|
|
1926
1926
|
try {
|
|
1927
|
-
|
|
1927
|
+
w = d(w);
|
|
1928
1928
|
} catch (p) {
|
|
1929
1929
|
g.call(this, p);
|
|
1930
1930
|
break;
|
|
1931
1931
|
}
|
|
1932
1932
|
}
|
|
1933
1933
|
try {
|
|
1934
|
-
f = dispatchRequest.call(this,
|
|
1934
|
+
f = dispatchRequest.call(this, w);
|
|
1935
1935
|
} catch (d) {
|
|
1936
1936
|
return Promise.reject(d);
|
|
1937
1937
|
}
|
|
1938
|
-
for (m = 0,
|
|
1938
|
+
for (m = 0, b = l.length; m < b; )
|
|
1939
1939
|
f = f.then(l[m++], l[m++]);
|
|
1940
1940
|
return f;
|
|
1941
1941
|
}
|
|
@@ -1945,25 +1945,25 @@ class Axios {
|
|
|
1945
1945
|
return buildURL(t, e.params, e.paramsSerializer);
|
|
1946
1946
|
}
|
|
1947
1947
|
}
|
|
1948
|
-
utils$1.forEach(["delete", "get", "head", "options"], function
|
|
1949
|
-
Axios.prototype[e] = function(t,
|
|
1950
|
-
return this.request(mergeConfig(
|
|
1948
|
+
utils$1.forEach(["delete", "get", "head", "options"], function s(e) {
|
|
1949
|
+
Axios.prototype[e] = function(t, r) {
|
|
1950
|
+
return this.request(mergeConfig(r || {}, {
|
|
1951
1951
|
method: e,
|
|
1952
1952
|
url: t,
|
|
1953
|
-
data: (
|
|
1953
|
+
data: (r || {}).data
|
|
1954
1954
|
}));
|
|
1955
1955
|
};
|
|
1956
1956
|
});
|
|
1957
|
-
utils$1.forEach(["post", "put", "patch"], function
|
|
1958
|
-
function t(
|
|
1959
|
-
return function(
|
|
1957
|
+
utils$1.forEach(["post", "put", "patch"], function s(e) {
|
|
1958
|
+
function t(r) {
|
|
1959
|
+
return function(i, o, a) {
|
|
1960
1960
|
return this.request(mergeConfig(a || {}, {
|
|
1961
1961
|
method: e,
|
|
1962
|
-
headers:
|
|
1962
|
+
headers: r ? {
|
|
1963
1963
|
"Content-Type": "multipart/form-data"
|
|
1964
1964
|
} : {},
|
|
1965
|
-
url:
|
|
1966
|
-
data:
|
|
1965
|
+
url: i,
|
|
1966
|
+
data: o
|
|
1967
1967
|
}));
|
|
1968
1968
|
};
|
|
1969
1969
|
}
|
|
@@ -1975,27 +1975,27 @@ class CancelToken {
|
|
|
1975
1975
|
if (typeof e != "function")
|
|
1976
1976
|
throw new TypeError("executor must be a function.");
|
|
1977
1977
|
let t;
|
|
1978
|
-
this.promise = new Promise(function(
|
|
1979
|
-
t =
|
|
1978
|
+
this.promise = new Promise(function(i) {
|
|
1979
|
+
t = i;
|
|
1980
1980
|
});
|
|
1981
|
-
const
|
|
1981
|
+
const r = this;
|
|
1982
1982
|
this.promise.then((n) => {
|
|
1983
|
-
if (!
|
|
1983
|
+
if (!r._listeners)
|
|
1984
1984
|
return;
|
|
1985
|
-
let
|
|
1986
|
-
for (;
|
|
1987
|
-
|
|
1988
|
-
|
|
1985
|
+
let i = r._listeners.length;
|
|
1986
|
+
for (; i-- > 0; )
|
|
1987
|
+
r._listeners[i](n);
|
|
1988
|
+
r._listeners = null;
|
|
1989
1989
|
}), this.promise.then = (n) => {
|
|
1990
|
-
let
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1990
|
+
let i;
|
|
1991
|
+
const o = new Promise((a) => {
|
|
1992
|
+
r.subscribe(a), i = a;
|
|
1993
1993
|
}).then(n);
|
|
1994
|
-
return
|
|
1995
|
-
|
|
1996
|
-
},
|
|
1997
|
-
}, e(function(
|
|
1998
|
-
|
|
1994
|
+
return o.cancel = function() {
|
|
1995
|
+
r.unsubscribe(i);
|
|
1996
|
+
}, o;
|
|
1997
|
+
}, e(function(i, o, a) {
|
|
1998
|
+
r.reason || (r.reason = new CanceledError(i, o, a), t(r.reason));
|
|
1999
1999
|
});
|
|
2000
2000
|
}
|
|
2001
2001
|
/**
|
|
@@ -2025,8 +2025,8 @@ class CancelToken {
|
|
|
2025
2025
|
t !== -1 && this._listeners.splice(t, 1);
|
|
2026
2026
|
}
|
|
2027
2027
|
toAbortSignal() {
|
|
2028
|
-
const e = new AbortController(), t = (
|
|
2029
|
-
e.abort(
|
|
2028
|
+
const e = new AbortController(), t = (r) => {
|
|
2029
|
+
e.abort(r);
|
|
2030
2030
|
};
|
|
2031
2031
|
return this.subscribe(t), e.signal.unsubscribe = () => this.unsubscribe(t), e.signal;
|
|
2032
2032
|
}
|
|
@@ -2045,13 +2045,13 @@ class CancelToken {
|
|
|
2045
2045
|
}
|
|
2046
2046
|
}
|
|
2047
2047
|
const CancelToken$1 = CancelToken;
|
|
2048
|
-
function spread(
|
|
2048
|
+
function spread(s) {
|
|
2049
2049
|
return function(t) {
|
|
2050
|
-
return
|
|
2050
|
+
return s.apply(null, t);
|
|
2051
2051
|
};
|
|
2052
2052
|
}
|
|
2053
|
-
function isAxiosError(
|
|
2054
|
-
return utils$1.isObject(
|
|
2053
|
+
function isAxiosError(s) {
|
|
2054
|
+
return utils$1.isObject(s) && s.isAxiosError === !0;
|
|
2055
2055
|
}
|
|
2056
2056
|
const HttpStatusCode = {
|
|
2057
2057
|
Continue: 100,
|
|
@@ -2118,14 +2118,14 @@ const HttpStatusCode = {
|
|
|
2118
2118
|
NotExtended: 510,
|
|
2119
2119
|
NetworkAuthenticationRequired: 511
|
|
2120
2120
|
};
|
|
2121
|
-
Object.entries(HttpStatusCode).forEach(([
|
|
2122
|
-
HttpStatusCode[e] =
|
|
2121
|
+
Object.entries(HttpStatusCode).forEach(([s, e]) => {
|
|
2122
|
+
HttpStatusCode[e] = s;
|
|
2123
2123
|
});
|
|
2124
2124
|
const HttpStatusCode$1 = HttpStatusCode;
|
|
2125
|
-
function createInstance(
|
|
2126
|
-
const e = new Axios$1(
|
|
2125
|
+
function createInstance(s) {
|
|
2126
|
+
const e = new Axios$1(s), t = bind(Axios$1.prototype.request, e);
|
|
2127
2127
|
return utils$1.extend(t, Axios$1.prototype, e, { allOwnKeys: !0 }), utils$1.extend(t, e, null, { allOwnKeys: !0 }), t.create = function(n) {
|
|
2128
|
-
return createInstance(mergeConfig(
|
|
2128
|
+
return createInstance(mergeConfig(s, n));
|
|
2129
2129
|
}, t;
|
|
2130
2130
|
}
|
|
2131
2131
|
const axios = createInstance(defaults$1);
|
|
@@ -2137,70 +2137,70 @@ axios.VERSION = VERSION;
|
|
|
2137
2137
|
axios.toFormData = toFormData;
|
|
2138
2138
|
axios.AxiosError = AxiosError;
|
|
2139
2139
|
axios.Cancel = axios.CanceledError;
|
|
2140
|
-
axios.all = function
|
|
2140
|
+
axios.all = function s(e) {
|
|
2141
2141
|
return Promise.all(e);
|
|
2142
2142
|
};
|
|
2143
2143
|
axios.spread = spread;
|
|
2144
2144
|
axios.isAxiosError = isAxiosError;
|
|
2145
2145
|
axios.mergeConfig = mergeConfig;
|
|
2146
2146
|
axios.AxiosHeaders = AxiosHeaders$1;
|
|
2147
|
-
axios.formToJSON = (
|
|
2147
|
+
axios.formToJSON = (s) => formDataToJSON(utils$1.isHTMLForm(s) ? new FormData(s) : s);
|
|
2148
2148
|
axios.getAdapter = adapters.getAdapter;
|
|
2149
2149
|
axios.HttpStatusCode = HttpStatusCode$1;
|
|
2150
2150
|
axios.default = axios;
|
|
2151
2151
|
/*! js-cookie v3.0.5 | MIT */
|
|
2152
|
-
function assign(
|
|
2152
|
+
function assign(s) {
|
|
2153
2153
|
for (var e = 1; e < arguments.length; e++) {
|
|
2154
2154
|
var t = arguments[e];
|
|
2155
|
-
for (var
|
|
2156
|
-
r
|
|
2155
|
+
for (var r in t)
|
|
2156
|
+
s[r] = t[r];
|
|
2157
2157
|
}
|
|
2158
|
-
return
|
|
2158
|
+
return s;
|
|
2159
2159
|
}
|
|
2160
2160
|
var defaultConverter = {
|
|
2161
|
-
read: function(
|
|
2162
|
-
return
|
|
2161
|
+
read: function(s) {
|
|
2162
|
+
return s[0] === '"' && (s = s.slice(1, -1)), s.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
2163
2163
|
},
|
|
2164
|
-
write: function(
|
|
2165
|
-
return encodeURIComponent(
|
|
2164
|
+
write: function(s) {
|
|
2165
|
+
return encodeURIComponent(s).replace(
|
|
2166
2166
|
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
2167
2167
|
decodeURIComponent
|
|
2168
2168
|
);
|
|
2169
2169
|
}
|
|
2170
2170
|
};
|
|
2171
|
-
function init(
|
|
2172
|
-
function t(n,
|
|
2171
|
+
function init(s, e) {
|
|
2172
|
+
function t(n, i, o) {
|
|
2173
2173
|
if (!(typeof document > "u")) {
|
|
2174
|
-
|
|
2174
|
+
o = assign({}, e, o), typeof o.expires == "number" && (o.expires = new Date(Date.now() + o.expires * 864e5)), o.expires && (o.expires = o.expires.toUTCString()), n = encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
2175
2175
|
var a = "";
|
|
2176
|
-
for (var u in
|
|
2177
|
-
|
|
2178
|
-
return document.cookie = n + "=" +
|
|
2176
|
+
for (var u in o)
|
|
2177
|
+
o[u] && (a += "; " + u, o[u] !== !0 && (a += "=" + o[u].split(";")[0]));
|
|
2178
|
+
return document.cookie = n + "=" + s.write(i, n) + a;
|
|
2179
2179
|
}
|
|
2180
2180
|
}
|
|
2181
|
-
function
|
|
2181
|
+
function r(n) {
|
|
2182
2182
|
if (!(typeof document > "u" || arguments.length && !n)) {
|
|
2183
|
-
for (var
|
|
2184
|
-
var u =
|
|
2183
|
+
for (var i = document.cookie ? document.cookie.split("; ") : [], o = {}, a = 0; a < i.length; a++) {
|
|
2184
|
+
var u = i[a].split("="), l = u.slice(1).join("=");
|
|
2185
2185
|
try {
|
|
2186
2186
|
var f = decodeURIComponent(u[0]);
|
|
2187
|
-
if (
|
|
2187
|
+
if (o[f] = s.read(l, f), n === f)
|
|
2188
2188
|
break;
|
|
2189
2189
|
} catch {
|
|
2190
2190
|
}
|
|
2191
2191
|
}
|
|
2192
|
-
return n ?
|
|
2192
|
+
return n ? o[n] : o;
|
|
2193
2193
|
}
|
|
2194
2194
|
}
|
|
2195
2195
|
return Object.create(
|
|
2196
2196
|
{
|
|
2197
2197
|
set: t,
|
|
2198
|
-
get:
|
|
2199
|
-
remove: function(n,
|
|
2198
|
+
get: r,
|
|
2199
|
+
remove: function(n, i) {
|
|
2200
2200
|
t(
|
|
2201
2201
|
n,
|
|
2202
2202
|
"",
|
|
2203
|
-
assign({},
|
|
2203
|
+
assign({}, i, {
|
|
2204
2204
|
expires: -1
|
|
2205
2205
|
})
|
|
2206
2206
|
);
|
|
@@ -2214,7 +2214,7 @@ function init(r, e) {
|
|
|
2214
2214
|
},
|
|
2215
2215
|
{
|
|
2216
2216
|
attributes: { value: Object.freeze(e) },
|
|
2217
|
-
converter: { value: Object.freeze(
|
|
2217
|
+
converter: { value: Object.freeze(s) }
|
|
2218
2218
|
}
|
|
2219
2219
|
);
|
|
2220
2220
|
}
|
|
@@ -2225,18 +2225,18 @@ class ErrorsHandler {
|
|
|
2225
2225
|
return "message" in e && (t.msg = e.message), "error" in e && (t.msg = e.error), "status" in e && (t.statusCode = e.status), t;
|
|
2226
2226
|
}
|
|
2227
2227
|
getErrorMessageFromData(e, t) {
|
|
2228
|
-
let
|
|
2229
|
-
const n = ["message", "msg", "error", "Message", "Messages", "Error", "Errors"],
|
|
2230
|
-
for (let [
|
|
2231
|
-
if (n.includes(
|
|
2232
|
-
|
|
2228
|
+
let r = "";
|
|
2229
|
+
const n = ["message", "msg", "error", "Message", "Messages", "Error", "Errors"], i = Object.entries(t);
|
|
2230
|
+
for (let [o, a] of i)
|
|
2231
|
+
if (n.includes(o)) {
|
|
2232
|
+
r = a;
|
|
2233
2233
|
break;
|
|
2234
2234
|
}
|
|
2235
|
-
return
|
|
2235
|
+
return r;
|
|
2236
2236
|
}
|
|
2237
2237
|
gerErrorByStatusCordovaHttp(e, t) {
|
|
2238
|
-
let
|
|
2239
|
-
return [-1, -4].includes(e) ?
|
|
2238
|
+
let r = "";
|
|
2239
|
+
return [-1, -4].includes(e) ? r = "Нет возможности подключиться к серверу" : e === -3 ? r = `Не удается разрешить хост ${t}: Нет адреса, связанного с именем хоста` : e === -6 && (r = "Нет доступа к сети"), e === -8 && console.log("download aborted"), r;
|
|
2240
2240
|
}
|
|
2241
2241
|
}
|
|
2242
2242
|
class SaveRequest {
|
|
@@ -2251,7 +2251,7 @@ class SaveRequest {
|
|
|
2251
2251
|
return this.list;
|
|
2252
2252
|
}
|
|
2253
2253
|
removeItem(e) {
|
|
2254
|
-
const t = this.list.filter((
|
|
2254
|
+
const t = this.list.filter((r) => r.url !== e);
|
|
2255
2255
|
this.list = t;
|
|
2256
2256
|
}
|
|
2257
2257
|
getLength() {
|
|
@@ -2259,20 +2259,20 @@ class SaveRequest {
|
|
|
2259
2259
|
}
|
|
2260
2260
|
getIsItem(e) {
|
|
2261
2261
|
const { list: t } = this;
|
|
2262
|
-
return t.some((
|
|
2262
|
+
return t.some((r) => r.url === e);
|
|
2263
2263
|
}
|
|
2264
2264
|
}
|
|
2265
2265
|
const x = class x {
|
|
2266
2266
|
};
|
|
2267
|
-
c(x, "events", (e, t,
|
|
2267
|
+
c(x, "events", (e, t, r, n = "") => new Promise((i, o) => {
|
|
2268
2268
|
let a = 0;
|
|
2269
|
-
for (let [u, l] of
|
|
2270
|
-
a++, e === "add" ? t.addEventListener(u, l) : t.removeEventListener(u, l), a ===
|
|
2271
|
-
})), c(x, "sortDataByAlphabet", (e, t) => e.sort((
|
|
2272
|
-
e.sort((
|
|
2269
|
+
for (let [u, l] of r)
|
|
2270
|
+
a++, e === "add" ? t.addEventListener(u, l) : t.removeEventListener(u, l), a === r.length && i("");
|
|
2271
|
+
})), c(x, "sortDataByAlphabet", (e, t) => e.sort((r, n) => n[t].trim() < r[t].trim() ? 1 : -1)), c(x, "sortDataByDate", (e, t) => {
|
|
2272
|
+
e.sort((r, n) => x.hasDateLessPeriod(n[t], r[t]) ? 1 : -1);
|
|
2273
2273
|
}), c(x, "sortDataByDateAndTime", (e, t) => {
|
|
2274
2274
|
}), c(x, "splitDateFromTime", (e) => e.split(" ")), c(x, "reverseDate", (e) => {
|
|
2275
|
-
let [t,
|
|
2275
|
+
let [t, r] = x.splitDateFromTime(e);
|
|
2276
2276
|
return t.split(".").reverse().join("-");
|
|
2277
2277
|
}), c(x, "correctionDataISO8601", (e) => {
|
|
2278
2278
|
let t = "";
|
|
@@ -2283,22 +2283,22 @@ c(x, "events", (e, t, s, n = "") => new Promise((o, i) => {
|
|
|
2283
2283
|
else
|
|
2284
2284
|
throw new Error(`функция correctionDataISO8601 >> date не корректна: ${e}. Требуется один из форматов: дд.мм.гггг | дд.мм.гггг мм:чч | гггг-мм-дд `);
|
|
2285
2285
|
return t;
|
|
2286
|
-
}), c(x, "hasDateLessPeriod", (e, t,
|
|
2287
|
-
if (e = x.correctionDataISO8601(e), t = x.correctionDataISO8601(t), !
|
|
2286
|
+
}), c(x, "hasDateLessPeriod", (e, t, r) => {
|
|
2287
|
+
if (e = x.correctionDataISO8601(e), t = x.correctionDataISO8601(t), !r || r && !r.dateMinMax || (r == null ? void 0 : r.dateMinMax) === "<=")
|
|
2288
2288
|
return Math.floor(Number(new Date(e))) <= Math.floor(Number(new Date(t)));
|
|
2289
|
-
if (
|
|
2289
|
+
if (r && (r == null ? void 0 : r.dateMinMax) === ">=")
|
|
2290
2290
|
return Math.floor(Number(new Date(e))) >= Math.floor(Number(new Date(t)));
|
|
2291
|
-
if (
|
|
2291
|
+
if (r && (r == null ? void 0 : r.dateMinMax) === "<")
|
|
2292
2292
|
return Math.floor(Number(new Date(e))) < Math.floor(Number(new Date(t)));
|
|
2293
|
-
if (
|
|
2293
|
+
if (r && (r == null ? void 0 : r.dateMinMax) === ">")
|
|
2294
2294
|
return Math.floor(Number(new Date(e))) > Math.floor(Number(new Date(t)));
|
|
2295
2295
|
}), c(x, "getEndsWithArr", (e, t) => e.slice(-t)), c(x, "deepMerge", (...e) => {
|
|
2296
|
-
const t = {},
|
|
2297
|
-
for (const
|
|
2298
|
-
Object.prototype.hasOwnProperty.call(n,
|
|
2296
|
+
const t = {}, r = (n) => {
|
|
2297
|
+
for (const i in n)
|
|
2298
|
+
Object.prototype.hasOwnProperty.call(n, i) && (Object.prototype.toString.call(n[i]) === "[object Object]" ? t[i] = x.deepMerge(t[i], n[i]) : t[i] = n[i]);
|
|
2299
2299
|
};
|
|
2300
2300
|
for (let n = 0; n < e.length; n++)
|
|
2301
|
-
|
|
2301
|
+
r(e[n]);
|
|
2302
2302
|
return t;
|
|
2303
2303
|
}), c(x, "isJSON", (e) => {
|
|
2304
2304
|
try {
|
|
@@ -2307,14 +2307,14 @@ c(x, "events", (e, t, s, n = "") => new Promise((o, i) => {
|
|
|
2307
2307
|
return !1;
|
|
2308
2308
|
}
|
|
2309
2309
|
return !0;
|
|
2310
|
-
}), c(x, "filterItems", (e, t) => e.filter((
|
|
2311
|
-
const t = [],
|
|
2312
|
-
for (let
|
|
2313
|
-
const a = e[
|
|
2314
|
-
a.online ? t.push(a) :
|
|
2315
|
-
}
|
|
2316
|
-
const n = x.sortDataByAlphabet(t, "name"),
|
|
2317
|
-
return [...n, ...
|
|
2310
|
+
}), c(x, "filterItems", (e, t) => e.filter((r) => r.name.toLowerCase().includes(t.toLowerCase()))), c(x, "sortByOnline", (e) => {
|
|
2311
|
+
const t = [], r = [];
|
|
2312
|
+
for (let o = 0; e.length > o; o++) {
|
|
2313
|
+
const a = e[o];
|
|
2314
|
+
a.online ? t.push(a) : r.push(a);
|
|
2315
|
+
}
|
|
2316
|
+
const n = x.sortDataByAlphabet(t, "name"), i = x.sortDataByAlphabet(r, "name");
|
|
2317
|
+
return [...n, ...i];
|
|
2318
2318
|
});
|
|
2319
2319
|
let Utils = x;
|
|
2320
2320
|
const E = class E {
|
|
@@ -2335,16 +2335,16 @@ const E = class E {
|
|
|
2335
2335
|
};
|
|
2336
2336
|
c(E, "keyCookie", "AuthCookie"), c(E, "cookieOptions", {}), c(E, "registerRequest", new SaveRequest()), c(E, "registerFailedRequests", new SaveRequest()), c(E, "requestUploadToken", null), c(E, "errorsHandler", new ErrorsHandler()), c(E, "setMethodUploadToken", (e) => {
|
|
2337
2337
|
E.requestUploadToken = e;
|
|
2338
|
-
}), c(E, "requestInServer", (e, t = {}) => new Promise((
|
|
2339
|
-
var
|
|
2340
|
-
let
|
|
2341
|
-
const
|
|
2338
|
+
}), c(E, "requestInServer", (e, t = {}) => new Promise((r, n) => {
|
|
2339
|
+
var b;
|
|
2340
|
+
let i = { url: e, statusCode: 0, data: {}, res: {} };
|
|
2341
|
+
const o = {
|
|
2342
2342
|
method: "get",
|
|
2343
2343
|
headers: {
|
|
2344
2344
|
cookie: E.getAuthCookies()
|
|
2345
2345
|
},
|
|
2346
2346
|
timeout: 6e4
|
|
2347
|
-
}, a = Utils.deepMerge(
|
|
2347
|
+
}, a = Utils.deepMerge(o, t), u = 520, l = "", f = {
|
|
2348
2348
|
url: e,
|
|
2349
2349
|
statusCode: u,
|
|
2350
2350
|
msg: l,
|
|
@@ -2352,37 +2352,37 @@ c(E, "keyCookie", "AuthCookie"), c(E, "cookieOptions", {}), c(E, "registerReques
|
|
|
2352
2352
|
request: a,
|
|
2353
2353
|
errExt: { message: l, status: u }
|
|
2354
2354
|
}, { cordova: m } = window;
|
|
2355
|
-
if (m != null && m.cordova && ((
|
|
2356
|
-
const { http:
|
|
2357
|
-
"Content-Type" in (a == null ? void 0 : a.headers) && ((a == null ? void 0 : a.headers["Content-Type"]) === "multipart/form-data" &&
|
|
2355
|
+
if (m != null && m.cordova && ((b = m == null ? void 0 : m.plugin) != null && b.http)) {
|
|
2356
|
+
const { http: w } = m == null ? void 0 : m.plugin;
|
|
2357
|
+
"Content-Type" in (a == null ? void 0 : a.headers) && ((a == null ? void 0 : a.headers["Content-Type"]) === "multipart/form-data" && w.setDataSerializer("urlencoded"), (a == null ? void 0 : a.headers["Content-Type"]) === "application/json" && w.setDataSerializer("json")), w.setRequestTimeout(Number(a.timeout) / 1e3), E.registerRequest.setList({ url: e, options: a }), w.sendRequest(
|
|
2358
2358
|
e,
|
|
2359
2359
|
a,
|
|
2360
2360
|
(d) => {
|
|
2361
2361
|
E.registerFailedRequests.removeItem(e), E.registerRequest.removeItem(e);
|
|
2362
2362
|
const g = (d == null ? void 0 : d.headers) && d.headers["set-cookie"], p = d.status, D = Utils.isJSON(d == null ? void 0 : d.data) ? JSON.parse(d == null ? void 0 : d.data) : d == null ? void 0 : d.data;
|
|
2363
|
-
|
|
2363
|
+
i = { ...i, statusCode: p, data: D, res: d }, p === 200 && g && (E.saveToken(g), i.data = { ...i.data, token: g }), r(i);
|
|
2364
2364
|
},
|
|
2365
2365
|
(d) => {
|
|
2366
|
-
const g = E.errorsHandler.handleError(d), { url: p, status: D, headers: A, error: S, ...O } = d,
|
|
2366
|
+
const g = E.errorsHandler.handleError(d), { url: p, status: D, headers: A, error: S, ...O } = d, T = typeof S == "string" ? Utils.isJSON(S.trim()) : !1, R = {
|
|
2367
2367
|
headers: A,
|
|
2368
2368
|
status: D,
|
|
2369
2369
|
message: ""
|
|
2370
2370
|
};
|
|
2371
|
-
if (
|
|
2372
|
-
const C = JSON.parse(S.trim()),
|
|
2373
|
-
|
|
2371
|
+
if (T) {
|
|
2372
|
+
const C = JSON.parse(S.trim()), v = E.errorsHandler.getErrorMessageFromData(D, C);
|
|
2373
|
+
R.message = v, R.data = C, g.msg = E.errorsHandler.gerErrorByStatusCordovaHttp(D, p);
|
|
2374
2374
|
} else
|
|
2375
|
-
typeof S == "string" && (
|
|
2376
|
-
n({ ...f, ...g, errExt:
|
|
2375
|
+
typeof S == "string" && (R.message = S);
|
|
2376
|
+
n({ ...f, ...g, errExt: R });
|
|
2377
2377
|
}
|
|
2378
2378
|
);
|
|
2379
2379
|
} else
|
|
2380
|
-
E.registerRequest.setList({ url: e, options: a }), axios({ url: e, ...a }).then((
|
|
2380
|
+
E.registerRequest.setList({ url: e, options: a }), axios({ url: e, ...a }).then((w) => {
|
|
2381
2381
|
E.registerRequest.removeItem(e);
|
|
2382
|
-
const d =
|
|
2383
|
-
|
|
2384
|
-
}).catch((
|
|
2385
|
-
const d = E.errorsHandler.handleError(
|
|
2382
|
+
const d = w.status, g = w == null ? void 0 : w.data;
|
|
2383
|
+
i = { ...i, statusCode: d, data: g, res: w }, r(i);
|
|
2384
|
+
}).catch((w) => {
|
|
2385
|
+
const d = E.errorsHandler.handleError(w), { code: g, config: p, status: D, message: A, response: S, stack: O } = w, T = {
|
|
2386
2386
|
code: g,
|
|
2387
2387
|
config: p,
|
|
2388
2388
|
status: D || u,
|
|
@@ -2392,12 +2392,12 @@ c(E, "keyCookie", "AuthCookie"), c(E, "cookieOptions", {}), c(E, "registerReques
|
|
|
2392
2392
|
data: S == null ? void 0 : S.data,
|
|
2393
2393
|
stack: O
|
|
2394
2394
|
};
|
|
2395
|
-
n({ ...f, ...d, errExt:
|
|
2395
|
+
n({ ...f, ...d, errExt: T });
|
|
2396
2396
|
});
|
|
2397
2397
|
})), c(E, "getAuthCookies", () => {
|
|
2398
|
-
var
|
|
2398
|
+
var r;
|
|
2399
2399
|
const { keyCookie: e } = E, { cordova: t } = window;
|
|
2400
|
-
if ((
|
|
2400
|
+
if ((r = t == null ? void 0 : t.plugin) != null && r.http) {
|
|
2401
2401
|
const { http: n } = t == null ? void 0 : t.plugin;
|
|
2402
2402
|
return n.getCookieString(e);
|
|
2403
2403
|
}
|
|
@@ -2405,18 +2405,18 @@ c(E, "keyCookie", "AuthCookie"), c(E, "cookieOptions", {}), c(E, "registerReques
|
|
|
2405
2405
|
}), c(E, "saveToken", (e) => {
|
|
2406
2406
|
var t;
|
|
2407
2407
|
if (e) {
|
|
2408
|
-
const { keyCookie:
|
|
2409
|
-
if ((t =
|
|
2410
|
-
const { http:
|
|
2411
|
-
|
|
2408
|
+
const { keyCookie: r, cookieOptions: n } = E, { cordova: i } = window;
|
|
2409
|
+
if ((t = i == null ? void 0 : i.plugin) != null && t.http) {
|
|
2410
|
+
const { http: o } = i == null ? void 0 : i.plugin;
|
|
2411
|
+
o.setCookie(r, e, n);
|
|
2412
2412
|
return;
|
|
2413
2413
|
}
|
|
2414
|
-
api.set(
|
|
2414
|
+
api.set(r, e, n);
|
|
2415
2415
|
}
|
|
2416
2416
|
}), c(E, "removeAuthCookie", () => {
|
|
2417
|
-
var
|
|
2417
|
+
var r;
|
|
2418
2418
|
const { keyCookie: e } = E, { cordova: t } = window;
|
|
2419
|
-
if ((
|
|
2419
|
+
if ((r = t == null ? void 0 : t.plugin) != null && r.http) {
|
|
2420
2420
|
const { http: n } = t == null ? void 0 : t.plugin;
|
|
2421
2421
|
n.clearCookies();
|
|
2422
2422
|
return;
|
|
@@ -2432,19 +2432,19 @@ class NetworkInformationCordova extends NetworkInformationAbstract {
|
|
|
2432
2432
|
constructor() {
|
|
2433
2433
|
super(...arguments);
|
|
2434
2434
|
c(this, "watchers", (t) => {
|
|
2435
|
-
const
|
|
2436
|
-
const
|
|
2437
|
-
t(
|
|
2435
|
+
const r = (n) => {
|
|
2436
|
+
const i = !["none", "unknown"].includes(n);
|
|
2437
|
+
t(i, n);
|
|
2438
2438
|
};
|
|
2439
2439
|
if (navigator != null && navigator.connection && "getInfo" in (navigator == null ? void 0 : navigator.connection)) {
|
|
2440
2440
|
const n = () => {
|
|
2441
|
-
var
|
|
2442
|
-
return (
|
|
2443
|
-
},
|
|
2444
|
-
const
|
|
2445
|
-
|
|
2441
|
+
var o;
|
|
2442
|
+
return (o = navigator == null ? void 0 : navigator.connection) == null ? void 0 : o.type;
|
|
2443
|
+
}, i = () => {
|
|
2444
|
+
const o = n();
|
|
2445
|
+
r(o);
|
|
2446
2446
|
};
|
|
2447
|
-
|
|
2447
|
+
i(), document.addEventListener("offline", i, !1), document.addEventListener("online", i, !1);
|
|
2448
2448
|
} else
|
|
2449
2449
|
console.error("Нету navigator.connection.getInfo");
|
|
2450
2450
|
});
|
|
@@ -2473,9 +2473,9 @@ class InternetWatchers {
|
|
|
2473
2473
|
{ event: "online", status: !0, textStatus: "network" },
|
|
2474
2474
|
{ event: "offline", status: !1, textStatus: "none" }
|
|
2475
2475
|
];
|
|
2476
|
-
for (let
|
|
2477
|
-
const n = new AbortController(), { event:
|
|
2478
|
-
this.state.listCloseSignals.push(n), window.addEventListener(
|
|
2476
|
+
for (let r = 0; r < t.length; r++) {
|
|
2477
|
+
const n = new AbortController(), { event: i, status: o, textStatus: a } = t[r];
|
|
2478
|
+
this.state.listCloseSignals.push(n), window.addEventListener(i, () => e(o, a), { signal: n.signal });
|
|
2479
2479
|
}
|
|
2480
2480
|
}
|
|
2481
2481
|
}
|
|
@@ -2509,22 +2509,22 @@ class EventSubscribers {
|
|
|
2509
2509
|
c(this, "getListNameEvents", () => Object.keys(this.subscribersEvents));
|
|
2510
2510
|
c(this, "getSubscribers", () => this.subscribersEvents);
|
|
2511
2511
|
c(this, "subscribe", (e, t) => {
|
|
2512
|
-
var
|
|
2513
|
-
(
|
|
2512
|
+
var r;
|
|
2513
|
+
(r = this.subscribersEvents[e]) == null || r.push(t);
|
|
2514
2514
|
});
|
|
2515
2515
|
c(this, "unsubscribe", (e, t) => {
|
|
2516
|
-
var
|
|
2517
|
-
this.subscribersEvents[e] && (this.subscribersEvents[e] = (
|
|
2516
|
+
var r;
|
|
2517
|
+
this.subscribersEvents[e] && (this.subscribersEvents[e] = (r = this.subscribersEvents[e]) == null ? void 0 : r.filter((n) => n !== t));
|
|
2518
2518
|
});
|
|
2519
2519
|
c(this, "publish", (e, t) => {
|
|
2520
|
-
var
|
|
2521
|
-
this.subscribersEvents[e] && ((
|
|
2520
|
+
var r;
|
|
2521
|
+
this.subscribersEvents[e] && ((r = this.subscribersEvents[e]) == null || r.forEach((n) => {
|
|
2522
2522
|
n(t);
|
|
2523
2523
|
}));
|
|
2524
2524
|
});
|
|
2525
2525
|
c(this, "resetSubscribers", () => {
|
|
2526
2526
|
const e = Object.entries(this.subscribersEvents);
|
|
2527
|
-
for (const [t,
|
|
2527
|
+
for (const [t, r] of e)
|
|
2528
2528
|
this.subscribersEvents[t] = [];
|
|
2529
2529
|
});
|
|
2530
2530
|
e.forEach((t) => {
|
|
@@ -2543,11 +2543,11 @@ const y = class y {
|
|
|
2543
2543
|
return y.state.isNetworkStatus;
|
|
2544
2544
|
}
|
|
2545
2545
|
static request({ keyAction: e, request: t }) {
|
|
2546
|
-
const { url:
|
|
2547
|
-
return new Promise((
|
|
2546
|
+
const { url: r, ...n } = t;
|
|
2547
|
+
return new Promise((i, o) => {
|
|
2548
2548
|
y.getIsInit() || y.init();
|
|
2549
2549
|
const u = y.getIsNetwork(), l = {
|
|
2550
|
-
url:
|
|
2550
|
+
url: r,
|
|
2551
2551
|
keyAction: e,
|
|
2552
2552
|
isErr: !u,
|
|
2553
2553
|
msg: u ? "" : "Нет интернета",
|
|
@@ -2556,7 +2556,7 @@ const y = class y {
|
|
|
2556
2556
|
isReload: !1
|
|
2557
2557
|
};
|
|
2558
2558
|
if (y.events.publish("fetch", l), u) {
|
|
2559
|
-
apiRequest.requestInServer(
|
|
2559
|
+
apiRequest.requestInServer(r, n).then((f) => {
|
|
2560
2560
|
const m = {
|
|
2561
2561
|
isReq: !1,
|
|
2562
2562
|
isReload: !0,
|
|
@@ -2565,7 +2565,7 @@ const y = class y {
|
|
|
2565
2565
|
msg: "",
|
|
2566
2566
|
...f
|
|
2567
2567
|
};
|
|
2568
|
-
y.events.publish("fetch", m),
|
|
2568
|
+
y.events.publish("fetch", m), i(m);
|
|
2569
2569
|
}).catch((f) => {
|
|
2570
2570
|
const m = {
|
|
2571
2571
|
//TODO: Проверить. dataErr не верно возвращает
|
|
@@ -2574,11 +2574,11 @@ const y = class y {
|
|
|
2574
2574
|
keyAction: e,
|
|
2575
2575
|
...f
|
|
2576
2576
|
};
|
|
2577
|
-
y.events.publish("fetch", m),
|
|
2577
|
+
y.events.publish("fetch", m), o(m);
|
|
2578
2578
|
});
|
|
2579
2579
|
return;
|
|
2580
2580
|
}
|
|
2581
|
-
y.events.publish("fetch", l),
|
|
2581
|
+
y.events.publish("fetch", l), o(l);
|
|
2582
2582
|
});
|
|
2583
2583
|
}
|
|
2584
2584
|
};
|
|
@@ -2616,16 +2616,22 @@ c(Numbers, "getOnlyTheStringNumbers", (e) => e.split("").filter((t) => !Number.i
|
|
|
2616
2616
|
return Math.floor(Math.random() * e.getTime());
|
|
2617
2617
|
}), c(Numbers, "randomMinMax", (e, t) => Math.floor(Math.random() * (t - e + 1)) + e);
|
|
2618
2618
|
class NetworkStatusTracker {
|
|
2619
|
-
constructor(e) {
|
|
2619
|
+
constructor(e = []) {
|
|
2620
2620
|
c(this, "networkInfo");
|
|
2621
2621
|
c(this, "listUrls", []);
|
|
2622
2622
|
c(this, "state", {
|
|
2623
2623
|
isActiveEvents: !1,
|
|
2624
2624
|
isMonitoring: !1,
|
|
2625
|
-
checkIntervalId: null
|
|
2625
|
+
checkIntervalId: null,
|
|
2626
|
+
isInitialized: !1
|
|
2627
|
+
});
|
|
2628
|
+
// private getIsNetwork = (typeNetwork: string) => !["unknown", "none"].includes(typeNetwork);
|
|
2629
|
+
c(this, "getTypeNetwork", (e) => {
|
|
2630
|
+
if (e === !1)
|
|
2631
|
+
return "none";
|
|
2632
|
+
const t = this.getConnection();
|
|
2633
|
+
return t ? (t == null ? void 0 : t.effectiveType) || (t == null ? void 0 : t.type) || "unknown" : "4g";
|
|
2626
2634
|
});
|
|
2627
|
-
c(this, "getIsNetwork", (e) => !["unknown", "none"].includes(e));
|
|
2628
|
-
c(this, "getTypeNetwork", (e, t) => t || t === null ? "4g" : "none");
|
|
2629
2635
|
/*-----------------------------------------------------------------------------*/
|
|
2630
2636
|
c(this, "controllersEvents", {
|
|
2631
2637
|
online: null,
|
|
@@ -2637,11 +2643,9 @@ class NetworkStatusTracker {
|
|
|
2637
2643
|
offline: null,
|
|
2638
2644
|
change: null
|
|
2639
2645
|
});
|
|
2640
|
-
this.listUrls = e
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
isNetwork: t,
|
|
2644
|
-
typeNetwork: this.getTypeNetwork(this.getConnection(), t)
|
|
2646
|
+
this.listUrls = e, this.networkInfo = {
|
|
2647
|
+
isNetwork: !1,
|
|
2648
|
+
typeNetwork: "unknown"
|
|
2645
2649
|
};
|
|
2646
2650
|
}
|
|
2647
2651
|
setState(e) {
|
|
@@ -2652,14 +2656,14 @@ class NetworkStatusTracker {
|
|
|
2652
2656
|
}
|
|
2653
2657
|
getConnection() {
|
|
2654
2658
|
var e;
|
|
2655
|
-
return (e = window
|
|
2659
|
+
return ((e = window.navigator) == null ? void 0 : e.connection) || null;
|
|
2656
2660
|
}
|
|
2657
2661
|
updateState(e, t) {
|
|
2658
|
-
const
|
|
2662
|
+
const r = {
|
|
2659
2663
|
isNetwork: e,
|
|
2660
|
-
typeNetwork: this.getTypeNetwork(
|
|
2664
|
+
typeNetwork: this.getTypeNetwork(e)
|
|
2661
2665
|
};
|
|
2662
|
-
this.networkInfo =
|
|
2666
|
+
this.networkInfo = r, typeof t == "function" && t(r);
|
|
2663
2667
|
}
|
|
2664
2668
|
getControllersEvents() {
|
|
2665
2669
|
return this.controllersEvents;
|
|
@@ -2667,48 +2671,84 @@ class NetworkStatusTracker {
|
|
|
2667
2671
|
setControllersEvents(e) {
|
|
2668
2672
|
this.controllersEvents = { ...this.controllersEvents, ...e };
|
|
2669
2673
|
}
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2674
|
+
async initialize(e, t) {
|
|
2675
|
+
if (!this.state.isInitialized)
|
|
2676
|
+
try {
|
|
2677
|
+
const r = typeof navigator < "u" ? navigator.onLine : !1;
|
|
2678
|
+
this.listUrls.length > 0 ? await this.requestByUrls(e, t) : this.updateState(r, e), this.setState({ isInitialized: !0 });
|
|
2679
|
+
} catch (r) {
|
|
2680
|
+
console.error("NetworkStatusTracker initialization error:", r), this.updateState(!1, e), this.setState({ isInitialized: !0 });
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
async startEvents(e) {
|
|
2684
|
+
return new Promise((t, r) => {
|
|
2685
|
+
const { isActiveEvents: n } = this.getState();
|
|
2686
|
+
n && t(), this.initialize(e).then(() => {
|
|
2687
|
+
var a, u, l;
|
|
2688
|
+
this.setState({ isActiveEvents: !0 });
|
|
2689
|
+
const i = {
|
|
2690
|
+
online: new AbortController(),
|
|
2691
|
+
offline: new AbortController(),
|
|
2692
|
+
change: new AbortController()
|
|
2693
|
+
};
|
|
2694
|
+
this.setControllersEvents(i);
|
|
2695
|
+
const o = this.getConnection();
|
|
2696
|
+
o && (o != null && o.addEventListener) ? o.addEventListener(
|
|
2697
|
+
"change",
|
|
2698
|
+
(f) => {
|
|
2699
|
+
console.log("NetworkStatusTracker: connection change event");
|
|
2700
|
+
const m = navigator.onLine;
|
|
2701
|
+
this.updateState(m, e);
|
|
2702
|
+
},
|
|
2703
|
+
{ signal: (a = i.change) == null ? void 0 : a.signal }
|
|
2704
|
+
) : (window.addEventListener(
|
|
2705
|
+
"online",
|
|
2706
|
+
() => {
|
|
2707
|
+
this.updateState(!0, e);
|
|
2708
|
+
},
|
|
2709
|
+
{ signal: (u = i.online) == null ? void 0 : u.signal }
|
|
2710
|
+
), window.addEventListener(
|
|
2711
|
+
"offline",
|
|
2712
|
+
() => {
|
|
2713
|
+
this.updateState(!1, e);
|
|
2714
|
+
},
|
|
2715
|
+
{ signal: (l = i.offline) == null ? void 0 : l.signal }
|
|
2716
|
+
)), t();
|
|
2717
|
+
});
|
|
2718
|
+
});
|
|
2691
2719
|
}
|
|
2692
2720
|
stopEvents() {
|
|
2693
2721
|
const { isActiveEvents: e } = this.getState();
|
|
2694
2722
|
if (e) {
|
|
2695
2723
|
this.setState({ isActiveEvents: !1 });
|
|
2696
2724
|
const t = this.getControllersEvents();
|
|
2697
|
-
for (const
|
|
2698
|
-
|
|
2725
|
+
for (const r of Object.values(t))
|
|
2726
|
+
r == null || r.abort();
|
|
2727
|
+
this.setControllersEvents({
|
|
2728
|
+
online: null,
|
|
2729
|
+
offline: null,
|
|
2730
|
+
change: null
|
|
2731
|
+
});
|
|
2699
2732
|
}
|
|
2700
2733
|
}
|
|
2701
2734
|
/*-----------------------------------------------------------------------------*/
|
|
2702
2735
|
async requestByUrls(e, t) {
|
|
2703
|
-
|
|
2704
|
-
|
|
2736
|
+
try {
|
|
2737
|
+
const r = await this.checkConnection(t);
|
|
2738
|
+
this.updateState(r, e);
|
|
2739
|
+
} catch (r) {
|
|
2740
|
+
console.error("NetworkStatusTracker: requestByUrls error:", r), this.updateState(!1, e);
|
|
2741
|
+
}
|
|
2705
2742
|
}
|
|
2706
2743
|
async checkConnection(e = {}) {
|
|
2707
2744
|
for (const t of this.listUrls)
|
|
2708
2745
|
try {
|
|
2709
|
-
const
|
|
2710
|
-
|
|
2711
|
-
|
|
2746
|
+
const r = new AbortController(), n = setTimeout(() => r.abort(), (e == null ? void 0 : e.timeout) || 5e3), i = await window.fetch(t, {
|
|
2747
|
+
method: "HEAD",
|
|
2748
|
+
mode: "no-cors",
|
|
2749
|
+
signal: r.signal
|
|
2750
|
+
});
|
|
2751
|
+
return clearTimeout(n), !0;
|
|
2712
2752
|
} catch {
|
|
2713
2753
|
continue;
|
|
2714
2754
|
}
|
|
@@ -2721,8 +2761,8 @@ class NetworkStatusTracker {
|
|
|
2721
2761
|
this.controllersFetching = { ...this.controllersFetching, ...e };
|
|
2722
2762
|
}
|
|
2723
2763
|
startFetching(e, { interval: t = 5e3 }) {
|
|
2724
|
-
const { isMonitoring:
|
|
2725
|
-
if (
|
|
2764
|
+
const { isMonitoring: r } = this.getState();
|
|
2765
|
+
if (r)
|
|
2726
2766
|
return;
|
|
2727
2767
|
this.setState({ isMonitoring: !0 });
|
|
2728
2768
|
const n = {
|
|
@@ -2731,15 +2771,15 @@ class NetworkStatusTracker {
|
|
|
2731
2771
|
change: new AbortController()
|
|
2732
2772
|
};
|
|
2733
2773
|
this.setControllersMonitoring(n), this.requestByUrls(e, { timeout: 2e3 });
|
|
2734
|
-
const
|
|
2735
|
-
this.setState({ checkIntervalId:
|
|
2774
|
+
const i = window.setInterval(() => this.requestByUrls(e), t);
|
|
2775
|
+
this.setState({ checkIntervalId: i });
|
|
2736
2776
|
}
|
|
2737
2777
|
stopFetching() {
|
|
2738
2778
|
const { isMonitoring: e, checkIntervalId: t } = this.getState();
|
|
2739
2779
|
if (!e)
|
|
2740
2780
|
return;
|
|
2741
|
-
const
|
|
2742
|
-
for (const n of Object.values(
|
|
2781
|
+
const r = this.getControllersMonitoring();
|
|
2782
|
+
for (const n of Object.values(r))
|
|
2743
2783
|
n == null || n.abort();
|
|
2744
2784
|
t && clearInterval(t), this.setState({ isMonitoring: !1, checkIntervalId: null });
|
|
2745
2785
|
}
|
|
@@ -2756,8 +2796,118 @@ class NetworkStatusTracker {
|
|
|
2756
2796
|
getCurrentState() {
|
|
2757
2797
|
return this.networkInfo;
|
|
2758
2798
|
}
|
|
2799
|
+
destroy() {
|
|
2800
|
+
this.stopEvents(), this.stopFetching(), this.setState({
|
|
2801
|
+
isActiveEvents: !1,
|
|
2802
|
+
isMonitoring: !1,
|
|
2803
|
+
isInitialized: !1
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
class Timer {
|
|
2808
|
+
/**
|
|
2809
|
+
* @param duration - Время в миллисекундах
|
|
2810
|
+
* @param onComplete - Колбэк, вызываемый по истечении времени
|
|
2811
|
+
*/
|
|
2812
|
+
constructor(e, t) {
|
|
2813
|
+
c(this, "duration");
|
|
2814
|
+
c(this, "onComplete");
|
|
2815
|
+
c(this, "timerId", null);
|
|
2816
|
+
c(this, "startTimeCount", null);
|
|
2817
|
+
c(this, "remainingTime");
|
|
2818
|
+
c(this, "isPaused", !1);
|
|
2819
|
+
if (e < 0)
|
|
2820
|
+
throw new Error("Duration cannot be negative");
|
|
2821
|
+
this.duration = e, this.remainingTime = e, this.onComplete = t;
|
|
2822
|
+
}
|
|
2823
|
+
/**
|
|
2824
|
+
* Запускает или возобновляет таймер
|
|
2825
|
+
*/
|
|
2826
|
+
startTime() {
|
|
2827
|
+
this.timerId !== null || this.isPaused || (this.startTimeCount = Date.now(), this.timerId = setTimeout(() => {
|
|
2828
|
+
this.complete();
|
|
2829
|
+
}, this.remainingTime));
|
|
2830
|
+
}
|
|
2831
|
+
/**
|
|
2832
|
+
* Ставит таймер на паузу
|
|
2833
|
+
*/
|
|
2834
|
+
pauseTime() {
|
|
2835
|
+
if (!(this.timerId === null || this.isPaused)) {
|
|
2836
|
+
if (clearTimeout(this.timerId), this.timerId = null, this.startTimeCount !== null) {
|
|
2837
|
+
const e = Date.now() - this.startTimeCount;
|
|
2838
|
+
this.remainingTime = Math.max(0, this.remainingTime - e), this.startTimeCount = null;
|
|
2839
|
+
}
|
|
2840
|
+
this.isPaused = !0;
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Сбрасывает таймер к начальному состоянию
|
|
2845
|
+
*/
|
|
2846
|
+
resetTime() {
|
|
2847
|
+
this.timerId !== null && (clearTimeout(this.timerId), this.timerId = null), this.remainingTime = this.duration, this.startTimeCount = null, this.isPaused = !1;
|
|
2848
|
+
}
|
|
2849
|
+
/**
|
|
2850
|
+
* Завершает таймер и вызывает колбэк
|
|
2851
|
+
*/
|
|
2852
|
+
complete() {
|
|
2853
|
+
this.timerId = null, this.startTimeCount = null, this.remainingTime = this.duration, this.isPaused = !1, this.onComplete();
|
|
2854
|
+
}
|
|
2855
|
+
/**
|
|
2856
|
+
* Проверяет, запущен ли таймер
|
|
2857
|
+
*/
|
|
2858
|
+
isRunning() {
|
|
2859
|
+
return this.timerId !== null && !this.isPaused;
|
|
2860
|
+
}
|
|
2861
|
+
/**
|
|
2862
|
+
* Проверяет, находится ли таймер на паузе
|
|
2863
|
+
*/
|
|
2864
|
+
isPausedState() {
|
|
2865
|
+
return this.isPaused;
|
|
2866
|
+
}
|
|
2867
|
+
/**
|
|
2868
|
+
* Возвращает оставшееся время в миллисекундах
|
|
2869
|
+
*/
|
|
2870
|
+
getRemainingTime() {
|
|
2871
|
+
if (this.timerId !== null && this.startTimeCount !== null && !this.isPaused) {
|
|
2872
|
+
const e = Date.now() - this.startTimeCount;
|
|
2873
|
+
return Math.max(0, this.remainingTime - e);
|
|
2874
|
+
}
|
|
2875
|
+
return this.remainingTime;
|
|
2876
|
+
}
|
|
2759
2877
|
}
|
|
2878
|
+
const P = class P {
|
|
2879
|
+
static initEventsPauseResume(e) {
|
|
2880
|
+
if (P.getWebPlatform() == "iOS") {
|
|
2881
|
+
document.addEventListener("active", (r) => {
|
|
2882
|
+
console.log("Событие: active :", r), e("on");
|
|
2883
|
+
}), document.addEventListener("resign", (r) => {
|
|
2884
|
+
console.log("Событие: resign: ", r), e("off");
|
|
2885
|
+
});
|
|
2886
|
+
return;
|
|
2887
|
+
}
|
|
2888
|
+
document.addEventListener("resume", (r) => {
|
|
2889
|
+
console.log("Событие: resume: ", r), e("on");
|
|
2890
|
+
}), document.addEventListener("pause", (r) => {
|
|
2891
|
+
console.log("Событие: pause :", r), e("off");
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2894
|
+
};
|
|
2895
|
+
c(P, "getWebPlatform", () => {
|
|
2896
|
+
const e = navigator.userAgent, t = navigator == null ? void 0 : navigator.platform;
|
|
2897
|
+
if (t) {
|
|
2898
|
+
const r = t.toLowerCase();
|
|
2899
|
+
if (r.includes("mac"))
|
|
2900
|
+
return "iOS/Mac";
|
|
2901
|
+
if (r.includes("win"))
|
|
2902
|
+
return "Windows";
|
|
2903
|
+
if (r.includes("linux"))
|
|
2904
|
+
return "Linux";
|
|
2905
|
+
}
|
|
2906
|
+
return /iPhone|iPad|iPod/.test(e) ? "iOS" : /Android/.test(e) ? "Android" : /Windows/.test(e) ? "Windows" : /Mac/.test(e) ? "Mac" : /Linux/.test(e) ? "Linux" : "unknown";
|
|
2907
|
+
});
|
|
2908
|
+
let BrowserUtils = P;
|
|
2760
2909
|
export {
|
|
2910
|
+
BrowserUtils,
|
|
2761
2911
|
Color,
|
|
2762
2912
|
DateProcessing,
|
|
2763
2913
|
DelaysPromise,
|
|
@@ -2765,10 +2915,10 @@ export {
|
|
|
2765
2915
|
File,
|
|
2766
2916
|
HTTPSApi,
|
|
2767
2917
|
NetworkInformation,
|
|
2768
|
-
NetworkInformationAbstract,
|
|
2769
2918
|
NetworkInformationCordova,
|
|
2770
2919
|
NetworkInformationPC,
|
|
2771
2920
|
NetworkStatusTracker,
|
|
2772
2921
|
Numbers,
|
|
2922
|
+
Timer,
|
|
2773
2923
|
Utils
|
|
2774
2924
|
};
|