@dxtmisha/functional-basic 0.12.2 → 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 +715 -113
- package/dist/library.js +913 -546
- package/package.json +1 -1
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 ne = {}, re = "ui-storage", b = 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 ne = {}, re = "ui-storage", b = 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 ne = {}, re = "ui-storage", b = 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 ne = {}, re = "ui-storage", b = 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 ne = {}, re = "ui-storage", b = 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 ne = {}, re = "ui-storage", b = 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,30 +491,30 @@ function C(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
|
|
331
|
-
function
|
|
505
|
+
function E(e) {
|
|
332
506
|
return Array.isArray(e) ? 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,14 +523,14 @@ var ce = 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
|
-
return this.type =
|
|
533
|
+
return this.type = E(e), this.reset(), this;
|
|
360
534
|
}
|
|
361
535
|
setListener(e) {
|
|
362
536
|
return this.listener = e, this;
|
|
@@ -425,22 +599,25 @@ var ce = 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 ce = 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 de = 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 de = 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 de = 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 de = 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);
|
|
@@ -578,13 +777,13 @@ var me = "d-response-loading", he = class {
|
|
|
578
777
|
return this.response.filter((e) => e.isForGlobal !== !0);
|
|
579
778
|
}
|
|
580
779
|
add(e) {
|
|
581
|
-
return this.response.push(...
|
|
780
|
+
return this.response.push(...E(e)), this;
|
|
582
781
|
}
|
|
583
782
|
setDevMode(e) {
|
|
584
783
|
return this.devMode = e, this;
|
|
585
784
|
}
|
|
586
785
|
async emulator(e) {
|
|
587
|
-
let { path: t = "", method: n =
|
|
786
|
+
let { path: t = "", method: n = O.get, global: r = n === O.get, devMode: i = !1 } = e;
|
|
588
787
|
if (r || this.isDevMode(i)) {
|
|
589
788
|
let r = this.requestDefault.request(e.request), a = this.get(t, n, r, i);
|
|
590
789
|
if (a) {
|
|
@@ -594,7 +793,7 @@ var me = "d-response-loading", he = 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 me = "d-response-loading", he = 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
|
-
|
|
615
|
-
e != null && e.lag ? (
|
|
616
|
-
this.stopResponseLoading(), n(t),
|
|
617
|
-
},
|
|
813
|
+
_e(g(e.response) ? e.response(t) : e.response).then((t) => {
|
|
814
|
+
e != null && e.lag ? (D.show(), setTimeout(() => {
|
|
815
|
+
this.stopResponseLoading(), n(t), D.hide();
|
|
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,9 +853,11 @@ var me = "d-response-loading", he = class {
|
|
|
654
853
|
let n = {};
|
|
655
854
|
return this.callbackEnd && (n = await this.callbackEnd(e, t)), n;
|
|
656
855
|
}
|
|
657
|
-
},
|
|
658
|
-
constructor(e = "/api/") {
|
|
659
|
-
|
|
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;
|
|
660
861
|
}
|
|
661
862
|
isLocalhost() {
|
|
662
863
|
return typeof location > "u" || location.hostname === "localhost";
|
|
@@ -668,16 +869,16 @@ var me = "d-response-loading", he = class {
|
|
|
668
869
|
return this.response;
|
|
669
870
|
}
|
|
670
871
|
getUrl(e, t = !0) {
|
|
671
|
-
return `${t ? this.url : ""}${e}`.replace("{locale}",
|
|
872
|
+
return `${t ? this.url : ""}${e}`.replace("{locale}", w.getLocation()).replace("{country}", w.getCountry()).replace("{language}", w.getLanguage());
|
|
672
873
|
}
|
|
673
|
-
getBody(e = {}, t =
|
|
874
|
+
getBody(e = {}, t = O.get) {
|
|
674
875
|
if (e instanceof FormData) return e;
|
|
675
|
-
if (t !==
|
|
876
|
+
if (t !== O.get && c(e)) return u(e) ? e : JSON.stringify(e);
|
|
676
877
|
}
|
|
677
|
-
getBodyForGet(e, t = "", n =
|
|
678
|
-
if (n ===
|
|
679
|
-
let n = t.match(/\?/) ? "&" : "?", r = typeof e == "object" ?
|
|
680
|
-
if (
|
|
878
|
+
getBodyForGet(e, t = "", n = O.get) {
|
|
879
|
+
if (n === O.get) {
|
|
880
|
+
let n = t.match(/\?/) ? "&" : "?", r = typeof e == "object" ? a(e) : e;
|
|
881
|
+
if (c(r)) return `${n}${r}`;
|
|
681
882
|
}
|
|
682
883
|
return "";
|
|
683
884
|
}
|
|
@@ -697,59 +898,127 @@ var me = "d-response-loading", he = class {
|
|
|
697
898
|
return this.preparation.setEnd(e), this;
|
|
698
899
|
}
|
|
699
900
|
async request(e) {
|
|
700
|
-
return
|
|
901
|
+
return u(e) ? await this.fetch({ path: e }) : await this.fetch(e);
|
|
701
902
|
}
|
|
702
903
|
get(e) {
|
|
703
|
-
return this.request(
|
|
904
|
+
return this.request(r(e, { method: O.get }));
|
|
704
905
|
}
|
|
705
906
|
post(e) {
|
|
706
|
-
return this.request(
|
|
907
|
+
return this.request(r(e, { method: O.post }));
|
|
707
908
|
}
|
|
708
909
|
put(e) {
|
|
709
|
-
return this.request(
|
|
910
|
+
return this.request(r(e, { method: O.put }));
|
|
710
911
|
}
|
|
711
912
|
delete(e) {
|
|
712
|
-
return this.request(
|
|
913
|
+
return this.request(r(e, { method: O.delete }));
|
|
713
914
|
}
|
|
714
915
|
async fetch(e) {
|
|
715
|
-
let { toData: t = !0, hideError: n = !1,
|
|
716
|
-
if (
|
|
717
|
-
let
|
|
718
|
-
|
|
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();
|
|
719
920
|
try {
|
|
720
|
-
await this.preparation.make(
|
|
721
|
-
let t
|
|
722
|
-
|
|
723
|
-
|
|
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);
|
|
724
927
|
} catch (e) {
|
|
725
|
-
throw n ||
|
|
928
|
+
throw n || this.makeError(e), c.setError(String(e)), this.status.setError(String(e)), r || this.loading.hide(), e;
|
|
726
929
|
}
|
|
727
|
-
return
|
|
930
|
+
return r || this.loading.hide(), c.setLastResponse(l), this.status.setLastResponse(l), this.makeStatus(this.makeData(l, t), c);
|
|
728
931
|
}
|
|
729
932
|
async readData(e, t, n) {
|
|
730
933
|
var r;
|
|
731
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() };
|
|
732
935
|
}
|
|
733
936
|
async makeQuery(e) {
|
|
734
|
-
let
|
|
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, {
|
|
735
938
|
method: o,
|
|
736
|
-
body: this.getBody(
|
|
939
|
+
body: this.getBody(t, o)
|
|
737
940
|
});
|
|
738
|
-
|
|
941
|
+
f && (p.headers = f);
|
|
942
|
+
let m = this.initController(e, p);
|
|
943
|
+
return {
|
|
944
|
+
query: await fetch(d, p),
|
|
945
|
+
timeoutId: m
|
|
946
|
+
};
|
|
739
947
|
}
|
|
740
|
-
makeData(e,
|
|
741
|
-
if (!
|
|
742
|
-
if (e.data !== null && typeof e.data != "object" ||
|
|
743
|
-
let
|
|
744
|
-
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;
|
|
745
953
|
}
|
|
746
954
|
makeStatus(e, t) {
|
|
747
|
-
return e &&
|
|
955
|
+
return e && n(e) ? {
|
|
748
956
|
...e,
|
|
749
957
|
statusObject: t.get()
|
|
750
958
|
} : e;
|
|
751
959
|
}
|
|
752
|
-
|
|
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 {
|
|
753
1022
|
static isLocalhost() {
|
|
754
1023
|
return this.item.isLocalhost();
|
|
755
1024
|
}
|
|
@@ -765,10 +1034,10 @@ var me = "d-response-loading", he = class {
|
|
|
765
1034
|
static getUrl(e, t = !0) {
|
|
766
1035
|
return this.item.getUrl(e, t);
|
|
767
1036
|
}
|
|
768
|
-
static getBody(e = {}, t =
|
|
1037
|
+
static getBody(e = {}, t = O.get) {
|
|
769
1038
|
return this.item.getBody(e, t);
|
|
770
1039
|
}
|
|
771
|
-
static getBodyForGet(e, t = "", n =
|
|
1040
|
+
static getBodyForGet(e, t = "", n = O.get) {
|
|
772
1041
|
return this.item.getBodyForGet(e, t, n);
|
|
773
1042
|
}
|
|
774
1043
|
static setHeaders(t) {
|
|
@@ -783,6 +1052,9 @@ var me = "d-response-loading", he = class {
|
|
|
783
1052
|
static setPreparation(t) {
|
|
784
1053
|
return this.item.setPreparation(t), e;
|
|
785
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
|
+
}
|
|
786
1058
|
static setEnd(t) {
|
|
787
1059
|
return this.item.setEnd(t), e;
|
|
788
1060
|
}
|
|
@@ -802,21 +1074,25 @@ var me = "d-response-loading", he = class {
|
|
|
802
1074
|
return this.item.delete(e);
|
|
803
1075
|
}
|
|
804
1076
|
};
|
|
805
|
-
|
|
1077
|
+
b(A, "item", new xe());
|
|
806
1078
|
//#endregion
|
|
807
1079
|
//#region src/classes/BroadcastMessage.ts
|
|
808
|
-
var
|
|
809
|
-
constructor(e, t, n) {
|
|
810
|
-
if (
|
|
1080
|
+
var Se = class {
|
|
1081
|
+
constructor(e, t, n, r = x.getItem()) {
|
|
1082
|
+
if (b(this, "channel", void 0), b(this, "update", (e) => {
|
|
811
1083
|
var t;
|
|
812
1084
|
return (t = this.callback) == null || t.call(this, e), this;
|
|
813
|
-
}),
|
|
1085
|
+
}), b(this, "updateError", (e) => {
|
|
814
1086
|
var t;
|
|
815
1087
|
return (t = this.callbackError) == null || t.call(this, e), this;
|
|
816
|
-
}), this.callback = t, this.callbackError = n,
|
|
817
|
-
this.channel = new BroadcastChannel(`${
|
|
818
|
-
} catch (
|
|
819
|
-
|
|
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
|
+
});
|
|
820
1096
|
}
|
|
821
1097
|
}
|
|
822
1098
|
getChannel() {
|
|
@@ -832,9 +1108,9 @@ var ve = class {
|
|
|
832
1108
|
setCallbackError(e) {
|
|
833
1109
|
return this.callbackError = e, this;
|
|
834
1110
|
}
|
|
835
|
-
},
|
|
1111
|
+
}, Ce = () => new S("__broadcast-name").get(() => `name_${k(1e6, 9999999)}`), we = class {
|
|
836
1112
|
constructor(e) {
|
|
837
|
-
|
|
1113
|
+
b(this, "cache", void 0), b(this, "cacheOld", void 0), b(this, "comparisons", []), this.callback = e;
|
|
838
1114
|
}
|
|
839
1115
|
getCache(e) {
|
|
840
1116
|
return this.isUpdate(e) && (this.cacheOld = this.cache, this.setCache()), this.cache;
|
|
@@ -854,9 +1130,9 @@ var ve = class {
|
|
|
854
1130
|
isUpdate(e) {
|
|
855
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;
|
|
856
1132
|
}
|
|
857
|
-
},
|
|
1133
|
+
}, Te = class {
|
|
858
1134
|
constructor() {
|
|
859
|
-
|
|
1135
|
+
b(this, "cache", {});
|
|
860
1136
|
}
|
|
861
1137
|
get(e, t, n) {
|
|
862
1138
|
return this.getCacheItem(e, t).getCache(n == null ? [] : n);
|
|
@@ -865,17 +1141,17 @@ var ve = class {
|
|
|
865
1141
|
return await this.getCacheItem(e, t).getCacheAsync(n == null ? [] : n);
|
|
866
1142
|
}
|
|
867
1143
|
getCacheItem(e, t) {
|
|
868
|
-
return e in this.cache || (this.cache[e] = new
|
|
1144
|
+
return e in this.cache || (this.cache[e] = new we(t)), this.cache[e];
|
|
869
1145
|
}
|
|
870
|
-
},
|
|
1146
|
+
}, Ee, j = class {
|
|
871
1147
|
static get(e, t, n) {
|
|
872
1148
|
return this.cache.get(e, t, n);
|
|
873
1149
|
}
|
|
874
1150
|
};
|
|
875
|
-
|
|
1151
|
+
Ee = j, b(j, "cache", void 0), Ee.cache = new Te();
|
|
876
1152
|
//#endregion
|
|
877
1153
|
//#region src/functions/transformation.ts
|
|
878
|
-
function
|
|
1154
|
+
function M(e, t = !1) {
|
|
879
1155
|
if (typeof e == "string") {
|
|
880
1156
|
let r = e.trim();
|
|
881
1157
|
switch (r) {
|
|
@@ -892,14 +1168,14 @@ function we(e, t = !1) {
|
|
|
892
1168
|
}
|
|
893
1169
|
else if (/^[0-9]+\.[0-9.]+$/.exec(r)) return parseFloat(r);
|
|
894
1170
|
else if (/^[0-9]+$/.exec(r)) return parseInt(r, 10);
|
|
895
|
-
else if (t &&
|
|
1171
|
+
else if (t && f() && typeof ((n = window) == null ? void 0 : n[r]) == "function") return window[r];
|
|
896
1172
|
}
|
|
897
1173
|
}
|
|
898
1174
|
return e;
|
|
899
1175
|
}
|
|
900
1176
|
//#endregion
|
|
901
1177
|
//#region src/classes/CookieBlock.ts
|
|
902
|
-
var
|
|
1178
|
+
var De = "cookie-block", N = class {
|
|
903
1179
|
static get() {
|
|
904
1180
|
var e;
|
|
905
1181
|
return (e = this.storage.get()) == null ? !1 : e;
|
|
@@ -908,19 +1184,19 @@ var Te = "cookie-block", Ee = class {
|
|
|
908
1184
|
this.storage.set(e);
|
|
909
1185
|
}
|
|
910
1186
|
};
|
|
911
|
-
|
|
1187
|
+
b(N, "storage", new S(De));
|
|
912
1188
|
//#endregion
|
|
913
1189
|
//#region src/classes/Cookie.ts
|
|
914
|
-
var
|
|
1190
|
+
var Oe, P = {}, ke = class {
|
|
915
1191
|
constructor(e) {
|
|
916
|
-
if (
|
|
917
|
-
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;
|
|
918
1194
|
}
|
|
919
1195
|
get(e, t) {
|
|
920
1196
|
return this.value === void 0 && e && this.set(e, t), this.value;
|
|
921
1197
|
}
|
|
922
1198
|
set(e, t) {
|
|
923
|
-
this.value =
|
|
1199
|
+
this.value = _(e), Object.assign(this.options, t), this.update();
|
|
924
1200
|
}
|
|
925
1201
|
remove() {
|
|
926
1202
|
this.set("");
|
|
@@ -930,7 +1206,7 @@ var De, A = {}, Oe = class {
|
|
|
930
1206
|
return (e = (t = this.options) == null ? void 0 : t.age) == null ? 10080 * 60 : e;
|
|
931
1207
|
}
|
|
932
1208
|
update() {
|
|
933
|
-
if (
|
|
1209
|
+
if (f() && !v() && !N.get()) {
|
|
934
1210
|
var e, t, n, r, i;
|
|
935
1211
|
let a = String((e = this.value) == null ? "" : e);
|
|
936
1212
|
document.cookie = [
|
|
@@ -944,40 +1220,40 @@ var De, A = {}, Oe = class {
|
|
|
944
1220
|
static updateData() {
|
|
945
1221
|
for (let e of document.cookie.split(";")) {
|
|
946
1222
|
let [t, n] = e.trim().split("=");
|
|
947
|
-
t &&
|
|
1223
|
+
t && c(n) && (P[t] = M(n));
|
|
948
1224
|
}
|
|
949
1225
|
}
|
|
950
1226
|
};
|
|
951
|
-
|
|
952
|
-
var
|
|
1227
|
+
Oe = ke, f() && !v() && Oe.updateData();
|
|
1228
|
+
var F = {};
|
|
953
1229
|
//#endregion
|
|
954
1230
|
//#region src/functions/toDate.ts
|
|
955
|
-
function
|
|
956
|
-
var t, n, r, i, a,
|
|
1231
|
+
function I(e) {
|
|
1232
|
+
var t, n, r, i, a, o, c, l;
|
|
957
1233
|
if (e instanceof Date) return e;
|
|
958
|
-
if (
|
|
1234
|
+
if (s(e)) return /* @__PURE__ */ new Date();
|
|
959
1235
|
if (typeof e == "number") return new Date(e);
|
|
960
|
-
let u = e, d =
|
|
1236
|
+
let u = e, d = w.getTimezoneFormat().trim();
|
|
961
1237
|
e.replace(/^([\s\S]+)([-+]\d{2}:?\d{2})$/, (e, t, n) => (u = t, d = n.trim(), e));
|
|
962
|
-
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;
|
|
963
1239
|
return /* @__PURE__ */ new Date(`${f.trim()}${d}`);
|
|
964
1240
|
}
|
|
965
1241
|
//#endregion
|
|
966
1242
|
//#region src/functions/getColumn.ts
|
|
967
|
-
function
|
|
968
|
-
return
|
|
1243
|
+
function Ae(e, t) {
|
|
1244
|
+
return i(e, (e) => e == null ? void 0 : e[t], !0);
|
|
969
1245
|
}
|
|
970
1246
|
//#endregion
|
|
971
1247
|
//#region src/classes/GeoIntl.ts
|
|
972
|
-
var
|
|
973
|
-
static getInstance(t =
|
|
1248
|
+
var L = class e {
|
|
1249
|
+
static getInstance(t = w.getLocation()) {
|
|
974
1250
|
return new e(t);
|
|
975
1251
|
}
|
|
976
|
-
constructor(e =
|
|
977
|
-
|
|
978
|
-
let
|
|
979
|
-
if (
|
|
980
|
-
|
|
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;
|
|
981
1257
|
}
|
|
982
1258
|
getLocation() {
|
|
983
1259
|
return this.geo.standard;
|
|
@@ -995,7 +1271,11 @@ var N = class e {
|
|
|
995
1271
|
try {
|
|
996
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)));
|
|
997
1273
|
} catch (e) {
|
|
998
|
-
|
|
1274
|
+
this.errorCenter.on({
|
|
1275
|
+
group: "intl",
|
|
1276
|
+
code: "display",
|
|
1277
|
+
details: e
|
|
1278
|
+
});
|
|
999
1279
|
}
|
|
1000
1280
|
return (n = (r = a) == null ? e : r) == null ? "" : n;
|
|
1001
1281
|
}
|
|
@@ -1004,7 +1284,7 @@ var N = class e {
|
|
|
1004
1284
|
type: "language",
|
|
1005
1285
|
style: t
|
|
1006
1286
|
};
|
|
1007
|
-
return this.display(
|
|
1287
|
+
return this.display(w.getByCode(e).language, n);
|
|
1008
1288
|
}
|
|
1009
1289
|
countryName(e, t) {
|
|
1010
1290
|
let n = {
|
|
@@ -1034,7 +1314,7 @@ var N = class e {
|
|
|
1034
1314
|
}
|
|
1035
1315
|
number(e, t) {
|
|
1036
1316
|
var n, r;
|
|
1037
|
-
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();
|
|
1038
1318
|
}
|
|
1039
1319
|
decimal() {
|
|
1040
1320
|
var e, t, n;
|
|
@@ -1048,7 +1328,7 @@ var N = class e {
|
|
|
1048
1328
|
}, i = e.toString().replace(/^([\S\s]+[\d ])([a-zA-Z]{3})$/i, (...e) => (r.currency = String(e[2]).toUpperCase(), String(e[1])));
|
|
1049
1329
|
if (n) {
|
|
1050
1330
|
let t = this.numberObject(r);
|
|
1051
|
-
return t ?
|
|
1331
|
+
return t ? Ae(t.formatToParts(m(e)).filter((e) => ["literal", "currency"].indexOf(e.type) === -1), "value").join("") : e.toString();
|
|
1052
1332
|
} else if ("currency" in r) return this.number(typeof e == "number" ? e : i, r);
|
|
1053
1333
|
else return this.number(typeof e == "number" ? e : i, {
|
|
1054
1334
|
...r,
|
|
@@ -1071,8 +1351,8 @@ var N = class e {
|
|
|
1071
1351
|
return this.number(r, n);
|
|
1072
1352
|
}
|
|
1073
1353
|
sizeFile(e, t = "byte") {
|
|
1074
|
-
let n =
|
|
1075
|
-
if (n > 1024 &&
|
|
1354
|
+
let n = m(e);
|
|
1355
|
+
if (n > 1024 && u(t)) switch (t) {
|
|
1076
1356
|
case "byte": return this.sizeFile(n / 1024, "kilobyte");
|
|
1077
1357
|
case "kilobyte": return this.sizeFile(n / 1024, "megabyte");
|
|
1078
1358
|
case "megabyte": return this.sizeFile(n / 1024, "gigabyte");
|
|
@@ -1088,11 +1368,11 @@ var N = class e {
|
|
|
1088
1368
|
});
|
|
1089
1369
|
}
|
|
1090
1370
|
percentBy100(e, t) {
|
|
1091
|
-
return this.percent(
|
|
1371
|
+
return this.percent(m(e) / 100, t);
|
|
1092
1372
|
}
|
|
1093
1373
|
plural(e, t, n, r) {
|
|
1094
1374
|
var i;
|
|
1095
|
-
let a =
|
|
1375
|
+
let a = m(e), o = t.split("|");
|
|
1096
1376
|
if (o.length > 1) try {
|
|
1097
1377
|
if (typeof Intl < "u") {
|
|
1098
1378
|
var s;
|
|
@@ -1120,23 +1400,27 @@ var N = class e {
|
|
|
1120
1400
|
return `${this.number(a, r)} ${(s = t) == null ? "" : s}`.trim();
|
|
1121
1401
|
}
|
|
1122
1402
|
} catch (e) {
|
|
1123
|
-
|
|
1403
|
+
this.errorCenter.on({
|
|
1404
|
+
group: "intl",
|
|
1405
|
+
code: "plural",
|
|
1406
|
+
details: e
|
|
1407
|
+
});
|
|
1124
1408
|
}
|
|
1125
1409
|
return `${this.number(a, r)} ${(i = o == null ? void 0 : o[0]) == null ? "" : i}`.trim();
|
|
1126
1410
|
}
|
|
1127
1411
|
date(e, t, n, r) {
|
|
1128
|
-
let i =
|
|
1412
|
+
let i = I(e), a = typeof n == "string", o = this.dateOptions(t, a ? n : "short");
|
|
1129
1413
|
return r && (o.hour12 = !1), a || Object.assign(o, n), i.toLocaleString(this.getLocation(), o);
|
|
1130
1414
|
}
|
|
1131
1415
|
relative(e, t, n) {
|
|
1132
|
-
let r =
|
|
1416
|
+
let r = I(e), i = n || /* @__PURE__ */ new Date(), a = {
|
|
1133
1417
|
numeric: "auto",
|
|
1134
1418
|
...typeof t == "string" ? { style: t } : t || {}
|
|
1135
1419
|
}, o = "second", s = (r.getTime() - i.getTime()) / 1e3;
|
|
1136
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);
|
|
1137
1421
|
}
|
|
1138
1422
|
relativeLimit(e, t, n, r, i, a, o) {
|
|
1139
|
-
let s =
|
|
1423
|
+
let s = I(e), c = n || /* @__PURE__ */ new Date(), l = new Date(c), u = new Date(c);
|
|
1140
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);
|
|
1141
1425
|
}
|
|
1142
1426
|
relativeByValue(e, t, n) {
|
|
@@ -1145,17 +1429,25 @@ var N = class e {
|
|
|
1145
1429
|
...typeof n == "string" ? { style: n } : n || {}
|
|
1146
1430
|
};
|
|
1147
1431
|
try {
|
|
1148
|
-
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);
|
|
1149
1433
|
} catch (e) {
|
|
1150
|
-
|
|
1434
|
+
this.errorCenter.on({
|
|
1435
|
+
group: "intl",
|
|
1436
|
+
code: "relative",
|
|
1437
|
+
details: e
|
|
1438
|
+
});
|
|
1151
1439
|
}
|
|
1152
1440
|
return "";
|
|
1153
1441
|
}
|
|
1154
1442
|
month(e, t) {
|
|
1155
1443
|
try {
|
|
1156
|
-
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));
|
|
1157
1445
|
} catch (e) {
|
|
1158
|
-
|
|
1446
|
+
this.errorCenter.on({
|
|
1447
|
+
group: "intl",
|
|
1448
|
+
code: "datetime",
|
|
1449
|
+
details: e
|
|
1450
|
+
});
|
|
1159
1451
|
}
|
|
1160
1452
|
return "";
|
|
1161
1453
|
}
|
|
@@ -1173,15 +1465,23 @@ var N = class e {
|
|
|
1173
1465
|
});
|
|
1174
1466
|
}
|
|
1175
1467
|
} catch (e) {
|
|
1176
|
-
|
|
1468
|
+
this.errorCenter.on({
|
|
1469
|
+
group: "intl",
|
|
1470
|
+
code: "datetime",
|
|
1471
|
+
details: e
|
|
1472
|
+
});
|
|
1177
1473
|
}
|
|
1178
1474
|
return t;
|
|
1179
1475
|
}
|
|
1180
1476
|
weekday(e, t) {
|
|
1181
1477
|
try {
|
|
1182
|
-
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));
|
|
1183
1479
|
} catch (e) {
|
|
1184
|
-
|
|
1480
|
+
this.errorCenter.on({
|
|
1481
|
+
group: "intl",
|
|
1482
|
+
code: "datetime",
|
|
1483
|
+
details: e
|
|
1484
|
+
});
|
|
1185
1485
|
}
|
|
1186
1486
|
return "";
|
|
1187
1487
|
}
|
|
@@ -1200,7 +1500,11 @@ var N = class e {
|
|
|
1200
1500
|
}), n.setDate(n.getDate() + 1);
|
|
1201
1501
|
}
|
|
1202
1502
|
} catch (e) {
|
|
1203
|
-
|
|
1503
|
+
this.errorCenter.on({
|
|
1504
|
+
group: "intl",
|
|
1505
|
+
code: "datetime",
|
|
1506
|
+
details: e
|
|
1507
|
+
});
|
|
1204
1508
|
}
|
|
1205
1509
|
return t;
|
|
1206
1510
|
}
|
|
@@ -1224,7 +1528,11 @@ var N = class e {
|
|
|
1224
1528
|
try {
|
|
1225
1529
|
if (this.hasIntl() && Intl.NumberFormat !== void 0) return new Intl.NumberFormat(this.getLocation(), e);
|
|
1226
1530
|
} catch (e) {
|
|
1227
|
-
|
|
1531
|
+
this.errorCenter.on({
|
|
1532
|
+
group: "intl",
|
|
1533
|
+
code: "number",
|
|
1534
|
+
details: e
|
|
1535
|
+
});
|
|
1228
1536
|
}
|
|
1229
1537
|
}
|
|
1230
1538
|
dateOptions(e, t = "short") {
|
|
@@ -1269,12 +1577,12 @@ var N = class e {
|
|
|
1269
1577
|
"second"
|
|
1270
1578
|
].indexOf(e) !== -1 && (n.second = "2-digit")), n;
|
|
1271
1579
|
}
|
|
1272
|
-
},
|
|
1273
|
-
constructor(e, t = "date", n =
|
|
1274
|
-
|
|
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);
|
|
1275
1583
|
}
|
|
1276
1584
|
getIntl() {
|
|
1277
|
-
return new
|
|
1585
|
+
return new L(this.code);
|
|
1278
1586
|
}
|
|
1279
1587
|
getDate() {
|
|
1280
1588
|
return this.date;
|
|
@@ -1377,7 +1685,7 @@ var N = class e {
|
|
|
1377
1685
|
].indexOf(this.type) !== -1 && (i = n.locale("time"))), `${r.join("-")}${i ? `T${i}${t ? n.getTimeZone() : ""}` : ""}`;
|
|
1378
1686
|
}
|
|
1379
1687
|
setDate(e) {
|
|
1380
|
-
return this.date =
|
|
1688
|
+
return this.date = I(e), this.update(), this;
|
|
1381
1689
|
}
|
|
1382
1690
|
setType(e) {
|
|
1383
1691
|
return this.type = e, this.update(), this;
|
|
@@ -1519,7 +1827,7 @@ var N = class e {
|
|
|
1519
1827
|
return this.cloneClass().moveDayPrevious();
|
|
1520
1828
|
}
|
|
1521
1829
|
toTimeZoneHourFormat(e) {
|
|
1522
|
-
|
|
1830
|
+
f() && this.getIntl().number(Math.trunc(e), {
|
|
1523
1831
|
signDisplay: "always",
|
|
1524
1832
|
minimumIntegerDigits: 2
|
|
1525
1833
|
});
|
|
@@ -1533,36 +1841,36 @@ var N = class e {
|
|
|
1533
1841
|
};
|
|
1534
1842
|
//#endregion
|
|
1535
1843
|
//#region src/functions/anyToString.ts
|
|
1536
|
-
function
|
|
1844
|
+
function R(e, n = !0) {
|
|
1537
1845
|
var r;
|
|
1538
|
-
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;
|
|
1539
1847
|
}
|
|
1540
1848
|
//#endregion
|
|
1541
1849
|
//#region src/functions/strSplit.ts
|
|
1542
|
-
function
|
|
1543
|
-
let r =
|
|
1850
|
+
function Ne(e, t, n) {
|
|
1851
|
+
let r = R(e);
|
|
1544
1852
|
if (!n || n <= 0) return r.split(t);
|
|
1545
1853
|
let i = r.split(t, n), a = r.split(t);
|
|
1546
1854
|
return i.length === a.length ? i : (i.pop(), [...i, a.slice(n - 1).join(t)]);
|
|
1547
1855
|
}
|
|
1548
1856
|
//#endregion
|
|
1549
1857
|
//#region src/functions/getItemByPath.ts
|
|
1550
|
-
function
|
|
1858
|
+
function z(e, n) {
|
|
1551
1859
|
var r;
|
|
1552
|
-
if (!
|
|
1553
|
-
let i =
|
|
1554
|
-
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;
|
|
1555
1863
|
}
|
|
1556
1864
|
//#endregion
|
|
1557
1865
|
//#region src/functions/toCamelCase.ts
|
|
1558
|
-
function
|
|
1866
|
+
function Pe(e) {
|
|
1559
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()}`);
|
|
1560
1868
|
}
|
|
1561
1869
|
//#endregion
|
|
1562
1870
|
//#region src/types/formattersTypes.ts
|
|
1563
|
-
var
|
|
1871
|
+
var B = /* @__PURE__ */ function(e) {
|
|
1564
1872
|
return e.currency = "currency", e.date = "date", e.name = "name", e.number = "number", e.plural = "plural", e.unit = "unit", e;
|
|
1565
|
-
}({}),
|
|
1873
|
+
}({}), Fe = class {
|
|
1566
1874
|
constructor(e, t) {
|
|
1567
1875
|
this.options = e, this.list = t;
|
|
1568
1876
|
}
|
|
@@ -1576,7 +1884,7 @@ var L = /* @__PURE__ */ function(e) {
|
|
|
1576
1884
|
return this.list ? this.isArray() ? this.list.length : 1 : 0;
|
|
1577
1885
|
}
|
|
1578
1886
|
getList() {
|
|
1579
|
-
return this.list ?
|
|
1887
|
+
return this.list ? E(this.list) : [];
|
|
1580
1888
|
}
|
|
1581
1889
|
getOptions() {
|
|
1582
1890
|
return this.options;
|
|
@@ -1585,7 +1893,7 @@ var L = /* @__PURE__ */ function(e) {
|
|
|
1585
1893
|
return this.list = e, this;
|
|
1586
1894
|
}
|
|
1587
1895
|
to() {
|
|
1588
|
-
let e =
|
|
1896
|
+
let e = i(this.getList(), (e) => ({
|
|
1589
1897
|
...e,
|
|
1590
1898
|
...this.getFormatData(e)
|
|
1591
1899
|
}));
|
|
@@ -1593,51 +1901,51 @@ var L = /* @__PURE__ */ function(e) {
|
|
|
1593
1901
|
}
|
|
1594
1902
|
getFormatData(e) {
|
|
1595
1903
|
let t = {};
|
|
1596
|
-
return
|
|
1597
|
-
let i = `${
|
|
1598
|
-
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);
|
|
1599
1907
|
}), t;
|
|
1600
1908
|
}
|
|
1601
1909
|
transformation(e, t, n, r) {
|
|
1602
|
-
if (
|
|
1603
|
-
case
|
|
1604
|
-
case
|
|
1605
|
-
case
|
|
1606
|
-
case
|
|
1607
|
-
case
|
|
1608
|
-
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);
|
|
1609
1917
|
default: return String(e);
|
|
1610
1918
|
}
|
|
1611
1919
|
return "";
|
|
1612
1920
|
}
|
|
1613
1921
|
formatCurrency(e, t, n) {
|
|
1614
1922
|
var r;
|
|
1615
|
-
let i = n != null && n.currencyPropName ?
|
|
1616
|
-
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);
|
|
1617
1925
|
}
|
|
1618
1926
|
formatDate(e, t) {
|
|
1619
|
-
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);
|
|
1620
1928
|
}
|
|
1621
1929
|
formatName(e, t) {
|
|
1622
1930
|
var n, r, i;
|
|
1623
|
-
let a =
|
|
1624
|
-
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) : "";
|
|
1625
1933
|
}
|
|
1626
1934
|
formatNumber(e, t) {
|
|
1627
|
-
return
|
|
1935
|
+
return L.getInstance().number(e, t == null ? void 0 : t.options);
|
|
1628
1936
|
}
|
|
1629
1937
|
formatPlural(e, t) {
|
|
1630
|
-
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;
|
|
1631
1939
|
}
|
|
1632
1940
|
formatUnit(e, t) {
|
|
1633
|
-
return t && t.unit ?
|
|
1941
|
+
return t && t.unit ? L.getInstance().unit(e, t.unit) : e;
|
|
1634
1942
|
}
|
|
1635
|
-
},
|
|
1636
|
-
constructor(e =
|
|
1943
|
+
}, Ie = "f", Le = class e {
|
|
1944
|
+
constructor(e = w.getLocation()) {
|
|
1637
1945
|
this.code = e;
|
|
1638
1946
|
}
|
|
1639
1947
|
get(t = this.code) {
|
|
1640
|
-
let n =
|
|
1948
|
+
let n = w.find(t);
|
|
1641
1949
|
if (n) {
|
|
1642
1950
|
var r;
|
|
1643
1951
|
let t = this.getCountry(n);
|
|
@@ -1656,10 +1964,10 @@ var L = /* @__PURE__ */ function(e) {
|
|
|
1656
1964
|
return (t = this.get(e)) == null ? void 0 : t.icon;
|
|
1657
1965
|
}
|
|
1658
1966
|
getList(e) {
|
|
1659
|
-
return
|
|
1967
|
+
return i(this.getCodes(e), (e) => this.get(e));
|
|
1660
1968
|
}
|
|
1661
1969
|
getNational(t) {
|
|
1662
|
-
return
|
|
1970
|
+
return i(this.getList(t), (t) => {
|
|
1663
1971
|
let n = new e(t.standard).get(t.standard);
|
|
1664
1972
|
return {
|
|
1665
1973
|
...t,
|
|
@@ -1673,7 +1981,7 @@ var L = /* @__PURE__ */ function(e) {
|
|
|
1673
1981
|
return this.code = e, this;
|
|
1674
1982
|
}
|
|
1675
1983
|
getLocation() {
|
|
1676
|
-
return new
|
|
1984
|
+
return new L(this.code);
|
|
1677
1985
|
}
|
|
1678
1986
|
getCodes(t) {
|
|
1679
1987
|
return t == null ? Object.keys(e.flags) : t;
|
|
@@ -1685,7 +1993,7 @@ var L = /* @__PURE__ */ function(e) {
|
|
|
1685
1993
|
return this.getLocation().countryName(e.country);
|
|
1686
1994
|
}
|
|
1687
1995
|
};
|
|
1688
|
-
|
|
1996
|
+
b(Le, "flags", {
|
|
1689
1997
|
AD: "f-ad",
|
|
1690
1998
|
AE: "f-ae",
|
|
1691
1999
|
AF: "f-af",
|
|
@@ -1930,12 +2238,12 @@ y(Fe, "flags", {
|
|
|
1930
2238
|
});
|
|
1931
2239
|
//#endregion
|
|
1932
2240
|
//#region src/classes/GeoPhone.ts
|
|
1933
|
-
var
|
|
2241
|
+
var Re = class {
|
|
1934
2242
|
static get(e) {
|
|
1935
|
-
return this.
|
|
2243
|
+
return this.getList().find((t) => e === t.value);
|
|
1936
2244
|
}
|
|
1937
2245
|
static getByPhone(e) {
|
|
1938
|
-
let t = this.toNumber(e), n = [""], r = this.
|
|
2246
|
+
let t = this.toNumber(e), n = [""], r = this.getMap(), i;
|
|
1939
2247
|
for (let e of t) if (n[n.length - 1] += e, e in r) {
|
|
1940
2248
|
var a, o, s;
|
|
1941
2249
|
(a = r[e]) != null && a.value && (i = r[e], n.push("")), r = (o = (s = r[e]) == null ? void 0 : s.next) == null ? {} : o;
|
|
@@ -1956,13 +2264,15 @@ var R, z = class {
|
|
|
1956
2264
|
}
|
|
1957
2265
|
}
|
|
1958
2266
|
static getList() {
|
|
1959
|
-
|
|
2267
|
+
var e;
|
|
2268
|
+
return this.list || this.makeList(), (e = this.list) == null ? [] : e;
|
|
1960
2269
|
}
|
|
1961
2270
|
static getMap() {
|
|
1962
|
-
|
|
2271
|
+
var e;
|
|
2272
|
+
return this.map || this.makeMap(), (e = this.map) == null ? {} : e;
|
|
1963
2273
|
}
|
|
1964
2274
|
static toMask(e, t) {
|
|
1965
|
-
if (
|
|
2275
|
+
if (c(e) && Array.isArray(t) && t.length > 0) {
|
|
1966
2276
|
let n = this.removeZero(e), r = n.length;
|
|
1967
2277
|
for (let e of t) if (this.getUnnecessaryLength(e) === r) return this.toStandard(n, e);
|
|
1968
2278
|
}
|
|
@@ -1984,17 +2294,17 @@ var R, z = class {
|
|
|
1984
2294
|
return (t = (n = e.match(/\*/g)) == null ? void 0 : n.length) == null ? 0 : t;
|
|
1985
2295
|
}
|
|
1986
2296
|
static makeList() {
|
|
1987
|
-
this.list =
|
|
2297
|
+
this.list = i(w.getList(), (e) => {
|
|
1988
2298
|
if (e != null && e.phoneMask) return {
|
|
1989
2299
|
phone: (e == null ? void 0 : e.phoneCode) && Number(e.phoneCode.replace(/[^0-9]+/, "")) || void 0,
|
|
1990
2300
|
within: (e == null ? void 0 : e.phoneWithin) || 0,
|
|
1991
|
-
mask:
|
|
2301
|
+
mask: E(e.phoneMask),
|
|
1992
2302
|
value: e.country
|
|
1993
2303
|
};
|
|
1994
2304
|
}).sort((e, t) => e.phone - t.phone);
|
|
1995
2305
|
}
|
|
1996
2306
|
static makeMap() {
|
|
1997
|
-
this.
|
|
2307
|
+
this.map = {}, this.getList().forEach((e) => {
|
|
1998
2308
|
e.mask.forEach((t) => {
|
|
1999
2309
|
let n = this.map, r;
|
|
2000
2310
|
if (this.toNumber(t).forEach((e) => {
|
|
@@ -2026,23 +2336,23 @@ var R, z = class {
|
|
|
2026
2336
|
return e.replace(/\*/, this.getWithinSymbol(t));
|
|
2027
2337
|
}
|
|
2028
2338
|
};
|
|
2029
|
-
|
|
2339
|
+
b(Re, "list", void 0), b(Re, "map", void 0);
|
|
2030
2340
|
//#endregion
|
|
2031
2341
|
//#region src/classes/Global.ts
|
|
2032
|
-
var
|
|
2342
|
+
var V, ze = class {
|
|
2033
2343
|
static get(e) {
|
|
2034
|
-
return
|
|
2344
|
+
return V && (V == null ? void 0 : V[e]);
|
|
2035
2345
|
}
|
|
2036
2346
|
static add(e) {
|
|
2037
|
-
|
|
2347
|
+
V === void 0 && (V = r(e));
|
|
2038
2348
|
}
|
|
2039
|
-
},
|
|
2349
|
+
}, Be, H = class {
|
|
2040
2350
|
static get(e, t) {
|
|
2041
2351
|
return !(e in this.hash) && t && this.set(e, t), this.hash[e];
|
|
2042
2352
|
}
|
|
2043
2353
|
static set(e, t) {
|
|
2044
2354
|
var n;
|
|
2045
|
-
let r =
|
|
2355
|
+
let r = _(t);
|
|
2046
2356
|
r !== ((n = this.hash) == null ? void 0 : n[e]) && (this.hash[e] = r, this.update());
|
|
2047
2357
|
}
|
|
2048
2358
|
static addWatch(e, t) {
|
|
@@ -2064,102 +2374,105 @@ var B, Ie = class {
|
|
|
2064
2374
|
}
|
|
2065
2375
|
static getLocation() {
|
|
2066
2376
|
let e = {};
|
|
2067
|
-
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;
|
|
2068
2378
|
}
|
|
2069
2379
|
static update() {
|
|
2070
|
-
this.block = !0, history.replaceState(null, "", `#${
|
|
2380
|
+
this.block = !0, history.replaceState(null, "", `#${a(this.hash, "=", ";")}`), requestAnimationFrame(() => {
|
|
2071
2381
|
this.block = !1;
|
|
2072
2382
|
});
|
|
2073
2383
|
}
|
|
2074
2384
|
static makeWatch(e) {
|
|
2075
|
-
|
|
2385
|
+
i(this.watch, (t, n) => {
|
|
2076
2386
|
var r;
|
|
2077
2387
|
((r = this.hash) == null ? void 0 : r[n]) !== (e == null ? void 0 : e[n]) && t.forEach((t) => t(e[n]));
|
|
2078
2388
|
});
|
|
2079
2389
|
}
|
|
2080
2390
|
};
|
|
2081
|
-
|
|
2391
|
+
Be = H, b(H, "hash", {}), b(H, "watch", {}), b(H, "block", !1), f() && (Be.reload(), addEventListener("hashchange", () => Be.reload()));
|
|
2082
2392
|
//#endregion
|
|
2083
2393
|
//#region src/classes/Icons.ts
|
|
2084
|
-
var
|
|
2394
|
+
var Ve, He = "__UI_ICON", Ue = 320, We = "--LOAD--", U = class {
|
|
2085
2395
|
static is(e) {
|
|
2086
2396
|
return e in this.icons || this.getName(e) in this.icons;
|
|
2087
2397
|
}
|
|
2088
2398
|
static async get(e, t = "", n = 1e3 * 60 * 3) {
|
|
2089
2399
|
var r, i, a, o;
|
|
2090
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;
|
|
2091
|
-
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;
|
|
2092
2402
|
}
|
|
2093
2403
|
static getNameList() {
|
|
2094
|
-
return
|
|
2404
|
+
return i(this.icons, (e, t) => t.replace(/^@/, ""));
|
|
2095
2405
|
}
|
|
2096
2406
|
static getUrlGlobal() {
|
|
2097
|
-
return `${
|
|
2407
|
+
return `${A.isLocalhost(), ""}${this.url}`;
|
|
2098
2408
|
}
|
|
2099
2409
|
static add(e, t) {
|
|
2100
2410
|
this.icons[this.getName(e)] = t;
|
|
2101
2411
|
}
|
|
2102
2412
|
static addLoad(e) {
|
|
2103
|
-
this.icons[this.getName(e)] =
|
|
2413
|
+
this.icons[this.getName(e)] = We;
|
|
2104
2414
|
}
|
|
2105
2415
|
static addGlobal(e, t) {
|
|
2106
2416
|
this.icons[this.getName(e)] = `${this.getUrlGlobal()}${t}`;
|
|
2107
2417
|
}
|
|
2108
2418
|
static addByList(e) {
|
|
2109
|
-
|
|
2419
|
+
i(e, (e, t) => this.add(t, e));
|
|
2110
2420
|
}
|
|
2111
2421
|
static setUrl(e) {
|
|
2112
2422
|
this.url = e;
|
|
2113
2423
|
}
|
|
2424
|
+
static setConfig(e) {
|
|
2425
|
+
e.url && this.setUrl(e.url), e.list && this.addByList(e.list);
|
|
2426
|
+
}
|
|
2114
2427
|
static getName(e) {
|
|
2115
2428
|
return `@${e}`;
|
|
2116
2429
|
}
|
|
2117
2430
|
static wait() {
|
|
2118
|
-
return new Promise((e) => setTimeout(() => e(),
|
|
2431
|
+
return new Promise((e) => setTimeout(() => e(), Ue));
|
|
2119
2432
|
}
|
|
2120
2433
|
};
|
|
2121
|
-
|
|
2434
|
+
Ve = U, b(U, "icons", {}), b(U, "url", "/icons/"), f() && (He in window || (window[He] = {}), Ve.icons = window[He]);
|
|
2122
2435
|
//#endregion
|
|
2123
2436
|
//#region src/functions/getElementItem.ts
|
|
2124
|
-
function
|
|
2437
|
+
function Ge(e, t, n) {
|
|
2125
2438
|
var r, i;
|
|
2126
|
-
return (r = (i =
|
|
2439
|
+
return (r = (i = T(e)) == null ? void 0 : i[t]) == null ? n : r;
|
|
2127
2440
|
}
|
|
2128
2441
|
//#endregion
|
|
2129
2442
|
//#region src/functions/setElementItem.ts
|
|
2130
|
-
function
|
|
2131
|
-
let a =
|
|
2443
|
+
function Ke(e, n, r) {
|
|
2444
|
+
let a = T(e);
|
|
2132
2445
|
if (a) {
|
|
2133
|
-
let e =
|
|
2134
|
-
if (
|
|
2135
|
-
e[n] =
|
|
2446
|
+
let e = Ge(a, n);
|
|
2447
|
+
if (t(e) && t(r)) i(r, (t, n) => {
|
|
2448
|
+
e[n] = _(t);
|
|
2136
2449
|
});
|
|
2137
2450
|
else {
|
|
2138
|
-
let e =
|
|
2139
|
-
!(
|
|
2451
|
+
let e = _(r);
|
|
2452
|
+
!(n in a) && typeof e == "string" ? a.setAttribute(n.toString(), e) : a[n] = _(r);
|
|
2140
2453
|
}
|
|
2141
2454
|
}
|
|
2142
2455
|
return a;
|
|
2143
2456
|
}
|
|
2144
2457
|
//#endregion
|
|
2145
2458
|
//#region src/functions/createElement.ts
|
|
2146
|
-
function W(e, t = "div",
|
|
2147
|
-
if (!
|
|
2148
|
-
let
|
|
2149
|
-
return typeof
|
|
2150
|
-
|
|
2151
|
-
}), 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;
|
|
2152
2465
|
}
|
|
2153
2466
|
//#endregion
|
|
2154
2467
|
//#region src/functions/encodeAttribute.ts
|
|
2155
|
-
function
|
|
2468
|
+
function qe(e) {
|
|
2156
2469
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").trim();
|
|
2157
2470
|
}
|
|
2158
2471
|
//#endregion
|
|
2159
2472
|
//#region src/classes/MetaManager.ts
|
|
2160
2473
|
var G = class {
|
|
2161
2474
|
constructor(e, t = !1) {
|
|
2162
|
-
|
|
2475
|
+
b(this, "items", {}), this.listMeta = e, this.isProperty = t, this.update();
|
|
2163
2476
|
}
|
|
2164
2477
|
getListMeta() {
|
|
2165
2478
|
return this.listMeta;
|
|
@@ -2172,19 +2485,19 @@ var G = class {
|
|
|
2172
2485
|
return this.items;
|
|
2173
2486
|
}
|
|
2174
2487
|
html() {
|
|
2175
|
-
return
|
|
2488
|
+
return i(this.listMeta, (e) => this.toHtmlString(e)).join("");
|
|
2176
2489
|
}
|
|
2177
2490
|
set(e, t) {
|
|
2178
2491
|
return this.setItem(e, t).setMeta(e), this;
|
|
2179
2492
|
}
|
|
2180
2493
|
setByList(e) {
|
|
2181
|
-
return
|
|
2494
|
+
return i(e, (e, t) => this.set(t, String(e))), this;
|
|
2182
2495
|
}
|
|
2183
2496
|
getAttributeName() {
|
|
2184
2497
|
return this.isProperty ? "property" : "name";
|
|
2185
2498
|
}
|
|
2186
2499
|
findMetaElement(e) {
|
|
2187
|
-
if (!
|
|
2500
|
+
if (!f()) return;
|
|
2188
2501
|
let t = `meta[${this.getAttributeName()}="${e}"]`;
|
|
2189
2502
|
return document.querySelector(t) || void 0;
|
|
2190
2503
|
}
|
|
@@ -2195,7 +2508,7 @@ var G = class {
|
|
|
2195
2508
|
var t;
|
|
2196
2509
|
let n = this.findMetaElement(e), r = (t = this.items[e]) == null ? "" : t;
|
|
2197
2510
|
if (n) n.content = r;
|
|
2198
|
-
else if (
|
|
2511
|
+
else if (f()) {
|
|
2199
2512
|
let t = { content: r };
|
|
2200
2513
|
this.isProperty ? t.property = e : t.name = e, W(document.head, "meta", t);
|
|
2201
2514
|
}
|
|
@@ -2203,7 +2516,7 @@ var G = class {
|
|
|
2203
2516
|
}
|
|
2204
2517
|
toHtmlString(e) {
|
|
2205
2518
|
var t;
|
|
2206
|
-
let n =
|
|
2519
|
+
let n = qe((t = this.items[e]) == null ? "" : t);
|
|
2207
2520
|
return n ? `<meta ${this.getAttributeName()}="${e}" content="${n}">` : "";
|
|
2208
2521
|
}
|
|
2209
2522
|
update() {
|
|
@@ -2214,25 +2527,25 @@ var G = class {
|
|
|
2214
2527
|
}
|
|
2215
2528
|
}, K = /* @__PURE__ */ function(e) {
|
|
2216
2529
|
return e.description = "description", e.keywords = "keywords", e.canonical = "canonical", e.robots = "robots", e.author = "author", e;
|
|
2217
|
-
}({}),
|
|
2530
|
+
}({}), Je = /* @__PURE__ */ function(e) {
|
|
2218
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;
|
|
2219
2532
|
}({}), q = /* @__PURE__ */ function(e) {
|
|
2220
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;
|
|
2221
|
-
}({}),
|
|
2534
|
+
}({}), Ye = /* @__PURE__ */ function(e) {
|
|
2222
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;
|
|
2223
|
-
}({}),
|
|
2536
|
+
}({}), Xe = /* @__PURE__ */ function(e) {
|
|
2224
2537
|
return e.inStock = "in stock", e.outOfStock = "out of stock", e.preorder = "preorder", e.backorder = "backorder", e.discontinued = "discontinued", e.pending = "pending", e;
|
|
2225
|
-
}({}),
|
|
2538
|
+
}({}), Ze = /* @__PURE__ */ function(e) {
|
|
2226
2539
|
return e.new = "new", e.used = "used", e.refurbished = "refurbished", e;
|
|
2227
|
-
}({}),
|
|
2540
|
+
}({}), Qe = /* @__PURE__ */ function(e) {
|
|
2228
2541
|
return e.newborn = "newborn", e.infant = "infant", e.toddler = "toddler", e.kids = "kids", e.adult = "adult", e;
|
|
2229
|
-
}({}),
|
|
2542
|
+
}({}), $e = /* @__PURE__ */ function(e) {
|
|
2230
2543
|
return e.female = "female", e.male = "male", e.unisex = "unisex", e;
|
|
2231
2544
|
}({}), J = /* @__PURE__ */ function(e) {
|
|
2232
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;
|
|
2233
|
-
}({}),
|
|
2546
|
+
}({}), et = /* @__PURE__ */ function(e) {
|
|
2234
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;
|
|
2235
|
-
}({}),
|
|
2548
|
+
}({}), tt = class extends G {
|
|
2236
2549
|
constructor() {
|
|
2237
2550
|
super(Object.values(q), !0);
|
|
2238
2551
|
}
|
|
@@ -2278,7 +2591,7 @@ var G = class {
|
|
|
2278
2591
|
setSiteName(e) {
|
|
2279
2592
|
return this.set(q.siteName, e);
|
|
2280
2593
|
}
|
|
2281
|
-
},
|
|
2594
|
+
}, nt = class extends G {
|
|
2282
2595
|
constructor() {
|
|
2283
2596
|
super(Object.values(J));
|
|
2284
2597
|
}
|
|
@@ -2324,9 +2637,9 @@ var G = class {
|
|
|
2324
2637
|
setImage(e) {
|
|
2325
2638
|
return this.set(J.image, e), this;
|
|
2326
2639
|
}
|
|
2327
|
-
},
|
|
2640
|
+
}, rt = class extends G {
|
|
2328
2641
|
constructor() {
|
|
2329
|
-
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();
|
|
2330
2643
|
}
|
|
2331
2644
|
getOg() {
|
|
2332
2645
|
return this.og;
|
|
@@ -2335,7 +2648,7 @@ var G = class {
|
|
|
2335
2648
|
return this.twitter;
|
|
2336
2649
|
}
|
|
2337
2650
|
getTitle() {
|
|
2338
|
-
return
|
|
2651
|
+
return f() ? document.title.replace(this.getSuffix(), "").trim() : "";
|
|
2339
2652
|
}
|
|
2340
2653
|
getKeywords() {
|
|
2341
2654
|
return this.get(K.keywords);
|
|
@@ -2362,14 +2675,14 @@ var G = class {
|
|
|
2362
2675
|
return this.og.getLocale();
|
|
2363
2676
|
}
|
|
2364
2677
|
setTitle(e) {
|
|
2365
|
-
if (
|
|
2366
|
-
let t =
|
|
2678
|
+
if (f()) {
|
|
2679
|
+
let t = c(e) ? `${e}${this.getSuffix()}` : this.suffix ? this.suffix : "";
|
|
2367
2680
|
document.title = t, this.og.setTitle(t), this.twitter.setTitle(t);
|
|
2368
2681
|
}
|
|
2369
2682
|
return this;
|
|
2370
2683
|
}
|
|
2371
2684
|
setKeywords(e) {
|
|
2372
|
-
return this.set(K.keywords,
|
|
2685
|
+
return this.set(K.keywords, E(e).join(", ")), this;
|
|
2373
2686
|
}
|
|
2374
2687
|
setDescription(e) {
|
|
2375
2688
|
return this.set(K.description, e), this;
|
|
@@ -2399,7 +2712,7 @@ var G = class {
|
|
|
2399
2712
|
return `${super.html()}${this.og.html()}${this.twitter.html()}`;
|
|
2400
2713
|
}
|
|
2401
2714
|
getSuffix() {
|
|
2402
|
-
return
|
|
2715
|
+
return c(this.suffix) ? ` - ${this.suffix}` : "";
|
|
2403
2716
|
}
|
|
2404
2717
|
}, Y = class {
|
|
2405
2718
|
static async is() {
|
|
@@ -2438,7 +2751,7 @@ var G = class {
|
|
|
2438
2751
|
});
|
|
2439
2752
|
}
|
|
2440
2753
|
};
|
|
2441
|
-
|
|
2754
|
+
b(Y, "storage", new S("scrollbar", !0)), b(Y, "calculate", !1);
|
|
2442
2755
|
//#endregion
|
|
2443
2756
|
//#region src/functions/escapeExp.ts
|
|
2444
2757
|
function X(e) {
|
|
@@ -2446,20 +2759,20 @@ function X(e) {
|
|
|
2446
2759
|
}
|
|
2447
2760
|
//#endregion
|
|
2448
2761
|
//#region src/functions/getSeparatingSearchExp.ts
|
|
2449
|
-
function
|
|
2450
|
-
let t =
|
|
2762
|
+
function it(e) {
|
|
2763
|
+
let t = i(e.split(" "), (e) => X(e)).join("|");
|
|
2451
2764
|
return RegExp(`(${t})`, "ig");
|
|
2452
2765
|
}
|
|
2453
2766
|
//#endregion
|
|
2454
2767
|
//#region src/functions/addTagHighlightMatch.ts
|
|
2455
|
-
function
|
|
2456
|
-
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;
|
|
2457
2770
|
}
|
|
2458
2771
|
//#endregion
|
|
2459
2772
|
//#region src/classes/SearchListData.ts
|
|
2460
|
-
var
|
|
2773
|
+
var ot = class {
|
|
2461
2774
|
constructor(e, t, n, r) {
|
|
2462
|
-
|
|
2775
|
+
b(this, "listCache", void 0), this.list = e, this.columns = t, this.item = n, this.options = r;
|
|
2463
2776
|
}
|
|
2464
2777
|
is() {
|
|
2465
2778
|
return !!(this.list && this.columns);
|
|
@@ -2496,8 +2809,8 @@ var nt = class {
|
|
|
2496
2809
|
toFormatItem(e, t) {
|
|
2497
2810
|
let n = {};
|
|
2498
2811
|
return this.columns && this.columns.forEach((r) => {
|
|
2499
|
-
let i = this.getColumnName(r), a =
|
|
2500
|
-
n[i] =
|
|
2812
|
+
let i = this.getColumnName(r), a = z(e, r);
|
|
2813
|
+
n[i] = c(a) && t ? this.addTag(a) : R(a);
|
|
2501
2814
|
}), {
|
|
2502
2815
|
...e,
|
|
2503
2816
|
...n,
|
|
@@ -2508,7 +2821,7 @@ var nt = class {
|
|
|
2508
2821
|
return e.replace(/\.([a-z0-9])/gi, (e, t) => t.toUpperCase()) + "Search";
|
|
2509
2822
|
}
|
|
2510
2823
|
addTag(e) {
|
|
2511
|
-
return
|
|
2824
|
+
return at(R(e), this.item.get(), this.options.getClassName());
|
|
2512
2825
|
}
|
|
2513
2826
|
generateCache() {
|
|
2514
2827
|
if (!this.isList()) return [];
|
|
@@ -2516,8 +2829,8 @@ var nt = class {
|
|
|
2516
2829
|
for (let t of this.list) {
|
|
2517
2830
|
let n = "";
|
|
2518
2831
|
if (this.columns) for (let e of this.columns) {
|
|
2519
|
-
let r =
|
|
2520
|
-
|
|
2832
|
+
let r = z(t, e);
|
|
2833
|
+
c(r) && (n += ` ${R(r)}`);
|
|
2521
2834
|
}
|
|
2522
2835
|
e.push({
|
|
2523
2836
|
item: t,
|
|
@@ -2532,7 +2845,7 @@ var nt = class {
|
|
|
2532
2845
|
resetCache() {
|
|
2533
2846
|
this.listCache = void 0;
|
|
2534
2847
|
}
|
|
2535
|
-
},
|
|
2848
|
+
}, st = class {
|
|
2536
2849
|
constructor(e, t) {
|
|
2537
2850
|
this.value = e, this.options = t;
|
|
2538
2851
|
}
|
|
@@ -2552,29 +2865,29 @@ var nt = class {
|
|
|
2552
2865
|
};
|
|
2553
2866
|
//#endregion
|
|
2554
2867
|
//#region src/functions/getExp.ts
|
|
2555
|
-
function
|
|
2868
|
+
function ct(e, t = "ig", n = ":value") {
|
|
2556
2869
|
let r = X(e);
|
|
2557
2870
|
return new RegExp(n.replace(/:value/g, r), t);
|
|
2558
2871
|
}
|
|
2559
2872
|
//#endregion
|
|
2560
2873
|
//#region src/functions/getExactSearchExp.ts
|
|
2561
|
-
function
|
|
2562
|
-
return
|
|
2874
|
+
function lt(e) {
|
|
2875
|
+
return ct(e, "i", "(:value)");
|
|
2563
2876
|
}
|
|
2564
2877
|
//#endregion
|
|
2565
2878
|
//#region src/functions/getSearchExp.ts
|
|
2566
|
-
function
|
|
2879
|
+
function ut(e) {
|
|
2567
2880
|
let t = "";
|
|
2568
2881
|
return e.split(" ").forEach((e) => {
|
|
2569
2882
|
let n = X(e).trim();
|
|
2570
|
-
|
|
2883
|
+
c(n) && (t += `(?=.*?${n})`);
|
|
2571
2884
|
}), RegExp(`^${t}`, "ig");
|
|
2572
2885
|
}
|
|
2573
2886
|
//#endregion
|
|
2574
2887
|
//#region src/classes/SearchListMatcher.ts
|
|
2575
|
-
var
|
|
2888
|
+
var dt = class {
|
|
2576
2889
|
constructor(e, t) {
|
|
2577
|
-
|
|
2890
|
+
b(this, "matcher", void 0), this.item = e, this.options = t, this.initMatcher();
|
|
2578
2891
|
}
|
|
2579
2892
|
is() {
|
|
2580
2893
|
return !!this.matcher;
|
|
@@ -2589,9 +2902,9 @@ var st = class {
|
|
|
2589
2902
|
this.initMatcher();
|
|
2590
2903
|
}
|
|
2591
2904
|
initMatcher() {
|
|
2592
|
-
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;
|
|
2593
2906
|
}
|
|
2594
|
-
},
|
|
2907
|
+
}, ft = class {
|
|
2595
2908
|
constructor(e) {
|
|
2596
2909
|
this.options = e;
|
|
2597
2910
|
}
|
|
@@ -2621,12 +2934,12 @@ var st = class {
|
|
|
2621
2934
|
setOptions(e) {
|
|
2622
2935
|
return this.options = e, this;
|
|
2623
2936
|
}
|
|
2624
|
-
},
|
|
2937
|
+
}, pt = class {
|
|
2625
2938
|
constructor(e, t, n, r) {
|
|
2626
|
-
|
|
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) => {
|
|
2627
2940
|
if (this.matcher.isSelection(t)) return this.data.toFormatItem(e, !0);
|
|
2628
2941
|
if (this.options.getReturnEverything()) return this.data.toFormatItem(e, !1);
|
|
2629
|
-
}),
|
|
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);
|
|
2630
2943
|
}
|
|
2631
2944
|
getData() {
|
|
2632
2945
|
return this.data;
|
|
@@ -2661,9 +2974,9 @@ var st = class {
|
|
|
2661
2974
|
to() {
|
|
2662
2975
|
if (this.item.isSearch()) return this.data.forEach(this.callbackToSelection);
|
|
2663
2976
|
let e = this.data.getList();
|
|
2664
|
-
return e ?
|
|
2977
|
+
return e ? i(e, this.callbackToNone) : [];
|
|
2665
2978
|
}
|
|
2666
|
-
},
|
|
2979
|
+
}, mt = [
|
|
2667
2980
|
"d",
|
|
2668
2981
|
"e",
|
|
2669
2982
|
"f",
|
|
@@ -2683,62 +2996,72 @@ var st = class {
|
|
|
2683
2996
|
"t",
|
|
2684
2997
|
"u",
|
|
2685
2998
|
"v"
|
|
2686
|
-
],
|
|
2687
|
-
let
|
|
2999
|
+
], ht = (e, t = {}) => {
|
|
3000
|
+
let r = String(e);
|
|
2688
3001
|
if (e.match(/%[a-z]/)) {
|
|
2689
3002
|
let e = 0;
|
|
2690
|
-
|
|
2691
|
-
|
|
3003
|
+
i(t, (t) => {
|
|
3004
|
+
r = r.replace(RegExp(`%${mt[e++]}`, "g"), String(t));
|
|
2692
3005
|
});
|
|
2693
3006
|
}
|
|
2694
|
-
return
|
|
2695
|
-
|
|
2696
|
-
}),
|
|
2697
|
-
},
|
|
2698
|
-
|
|
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() {
|
|
2699
3015
|
return Object.keys(this.files).length > 0 && this.getIndex() !== void 0;
|
|
2700
3016
|
}
|
|
2701
|
-
|
|
3017
|
+
getLocation() {
|
|
3018
|
+
return _(this.location);
|
|
3019
|
+
}
|
|
3020
|
+
getLanguage() {
|
|
3021
|
+
return _(this.language);
|
|
3022
|
+
}
|
|
3023
|
+
async getList() {
|
|
2702
3024
|
let e = this.getIndex();
|
|
2703
3025
|
if (e) {
|
|
2704
3026
|
var t;
|
|
2705
3027
|
return (t = this.getByData(e)) == null ? await this.getByFile(e) : t;
|
|
2706
3028
|
}
|
|
2707
3029
|
}
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
3030
|
+
add(e) {
|
|
3031
|
+
i(e, (e, t) => {
|
|
3032
|
+
g(e) && (this.files[t] = e);
|
|
2711
3033
|
});
|
|
2712
3034
|
}
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
if (
|
|
2716
|
-
|
|
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;
|
|
2717
3041
|
}
|
|
2718
|
-
|
|
3042
|
+
getByData(e) {
|
|
2719
3043
|
if (e in this.data) return this.data[e];
|
|
2720
3044
|
}
|
|
2721
|
-
|
|
3045
|
+
async getByFile(e) {
|
|
2722
3046
|
if (e in this.files) {
|
|
2723
|
-
let t = await
|
|
3047
|
+
let t = await _(this.files[e]);
|
|
2724
3048
|
return t && (this.data[e] = t), t;
|
|
2725
3049
|
}
|
|
2726
3050
|
}
|
|
2727
|
-
}
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
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) {
|
|
2733
3056
|
var n;
|
|
2734
3057
|
let r = this.getText(e);
|
|
2735
|
-
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));
|
|
2736
3059
|
}
|
|
2737
|
-
|
|
3060
|
+
getSync(e, t = !1, n) {
|
|
2738
3061
|
let r = this.getText(e);
|
|
2739
3062
|
return r ? this.replacement(r, n) : t ? " " : e;
|
|
2740
3063
|
}
|
|
2741
|
-
|
|
3064
|
+
getList(e) {
|
|
2742
3065
|
return new Promise((t) => {
|
|
2743
3066
|
let n = {}, r = 0;
|
|
2744
3067
|
for (let i of e) {
|
|
@@ -2749,7 +3072,7 @@ var Q = class e {
|
|
|
2749
3072
|
}
|
|
2750
3073
|
});
|
|
2751
3074
|
}
|
|
2752
|
-
|
|
3075
|
+
getListSync(e, t = !1) {
|
|
2753
3076
|
let n = {};
|
|
2754
3077
|
for (let r of e) {
|
|
2755
3078
|
let e = Array.isArray(r) ? r[0] : r, i = Array.isArray(r) ? r.slice(1) : void 0;
|
|
@@ -2757,49 +3080,50 @@ var Q = class e {
|
|
|
2757
3080
|
}
|
|
2758
3081
|
return n;
|
|
2759
3082
|
}
|
|
2760
|
-
|
|
3083
|
+
add(e) {
|
|
2761
3084
|
return new Promise((t) => {
|
|
2762
|
-
|
|
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(() => {
|
|
2763
3087
|
this.timeout = void 0, this.make().then(() => {
|
|
2764
3088
|
this.resolveList.forEach((e) => e()), this.resolveList = [];
|
|
2765
3089
|
});
|
|
2766
3090
|
}, 160)) : t();
|
|
2767
3091
|
});
|
|
2768
3092
|
}
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
3093
|
+
addSync(e) {
|
|
3094
|
+
i(e, (e, t) => {
|
|
3095
|
+
u(e) && c(e) && (this.data[this.getName(t)] = e);
|
|
2772
3096
|
});
|
|
2773
3097
|
}
|
|
2774
|
-
|
|
2775
|
-
if (
|
|
3098
|
+
async addNormalOrSync(e) {
|
|
3099
|
+
if (c(e)) if (A.isLocalhost()) this.addSync(e);
|
|
2776
3100
|
else {
|
|
2777
3101
|
let t = Object.keys(e);
|
|
2778
3102
|
t.length > 0 && await this.add(t);
|
|
2779
3103
|
}
|
|
2780
3104
|
}
|
|
2781
|
-
|
|
2782
|
-
|
|
3105
|
+
addSyncByLocation(e) {
|
|
3106
|
+
i(e, (e, t) => i(e, (e, n) => {
|
|
2783
3107
|
let r = `${t}-${n}`;
|
|
2784
3108
|
r in this.data || (this.data[r] = e);
|
|
2785
3109
|
}));
|
|
2786
3110
|
}
|
|
2787
|
-
|
|
2788
|
-
|
|
3111
|
+
addSyncByFile(e) {
|
|
3112
|
+
this.files.add(e);
|
|
2789
3113
|
}
|
|
2790
|
-
|
|
2791
|
-
return this.url =
|
|
3114
|
+
setUrl(e) {
|
|
3115
|
+
return this.url = e, this;
|
|
2792
3116
|
}
|
|
2793
|
-
|
|
3117
|
+
setPropsName(e) {
|
|
2794
3118
|
return this.propsName = e, this;
|
|
2795
3119
|
}
|
|
2796
|
-
|
|
3120
|
+
setReadApi(e) {
|
|
2797
3121
|
return this.isReadApi = e, this;
|
|
2798
3122
|
}
|
|
2799
|
-
|
|
3123
|
+
hasName(e) {
|
|
2800
3124
|
return this.getName(e) in this.data || this.getNameByLanguage(e) in this.data || this.getNameByGlobal(e) in this.data;
|
|
2801
3125
|
}
|
|
2802
|
-
|
|
3126
|
+
getText(e) {
|
|
2803
3127
|
let t = this.getName(e);
|
|
2804
3128
|
if (t in this.data) return this.data[t];
|
|
2805
3129
|
let n = this.getNameByLanguage(e);
|
|
@@ -2807,23 +3131,23 @@ var Q = class e {
|
|
|
2807
3131
|
let r = this.getNameByGlobal(e);
|
|
2808
3132
|
if (r in this.data) return this.data[r];
|
|
2809
3133
|
}
|
|
2810
|
-
|
|
2811
|
-
return `${
|
|
3134
|
+
getName(e) {
|
|
3135
|
+
return `${this.files.getLocation()}-${e}`;
|
|
2812
3136
|
}
|
|
2813
|
-
|
|
2814
|
-
return `${
|
|
3137
|
+
getNameByLanguage(e) {
|
|
3138
|
+
return `${this.files.getLanguage()}-${e}`;
|
|
2815
3139
|
}
|
|
2816
|
-
|
|
2817
|
-
return `${
|
|
3140
|
+
getNameByGlobal(e) {
|
|
3141
|
+
return `${gt}-${e}`;
|
|
2818
3142
|
}
|
|
2819
|
-
|
|
3143
|
+
getNamesNone(e) {
|
|
2820
3144
|
let t = [];
|
|
2821
|
-
return
|
|
2822
|
-
e !== "__TRANSLATE_START__" && e !== "__TRANSLATE_END__" && !
|
|
3145
|
+
return E(e).forEach((e) => {
|
|
3146
|
+
e !== "__TRANSLATE_START__" && e !== "__TRANSLATE_END__" && !this.hasName(e) && t.push(e);
|
|
2823
3147
|
}), t;
|
|
2824
3148
|
}
|
|
2825
|
-
|
|
2826
|
-
let e = await
|
|
3149
|
+
async getResponse() {
|
|
3150
|
+
let e = await A.get({
|
|
2827
3151
|
api: !1,
|
|
2828
3152
|
path: this.url,
|
|
2829
3153
|
request: { [this.propsName]: this.cache },
|
|
@@ -2832,29 +3156,72 @@ var Q = class e {
|
|
|
2832
3156
|
});
|
|
2833
3157
|
return e == null ? {} : e;
|
|
2834
3158
|
}
|
|
2835
|
-
|
|
2836
|
-
return t ?
|
|
3159
|
+
replacement(e, t) {
|
|
3160
|
+
return t ? ht(e, t) : e;
|
|
2837
3161
|
}
|
|
2838
|
-
|
|
3162
|
+
async make() {
|
|
2839
3163
|
let e;
|
|
2840
|
-
|
|
3164
|
+
this.files.isFile() ? e = await this.files.getList() : this.isReadApi && (e = await this.getResponse()), e && this.makeList(e);
|
|
2841
3165
|
}
|
|
2842
|
-
|
|
3166
|
+
makeList(e) {
|
|
2843
3167
|
this.cache.forEach((t) => {
|
|
2844
3168
|
var n;
|
|
2845
3169
|
this.data[this.getName(t)] = (n = e == null ? void 0 : e[t]) == null ? "" : n;
|
|
2846
3170
|
}), this.cache = [];
|
|
2847
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
|
+
}
|
|
2848
3215
|
};
|
|
2849
|
-
|
|
3216
|
+
b(bt, "item", new yt());
|
|
2850
3217
|
//#endregion
|
|
2851
3218
|
//#region src/functions/arrFill.ts
|
|
2852
|
-
function
|
|
3219
|
+
function xt(e, t) {
|
|
2853
3220
|
return Array(t).fill(e);
|
|
2854
3221
|
}
|
|
2855
3222
|
//#endregion
|
|
2856
3223
|
//#region src/functions/blobToBase64.ts
|
|
2857
|
-
function
|
|
3224
|
+
function St(e) {
|
|
2858
3225
|
return new Promise((t, n) => {
|
|
2859
3226
|
let r = new FileReader();
|
|
2860
3227
|
r.onloadend = () => t(r.result), r.onerror = n, r.readAsDataURL(e);
|
|
@@ -2862,67 +3229,67 @@ function ht(e) {
|
|
|
2862
3229
|
}
|
|
2863
3230
|
//#endregion
|
|
2864
3231
|
//#region src/functions/domQuerySelector.ts
|
|
2865
|
-
function
|
|
2866
|
-
if (
|
|
3232
|
+
function Ct(e) {
|
|
3233
|
+
if (f()) {
|
|
2867
3234
|
var t;
|
|
2868
3235
|
return (t = document.querySelector(e)) == null ? void 0 : t;
|
|
2869
3236
|
}
|
|
2870
3237
|
}
|
|
2871
3238
|
//#endregion
|
|
2872
3239
|
//#region src/functions/domQuerySelectorAll.ts
|
|
2873
|
-
function
|
|
2874
|
-
if (
|
|
3240
|
+
function wt(e) {
|
|
3241
|
+
if (f()) return document.querySelectorAll(e);
|
|
2875
3242
|
}
|
|
2876
3243
|
//#endregion
|
|
2877
3244
|
//#region src/functions/getElementImage.ts
|
|
2878
|
-
function
|
|
2879
|
-
return
|
|
3245
|
+
function Z(e) {
|
|
3246
|
+
return u(e) ? W(void 0, "img", { src: e }) : e;
|
|
2880
3247
|
}
|
|
2881
3248
|
//#endregion
|
|
2882
3249
|
//#region src/functions/resizeImageByMax.ts
|
|
2883
|
-
function
|
|
3250
|
+
function Tt(e, t = "auto") {
|
|
2884
3251
|
switch (t) {
|
|
2885
3252
|
case "auto": return e.naturalWidth >= e.naturalHeight;
|
|
2886
3253
|
case "width": return !0;
|
|
2887
3254
|
case "height": return !1;
|
|
2888
3255
|
}
|
|
2889
3256
|
}
|
|
2890
|
-
function
|
|
2891
|
-
let i =
|
|
3257
|
+
function Et(e, t, n = "auto", r) {
|
|
3258
|
+
let i = Z(e);
|
|
2892
3259
|
if (i && (i.naturalWidth > t && (n === "auto" || n === "width") || i.naturalHeight > t && (n === "auto" || n === "height"))) {
|
|
2893
3260
|
var a;
|
|
2894
|
-
let e =
|
|
3261
|
+
let e = Tt(i, n), o = (a = document.createElement("canvas")) == null ? void 0 : a.getContext("2d");
|
|
2895
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);
|
|
2896
3263
|
}
|
|
2897
3264
|
}
|
|
2898
3265
|
//#endregion
|
|
2899
3266
|
//#region src/functions/ensureMaxSize.ts
|
|
2900
|
-
async function
|
|
3267
|
+
async function Dt(e, t = .56, n = "image/jpeg") {
|
|
2901
3268
|
return new Promise((r) => {
|
|
2902
|
-
let i = new Blob([e], { type: n }), a =
|
|
3269
|
+
let i = new Blob([e], { type: n }), a = Z(URL.createObjectURL(i));
|
|
2903
3270
|
a ? a.onload = () => {
|
|
2904
|
-
let e =
|
|
3271
|
+
let e = Et(a, t * a.naturalWidth, "width", n);
|
|
2905
3272
|
r(e == null ? "" : e);
|
|
2906
|
-
} :
|
|
3273
|
+
} : St(i).then((e) => r(String(e == null ? "" : e)));
|
|
2907
3274
|
});
|
|
2908
3275
|
}
|
|
2909
3276
|
//#endregion
|
|
2910
3277
|
//#region src/functions/eventStopPropagation.ts
|
|
2911
|
-
function
|
|
3278
|
+
function Ot(e) {
|
|
2912
3279
|
e.preventDefault(), e.stopPropagation();
|
|
2913
3280
|
}
|
|
2914
3281
|
//#endregion
|
|
2915
3282
|
//#region src/functions/frame.ts
|
|
2916
|
-
function
|
|
3283
|
+
function kt(e, t, n) {
|
|
2917
3284
|
let r = () => {
|
|
2918
|
-
e(), t != null && t() ?
|
|
3285
|
+
e(), t != null && t() ? kt(e, t, n) : n == null || n();
|
|
2919
3286
|
};
|
|
2920
|
-
|
|
3287
|
+
f() ? requestAnimationFrame(r) : r();
|
|
2921
3288
|
}
|
|
2922
3289
|
//#endregion
|
|
2923
3290
|
//#region src/functions/getAttributes.ts
|
|
2924
|
-
function
|
|
2925
|
-
let t = {}, n =
|
|
3291
|
+
function At(e) {
|
|
3292
|
+
let t = {}, n = T(e);
|
|
2926
3293
|
if (n) for (let e of n.attributes) {
|
|
2927
3294
|
var r;
|
|
2928
3295
|
t[e.name] = (r = (e == null ? void 0 : e.value) || (e == null ? void 0 : e.textContent)) == null ? void 0 : r;
|
|
@@ -2931,66 +3298,66 @@ function wt(e) {
|
|
|
2931
3298
|
}
|
|
2932
3299
|
//#endregion
|
|
2933
3300
|
//#region src/functions/getClipboardData.ts
|
|
2934
|
-
async function
|
|
3301
|
+
async function jt(e) {
|
|
2935
3302
|
var t, n;
|
|
2936
3303
|
return (t = e == null || (n = e.clipboardData) == null ? void 0 : n.getData("text")) == null ? await navigator.clipboard.readText() || "" : t;
|
|
2937
3304
|
}
|
|
2938
3305
|
//#endregion
|
|
2939
3306
|
//#region src/functions/getCurrentDate.ts
|
|
2940
|
-
function
|
|
2941
|
-
return new
|
|
3307
|
+
function Mt(e = "datetime") {
|
|
3308
|
+
return new Me(void 0, e).standard();
|
|
2942
3309
|
}
|
|
2943
3310
|
//#endregion
|
|
2944
3311
|
//#region src/functions/getElementId.ts
|
|
2945
|
-
var
|
|
2946
|
-
function
|
|
2947
|
-
let n =
|
|
2948
|
-
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++}`;
|
|
2949
3316
|
}
|
|
2950
3317
|
//#endregion
|
|
2951
3318
|
//#region src/functions/getKey.ts
|
|
2952
|
-
function
|
|
3319
|
+
function Ft(e) {
|
|
2953
3320
|
var t, n, r;
|
|
2954
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;
|
|
2955
3322
|
}
|
|
2956
3323
|
//#endregion
|
|
2957
3324
|
//#region src/functions/getLengthOfAllArray.ts
|
|
2958
|
-
function
|
|
2959
|
-
return
|
|
3325
|
+
function Q(e) {
|
|
3326
|
+
return i(e, (e) => e.length);
|
|
2960
3327
|
}
|
|
2961
3328
|
//#endregion
|
|
2962
3329
|
//#region src/functions/getMaxLengthAllArray.ts
|
|
2963
|
-
function
|
|
2964
|
-
return Math.max(...
|
|
3330
|
+
function It(e) {
|
|
3331
|
+
return Math.max(...Q(e));
|
|
2965
3332
|
}
|
|
2966
3333
|
//#endregion
|
|
2967
3334
|
//#region src/functions/getMinLengthAllArray.ts
|
|
2968
|
-
function
|
|
2969
|
-
return Math.min(...
|
|
3335
|
+
function Lt(e) {
|
|
3336
|
+
return Math.min(...Q(e));
|
|
2970
3337
|
}
|
|
2971
3338
|
//#endregion
|
|
2972
3339
|
//#region src/functions/getMouseClientX.ts
|
|
2973
|
-
function
|
|
3340
|
+
function Rt(e) {
|
|
2974
3341
|
var t, n;
|
|
2975
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;
|
|
2976
3343
|
}
|
|
2977
3344
|
//#endregion
|
|
2978
3345
|
//#region src/functions/getMouseClientY.ts
|
|
2979
|
-
function
|
|
3346
|
+
function zt(e) {
|
|
2980
3347
|
var t, n;
|
|
2981
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;
|
|
2982
3349
|
}
|
|
2983
3350
|
//#endregion
|
|
2984
3351
|
//#region src/functions/getMouseClient.ts
|
|
2985
|
-
function
|
|
3352
|
+
function Bt(e) {
|
|
2986
3353
|
return {
|
|
2987
|
-
x:
|
|
2988
|
-
y:
|
|
3354
|
+
x: Rt(e),
|
|
3355
|
+
y: zt(e)
|
|
2989
3356
|
};
|
|
2990
3357
|
}
|
|
2991
3358
|
//#endregion
|
|
2992
3359
|
//#region src/functions/getObjectByKeys.ts
|
|
2993
|
-
function
|
|
3360
|
+
function Vt(e, t) {
|
|
2994
3361
|
let n = {};
|
|
2995
3362
|
return t.forEach((t) => {
|
|
2996
3363
|
t in e && e[t] !== void 0 && (n[t] = e[t]);
|
|
@@ -2998,58 +3365,58 @@ function It(e, t) {
|
|
|
2998
3365
|
}
|
|
2999
3366
|
//#endregion
|
|
3000
3367
|
//#region src/functions/getObjectNoUndefined.ts
|
|
3001
|
-
function
|
|
3368
|
+
function Ht(e, t = void 0) {
|
|
3002
3369
|
let n = {};
|
|
3003
|
-
return
|
|
3370
|
+
return i(e, (e, r) => {
|
|
3004
3371
|
e !== t && (n[r] = e);
|
|
3005
3372
|
}), n;
|
|
3006
3373
|
}
|
|
3007
3374
|
//#endregion
|
|
3008
3375
|
//#region src/functions/getObjectOrNone.ts
|
|
3009
|
-
function
|
|
3010
|
-
return
|
|
3376
|
+
function Ut(e) {
|
|
3377
|
+
return n(e) ? e : {};
|
|
3011
3378
|
}
|
|
3012
3379
|
//#endregion
|
|
3013
3380
|
//#region src/functions/strFill.ts
|
|
3014
|
-
function
|
|
3015
|
-
return
|
|
3381
|
+
function Wt(e, t) {
|
|
3382
|
+
return xt(e, t).join("");
|
|
3016
3383
|
}
|
|
3017
3384
|
//#endregion
|
|
3018
3385
|
//#region src/functions/getRandomText.ts
|
|
3019
|
-
function
|
|
3020
|
-
let a =
|
|
3021
|
-
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)));
|
|
3022
3389
|
return o.join(" ");
|
|
3023
3390
|
}
|
|
3024
3391
|
//#endregion
|
|
3025
3392
|
//#region src/functions/getStepPercent.ts
|
|
3026
|
-
function
|
|
3393
|
+
function Kt(e, t) {
|
|
3027
3394
|
let n = e == null ? 0 : e;
|
|
3028
3395
|
return t > n ? 100 / (t - n) : 0;
|
|
3029
3396
|
}
|
|
3030
3397
|
//#endregion
|
|
3031
3398
|
//#region src/functions/getStepValue.ts
|
|
3032
|
-
function
|
|
3399
|
+
function qt(e, t) {
|
|
3033
3400
|
let n = e == null ? 0 : e;
|
|
3034
3401
|
return t > n ? (t - n) / 100 : 0;
|
|
3035
3402
|
}
|
|
3036
3403
|
//#endregion
|
|
3037
3404
|
//#region src/functions/goScroll.ts
|
|
3038
|
-
var
|
|
3039
|
-
function
|
|
3405
|
+
var Jt = 0;
|
|
3406
|
+
function Yt(e, t, n) {
|
|
3040
3407
|
let r = t == null ? void 0 : t.closest(e);
|
|
3041
3408
|
if (t && r && r.scrollHeight !== r.offsetHeight) {
|
|
3042
3409
|
let e = r.getBoundingClientRect(), i = t.getBoundingClientRect();
|
|
3043
3410
|
if (n) {
|
|
3044
3411
|
let a = n.getBoundingClientRect();
|
|
3045
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);
|
|
3046
|
-
} 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);
|
|
3047
3414
|
}
|
|
3048
3415
|
}
|
|
3049
3416
|
//#endregion
|
|
3050
3417
|
//#region src/functions/goScrollSmooth.ts
|
|
3051
|
-
function
|
|
3052
|
-
if (!
|
|
3418
|
+
function Xt(e, t, n = 0) {
|
|
3419
|
+
if (!f()) return;
|
|
3053
3420
|
let r = (t == null ? void 0 : t.behavior) || "smooth";
|
|
3054
3421
|
if ("scrollIntoView" in e && !n) {
|
|
3055
3422
|
e.scrollIntoView({
|
|
@@ -3070,8 +3437,8 @@ function Gt(e, t, n = 0) {
|
|
|
3070
3437
|
}
|
|
3071
3438
|
//#endregion
|
|
3072
3439
|
//#region src/functions/goScrollTo.ts
|
|
3073
|
-
function
|
|
3074
|
-
if (!
|
|
3440
|
+
function Zt(e, t, n = "smooth") {
|
|
3441
|
+
if (!f() || !e || !t) return;
|
|
3075
3442
|
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect();
|
|
3076
3443
|
e.scrollBy({
|
|
3077
3444
|
top: i.top - r.top,
|
|
@@ -3081,13 +3448,13 @@ function Kt(e, t, n = "smooth") {
|
|
|
3081
3448
|
}
|
|
3082
3449
|
//#endregion
|
|
3083
3450
|
//#region src/functions/isShare.ts
|
|
3084
|
-
function
|
|
3085
|
-
return
|
|
3451
|
+
function Qt() {
|
|
3452
|
+
return f() && typeof navigator < "u" && !!navigator.share;
|
|
3086
3453
|
}
|
|
3087
3454
|
//#endregion
|
|
3088
3455
|
//#region src/functions/handleShare.ts
|
|
3089
|
-
async function
|
|
3090
|
-
if (
|
|
3456
|
+
async function $t(e) {
|
|
3457
|
+
if (Qt() && navigator.canShare && navigator.canShare(e)) try {
|
|
3091
3458
|
return await navigator.share(e), !0;
|
|
3092
3459
|
} catch (e) {
|
|
3093
3460
|
console.error("handleShare error:", e);
|
|
@@ -3096,60 +3463,60 @@ async function Jt(e) {
|
|
|
3096
3463
|
}
|
|
3097
3464
|
//#endregion
|
|
3098
3465
|
//#region src/functions/inArray.ts
|
|
3099
|
-
function
|
|
3466
|
+
function en(e, t) {
|
|
3100
3467
|
return e.indexOf(t) !== -1;
|
|
3101
3468
|
}
|
|
3102
3469
|
//#endregion
|
|
3103
3470
|
//#region src/functions/initScrollbarOffset.ts
|
|
3104
|
-
async function
|
|
3105
|
-
if (
|
|
3471
|
+
async function tn() {
|
|
3472
|
+
if (f()) {
|
|
3106
3473
|
let e = await Y.get();
|
|
3107
3474
|
document.body.style.setProperty("--sys-scrollbar-offset", `${e}px`);
|
|
3108
3475
|
}
|
|
3109
3476
|
}
|
|
3110
3477
|
//#endregion
|
|
3111
3478
|
//#region src/functions/intersectKey.ts
|
|
3112
|
-
function
|
|
3113
|
-
let
|
|
3114
|
-
return
|
|
3115
|
-
|
|
3116
|
-
}),
|
|
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;
|
|
3117
3484
|
}
|
|
3118
3485
|
//#endregion
|
|
3119
3486
|
//#region src/functions/isApiSuccess.ts
|
|
3120
|
-
var
|
|
3487
|
+
var rn = (e) => {
|
|
3121
3488
|
var t;
|
|
3122
|
-
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/)));
|
|
3123
3490
|
};
|
|
3124
3491
|
//#endregion
|
|
3125
3492
|
//#region src/functions/isDifferent.ts
|
|
3126
|
-
function
|
|
3493
|
+
function an(e, t) {
|
|
3127
3494
|
let n = Object.keys(e).length !== Object.keys(t).length;
|
|
3128
|
-
return n ||
|
|
3495
|
+
return n || i(e, (e, r) => {
|
|
3129
3496
|
e !== (t == null ? void 0 : t[r]) && (n = !0);
|
|
3130
3497
|
}), n;
|
|
3131
3498
|
}
|
|
3132
3499
|
//#endregion
|
|
3133
3500
|
//#region src/functions/isElementVisible.ts
|
|
3134
|
-
function
|
|
3135
|
-
if (!
|
|
3136
|
-
let t =
|
|
3501
|
+
function on(e) {
|
|
3502
|
+
if (!f()) return !1;
|
|
3503
|
+
let t = T(e);
|
|
3137
3504
|
if (!t || "isConnected" in t && t.isConnected === !1) return !1;
|
|
3138
3505
|
let n = window.getComputedStyle(t);
|
|
3139
3506
|
return n.display !== "none" && n.visibility !== "hidden" && n.opacity !== "0" && t.offsetWidth !== 0 && t.offsetHeight !== 0;
|
|
3140
3507
|
}
|
|
3141
3508
|
//#endregion
|
|
3142
3509
|
//#region src/functions/isInput.ts
|
|
3143
|
-
var
|
|
3510
|
+
var sn = (e) => {
|
|
3144
3511
|
if (e instanceof HTMLElement) {
|
|
3145
3512
|
let t = e.tagName.toLowerCase();
|
|
3146
3513
|
return !!(t === "input" || t === "textarea" || t === "select" || e.isContentEditable || e.getAttribute("contenteditable") === "true");
|
|
3147
3514
|
}
|
|
3148
3515
|
return !1;
|
|
3149
|
-
},
|
|
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;
|
|
3150
3517
|
//#endregion
|
|
3151
3518
|
//#region src/functions/isFloat.ts
|
|
3152
|
-
function
|
|
3519
|
+
function ln(e) {
|
|
3153
3520
|
switch (typeof e) {
|
|
3154
3521
|
case "number": return !0;
|
|
3155
3522
|
case "string": return !!e.match(/^([0-9]+|[0-9]+\.[0-9]+)$/);
|
|
@@ -3158,18 +3525,18 @@ function rn(e) {
|
|
|
3158
3525
|
}
|
|
3159
3526
|
//#endregion
|
|
3160
3527
|
//#region src/functions/isIntegerBetween.ts
|
|
3161
|
-
function
|
|
3528
|
+
function un(e, t) {
|
|
3162
3529
|
let n = Math.floor(t);
|
|
3163
3530
|
return e >= n && e < n + 1;
|
|
3164
3531
|
}
|
|
3165
3532
|
//#endregion
|
|
3166
3533
|
//#region src/functions/isSelectedByList.ts
|
|
3167
|
-
function
|
|
3168
|
-
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);
|
|
3169
3536
|
}
|
|
3170
3537
|
//#endregion
|
|
3171
3538
|
//#region src/functions/removeCommonPrefix.ts
|
|
3172
|
-
function
|
|
3539
|
+
function fn(e, t) {
|
|
3173
3540
|
if (e.startsWith(t)) return e.slice(t.length).trim();
|
|
3174
3541
|
let n = 0;
|
|
3175
3542
|
for (; e[n] === t[n] && n < e.length && n < t.length;) n++;
|
|
@@ -3177,45 +3544,45 @@ function sn(e, t) {
|
|
|
3177
3544
|
}
|
|
3178
3545
|
//#endregion
|
|
3179
3546
|
//#region src/functions/replaceComponentName.ts
|
|
3180
|
-
var
|
|
3547
|
+
var pn = (e, t, n) => {
|
|
3181
3548
|
var r;
|
|
3182
3549
|
return e == null || (r = e.replace(RegExp(`<${t}`, "ig"), `<${n}`)) == null || (r = r.replace(RegExp(`</${t}`, "ig"), `</${n}`)) == null ? void 0 : r.trim();
|
|
3183
3550
|
};
|
|
3184
3551
|
//#endregion
|
|
3185
3552
|
//#region src/functions/uniqueArray.ts
|
|
3186
|
-
function
|
|
3553
|
+
function mn(e) {
|
|
3187
3554
|
return [...new Set(e)];
|
|
3188
3555
|
}
|
|
3189
3556
|
//#endregion
|
|
3190
3557
|
//#region src/functions/replaceRecursive.ts
|
|
3191
|
-
function $(e,
|
|
3192
|
-
let a =
|
|
3193
|
-
return
|
|
3194
|
-
let o = e == null ? void 0 : e[
|
|
3195
|
-
|
|
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;
|
|
3196
3563
|
}), a;
|
|
3197
3564
|
}
|
|
3198
3565
|
//#endregion
|
|
3199
3566
|
//#region src/functions/replaceTemplate.ts
|
|
3200
|
-
function
|
|
3567
|
+
function hn(e, t) {
|
|
3201
3568
|
let n = e;
|
|
3202
|
-
return
|
|
3203
|
-
n = n.replace(
|
|
3569
|
+
return i(t, (e, t) => {
|
|
3570
|
+
n = n.replace(ct(`[${t}]`), _(e));
|
|
3204
3571
|
}), n;
|
|
3205
3572
|
}
|
|
3206
3573
|
//#endregion
|
|
3207
3574
|
//#region src/functions/secondToTime.ts
|
|
3208
|
-
function
|
|
3209
|
-
let t =
|
|
3575
|
+
function gn(e) {
|
|
3576
|
+
let t = m(e);
|
|
3210
3577
|
return t > 0 ? `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}` : "00:00";
|
|
3211
3578
|
}
|
|
3212
3579
|
//#endregion
|
|
3213
3580
|
//#region src/functions/setValues.ts
|
|
3214
|
-
function
|
|
3581
|
+
function _n(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: i = !0, notEmpty: a = !1 }) {
|
|
3215
3582
|
if (n) {
|
|
3216
|
-
if (
|
|
3583
|
+
if (o(e)) {
|
|
3217
3584
|
let n = e.indexOf(t), i = [...e];
|
|
3218
|
-
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;
|
|
3219
3586
|
}
|
|
3220
3587
|
return e === t ? [] : e ? [e, t] : [t];
|
|
3221
3588
|
}
|
|
@@ -3223,51 +3590,51 @@ function fn(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: i = !0, no
|
|
|
3223
3590
|
}
|
|
3224
3591
|
//#endregion
|
|
3225
3592
|
//#region src/functions/splice.ts
|
|
3226
|
-
function
|
|
3227
|
-
if (
|
|
3228
|
-
if (
|
|
3593
|
+
function vn(e, n, r) {
|
|
3594
|
+
if (t(e) && t(n)) {
|
|
3595
|
+
if (r) {
|
|
3229
3596
|
let a = {}, o = !1;
|
|
3230
|
-
return
|
|
3231
|
-
!o && (
|
|
3232
|
-
}), 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);
|
|
3233
3600
|
}
|
|
3234
|
-
if (n
|
|
3601
|
+
if (t(n)) return $(e, n);
|
|
3235
3602
|
}
|
|
3236
|
-
return
|
|
3603
|
+
return d(e);
|
|
3237
3604
|
}
|
|
3238
3605
|
//#endregion
|
|
3239
3606
|
//#region src/functions/toCamelCaseFirst.ts
|
|
3240
|
-
function
|
|
3241
|
-
return
|
|
3607
|
+
function yn(e) {
|
|
3608
|
+
return Pe(e).replace(/^([a-z])/, (e) => `${e.toUpperCase()}`);
|
|
3242
3609
|
}
|
|
3243
3610
|
//#endregion
|
|
3244
3611
|
//#region src/functions/toKebabCase.ts
|
|
3245
|
-
function
|
|
3612
|
+
function bn(e) {
|
|
3246
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());
|
|
3247
3614
|
}
|
|
3248
3615
|
//#endregion
|
|
3249
3616
|
//#region src/functions/toNumberByMax.ts
|
|
3250
|
-
function
|
|
3251
|
-
let i =
|
|
3252
|
-
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);
|
|
3253
3620
|
}
|
|
3254
|
-
var
|
|
3621
|
+
var Sn = (e, t, n) => t ? new L(n).number(e) : e;
|
|
3255
3622
|
//#endregion
|
|
3256
3623
|
//#region src/functions/toPercent.ts
|
|
3257
|
-
function
|
|
3624
|
+
function Cn(e, t) {
|
|
3258
3625
|
return 1 / e * t;
|
|
3259
3626
|
}
|
|
3260
3627
|
//#endregion
|
|
3261
3628
|
//#region src/functions/toPercentBy100.ts
|
|
3262
|
-
function
|
|
3263
|
-
return
|
|
3629
|
+
function wn(e, t) {
|
|
3630
|
+
return Cn(e, t) * 100;
|
|
3264
3631
|
}
|
|
3265
3632
|
//#endregion
|
|
3266
3633
|
//#region src/functions/uint8ArrayToBase64.ts
|
|
3267
|
-
function
|
|
3634
|
+
function Tn(e) {
|
|
3268
3635
|
let t = "";
|
|
3269
3636
|
for (let n of e) t += String.fromCharCode(n);
|
|
3270
|
-
if (
|
|
3637
|
+
if (f()) return window.btoa(t);
|
|
3271
3638
|
if (globalThis && globalThis.Buffer) {
|
|
3272
3639
|
var n;
|
|
3273
3640
|
return (n = globalThis) == null ? void 0 : n.Buffer.from(e).toString("base64");
|
|
@@ -3276,8 +3643,8 @@ function bn(e) {
|
|
|
3276
3643
|
}
|
|
3277
3644
|
//#endregion
|
|
3278
3645
|
//#region src/functions/writeClipboardData.ts
|
|
3279
|
-
async function
|
|
3280
|
-
if (
|
|
3646
|
+
async function En(e) {
|
|
3647
|
+
if (f()) try {
|
|
3281
3648
|
await navigator.clipboard.writeText(e);
|
|
3282
3649
|
} catch (n) {
|
|
3283
3650
|
var t;
|
|
@@ -3285,4 +3652,4 @@ async function xn(e) {
|
|
|
3285
3652
|
}
|
|
3286
3653
|
}
|
|
3287
3654
|
//#endregion
|
|
3288
|
-
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 };
|