@dxtmisha/functional-basic 0.12.0 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/library.d.ts +908 -170
- package/dist/library.js +973 -551
- package/package.json +3 -2
package/dist/library.js
CHANGED
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
import { geo as e } from "@dxtmisha/media";
|
|
2
|
-
//#region src/functions/
|
|
3
|
-
function t(e
|
|
4
|
-
return
|
|
2
|
+
//#region src/functions/isObject.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
return !!(e && typeof e == "object");
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
-
//#region src/functions/
|
|
7
|
+
//#region src/functions/isObjectNotArray.ts
|
|
8
8
|
function n(e) {
|
|
9
|
-
return
|
|
9
|
+
return t(e) && !Array.isArray(e);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/functions/copyObjectLite.ts
|
|
13
|
+
function r(e, t) {
|
|
14
|
+
return t ? Object.assign({}, e, t) : Object.assign({}, e);
|
|
10
15
|
}
|
|
11
16
|
//#endregion
|
|
12
17
|
//#region src/functions/forEach.ts
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
15
|
-
let
|
|
16
|
-
return e instanceof Map || Array.isArray(e) ? e.forEach((r, i) =>
|
|
18
|
+
function i(e, n, r) {
|
|
19
|
+
if (t(e)) {
|
|
20
|
+
let t = [];
|
|
21
|
+
return e instanceof Map || Array.isArray(e) ? e.forEach((r, i) => t.push(n(r, i, e))) : Object.entries(e).forEach(([r, i]) => t.push(n(i, r, e))), r ? t : t.filter((e) => e !== void 0);
|
|
17
22
|
}
|
|
18
23
|
return [];
|
|
19
24
|
}
|
|
20
25
|
//#endregion
|
|
21
26
|
//#region src/functions/getRequestString.ts
|
|
22
|
-
function
|
|
23
|
-
return
|
|
27
|
+
function a(e, t = "=", n = "&") {
|
|
28
|
+
return i(e, (e, n) => `${n}${t}${encodeURIComponent(String(e).trim())}`).sort().join(n);
|
|
24
29
|
}
|
|
25
30
|
//#endregion
|
|
26
31
|
//#region src/functions/isArray.ts
|
|
27
|
-
function
|
|
32
|
+
function o(e) {
|
|
28
33
|
return Array.isArray(e);
|
|
29
34
|
}
|
|
30
35
|
//#endregion
|
|
31
36
|
//#region src/functions/isNull.ts
|
|
32
|
-
function
|
|
37
|
+
function s(e) {
|
|
33
38
|
return e == null;
|
|
34
39
|
}
|
|
35
40
|
//#endregion
|
|
36
41
|
//#region src/functions/isFilled.ts
|
|
37
|
-
function
|
|
42
|
+
function c(e, t) {
|
|
38
43
|
if (e) {
|
|
39
44
|
if (t && e === "0") return !0;
|
|
40
45
|
switch (typeof e) {
|
|
@@ -43,7 +48,7 @@ function s(e, t) {
|
|
|
43
48
|
case "boolean": return e;
|
|
44
49
|
case "function":
|
|
45
50
|
case "symbol": return !0;
|
|
46
|
-
case "object": return Array.isArray(e) ? e.length > 0 : Object.values(e).some((e) => !
|
|
51
|
+
case "object": return Array.isArray(e) ? e.length > 0 : Object.values(e).some((e) => !s(e));
|
|
47
52
|
case "string": return ![
|
|
48
53
|
"",
|
|
49
54
|
"undefined",
|
|
@@ -59,28 +64,28 @@ function s(e, t) {
|
|
|
59
64
|
return !1;
|
|
60
65
|
}
|
|
61
66
|
//#endregion
|
|
62
|
-
//#region src/functions/
|
|
63
|
-
function
|
|
64
|
-
return
|
|
67
|
+
//#region src/functions/isOnLine.ts
|
|
68
|
+
function l() {
|
|
69
|
+
return typeof navigator > "u" || navigator.onLine;
|
|
65
70
|
}
|
|
66
71
|
//#endregion
|
|
67
72
|
//#region src/functions/isString.ts
|
|
68
|
-
function
|
|
73
|
+
function u(e) {
|
|
69
74
|
return typeof e == "string";
|
|
70
75
|
}
|
|
71
76
|
//#endregion
|
|
72
77
|
//#region src/functions/copyObject.ts
|
|
73
|
-
function
|
|
78
|
+
function d(e) {
|
|
74
79
|
return JSON.parse(JSON.stringify(e));
|
|
75
80
|
}
|
|
76
81
|
//#endregion
|
|
77
82
|
//#region src/functions/isDomRuntime.ts
|
|
78
|
-
function
|
|
83
|
+
function f() {
|
|
79
84
|
return typeof window < "u" && !!window.document;
|
|
80
85
|
}
|
|
81
86
|
//#endregion
|
|
82
87
|
//#region src/functions/isNumber.ts
|
|
83
|
-
function
|
|
88
|
+
function p(e) {
|
|
84
89
|
switch (typeof e) {
|
|
85
90
|
case "number": return !0;
|
|
86
91
|
case "string": return !!e.match(/^-?[0-9]+(\.[0-9]+)?$/);
|
|
@@ -89,7 +94,7 @@ function f(e) {
|
|
|
89
94
|
}
|
|
90
95
|
//#endregion
|
|
91
96
|
//#region src/functions/toNumber.ts
|
|
92
|
-
function
|
|
97
|
+
function m(e) {
|
|
93
98
|
if (typeof e == "number") return e;
|
|
94
99
|
if (!e) return 0;
|
|
95
100
|
let t = e.replace(/[^\d., ]+/gi, "");
|
|
@@ -97,42 +102,42 @@ function p(e) {
|
|
|
97
102
|
}
|
|
98
103
|
//#endregion
|
|
99
104
|
//#region src/functions/isSelected.ts
|
|
100
|
-
function
|
|
101
|
-
return
|
|
105
|
+
function h(e, t) {
|
|
106
|
+
return s(e) ? !1 : Array.isArray(t) ? t.includes(e) : p(e) && p(t) ? m(e) === m(t) : e === t;
|
|
102
107
|
}
|
|
103
108
|
//#endregion
|
|
104
109
|
//#region src/functions/isFunction.ts
|
|
105
|
-
function
|
|
110
|
+
function g(e) {
|
|
106
111
|
return e instanceof Function || typeof e == "function";
|
|
107
112
|
}
|
|
108
113
|
//#endregion
|
|
109
114
|
//#region src/functions/executeFunction.ts
|
|
110
|
-
function
|
|
111
|
-
return
|
|
115
|
+
function _(e) {
|
|
116
|
+
return g(e) ? e() : e;
|
|
112
117
|
}
|
|
113
118
|
//#endregion
|
|
114
119
|
//#region src/functions/isDomData.ts
|
|
115
|
-
function
|
|
120
|
+
function v() {
|
|
116
121
|
return location.href.startsWith("data:");
|
|
117
122
|
}
|
|
118
123
|
//#endregion
|
|
119
124
|
//#region \0@oxc-project+runtime@0.120.0/helpers/typeof.js
|
|
120
|
-
function
|
|
125
|
+
function y(e) {
|
|
121
126
|
"@babel/helpers - typeof";
|
|
122
|
-
return
|
|
127
|
+
return y = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
123
128
|
return typeof e;
|
|
124
129
|
} : function(e) {
|
|
125
130
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
126
|
-
},
|
|
131
|
+
}, y(e);
|
|
127
132
|
}
|
|
128
133
|
//#endregion
|
|
129
134
|
//#region \0@oxc-project+runtime@0.120.0/helpers/toPrimitive.js
|
|
130
135
|
function ee(e, t) {
|
|
131
|
-
if (
|
|
136
|
+
if (y(e) != "object" || !e) return e;
|
|
132
137
|
var n = e[Symbol.toPrimitive];
|
|
133
138
|
if (n !== void 0) {
|
|
134
139
|
var r = n.call(e, t || "default");
|
|
135
|
-
if (
|
|
140
|
+
if (y(r) != "object") return r;
|
|
136
141
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
137
142
|
}
|
|
138
143
|
return (t === "string" ? String : Number)(e);
|
|
@@ -141,11 +146,11 @@ function ee(e, t) {
|
|
|
141
146
|
//#region \0@oxc-project+runtime@0.120.0/helpers/toPropertyKey.js
|
|
142
147
|
function te(e) {
|
|
143
148
|
var t = ee(e, "string");
|
|
144
|
-
return
|
|
149
|
+
return y(t) == "symbol" ? t : t + "";
|
|
145
150
|
}
|
|
146
151
|
//#endregion
|
|
147
152
|
//#region \0@oxc-project+runtime@0.120.0/helpers/defineProperty.js
|
|
148
|
-
function
|
|
153
|
+
function b(e, t, n) {
|
|
149
154
|
return (t = te(t)) in e ? Object.defineProperty(e, t, {
|
|
150
155
|
value: n,
|
|
151
156
|
enumerable: !0,
|
|
@@ -154,23 +159,188 @@ function y(e, t, n) {
|
|
|
154
159
|
}) : e[t] = n, e;
|
|
155
160
|
}
|
|
156
161
|
//#endregion
|
|
162
|
+
//#region src/classes/ErrorCenterHandler.ts
|
|
163
|
+
var ne = class {
|
|
164
|
+
constructor(e) {
|
|
165
|
+
b(this, "handlers", []), e && this.addList(e);
|
|
166
|
+
}
|
|
167
|
+
has(e) {
|
|
168
|
+
return !!this.get(e);
|
|
169
|
+
}
|
|
170
|
+
get(e) {
|
|
171
|
+
return this.handlers.find((t) => t.group === e);
|
|
172
|
+
}
|
|
173
|
+
add(e, t) {
|
|
174
|
+
let n = this.get(e);
|
|
175
|
+
return n ? n.handlers.push(t) : this.handlers.push({
|
|
176
|
+
group: e,
|
|
177
|
+
handlers: [t]
|
|
178
|
+
}), this;
|
|
179
|
+
}
|
|
180
|
+
addList(e) {
|
|
181
|
+
return e.forEach((e) => e.handlers.forEach((t) => this.add(e.group, t))), this;
|
|
182
|
+
}
|
|
183
|
+
on(e) {
|
|
184
|
+
if (f()) {
|
|
185
|
+
var t;
|
|
186
|
+
let n = (t = this.get(e.group)) == null ? this.get(void 0) : t;
|
|
187
|
+
n && n.handlers.forEach((t) => t(e)), this.toConsole(e);
|
|
188
|
+
}
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
toConsole(e) {
|
|
192
|
+
return console.error(`Error Center: ${e.code}`), console.error(e.message), this;
|
|
193
|
+
}
|
|
194
|
+
}, re = class {
|
|
195
|
+
constructor(e, t = new ne()) {
|
|
196
|
+
b(this, "causes", []), this.handler = t, e && this.addList(e);
|
|
197
|
+
}
|
|
198
|
+
has(e, t) {
|
|
199
|
+
return !!this.get(e, t);
|
|
200
|
+
}
|
|
201
|
+
get(e, t) {
|
|
202
|
+
return this.causes.find((n) => n.group === t && n.code === e);
|
|
203
|
+
}
|
|
204
|
+
add(e) {
|
|
205
|
+
return this.causes.push(e), this;
|
|
206
|
+
}
|
|
207
|
+
addList(e) {
|
|
208
|
+
return this.causes.push(...e), this;
|
|
209
|
+
}
|
|
210
|
+
addHandler(e, t) {
|
|
211
|
+
return this.handler.add(e, t), this;
|
|
212
|
+
}
|
|
213
|
+
addHandlerList(e) {
|
|
214
|
+
return this.handler.addList(e), this;
|
|
215
|
+
}
|
|
216
|
+
on(e) {
|
|
217
|
+
return this.handler.on(this.assign(e)), this;
|
|
218
|
+
}
|
|
219
|
+
assign(e) {
|
|
220
|
+
let t = this.get(e.code, e.group);
|
|
221
|
+
return t ? {
|
|
222
|
+
...t,
|
|
223
|
+
...e
|
|
224
|
+
} : e;
|
|
225
|
+
}
|
|
226
|
+
}, ie = [
|
|
227
|
+
{
|
|
228
|
+
group: "api",
|
|
229
|
+
code: "unknown",
|
|
230
|
+
label: "Unknown Error",
|
|
231
|
+
message: "An unexpected error occurred. Please try again later."
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
group: "api",
|
|
235
|
+
code: "timeout",
|
|
236
|
+
label: "Request Timeout",
|
|
237
|
+
message: "The request took too long to complete. Please check your connection."
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
group: "api",
|
|
241
|
+
code: "offline",
|
|
242
|
+
label: "No Internet Connection",
|
|
243
|
+
message: "Your device is currently offline. Please check your network settings."
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
group: "api",
|
|
247
|
+
code: "notFound",
|
|
248
|
+
label: "Resource Not Found",
|
|
249
|
+
message: "The requested resource could not be found on the server."
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
group: "api",
|
|
253
|
+
code: "server",
|
|
254
|
+
label: "Internal Server Error",
|
|
255
|
+
message: "Something went wrong on our end. We are working to fix it."
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
group: "broadcast",
|
|
259
|
+
code: "error",
|
|
260
|
+
label: "Broadcast Error",
|
|
261
|
+
message: "An unexpected error occurred. Please try again later."
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
group: "storage",
|
|
265
|
+
code: "error",
|
|
266
|
+
label: "Storage Error",
|
|
267
|
+
message: "An unexpected error occurred. Please try again later."
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
group: "intl",
|
|
271
|
+
code: "display",
|
|
272
|
+
label: "Intl Display Error",
|
|
273
|
+
message: "An unexpected error occurred. Please try again later."
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
group: "intl",
|
|
277
|
+
code: "plural",
|
|
278
|
+
label: "Intl Plural Error",
|
|
279
|
+
message: "An unexpected error occurred. Please try again later."
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
group: "intl",
|
|
283
|
+
code: "relative",
|
|
284
|
+
label: "Intl Relative Error",
|
|
285
|
+
message: "An unexpected error occurred. Please try again later."
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
group: "intl",
|
|
289
|
+
code: "datetime",
|
|
290
|
+
label: "Intl Datetime Error",
|
|
291
|
+
message: "An unexpected error occurred. Please try again later."
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
group: "intl",
|
|
295
|
+
code: "number",
|
|
296
|
+
label: "Intl Number Error",
|
|
297
|
+
message: "An unexpected error occurred. Please try again later."
|
|
298
|
+
}
|
|
299
|
+
], x = class {
|
|
300
|
+
static has(e, t) {
|
|
301
|
+
return this.item.has(e, t);
|
|
302
|
+
}
|
|
303
|
+
static get(e, t) {
|
|
304
|
+
return this.item.get(e, t);
|
|
305
|
+
}
|
|
306
|
+
static getItem() {
|
|
307
|
+
return this.item;
|
|
308
|
+
}
|
|
309
|
+
static add(e) {
|
|
310
|
+
return this.item.add(e), this;
|
|
311
|
+
}
|
|
312
|
+
static addList(e) {
|
|
313
|
+
return this.item.addList(e), this;
|
|
314
|
+
}
|
|
315
|
+
static addHandler(e, t) {
|
|
316
|
+
return this.item.addHandler(e, t), this;
|
|
317
|
+
}
|
|
318
|
+
static addHandlerList(e) {
|
|
319
|
+
return this.item.addHandlerList(e), this;
|
|
320
|
+
}
|
|
321
|
+
static on(e) {
|
|
322
|
+
return this.item.on(e), this;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
b(x, "item", new re(ie));
|
|
326
|
+
//#endregion
|
|
157
327
|
//#region src/classes/DataStorage.ts
|
|
158
|
-
var
|
|
328
|
+
var ae = {}, oe = "ui-storage", S = class {
|
|
159
329
|
static setPrefix(e) {
|
|
160
|
-
|
|
330
|
+
oe = e;
|
|
161
331
|
}
|
|
162
|
-
constructor(e, t = !1) {
|
|
163
|
-
|
|
164
|
-
let
|
|
165
|
-
if (
|
|
166
|
-
this.make(),
|
|
332
|
+
constructor(e, t = !1, n = x.getItem()) {
|
|
333
|
+
b(this, "value", void 0), b(this, "age", void 0), this.name = e, this.isSession = t, this.errorCenter = n;
|
|
334
|
+
let r = `${t ? "session" : "storage"}#${e}`;
|
|
335
|
+
if (r in ae) return ae[r];
|
|
336
|
+
this.make(), ae[r] = this;
|
|
167
337
|
}
|
|
168
338
|
get(e, t) {
|
|
169
339
|
if (this.value !== null && this.value !== void 0 && this.isCache(t)) return this.value;
|
|
170
340
|
if (e !== void 0) return this.set(e);
|
|
171
341
|
}
|
|
172
342
|
set(e) {
|
|
173
|
-
if (this.value =
|
|
343
|
+
if (this.value = _(e), this.age = (/* @__PURE__ */ new Date()).getTime(), this.value === void 0) this.remove();
|
|
174
344
|
else {
|
|
175
345
|
var t;
|
|
176
346
|
(t = this.getMethod()) == null || t.setItem(this.getIndex(), JSON.stringify({
|
|
@@ -188,17 +358,17 @@ var b = {}, ne = "ui-storage", x = class {
|
|
|
188
358
|
return this.make(), this;
|
|
189
359
|
}
|
|
190
360
|
isCache(e) {
|
|
191
|
-
return
|
|
361
|
+
return s(e) || this.age && this.age + e * 1e3 >= (/* @__PURE__ */ new Date()).getTime();
|
|
192
362
|
}
|
|
193
363
|
getMethod() {
|
|
194
|
-
if (
|
|
364
|
+
if (f() && !v()) {
|
|
195
365
|
var e, t;
|
|
196
366
|
let n = this.isSession ? (e = window) == null ? void 0 : e.sessionStorage : (t = window) == null ? void 0 : t.localStorage;
|
|
197
367
|
if (n) return n;
|
|
198
368
|
}
|
|
199
369
|
}
|
|
200
370
|
getIndex() {
|
|
201
|
-
return `${
|
|
371
|
+
return `${oe}__${this.name}`;
|
|
202
372
|
}
|
|
203
373
|
getValue() {
|
|
204
374
|
var e;
|
|
@@ -206,14 +376,18 @@ var b = {}, ne = "ui-storage", x = class {
|
|
|
206
376
|
if (t) try {
|
|
207
377
|
return JSON.parse(t);
|
|
208
378
|
} catch (e) {
|
|
209
|
-
|
|
379
|
+
this.errorCenter.on({
|
|
380
|
+
group: "storage",
|
|
381
|
+
code: "error",
|
|
382
|
+
details: e
|
|
383
|
+
});
|
|
210
384
|
}
|
|
211
385
|
}
|
|
212
386
|
make() {
|
|
213
387
|
let e = this.getValue();
|
|
214
388
|
return e ? (this.value = e.value, this.age = e.age) : (this.value = void 0, this.age = void 0), this;
|
|
215
389
|
}
|
|
216
|
-
},
|
|
390
|
+
}, C, se = "geo-code", w = class {
|
|
217
391
|
static get() {
|
|
218
392
|
return this.item;
|
|
219
393
|
}
|
|
@@ -233,7 +407,7 @@ var b = {}, ne = "ui-storage", x = class {
|
|
|
233
407
|
return this.location;
|
|
234
408
|
}
|
|
235
409
|
static getItem() {
|
|
236
|
-
return
|
|
410
|
+
return r(this.item, { language: this.language });
|
|
237
411
|
}
|
|
238
412
|
static getList() {
|
|
239
413
|
return e;
|
|
@@ -241,10 +415,10 @@ var b = {}, ne = "ui-storage", x = class {
|
|
|
241
415
|
static getByCode(e) {
|
|
242
416
|
var t;
|
|
243
417
|
let n;
|
|
244
|
-
return e && (e.match(/([A-Z]{2}-[a-z]{2})|([a-z]{2}-[A-Z]{2})/) && (n = this.getByCodeFull(e)), !n && e.match(/[A-Z]{2}/) && (n = this.getByCountry(this.toCountry(e))), !n && e.match(/[a-z]{2}/) && (n = this.getByLanguage(this.toLanguage(e)))), this.toFull(
|
|
418
|
+
return e && (e.match(/([A-Z]{2}-[a-z]{2})|([a-z]{2}-[A-Z]{2})/) && (n = this.getByCodeFull(e)), !n && e.match(/[A-Z]{2}/) && (n = this.getByCountry(this.toCountry(e))), !n && e.match(/[a-z]{2}/) && (n = this.getByLanguage(this.toLanguage(e)))), this.toFull(d((t = n) == null ? this.getList()[0] : t));
|
|
245
419
|
}
|
|
246
420
|
static getByCodeFull(e) {
|
|
247
|
-
return this.getList().find((t) =>
|
|
421
|
+
return this.getList().find((t) => h(e, [`${t.language}-${t.country}`, `${t.country}-${t.language}`]));
|
|
248
422
|
}
|
|
249
423
|
static getByCountry(e) {
|
|
250
424
|
return this.getList().find((t) => {
|
|
@@ -279,7 +453,7 @@ var b = {}, ne = "ui-storage", x = class {
|
|
|
279
453
|
}
|
|
280
454
|
static findLocation() {
|
|
281
455
|
var e;
|
|
282
|
-
return
|
|
456
|
+
return f() && (this.storage.get() || ((e = document.querySelector("html")) == null ? void 0 : e.lang) || navigator.language || navigator.languages[0] || "en-GB") || "en-GB";
|
|
283
457
|
}
|
|
284
458
|
static findLanguage(e) {
|
|
285
459
|
return e && e.match(/[a-z]{2}/) ? this.toLanguage(e) : this.item.language;
|
|
@@ -291,24 +465,24 @@ var b = {}, ne = "ui-storage", x = class {
|
|
|
291
465
|
return e.replace(/[^a-z]+/g, "");
|
|
292
466
|
}
|
|
293
467
|
static toFull(e) {
|
|
294
|
-
return
|
|
468
|
+
return r(e, {
|
|
295
469
|
standard: this.toStandard(e),
|
|
296
470
|
firstDay: (e == null ? void 0 : e.firstDay) || "Mo"
|
|
297
471
|
});
|
|
298
472
|
}
|
|
299
473
|
};
|
|
300
|
-
|
|
474
|
+
C = w, b(w, "storage", new S(se)), b(w, "location", void 0), b(w, "item", void 0), b(w, "language", void 0), b(w, "timezone", (/* @__PURE__ */ new Date()).getTimezoneOffset()), C.location = C.findLocation(), C.language = C.findLanguage(C.location), C.item = C.getByCode(C.location);
|
|
301
475
|
//#endregion
|
|
302
476
|
//#region src/functions/isWindow.ts
|
|
303
|
-
function
|
|
304
|
-
return
|
|
477
|
+
function ce(e) {
|
|
478
|
+
return f() && e === window;
|
|
305
479
|
}
|
|
306
480
|
//#endregion
|
|
307
481
|
//#region src/functions/getElement.ts
|
|
308
|
-
function
|
|
309
|
-
if (
|
|
310
|
-
if (
|
|
311
|
-
if (
|
|
482
|
+
function T(e) {
|
|
483
|
+
if (f()) {
|
|
484
|
+
if (ce(e)) return document.body;
|
|
485
|
+
if (u(e)) {
|
|
312
486
|
var t;
|
|
313
487
|
return (t = document.querySelector(e)) == null ? void 0 : t;
|
|
314
488
|
}
|
|
@@ -317,14 +491,14 @@ function w(e) {
|
|
|
317
491
|
}
|
|
318
492
|
//#endregion
|
|
319
493
|
//#region src/functions/getElementOrWindow.ts
|
|
320
|
-
function
|
|
321
|
-
return
|
|
494
|
+
function le(e) {
|
|
495
|
+
return ce(e) ? e : T(e);
|
|
322
496
|
}
|
|
323
497
|
//#endregion
|
|
324
498
|
//#region src/functions/isInDom.ts
|
|
325
|
-
function
|
|
499
|
+
function ue(e) {
|
|
326
500
|
var t;
|
|
327
|
-
return !!((t =
|
|
501
|
+
return !!((t = T(e)) != null && t.closest("html"));
|
|
328
502
|
}
|
|
329
503
|
//#endregion
|
|
330
504
|
//#region src/functions/toArray.ts
|
|
@@ -333,14 +507,14 @@ function E(e) {
|
|
|
333
507
|
}
|
|
334
508
|
//#endregion
|
|
335
509
|
//#region src/classes/EventItem.ts
|
|
336
|
-
var
|
|
337
|
-
constructor(e,
|
|
338
|
-
|
|
339
|
-
if (
|
|
340
|
-
var
|
|
341
|
-
(
|
|
510
|
+
var de = class {
|
|
511
|
+
constructor(e, n = ["click"], r, i, a) {
|
|
512
|
+
b(this, "element", void 0), b(this, "elementControl", void 0), b(this, "elementControlEdit", void 0), b(this, "type", void 0), b(this, "listenerRecent", (e) => {
|
|
513
|
+
if (ue(this.elementControl)) {
|
|
514
|
+
var n, r;
|
|
515
|
+
(n = this.listener) == null || n.call(this.element, e, this.detail), t(this.options) && (r = this.options) != null && r.once && this.stop();
|
|
342
516
|
} else this.stop();
|
|
343
|
-
}),
|
|
517
|
+
}), b(this, "activity", !1), b(this, "activityItems", []), this.listener = r, this.options = i, this.detail = a, this.element = le(e), this.elementControl = T(e), this.type = E(n);
|
|
344
518
|
}
|
|
345
519
|
isActive() {
|
|
346
520
|
return this.activity;
|
|
@@ -349,11 +523,11 @@ var oe = class {
|
|
|
349
523
|
return this.element;
|
|
350
524
|
}
|
|
351
525
|
setElement(e) {
|
|
352
|
-
let t =
|
|
353
|
-
return this.elementControlEdit || (this.elementControl =
|
|
526
|
+
let t = le(e);
|
|
527
|
+
return this.elementControlEdit || (this.elementControl = T(e)), this.element = t, this.reset(), this;
|
|
354
528
|
}
|
|
355
529
|
setElementControl(e) {
|
|
356
|
-
return this.elementControl =
|
|
530
|
+
return this.elementControl = T(e), this.elementControlEdit = !s(this.elementControl), this.elementControlEdit || (this.elementControl = T(this.element)), this;
|
|
357
531
|
}
|
|
358
532
|
setType(e) {
|
|
359
533
|
return this.type = E(e), this.reset(), this;
|
|
@@ -425,22 +599,25 @@ var oe = class {
|
|
|
425
599
|
}
|
|
426
600
|
return !1;
|
|
427
601
|
}
|
|
428
|
-
},
|
|
429
|
-
|
|
602
|
+
}, fe = "ui-loading", pe = class {
|
|
603
|
+
constructor(e = fe) {
|
|
604
|
+
b(this, "value", 0), b(this, "event", void 0), b(this, "registrationList", []), this.eventName = e, f() && (this.event = new de(window, this.eventName));
|
|
605
|
+
}
|
|
606
|
+
is() {
|
|
430
607
|
return this.value > 0;
|
|
431
608
|
}
|
|
432
|
-
|
|
609
|
+
get() {
|
|
433
610
|
return this.value;
|
|
434
611
|
}
|
|
435
|
-
|
|
612
|
+
show() {
|
|
436
613
|
this.value++, this.dispatch();
|
|
437
614
|
}
|
|
438
|
-
|
|
615
|
+
hide() {
|
|
439
616
|
this.is() && (this.value--, this.dispatch());
|
|
440
617
|
}
|
|
441
|
-
|
|
442
|
-
if (
|
|
443
|
-
let n = new
|
|
618
|
+
registrationEvent(e, t) {
|
|
619
|
+
if (f()) {
|
|
620
|
+
let n = new de(window, this.eventName, e).setElementControl(t).start();
|
|
444
621
|
this.registrationList.push({
|
|
445
622
|
item: n,
|
|
446
623
|
listener: e,
|
|
@@ -448,35 +625,57 @@ var oe = class {
|
|
|
448
625
|
});
|
|
449
626
|
}
|
|
450
627
|
}
|
|
451
|
-
|
|
628
|
+
unregistrationEvent(e, t) {
|
|
452
629
|
this.registrationList = this.registrationList.filter((n) => n.listener === e && n.element === t ? (n.item.stop(), !1) : !0);
|
|
453
630
|
}
|
|
454
|
-
|
|
631
|
+
dispatch() {
|
|
455
632
|
var e;
|
|
456
633
|
(e = this.event) == null || e.dispatch({ loading: this.is() });
|
|
457
634
|
}
|
|
635
|
+
}, D = class {
|
|
636
|
+
static is() {
|
|
637
|
+
return this.item.is();
|
|
638
|
+
}
|
|
639
|
+
static get() {
|
|
640
|
+
return this.item.get();
|
|
641
|
+
}
|
|
642
|
+
static getItem() {
|
|
643
|
+
return this.item;
|
|
644
|
+
}
|
|
645
|
+
static show() {
|
|
646
|
+
this.item.show();
|
|
647
|
+
}
|
|
648
|
+
static hide() {
|
|
649
|
+
this.item.hide();
|
|
650
|
+
}
|
|
651
|
+
static registrationEvent(e, t) {
|
|
652
|
+
this.item.registrationEvent(e, t);
|
|
653
|
+
}
|
|
654
|
+
static unregistrationEvent(e, t) {
|
|
655
|
+
this.item.unregistrationEvent(e, t);
|
|
656
|
+
}
|
|
458
657
|
};
|
|
459
|
-
|
|
658
|
+
b(D, "item", new pe());
|
|
460
659
|
//#endregion
|
|
461
660
|
//#region src/classes/ApiHeaders.ts
|
|
462
|
-
var
|
|
661
|
+
var me = class {
|
|
463
662
|
constructor() {
|
|
464
|
-
|
|
663
|
+
b(this, "headers", {});
|
|
465
664
|
}
|
|
466
|
-
get(e,
|
|
665
|
+
get(e, t = "application/json;charset=UTF-8") {
|
|
467
666
|
if (e !== null) {
|
|
468
|
-
let
|
|
469
|
-
return
|
|
667
|
+
let n = r(this.headers, e);
|
|
668
|
+
return c(t) && (n["Content-Type"] = t), n;
|
|
470
669
|
}
|
|
471
670
|
}
|
|
472
671
|
set(e) {
|
|
473
|
-
return
|
|
672
|
+
return n(e) && (this.headers = e), this;
|
|
474
673
|
}
|
|
475
674
|
}, O = /* @__PURE__ */ function(e) {
|
|
476
675
|
return e.get = "GET", e.post = "POST", e.put = "PUT", e.delete = "DELETE", e;
|
|
477
|
-
}({}),
|
|
676
|
+
}({}), he = class {
|
|
478
677
|
constructor() {
|
|
479
|
-
|
|
678
|
+
b(this, "value", void 0);
|
|
480
679
|
}
|
|
481
680
|
is() {
|
|
482
681
|
return !!this.value;
|
|
@@ -485,10 +684,10 @@ var le = class {
|
|
|
485
684
|
return this.value;
|
|
486
685
|
}
|
|
487
686
|
request(e) {
|
|
488
|
-
let
|
|
489
|
-
if (
|
|
490
|
-
if (e instanceof FormData) this.addByFormData(e,
|
|
491
|
-
else if (
|
|
687
|
+
let t = this.get();
|
|
688
|
+
if (t) {
|
|
689
|
+
if (e instanceof FormData) this.addByFormData(e, t);
|
|
690
|
+
else if (n(e)) return r(t, e);
|
|
492
691
|
}
|
|
493
692
|
return e;
|
|
494
693
|
}
|
|
@@ -498,9 +697,9 @@ var le = class {
|
|
|
498
697
|
addByFormData(e, t) {
|
|
499
698
|
for (let n in t) e.has(n) || e.set(n, t[n]);
|
|
500
699
|
}
|
|
501
|
-
},
|
|
700
|
+
}, ge = class {
|
|
502
701
|
constructor() {
|
|
503
|
-
|
|
702
|
+
b(this, "value", void 0);
|
|
504
703
|
}
|
|
505
704
|
get() {
|
|
506
705
|
return this.value;
|
|
@@ -542,7 +741,7 @@ var le = class {
|
|
|
542
741
|
return this.set({ error: e }), this;
|
|
543
742
|
}
|
|
544
743
|
setLastResponse(e) {
|
|
545
|
-
return e &&
|
|
744
|
+
return e && n(e) && ("message" in e && this.setLastMessage(String(e.message)), "status" in e && this.setLastStatus(String(e.status))), this.set({ lastResponse: e }), this;
|
|
546
745
|
}
|
|
547
746
|
setLastStatus(e) {
|
|
548
747
|
return this.set({ lastStatus: e }), this;
|
|
@@ -556,20 +755,20 @@ var le = class {
|
|
|
556
755
|
};
|
|
557
756
|
//#endregion
|
|
558
757
|
//#region src/functions/executePromise.ts
|
|
559
|
-
async function
|
|
560
|
-
let t =
|
|
758
|
+
async function _e(e) {
|
|
759
|
+
let t = _(e);
|
|
561
760
|
return t instanceof Promise ? await t : t;
|
|
562
761
|
}
|
|
563
762
|
//#endregion
|
|
564
763
|
//#region src/functions/random.ts
|
|
565
|
-
function
|
|
764
|
+
function k(e, t) {
|
|
566
765
|
return Math.floor(Math.random() * (t - e + 1) + e);
|
|
567
766
|
}
|
|
568
767
|
//#endregion
|
|
569
768
|
//#region src/classes/ApiResponse.ts
|
|
570
|
-
var
|
|
769
|
+
var ve = "d-response-loading", ye = class {
|
|
571
770
|
constructor(e) {
|
|
572
|
-
|
|
771
|
+
b(this, "first", []), b(this, "response", []), b(this, "loading", void 0), b(this, "devMode", !1), this.requestDefault = e;
|
|
573
772
|
}
|
|
574
773
|
get(e = "", t, n, r) {
|
|
575
774
|
return this.response.find((i) => !this.isDisable(i) && this.isPath(i, e) && t === i.method && this.isFirst(i, r) && this.isResponse(i, n) ? (this.isDevMode(r) && console.warn(`Response type: ${i.path}`), this.first.push(i), !0) : !1);
|
|
@@ -594,7 +793,7 @@ var fe = "d-response-loading", pe = class {
|
|
|
594
793
|
}
|
|
595
794
|
}
|
|
596
795
|
isDisable(e) {
|
|
597
|
-
return !!
|
|
796
|
+
return !!_(e == null ? void 0 : e.disable);
|
|
598
797
|
}
|
|
599
798
|
isPath(e, t) {
|
|
600
799
|
return t === e.path || !!(e.path instanceof RegExp && t.match(e.path));
|
|
@@ -606,29 +805,29 @@ var fe = "d-response-loading", pe = class {
|
|
|
606
805
|
return this.first.indexOf(e) === -1 || this.isDevMode(t);
|
|
607
806
|
}
|
|
608
807
|
isResponse(e, t) {
|
|
609
|
-
let
|
|
610
|
-
return t ===
|
|
808
|
+
let r = this.requestDefault.request(e == null ? void 0 : e.request);
|
|
809
|
+
return t === r || r === "*any" || c(t) && c(r) && n(t) && n(r) && !(t instanceof FormData) && !(r instanceof FormData) && Object.values(t).length === Object.values(r).length && Object.entries(r).reduce((e, [n, r]) => e && (r === (t == null ? void 0 : t[n]) || r === "*any"), !0);
|
|
611
810
|
}
|
|
612
811
|
fetch(e, t) {
|
|
613
812
|
return this.startResponseLoading(), new Promise((n) => {
|
|
614
|
-
|
|
813
|
+
_e(g(e.response) ? e.response(t) : e.response).then((t) => {
|
|
615
814
|
e != null && e.lag ? (D.show(), setTimeout(() => {
|
|
616
815
|
this.stopResponseLoading(), n(t), D.hide();
|
|
617
|
-
},
|
|
816
|
+
}, k(0, 2e3))) : (this.stopResponseLoading(), n(t));
|
|
618
817
|
});
|
|
619
818
|
});
|
|
620
819
|
}
|
|
621
820
|
startResponseLoading() {
|
|
622
|
-
this.loading && clearTimeout(this.loading),
|
|
821
|
+
this.loading && clearTimeout(this.loading), f() && document.body.classList.add(ve);
|
|
623
822
|
}
|
|
624
823
|
stopResponseLoading() {
|
|
625
824
|
this.loading = setTimeout(() => {
|
|
626
|
-
this.loading = void 0,
|
|
825
|
+
this.loading = void 0, f() && document.body.classList.remove(ve);
|
|
627
826
|
}, 1200);
|
|
628
827
|
}
|
|
629
|
-
},
|
|
828
|
+
}, be = class {
|
|
630
829
|
constructor() {
|
|
631
|
-
|
|
830
|
+
b(this, "callback", void 0), b(this, "callbackEnd", void 0), b(this, "loading", !1);
|
|
632
831
|
}
|
|
633
832
|
async make(e, t) {
|
|
634
833
|
if (e && this.callback) return this.go(t);
|
|
@@ -654,114 +853,246 @@ var fe = "d-response-loading", pe = class {
|
|
|
654
853
|
let n = {};
|
|
655
854
|
return this.callbackEnd && (n = await this.callbackEnd(e, t)), n;
|
|
656
855
|
}
|
|
657
|
-
},
|
|
658
|
-
|
|
856
|
+
}, xe = class {
|
|
857
|
+
constructor(e = "/api/", t = {}) {
|
|
858
|
+
b(this, "headers", void 0), b(this, "requestDefault", void 0), b(this, "status", void 0), b(this, "response", void 0), b(this, "preparation", void 0), b(this, "loading", void 0), b(this, "errorCenter", void 0), this.url = e;
|
|
859
|
+
let { headersClass: n = me, requestDefaultClass: r = he, statusClass: i = ge, responseClass: a = ye, preparationClass: o = be, loadingClass: s = D.getItem(), errorCenterClass: c = x.getItem() } = t;
|
|
860
|
+
this.headers = new n(), this.requestDefault = new r(), this.status = new i(), this.response = new a(this.requestDefault), this.preparation = new o(), this.loading = s, this.errorCenter = c;
|
|
861
|
+
}
|
|
862
|
+
isLocalhost() {
|
|
659
863
|
return typeof location > "u" || location.hostname === "localhost";
|
|
660
864
|
}
|
|
661
|
-
|
|
865
|
+
getStatus() {
|
|
662
866
|
return this.status;
|
|
663
867
|
}
|
|
664
|
-
|
|
868
|
+
getResponse() {
|
|
665
869
|
return this.response;
|
|
666
870
|
}
|
|
667
|
-
|
|
668
|
-
return `${t ? this.url : ""}${e}`.replace("{locale}",
|
|
871
|
+
getUrl(e, t = !0) {
|
|
872
|
+
return `${t ? this.url : ""}${e}`.replace("{locale}", w.getLocation()).replace("{country}", w.getCountry()).replace("{language}", w.getLanguage());
|
|
669
873
|
}
|
|
670
|
-
|
|
874
|
+
getBody(e = {}, t = O.get) {
|
|
671
875
|
if (e instanceof FormData) return e;
|
|
672
|
-
if (t !== O.get &&
|
|
876
|
+
if (t !== O.get && c(e)) return u(e) ? e : JSON.stringify(e);
|
|
673
877
|
}
|
|
674
|
-
|
|
878
|
+
getBodyForGet(e, t = "", n = O.get) {
|
|
675
879
|
if (n === O.get) {
|
|
676
|
-
let n = t.match(/\?/) ? "&" : "?", r = typeof e == "object" ?
|
|
677
|
-
if (
|
|
880
|
+
let n = t.match(/\?/) ? "&" : "?", r = typeof e == "object" ? a(e) : e;
|
|
881
|
+
if (c(r)) return `${n}${r}`;
|
|
678
882
|
}
|
|
679
883
|
return "";
|
|
680
884
|
}
|
|
681
|
-
|
|
682
|
-
return this.headers.set(
|
|
885
|
+
setHeaders(e) {
|
|
886
|
+
return this.headers.set(e), this;
|
|
683
887
|
}
|
|
684
|
-
|
|
685
|
-
return this.requestDefault.set(
|
|
888
|
+
setRequestDefault(e) {
|
|
889
|
+
return this.requestDefault.set(e), this;
|
|
686
890
|
}
|
|
687
|
-
|
|
688
|
-
return this.url =
|
|
891
|
+
setUrl(e) {
|
|
892
|
+
return this.url = e, this;
|
|
689
893
|
}
|
|
690
|
-
|
|
691
|
-
return this.preparation.set(
|
|
894
|
+
setPreparation(e) {
|
|
895
|
+
return this.preparation.set(e), this;
|
|
692
896
|
}
|
|
693
|
-
|
|
694
|
-
return this.preparation.setEnd(
|
|
897
|
+
setEnd(e) {
|
|
898
|
+
return this.preparation.setEnd(e), this;
|
|
695
899
|
}
|
|
696
|
-
|
|
697
|
-
return
|
|
900
|
+
async request(e) {
|
|
901
|
+
return u(e) ? await this.fetch({ path: e }) : await this.fetch(e);
|
|
698
902
|
}
|
|
699
|
-
|
|
700
|
-
return this.request(
|
|
903
|
+
get(e) {
|
|
904
|
+
return this.request(r(e, { method: O.get }));
|
|
701
905
|
}
|
|
702
|
-
|
|
703
|
-
return this.request(
|
|
906
|
+
post(e) {
|
|
907
|
+
return this.request(r(e, { method: O.post }));
|
|
704
908
|
}
|
|
705
|
-
|
|
706
|
-
return this.request(
|
|
909
|
+
put(e) {
|
|
910
|
+
return this.request(r(e, { method: O.put }));
|
|
707
911
|
}
|
|
708
|
-
|
|
709
|
-
return this.request(
|
|
912
|
+
delete(e) {
|
|
913
|
+
return this.request(r(e, { method: O.delete }));
|
|
710
914
|
}
|
|
711
|
-
|
|
712
|
-
let { toData: t = !0, hideError: n = !1,
|
|
713
|
-
if (
|
|
714
|
-
let
|
|
715
|
-
|
|
915
|
+
async fetch(e) {
|
|
916
|
+
let { toData: t = !0, hideError: n = !1, hideLoading: r = !1, queryReturn: i = void 0, globalPreparation: a = !0, globalEnd: o = !0 } = e, s = await this.response.emulator(e);
|
|
917
|
+
if (s) return s;
|
|
918
|
+
let c = new ge(), l;
|
|
919
|
+
r || this.loading.show();
|
|
716
920
|
try {
|
|
717
|
-
await this.preparation.make(
|
|
718
|
-
let t
|
|
719
|
-
|
|
720
|
-
|
|
921
|
+
await this.preparation.make(a, e);
|
|
922
|
+
let { query: t, timeoutId: r } = await this.makeQuery(e);
|
|
923
|
+
r && clearTimeout(r);
|
|
924
|
+
let s = await this.preparation.makeEnd(o, t, e);
|
|
925
|
+
if (c.setStatus(t.status, t.statusText), this.status.setStatus(t.status, t.statusText), !n && t.status >= 400 && this.makeErrorQuery(t), s != null && s.reset) return this.loading.hide(), await this.fetch(e);
|
|
926
|
+
l = await this.readData(t, i, s);
|
|
721
927
|
} catch (e) {
|
|
722
|
-
throw n ||
|
|
928
|
+
throw n || this.makeError(e), c.setError(String(e)), this.status.setError(String(e)), r || this.loading.hide(), e;
|
|
723
929
|
}
|
|
724
|
-
return
|
|
930
|
+
return r || this.loading.hide(), c.setLastResponse(l), this.status.setLastResponse(l), this.makeStatus(this.makeData(l, t), c);
|
|
725
931
|
}
|
|
726
|
-
|
|
932
|
+
async readData(e, t, n) {
|
|
727
933
|
var r;
|
|
728
934
|
return t ? await t(e) : "data" in n ? n.data : ((r = e.headers.get("Content-Type")) == null ? "" : r).match("application/json") ? await e.json() : { data: await e.text() };
|
|
729
935
|
}
|
|
730
|
-
|
|
731
|
-
let
|
|
936
|
+
async makeQuery(e) {
|
|
937
|
+
let t = this.requestDefault.request(e.request), { api: n = !0, path: i = "", pathFull: a = void 0, method: o = O.get, headers: s = {}, type: c = "application/json;charset=UTF-8", init: l = {} } = e, u = a == null ? this.getUrl(i, n) : a, d = `${u}${this.getBodyForGet(t, u, o)}`, f = this.headers.get(s, c), p = r(l, {
|
|
732
938
|
method: o,
|
|
733
|
-
body: this.getBody(
|
|
939
|
+
body: this.getBody(t, o)
|
|
734
940
|
});
|
|
735
|
-
|
|
941
|
+
f && (p.headers = f);
|
|
942
|
+
let m = this.initController(e, p);
|
|
943
|
+
return {
|
|
944
|
+
query: await fetch(d, p),
|
|
945
|
+
timeoutId: m
|
|
946
|
+
};
|
|
736
947
|
}
|
|
737
|
-
|
|
738
|
-
if (!
|
|
739
|
-
if (e.data !== null && typeof e.data != "object" ||
|
|
740
|
-
let
|
|
741
|
-
return "success" in e && !("success" in
|
|
948
|
+
makeData(e, t) {
|
|
949
|
+
if (!t || !e || !n(e) || !("data" in e)) return e;
|
|
950
|
+
if (e.data !== null && typeof e.data != "object" || o(e.data)) return e.data;
|
|
951
|
+
let i = r(e.data);
|
|
952
|
+
return "success" in e && !("success" in i) && (i.success = e.success), "status" in e && !("status" in i) && (i.status = e.status), "message" in e && !("message" in i) && (i.message = e.message), i;
|
|
742
953
|
}
|
|
743
|
-
|
|
744
|
-
return e &&
|
|
954
|
+
makeStatus(e, t) {
|
|
955
|
+
return e && n(e) ? {
|
|
745
956
|
...e,
|
|
746
957
|
statusObject: t.get()
|
|
747
958
|
} : e;
|
|
748
959
|
}
|
|
960
|
+
makeError(e, t = "api") {
|
|
961
|
+
switch (e.name) {
|
|
962
|
+
case "TimeoutError":
|
|
963
|
+
this.errorCenter.on({
|
|
964
|
+
group: t,
|
|
965
|
+
code: "timeout",
|
|
966
|
+
details: e
|
|
967
|
+
});
|
|
968
|
+
break;
|
|
969
|
+
case "AbortError": break;
|
|
970
|
+
default: l() ? this.errorCenter.on({
|
|
971
|
+
group: t,
|
|
972
|
+
code: "unknown",
|
|
973
|
+
details: e
|
|
974
|
+
}) : this.errorCenter.on({
|
|
975
|
+
group: t,
|
|
976
|
+
code: "offline",
|
|
977
|
+
details: e
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
makeErrorQuery(e) {
|
|
982
|
+
switch (e.status) {
|
|
983
|
+
case 404:
|
|
984
|
+
this.errorCenter.on({
|
|
985
|
+
group: "api",
|
|
986
|
+
code: "notFound",
|
|
987
|
+
details: e
|
|
988
|
+
});
|
|
989
|
+
break;
|
|
990
|
+
case 500:
|
|
991
|
+
this.errorCenter.on({
|
|
992
|
+
group: "api",
|
|
993
|
+
code: "server",
|
|
994
|
+
details: e
|
|
995
|
+
});
|
|
996
|
+
break;
|
|
997
|
+
default: this.errorCenter.on({
|
|
998
|
+
group: "api-server",
|
|
999
|
+
code: String(e.status),
|
|
1000
|
+
details: e
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
initController(e, t) {
|
|
1005
|
+
let { timeout: n, controller: r } = e;
|
|
1006
|
+
if (n && !r && typeof AbortSignal < "u") {
|
|
1007
|
+
t.signal = AbortSignal.timeout(n);
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
if (!n && r) {
|
|
1011
|
+
t.signal = r.signal;
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
if (n) {
|
|
1015
|
+
let e = r == null ? new AbortController() : r;
|
|
1016
|
+
return t.signal = e.signal, setTimeout(() => {
|
|
1017
|
+
e.abort(new DOMException("Timeout", "TimeoutError"));
|
|
1018
|
+
}, n);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}, A = class e {
|
|
1022
|
+
static isLocalhost() {
|
|
1023
|
+
return this.item.isLocalhost();
|
|
1024
|
+
}
|
|
1025
|
+
static getItem() {
|
|
1026
|
+
return this.item;
|
|
1027
|
+
}
|
|
1028
|
+
static getStatus() {
|
|
1029
|
+
return this.item.getStatus();
|
|
1030
|
+
}
|
|
1031
|
+
static getResponse() {
|
|
1032
|
+
return this.item.getResponse();
|
|
1033
|
+
}
|
|
1034
|
+
static getUrl(e, t = !0) {
|
|
1035
|
+
return this.item.getUrl(e, t);
|
|
1036
|
+
}
|
|
1037
|
+
static getBody(e = {}, t = O.get) {
|
|
1038
|
+
return this.item.getBody(e, t);
|
|
1039
|
+
}
|
|
1040
|
+
static getBodyForGet(e, t = "", n = O.get) {
|
|
1041
|
+
return this.item.getBodyForGet(e, t, n);
|
|
1042
|
+
}
|
|
1043
|
+
static setHeaders(t) {
|
|
1044
|
+
return this.item.setHeaders(t), e;
|
|
1045
|
+
}
|
|
1046
|
+
static setRequestDefault(t) {
|
|
1047
|
+
return this.item.setRequestDefault(t), e;
|
|
1048
|
+
}
|
|
1049
|
+
static setUrl(t) {
|
|
1050
|
+
return this.item.setUrl(t), e;
|
|
1051
|
+
}
|
|
1052
|
+
static setPreparation(t) {
|
|
1053
|
+
return this.item.setPreparation(t), e;
|
|
1054
|
+
}
|
|
1055
|
+
static setConfig(e) {
|
|
1056
|
+
return e && n(e) && (e.urlRoot && this.setUrl(e.urlRoot), e.headers && this.setHeaders(e.headers), e.requestDefault && this.setRequestDefault(e.requestDefault), e.preparation && this.setPreparation(e.preparation), e.end && this.setEnd(e.end)), this;
|
|
1057
|
+
}
|
|
1058
|
+
static setEnd(t) {
|
|
1059
|
+
return this.item.setEnd(t), e;
|
|
1060
|
+
}
|
|
1061
|
+
static async request(e) {
|
|
1062
|
+
return this.item.request(e);
|
|
1063
|
+
}
|
|
1064
|
+
static get(e) {
|
|
1065
|
+
return this.item.get(e);
|
|
1066
|
+
}
|
|
1067
|
+
static post(e) {
|
|
1068
|
+
return this.item.post(e);
|
|
1069
|
+
}
|
|
1070
|
+
static put(e) {
|
|
1071
|
+
return this.item.put(e);
|
|
1072
|
+
}
|
|
1073
|
+
static delete(e) {
|
|
1074
|
+
return this.item.delete(e);
|
|
1075
|
+
}
|
|
749
1076
|
};
|
|
750
|
-
|
|
1077
|
+
b(A, "item", new xe());
|
|
751
1078
|
//#endregion
|
|
752
1079
|
//#region src/classes/BroadcastMessage.ts
|
|
753
|
-
var
|
|
754
|
-
constructor(e, t, n) {
|
|
755
|
-
if (
|
|
1080
|
+
var Se = class {
|
|
1081
|
+
constructor(e, t, n, r = x.getItem()) {
|
|
1082
|
+
if (b(this, "channel", void 0), b(this, "update", (e) => {
|
|
756
1083
|
var t;
|
|
757
1084
|
return (t = this.callback) == null || t.call(this, e), this;
|
|
758
|
-
}),
|
|
1085
|
+
}), b(this, "updateError", (e) => {
|
|
759
1086
|
var t;
|
|
760
1087
|
return (t = this.callbackError) == null || t.call(this, e), this;
|
|
761
|
-
}), this.callback = t, this.callbackError = n,
|
|
762
|
-
this.channel = new BroadcastChannel(`${
|
|
763
|
-
} catch (
|
|
764
|
-
|
|
1088
|
+
}), this.callback = t, this.callbackError = n, f()) try {
|
|
1089
|
+
this.channel = new BroadcastChannel(`${Ce()}__${e}`), this.channel.onmessage = this.update, this.channel.onmessageerror = this.updateError;
|
|
1090
|
+
} catch (e) {
|
|
1091
|
+
r.on({
|
|
1092
|
+
group: "broadcast",
|
|
1093
|
+
code: "error",
|
|
1094
|
+
details: e
|
|
1095
|
+
});
|
|
765
1096
|
}
|
|
766
1097
|
}
|
|
767
1098
|
getChannel() {
|
|
@@ -777,9 +1108,9 @@ var ge = class {
|
|
|
777
1108
|
setCallbackError(e) {
|
|
778
1109
|
return this.callbackError = e, this;
|
|
779
1110
|
}
|
|
780
|
-
},
|
|
1111
|
+
}, Ce = () => new S("__broadcast-name").get(() => `name_${k(1e6, 9999999)}`), we = class {
|
|
781
1112
|
constructor(e) {
|
|
782
|
-
|
|
1113
|
+
b(this, "cache", void 0), b(this, "cacheOld", void 0), b(this, "comparisons", []), this.callback = e;
|
|
783
1114
|
}
|
|
784
1115
|
getCache(e) {
|
|
785
1116
|
return this.isUpdate(e) && (this.cacheOld = this.cache, this.setCache()), this.cache;
|
|
@@ -799,9 +1130,9 @@ var ge = class {
|
|
|
799
1130
|
isUpdate(e) {
|
|
800
1131
|
return this.cache === void 0 || this.comparisons.length !== e.length || this.comparisons.findIndex((t, n) => t !== e[n]) >= 0 ? (this.comparisons = [...e], !0) : !1;
|
|
801
1132
|
}
|
|
802
|
-
},
|
|
1133
|
+
}, Te = class {
|
|
803
1134
|
constructor() {
|
|
804
|
-
|
|
1135
|
+
b(this, "cache", {});
|
|
805
1136
|
}
|
|
806
1137
|
get(e, t, n) {
|
|
807
1138
|
return this.getCacheItem(e, t).getCache(n == null ? [] : n);
|
|
@@ -810,17 +1141,17 @@ var ge = class {
|
|
|
810
1141
|
return await this.getCacheItem(e, t).getCacheAsync(n == null ? [] : n);
|
|
811
1142
|
}
|
|
812
1143
|
getCacheItem(e, t) {
|
|
813
|
-
return e in this.cache || (this.cache[e] = new
|
|
1144
|
+
return e in this.cache || (this.cache[e] = new we(t)), this.cache[e];
|
|
814
1145
|
}
|
|
815
|
-
},
|
|
1146
|
+
}, Ee, j = class {
|
|
816
1147
|
static get(e, t, n) {
|
|
817
1148
|
return this.cache.get(e, t, n);
|
|
818
1149
|
}
|
|
819
1150
|
};
|
|
820
|
-
|
|
1151
|
+
Ee = j, b(j, "cache", void 0), Ee.cache = new Te();
|
|
821
1152
|
//#endregion
|
|
822
1153
|
//#region src/functions/transformation.ts
|
|
823
|
-
function
|
|
1154
|
+
function M(e, t = !1) {
|
|
824
1155
|
if (typeof e == "string") {
|
|
825
1156
|
let r = e.trim();
|
|
826
1157
|
switch (r) {
|
|
@@ -837,14 +1168,14 @@ function Se(e, t = !1) {
|
|
|
837
1168
|
}
|
|
838
1169
|
else if (/^[0-9]+\.[0-9.]+$/.exec(r)) return parseFloat(r);
|
|
839
1170
|
else if (/^[0-9]+$/.exec(r)) return parseInt(r, 10);
|
|
840
|
-
else if (t &&
|
|
1171
|
+
else if (t && f() && typeof ((n = window) == null ? void 0 : n[r]) == "function") return window[r];
|
|
841
1172
|
}
|
|
842
1173
|
}
|
|
843
1174
|
return e;
|
|
844
1175
|
}
|
|
845
1176
|
//#endregion
|
|
846
1177
|
//#region src/classes/CookieBlock.ts
|
|
847
|
-
var
|
|
1178
|
+
var De = "cookie-block", N = class {
|
|
848
1179
|
static get() {
|
|
849
1180
|
var e;
|
|
850
1181
|
return (e = this.storage.get()) == null ? !1 : e;
|
|
@@ -853,19 +1184,19 @@ var Ce = "cookie-block", we = class {
|
|
|
853
1184
|
this.storage.set(e);
|
|
854
1185
|
}
|
|
855
1186
|
};
|
|
856
|
-
|
|
1187
|
+
b(N, "storage", new S(De));
|
|
857
1188
|
//#endregion
|
|
858
1189
|
//#region src/classes/Cookie.ts
|
|
859
|
-
var
|
|
1190
|
+
var Oe, P = {}, ke = class {
|
|
860
1191
|
constructor(e) {
|
|
861
|
-
if (
|
|
862
|
-
this.value =
|
|
1192
|
+
if (b(this, "value", void 0), b(this, "options", {}), this.name = e, e in F) return F[e];
|
|
1193
|
+
this.value = P == null ? void 0 : P[e], F[e] = this;
|
|
863
1194
|
}
|
|
864
1195
|
get(e, t) {
|
|
865
1196
|
return this.value === void 0 && e && this.set(e, t), this.value;
|
|
866
1197
|
}
|
|
867
1198
|
set(e, t) {
|
|
868
|
-
this.value =
|
|
1199
|
+
this.value = _(e), Object.assign(this.options, t), this.update();
|
|
869
1200
|
}
|
|
870
1201
|
remove() {
|
|
871
1202
|
this.set("");
|
|
@@ -875,7 +1206,7 @@ var Te, M = {}, Ee = class {
|
|
|
875
1206
|
return (e = (t = this.options) == null ? void 0 : t.age) == null ? 10080 * 60 : e;
|
|
876
1207
|
}
|
|
877
1208
|
update() {
|
|
878
|
-
if (
|
|
1209
|
+
if (f() && !v() && !N.get()) {
|
|
879
1210
|
var e, t, n, r, i;
|
|
880
1211
|
let a = String((e = this.value) == null ? "" : e);
|
|
881
1212
|
document.cookie = [
|
|
@@ -889,40 +1220,40 @@ var Te, M = {}, Ee = class {
|
|
|
889
1220
|
static updateData() {
|
|
890
1221
|
for (let e of document.cookie.split(";")) {
|
|
891
1222
|
let [t, n] = e.trim().split("=");
|
|
892
|
-
t &&
|
|
1223
|
+
t && c(n) && (P[t] = M(n));
|
|
893
1224
|
}
|
|
894
1225
|
}
|
|
895
1226
|
};
|
|
896
|
-
|
|
897
|
-
var
|
|
1227
|
+
Oe = ke, f() && !v() && Oe.updateData();
|
|
1228
|
+
var F = {};
|
|
898
1229
|
//#endregion
|
|
899
1230
|
//#region src/functions/toDate.ts
|
|
900
|
-
function
|
|
901
|
-
var t, n, r, i, a,
|
|
1231
|
+
function I(e) {
|
|
1232
|
+
var t, n, r, i, a, o, c, l;
|
|
902
1233
|
if (e instanceof Date) return e;
|
|
903
|
-
if (
|
|
1234
|
+
if (s(e)) return /* @__PURE__ */ new Date();
|
|
904
1235
|
if (typeof e == "number") return new Date(e);
|
|
905
|
-
let u = e, d =
|
|
1236
|
+
let u = e, d = w.getTimezoneFormat().trim();
|
|
906
1237
|
e.replace(/^([\s\S]+)([-+]\d{2}:?\d{2})$/, (e, t, n) => (u = t, d = n.trim(), e));
|
|
907
|
-
let f = (t = (n = (r = (i = (a = (
|
|
1238
|
+
let f = (t = (n = (r = (i = (a = (o = (c = (l = /^\d{4}\d{2}\d{2}$/.exec(u) && `${u.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3")}T00:00:00`) == null ? /^\d{4}\d{2}$/.exec(u) && `${u.replace(/^(\d{4})(\d{2})$/, "$1-$2")}-01T00:00:00` : l) == null ? /^\d{4}\d{2}\d{2} \d{2}:\d{2}:\d{2}$/.exec(u) && u.replace(/^(\d{4})(\d{2})(\d{2}) (\d{2}):(\d{2}):(\d{2})$/, "$1-$2-$3T$4:$5:$6") : c) == null ? /^\d{4}-\d{2}-\d{2}$/.exec(u) && `${u}T00:00:00` : o) == null ? /^\d{4}-\d{2}$/.exec(u) && `${u}-01T00:00:00` : a) == null ? /^\d{4}$/.exec(u) && `${u}-01-01T00:00:00` : i) == null ? /^\d{2}:\d{2}$/.exec(u) && `2000-01-01T${u}:00` : r) == null ? /^\d{2}:\d{2}:\d{2}$/.exec(u) && `2000-01-01T${u}` : n) == null ? u.replace(" ", "T") : t;
|
|
908
1239
|
return /* @__PURE__ */ new Date(`${f.trim()}${d}`);
|
|
909
1240
|
}
|
|
910
1241
|
//#endregion
|
|
911
1242
|
//#region src/functions/getColumn.ts
|
|
912
|
-
function
|
|
913
|
-
return
|
|
1243
|
+
function Ae(e, t) {
|
|
1244
|
+
return i(e, (e) => e == null ? void 0 : e[t], !0);
|
|
914
1245
|
}
|
|
915
1246
|
//#endregion
|
|
916
1247
|
//#region src/classes/GeoIntl.ts
|
|
917
|
-
var
|
|
918
|
-
static getInstance(t =
|
|
1248
|
+
var L = class e {
|
|
1249
|
+
static getInstance(t = w.getLocation()) {
|
|
919
1250
|
return new e(t);
|
|
920
1251
|
}
|
|
921
|
-
constructor(e =
|
|
922
|
-
|
|
923
|
-
let
|
|
924
|
-
if (
|
|
925
|
-
|
|
1252
|
+
constructor(e = w.getLocation(), t = x.getItem()) {
|
|
1253
|
+
b(this, "geo", void 0), this.errorCenter = t, this.geo = w.find(e);
|
|
1254
|
+
let n = this.getLocation();
|
|
1255
|
+
if (n in je) return je[n];
|
|
1256
|
+
je[n] = this;
|
|
926
1257
|
}
|
|
927
1258
|
getLocation() {
|
|
928
1259
|
return this.geo.standard;
|
|
@@ -940,7 +1271,11 @@ var F = class e {
|
|
|
940
1271
|
try {
|
|
941
1272
|
typeof Intl < "u" && (e ? a = new Intl.DisplayNames(this.getLocation(), i).of(e) : i.type === "language" ? a = new Intl.DisplayNames(this.getLocation(), i).of(this.geo.language) : i.type === "region" && (a = new Intl.DisplayNames(this.getLocation(), i).of(this.geo.country)));
|
|
942
1273
|
} catch (e) {
|
|
943
|
-
|
|
1274
|
+
this.errorCenter.on({
|
|
1275
|
+
group: "intl",
|
|
1276
|
+
code: "display",
|
|
1277
|
+
details: e
|
|
1278
|
+
});
|
|
944
1279
|
}
|
|
945
1280
|
return (n = (r = a) == null ? e : r) == null ? "" : n;
|
|
946
1281
|
}
|
|
@@ -949,7 +1284,7 @@ var F = class e {
|
|
|
949
1284
|
type: "language",
|
|
950
1285
|
style: t
|
|
951
1286
|
};
|
|
952
|
-
return this.display(
|
|
1287
|
+
return this.display(w.getByCode(e).language, n);
|
|
953
1288
|
}
|
|
954
1289
|
countryName(e, t) {
|
|
955
1290
|
let n = {
|
|
@@ -979,7 +1314,7 @@ var F = class e {
|
|
|
979
1314
|
}
|
|
980
1315
|
number(e, t) {
|
|
981
1316
|
var n, r;
|
|
982
|
-
return ((n = this.numberObject(t)) == null || (r = n.format) == null ? void 0 : r.call(n,
|
|
1317
|
+
return ((n = this.numberObject(t)) == null || (r = n.format) == null ? void 0 : r.call(n, m(e))) || e.toString();
|
|
983
1318
|
}
|
|
984
1319
|
decimal() {
|
|
985
1320
|
var e, t, n;
|
|
@@ -993,7 +1328,7 @@ var F = class e {
|
|
|
993
1328
|
}, i = e.toString().replace(/^([\S\s]+[\d ])([a-zA-Z]{3})$/i, (...e) => (r.currency = String(e[2]).toUpperCase(), String(e[1])));
|
|
994
1329
|
if (n) {
|
|
995
1330
|
let t = this.numberObject(r);
|
|
996
|
-
return t ?
|
|
1331
|
+
return t ? Ae(t.formatToParts(m(e)).filter((e) => ["literal", "currency"].indexOf(e.type) === -1), "value").join("") : e.toString();
|
|
997
1332
|
} else if ("currency" in r) return this.number(typeof e == "number" ? e : i, r);
|
|
998
1333
|
else return this.number(typeof e == "number" ? e : i, {
|
|
999
1334
|
...r,
|
|
@@ -1016,8 +1351,8 @@ var F = class e {
|
|
|
1016
1351
|
return this.number(r, n);
|
|
1017
1352
|
}
|
|
1018
1353
|
sizeFile(e, t = "byte") {
|
|
1019
|
-
let n =
|
|
1020
|
-
if (n > 1024 &&
|
|
1354
|
+
let n = m(e);
|
|
1355
|
+
if (n > 1024 && u(t)) switch (t) {
|
|
1021
1356
|
case "byte": return this.sizeFile(n / 1024, "kilobyte");
|
|
1022
1357
|
case "kilobyte": return this.sizeFile(n / 1024, "megabyte");
|
|
1023
1358
|
case "megabyte": return this.sizeFile(n / 1024, "gigabyte");
|
|
@@ -1033,11 +1368,11 @@ var F = class e {
|
|
|
1033
1368
|
});
|
|
1034
1369
|
}
|
|
1035
1370
|
percentBy100(e, t) {
|
|
1036
|
-
return this.percent(
|
|
1371
|
+
return this.percent(m(e) / 100, t);
|
|
1037
1372
|
}
|
|
1038
1373
|
plural(e, t, n, r) {
|
|
1039
1374
|
var i;
|
|
1040
|
-
let a =
|
|
1375
|
+
let a = m(e), o = t.split("|");
|
|
1041
1376
|
if (o.length > 1) try {
|
|
1042
1377
|
if (typeof Intl < "u") {
|
|
1043
1378
|
var s;
|
|
@@ -1065,23 +1400,27 @@ var F = class e {
|
|
|
1065
1400
|
return `${this.number(a, r)} ${(s = t) == null ? "" : s}`.trim();
|
|
1066
1401
|
}
|
|
1067
1402
|
} catch (e) {
|
|
1068
|
-
|
|
1403
|
+
this.errorCenter.on({
|
|
1404
|
+
group: "intl",
|
|
1405
|
+
code: "plural",
|
|
1406
|
+
details: e
|
|
1407
|
+
});
|
|
1069
1408
|
}
|
|
1070
1409
|
return `${this.number(a, r)} ${(i = o == null ? void 0 : o[0]) == null ? "" : i}`.trim();
|
|
1071
1410
|
}
|
|
1072
1411
|
date(e, t, n, r) {
|
|
1073
|
-
let i =
|
|
1412
|
+
let i = I(e), a = typeof n == "string", o = this.dateOptions(t, a ? n : "short");
|
|
1074
1413
|
return r && (o.hour12 = !1), a || Object.assign(o, n), i.toLocaleString(this.getLocation(), o);
|
|
1075
1414
|
}
|
|
1076
1415
|
relative(e, t, n) {
|
|
1077
|
-
let r =
|
|
1416
|
+
let r = I(e), i = n || /* @__PURE__ */ new Date(), a = {
|
|
1078
1417
|
numeric: "auto",
|
|
1079
1418
|
...typeof t == "string" ? { style: t } : t || {}
|
|
1080
1419
|
}, o = "second", s = (r.getTime() - i.getTime()) / 1e3;
|
|
1081
1420
|
return Math.abs(s) >= 60 && (o = "minute", s /= 60, Math.abs(s) >= 60 && (o = "hour", s /= 60, Math.abs(s) >= 24 && (o = "day", s /= 24, Math.abs(s) >= 30 && (o = "month", s /= 30, Math.abs(s) >= 12 && (o = "year", s /= 12))))), this.relativeByValue(s, o, a);
|
|
1082
1421
|
}
|
|
1083
1422
|
relativeLimit(e, t, n, r, i, a, o) {
|
|
1084
|
-
let s =
|
|
1423
|
+
let s = I(e), c = n || /* @__PURE__ */ new Date(), l = new Date(c), u = new Date(c);
|
|
1085
1424
|
return l.setDate(c.getDate() - t), u.setDate(c.getDate() + t), s >= l && s <= u ? this.relative(s, r, c) : this.date(s, a, i, o);
|
|
1086
1425
|
}
|
|
1087
1426
|
relativeByValue(e, t, n) {
|
|
@@ -1090,17 +1429,25 @@ var F = class e {
|
|
|
1090
1429
|
...typeof n == "string" ? { style: n } : n || {}
|
|
1091
1430
|
};
|
|
1092
1431
|
try {
|
|
1093
|
-
if (this.hasIntl() && Intl.RelativeTimeFormat !== void 0) return new Intl.RelativeTimeFormat(this.getLocation(), r).format(Math.round(
|
|
1432
|
+
if (this.hasIntl() && Intl.RelativeTimeFormat !== void 0) return new Intl.RelativeTimeFormat(this.getLocation(), r).format(Math.round(m(e)), t);
|
|
1094
1433
|
} catch (e) {
|
|
1095
|
-
|
|
1434
|
+
this.errorCenter.on({
|
|
1435
|
+
group: "intl",
|
|
1436
|
+
code: "relative",
|
|
1437
|
+
details: e
|
|
1438
|
+
});
|
|
1096
1439
|
}
|
|
1097
1440
|
return "";
|
|
1098
1441
|
}
|
|
1099
1442
|
month(e, t) {
|
|
1100
1443
|
try {
|
|
1101
|
-
if (this.hasIntlDateTimeFormat()) return Intl.DateTimeFormat(this.getLocation(), { month: t || "long" }).format(
|
|
1444
|
+
if (this.hasIntlDateTimeFormat()) return Intl.DateTimeFormat(this.getLocation(), { month: t || "long" }).format(I(e));
|
|
1102
1445
|
} catch (e) {
|
|
1103
|
-
|
|
1446
|
+
this.errorCenter.on({
|
|
1447
|
+
group: "intl",
|
|
1448
|
+
code: "datetime",
|
|
1449
|
+
details: e
|
|
1450
|
+
});
|
|
1104
1451
|
}
|
|
1105
1452
|
return "";
|
|
1106
1453
|
}
|
|
@@ -1118,15 +1465,23 @@ var F = class e {
|
|
|
1118
1465
|
});
|
|
1119
1466
|
}
|
|
1120
1467
|
} catch (e) {
|
|
1121
|
-
|
|
1468
|
+
this.errorCenter.on({
|
|
1469
|
+
group: "intl",
|
|
1470
|
+
code: "datetime",
|
|
1471
|
+
details: e
|
|
1472
|
+
});
|
|
1122
1473
|
}
|
|
1123
1474
|
return t;
|
|
1124
1475
|
}
|
|
1125
1476
|
weekday(e, t) {
|
|
1126
1477
|
try {
|
|
1127
|
-
if (this.hasIntlDateTimeFormat()) return Intl.DateTimeFormat(this.getLocation(), { weekday: t || "long" }).format(
|
|
1478
|
+
if (this.hasIntlDateTimeFormat()) return Intl.DateTimeFormat(this.getLocation(), { weekday: t || "long" }).format(I(e));
|
|
1128
1479
|
} catch (e) {
|
|
1129
|
-
|
|
1480
|
+
this.errorCenter.on({
|
|
1481
|
+
group: "intl",
|
|
1482
|
+
code: "datetime",
|
|
1483
|
+
details: e
|
|
1484
|
+
});
|
|
1130
1485
|
}
|
|
1131
1486
|
return "";
|
|
1132
1487
|
}
|
|
@@ -1145,7 +1500,11 @@ var F = class e {
|
|
|
1145
1500
|
}), n.setDate(n.getDate() + 1);
|
|
1146
1501
|
}
|
|
1147
1502
|
} catch (e) {
|
|
1148
|
-
|
|
1503
|
+
this.errorCenter.on({
|
|
1504
|
+
group: "intl",
|
|
1505
|
+
code: "datetime",
|
|
1506
|
+
details: e
|
|
1507
|
+
});
|
|
1149
1508
|
}
|
|
1150
1509
|
return t;
|
|
1151
1510
|
}
|
|
@@ -1169,7 +1528,11 @@ var F = class e {
|
|
|
1169
1528
|
try {
|
|
1170
1529
|
if (this.hasIntl() && Intl.NumberFormat !== void 0) return new Intl.NumberFormat(this.getLocation(), e);
|
|
1171
1530
|
} catch (e) {
|
|
1172
|
-
|
|
1531
|
+
this.errorCenter.on({
|
|
1532
|
+
group: "intl",
|
|
1533
|
+
code: "number",
|
|
1534
|
+
details: e
|
|
1535
|
+
});
|
|
1173
1536
|
}
|
|
1174
1537
|
}
|
|
1175
1538
|
dateOptions(e, t = "short") {
|
|
@@ -1214,12 +1577,12 @@ var F = class e {
|
|
|
1214
1577
|
"second"
|
|
1215
1578
|
].indexOf(e) !== -1 && (n.second = "2-digit")), n;
|
|
1216
1579
|
}
|
|
1217
|
-
},
|
|
1218
|
-
constructor(e, t = "date", n =
|
|
1219
|
-
|
|
1580
|
+
}, je = {}, Me = class e {
|
|
1581
|
+
constructor(e, t = "date", n = w.getLocation()) {
|
|
1582
|
+
b(this, "date", void 0), b(this, "hour24", !1), b(this, "watch", void 0), this.type = t, this.code = n, this.date = I(e);
|
|
1220
1583
|
}
|
|
1221
1584
|
getIntl() {
|
|
1222
|
-
return new
|
|
1585
|
+
return new L(this.code);
|
|
1223
1586
|
}
|
|
1224
1587
|
getDate() {
|
|
1225
1588
|
return this.date;
|
|
@@ -1322,7 +1685,7 @@ var F = class e {
|
|
|
1322
1685
|
].indexOf(this.type) !== -1 && (i = n.locale("time"))), `${r.join("-")}${i ? `T${i}${t ? n.getTimeZone() : ""}` : ""}`;
|
|
1323
1686
|
}
|
|
1324
1687
|
setDate(e) {
|
|
1325
|
-
return this.date =
|
|
1688
|
+
return this.date = I(e), this.update(), this;
|
|
1326
1689
|
}
|
|
1327
1690
|
setType(e) {
|
|
1328
1691
|
return this.type = e, this.update(), this;
|
|
@@ -1464,7 +1827,7 @@ var F = class e {
|
|
|
1464
1827
|
return this.cloneClass().moveDayPrevious();
|
|
1465
1828
|
}
|
|
1466
1829
|
toTimeZoneHourFormat(e) {
|
|
1467
|
-
|
|
1830
|
+
f() && this.getIntl().number(Math.trunc(e), {
|
|
1468
1831
|
signDisplay: "always",
|
|
1469
1832
|
minimumIntegerDigits: 2
|
|
1470
1833
|
});
|
|
@@ -1478,36 +1841,36 @@ var F = class e {
|
|
|
1478
1841
|
};
|
|
1479
1842
|
//#endregion
|
|
1480
1843
|
//#region src/functions/anyToString.ts
|
|
1481
|
-
function
|
|
1844
|
+
function R(e, n = !0) {
|
|
1482
1845
|
var r;
|
|
1483
|
-
return
|
|
1846
|
+
return u(e) ? e.trim() : o(e) && e.findIndex((e) => t(e)) === -1 && n ? e.join(",") : t(e) ? JSON.stringify(e) : e === !0 ? "1" : e === !1 ? "0" : (r = e == null ? void 0 : e.toString()) == null ? "" : r;
|
|
1484
1847
|
}
|
|
1485
1848
|
//#endregion
|
|
1486
1849
|
//#region src/functions/strSplit.ts
|
|
1487
|
-
function
|
|
1488
|
-
let r =
|
|
1850
|
+
function Ne(e, t, n) {
|
|
1851
|
+
let r = R(e);
|
|
1489
1852
|
if (!n || n <= 0) return r.split(t);
|
|
1490
1853
|
let i = r.split(t, n), a = r.split(t);
|
|
1491
1854
|
return i.length === a.length ? i : (i.pop(), [...i, a.slice(n - 1).join(t)]);
|
|
1492
1855
|
}
|
|
1493
1856
|
//#endregion
|
|
1494
1857
|
//#region src/functions/getItemByPath.ts
|
|
1495
|
-
function
|
|
1858
|
+
function z(e, n) {
|
|
1496
1859
|
var r;
|
|
1497
|
-
if (!
|
|
1498
|
-
let i =
|
|
1499
|
-
return a && e != null && e[a] &&
|
|
1860
|
+
if (!c(n)) return;
|
|
1861
|
+
let i = Ne(n, ".", 2), a = i[0];
|
|
1862
|
+
return a && e != null && e[a] && t(e[a]) && i != null && i[1] ? z(e[a], i[1]) : (r = c(a) && (e == null ? void 0 : e[a])) == null ? void 0 : r;
|
|
1500
1863
|
}
|
|
1501
1864
|
//#endregion
|
|
1502
1865
|
//#region src/functions/toCamelCase.ts
|
|
1503
|
-
function
|
|
1866
|
+
function Pe(e) {
|
|
1504
1867
|
return e.toString().trim().replace(/[^\w-. ]+/g, "").replace(/[ .]+/g, "-").replace(/(?<=[A-Z])([A-Z])/g, (e) => `${e.toLowerCase()}`).replace(/-+([a-zA-Z0-9])/g, (...e) => `${String(e[1]).toUpperCase()}`).replace(/^([A-Z])/, (e) => `${e.toLowerCase()}`);
|
|
1505
1868
|
}
|
|
1506
1869
|
//#endregion
|
|
1507
1870
|
//#region src/types/formattersTypes.ts
|
|
1508
|
-
var
|
|
1871
|
+
var B = /* @__PURE__ */ function(e) {
|
|
1509
1872
|
return e.currency = "currency", e.date = "date", e.name = "name", e.number = "number", e.plural = "plural", e.unit = "unit", e;
|
|
1510
|
-
}({}),
|
|
1873
|
+
}({}), Fe = class {
|
|
1511
1874
|
constructor(e, t) {
|
|
1512
1875
|
this.options = e, this.list = t;
|
|
1513
1876
|
}
|
|
@@ -1530,7 +1893,7 @@ var z = /* @__PURE__ */ function(e) {
|
|
|
1530
1893
|
return this.list = e, this;
|
|
1531
1894
|
}
|
|
1532
1895
|
to() {
|
|
1533
|
-
let e =
|
|
1896
|
+
let e = i(this.getList(), (e) => ({
|
|
1534
1897
|
...e,
|
|
1535
1898
|
...this.getFormatData(e)
|
|
1536
1899
|
}));
|
|
@@ -1538,51 +1901,51 @@ var z = /* @__PURE__ */ function(e) {
|
|
|
1538
1901
|
}
|
|
1539
1902
|
getFormatData(e) {
|
|
1540
1903
|
let t = {};
|
|
1541
|
-
return
|
|
1542
|
-
let i = `${
|
|
1543
|
-
n != null && n.transformation ?
|
|
1904
|
+
return i(this.options, (n, r) => {
|
|
1905
|
+
let i = `${Pe(r)}Format`, a = z(e, r);
|
|
1906
|
+
n != null && n.transformation ? c(a) ? t[i] = n.transformation(a, e, n.options) : t[i] = "" : t[i] = this.transformation(a, e, n.type, n.options);
|
|
1544
1907
|
}), t;
|
|
1545
1908
|
}
|
|
1546
1909
|
transformation(e, t, n, r) {
|
|
1547
|
-
if (
|
|
1548
|
-
case
|
|
1549
|
-
case
|
|
1550
|
-
case
|
|
1551
|
-
case
|
|
1552
|
-
case
|
|
1553
|
-
case
|
|
1910
|
+
if (c(e) || n === B.name) switch (n) {
|
|
1911
|
+
case B.currency: return this.formatCurrency(e, t, r);
|
|
1912
|
+
case B.date: return this.formatDate(e, r);
|
|
1913
|
+
case B.name: return this.formatName(t, r);
|
|
1914
|
+
case B.number: return this.formatNumber(e, r);
|
|
1915
|
+
case B.plural: return this.formatPlural(e, r);
|
|
1916
|
+
case B.unit: return this.formatUnit(e, r);
|
|
1554
1917
|
default: return String(e);
|
|
1555
1918
|
}
|
|
1556
1919
|
return "";
|
|
1557
1920
|
}
|
|
1558
1921
|
formatCurrency(e, t, n) {
|
|
1559
1922
|
var r;
|
|
1560
|
-
let i = n != null && n.currencyPropName ?
|
|
1561
|
-
return
|
|
1923
|
+
let i = n != null && n.currencyPropName ? z(t, n.currencyPropName) : t == null ? void 0 : t.currency;
|
|
1924
|
+
return L.getInstance().currency(e, (r = n == null ? void 0 : n.options) == null ? i : r, n == null ? void 0 : n.numberOnly);
|
|
1562
1925
|
}
|
|
1563
1926
|
formatDate(e, t) {
|
|
1564
|
-
return
|
|
1927
|
+
return L.getInstance().date(e, t == null ? void 0 : t.type, t == null ? void 0 : t.options, t == null ? void 0 : t.hour24);
|
|
1565
1928
|
}
|
|
1566
1929
|
formatName(e, t) {
|
|
1567
1930
|
var n, r, i;
|
|
1568
|
-
let a =
|
|
1569
|
-
return a && o ?
|
|
1931
|
+
let a = z(e, (n = t == null ? void 0 : t.lastPropName) == null ? "lastName" : n), o = z(e, (r = t == null ? void 0 : t.firstPropName) == null ? "firstName" : r), s = z(e, (i = t == null ? void 0 : t.surname) == null ? "surname" : i);
|
|
1932
|
+
return a && o ? L.getInstance().fullName(a, o, s, t == null ? void 0 : t.short) : "";
|
|
1570
1933
|
}
|
|
1571
1934
|
formatNumber(e, t) {
|
|
1572
|
-
return
|
|
1935
|
+
return L.getInstance().number(e, t == null ? void 0 : t.options);
|
|
1573
1936
|
}
|
|
1574
1937
|
formatPlural(e, t) {
|
|
1575
|
-
return t && t.words ?
|
|
1938
|
+
return t && t.words ? L.getInstance().plural(e, t == null ? void 0 : t.words, t == null ? void 0 : t.options, t == null ? void 0 : t.optionsNumber) : e;
|
|
1576
1939
|
}
|
|
1577
1940
|
formatUnit(e, t) {
|
|
1578
|
-
return t && t.unit ?
|
|
1941
|
+
return t && t.unit ? L.getInstance().unit(e, t.unit) : e;
|
|
1579
1942
|
}
|
|
1580
|
-
},
|
|
1581
|
-
constructor(e =
|
|
1943
|
+
}, Ie = "f", Le = class e {
|
|
1944
|
+
constructor(e = w.getLocation()) {
|
|
1582
1945
|
this.code = e;
|
|
1583
1946
|
}
|
|
1584
1947
|
get(t = this.code) {
|
|
1585
|
-
let n =
|
|
1948
|
+
let n = w.find(t);
|
|
1586
1949
|
if (n) {
|
|
1587
1950
|
var r;
|
|
1588
1951
|
let t = this.getCountry(n);
|
|
@@ -1601,10 +1964,10 @@ var z = /* @__PURE__ */ function(e) {
|
|
|
1601
1964
|
return (t = this.get(e)) == null ? void 0 : t.icon;
|
|
1602
1965
|
}
|
|
1603
1966
|
getList(e) {
|
|
1604
|
-
return
|
|
1967
|
+
return i(this.getCodes(e), (e) => this.get(e));
|
|
1605
1968
|
}
|
|
1606
1969
|
getNational(t) {
|
|
1607
|
-
return
|
|
1970
|
+
return i(this.getList(t), (t) => {
|
|
1608
1971
|
let n = new e(t.standard).get(t.standard);
|
|
1609
1972
|
return {
|
|
1610
1973
|
...t,
|
|
@@ -1618,7 +1981,7 @@ var z = /* @__PURE__ */ function(e) {
|
|
|
1618
1981
|
return this.code = e, this;
|
|
1619
1982
|
}
|
|
1620
1983
|
getLocation() {
|
|
1621
|
-
return new
|
|
1984
|
+
return new L(this.code);
|
|
1622
1985
|
}
|
|
1623
1986
|
getCodes(t) {
|
|
1624
1987
|
return t == null ? Object.keys(e.flags) : t;
|
|
@@ -1630,7 +1993,7 @@ var z = /* @__PURE__ */ function(e) {
|
|
|
1630
1993
|
return this.getLocation().countryName(e.country);
|
|
1631
1994
|
}
|
|
1632
1995
|
};
|
|
1633
|
-
|
|
1996
|
+
b(Le, "flags", {
|
|
1634
1997
|
AD: "f-ad",
|
|
1635
1998
|
AE: "f-ae",
|
|
1636
1999
|
AF: "f-af",
|
|
@@ -1875,12 +2238,12 @@ y(Ne, "flags", {
|
|
|
1875
2238
|
});
|
|
1876
2239
|
//#endregion
|
|
1877
2240
|
//#region src/classes/GeoPhone.ts
|
|
1878
|
-
var
|
|
2241
|
+
var Re = class {
|
|
1879
2242
|
static get(e) {
|
|
1880
|
-
return this.
|
|
2243
|
+
return this.getList().find((t) => e === t.value);
|
|
1881
2244
|
}
|
|
1882
2245
|
static getByPhone(e) {
|
|
1883
|
-
let t = this.toNumber(e), n = [""], r = this.
|
|
2246
|
+
let t = this.toNumber(e), n = [""], r = this.getMap(), i;
|
|
1884
2247
|
for (let e of t) if (n[n.length - 1] += e, e in r) {
|
|
1885
2248
|
var a, o, s;
|
|
1886
2249
|
(a = r[e]) != null && a.value && (i = r[e], n.push("")), r = (o = (s = r[e]) == null ? void 0 : s.next) == null ? {} : o;
|
|
@@ -1901,13 +2264,15 @@ var Pe, B = class {
|
|
|
1901
2264
|
}
|
|
1902
2265
|
}
|
|
1903
2266
|
static getList() {
|
|
1904
|
-
|
|
2267
|
+
var e;
|
|
2268
|
+
return this.list || this.makeList(), (e = this.list) == null ? [] : e;
|
|
1905
2269
|
}
|
|
1906
2270
|
static getMap() {
|
|
1907
|
-
|
|
2271
|
+
var e;
|
|
2272
|
+
return this.map || this.makeMap(), (e = this.map) == null ? {} : e;
|
|
1908
2273
|
}
|
|
1909
2274
|
static toMask(e, t) {
|
|
1910
|
-
if (
|
|
2275
|
+
if (c(e) && Array.isArray(t) && t.length > 0) {
|
|
1911
2276
|
let n = this.removeZero(e), r = n.length;
|
|
1912
2277
|
for (let e of t) if (this.getUnnecessaryLength(e) === r) return this.toStandard(n, e);
|
|
1913
2278
|
}
|
|
@@ -1929,7 +2294,7 @@ var Pe, B = class {
|
|
|
1929
2294
|
return (t = (n = e.match(/\*/g)) == null ? void 0 : n.length) == null ? 0 : t;
|
|
1930
2295
|
}
|
|
1931
2296
|
static makeList() {
|
|
1932
|
-
this.list =
|
|
2297
|
+
this.list = i(w.getList(), (e) => {
|
|
1933
2298
|
if (e != null && e.phoneMask) return {
|
|
1934
2299
|
phone: (e == null ? void 0 : e.phoneCode) && Number(e.phoneCode.replace(/[^0-9]+/, "")) || void 0,
|
|
1935
2300
|
within: (e == null ? void 0 : e.phoneWithin) || 0,
|
|
@@ -1939,7 +2304,7 @@ var Pe, B = class {
|
|
|
1939
2304
|
}).sort((e, t) => e.phone - t.phone);
|
|
1940
2305
|
}
|
|
1941
2306
|
static makeMap() {
|
|
1942
|
-
this.
|
|
2307
|
+
this.map = {}, this.getList().forEach((e) => {
|
|
1943
2308
|
e.mask.forEach((t) => {
|
|
1944
2309
|
let n = this.map, r;
|
|
1945
2310
|
if (this.toNumber(t).forEach((e) => {
|
|
@@ -1971,23 +2336,23 @@ var Pe, B = class {
|
|
|
1971
2336
|
return e.replace(/\*/, this.getWithinSymbol(t));
|
|
1972
2337
|
}
|
|
1973
2338
|
};
|
|
1974
|
-
|
|
2339
|
+
b(Re, "list", void 0), b(Re, "map", void 0);
|
|
1975
2340
|
//#endregion
|
|
1976
2341
|
//#region src/classes/Global.ts
|
|
1977
|
-
var V,
|
|
2342
|
+
var V, ze = class {
|
|
1978
2343
|
static get(e) {
|
|
1979
2344
|
return V && (V == null ? void 0 : V[e]);
|
|
1980
2345
|
}
|
|
1981
2346
|
static add(e) {
|
|
1982
|
-
V === void 0 && (V =
|
|
2347
|
+
V === void 0 && (V = r(e));
|
|
1983
2348
|
}
|
|
1984
|
-
},
|
|
2349
|
+
}, Be, H = class {
|
|
1985
2350
|
static get(e, t) {
|
|
1986
2351
|
return !(e in this.hash) && t && this.set(e, t), this.hash[e];
|
|
1987
2352
|
}
|
|
1988
2353
|
static set(e, t) {
|
|
1989
2354
|
var n;
|
|
1990
|
-
let r =
|
|
2355
|
+
let r = _(t);
|
|
1991
2356
|
r !== ((n = this.hash) == null ? void 0 : n[e]) && (this.hash[e] = r, this.update());
|
|
1992
2357
|
}
|
|
1993
2358
|
static addWatch(e, t) {
|
|
@@ -2009,102 +2374,105 @@ var V, Fe = class {
|
|
|
2009
2374
|
}
|
|
2010
2375
|
static getLocation() {
|
|
2011
2376
|
let e = {};
|
|
2012
|
-
return location.hash.replace(/([\w-]+)[:=]([^;]+)/gi, (...t) => (e[String(t[1])] =
|
|
2377
|
+
return location.hash.replace(/([\w-]+)[:=]([^;]+)/gi, (...t) => (e[String(t[1])] = M(t[2]), "")), e;
|
|
2013
2378
|
}
|
|
2014
2379
|
static update() {
|
|
2015
|
-
this.block = !0, history.replaceState(null, "", `#${
|
|
2380
|
+
this.block = !0, history.replaceState(null, "", `#${a(this.hash, "=", ";")}`), requestAnimationFrame(() => {
|
|
2016
2381
|
this.block = !1;
|
|
2017
2382
|
});
|
|
2018
2383
|
}
|
|
2019
2384
|
static makeWatch(e) {
|
|
2020
|
-
|
|
2385
|
+
i(this.watch, (t, n) => {
|
|
2021
2386
|
var r;
|
|
2022
2387
|
((r = this.hash) == null ? void 0 : r[n]) !== (e == null ? void 0 : e[n]) && t.forEach((t) => t(e[n]));
|
|
2023
2388
|
});
|
|
2024
2389
|
}
|
|
2025
2390
|
};
|
|
2026
|
-
|
|
2391
|
+
Be = H, b(H, "hash", {}), b(H, "watch", {}), b(H, "block", !1), f() && (Be.reload(), addEventListener("hashchange", () => Be.reload()));
|
|
2027
2392
|
//#endregion
|
|
2028
2393
|
//#region src/classes/Icons.ts
|
|
2029
|
-
var
|
|
2394
|
+
var Ve, He = "__UI_ICON", Ue = 320, We = "--LOAD--", U = class {
|
|
2030
2395
|
static is(e) {
|
|
2031
2396
|
return e in this.icons || this.getName(e) in this.icons;
|
|
2032
2397
|
}
|
|
2033
2398
|
static async get(e, t = "", n = 1e3 * 60 * 3) {
|
|
2034
2399
|
var r, i, a, o;
|
|
2035
2400
|
let s = (r = (i = (a = this.icons) == null ? void 0 : a[this.getName(e)]) == null ? (o = this.icons) == null ? void 0 : o[e] : i) == null ? `${e.replace(/^@/, t == null ? this.url : t)}.svg` : r;
|
|
2036
|
-
return typeof s == "string" ? s ===
|
|
2401
|
+
return typeof s == "string" ? s === We && n > 0 ? (await this.wait(), this.get(e, t, n - Ue)) : s : g(s) ? await s() : await s;
|
|
2037
2402
|
}
|
|
2038
2403
|
static getNameList() {
|
|
2039
|
-
return
|
|
2404
|
+
return i(this.icons, (e, t) => t.replace(/^@/, ""));
|
|
2040
2405
|
}
|
|
2041
2406
|
static getUrlGlobal() {
|
|
2042
|
-
return `${
|
|
2407
|
+
return `${A.isLocalhost(), ""}${this.url}`;
|
|
2043
2408
|
}
|
|
2044
2409
|
static add(e, t) {
|
|
2045
2410
|
this.icons[this.getName(e)] = t;
|
|
2046
2411
|
}
|
|
2047
2412
|
static addLoad(e) {
|
|
2048
|
-
this.icons[this.getName(e)] =
|
|
2413
|
+
this.icons[this.getName(e)] = We;
|
|
2049
2414
|
}
|
|
2050
2415
|
static addGlobal(e, t) {
|
|
2051
2416
|
this.icons[this.getName(e)] = `${this.getUrlGlobal()}${t}`;
|
|
2052
2417
|
}
|
|
2053
2418
|
static addByList(e) {
|
|
2054
|
-
|
|
2419
|
+
i(e, (e, t) => this.add(t, e));
|
|
2055
2420
|
}
|
|
2056
2421
|
static setUrl(e) {
|
|
2057
2422
|
this.url = e;
|
|
2058
2423
|
}
|
|
2424
|
+
static setConfig(e) {
|
|
2425
|
+
e.url && this.setUrl(e.url), e.list && this.addByList(e.list);
|
|
2426
|
+
}
|
|
2059
2427
|
static getName(e) {
|
|
2060
2428
|
return `@${e}`;
|
|
2061
2429
|
}
|
|
2062
2430
|
static wait() {
|
|
2063
|
-
return new Promise((e) => setTimeout(() => e(),
|
|
2431
|
+
return new Promise((e) => setTimeout(() => e(), Ue));
|
|
2064
2432
|
}
|
|
2065
2433
|
};
|
|
2066
|
-
|
|
2434
|
+
Ve = U, b(U, "icons", {}), b(U, "url", "/icons/"), f() && (He in window || (window[He] = {}), Ve.icons = window[He]);
|
|
2067
2435
|
//#endregion
|
|
2068
2436
|
//#region src/functions/getElementItem.ts
|
|
2069
|
-
function
|
|
2437
|
+
function Ge(e, t, n) {
|
|
2070
2438
|
var r, i;
|
|
2071
|
-
return (r = (i =
|
|
2439
|
+
return (r = (i = T(e)) == null ? void 0 : i[t]) == null ? n : r;
|
|
2072
2440
|
}
|
|
2073
2441
|
//#endregion
|
|
2074
2442
|
//#region src/functions/setElementItem.ts
|
|
2075
|
-
function
|
|
2076
|
-
let a =
|
|
2443
|
+
function Ke(e, n, r) {
|
|
2444
|
+
let a = T(e);
|
|
2077
2445
|
if (a) {
|
|
2078
|
-
let e =
|
|
2079
|
-
if (
|
|
2080
|
-
e[n] =
|
|
2446
|
+
let e = Ge(a, n);
|
|
2447
|
+
if (t(e) && t(r)) i(r, (t, n) => {
|
|
2448
|
+
e[n] = _(t);
|
|
2081
2449
|
});
|
|
2082
2450
|
else {
|
|
2083
|
-
let e =
|
|
2084
|
-
!(
|
|
2451
|
+
let e = _(r);
|
|
2452
|
+
!(n in a) && typeof e == "string" ? a.setAttribute(n.toString(), e) : a[n] = _(r);
|
|
2085
2453
|
}
|
|
2086
2454
|
}
|
|
2087
2455
|
return a;
|
|
2088
2456
|
}
|
|
2089
2457
|
//#endregion
|
|
2090
2458
|
//#region src/functions/createElement.ts
|
|
2091
|
-
function W(e, t = "div",
|
|
2092
|
-
if (!
|
|
2093
|
-
let
|
|
2094
|
-
return typeof
|
|
2095
|
-
|
|
2096
|
-
}), e == null || e.insertBefore(
|
|
2459
|
+
function W(e, t = "div", r, a) {
|
|
2460
|
+
if (!f()) return;
|
|
2461
|
+
let o = document.createElement(t);
|
|
2462
|
+
return typeof r == "function" ? r(o) : n(r) && i(r, (e, t) => {
|
|
2463
|
+
Ke(o, t, e);
|
|
2464
|
+
}), e == null || e.insertBefore(o, a == null ? null : a), o;
|
|
2097
2465
|
}
|
|
2098
2466
|
//#endregion
|
|
2099
2467
|
//#region src/functions/encodeAttribute.ts
|
|
2100
|
-
function
|
|
2468
|
+
function qe(e) {
|
|
2101
2469
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").trim();
|
|
2102
2470
|
}
|
|
2103
2471
|
//#endregion
|
|
2104
2472
|
//#region src/classes/MetaManager.ts
|
|
2105
2473
|
var G = class {
|
|
2106
2474
|
constructor(e, t = !1) {
|
|
2107
|
-
|
|
2475
|
+
b(this, "items", {}), this.listMeta = e, this.isProperty = t, this.update();
|
|
2108
2476
|
}
|
|
2109
2477
|
getListMeta() {
|
|
2110
2478
|
return this.listMeta;
|
|
@@ -2117,19 +2485,19 @@ var G = class {
|
|
|
2117
2485
|
return this.items;
|
|
2118
2486
|
}
|
|
2119
2487
|
html() {
|
|
2120
|
-
return
|
|
2488
|
+
return i(this.listMeta, (e) => this.toHtmlString(e)).join("");
|
|
2121
2489
|
}
|
|
2122
2490
|
set(e, t) {
|
|
2123
2491
|
return this.setItem(e, t).setMeta(e), this;
|
|
2124
2492
|
}
|
|
2125
2493
|
setByList(e) {
|
|
2126
|
-
return
|
|
2494
|
+
return i(e, (e, t) => this.set(t, String(e))), this;
|
|
2127
2495
|
}
|
|
2128
2496
|
getAttributeName() {
|
|
2129
2497
|
return this.isProperty ? "property" : "name";
|
|
2130
2498
|
}
|
|
2131
2499
|
findMetaElement(e) {
|
|
2132
|
-
if (!
|
|
2500
|
+
if (!f()) return;
|
|
2133
2501
|
let t = `meta[${this.getAttributeName()}="${e}"]`;
|
|
2134
2502
|
return document.querySelector(t) || void 0;
|
|
2135
2503
|
}
|
|
@@ -2140,7 +2508,7 @@ var G = class {
|
|
|
2140
2508
|
var t;
|
|
2141
2509
|
let n = this.findMetaElement(e), r = (t = this.items[e]) == null ? "" : t;
|
|
2142
2510
|
if (n) n.content = r;
|
|
2143
|
-
else if (
|
|
2511
|
+
else if (f()) {
|
|
2144
2512
|
let t = { content: r };
|
|
2145
2513
|
this.isProperty ? t.property = e : t.name = e, W(document.head, "meta", t);
|
|
2146
2514
|
}
|
|
@@ -2148,7 +2516,7 @@ var G = class {
|
|
|
2148
2516
|
}
|
|
2149
2517
|
toHtmlString(e) {
|
|
2150
2518
|
var t;
|
|
2151
|
-
let n =
|
|
2519
|
+
let n = qe((t = this.items[e]) == null ? "" : t);
|
|
2152
2520
|
return n ? `<meta ${this.getAttributeName()}="${e}" content="${n}">` : "";
|
|
2153
2521
|
}
|
|
2154
2522
|
update() {
|
|
@@ -2159,25 +2527,25 @@ var G = class {
|
|
|
2159
2527
|
}
|
|
2160
2528
|
}, K = /* @__PURE__ */ function(e) {
|
|
2161
2529
|
return e.description = "description", e.keywords = "keywords", e.canonical = "canonical", e.robots = "robots", e.author = "author", e;
|
|
2162
|
-
}({}),
|
|
2530
|
+
}({}), Je = /* @__PURE__ */ function(e) {
|
|
2163
2531
|
return e.indexFollow = "index, follow", e.noIndexFollow = "noindex, follow", e.indexNoFollow = "index, nofollow", e.noIndexNoFollow = "noindex, nofollow", e.noArchive = "noarchive", e.noSnippet = "nosnippet", e.noImageIndex = "noimageindex", e.images = "images", e.noTranslate = "notranslate", e.noPreview = "nopreview", e.textOnly = "textonly", e.noIndexSubpages = "noindex, noarchive", e.none = "none", e;
|
|
2164
2532
|
}({}), q = /* @__PURE__ */ function(e) {
|
|
2165
2533
|
return e.title = "og:title", e.type = "og:type", e.url = "og:url", e.image = "og:image", e.description = "og:description", e.locale = "og:locale", e.siteName = "og:site_name", e.localeAlternate = "og:locale:alternate", e.imageUrl = "og:image:url", e.imageSecureUrl = "og:image:secure_url", e.imageType = "og:image:type", e.imageWidth = "og:image:width", e.imageHeight = "og:image:height", e.imageAlt = "og:image:alt", e.video = "og:video", e.videoUrl = "og:video:url", e.videoSecureUrl = "og:video:secure_url", e.videoType = "og:video:type", e.videoWidth = "og:video:width", e.videoHeight = "og:video:height", e.audio = "og:audio", e.audioSecureUrl = "og:audio:secure_url", e.audioType = "og:audio:type", e.articlePublishedTime = "article:published_time", e.articleModifiedTime = "article:modified_time", e.articleExpirationTime = "article:expiration_time", e.articleAuthor = "article:author", e.articleSection = "article:section", e.articleTag = "article:tag", e.bookAuthor = "book:author", e.bookIsbn = "book:isbn", e.bookReleaseDate = "book:release_date", e.bookTag = "book:tag", e.musicDuration = "music:duration", e.musicAlbum = "music:album", e.musicAlbumDisc = "music:album:disc", e.musicAlbumTrack = "music:album:track", e.musicMusician = "music:musician", e.musicSong = "music:song", e.musicSongDisc = "music:song:disc", e.musicSongTrack = "music:song:track", e.musicReleaseDate = "music:release_date", e.musicCreator = "music:creator", e.videoActor = "video:actor", e.videoActorRole = "video:actor:role", e.videoDirector = "video:director", e.videoWriter = "video:writer", e.videoDuration = "video:duration", e.videoReleaseDate = "video:release_date", e.videoTag = "video:tag", e.videoSeries = "video:series", e.profileFirstName = "profile:first_name", e.profileLastName = "profile:last_name", e.profileUsername = "profile:username", e.profileGender = "profile:gender", e.productBrand = "product:brand", e.productAvailability = "product:availability", e.productCondition = "product:condition", e.productPriceAmount = "product:price:amount", e.productPriceCurrency = "product:price:currency", e.productRetailerItemId = "product:retailer_item_id", e.productCategory = "product:category", e.productEan = "product:ean", e.productIsbn = "product:isbn", e.productMfrPartNo = "product:mfr_part_no", e.productUpc = "product:upc", e.productWeightValue = "product:weight:value", e.productWeightUnits = "product:weight:units", e.productColor = "product:color", e.productMaterial = "product:material", e.productPattern = "product:pattern", e.productAgeGroup = "product:age_group", e.productGender = "product:gender", e;
|
|
2166
|
-
}({}),
|
|
2534
|
+
}({}), Ye = /* @__PURE__ */ function(e) {
|
|
2167
2535
|
return e.website = "website", e.article = "article", e.video = "video.other", e.videoTvShow = "video.tv_show", e.videoEpisode = "video.episode", e.videoMovie = "video.movie", e.musicAlbum = "music.album", e.musicPlaylist = "music.playlist", e.musicSong = "music.song", e.musicRadioStation = "music.radio_station", e.app = "app", e.product = "product", e.business = "business.business", e.place = "place", e.event = "event", e.profile = "profile", e.book = "book", e;
|
|
2168
|
-
}({}),
|
|
2536
|
+
}({}), Xe = /* @__PURE__ */ function(e) {
|
|
2169
2537
|
return e.inStock = "in stock", e.outOfStock = "out of stock", e.preorder = "preorder", e.backorder = "backorder", e.discontinued = "discontinued", e.pending = "pending", e;
|
|
2170
|
-
}({}),
|
|
2538
|
+
}({}), Ze = /* @__PURE__ */ function(e) {
|
|
2171
2539
|
return e.new = "new", e.used = "used", e.refurbished = "refurbished", e;
|
|
2172
|
-
}({}),
|
|
2540
|
+
}({}), Qe = /* @__PURE__ */ function(e) {
|
|
2173
2541
|
return e.newborn = "newborn", e.infant = "infant", e.toddler = "toddler", e.kids = "kids", e.adult = "adult", e;
|
|
2174
|
-
}({}),
|
|
2542
|
+
}({}), $e = /* @__PURE__ */ function(e) {
|
|
2175
2543
|
return e.female = "female", e.male = "male", e.unisex = "unisex", e;
|
|
2176
2544
|
}({}), J = /* @__PURE__ */ function(e) {
|
|
2177
2545
|
return e.card = "twitter:card", e.site = "twitter:site", e.creator = "twitter:creator", e.url = "twitter:url", e.title = "twitter:title", e.description = "twitter:description", e.image = "twitter:image", e.imageAlt = "twitter:image:alt", e.imageSrc = "twitter:image:src", e.imageWidth = "twitter:image:width", e.imageHeight = "twitter:image:height", e.label1 = "twitter:label1", e.data1 = "twitter:data1", e.label2 = "twitter:label2", e.data2 = "twitter:data2", e.appNameIphone = "twitter:app:name:iphone", e.appIdIphone = "twitter:app:id:iphone", e.appUrlIphone = "twitter:app:url:iphone", e.appNameIpad = "twitter:app:name:ipad", e.appIdIpad = "twitter:app:id:ipad", e.appUrlIpad = "twitter:app:url:ipad", e.appNameGooglePlay = "twitter:app:name:googleplay", e.appIdGooglePlay = "twitter:app:id:googleplay", e.appUrlGooglePlay = "twitter:app:url:googleplay", e.player = "twitter:player", e.playerWidth = "twitter:player:width", e.playerHeight = "twitter:player:height", e.playerStream = "twitter:player:stream", e.playerStreamContentType = "twitter:player:stream:content_type", e;
|
|
2178
|
-
}({}),
|
|
2546
|
+
}({}), et = /* @__PURE__ */ function(e) {
|
|
2179
2547
|
return e.summary = "summary", e.summaryLargeImage = "summary_large_image", e.app = "app", e.player = "player", e.product = "product", e.gallery = "gallery", e.photo = "photo", e.leadGeneration = "lead_generation", e.audio = "audio", e.poll = "poll", e;
|
|
2180
|
-
}({}),
|
|
2548
|
+
}({}), tt = class extends G {
|
|
2181
2549
|
constructor() {
|
|
2182
2550
|
super(Object.values(q), !0);
|
|
2183
2551
|
}
|
|
@@ -2223,7 +2591,7 @@ var G = class {
|
|
|
2223
2591
|
setSiteName(e) {
|
|
2224
2592
|
return this.set(q.siteName, e);
|
|
2225
2593
|
}
|
|
2226
|
-
},
|
|
2594
|
+
}, nt = class extends G {
|
|
2227
2595
|
constructor() {
|
|
2228
2596
|
super(Object.values(J));
|
|
2229
2597
|
}
|
|
@@ -2269,9 +2637,9 @@ var G = class {
|
|
|
2269
2637
|
setImage(e) {
|
|
2270
2638
|
return this.set(J.image, e), this;
|
|
2271
2639
|
}
|
|
2272
|
-
},
|
|
2640
|
+
}, rt = class extends G {
|
|
2273
2641
|
constructor() {
|
|
2274
|
-
super(Object.values(K)),
|
|
2642
|
+
super(Object.values(K)), b(this, "suffix", void 0), b(this, "og", void 0), b(this, "twitter", void 0), this.og = new tt(), this.twitter = new nt();
|
|
2275
2643
|
}
|
|
2276
2644
|
getOg() {
|
|
2277
2645
|
return this.og;
|
|
@@ -2280,7 +2648,7 @@ var G = class {
|
|
|
2280
2648
|
return this.twitter;
|
|
2281
2649
|
}
|
|
2282
2650
|
getTitle() {
|
|
2283
|
-
return
|
|
2651
|
+
return f() ? document.title.replace(this.getSuffix(), "").trim() : "";
|
|
2284
2652
|
}
|
|
2285
2653
|
getKeywords() {
|
|
2286
2654
|
return this.get(K.keywords);
|
|
@@ -2307,8 +2675,8 @@ var G = class {
|
|
|
2307
2675
|
return this.og.getLocale();
|
|
2308
2676
|
}
|
|
2309
2677
|
setTitle(e) {
|
|
2310
|
-
if (
|
|
2311
|
-
let t =
|
|
2678
|
+
if (f()) {
|
|
2679
|
+
let t = c(e) ? `${e}${this.getSuffix()}` : this.suffix ? this.suffix : "";
|
|
2312
2680
|
document.title = t, this.og.setTitle(t), this.twitter.setTitle(t);
|
|
2313
2681
|
}
|
|
2314
2682
|
return this;
|
|
@@ -2344,7 +2712,7 @@ var G = class {
|
|
|
2344
2712
|
return `${super.html()}${this.og.html()}${this.twitter.html()}`;
|
|
2345
2713
|
}
|
|
2346
2714
|
getSuffix() {
|
|
2347
|
-
return
|
|
2715
|
+
return c(this.suffix) ? ` - ${this.suffix}` : "";
|
|
2348
2716
|
}
|
|
2349
2717
|
}, Y = class {
|
|
2350
2718
|
static async is() {
|
|
@@ -2383,7 +2751,7 @@ var G = class {
|
|
|
2383
2751
|
});
|
|
2384
2752
|
}
|
|
2385
2753
|
};
|
|
2386
|
-
|
|
2754
|
+
b(Y, "storage", new S("scrollbar", !0)), b(Y, "calculate", !1);
|
|
2387
2755
|
//#endregion
|
|
2388
2756
|
//#region src/functions/escapeExp.ts
|
|
2389
2757
|
function X(e) {
|
|
@@ -2391,20 +2759,20 @@ function X(e) {
|
|
|
2391
2759
|
}
|
|
2392
2760
|
//#endregion
|
|
2393
2761
|
//#region src/functions/getSeparatingSearchExp.ts
|
|
2394
|
-
function
|
|
2395
|
-
let t =
|
|
2762
|
+
function it(e) {
|
|
2763
|
+
let t = i(e.split(" "), (e) => X(e)).join("|");
|
|
2396
2764
|
return RegExp(`(${t})`, "ig");
|
|
2397
2765
|
}
|
|
2398
2766
|
//#endregion
|
|
2399
2767
|
//#region src/functions/addTagHighlightMatch.ts
|
|
2400
|
-
function
|
|
2401
|
-
return t ? String(e).replace(
|
|
2768
|
+
function at(e, t, n = "sys-highlight-match") {
|
|
2769
|
+
return t ? String(e).replace(it(t), `<span class="${n}">$1</span>`) : e;
|
|
2402
2770
|
}
|
|
2403
2771
|
//#endregion
|
|
2404
2772
|
//#region src/classes/SearchListData.ts
|
|
2405
|
-
var
|
|
2773
|
+
var ot = class {
|
|
2406
2774
|
constructor(e, t, n, r) {
|
|
2407
|
-
|
|
2775
|
+
b(this, "listCache", void 0), this.list = e, this.columns = t, this.item = n, this.options = r;
|
|
2408
2776
|
}
|
|
2409
2777
|
is() {
|
|
2410
2778
|
return !!(this.list && this.columns);
|
|
@@ -2441,8 +2809,8 @@ var nt = class {
|
|
|
2441
2809
|
toFormatItem(e, t) {
|
|
2442
2810
|
let n = {};
|
|
2443
2811
|
return this.columns && this.columns.forEach((r) => {
|
|
2444
|
-
let i = this.getColumnName(r), a =
|
|
2445
|
-
n[i] =
|
|
2812
|
+
let i = this.getColumnName(r), a = z(e, r);
|
|
2813
|
+
n[i] = c(a) && t ? this.addTag(a) : R(a);
|
|
2446
2814
|
}), {
|
|
2447
2815
|
...e,
|
|
2448
2816
|
...n,
|
|
@@ -2453,7 +2821,7 @@ var nt = class {
|
|
|
2453
2821
|
return e.replace(/\.([a-z0-9])/gi, (e, t) => t.toUpperCase()) + "Search";
|
|
2454
2822
|
}
|
|
2455
2823
|
addTag(e) {
|
|
2456
|
-
return
|
|
2824
|
+
return at(R(e), this.item.get(), this.options.getClassName());
|
|
2457
2825
|
}
|
|
2458
2826
|
generateCache() {
|
|
2459
2827
|
if (!this.isList()) return [];
|
|
@@ -2461,8 +2829,8 @@ var nt = class {
|
|
|
2461
2829
|
for (let t of this.list) {
|
|
2462
2830
|
let n = "";
|
|
2463
2831
|
if (this.columns) for (let e of this.columns) {
|
|
2464
|
-
let r =
|
|
2465
|
-
|
|
2832
|
+
let r = z(t, e);
|
|
2833
|
+
c(r) && (n += ` ${R(r)}`);
|
|
2466
2834
|
}
|
|
2467
2835
|
e.push({
|
|
2468
2836
|
item: t,
|
|
@@ -2477,7 +2845,7 @@ var nt = class {
|
|
|
2477
2845
|
resetCache() {
|
|
2478
2846
|
this.listCache = void 0;
|
|
2479
2847
|
}
|
|
2480
|
-
},
|
|
2848
|
+
}, st = class {
|
|
2481
2849
|
constructor(e, t) {
|
|
2482
2850
|
this.value = e, this.options = t;
|
|
2483
2851
|
}
|
|
@@ -2497,29 +2865,29 @@ var nt = class {
|
|
|
2497
2865
|
};
|
|
2498
2866
|
//#endregion
|
|
2499
2867
|
//#region src/functions/getExp.ts
|
|
2500
|
-
function
|
|
2868
|
+
function ct(e, t = "ig", n = ":value") {
|
|
2501
2869
|
let r = X(e);
|
|
2502
2870
|
return new RegExp(n.replace(/:value/g, r), t);
|
|
2503
2871
|
}
|
|
2504
2872
|
//#endregion
|
|
2505
2873
|
//#region src/functions/getExactSearchExp.ts
|
|
2506
|
-
function
|
|
2507
|
-
return
|
|
2874
|
+
function lt(e) {
|
|
2875
|
+
return ct(e, "i", "(:value)");
|
|
2508
2876
|
}
|
|
2509
2877
|
//#endregion
|
|
2510
2878
|
//#region src/functions/getSearchExp.ts
|
|
2511
|
-
function
|
|
2879
|
+
function ut(e) {
|
|
2512
2880
|
let t = "";
|
|
2513
2881
|
return e.split(" ").forEach((e) => {
|
|
2514
2882
|
let n = X(e).trim();
|
|
2515
|
-
|
|
2883
|
+
c(n) && (t += `(?=.*?${n})`);
|
|
2516
2884
|
}), RegExp(`^${t}`, "ig");
|
|
2517
2885
|
}
|
|
2518
2886
|
//#endregion
|
|
2519
2887
|
//#region src/classes/SearchListMatcher.ts
|
|
2520
|
-
var
|
|
2888
|
+
var dt = class {
|
|
2521
2889
|
constructor(e, t) {
|
|
2522
|
-
|
|
2890
|
+
b(this, "matcher", void 0), this.item = e, this.options = t, this.initMatcher();
|
|
2523
2891
|
}
|
|
2524
2892
|
is() {
|
|
2525
2893
|
return !!this.matcher;
|
|
@@ -2534,9 +2902,9 @@ var st = class {
|
|
|
2534
2902
|
this.initMatcher();
|
|
2535
2903
|
}
|
|
2536
2904
|
initMatcher() {
|
|
2537
|
-
this.item.is() ? this.matcher = this.options.getFindExactMatch() ?
|
|
2905
|
+
this.item.is() ? this.matcher = this.options.getFindExactMatch() ? lt(this.item.get()) : ut(this.item.get()) : this.matcher = void 0;
|
|
2538
2906
|
}
|
|
2539
|
-
},
|
|
2907
|
+
}, ft = class {
|
|
2540
2908
|
constructor(e) {
|
|
2541
2909
|
this.options = e;
|
|
2542
2910
|
}
|
|
@@ -2566,12 +2934,12 @@ var st = class {
|
|
|
2566
2934
|
setOptions(e) {
|
|
2567
2935
|
return this.options = e, this;
|
|
2568
2936
|
}
|
|
2569
|
-
},
|
|
2937
|
+
}, pt = class {
|
|
2570
2938
|
constructor(e, t, n, r) {
|
|
2571
|
-
|
|
2939
|
+
b(this, "options", void 0), b(this, "item", void 0), b(this, "matcher", void 0), b(this, "data", void 0), b(this, "callbackToSelection", (e, t) => {
|
|
2572
2940
|
if (this.matcher.isSelection(t)) return this.data.toFormatItem(e, !0);
|
|
2573
2941
|
if (this.options.getReturnEverything()) return this.data.toFormatItem(e, !1);
|
|
2574
|
-
}),
|
|
2942
|
+
}), b(this, "callbackToNone", (e) => this.data.toFormatItem(e, !1)), this.options = new ft(r), this.item = new st(n, this.options), this.matcher = new dt(this.item, this.options), this.data = new ot(e, t, this.item, this.options);
|
|
2575
2943
|
}
|
|
2576
2944
|
getData() {
|
|
2577
2945
|
return this.data;
|
|
@@ -2606,9 +2974,9 @@ var st = class {
|
|
|
2606
2974
|
to() {
|
|
2607
2975
|
if (this.item.isSearch()) return this.data.forEach(this.callbackToSelection);
|
|
2608
2976
|
let e = this.data.getList();
|
|
2609
|
-
return e ?
|
|
2977
|
+
return e ? i(e, this.callbackToNone) : [];
|
|
2610
2978
|
}
|
|
2611
|
-
},
|
|
2979
|
+
}, mt = [
|
|
2612
2980
|
"d",
|
|
2613
2981
|
"e",
|
|
2614
2982
|
"f",
|
|
@@ -2628,62 +2996,72 @@ var st = class {
|
|
|
2628
2996
|
"t",
|
|
2629
2997
|
"u",
|
|
2630
2998
|
"v"
|
|
2631
|
-
],
|
|
2632
|
-
let
|
|
2999
|
+
], ht = (e, t = {}) => {
|
|
3000
|
+
let r = String(e);
|
|
2633
3001
|
if (e.match(/%[a-z]/)) {
|
|
2634
3002
|
let e = 0;
|
|
2635
|
-
|
|
2636
|
-
|
|
3003
|
+
i(t, (t) => {
|
|
3004
|
+
r = r.replace(RegExp(`%${mt[e++]}`, "g"), String(t));
|
|
2637
3005
|
});
|
|
2638
3006
|
}
|
|
2639
|
-
return
|
|
2640
|
-
|
|
2641
|
-
}),
|
|
2642
|
-
},
|
|
2643
|
-
|
|
3007
|
+
return n(t) && i(t, (e, t) => {
|
|
3008
|
+
r = r.replace(RegExp(`(?:\\[|\\{)${t}(?:\\]|\\})(.*?)(?:\\[|\\{)\\/${t}(?:\\]|\\})`, "g"), (t, n) => String(e).replace(/(?:\[|\{)content(?:\]|\})/g, n)).replace(RegExp(`(?:\\[|\\{)${t}(?:\\]|\\})`, "g"), String(e));
|
|
3009
|
+
}), r;
|
|
3010
|
+
}, gt = "global", _t = 160, vt = class {
|
|
3011
|
+
constructor(e, t = () => w.getLanguage(), n = () => w.getLocation()) {
|
|
3012
|
+
b(this, "files", {}), b(this, "data", {}), this.language = t, this.location = n, e && this.add(e);
|
|
3013
|
+
}
|
|
3014
|
+
isFile() {
|
|
2644
3015
|
return Object.keys(this.files).length > 0 && this.getIndex() !== void 0;
|
|
2645
3016
|
}
|
|
2646
|
-
|
|
3017
|
+
getLocation() {
|
|
3018
|
+
return _(this.location);
|
|
3019
|
+
}
|
|
3020
|
+
getLanguage() {
|
|
3021
|
+
return _(this.language);
|
|
3022
|
+
}
|
|
3023
|
+
async getList() {
|
|
2647
3024
|
let e = this.getIndex();
|
|
2648
3025
|
if (e) {
|
|
2649
3026
|
var t;
|
|
2650
3027
|
return (t = this.getByData(e)) == null ? await this.getByFile(e) : t;
|
|
2651
3028
|
}
|
|
2652
3029
|
}
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
3030
|
+
add(e) {
|
|
3031
|
+
i(e, (e, t) => {
|
|
3032
|
+
g(e) && (this.files[t] = e);
|
|
2656
3033
|
});
|
|
2657
3034
|
}
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
if (
|
|
2661
|
-
|
|
3035
|
+
getIndex() {
|
|
3036
|
+
let e = this.getLocation();
|
|
3037
|
+
if (e in this.files) return e;
|
|
3038
|
+
let t = this.getLanguage();
|
|
3039
|
+
if (t in this.files) return t;
|
|
3040
|
+
if ("global" in this.files) return gt;
|
|
2662
3041
|
}
|
|
2663
|
-
|
|
3042
|
+
getByData(e) {
|
|
2664
3043
|
if (e in this.data) return this.data[e];
|
|
2665
3044
|
}
|
|
2666
|
-
|
|
3045
|
+
async getByFile(e) {
|
|
2667
3046
|
if (e in this.files) {
|
|
2668
|
-
let t = await
|
|
3047
|
+
let t = await _(this.files[e]);
|
|
2669
3048
|
return t && (this.data[e] = t), t;
|
|
2670
3049
|
}
|
|
2671
3050
|
}
|
|
2672
|
-
}
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
static async get(e, t) {
|
|
3051
|
+
}, yt = class {
|
|
3052
|
+
constructor(e = "/api/translate", t = "list", n = new vt()) {
|
|
3053
|
+
b(this, "data", {}), b(this, "cache", []), b(this, "resolveList", []), b(this, "timeout", void 0), b(this, "isReadApi", !0), this.url = e, this.propsName = t, this.files = n;
|
|
3054
|
+
}
|
|
3055
|
+
async get(e, t) {
|
|
2678
3056
|
var n;
|
|
2679
3057
|
let r = this.getText(e);
|
|
2680
|
-
return r ? this.replacement(r, t) : (
|
|
3058
|
+
return r ? this.replacement(r, t) : (A.isLocalhost() || await this.add(e), this.replacement((n = this.getText(e)) == null ? e : n));
|
|
2681
3059
|
}
|
|
2682
|
-
|
|
3060
|
+
getSync(e, t = !1, n) {
|
|
2683
3061
|
let r = this.getText(e);
|
|
2684
3062
|
return r ? this.replacement(r, n) : t ? " " : e;
|
|
2685
3063
|
}
|
|
2686
|
-
|
|
3064
|
+
getList(e) {
|
|
2687
3065
|
return new Promise((t) => {
|
|
2688
3066
|
let n = {}, r = 0;
|
|
2689
3067
|
for (let i of e) {
|
|
@@ -2694,7 +3072,7 @@ var Q = class e {
|
|
|
2694
3072
|
}
|
|
2695
3073
|
});
|
|
2696
3074
|
}
|
|
2697
|
-
|
|
3075
|
+
getListSync(e, t = !1) {
|
|
2698
3076
|
let n = {};
|
|
2699
3077
|
for (let r of e) {
|
|
2700
3078
|
let e = Array.isArray(r) ? r[0] : r, i = Array.isArray(r) ? r.slice(1) : void 0;
|
|
@@ -2702,49 +3080,50 @@ var Q = class e {
|
|
|
2702
3080
|
}
|
|
2703
3081
|
return n;
|
|
2704
3082
|
}
|
|
2705
|
-
|
|
3083
|
+
add(e) {
|
|
2706
3084
|
return new Promise((t) => {
|
|
2707
|
-
|
|
3085
|
+
let n = this.getNamesNone(e);
|
|
3086
|
+
n.length > 0 ? (this.cache.push(...n), this.resolveList.push(t), this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(() => {
|
|
2708
3087
|
this.timeout = void 0, this.make().then(() => {
|
|
2709
3088
|
this.resolveList.forEach((e) => e()), this.resolveList = [];
|
|
2710
3089
|
});
|
|
2711
3090
|
}, 160)) : t();
|
|
2712
3091
|
});
|
|
2713
3092
|
}
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
3093
|
+
addSync(e) {
|
|
3094
|
+
i(e, (e, t) => {
|
|
3095
|
+
u(e) && c(e) && (this.data[this.getName(t)] = e);
|
|
2717
3096
|
});
|
|
2718
3097
|
}
|
|
2719
|
-
|
|
2720
|
-
if (
|
|
3098
|
+
async addNormalOrSync(e) {
|
|
3099
|
+
if (c(e)) if (A.isLocalhost()) this.addSync(e);
|
|
2721
3100
|
else {
|
|
2722
3101
|
let t = Object.keys(e);
|
|
2723
3102
|
t.length > 0 && await this.add(t);
|
|
2724
3103
|
}
|
|
2725
3104
|
}
|
|
2726
|
-
|
|
2727
|
-
|
|
3105
|
+
addSyncByLocation(e) {
|
|
3106
|
+
i(e, (e, t) => i(e, (e, n) => {
|
|
2728
3107
|
let r = `${t}-${n}`;
|
|
2729
3108
|
r in this.data || (this.data[r] = e);
|
|
2730
3109
|
}));
|
|
2731
3110
|
}
|
|
2732
|
-
|
|
2733
|
-
|
|
3111
|
+
addSyncByFile(e) {
|
|
3112
|
+
this.files.add(e);
|
|
2734
3113
|
}
|
|
2735
|
-
|
|
2736
|
-
return this.url =
|
|
3114
|
+
setUrl(e) {
|
|
3115
|
+
return this.url = e, this;
|
|
2737
3116
|
}
|
|
2738
|
-
|
|
3117
|
+
setPropsName(e) {
|
|
2739
3118
|
return this.propsName = e, this;
|
|
2740
3119
|
}
|
|
2741
|
-
|
|
3120
|
+
setReadApi(e) {
|
|
2742
3121
|
return this.isReadApi = e, this;
|
|
2743
3122
|
}
|
|
2744
|
-
|
|
3123
|
+
hasName(e) {
|
|
2745
3124
|
return this.getName(e) in this.data || this.getNameByLanguage(e) in this.data || this.getNameByGlobal(e) in this.data;
|
|
2746
3125
|
}
|
|
2747
|
-
|
|
3126
|
+
getText(e) {
|
|
2748
3127
|
let t = this.getName(e);
|
|
2749
3128
|
if (t in this.data) return this.data[t];
|
|
2750
3129
|
let n = this.getNameByLanguage(e);
|
|
@@ -2752,23 +3131,23 @@ var Q = class e {
|
|
|
2752
3131
|
let r = this.getNameByGlobal(e);
|
|
2753
3132
|
if (r in this.data) return this.data[r];
|
|
2754
3133
|
}
|
|
2755
|
-
|
|
2756
|
-
return `${
|
|
3134
|
+
getName(e) {
|
|
3135
|
+
return `${this.files.getLocation()}-${e}`;
|
|
2757
3136
|
}
|
|
2758
|
-
|
|
2759
|
-
return `${
|
|
3137
|
+
getNameByLanguage(e) {
|
|
3138
|
+
return `${this.files.getLanguage()}-${e}`;
|
|
2760
3139
|
}
|
|
2761
|
-
|
|
2762
|
-
return `${
|
|
3140
|
+
getNameByGlobal(e) {
|
|
3141
|
+
return `${gt}-${e}`;
|
|
2763
3142
|
}
|
|
2764
|
-
|
|
3143
|
+
getNamesNone(e) {
|
|
2765
3144
|
let t = [];
|
|
2766
3145
|
return E(e).forEach((e) => {
|
|
2767
|
-
e !== "__TRANSLATE_START__" && e !== "__TRANSLATE_END__" && !
|
|
3146
|
+
e !== "__TRANSLATE_START__" && e !== "__TRANSLATE_END__" && !this.hasName(e) && t.push(e);
|
|
2768
3147
|
}), t;
|
|
2769
3148
|
}
|
|
2770
|
-
|
|
2771
|
-
let e = await
|
|
3149
|
+
async getResponse() {
|
|
3150
|
+
let e = await A.get({
|
|
2772
3151
|
api: !1,
|
|
2773
3152
|
path: this.url,
|
|
2774
3153
|
request: { [this.propsName]: this.cache },
|
|
@@ -2777,29 +3156,72 @@ var Q = class e {
|
|
|
2777
3156
|
});
|
|
2778
3157
|
return e == null ? {} : e;
|
|
2779
3158
|
}
|
|
2780
|
-
|
|
2781
|
-
return t ?
|
|
3159
|
+
replacement(e, t) {
|
|
3160
|
+
return t ? ht(e, t) : e;
|
|
2782
3161
|
}
|
|
2783
|
-
|
|
3162
|
+
async make() {
|
|
2784
3163
|
let e;
|
|
2785
|
-
|
|
3164
|
+
this.files.isFile() ? e = await this.files.getList() : this.isReadApi && (e = await this.getResponse()), e && this.makeList(e);
|
|
2786
3165
|
}
|
|
2787
|
-
|
|
3166
|
+
makeList(e) {
|
|
2788
3167
|
this.cache.forEach((t) => {
|
|
2789
3168
|
var n;
|
|
2790
3169
|
this.data[this.getName(t)] = (n = e == null ? void 0 : e[t]) == null ? "" : n;
|
|
2791
3170
|
}), this.cache = [];
|
|
2792
3171
|
}
|
|
3172
|
+
}, bt = class {
|
|
3173
|
+
static async get(e, t) {
|
|
3174
|
+
return this.item.get(e, t);
|
|
3175
|
+
}
|
|
3176
|
+
static getItem() {
|
|
3177
|
+
return this.item;
|
|
3178
|
+
}
|
|
3179
|
+
static getSync(e, t = !1, n) {
|
|
3180
|
+
return this.item.getSync(e, t, n);
|
|
3181
|
+
}
|
|
3182
|
+
static getList(e) {
|
|
3183
|
+
return this.item.getList(e);
|
|
3184
|
+
}
|
|
3185
|
+
static getListSync(e, t = !1) {
|
|
3186
|
+
return this.item.getListSync(e, t);
|
|
3187
|
+
}
|
|
3188
|
+
static async add(e) {
|
|
3189
|
+
await this.item.add(e);
|
|
3190
|
+
}
|
|
3191
|
+
static addSync(e) {
|
|
3192
|
+
this.item.addSync(e);
|
|
3193
|
+
}
|
|
3194
|
+
static async addNormalOrSync(e) {
|
|
3195
|
+
await this.item.addNormalOrSync(e);
|
|
3196
|
+
}
|
|
3197
|
+
static addSyncByLocation(e) {
|
|
3198
|
+
this.item.addSyncByLocation(e);
|
|
3199
|
+
}
|
|
3200
|
+
static addSyncByFile(e) {
|
|
3201
|
+
this.item.addSyncByFile(e);
|
|
3202
|
+
}
|
|
3203
|
+
static setUrl(e) {
|
|
3204
|
+
return this.item.setUrl(e), this;
|
|
3205
|
+
}
|
|
3206
|
+
static setPropsName(e) {
|
|
3207
|
+
return this.item.setPropsName(e), this;
|
|
3208
|
+
}
|
|
3209
|
+
static setReadApi(e) {
|
|
3210
|
+
return this.item.setReadApi(e), this;
|
|
3211
|
+
}
|
|
3212
|
+
static setConfig(e) {
|
|
3213
|
+
return e.url && this.item.setUrl(e.url), e.propsName && this.item.setPropsName(e.propsName), typeof e.readApi == "boolean" && this.item.setReadApi(e.readApi), this;
|
|
3214
|
+
}
|
|
2793
3215
|
};
|
|
2794
|
-
|
|
3216
|
+
b(bt, "item", new yt());
|
|
2795
3217
|
//#endregion
|
|
2796
3218
|
//#region src/functions/arrFill.ts
|
|
2797
|
-
function
|
|
3219
|
+
function xt(e, t) {
|
|
2798
3220
|
return Array(t).fill(e);
|
|
2799
3221
|
}
|
|
2800
3222
|
//#endregion
|
|
2801
3223
|
//#region src/functions/blobToBase64.ts
|
|
2802
|
-
function
|
|
3224
|
+
function St(e) {
|
|
2803
3225
|
return new Promise((t, n) => {
|
|
2804
3226
|
let r = new FileReader();
|
|
2805
3227
|
r.onloadend = () => t(r.result), r.onerror = n, r.readAsDataURL(e);
|
|
@@ -2807,67 +3229,67 @@ function ht(e) {
|
|
|
2807
3229
|
}
|
|
2808
3230
|
//#endregion
|
|
2809
3231
|
//#region src/functions/domQuerySelector.ts
|
|
2810
|
-
function
|
|
2811
|
-
if (
|
|
3232
|
+
function Ct(e) {
|
|
3233
|
+
if (f()) {
|
|
2812
3234
|
var t;
|
|
2813
3235
|
return (t = document.querySelector(e)) == null ? void 0 : t;
|
|
2814
3236
|
}
|
|
2815
3237
|
}
|
|
2816
3238
|
//#endregion
|
|
2817
3239
|
//#region src/functions/domQuerySelectorAll.ts
|
|
2818
|
-
function
|
|
2819
|
-
if (
|
|
3240
|
+
function wt(e) {
|
|
3241
|
+
if (f()) return document.querySelectorAll(e);
|
|
2820
3242
|
}
|
|
2821
3243
|
//#endregion
|
|
2822
3244
|
//#region src/functions/getElementImage.ts
|
|
2823
|
-
function
|
|
2824
|
-
return
|
|
3245
|
+
function Z(e) {
|
|
3246
|
+
return u(e) ? W(void 0, "img", { src: e }) : e;
|
|
2825
3247
|
}
|
|
2826
3248
|
//#endregion
|
|
2827
3249
|
//#region src/functions/resizeImageByMax.ts
|
|
2828
|
-
function
|
|
3250
|
+
function Tt(e, t = "auto") {
|
|
2829
3251
|
switch (t) {
|
|
2830
3252
|
case "auto": return e.naturalWidth >= e.naturalHeight;
|
|
2831
3253
|
case "width": return !0;
|
|
2832
3254
|
case "height": return !1;
|
|
2833
3255
|
}
|
|
2834
3256
|
}
|
|
2835
|
-
function
|
|
2836
|
-
let i =
|
|
3257
|
+
function Et(e, t, n = "auto", r) {
|
|
3258
|
+
let i = Z(e);
|
|
2837
3259
|
if (i && (i.naturalWidth > t && (n === "auto" || n === "width") || i.naturalHeight > t && (n === "auto" || n === "height"))) {
|
|
2838
3260
|
var a;
|
|
2839
|
-
let e =
|
|
3261
|
+
let e = Tt(i, n), o = (a = document.createElement("canvas")) == null ? void 0 : a.getContext("2d");
|
|
2840
3262
|
if (o) return o.canvas.width = e ? t : i.naturalWidth / i.naturalHeight * t, o.canvas.height = e ? i.naturalHeight / i.naturalWidth * t : t, o.drawImage(i, 0, 0, o.canvas.width, o.canvas.height), o.canvas.toDataURL(r);
|
|
2841
3263
|
}
|
|
2842
3264
|
}
|
|
2843
3265
|
//#endregion
|
|
2844
3266
|
//#region src/functions/ensureMaxSize.ts
|
|
2845
|
-
async function
|
|
3267
|
+
async function Dt(e, t = .56, n = "image/jpeg") {
|
|
2846
3268
|
return new Promise((r) => {
|
|
2847
|
-
let i = new Blob([e], { type: n }), a =
|
|
3269
|
+
let i = new Blob([e], { type: n }), a = Z(URL.createObjectURL(i));
|
|
2848
3270
|
a ? a.onload = () => {
|
|
2849
|
-
let e =
|
|
3271
|
+
let e = Et(a, t * a.naturalWidth, "width", n);
|
|
2850
3272
|
r(e == null ? "" : e);
|
|
2851
|
-
} :
|
|
3273
|
+
} : St(i).then((e) => r(String(e == null ? "" : e)));
|
|
2852
3274
|
});
|
|
2853
3275
|
}
|
|
2854
3276
|
//#endregion
|
|
2855
3277
|
//#region src/functions/eventStopPropagation.ts
|
|
2856
|
-
function
|
|
3278
|
+
function Ot(e) {
|
|
2857
3279
|
e.preventDefault(), e.stopPropagation();
|
|
2858
3280
|
}
|
|
2859
3281
|
//#endregion
|
|
2860
3282
|
//#region src/functions/frame.ts
|
|
2861
|
-
function
|
|
3283
|
+
function kt(e, t, n) {
|
|
2862
3284
|
let r = () => {
|
|
2863
|
-
e(), t != null && t() ?
|
|
3285
|
+
e(), t != null && t() ? kt(e, t, n) : n == null || n();
|
|
2864
3286
|
};
|
|
2865
|
-
|
|
3287
|
+
f() ? requestAnimationFrame(r) : r();
|
|
2866
3288
|
}
|
|
2867
3289
|
//#endregion
|
|
2868
3290
|
//#region src/functions/getAttributes.ts
|
|
2869
|
-
function
|
|
2870
|
-
let t = {}, n =
|
|
3291
|
+
function At(e) {
|
|
3292
|
+
let t = {}, n = T(e);
|
|
2871
3293
|
if (n) for (let e of n.attributes) {
|
|
2872
3294
|
var r;
|
|
2873
3295
|
t[e.name] = (r = (e == null ? void 0 : e.value) || (e == null ? void 0 : e.textContent)) == null ? void 0 : r;
|
|
@@ -2876,66 +3298,66 @@ function wt(e) {
|
|
|
2876
3298
|
}
|
|
2877
3299
|
//#endregion
|
|
2878
3300
|
//#region src/functions/getClipboardData.ts
|
|
2879
|
-
async function
|
|
3301
|
+
async function jt(e) {
|
|
2880
3302
|
var t, n;
|
|
2881
3303
|
return (t = e == null || (n = e.clipboardData) == null ? void 0 : n.getData("text")) == null ? await navigator.clipboard.readText() || "" : t;
|
|
2882
3304
|
}
|
|
2883
3305
|
//#endregion
|
|
2884
3306
|
//#region src/functions/getCurrentDate.ts
|
|
2885
|
-
function
|
|
2886
|
-
return new
|
|
3307
|
+
function Mt(e = "datetime") {
|
|
3308
|
+
return new Me(void 0, e).standard();
|
|
2887
3309
|
}
|
|
2888
3310
|
//#endregion
|
|
2889
3311
|
//#region src/functions/getElementId.ts
|
|
2890
|
-
var
|
|
2891
|
-
function
|
|
2892
|
-
let n =
|
|
2893
|
-
return n ? (
|
|
3312
|
+
var Nt = k(1e5, 9e5);
|
|
3313
|
+
function Pt(e, t) {
|
|
3314
|
+
let n = T(e);
|
|
3315
|
+
return n ? (c(n.id) || n.setAttribute("id", `id-${Nt++}`), t ? `#${n.id}${t}`.trim() : n.id) : `id-${Nt++}`;
|
|
2894
3316
|
}
|
|
2895
3317
|
//#endregion
|
|
2896
3318
|
//#region src/functions/getKey.ts
|
|
2897
|
-
function
|
|
3319
|
+
function Ft(e) {
|
|
2898
3320
|
var t, n, r;
|
|
2899
3321
|
return (t = (n = e == null ? void 0 : e.key) == null ? e == null ? void 0 : e.code : n) == null ? e == null || (r = e.keyCode) == null ? void 0 : r.toString() : t;
|
|
2900
3322
|
}
|
|
2901
3323
|
//#endregion
|
|
2902
3324
|
//#region src/functions/getLengthOfAllArray.ts
|
|
2903
|
-
function
|
|
2904
|
-
return
|
|
3325
|
+
function Q(e) {
|
|
3326
|
+
return i(e, (e) => e.length);
|
|
2905
3327
|
}
|
|
2906
3328
|
//#endregion
|
|
2907
3329
|
//#region src/functions/getMaxLengthAllArray.ts
|
|
2908
|
-
function
|
|
2909
|
-
return Math.max(...
|
|
3330
|
+
function It(e) {
|
|
3331
|
+
return Math.max(...Q(e));
|
|
2910
3332
|
}
|
|
2911
3333
|
//#endregion
|
|
2912
3334
|
//#region src/functions/getMinLengthAllArray.ts
|
|
2913
|
-
function
|
|
2914
|
-
return Math.min(...
|
|
3335
|
+
function Lt(e) {
|
|
3336
|
+
return Math.min(...Q(e));
|
|
2915
3337
|
}
|
|
2916
3338
|
//#endregion
|
|
2917
3339
|
//#region src/functions/getMouseClientX.ts
|
|
2918
|
-
function
|
|
3340
|
+
function Rt(e) {
|
|
2919
3341
|
var t, n;
|
|
2920
3342
|
return (e == null ? void 0 : e.clientX) || (e == null || (t = e.targetTouches) == null || (t = t[0]) == null ? void 0 : t.clientX) || (e == null || (n = e.touches) == null || (n = n[0]) == null ? void 0 : n.clientX) || 0;
|
|
2921
3343
|
}
|
|
2922
3344
|
//#endregion
|
|
2923
3345
|
//#region src/functions/getMouseClientY.ts
|
|
2924
|
-
function
|
|
3346
|
+
function zt(e) {
|
|
2925
3347
|
var t, n;
|
|
2926
3348
|
return (e == null ? void 0 : e.clientY) || (e == null || (t = e.targetTouches) == null || (t = t[0]) == null ? void 0 : t.clientY) || (e == null || (n = e.touches) == null || (n = n[0]) == null ? void 0 : n.clientY) || 0;
|
|
2927
3349
|
}
|
|
2928
3350
|
//#endregion
|
|
2929
3351
|
//#region src/functions/getMouseClient.ts
|
|
2930
|
-
function
|
|
3352
|
+
function Bt(e) {
|
|
2931
3353
|
return {
|
|
2932
|
-
x:
|
|
2933
|
-
y:
|
|
3354
|
+
x: Rt(e),
|
|
3355
|
+
y: zt(e)
|
|
2934
3356
|
};
|
|
2935
3357
|
}
|
|
2936
3358
|
//#endregion
|
|
2937
3359
|
//#region src/functions/getObjectByKeys.ts
|
|
2938
|
-
function
|
|
3360
|
+
function Vt(e, t) {
|
|
2939
3361
|
let n = {};
|
|
2940
3362
|
return t.forEach((t) => {
|
|
2941
3363
|
t in e && e[t] !== void 0 && (n[t] = e[t]);
|
|
@@ -2943,58 +3365,58 @@ function It(e, t) {
|
|
|
2943
3365
|
}
|
|
2944
3366
|
//#endregion
|
|
2945
3367
|
//#region src/functions/getObjectNoUndefined.ts
|
|
2946
|
-
function
|
|
3368
|
+
function Ht(e, t = void 0) {
|
|
2947
3369
|
let n = {};
|
|
2948
|
-
return
|
|
3370
|
+
return i(e, (e, r) => {
|
|
2949
3371
|
e !== t && (n[r] = e);
|
|
2950
3372
|
}), n;
|
|
2951
3373
|
}
|
|
2952
3374
|
//#endregion
|
|
2953
3375
|
//#region src/functions/getObjectOrNone.ts
|
|
2954
|
-
function
|
|
2955
|
-
return
|
|
3376
|
+
function Ut(e) {
|
|
3377
|
+
return n(e) ? e : {};
|
|
2956
3378
|
}
|
|
2957
3379
|
//#endregion
|
|
2958
3380
|
//#region src/functions/strFill.ts
|
|
2959
|
-
function
|
|
2960
|
-
return
|
|
3381
|
+
function Wt(e, t) {
|
|
3382
|
+
return xt(e, t).join("");
|
|
2961
3383
|
}
|
|
2962
3384
|
//#endregion
|
|
2963
3385
|
//#region src/functions/getRandomText.ts
|
|
2964
|
-
function
|
|
2965
|
-
let a =
|
|
2966
|
-
for (let e = 0; e < a; e++) o.push(
|
|
3386
|
+
function Gt(e, t, n = "#", r = 2, i = 12) {
|
|
3387
|
+
let a = k(e, t), o = [];
|
|
3388
|
+
for (let e = 0; e < a; e++) o.push(Wt(n, k(r, i)));
|
|
2967
3389
|
return o.join(" ");
|
|
2968
3390
|
}
|
|
2969
3391
|
//#endregion
|
|
2970
3392
|
//#region src/functions/getStepPercent.ts
|
|
2971
|
-
function
|
|
3393
|
+
function Kt(e, t) {
|
|
2972
3394
|
let n = e == null ? 0 : e;
|
|
2973
3395
|
return t > n ? 100 / (t - n) : 0;
|
|
2974
3396
|
}
|
|
2975
3397
|
//#endregion
|
|
2976
3398
|
//#region src/functions/getStepValue.ts
|
|
2977
|
-
function
|
|
3399
|
+
function qt(e, t) {
|
|
2978
3400
|
let n = e == null ? 0 : e;
|
|
2979
3401
|
return t > n ? (t - n) / 100 : 0;
|
|
2980
3402
|
}
|
|
2981
3403
|
//#endregion
|
|
2982
3404
|
//#region src/functions/goScroll.ts
|
|
2983
|
-
var
|
|
2984
|
-
function
|
|
3405
|
+
var Jt = 0;
|
|
3406
|
+
function Yt(e, t, n) {
|
|
2985
3407
|
let r = t == null ? void 0 : t.closest(e);
|
|
2986
3408
|
if (t && r && r.scrollHeight !== r.offsetHeight) {
|
|
2987
3409
|
let e = r.getBoundingClientRect(), i = t.getBoundingClientRect();
|
|
2988
3410
|
if (n) {
|
|
2989
3411
|
let a = n.getBoundingClientRect();
|
|
2990
3412
|
r.scrollTop = t.offsetTop - (a.top - e.top) - (a.height / 2 - i.height / 2), r.scrollTop + r.offsetHeight < t.offsetTop + t.offsetHeight && (r.scrollTop = t.offsetTop + t.offsetHeight - r.offsetHeight);
|
|
2991
|
-
} else r.scrollTop > t.offsetTop ? r.scrollTop = i.top - e.top -
|
|
3413
|
+
} else r.scrollTop > t.offsetTop ? r.scrollTop = i.top - e.top - Jt : r.scrollTop + r.offsetHeight < t.offsetTop + t.offsetHeight && (r.scrollTop = i.top - e.top + i.height - e.height + Jt);
|
|
2992
3414
|
}
|
|
2993
3415
|
}
|
|
2994
3416
|
//#endregion
|
|
2995
3417
|
//#region src/functions/goScrollSmooth.ts
|
|
2996
|
-
function
|
|
2997
|
-
if (!
|
|
3418
|
+
function Xt(e, t, n = 0) {
|
|
3419
|
+
if (!f()) return;
|
|
2998
3420
|
let r = (t == null ? void 0 : t.behavior) || "smooth";
|
|
2999
3421
|
if ("scrollIntoView" in e && !n) {
|
|
3000
3422
|
e.scrollIntoView({
|
|
@@ -3015,8 +3437,8 @@ function Gt(e, t, n = 0) {
|
|
|
3015
3437
|
}
|
|
3016
3438
|
//#endregion
|
|
3017
3439
|
//#region src/functions/goScrollTo.ts
|
|
3018
|
-
function
|
|
3019
|
-
if (!
|
|
3440
|
+
function Zt(e, t, n = "smooth") {
|
|
3441
|
+
if (!f() || !e || !t) return;
|
|
3020
3442
|
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect();
|
|
3021
3443
|
e.scrollBy({
|
|
3022
3444
|
top: i.top - r.top,
|
|
@@ -3026,13 +3448,13 @@ function Kt(e, t, n = "smooth") {
|
|
|
3026
3448
|
}
|
|
3027
3449
|
//#endregion
|
|
3028
3450
|
//#region src/functions/isShare.ts
|
|
3029
|
-
function
|
|
3030
|
-
return
|
|
3451
|
+
function Qt() {
|
|
3452
|
+
return f() && typeof navigator < "u" && !!navigator.share;
|
|
3031
3453
|
}
|
|
3032
3454
|
//#endregion
|
|
3033
3455
|
//#region src/functions/handleShare.ts
|
|
3034
|
-
async function
|
|
3035
|
-
if (
|
|
3456
|
+
async function $t(e) {
|
|
3457
|
+
if (Qt() && navigator.canShare && navigator.canShare(e)) try {
|
|
3036
3458
|
return await navigator.share(e), !0;
|
|
3037
3459
|
} catch (e) {
|
|
3038
3460
|
console.error("handleShare error:", e);
|
|
@@ -3041,60 +3463,60 @@ async function Jt(e) {
|
|
|
3041
3463
|
}
|
|
3042
3464
|
//#endregion
|
|
3043
3465
|
//#region src/functions/inArray.ts
|
|
3044
|
-
function
|
|
3466
|
+
function en(e, t) {
|
|
3045
3467
|
return e.indexOf(t) !== -1;
|
|
3046
3468
|
}
|
|
3047
3469
|
//#endregion
|
|
3048
3470
|
//#region src/functions/initScrollbarOffset.ts
|
|
3049
|
-
async function
|
|
3050
|
-
if (
|
|
3471
|
+
async function tn() {
|
|
3472
|
+
if (f()) {
|
|
3051
3473
|
let e = await Y.get();
|
|
3052
3474
|
document.body.style.setProperty("--sys-scrollbar-offset", `${e}px`);
|
|
3053
3475
|
}
|
|
3054
3476
|
}
|
|
3055
3477
|
//#endregion
|
|
3056
3478
|
//#region src/functions/intersectKey.ts
|
|
3057
|
-
function
|
|
3058
|
-
let
|
|
3059
|
-
return
|
|
3060
|
-
|
|
3061
|
-
}),
|
|
3479
|
+
function nn(e, n) {
|
|
3480
|
+
let r = {};
|
|
3481
|
+
return t(e) && t(n) && i(e, (e, t) => {
|
|
3482
|
+
t in n && (r[t] = e);
|
|
3483
|
+
}), r;
|
|
3062
3484
|
}
|
|
3063
3485
|
//#endregion
|
|
3064
3486
|
//#region src/functions/isApiSuccess.ts
|
|
3065
|
-
var
|
|
3487
|
+
var rn = (e) => {
|
|
3066
3488
|
var t;
|
|
3067
|
-
return
|
|
3489
|
+
return o(e) ? !0 : !!(e && n(e) && ((e == null ? void 0 : e.status) === "success" || e != null && e.success || !(e == null || (t = e.statusObject) == null) && t.status && String(e.statusObject.status).match(/^2/) || !("status" in e) && !("success" in e) && !("statusObject" in e) && String(A.getStatus().getStatus()).match(/^2/)));
|
|
3068
3490
|
};
|
|
3069
3491
|
//#endregion
|
|
3070
3492
|
//#region src/functions/isDifferent.ts
|
|
3071
|
-
function
|
|
3493
|
+
function an(e, t) {
|
|
3072
3494
|
let n = Object.keys(e).length !== Object.keys(t).length;
|
|
3073
|
-
return n ||
|
|
3495
|
+
return n || i(e, (e, r) => {
|
|
3074
3496
|
e !== (t == null ? void 0 : t[r]) && (n = !0);
|
|
3075
3497
|
}), n;
|
|
3076
3498
|
}
|
|
3077
3499
|
//#endregion
|
|
3078
3500
|
//#region src/functions/isElementVisible.ts
|
|
3079
|
-
function
|
|
3080
|
-
if (!
|
|
3081
|
-
let t =
|
|
3501
|
+
function on(e) {
|
|
3502
|
+
if (!f()) return !1;
|
|
3503
|
+
let t = T(e);
|
|
3082
3504
|
if (!t || "isConnected" in t && t.isConnected === !1) return !1;
|
|
3083
3505
|
let n = window.getComputedStyle(t);
|
|
3084
3506
|
return n.display !== "none" && n.visibility !== "hidden" && n.opacity !== "0" && t.offsetWidth !== 0 && t.offsetHeight !== 0;
|
|
3085
3507
|
}
|
|
3086
3508
|
//#endregion
|
|
3087
3509
|
//#region src/functions/isInput.ts
|
|
3088
|
-
var
|
|
3510
|
+
var sn = (e) => {
|
|
3089
3511
|
if (e instanceof HTMLElement) {
|
|
3090
3512
|
let t = e.tagName.toLowerCase();
|
|
3091
3513
|
return !!(t === "input" || t === "textarea" || t === "select" || e.isContentEditable || e.getAttribute("contenteditable") === "true");
|
|
3092
3514
|
}
|
|
3093
3515
|
return !1;
|
|
3094
|
-
},
|
|
3516
|
+
}, cn = (e, t) => e.code === "Space" || e.code === "Enter" || e.key === " " || e.key === "Spacebar" || e.key === "Enter" || e.keyCode === 13 || e.keyCode === 32 ? t === void 0 ? !sn(e.target) : !t : !1;
|
|
3095
3517
|
//#endregion
|
|
3096
3518
|
//#region src/functions/isFloat.ts
|
|
3097
|
-
function
|
|
3519
|
+
function ln(e) {
|
|
3098
3520
|
switch (typeof e) {
|
|
3099
3521
|
case "number": return !0;
|
|
3100
3522
|
case "string": return !!e.match(/^([0-9]+|[0-9]+\.[0-9]+)$/);
|
|
@@ -3103,18 +3525,18 @@ function rn(e) {
|
|
|
3103
3525
|
}
|
|
3104
3526
|
//#endregion
|
|
3105
3527
|
//#region src/functions/isIntegerBetween.ts
|
|
3106
|
-
function
|
|
3528
|
+
function un(e, t) {
|
|
3107
3529
|
let n = Math.floor(t);
|
|
3108
3530
|
return e >= n && e < n + 1;
|
|
3109
3531
|
}
|
|
3110
3532
|
//#endregion
|
|
3111
3533
|
//#region src/functions/isSelectedByList.ts
|
|
3112
|
-
function
|
|
3113
|
-
return Array.isArray(e) ? e.every((e) =>
|
|
3534
|
+
function dn(e, t) {
|
|
3535
|
+
return Array.isArray(e) ? e.every((e) => h(e, t)) : h(e, t);
|
|
3114
3536
|
}
|
|
3115
3537
|
//#endregion
|
|
3116
3538
|
//#region src/functions/removeCommonPrefix.ts
|
|
3117
|
-
function
|
|
3539
|
+
function fn(e, t) {
|
|
3118
3540
|
if (e.startsWith(t)) return e.slice(t.length).trim();
|
|
3119
3541
|
let n = 0;
|
|
3120
3542
|
for (; e[n] === t[n] && n < e.length && n < t.length;) n++;
|
|
@@ -3122,45 +3544,45 @@ function sn(e, t) {
|
|
|
3122
3544
|
}
|
|
3123
3545
|
//#endregion
|
|
3124
3546
|
//#region src/functions/replaceComponentName.ts
|
|
3125
|
-
var
|
|
3547
|
+
var pn = (e, t, n) => {
|
|
3126
3548
|
var r;
|
|
3127
3549
|
return e == null || (r = e.replace(RegExp(`<${t}`, "ig"), `<${n}`)) == null || (r = r.replace(RegExp(`</${t}`, "ig"), `</${n}`)) == null ? void 0 : r.trim();
|
|
3128
3550
|
};
|
|
3129
3551
|
//#endregion
|
|
3130
3552
|
//#region src/functions/uniqueArray.ts
|
|
3131
|
-
function
|
|
3553
|
+
function mn(e) {
|
|
3132
3554
|
return [...new Set(e)];
|
|
3133
3555
|
}
|
|
3134
3556
|
//#endregion
|
|
3135
3557
|
//#region src/functions/replaceRecursive.ts
|
|
3136
|
-
function $(e,
|
|
3137
|
-
let a =
|
|
3138
|
-
return
|
|
3139
|
-
let o = e == null ? void 0 : e[
|
|
3140
|
-
|
|
3558
|
+
function $(e, n, r = !0) {
|
|
3559
|
+
let a = d(e);
|
|
3560
|
+
return t(e) && t(n) && i(n, (n, i) => {
|
|
3561
|
+
let o = e == null ? void 0 : e[i];
|
|
3562
|
+
t(o) && t(n) ? r && Array.isArray(o) && Array.isArray(n) ? a[i] = d(mn([...o, ...n])) : a[i] = $(Array.isArray(o) ? { ...o } : o, n, r) : a[i] = t(n) ? d(n) : n;
|
|
3141
3563
|
}), a;
|
|
3142
3564
|
}
|
|
3143
3565
|
//#endregion
|
|
3144
3566
|
//#region src/functions/replaceTemplate.ts
|
|
3145
|
-
function
|
|
3567
|
+
function hn(e, t) {
|
|
3146
3568
|
let n = e;
|
|
3147
|
-
return
|
|
3148
|
-
n = n.replace(
|
|
3569
|
+
return i(t, (e, t) => {
|
|
3570
|
+
n = n.replace(ct(`[${t}]`), _(e));
|
|
3149
3571
|
}), n;
|
|
3150
3572
|
}
|
|
3151
3573
|
//#endregion
|
|
3152
3574
|
//#region src/functions/secondToTime.ts
|
|
3153
|
-
function
|
|
3154
|
-
let t =
|
|
3575
|
+
function gn(e) {
|
|
3576
|
+
let t = m(e);
|
|
3155
3577
|
return t > 0 ? `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}` : "00:00";
|
|
3156
3578
|
}
|
|
3157
3579
|
//#endregion
|
|
3158
3580
|
//#region src/functions/setValues.ts
|
|
3159
|
-
function
|
|
3581
|
+
function _n(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: i = !0, notEmpty: a = !1 }) {
|
|
3160
3582
|
if (n) {
|
|
3161
|
-
if (
|
|
3583
|
+
if (o(e)) {
|
|
3162
3584
|
let n = e.indexOf(t), i = [...e];
|
|
3163
|
-
return n === -1 ? (!r || e.length < r) && i.push(t) : (!
|
|
3585
|
+
return n === -1 ? (!r || e.length < r) && i.push(t) : (!a || i.length > 1) && i.splice(n, 1), i;
|
|
3164
3586
|
}
|
|
3165
3587
|
return e === t ? [] : e ? [e, t] : [t];
|
|
3166
3588
|
}
|
|
@@ -3168,51 +3590,51 @@ function fn(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: i = !0, no
|
|
|
3168
3590
|
}
|
|
3169
3591
|
//#endregion
|
|
3170
3592
|
//#region src/functions/splice.ts
|
|
3171
|
-
function
|
|
3172
|
-
if (
|
|
3173
|
-
if (
|
|
3593
|
+
function vn(e, n, r) {
|
|
3594
|
+
if (t(e) && t(n)) {
|
|
3595
|
+
if (r) {
|
|
3174
3596
|
let a = {}, o = !1;
|
|
3175
|
-
return
|
|
3176
|
-
!o && (
|
|
3177
|
-
}), o ? a : $(e,
|
|
3597
|
+
return i(e, (e, i) => {
|
|
3598
|
+
!o && (r === i || r === e) ? (o = !0, a = $(a, n)) : o ? a = $(a, { [i]: e }) : a[i] = t(e) ? d(e) : e;
|
|
3599
|
+
}), o ? a : $(e, n);
|
|
3178
3600
|
}
|
|
3179
|
-
if (n
|
|
3601
|
+
if (t(n)) return $(e, n);
|
|
3180
3602
|
}
|
|
3181
|
-
return
|
|
3603
|
+
return d(e);
|
|
3182
3604
|
}
|
|
3183
3605
|
//#endregion
|
|
3184
3606
|
//#region src/functions/toCamelCaseFirst.ts
|
|
3185
|
-
function
|
|
3186
|
-
return
|
|
3607
|
+
function yn(e) {
|
|
3608
|
+
return Pe(e).replace(/^([a-z])/, (e) => `${e.toUpperCase()}`);
|
|
3187
3609
|
}
|
|
3188
3610
|
//#endregion
|
|
3189
3611
|
//#region src/functions/toKebabCase.ts
|
|
3190
|
-
function
|
|
3612
|
+
function bn(e) {
|
|
3191
3613
|
return e.toString().trim().replace(/[^\w-. ]+/g, "").replace(/[ .]+/g, "-").replace(/(?<=[A-Z])([A-Z])/g, (e) => `${e.toLowerCase()}`).replace(/^[A-Z]/, (e) => e.toLowerCase()).replace(/(?<=[\w ])[A-Z]/g, (e) => `-${e.toLowerCase()}`).replace(/[A-Z]/g, (e) => e.toLowerCase());
|
|
3192
3614
|
}
|
|
3193
3615
|
//#endregion
|
|
3194
3616
|
//#region src/functions/toNumberByMax.ts
|
|
3195
|
-
function
|
|
3196
|
-
let i =
|
|
3197
|
-
return t && a < i ? `${
|
|
3617
|
+
function xn(e, t, n, r) {
|
|
3618
|
+
let i = m(e), a = m(t);
|
|
3619
|
+
return t && a < i ? `${Sn(a, n, r)}+` : Sn(i, n, r);
|
|
3198
3620
|
}
|
|
3199
|
-
var
|
|
3621
|
+
var Sn = (e, t, n) => t ? new L(n).number(e) : e;
|
|
3200
3622
|
//#endregion
|
|
3201
3623
|
//#region src/functions/toPercent.ts
|
|
3202
|
-
function
|
|
3624
|
+
function Cn(e, t) {
|
|
3203
3625
|
return 1 / e * t;
|
|
3204
3626
|
}
|
|
3205
3627
|
//#endregion
|
|
3206
3628
|
//#region src/functions/toPercentBy100.ts
|
|
3207
|
-
function
|
|
3208
|
-
return
|
|
3629
|
+
function wn(e, t) {
|
|
3630
|
+
return Cn(e, t) * 100;
|
|
3209
3631
|
}
|
|
3210
3632
|
//#endregion
|
|
3211
3633
|
//#region src/functions/uint8ArrayToBase64.ts
|
|
3212
|
-
function
|
|
3634
|
+
function Tn(e) {
|
|
3213
3635
|
let t = "";
|
|
3214
3636
|
for (let n of e) t += String.fromCharCode(n);
|
|
3215
|
-
if (
|
|
3637
|
+
if (f()) return window.btoa(t);
|
|
3216
3638
|
if (globalThis && globalThis.Buffer) {
|
|
3217
3639
|
var n;
|
|
3218
3640
|
return (n = globalThis) == null ? void 0 : n.Buffer.from(e).toString("base64");
|
|
@@ -3221,8 +3643,8 @@ function bn(e) {
|
|
|
3221
3643
|
}
|
|
3222
3644
|
//#endregion
|
|
3223
3645
|
//#region src/functions/writeClipboardData.ts
|
|
3224
|
-
async function
|
|
3225
|
-
if (
|
|
3646
|
+
async function En(e) {
|
|
3647
|
+
if (f()) try {
|
|
3226
3648
|
await navigator.clipboard.writeText(e);
|
|
3227
3649
|
} catch (n) {
|
|
3228
3650
|
var t;
|
|
@@ -3230,4 +3652,4 @@ async function xn(e) {
|
|
|
3230
3652
|
}
|
|
3231
3653
|
}
|
|
3232
3654
|
//#endregion
|
|
3233
|
-
export {
|
|
3655
|
+
export { A as Api, he as ApiDefault, me as ApiHeaders, xe as ApiInstance, O as ApiMethodItem, be as ApiPreparation, ye as ApiResponse, ge as ApiStatus, Se as BroadcastMessage, Te as Cache, we as CacheItem, j as CacheStatic, ke as Cookie, N as CookieBlock, S as DataStorage, Me as Datetime, x as ErrorCenter, ne as ErrorCenterHandler, re as ErrorCenterInstance, de as EventItem, Fe as Formatters, B as FormattersType, Ie as GEO_FLAG_ICON_NAME, w as Geo, Le as GeoFlag, L as GeoIntl, Re as GeoPhone, ze as Global, H as Hash, U as Icons, D as Loading, pe as LoadingInstance, rt as Meta, G as MetaManager, tt as MetaOg, Qe as MetaOpenGraphAge, Xe as MetaOpenGraphAvailability, Ze as MetaOpenGraphCondition, $e as MetaOpenGraphGender, q as MetaOpenGraphTag, Ye as MetaOpenGraphType, Je as MetaRobots, K as MetaTag, nt as MetaTwitter, et as MetaTwitterCard, J as MetaTwitterTag, Y as ScrollbarWidth, pt as SearchList, ot as SearchListData, st as SearchListItem, dt as SearchListMatcher, ft as SearchListOptions, gt as TRANSLATE_GLOBAL_PREFIX, _t as TRANSLATE_TIME_OUT, bt as Translate, vt as TranslateFile, yt as TranslateInstance, at as addTagHighlightMatch, R as anyToString, ht as applyTemplate, xt as arrFill, St as blobToBase64, d as copyObject, r as copyObjectLite, W as createElement, Ct as domQuerySelector, wt as domQuerySelectorAll, qe as encodeAttribute, Dt as ensureMaxSize, X as escapeExp, Ot as eventStopPropagation, _ as executeFunction, _e as executePromise, i as forEach, kt as frame, At as getAttributes, jt as getClipboardData, Ae as getColumn, Mt as getCurrentDate, T as getElement, Pt as getElementId, Z as getElementImage, Ge as getElementItem, le as getElementOrWindow, lt as getExactSearchExp, ct as getExp, z as getItemByPath, Ft as getKey, Q as getLengthOfAllArray, It as getMaxLengthAllArray, Lt as getMinLengthAllArray, Bt as getMouseClient, Rt as getMouseClientX, zt as getMouseClientY, Vt as getObjectByKeys, Ht as getObjectNoUndefined, Ut as getObjectOrNone, Gt as getRandomText, a as getRequestString, ut as getSearchExp, it as getSeparatingSearchExp, Kt as getStepPercent, qt as getStepValue, Yt as goScroll, Xt as goScrollSmooth, Zt as goScrollTo, $t as handleShare, en as inArray, tn as initScrollbarOffset, nn as intersectKey, rn as isApiSuccess, o as isArray, an as isDifferent, v as isDomData, f as isDomRuntime, on as isElementVisible, cn as isEnter, c as isFilled, ln as isFloat, g as isFunction, ue as isInDom, sn as isInput, un as isIntegerBetween, s as isNull, p as isNumber, t as isObject, n as isObjectNotArray, l as isOnLine, h as isSelected, dn as isSelectedByList, Qt as isShare, u as isString, ce as isWindow, k as random, fn as removeCommonPrefix, pn as replaceComponentName, $ as replaceRecursive, hn as replaceTemplate, Et as resizeImageByMax, gn as secondToTime, Ke as setElementItem, _n as setValues, vn as splice, Wt as strFill, Ne as strSplit, E as toArray, Pe as toCamelCase, yn as toCamelCaseFirst, I as toDate, bn as toKebabCase, m as toNumber, xn as toNumberByMax, Cn as toPercent, wn as toPercentBy100, M as transformation, Tn as uint8ArrayToBase64, mn as uniqueArray, En as writeClipboardData };
|