@aiao/utils 0.0.6 → 0.0.7
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/@browser/index.d.ts +1 -0
- package/dist/@browser/index.d.ts.map +1 -1
- package/dist/@browser/leader-election.d.ts +40 -2
- package/dist/@browser/leader-election.d.ts.map +1 -1
- package/dist/@browser/requestIdleCallbackPolyfill.d.ts +2 -0
- package/dist/@browser/requestIdleCallbackPolyfill.d.ts.map +1 -0
- package/dist/array/difference.d.ts +3 -3
- package/dist/array/flatten.d.ts +3 -3
- package/dist/array/flattenDeep.d.ts +3 -3
- package/dist/array/intersection.d.ts +4 -4
- package/dist/array/needArray.d.ts +5 -10
- package/dist/array/needArray.d.ts.map +1 -1
- package/dist/array/orderBy.d.ts +18 -4
- package/dist/array/orderBy.d.ts.map +1 -1
- package/dist/array/sortBy.d.ts +4 -4
- package/dist/array/unionBy.d.ts +20 -0
- package/dist/array/unionBy.d.ts.map +1 -1
- package/dist/async/nextMacroTask.d.ts +11 -2
- package/dist/async/nextMacroTask.d.ts.map +1 -1
- package/dist/async/nextMicroTask.d.ts +1 -1
- package/dist/binary/uint8ArrayToString.d.ts +1 -1
- package/dist/collection/traverseObjectKeys.d.ts.map +1 -1
- package/dist/crypto/aesDecrypt.d.ts +12 -5
- package/dist/crypto/aesDecrypt.d.ts.map +1 -1
- package/dist/crypto/aesEncrypt.d.ts +2 -2
- package/dist/crypto/rsaGenerateKey.d.ts +22 -0
- package/dist/crypto/rsaGenerateKey.d.ts.map +1 -1
- package/dist/date/parseTime.d.ts +23 -0
- package/dist/date/parseTime.d.ts.map +1 -1
- package/dist/date/stringTime.d.ts +12 -0
- package/dist/date/stringTime.d.ts.map +1 -1
- package/dist/function/once.d.ts +2 -2
- package/dist/function/throttle.d.ts +3 -3
- package/dist/index.js +247 -214
- package/dist/indexing/fractional-indexing.d.ts +46 -10
- package/dist/indexing/fractional-indexing.d.ts.map +1 -1
- package/dist/number/canBeNumber.d.ts +2 -2
- package/dist/number/numberStep.d.ts +2 -2
- package/dist/number/numberStepScreenSize.d.ts +13 -0
- package/dist/number/numberStepScreenSize.d.ts.map +1 -1
- package/dist/number/numberStrip.d.ts +3 -3
- package/dist/number/toInt.d.ts +12 -6
- package/dist/number/toInt.d.ts.map +1 -1
- package/dist/number/tryToNumber.d.ts +17 -8
- package/dist/number/tryToNumber.d.ts.map +1 -1
- package/dist/object/deepFreeze.d.ts +17 -1
- package/dist/object/deepFreeze.d.ts.map +1 -1
- package/dist/object/flattenPathObjectToPlainObject.d.ts +14 -3
- package/dist/object/flattenPathObjectToPlainObject.d.ts.map +1 -1
- package/dist/object/get.d.ts +2 -2
- package/dist/object/has.d.ts +2 -2
- package/dist/object/isEqual.d.ts +3 -3
- package/dist/object/omit.d.ts +2 -2
- package/dist/object/omitBy.d.ts +3 -3
- package/dist/object/pick.d.ts +2 -2
- package/dist/object/plainObjectToFlattenPathObject.d.ts +10 -4
- package/dist/object/plainObjectToFlattenPathObject.d.ts.map +1 -1
- package/dist/object/set.d.ts +3 -3
- package/dist/object/setWith.d.ts +0 -1
- package/dist/object/setWith.d.ts.map +1 -1
- package/dist/object/toPlainObject.d.ts +19 -0
- package/dist/object/toPlainObject.d.ts.map +1 -1
- package/dist/object/zipObject.d.ts +22 -5
- package/dist/object/zipObject.d.ts.map +1 -1
- package/dist/platform/is-browser.d.ts +14 -1
- package/dist/platform/is-browser.d.ts.map +1 -1
- package/dist/random/randomArrayItem.d.ts +18 -1
- package/dist/random/randomArrayItem.d.ts.map +1 -1
- package/dist/random/randomFloat.d.ts +16 -0
- package/dist/random/randomFloat.d.ts.map +1 -1
- package/dist/random/randomInt.d.ts +14 -4
- package/dist/random/randomInt.d.ts.map +1 -1
- package/dist/random/randomString.d.ts +16 -0
- package/dist/random/randomString.d.ts.map +1 -1
- package/dist/random/randomUintByLength.d.ts +15 -0
- package/dist/random/randomUintByLength.d.ts.map +1 -1
- package/dist/random/randomUintString.d.ts +15 -0
- package/dist/random/randomUintString.d.ts.map +1 -1
- package/dist/string/camelCase.d.ts +1 -1
- package/dist/string/getWords.d.ts +21 -0
- package/dist/string/getWords.d.ts.map +1 -1
- package/dist/string/kebabCase.d.ts +2 -2
- package/dist/string/stringSingleline.d.ts +14 -1
- package/dist/string/stringSingleline.d.ts.map +1 -1
- package/dist/string/stringToArrayBuffer.d.ts +0 -1
- package/dist/string/stringToArrayBuffer.d.ts.map +1 -1
- package/dist/tools/event.d.ts +31 -25
- package/dist/tools/event.d.ts.map +1 -1
- package/dist/type-definition/result-types.d.ts +26 -4
- package/dist/type-definition/result-types.d.ts.map +1 -1
- package/dist/types/AnyFunction.d.ts +2 -2
- package/dist/types/DeepPartial.d.ts +3 -3
- package/dist/types/isArray.d.ts +1 -1
- package/dist/types/isArrayBuffer.d.ts +3 -3
- package/dist/types/isBoolean.d.ts +3 -3
- package/dist/types/isDate.d.ts +3 -3
- package/dist/types/isEmpty.d.ts +4 -4
- package/dist/types/isNil.d.ts +2 -2
- package/dist/types/isNumber.d.ts +3 -3
- package/dist/types/isObject.d.ts +2 -2
- package/dist/types/isPlainObject.d.ts +3 -3
- package/dist/types/isPrimitive.d.ts +3 -3
- package/dist/types/isRegExp.d.ts +3 -3
- package/dist/types/isString.d.ts +2 -2
- package/dist/types/isUint8Array.d.ts +3 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Observable as
|
|
2
|
-
import
|
|
3
|
-
import { distance as
|
|
4
|
-
class
|
|
1
|
+
import { Observable as ce, shareReplay as ie, BehaviorSubject as ae, distinctUntilChanged as le } from "rxjs";
|
|
2
|
+
import ue from "ms";
|
|
3
|
+
import { distance as fe } from "fastest-levenshtein";
|
|
4
|
+
class he {
|
|
5
5
|
cache = /* @__PURE__ */ new Map();
|
|
6
6
|
/**
|
|
7
7
|
* 发送消息到指定频道
|
|
@@ -24,7 +24,7 @@ class pe {
|
|
|
24
24
|
const r = this.cache.get(t);
|
|
25
25
|
if (r)
|
|
26
26
|
return r.refCount++, r.observable;
|
|
27
|
-
const n = new BroadcastChannel(t), o = new
|
|
27
|
+
const n = new BroadcastChannel(t), o = new ce((s) => {
|
|
28
28
|
const i = (a) => {
|
|
29
29
|
try {
|
|
30
30
|
s.next(a.data);
|
|
@@ -35,7 +35,7 @@ class pe {
|
|
|
35
35
|
return n.addEventListener("message", i), () => {
|
|
36
36
|
n.removeEventListener("message", i), this.decrementRef(t);
|
|
37
37
|
};
|
|
38
|
-
}).pipe(
|
|
38
|
+
}).pipe(ie(1)), c = {
|
|
39
39
|
observable: o,
|
|
40
40
|
channel: n,
|
|
41
41
|
refCount: 1
|
|
@@ -50,10 +50,10 @@ class pe {
|
|
|
50
50
|
r && (r.refCount--, r.refCount <= 0 && (r.channel.close(), this.cache.delete(t)));
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
const
|
|
54
|
-
message$:
|
|
55
|
-
emit: (n) =>
|
|
56
|
-
}),
|
|
53
|
+
const B = new he(), tt = (e) => ({
|
|
54
|
+
message$: B.on(e),
|
|
55
|
+
emit: (n) => B.emit(e, n)
|
|
56
|
+
}), pe = [
|
|
57
57
|
"mousemove",
|
|
58
58
|
"keydown",
|
|
59
59
|
"wheel",
|
|
@@ -67,11 +67,11 @@ const I = new pe(), rt = (e) => ({
|
|
|
67
67
|
"visibilitychange",
|
|
68
68
|
"focus"
|
|
69
69
|
];
|
|
70
|
-
class
|
|
70
|
+
class rt {
|
|
71
71
|
#e = 1e3 * 2;
|
|
72
72
|
#t;
|
|
73
|
-
#r = new
|
|
74
|
-
idle$ = this.#r.asObservable().pipe(
|
|
73
|
+
#r = new ae(!1);
|
|
74
|
+
idle$ = this.#r.asObservable().pipe(le());
|
|
75
75
|
constructor(t) {
|
|
76
76
|
this.#e = t?.timeout || this.#e;
|
|
77
77
|
}
|
|
@@ -84,7 +84,7 @@ class nt {
|
|
|
84
84
|
}, this.#e);
|
|
85
85
|
};
|
|
86
86
|
#o() {
|
|
87
|
-
|
|
87
|
+
pe.forEach(
|
|
88
88
|
(t) => document.addEventListener(t, this.#n, {
|
|
89
89
|
capture: !0,
|
|
90
90
|
passive: !0
|
|
@@ -92,31 +92,48 @@ class nt {
|
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
class
|
|
95
|
+
class nt {
|
|
96
|
+
/**
|
|
97
|
+
* @param name - 锁名称,相同名称的实例竞争同一个 leader 位置
|
|
98
|
+
*/
|
|
96
99
|
constructor(t) {
|
|
97
|
-
this.name = t, window.addEventListener("beforeunload",
|
|
100
|
+
this.name = t, window.addEventListener("beforeunload", this.#s);
|
|
98
101
|
}
|
|
99
|
-
#e
|
|
100
|
-
#t
|
|
101
|
-
#r;
|
|
102
|
-
#n;
|
|
102
|
+
#e;
|
|
103
|
+
#t;
|
|
104
|
+
#r = !1;
|
|
105
|
+
#n = !1;
|
|
106
|
+
#o = /* @__PURE__ */ new Set();
|
|
107
|
+
/** 当前是否为 leader */
|
|
103
108
|
get isLeader() {
|
|
104
|
-
return this.#
|
|
109
|
+
return this.#n;
|
|
105
110
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
/**
|
|
112
|
+
* 参与 leader 选举
|
|
113
|
+
* @param callback - 成为 leader 时回调,参数为 `true`
|
|
114
|
+
* @returns 取消订阅函数
|
|
115
|
+
*/
|
|
116
|
+
elect(t) {
|
|
117
|
+
return this.#o.add(t), this.#n ? t(!0) : this.#e || (this.#e = navigator.locks.request(this.name, async () => {
|
|
118
|
+
this.#n = !0, this.#o.forEach((r) => r(!0)), await new Promise((r) => {
|
|
119
|
+
this.#t = r;
|
|
120
|
+
});
|
|
121
|
+
})), () => this.#o.delete(t);
|
|
122
|
+
}
|
|
123
|
+
/** 释放 leader 身份并清理资源 */
|
|
124
|
+
dispose() {
|
|
125
|
+
this.#r || (this.#r = !0, window.removeEventListener("beforeunload", this.#s), this.#t?.(), this.#o.clear());
|
|
110
126
|
}
|
|
127
|
+
#s = () => this.dispose();
|
|
111
128
|
}
|
|
112
|
-
const
|
|
129
|
+
const de = () => "storage" in navigator && "getDirectory" in navigator.storage, ot = async () => {
|
|
113
130
|
try {
|
|
114
|
-
return
|
|
131
|
+
return de() ? !!await navigator.storage.getDirectory() : !1;
|
|
115
132
|
} catch (e) {
|
|
116
133
|
return console.error("OPFS not available:", e), !1;
|
|
117
134
|
}
|
|
118
135
|
};
|
|
119
|
-
function
|
|
136
|
+
function st(e, t) {
|
|
120
137
|
if (e.length === 0) return;
|
|
121
138
|
let r = 0;
|
|
122
139
|
function n() {
|
|
@@ -128,16 +145,26 @@ function ct(e, t) {
|
|
|
128
145
|
}
|
|
129
146
|
n();
|
|
130
147
|
}
|
|
131
|
-
const
|
|
148
|
+
const ct = () => {
|
|
149
|
+
window.requestIdleCallback = window.requestIdleCallback || ((e) => {
|
|
150
|
+
const t = Date.now();
|
|
151
|
+
return setTimeout(() => {
|
|
152
|
+
e({
|
|
153
|
+
didTimeout: !1,
|
|
154
|
+
timeRemaining: () => Math.max(0, 50 - (Date.now() - t))
|
|
155
|
+
});
|
|
156
|
+
}, 0);
|
|
157
|
+
}), window.cancelIdleCallback = window.cancelIdleCallback || ((e) => clearTimeout(e));
|
|
158
|
+
}, it = (e, t) => {
|
|
132
159
|
const r = Math.floor(t), n = [];
|
|
133
160
|
for (let o = 0; o < e.length; o += r)
|
|
134
161
|
n.push(e.slice(o, o + r));
|
|
135
162
|
return n;
|
|
136
|
-
}, at = (e, t) => e.filter((r) => !t.includes(r)), lt = (e) => Array.prototype.concat([], ...e),
|
|
163
|
+
}, at = (e, t) => e.filter((r) => !t.includes(r)), lt = (e) => Array.prototype.concat([], ...e), me = (e) => e.flatMap((t) => Array.isArray(t) ? me(t) : t), ut = (...e) => e.reduce((t, r) => t.filter((n) => r.includes(n))), b = Array.isArray, ye = (e) => e instanceof ArrayBuffer;
|
|
137
164
|
function ft(e) {
|
|
138
165
|
return e === !0 || e === !1 || e != null && typeof e.valueOf() == "boolean";
|
|
139
166
|
}
|
|
140
|
-
function
|
|
167
|
+
function G(e) {
|
|
141
168
|
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
|
|
142
169
|
}
|
|
143
170
|
const d = (e) => !!(e && e.constructor && e.call && e.apply), p = (e) => {
|
|
@@ -146,25 +173,25 @@ const d = (e) => !!(e && e.constructor && e.call && e.apply), p = (e) => {
|
|
|
146
173
|
} catch {
|
|
147
174
|
return !1;
|
|
148
175
|
}
|
|
149
|
-
},
|
|
176
|
+
}, ge = (e) => e && e.constructor === Symbol, ht = (e) => {
|
|
150
177
|
if (e === !0 || e === !1 || e === null || e === void 0) return !0;
|
|
151
178
|
if (p(e)) return e === 0;
|
|
152
|
-
if (
|
|
153
|
-
if (d(e) ||
|
|
179
|
+
if (G(e)) return isNaN(e.getTime());
|
|
180
|
+
if (d(e) || ge(e)) return !1;
|
|
154
181
|
const t = e.length;
|
|
155
182
|
if (p(t)) return t === 0;
|
|
156
183
|
const r = e.size;
|
|
157
184
|
return p(r) ? r === 0 : Object.keys(e).length === 0;
|
|
158
|
-
}, pt = (e) => p(e) && e % 1 !== 0,
|
|
185
|
+
}, pt = (e) => p(e) && e % 1 !== 0, we = (e) => Number.isInteger(e);
|
|
159
186
|
function dt(e) {
|
|
160
|
-
return b(e) && e.every(
|
|
187
|
+
return b(e) && e.every(we);
|
|
161
188
|
}
|
|
162
|
-
const
|
|
189
|
+
const V = (e) => e == null;
|
|
163
190
|
function mt(e) {
|
|
164
191
|
return b(e) && e.every(p);
|
|
165
192
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
193
|
+
const R = (e) => !!e && e.constructor === Object, yt = (e) => typeof e == "object" && e !== null;
|
|
194
|
+
function Ae(e) {
|
|
168
195
|
if (Object.prototype.toString.call(e) !== "[object Object]")
|
|
169
196
|
return !1;
|
|
170
197
|
const t = Object.getPrototypeOf(e);
|
|
@@ -177,10 +204,10 @@ const wt = (e) => !(!e || !e.then || !d(e.then));
|
|
|
177
204
|
function At(e) {
|
|
178
205
|
return e instanceof RegExp;
|
|
179
206
|
}
|
|
180
|
-
function
|
|
207
|
+
function C(e) {
|
|
181
208
|
return typeof e == "string";
|
|
182
209
|
}
|
|
183
|
-
const Et = (e) => b(e) ? e.every(
|
|
210
|
+
const Et = (e) => b(e) ? e.every(C) : !1, $ = (e) => e instanceof Uint8Array, St = (e) => Array.isArray(e) ? e : V(e) ? [] : [e], bt = (e, t = [], r = []) => {
|
|
184
211
|
const n = [...e];
|
|
185
212
|
return n.sort((o, c) => {
|
|
186
213
|
for (let s = 0; s < t.length; s++) {
|
|
@@ -194,11 +221,11 @@ const Et = (e) => b(e) ? e.every(O) : !1, $ = (e) => e instanceof Uint8Array, St
|
|
|
194
221
|
}
|
|
195
222
|
return 0;
|
|
196
223
|
}), n;
|
|
197
|
-
},
|
|
224
|
+
}, Ct = (e) => (t, r) => {
|
|
198
225
|
const n = t[e], o = r[e];
|
|
199
226
|
return n == null && o == null ? 0 : n == null ? 1 : o == null ? -1 : n > o ? 1 : n < o ? -1 : 0;
|
|
200
|
-
},
|
|
201
|
-
class
|
|
227
|
+
}, Ot = (e, t) => e.filter(/* @__PURE__ */ ((r) => (n) => r.has(t(n)) ? !1 : r.add(t(n)))(/* @__PURE__ */ new Set()));
|
|
228
|
+
class Tt {
|
|
202
229
|
maxConcurrent;
|
|
203
230
|
running = 0;
|
|
204
231
|
queue = [];
|
|
@@ -293,49 +320,49 @@ class Ct {
|
|
|
293
320
|
});
|
|
294
321
|
}
|
|
295
322
|
}
|
|
296
|
-
const Pt = (e) => setTimeout(() => e(), 0), L = /* @__PURE__ */ Promise.resolve(), $t = (e) => e ? L.then(e) : L, Mt = (e) => new Promise((t) => setTimeout(t, e)),
|
|
297
|
-
function
|
|
323
|
+
const Pt = (e) => setTimeout(() => e(), 0), L = /* @__PURE__ */ Promise.resolve(), $t = (e) => e ? L.then(e) : L, Mt = (e) => new Promise((t) => setTimeout(t, e)), Ee = new TextDecoder(), Rt = (e) => Ee.decode(e);
|
|
324
|
+
function Se(e, t) {
|
|
298
325
|
for (const r in e)
|
|
299
|
-
Object.prototype.hasOwnProperty.call(e, r) && (t(r, e[r], e),
|
|
326
|
+
Object.prototype.hasOwnProperty.call(e, r) && (t(r, e[r], e), Z(e[r], t));
|
|
300
327
|
}
|
|
301
|
-
const
|
|
302
|
-
Array.isArray(e) ? e.forEach((r) =>
|
|
303
|
-
},
|
|
328
|
+
const Z = (e, t) => {
|
|
329
|
+
Array.isArray(e) ? e.forEach((r) => Z(r, t)) : R(e) && Se(e, t);
|
|
330
|
+
}, T = (e) => new Uint8Array(
|
|
304
331
|
atob(e).split("").map((t) => t.charCodeAt(0))
|
|
305
332
|
);
|
|
306
|
-
async function
|
|
333
|
+
async function _t(e, t, r) {
|
|
307
334
|
const n = await crypto.subtle.importKey(
|
|
308
335
|
"raw",
|
|
309
|
-
|
|
336
|
+
T(t),
|
|
310
337
|
{
|
|
311
338
|
name: "AES-GCM",
|
|
312
339
|
length: 256
|
|
313
340
|
},
|
|
314
341
|
!0,
|
|
315
342
|
["decrypt"]
|
|
316
|
-
), o =
|
|
343
|
+
), o = T(r), c = await crypto.subtle.decrypt(
|
|
317
344
|
{
|
|
318
345
|
name: "AES-GCM",
|
|
319
346
|
iv: o
|
|
320
347
|
},
|
|
321
348
|
n,
|
|
322
|
-
|
|
349
|
+
T(e)
|
|
323
350
|
);
|
|
324
351
|
return new TextDecoder().decode(c);
|
|
325
352
|
}
|
|
326
353
|
const S = (e) => {
|
|
327
|
-
if (
|
|
354
|
+
if (C(e))
|
|
328
355
|
return btoa(e);
|
|
329
356
|
if ($(e) || Array.isArray(e))
|
|
330
357
|
return btoa(String.fromCharCode(...e));
|
|
331
|
-
if (
|
|
358
|
+
if (ye(e)) {
|
|
332
359
|
const t = new Uint8Array(e);
|
|
333
360
|
return btoa(String.fromCharCode(...t));
|
|
334
361
|
}
|
|
335
362
|
throw new TypeError(`Unsupported type for base64 encoding: ${typeof e}`);
|
|
336
|
-
}, { subtle:
|
|
337
|
-
async function
|
|
338
|
-
return await
|
|
363
|
+
}, { subtle: be } = globalThis.crypto;
|
|
364
|
+
async function Ce() {
|
|
365
|
+
return await be.generateKey(
|
|
339
366
|
{
|
|
340
367
|
name: "AES-GCM",
|
|
341
368
|
length: 256
|
|
@@ -344,12 +371,12 @@ async function Te() {
|
|
|
344
371
|
["encrypt", "decrypt"]
|
|
345
372
|
);
|
|
346
373
|
}
|
|
347
|
-
async function
|
|
374
|
+
async function Oe(e) {
|
|
348
375
|
const t = await crypto.subtle.exportKey("raw", e);
|
|
349
376
|
return S(t);
|
|
350
377
|
}
|
|
351
|
-
async function
|
|
352
|
-
const t = new TextEncoder(), r = await
|
|
378
|
+
async function It(e) {
|
|
379
|
+
const t = new TextEncoder(), r = await Ce(), n = crypto.getRandomValues(new Uint8Array(16)), o = await crypto.subtle.encrypt(
|
|
353
380
|
{
|
|
354
381
|
name: "AES-GCM",
|
|
355
382
|
iv: n
|
|
@@ -358,25 +385,25 @@ async function xt(e) {
|
|
|
358
385
|
t.encode(e)
|
|
359
386
|
);
|
|
360
387
|
return {
|
|
361
|
-
key: await
|
|
388
|
+
key: await Oe(r),
|
|
362
389
|
iv: S(n),
|
|
363
390
|
cipherText: S(o)
|
|
364
391
|
};
|
|
365
392
|
}
|
|
366
|
-
const
|
|
393
|
+
const Te = (e) => atob(e.replace(/[-]/g, "+").replace(/[_]/g, "/")), xt = (e) => {
|
|
367
394
|
const t = e.split(".");
|
|
368
395
|
if (t.length !== 3) throw new Error("JWT is not valid: not a JWT structure");
|
|
369
396
|
const r = t[1];
|
|
370
|
-
return JSON.parse(
|
|
397
|
+
return JSON.parse(Te(r));
|
|
371
398
|
};
|
|
372
|
-
function
|
|
399
|
+
function _(e) {
|
|
373
400
|
const t = new ArrayBuffer(e.length), r = new Uint8Array(t);
|
|
374
401
|
for (let n = 0, o = e.length; n < o; n++)
|
|
375
402
|
r[n] = e.charCodeAt(n);
|
|
376
403
|
return t;
|
|
377
404
|
}
|
|
378
|
-
function
|
|
379
|
-
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n =
|
|
405
|
+
function Pe(e) {
|
|
406
|
+
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n = _(r);
|
|
380
407
|
return crypto.subtle.importKey(
|
|
381
408
|
"pkcs8",
|
|
382
409
|
n,
|
|
@@ -388,18 +415,18 @@ function $e(e) {
|
|
|
388
415
|
["decrypt"]
|
|
389
416
|
);
|
|
390
417
|
}
|
|
391
|
-
async function
|
|
392
|
-
const r = await
|
|
418
|
+
async function Bt(e, t) {
|
|
419
|
+
const r = await Pe(t), n = await crypto.subtle.decrypt(
|
|
393
420
|
{
|
|
394
421
|
name: "RSA-OAEP"
|
|
395
422
|
},
|
|
396
423
|
r,
|
|
397
|
-
|
|
424
|
+
T(e)
|
|
398
425
|
);
|
|
399
426
|
return new TextDecoder().decode(n);
|
|
400
427
|
}
|
|
401
|
-
function
|
|
402
|
-
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n =
|
|
428
|
+
function $e(e) {
|
|
429
|
+
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n = _(r);
|
|
403
430
|
return crypto.subtle.importKey(
|
|
404
431
|
"spki",
|
|
405
432
|
n,
|
|
@@ -412,21 +439,21 @@ function Me(e) {
|
|
|
412
439
|
);
|
|
413
440
|
}
|
|
414
441
|
async function Lt(e, t) {
|
|
415
|
-
const r = await
|
|
442
|
+
const r = await $e(t), n = await crypto.subtle.encrypt(
|
|
416
443
|
{
|
|
417
444
|
name: "RSA-OAEP"
|
|
418
445
|
},
|
|
419
446
|
r,
|
|
420
|
-
|
|
447
|
+
_(e)
|
|
421
448
|
);
|
|
422
449
|
return S(n);
|
|
423
450
|
}
|
|
424
|
-
const
|
|
451
|
+
const N = "PUBLIC KEY", j = "RSA PRIVATE KEY";
|
|
425
452
|
async function D(e, t = "pkcs8") {
|
|
426
453
|
const r = await crypto.subtle.exportKey(t, e);
|
|
427
454
|
return S(r);
|
|
428
455
|
}
|
|
429
|
-
async function
|
|
456
|
+
async function Nt(e = 1024) {
|
|
430
457
|
const { publicKey: t, privateKey: r } = await crypto.subtle.generateKey(
|
|
431
458
|
{
|
|
432
459
|
name: "RSA-OAEP",
|
|
@@ -440,15 +467,15 @@ async function jt(e = 1024) {
|
|
|
440
467
|
["encrypt", "decrypt"]
|
|
441
468
|
), n = await D(t, "spki"), o = await D(r, "pkcs8");
|
|
442
469
|
return {
|
|
443
|
-
publicKey: `-----BEGIN ${
|
|
470
|
+
publicKey: `-----BEGIN ${N}-----
|
|
444
471
|
${n}
|
|
445
|
-
-----END ${
|
|
446
|
-
privateKey: `-----BEGIN ${
|
|
472
|
+
-----END ${N}-----`,
|
|
473
|
+
privateKey: `-----BEGIN ${j}-----
|
|
447
474
|
${o}
|
|
448
|
-
-----END ${
|
|
475
|
+
-----END ${j}-----`
|
|
449
476
|
};
|
|
450
477
|
}
|
|
451
|
-
const
|
|
478
|
+
const jt = (e) => p(e) || G(e) ? !0 : V(e) ? !1 : new Date(e).getTime() > 0, Me = (e) => {
|
|
452
479
|
const t = e > 0 ? "+" : "-", r = Math.abs(e), n = `${Math.floor(r / 60)}`.padStart(2, "0"), o = `${r % 60}`.padStart(2, "0");
|
|
453
480
|
return {
|
|
454
481
|
flag: t,
|
|
@@ -457,24 +484,24 @@ const Nt = (e) => p(e) || Z(e) ? !0 : H(e) ? !1 : new Date(e).getTime() > 0, _e
|
|
|
457
484
|
minute: o
|
|
458
485
|
};
|
|
459
486
|
}, Re = (e, t, r) => {
|
|
460
|
-
const { flag: n, hour: o, minute: c } =
|
|
487
|
+
const { flag: n, hour: o, minute: c } = Me(r);
|
|
461
488
|
return `${e}T${t}${n}${o}:${c}`;
|
|
462
|
-
}, Dt = (e, t, r) => new Date(Re(e, t, r)),
|
|
489
|
+
}, Dt = (e, t, r) => new Date(Re(e, t, r)), H = (e, t) => {
|
|
463
490
|
const r = t.getTime() - e.getTime(), n = Math.floor(r / 864e5), o = Math.floor(n / 30), c = Math.floor(o / 12), s = Math.floor(r / 36e5) % 24, i = Math.floor(r / 6e4) % 60, a = Math.floor(r / 1e3) % 60;
|
|
464
491
|
return { year: c, month: o, day: n, hour: s, minute: i, second: a };
|
|
465
|
-
},
|
|
466
|
-
const n =
|
|
467
|
-
return d(r) ? r({ key: o, value: c }) :
|
|
468
|
-
},
|
|
469
|
-
const n =
|
|
470
|
-
return d(r) ? r(n) :
|
|
471
|
-
}, Kt = (e) =>
|
|
492
|
+
}, Q = (e, t, r) => r ? `${t} ${r[e] || e}` : `${t} ${e}`, J = ["year", "month", "day", "hour", "minute", "second"], kt = (e, t, r) => {
|
|
493
|
+
const n = H(e, t), o = J.find((s) => n[s] > 0) || "second", c = n[o];
|
|
494
|
+
return d(r) ? r({ key: o, value: c }) : Q(o, c, r);
|
|
495
|
+
}, Ut = (e, t, r) => {
|
|
496
|
+
const n = H(e, t);
|
|
497
|
+
return d(r) ? r(n) : J.filter((o) => o).map((o) => Q(o, n[o], r)).join(" ");
|
|
498
|
+
}, Kt = (e) => C(e) && /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|\+[0-2]\d(?:\\:[0-5]\d)?)?/g.test(e);
|
|
472
499
|
function qt(e) {
|
|
473
|
-
return p(e) ? !0 :
|
|
500
|
+
return p(e) ? !0 : C(e) ? !!/^(?<value>-?(?:\d+)?\.?\d+) *(?<type>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
474
501
|
e
|
|
475
502
|
)?.groups : !1;
|
|
476
503
|
}
|
|
477
|
-
const Ft = (e) =>
|
|
504
|
+
const Ft = (e) => ue(e), zt = () => Math.floor(Date.now() / 1e3), vt = (e, t = 50) => {
|
|
478
505
|
let r;
|
|
479
506
|
return function(...n) {
|
|
480
507
|
const o = () => {
|
|
@@ -482,7 +509,7 @@ const Ft = (e) => fe(e), zt = () => Math.floor(Date.now() / 1e3), Wt = (e, t = 5
|
|
|
482
509
|
};
|
|
483
510
|
r !== void 0 && clearTimeout(r), r = setTimeout(o, t);
|
|
484
511
|
};
|
|
485
|
-
},
|
|
512
|
+
}, Wt = () => {
|
|
486
513
|
};
|
|
487
514
|
function Gt(e) {
|
|
488
515
|
let t = !1, r;
|
|
@@ -499,7 +526,7 @@ const Vt = (e, t) => {
|
|
|
499
526
|
const o = (/* @__PURE__ */ new Date()).getTime();
|
|
500
527
|
o - r >= t && (e.apply(this, n), r = o);
|
|
501
528
|
};
|
|
502
|
-
},
|
|
529
|
+
}, Y = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
503
530
|
function w(e, t, r) {
|
|
504
531
|
const n = r[0];
|
|
505
532
|
if (t != null && e >= t)
|
|
@@ -520,7 +547,7 @@ function w(e, t, r) {
|
|
|
520
547
|
}
|
|
521
548
|
return t && t.length > 1 ? t[0] : r[o] + w(e.slice(1), null, r);
|
|
522
549
|
}
|
|
523
|
-
function
|
|
550
|
+
function X(e) {
|
|
524
551
|
const t = e.charCodeAt(0), r = 97, n = 90;
|
|
525
552
|
if (e >= "a" && e <= "z")
|
|
526
553
|
return t - r + 2;
|
|
@@ -529,24 +556,24 @@ function te(e) {
|
|
|
529
556
|
throw new Error(`invalid order key head: ${e}`);
|
|
530
557
|
}
|
|
531
558
|
function E(e) {
|
|
532
|
-
const t =
|
|
559
|
+
const t = X(e[0]);
|
|
533
560
|
if (t > e.length)
|
|
534
561
|
throw new Error(`invalid order key: ${e}`);
|
|
535
562
|
return e.slice(0, t);
|
|
536
563
|
}
|
|
537
|
-
function
|
|
538
|
-
if (e.length !==
|
|
564
|
+
function ee(e) {
|
|
565
|
+
if (e.length !== X(e[0]))
|
|
539
566
|
throw new Error(`invalid integer part of order key: ${e}`);
|
|
540
567
|
}
|
|
541
|
-
function
|
|
568
|
+
function k(e, t) {
|
|
542
569
|
if (e === "A" + t[0].repeat(26))
|
|
543
570
|
throw new Error(`invalid order key: ${e}`);
|
|
544
571
|
const r = E(e);
|
|
545
572
|
if (e.slice(r.length).endsWith(t[0]))
|
|
546
573
|
throw new Error(`invalid order key: ${e}`);
|
|
547
574
|
}
|
|
548
|
-
function
|
|
549
|
-
|
|
575
|
+
function U(e, t) {
|
|
576
|
+
ee(e);
|
|
550
577
|
const r = e[0], n = e.slice(1).split("");
|
|
551
578
|
let o = !0;
|
|
552
579
|
for (let c = n.length - 1; o && c >= 0; c--) {
|
|
@@ -561,8 +588,8 @@ function k(e, t) {
|
|
|
561
588
|
}
|
|
562
589
|
return r + n.join("");
|
|
563
590
|
}
|
|
564
|
-
function
|
|
565
|
-
|
|
591
|
+
function _e(e, t) {
|
|
592
|
+
ee(e);
|
|
566
593
|
const r = e[0], n = e.slice(1).split("");
|
|
567
594
|
let o = !0;
|
|
568
595
|
for (let c = n.length - 1; o && c >= 0; c--) {
|
|
@@ -577,8 +604,8 @@ function xe(e, t) {
|
|
|
577
604
|
}
|
|
578
605
|
return r + n.join("");
|
|
579
606
|
}
|
|
580
|
-
function g(e, t, r =
|
|
581
|
-
if (e != null &&
|
|
607
|
+
function g(e, t, r = Y) {
|
|
608
|
+
if (e != null && k(e, r), t != null && k(t, r), e != null && t != null && e >= t)
|
|
582
609
|
throw new Error(`${e} >= ${t}`);
|
|
583
610
|
if (e == null && t == null)
|
|
584
611
|
return "a" + r[0];
|
|
@@ -588,24 +615,24 @@ function g(e, t, r = ee) {
|
|
|
588
615
|
return a + w("", l, r);
|
|
589
616
|
if (a < t)
|
|
590
617
|
return a;
|
|
591
|
-
const u =
|
|
618
|
+
const u = _e(a, r);
|
|
592
619
|
if (u == null)
|
|
593
620
|
throw new Error("cannot decrement any more");
|
|
594
621
|
return u;
|
|
595
622
|
}
|
|
596
623
|
if (t == null) {
|
|
597
624
|
const a = E(e), l = e.slice(a.length);
|
|
598
|
-
return
|
|
625
|
+
return U(a, r) ?? a + w(l, null, r);
|
|
599
626
|
}
|
|
600
627
|
const n = E(e), o = e.slice(n.length), c = E(t), s = t.slice(c.length);
|
|
601
628
|
if (n === c)
|
|
602
629
|
return n + w(o, s, r);
|
|
603
|
-
const i =
|
|
630
|
+
const i = U(n, r);
|
|
604
631
|
if (i == null)
|
|
605
632
|
throw new Error("cannot increment any more");
|
|
606
633
|
return i < t ? i : n + w(o, null, r);
|
|
607
634
|
}
|
|
608
|
-
function K(e, t, r, n =
|
|
635
|
+
function K(e, t, r, n = Y) {
|
|
609
636
|
if (r === 0) return [];
|
|
610
637
|
if (r === 1) return [g(e, t, n)];
|
|
611
638
|
if (t == null) {
|
|
@@ -627,29 +654,29 @@ function K(e, t, r, n = ee) {
|
|
|
627
654
|
const o = Math.floor(r / 2), c = g(e, t, n);
|
|
628
655
|
return [...K(e, c, o, n), c, ...K(c, t, r - o - 1, n)];
|
|
629
656
|
}
|
|
630
|
-
const
|
|
657
|
+
const Ie = (e) => {
|
|
631
658
|
if (e == null || e === "") return !1;
|
|
632
659
|
const t = parseFloat(e);
|
|
633
660
|
return !(isNaN(t) || !isFinite(t));
|
|
634
|
-
},
|
|
661
|
+
}, xe = (e, t) => Math.ceil(e / t) * t, Zt = (e, t = 80, r = 1) => xe(e * r, t), Ht = (e, t = 12) => parseFloat(e.toPrecision(t)), Qt = (e) => {
|
|
635
662
|
const t = Number(e);
|
|
636
663
|
return t < 0 ? Math.ceil(t) : Math.floor(t);
|
|
637
664
|
}, Jt = (e) => {
|
|
638
|
-
if (
|
|
665
|
+
if (Ie(e)) {
|
|
639
666
|
const t = Number(e);
|
|
640
667
|
return isNaN(t) || !isFinite(t) ? e : t;
|
|
641
668
|
}
|
|
642
669
|
return e;
|
|
643
|
-
},
|
|
670
|
+
}, Be = (e) => {
|
|
644
671
|
for (const r of Object.getOwnPropertyNames(e)) {
|
|
645
672
|
const n = e[r];
|
|
646
|
-
!
|
|
673
|
+
!R(n) && !d(n) || n === null || Be(n);
|
|
647
674
|
}
|
|
648
675
|
return Object.isFrozen(e) ? e : Object.freeze(e);
|
|
649
|
-
},
|
|
650
|
-
function
|
|
676
|
+
}, Le = (e) => e.replace(/\[/g, ".").replace(/\]/g, "").split(".");
|
|
677
|
+
function te(e, t, r, n) {
|
|
651
678
|
const o = d(n) ? n : void 0;
|
|
652
|
-
return
|
|
679
|
+
return Le(t).reduce((s, i, a, l) => {
|
|
653
680
|
if (a === l.length - 1)
|
|
654
681
|
return s[i] = r, s;
|
|
655
682
|
if (i in s)
|
|
@@ -663,25 +690,25 @@ function ne(e, t, r, n) {
|
|
|
663
690
|
}, e), e;
|
|
664
691
|
}
|
|
665
692
|
function Ne(e, t, r) {
|
|
666
|
-
return
|
|
693
|
+
return te(e, t, r);
|
|
667
694
|
}
|
|
668
|
-
function
|
|
695
|
+
function je(e, t, r, n) {
|
|
669
696
|
const o = d(n) ? n : void 0;
|
|
670
|
-
return
|
|
697
|
+
return te(e, t, r, o);
|
|
671
698
|
}
|
|
672
699
|
const Yt = (e) => {
|
|
673
700
|
const t = {};
|
|
674
701
|
return Object.keys(e).forEach((r) => {
|
|
675
|
-
r.match(/[^\]]*\[\d+\]/) ? Ne(t, r, e[r]) :
|
|
702
|
+
r.match(/[^\]]*\[\d+\]/) ? Ne(t, r, e[r]) : je(t, r, e[r], Object);
|
|
676
703
|
}), t;
|
|
677
|
-
},
|
|
704
|
+
}, De = (e, t, r) => {
|
|
678
705
|
const n = (c) => String.prototype.split.call(t, c).filter(Boolean).reduce((s, i) => s != null ? s[i] : s, e), o = n(/[,[\]]+?/) || n(/[,[\].]+?/);
|
|
679
706
|
return o === void 0 || o === e ? r : o;
|
|
680
707
|
}, ke = (e, t) => {
|
|
681
708
|
const r = t.split(".");
|
|
682
709
|
return !!e && (r.length > 1 ? ke(e[t.split(".")[0]], r.slice(1).join(".")) : Object.hasOwnProperty.call(e, t));
|
|
683
710
|
};
|
|
684
|
-
function
|
|
711
|
+
function Ue(e, t) {
|
|
685
712
|
return e.length !== t.length ? !1 : e.every((r, n) => r === t[n]);
|
|
686
713
|
}
|
|
687
714
|
const q = (e, t) => {
|
|
@@ -694,7 +721,7 @@ const q = (e, t) => {
|
|
|
694
721
|
for (n = r; n-- !== 0; ) if (!q(e[n], t[n])) return !1;
|
|
695
722
|
return !0;
|
|
696
723
|
}
|
|
697
|
-
if ($(e) && $(t)) return
|
|
724
|
+
if ($(e) && $(t)) return Ue(e, t);
|
|
698
725
|
if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
|
|
699
726
|
if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf();
|
|
700
727
|
if (e.toString !== Object.prototype.toString) return e.toString() === t.toString();
|
|
@@ -724,7 +751,7 @@ function rr(e, t) {
|
|
|
724
751
|
function nr(e, t) {
|
|
725
752
|
return Object.keys(e).filter((r) => t(e[r], r)).reduce((r, n) => (r[n] = e[n], r), {});
|
|
726
753
|
}
|
|
727
|
-
const M = (e, t = "", r = {}) => (b(e) ? e.forEach((n, o) => M(n, `${t}[${o}]`, r)) :
|
|
754
|
+
const M = (e, t = "", r = {}) => (b(e) ? e.forEach((n, o) => M(n, `${t}[${o}]`, r)) : Ae(e) ? Object.keys(e).forEach(
|
|
728
755
|
(n) => M(e[n], `${t ? t + "." : ""}${n}`, r)
|
|
729
756
|
) : r[`${t}`] = e, r);
|
|
730
757
|
function or(e) {
|
|
@@ -749,22 +776,22 @@ const ir = typeof window == "object", ar = (e) => e[Math.floor(Math.random() * e
|
|
|
749
776
|
function ur(e = Number.MIN_SAFE_INTEGER, t = Number.MAX_SAFE_INTEGER) {
|
|
750
777
|
return Math.floor(Math.random() * (t - e + 1) + e);
|
|
751
778
|
}
|
|
752
|
-
const
|
|
779
|
+
const Ke = "0", re = "123456789", ne = Ke + re, oe = "abcdefghijklmnopqrstuvwxyz", qe = oe.toUpperCase(), Fe = oe + qe, ze = "_-", ve = ne + Fe + ze, F = (e = 16, t = ve) => {
|
|
753
780
|
let r = "";
|
|
754
781
|
const n = crypto.getRandomValues(new Uint8Array(e |= 0)), o = t.length - 1;
|
|
755
782
|
for (; e--; ) r += t[n[e] & o];
|
|
756
783
|
return r;
|
|
757
|
-
},
|
|
784
|
+
}, We = (e = 16) => F(1, re) + F(e - 1, ne), fr = (e = 16) => parseInt(We(e), 10), se = (e) => {
|
|
758
785
|
if (!e) return "";
|
|
759
786
|
const t = e.toLowerCase();
|
|
760
|
-
return
|
|
761
|
-
},
|
|
787
|
+
return Ge(t);
|
|
788
|
+
}, Ge = (e) => e ? e.substring(0, 1).toUpperCase() + e.substring(1, e.length) : "", Ve = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g, I = (e) => Array.from(e.match(Ve) ?? []);
|
|
762
789
|
function hr(e) {
|
|
763
|
-
const t =
|
|
790
|
+
const t = I(e);
|
|
764
791
|
if (t.length === 0)
|
|
765
792
|
return "";
|
|
766
793
|
const [r, ...n] = t;
|
|
767
|
-
return `${r.toLowerCase()}${n.map((o) =>
|
|
794
|
+
return `${r.toLowerCase()}${n.map((o) => se(o)).join("")}`;
|
|
768
795
|
}
|
|
769
796
|
const pr = async (e, t = "deflate") => {
|
|
770
797
|
try {
|
|
@@ -799,9 +826,9 @@ const pr = async (e, t = "deflate") => {
|
|
|
799
826
|
const u = s.readable.getReader(), f = [];
|
|
800
827
|
let A = 0;
|
|
801
828
|
for (; ; ) {
|
|
802
|
-
const { done: h, value:
|
|
829
|
+
const { done: h, value: x } = await u.read();
|
|
803
830
|
if (h) break;
|
|
804
|
-
f.push(
|
|
831
|
+
f.push(x), A += x.length;
|
|
805
832
|
}
|
|
806
833
|
const y = new Uint8Array(A);
|
|
807
834
|
let m = 0;
|
|
@@ -811,7 +838,7 @@ const pr = async (e, t = "deflate") => {
|
|
|
811
838
|
} catch (r) {
|
|
812
839
|
throw console.error("解压过程中出错:", r), r;
|
|
813
840
|
}
|
|
814
|
-
},
|
|
841
|
+
}, Ze = (e) => I(e).map((r) => r.toLowerCase()).join("-"), He = {
|
|
815
842
|
"〇": 0,
|
|
816
843
|
一: 1,
|
|
817
844
|
二: 2,
|
|
@@ -853,7 +880,7 @@ const pr = async (e, t = "deflate") => {
|
|
|
853
880
|
function mr(e) {
|
|
854
881
|
let t = 0, r = 0, n = 0, o = !1;
|
|
855
882
|
for (const c of e.split("").reverse()) {
|
|
856
|
-
if (r =
|
|
883
|
+
if (r = He[c], r === void 0)
|
|
857
884
|
throw new Error(`无法解析的数字: ${c}`);
|
|
858
885
|
switch (r) {
|
|
859
886
|
case 10: {
|
|
@@ -893,47 +920,47 @@ const yr = (e) => {
|
|
|
893
920
|
Array.isArray(n) ? n.forEach((o) => t.append(r, `${o}`)) : t.set(r, `${n}`);
|
|
894
921
|
}
|
|
895
922
|
return t.sort(), t.toString();
|
|
896
|
-
},
|
|
923
|
+
}, Qe = ["角", "分", "厘"], z = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], O = [
|
|
897
924
|
["元", "万", "亿", "兆", "京", "垓"],
|
|
898
925
|
["", "拾", "佰", "仟"]
|
|
899
|
-
],
|
|
926
|
+
], v = Math.pow(10, 22), wr = (e) => {
|
|
900
927
|
const t = e < 0 ? "欠" : "";
|
|
901
928
|
let r = Math.abs(e);
|
|
902
|
-
if (r >
|
|
903
|
-
throw new Error(`max value is ${
|
|
929
|
+
if (r > v)
|
|
930
|
+
throw new Error(`max value is ${v}`);
|
|
904
931
|
let n = "";
|
|
905
932
|
if (e > Math.floor(e)) {
|
|
906
933
|
const o = +("0." + `${r}`.split(".")[1]);
|
|
907
|
-
n =
|
|
934
|
+
n = Qe.reduce(
|
|
908
935
|
(c, s, i) => c + (z[Math.floor(o * 10 * Math.pow(10, i)) % 10] + s).replace(/零./, ""),
|
|
909
936
|
""
|
|
910
937
|
);
|
|
911
938
|
}
|
|
912
939
|
n = n || "整", r = Math.floor(r);
|
|
913
|
-
for (let o = 0; o <
|
|
940
|
+
for (let o = 0; o < O[0].length && r > 0; o++) {
|
|
914
941
|
let c = "";
|
|
915
|
-
for (let s = 0; s <
|
|
916
|
-
c = z[r % 10] +
|
|
917
|
-
n = c.replace(/(零.)*零$/g, "").replace(/^$/, "零") +
|
|
942
|
+
for (let s = 0; s < O[1].length && r > 0; s++)
|
|
943
|
+
c = z[r % 10] + O[1][s] + c, r = Math.floor(r / 10);
|
|
944
|
+
n = c.replace(/(零.)*零$/g, "").replace(/^$/, "零") + O[0][o] + n;
|
|
918
945
|
}
|
|
919
946
|
return `${t}${n.replace(/(零.)*零元/, "元").replace(/(零.)+/g, "零").replace(/^整$/, "零元整")}`;
|
|
920
947
|
};
|
|
921
948
|
function Ar(e, t) {
|
|
922
949
|
const r = e || "", n = t || "", o = Math.max(r.length, n.length);
|
|
923
|
-
return o === 0 ? 1 : (o -
|
|
950
|
+
return o === 0 ? 1 : (o - fe(r, n)) / o;
|
|
924
951
|
}
|
|
925
|
-
const Er = (e) =>
|
|
952
|
+
const Er = (e) => I(e).map((r) => r.toLowerCase()).join("_"), Sr = (e) => Ze(e).split("-").filter((t) => !!t).map((t) => se(t.toLowerCase())).join(" "), br = (e) => e.trim().replace(/\s+/g, " "), Cr = (e, t) => e.replace(/\${([^}]+)}/g, (r, n) => De(t, n.trim(), "")), Je = (e) => e ? e.substring(0, 1).toLowerCase() + e.substring(1, e.length) : "", Or = (e) => {
|
|
926
953
|
if (!e) return "";
|
|
927
954
|
const t = e.toLowerCase();
|
|
928
|
-
return
|
|
929
|
-
},
|
|
955
|
+
return Je(t);
|
|
956
|
+
}, W = /^([^/:]+):\/*/, Tr = (...e) => {
|
|
930
957
|
if (e = e.filter((s) => s !== ""), e.length === 0)
|
|
931
958
|
return "";
|
|
932
|
-
if (e.findIndex((s) => !(
|
|
959
|
+
if (e.findIndex((s) => !(C(s) || p(s))) >= 0)
|
|
933
960
|
throw new Error("paths must be a string or number");
|
|
934
961
|
let r = "";
|
|
935
962
|
const n = `${e[0]}`;
|
|
936
|
-
n.startsWith("//") ? r = "//" : n.startsWith("/") ? r = "/" : (n.startsWith("file:") && e.length > 1 && (n + e[1]).match(/^file:\/\/\//) ? r = n.replace(
|
|
963
|
+
n.startsWith("//") ? r = "//" : n.startsWith("/") ? r = "/" : (n.startsWith("file:") && e.length > 1 && (n + e[1]).match(/^file:\/\/\//) ? r = n.replace(W, "$1:///") : r = n.replace(W, "$1://"), e.shift()), r && !r.endsWith("/") && (r += "/");
|
|
937
964
|
let o = e.map(
|
|
938
965
|
(s) => `${s}`.replace(/^\/+/, "").replace(/^\.\/+/, "").replace(/\/+$/, "")
|
|
939
966
|
).filter((s) => s !== "").join("/");
|
|
@@ -977,15 +1004,22 @@ class Pr {
|
|
|
977
1004
|
}
|
|
978
1005
|
/**
|
|
979
1006
|
* 分发事件
|
|
980
|
-
* @param
|
|
1007
|
+
* @param type - 事件类型
|
|
1008
|
+
* @param data - 事件数据
|
|
981
1009
|
*/
|
|
982
|
-
dispatchEvent(t) {
|
|
983
|
-
this.#t(t
|
|
1010
|
+
dispatchEvent(t, r) {
|
|
1011
|
+
this.#t(t).forEach((n) => {
|
|
1012
|
+
try {
|
|
1013
|
+
n(r);
|
|
1014
|
+
} catch (o) {
|
|
1015
|
+
console.error(`Error in event handler for "${String(t)}":`, o);
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
984
1018
|
}
|
|
985
1019
|
/**
|
|
986
1020
|
* 移除所有事件监听器
|
|
987
1021
|
*/
|
|
988
|
-
|
|
1022
|
+
removeAllEventListeners() {
|
|
989
1023
|
this.#e.clear();
|
|
990
1024
|
}
|
|
991
1025
|
/**
|
|
@@ -996,15 +1030,13 @@ class Pr {
|
|
|
996
1030
|
#t(t) {
|
|
997
1031
|
if (this.#e.has(t))
|
|
998
1032
|
return this.#e.get(t);
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
return this.#e.set(t, n), n;
|
|
1002
|
-
}
|
|
1033
|
+
const r = /* @__PURE__ */ new Set();
|
|
1034
|
+
return this.#e.set(t, r), r;
|
|
1003
1035
|
}
|
|
1004
1036
|
}
|
|
1005
|
-
const $r = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", Mr = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
|
|
1037
|
+
const $r = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", Mr = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", Rr = (e, ...t) => {
|
|
1006
1038
|
const r = [];
|
|
1007
|
-
|
|
1039
|
+
R(e) ? Object.keys(e).sort().forEach((o) => {
|
|
1008
1040
|
const c = e[o];
|
|
1009
1041
|
r.push([o, c]);
|
|
1010
1042
|
}) : r.push([e]), t.length && t.forEach((o) => {
|
|
@@ -1012,81 +1044,81 @@ const $r = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBAD
|
|
|
1012
1044
|
}), (console?.table ?? console.log)(r);
|
|
1013
1045
|
};
|
|
1014
1046
|
export {
|
|
1015
|
-
|
|
1016
|
-
|
|
1047
|
+
Tt as AsyncQueueExecutor,
|
|
1048
|
+
Y as BASE_62_DIGITS,
|
|
1017
1049
|
Pr as EventDispatcher,
|
|
1018
1050
|
$r as IMAGE_MIN_BASE64_BLACK,
|
|
1019
1051
|
Mr as IMAGE_MIN_BASE64_TRANSPARENT,
|
|
1020
1052
|
ir as IS_BROWSER,
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1053
|
+
rt as IdleTimer,
|
|
1054
|
+
nt as LeaderElection,
|
|
1055
|
+
_t as aesDecrypt,
|
|
1056
|
+
It as aesEncrypt,
|
|
1057
|
+
T as base64Decode,
|
|
1026
1058
|
S as base64Encode,
|
|
1027
1059
|
hr as camelCase,
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1060
|
+
jt as canBeDate,
|
|
1061
|
+
Ie as canBeNumber,
|
|
1062
|
+
se as capitalize,
|
|
1063
|
+
Ge as capitalizeFirst,
|
|
1064
|
+
ot as checkOPFSAvailable,
|
|
1033
1065
|
it as chunk,
|
|
1034
1066
|
pr as compressToBase64Url,
|
|
1035
|
-
|
|
1067
|
+
tt as createBroadcastTopic,
|
|
1036
1068
|
Dt as dateStringToDate,
|
|
1037
1069
|
Re as dateStringWithTimezone,
|
|
1038
|
-
|
|
1039
|
-
|
|
1070
|
+
vt as debounce,
|
|
1071
|
+
xt as decodeJWTPayload,
|
|
1040
1072
|
dr as decompressFromBase64Url,
|
|
1041
|
-
|
|
1073
|
+
Be as deepFreeze,
|
|
1042
1074
|
at as difference,
|
|
1043
|
-
|
|
1075
|
+
Wt as emptyFunction,
|
|
1044
1076
|
lt as flatten,
|
|
1045
|
-
|
|
1077
|
+
me as flattenDeep,
|
|
1046
1078
|
Yt as flattenPathObjectToPlainObject,
|
|
1047
|
-
|
|
1048
|
-
|
|
1079
|
+
Ut as formatCountdown,
|
|
1080
|
+
kt as formatPassTime,
|
|
1049
1081
|
g as generateKeyBetween,
|
|
1050
1082
|
K as generateKeysBetween,
|
|
1051
|
-
|
|
1083
|
+
De as get,
|
|
1052
1084
|
ke as has,
|
|
1053
1085
|
ut as intersection,
|
|
1054
1086
|
b as isArray,
|
|
1055
|
-
|
|
1087
|
+
ye as isArrayBuffer,
|
|
1056
1088
|
ft as isBoolean,
|
|
1057
|
-
|
|
1089
|
+
G as isDate,
|
|
1058
1090
|
ht as isEmpty,
|
|
1059
1091
|
q as isEqual,
|
|
1060
1092
|
Xt as isEqualDate,
|
|
1061
|
-
|
|
1093
|
+
Ue as isEqualUint8Array,
|
|
1062
1094
|
pt as isFloat,
|
|
1063
1095
|
d as isFunction,
|
|
1064
1096
|
Kt as isISODateString,
|
|
1065
|
-
|
|
1097
|
+
we as isInt,
|
|
1066
1098
|
dt as isIntArray,
|
|
1067
1099
|
qt as isMSTime,
|
|
1068
|
-
|
|
1100
|
+
V as isNil,
|
|
1069
1101
|
p as isNumber,
|
|
1070
1102
|
mt as isNumberArray,
|
|
1071
|
-
|
|
1072
|
-
|
|
1103
|
+
de as isOPFSSupported,
|
|
1104
|
+
R as isObject,
|
|
1073
1105
|
yt as isObjectLike,
|
|
1074
|
-
|
|
1106
|
+
Ae as isPlainObject,
|
|
1075
1107
|
gt as isPrimitive,
|
|
1076
1108
|
wt as isPromise,
|
|
1077
1109
|
At as isRegExp,
|
|
1078
|
-
|
|
1110
|
+
C as isString,
|
|
1079
1111
|
Et as isStringArray,
|
|
1080
|
-
|
|
1112
|
+
ge as isSymbol,
|
|
1081
1113
|
$ as isUint8Array,
|
|
1082
|
-
|
|
1083
|
-
|
|
1114
|
+
Ze as kebabCase,
|
|
1115
|
+
Rr as logError,
|
|
1084
1116
|
Ft as msTimeToMilliseconds,
|
|
1085
1117
|
St as needArray,
|
|
1086
1118
|
Pt as nextMacroTask,
|
|
1087
1119
|
$t as nextMicroTask,
|
|
1088
|
-
|
|
1089
|
-
|
|
1120
|
+
Wt as noop,
|
|
1121
|
+
xe as numberStep,
|
|
1090
1122
|
Zt as numberStepScreenSize,
|
|
1091
1123
|
Ht as numberStrip,
|
|
1092
1124
|
er as omit,
|
|
@@ -1094,12 +1126,12 @@ export {
|
|
|
1094
1126
|
Gt as once,
|
|
1095
1127
|
bt as orderBy,
|
|
1096
1128
|
mr as parseChineseNumber,
|
|
1097
|
-
|
|
1098
|
-
|
|
1129
|
+
H as parseTime,
|
|
1130
|
+
st as performChunk,
|
|
1099
1131
|
rr as pick,
|
|
1100
1132
|
nr as pickBy,
|
|
1101
1133
|
or as plainObjectToFlattenPathObject,
|
|
1102
|
-
|
|
1134
|
+
B as pool,
|
|
1103
1135
|
yr as queryParse,
|
|
1104
1136
|
gr as queryStringify,
|
|
1105
1137
|
ar as randomArrayItem,
|
|
@@ -1107,33 +1139,34 @@ export {
|
|
|
1107
1139
|
ur as randomInt,
|
|
1108
1140
|
F as randomString,
|
|
1109
1141
|
fr as randomUintByLength,
|
|
1110
|
-
|
|
1142
|
+
We as randomUintString,
|
|
1143
|
+
ct as requestIdleCallbackPolyfill,
|
|
1111
1144
|
wr as rmbUppercase,
|
|
1112
|
-
|
|
1145
|
+
Bt as rsaDecrypt,
|
|
1113
1146
|
Lt as rsaEncrypt,
|
|
1114
|
-
|
|
1147
|
+
Nt as rsaGenerateKey,
|
|
1115
1148
|
Ne as set,
|
|
1116
|
-
|
|
1117
|
-
|
|
1149
|
+
te as setBase,
|
|
1150
|
+
je as setWith,
|
|
1118
1151
|
Ar as similarity,
|
|
1119
1152
|
Mt as sleep,
|
|
1120
1153
|
Er as snakeCase,
|
|
1121
|
-
|
|
1154
|
+
Ct as sortBy,
|
|
1122
1155
|
Sr as startCase,
|
|
1123
1156
|
br as stringSingleline,
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1157
|
+
Cr as stringTemplate,
|
|
1158
|
+
Q as stringTime,
|
|
1159
|
+
_ as stringToArrayBuffer,
|
|
1127
1160
|
Vt as throttle,
|
|
1128
1161
|
Qt as toInt,
|
|
1129
1162
|
sr as toPlainObject,
|
|
1130
|
-
|
|
1163
|
+
Z as traverseObjectKeys,
|
|
1131
1164
|
Jt as tryToNumber,
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1165
|
+
Rt as uint8ArrayToString,
|
|
1166
|
+
Or as uncapitalize,
|
|
1167
|
+
Je as uncapitalizeFirst,
|
|
1168
|
+
Ot as unionBy,
|
|
1136
1169
|
zt as unixTimestamp,
|
|
1137
|
-
|
|
1170
|
+
Tr as urlJoin,
|
|
1138
1171
|
cr as zipObject
|
|
1139
1172
|
};
|