@unicom-cloud/utils 0.1.0
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/case-name/index.js +23 -0
- package/class-name/index.js +9 -0
- package/clipboard-copy/index.js +41 -0
- package/constant/address.js +5304 -0
- package/constant/chineseCharacters.js +4 -0
- package/constant/constellations.js +17 -0
- package/constant/domain.js +268 -0
- package/constant/identity.js +18 -0
- package/constant/index.js +6 -0
- package/constant/keyboardCode.js +105 -0
- package/constant/licensePlate.js +42 -0
- package/constant/name.js +666 -0
- package/constant/platform.js +20 -0
- package/constant/protocol.js +18 -0
- package/constant/ui.js +17 -0
- package/cookie/index.js +33 -0
- package/cookie/src/index.js +116 -0
- package/decimal/decimal.js +1070 -0
- package/decimal/index.js +5 -0
- package/event-emitter/index.js +57 -0
- package/file/fileToURL.js +26 -0
- package/file/index.js +6 -0
- package/file/saveAs.js +35 -0
- package/filesize/index.js +8 -0
- package/filesize/src/constants.js +71 -0
- package/filesize/src/filesize.js +88 -0
- package/index.js +47 -0
- package/invariant/index.js +21 -0
- package/is/index.js +137 -0
- package/math/index.js +34 -0
- package/md5/index.js +65 -0
- package/mock/MockWebSocket.js +117 -0
- package/mock/MockXMLHttpRequest.js +94 -0
- package/mock/index.js +8 -0
- package/normalize-wheel/ExecutionEnvironment.js +11 -0
- package/normalize-wheel/UserAgent_DEPRECATED.js +146 -0
- package/normalize-wheel/index.js +13 -0
- package/normalize-wheel/isEventSupported.js +33 -0
- package/nzh/cn.js +7 -0
- package/nzh/hk.js +7 -0
- package/nzh/index.js +4 -0
- package/nzh/nzh.js +22 -0
- package/nzh/src/autoGet.js +25 -0
- package/nzh/src/index.js +93 -0
- package/nzh/src/langs/cn_b.js +12 -0
- package/nzh/src/langs/cn_s.js +9 -0
- package/nzh/src/langs/hk_b.js +12 -0
- package/nzh/src/langs/hk_s.js +9 -0
- package/nzh/src/utils.js +71 -0
- package/objectKeysSort.js +7 -0
- package/package.json +1 -0
- package/random/address.js +32 -0
- package/random/constellation.js +8 -0
- package/random/image.js +20 -0
- package/random/index.js +63 -0
- package/random/licensePlate.js +12 -0
- package/random/name.js +25 -0
- package/random/number.js +15 -0
- package/random/text.js +117 -0
- package/random/time.js +8 -0
- package/random/web.js +37 -0
- package/screenfull/index.js +119 -0
- package/tree/index.js +87 -0
- package/turbo-stream/index.js +6 -0
- package/turbo-stream/src/decode.js +284 -0
- package/turbo-stream/src/encode.js +363 -0
- package/turbo-stream/src/shared.js +287 -0
- package/url-toolkit/index.js +8 -0
- package/url-toolkit/src/url-toolkit.js +74 -0
package/decimal/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var o = (i) => {
|
|
2
|
+
throw TypeError(i);
|
|
3
|
+
};
|
|
4
|
+
var a = (i, t, e) => t.has(i) || o("Cannot " + e);
|
|
5
|
+
var h = (i, t, e) => (a(i, t, "read from private field"), e ? e.call(i) : t.get(i)), l = (i, t, e) => t.has(i) ? o("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e);
|
|
6
|
+
var r;
|
|
7
|
+
class u {
|
|
8
|
+
constructor() {
|
|
9
|
+
l(this, r, /* @__PURE__ */ new Map());
|
|
10
|
+
if (!new.target) throw new Error("必须使用 new 命令生成实例");
|
|
11
|
+
this.addListener = this.addEventListener = this.on, this.removeListener = this.removeEventListener = this.off, this.removeAllListeners = this.removeAllEventListeners = this.offAll, this.dispatch = this.dispatchEvent = this.emit;
|
|
12
|
+
}
|
|
13
|
+
once(t, e) {
|
|
14
|
+
if (!t || !e)
|
|
15
|
+
return;
|
|
16
|
+
this.off(t);
|
|
17
|
+
const s = (...n) => {
|
|
18
|
+
this.off(t, s), e(...n);
|
|
19
|
+
};
|
|
20
|
+
this.on(t, s);
|
|
21
|
+
}
|
|
22
|
+
on(t, e) {
|
|
23
|
+
if (!t || !e)
|
|
24
|
+
return;
|
|
25
|
+
const s = h(this, r).get(t) || [];
|
|
26
|
+
s.push(e), h(this, r).set(t, s);
|
|
27
|
+
}
|
|
28
|
+
off(t, e) {
|
|
29
|
+
if (!t)
|
|
30
|
+
return;
|
|
31
|
+
if (!e) {
|
|
32
|
+
h(this, r).delete(t);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const s = h(this, r).get(t);
|
|
36
|
+
if (!s)
|
|
37
|
+
return;
|
|
38
|
+
if (s.length === 0) {
|
|
39
|
+
h(this, r).delete(t);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const n = s.indexOf(e);
|
|
43
|
+
n !== -1 && (s.splice(n, 1), h(this, r).set(t, s), this.off(t, e));
|
|
44
|
+
}
|
|
45
|
+
offAll(t) {
|
|
46
|
+
var e, s;
|
|
47
|
+
t ? (s = (e = h(this, r).get(t)) == null ? void 0 : e.forEach) == null || s.call(e, (n) => this.off(t, n)) : h(this, r).clear();
|
|
48
|
+
}
|
|
49
|
+
emit(t, ...e) {
|
|
50
|
+
var s, n;
|
|
51
|
+
(n = (s = h(this, r).get(t)) == null ? void 0 : s.forEach) == null || n.call(s, (f) => f == null ? void 0 : f(...e));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
r = new WeakMap();
|
|
55
|
+
export {
|
|
56
|
+
u as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../is/index.js";
|
|
2
|
+
import l from "lodash/isString.js";
|
|
3
|
+
function u(r) {
|
|
4
|
+
return new Promise((n, e) => {
|
|
5
|
+
if (r)
|
|
6
|
+
if (l(r.url))
|
|
7
|
+
n(r.url);
|
|
8
|
+
else if (r instanceof File) {
|
|
9
|
+
const s = "文件解析出错", o = new FileReader();
|
|
10
|
+
o.onload = (t) => {
|
|
11
|
+
var i;
|
|
12
|
+
const a = (i = t.target) == null ? void 0 : i.result;
|
|
13
|
+
a ? n(a) : e(new Error(t)), o.abort();
|
|
14
|
+
}, o.onerror = () => {
|
|
15
|
+
e(new Error(s));
|
|
16
|
+
}, o.readAsDataURL(r);
|
|
17
|
+
} else
|
|
18
|
+
e(new Error("file 不是 File 的实例"));
|
|
19
|
+
else
|
|
20
|
+
e(new Error("file 为空"));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
u as default,
|
|
25
|
+
u as fileToURL
|
|
26
|
+
};
|
package/file/index.js
ADDED
package/file/saveAs.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { fileToURL as r } from "./fileToURL.js";
|
|
2
|
+
function o(n) {
|
|
3
|
+
return new XMLHttpRequest();
|
|
4
|
+
}
|
|
5
|
+
function s(n, t) {
|
|
6
|
+
const e = o();
|
|
7
|
+
e.open("GET", n), e.responseType = "blob", e.onload = () => {
|
|
8
|
+
c(e.response, t);
|
|
9
|
+
}, e.onerror = () => {
|
|
10
|
+
console.error("无法下载文件");
|
|
11
|
+
}, e.send();
|
|
12
|
+
}
|
|
13
|
+
function a(n) {
|
|
14
|
+
const t = o();
|
|
15
|
+
t.open("HEAD", n, !1);
|
|
16
|
+
try {
|
|
17
|
+
t.send();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
console.error(e);
|
|
20
|
+
}
|
|
21
|
+
return t.status >= 200 && t.status <= 299;
|
|
22
|
+
}
|
|
23
|
+
async function i(n, t) {
|
|
24
|
+
const e = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
|
|
25
|
+
e.rel = "noopener", typeof n == "string" && (e.href = n, e.origin === location.origin || (a(n) ? s(n, t) : e.target = "_blank")), n instanceof Blob && (e.href = await r(n)), n instanceof File && (t || (t = n.name)), t || (t = "download"), e.download = t, setTimeout(() => {
|
|
26
|
+
e.dispatchEvent(new MouseEvent("click"));
|
|
27
|
+
}, 0);
|
|
28
|
+
}
|
|
29
|
+
function c(n, t) {
|
|
30
|
+
i(n, t);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
c as default,
|
|
34
|
+
c as saveAs
|
|
35
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const t = "array", i = "bit", b = "bits", o = "byte", n = "bytes", s = "", c = "exponent", e = "function", B = "iec", E = "Invalid number", I = "Invalid rounding method", T = "jedec", a = "object", N = ".", S = "round", r = "s", R = "si", Y = "kbit", d = "kB", y = " ", P = "string", O = "0", g = {
|
|
2
|
+
symbol: {
|
|
3
|
+
iec: {
|
|
4
|
+
bits: [
|
|
5
|
+
"bit",
|
|
6
|
+
"Kibit",
|
|
7
|
+
"Mibit",
|
|
8
|
+
"Gibit",
|
|
9
|
+
"Tibit",
|
|
10
|
+
"Pibit",
|
|
11
|
+
"Eibit",
|
|
12
|
+
"Zibit",
|
|
13
|
+
"Yibit"
|
|
14
|
+
],
|
|
15
|
+
bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
|
|
16
|
+
},
|
|
17
|
+
jedec: {
|
|
18
|
+
bits: [
|
|
19
|
+
"bit",
|
|
20
|
+
"Kbit",
|
|
21
|
+
"Mbit",
|
|
22
|
+
"Gbit",
|
|
23
|
+
"Tbit",
|
|
24
|
+
"Pbit",
|
|
25
|
+
"Ebit",
|
|
26
|
+
"Zbit",
|
|
27
|
+
"Ybit"
|
|
28
|
+
],
|
|
29
|
+
bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
fullform: {
|
|
33
|
+
iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
|
|
34
|
+
jedec: [
|
|
35
|
+
"",
|
|
36
|
+
"kilo",
|
|
37
|
+
"mega",
|
|
38
|
+
"giga",
|
|
39
|
+
"tera",
|
|
40
|
+
"peta",
|
|
41
|
+
"exa",
|
|
42
|
+
"zetta",
|
|
43
|
+
"yotta"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
t as ARRAY,
|
|
49
|
+
i as BIT,
|
|
50
|
+
b as BITS,
|
|
51
|
+
o as BYTE,
|
|
52
|
+
n as BYTES,
|
|
53
|
+
s as EMPTY,
|
|
54
|
+
c as EXPONENT,
|
|
55
|
+
e as FUNCTION,
|
|
56
|
+
B as IEC,
|
|
57
|
+
E as INVALID_NUMBER,
|
|
58
|
+
I as INVALID_ROUND,
|
|
59
|
+
T as JEDEC,
|
|
60
|
+
a as OBJECT,
|
|
61
|
+
N as PERIOD,
|
|
62
|
+
S as ROUND,
|
|
63
|
+
r as S,
|
|
64
|
+
R as SI,
|
|
65
|
+
Y as SI_KBIT,
|
|
66
|
+
d as SI_KBYTE,
|
|
67
|
+
y as SPACE,
|
|
68
|
+
P as STRING,
|
|
69
|
+
g as STRINGS,
|
|
70
|
+
O as ZERO
|
|
71
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { INVALID_NUMBER as j, FUNCTION as z, INVALID_ROUND as X, STRING as F, EXPONENT as Z, STRINGS as O, EMPTY as t, BITS as $, BYTES as s, SI_KBIT as k, SI_KBYTE as q, PERIOD as v, ZERO as H, BIT as Q, BYTE as W, S as a, ARRAY as b, OBJECT as d, SPACE as G, ROUND as J, SI as f0, JEDEC as A, IEC as x } from "./constants.js";
|
|
2
|
+
function e0(I, {
|
|
3
|
+
bits: o = !1,
|
|
4
|
+
pad: M = !1,
|
|
5
|
+
base: l = -1,
|
|
6
|
+
round: S = 2,
|
|
7
|
+
locale: T = t,
|
|
8
|
+
localeOptions: R = {},
|
|
9
|
+
separator: h = t,
|
|
10
|
+
spacer: B = G,
|
|
11
|
+
symbols: c = {},
|
|
12
|
+
standard: i = t,
|
|
13
|
+
output: g = F,
|
|
14
|
+
fullform: w = !1,
|
|
15
|
+
fullforms: u = [],
|
|
16
|
+
exponent: p = -1,
|
|
17
|
+
roundingMethod: y = J,
|
|
18
|
+
precision: E = 0
|
|
19
|
+
} = {}) {
|
|
20
|
+
let e = p, N = Number(I), f = [], n = 0, D = t;
|
|
21
|
+
i === f0 ? (l = 10, i = A) : i === x || i === A ? l = 2 : l === 2 ? i = x : (l = 10, i = A);
|
|
22
|
+
const m = l === 10 ? 1e3 : 1024, K = w === !0, C = N < 0, P = Math[y];
|
|
23
|
+
if (typeof I != "bigint" && isNaN(I))
|
|
24
|
+
throw new TypeError(j);
|
|
25
|
+
if (typeof P !== z)
|
|
26
|
+
throw new TypeError(X);
|
|
27
|
+
if (C && (N = -N), (e === -1 || isNaN(e)) && (e = Math.floor(Math.log(N) / Math.log(m)), e < 0 && (e = 0)), e > 8 && (E > 0 && (E += 8 - e), e = 8), g === Z)
|
|
28
|
+
return e;
|
|
29
|
+
if (N === 0)
|
|
30
|
+
f[0] = 0, D = f[1] = O.symbol[i][o ? $ : s][e];
|
|
31
|
+
else {
|
|
32
|
+
n = N / (l === 2 ? Math.pow(2, e * 10) : Math.pow(1e3, e)), o && (n = n * 8, n >= m && e < 8 && (n = n / m, e++));
|
|
33
|
+
const r = Math.pow(10, e > 0 ? S : 0);
|
|
34
|
+
f[0] = P(n * r) / r, f[0] === m && e < 8 && p === -1 && (f[0] = 1, e++), D = f[1] = l === 10 && e === 1 ? o ? k : q : O.symbol[i][o ? $ : s][e];
|
|
35
|
+
}
|
|
36
|
+
if (C && (f[0] = -f[0]), E > 0 && (f[0] = f[0].toPrecision(E)), f[1] = c[f[1]] || f[1], T === !0 ? f[0] = f[0].toLocaleString() : T.length > 0 ? f[0] = f[0].toLocaleString(T, R) : h.length > 0 && (f[0] = f[0].toString().replace(v, h)), M && S > 0) {
|
|
37
|
+
const r = f[0].toString(), Y = h || (r.match(/(\D)/g) || []).pop() || v, L = r.toString().split(Y), U = L[1] || t, _ = U.length, V = S - _;
|
|
38
|
+
f[0] = `${L[0]}${Y}${U.padEnd(_ + V, H)}`;
|
|
39
|
+
}
|
|
40
|
+
return K && (f[1] = u[e] ? u[e] : O.fullform[i][e] + (o ? Q : W) + (f[0] === 1 ? t : a)), g === b ? f : g === d ? {
|
|
41
|
+
value: f[0],
|
|
42
|
+
symbol: f[1],
|
|
43
|
+
exponent: e,
|
|
44
|
+
unit: D
|
|
45
|
+
} : f.join(B);
|
|
46
|
+
}
|
|
47
|
+
function l0({
|
|
48
|
+
bits: I = !1,
|
|
49
|
+
pad: o = !1,
|
|
50
|
+
base: M = -1,
|
|
51
|
+
round: l = 2,
|
|
52
|
+
locale: S = t,
|
|
53
|
+
localeOptions: T = {},
|
|
54
|
+
separator: R = t,
|
|
55
|
+
spacer: h = G,
|
|
56
|
+
symbols: B = {},
|
|
57
|
+
standard: c = t,
|
|
58
|
+
output: i = F,
|
|
59
|
+
fullform: g = !1,
|
|
60
|
+
fullforms: w = [],
|
|
61
|
+
exponent: u = -1,
|
|
62
|
+
roundingMethod: p = J,
|
|
63
|
+
precision: y = 0
|
|
64
|
+
} = {}) {
|
|
65
|
+
return (E) => e0(E, {
|
|
66
|
+
bits: I,
|
|
67
|
+
pad: o,
|
|
68
|
+
base: M,
|
|
69
|
+
round: l,
|
|
70
|
+
locale: S,
|
|
71
|
+
localeOptions: T,
|
|
72
|
+
separator: R,
|
|
73
|
+
spacer: h,
|
|
74
|
+
symbols: B,
|
|
75
|
+
standard: c,
|
|
76
|
+
output: i,
|
|
77
|
+
fullform: g,
|
|
78
|
+
fullforms: w,
|
|
79
|
+
exponent: u,
|
|
80
|
+
roundingMethod: p,
|
|
81
|
+
precision: y
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
e0 as default,
|
|
86
|
+
e0 as filesize,
|
|
87
|
+
l0 as partial
|
|
88
|
+
};
|
package/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as o from "./is/index.js";
|
|
2
|
+
import * as e from "./math/index.js";
|
|
3
|
+
import * as r from "./tree/index.js";
|
|
4
|
+
import * as t from "./turbo-stream/index.js";
|
|
5
|
+
import * as a from "./url-toolkit/index.js";
|
|
6
|
+
import { default as p } from "./case-name/index.js";
|
|
7
|
+
import { default as l } from "./class-name/index.js";
|
|
8
|
+
import { default as n } from "./clipboard-copy/index.js";
|
|
9
|
+
import { splitCookiesString as c } from "./cookie/index.js";
|
|
10
|
+
import { default as b } from "./decimal/decimal.js";
|
|
11
|
+
import { default as k } from "./event-emitter/index.js";
|
|
12
|
+
import { fileToURL as S } from "./file/fileToURL.js";
|
|
13
|
+
import { saveAs as C } from "./file/saveAs.js";
|
|
14
|
+
import * as s from "./filesize/src/constants.js";
|
|
15
|
+
import { filesize as y, partial as N } from "./filesize/src/filesize.js";
|
|
16
|
+
import { default as j } from "./invariant/index.js";
|
|
17
|
+
import { default as E } from "./md5/index.js";
|
|
18
|
+
import { default as L } from "./normalize-wheel/index.js";
|
|
19
|
+
import { default as U } from "./nzh/nzh.js";
|
|
20
|
+
import { default as q } from "./objectKeysSort.js";
|
|
21
|
+
import { default as B } from "./screenfull/index.js";
|
|
22
|
+
import * as m from "./cookie/src/index.js";
|
|
23
|
+
export {
|
|
24
|
+
p as caseName,
|
|
25
|
+
l as className,
|
|
26
|
+
n as clipboardCopy,
|
|
27
|
+
m as cookie,
|
|
28
|
+
b as decimal,
|
|
29
|
+
k as eventEmitter,
|
|
30
|
+
S as fileToURL,
|
|
31
|
+
y as filesize,
|
|
32
|
+
s as filesizeConstants,
|
|
33
|
+
j as invariant,
|
|
34
|
+
o as is,
|
|
35
|
+
e as math,
|
|
36
|
+
E as md5,
|
|
37
|
+
L as normalizeWheel,
|
|
38
|
+
U as nzh,
|
|
39
|
+
q as objectKeysSort,
|
|
40
|
+
N as partial,
|
|
41
|
+
C as saveAs,
|
|
42
|
+
B as screenfull,
|
|
43
|
+
c as splitCookiesString,
|
|
44
|
+
r as tree,
|
|
45
|
+
t as turboStream,
|
|
46
|
+
a as urlToolkit
|
|
47
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function t(n, r, ...i) {
|
|
2
|
+
if (process.env.NODE_ENV !== "production" && r === void 0)
|
|
3
|
+
throw new Error("invariant requires an error message argument");
|
|
4
|
+
if (!n) {
|
|
5
|
+
let e;
|
|
6
|
+
if (r === void 0)
|
|
7
|
+
e = new Error(
|
|
8
|
+
"Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
|
|
9
|
+
);
|
|
10
|
+
else {
|
|
11
|
+
let o = 0;
|
|
12
|
+
e = new Error(
|
|
13
|
+
r.replace(/%s/g, () => i[o++])
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
throw e;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
t as default
|
|
21
|
+
};
|
package/is/index.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { default as $ } from "lodash/isArguments.js";
|
|
2
|
+
import i from "lodash/isArray.js";
|
|
3
|
+
import { default as L } from "lodash/isArray.js";
|
|
4
|
+
import { default as W } from "lodash/isArrayBuffer.js";
|
|
5
|
+
import { default as P } from "lodash/isArrayLike.js";
|
|
6
|
+
import { default as v } from "lodash/isArrayLikeObject.js";
|
|
7
|
+
import { default as V } from "lodash/isBoolean.js";
|
|
8
|
+
import { default as T } from "lodash/isBuffer.js";
|
|
9
|
+
import { default as z } from "lodash/isDate.js";
|
|
10
|
+
import { default as H } from "lodash/isElement.js";
|
|
11
|
+
import o from "lodash/isEmpty.js";
|
|
12
|
+
import { default as Q } from "lodash/isEmpty.js";
|
|
13
|
+
import { default as Y } from "lodash/isEqual.js";
|
|
14
|
+
import { default as _ } from "lodash/isEqualWith.js";
|
|
15
|
+
import { default as et } from "lodash/isError.js";
|
|
16
|
+
import { default as ot } from "lodash/isFinite.js";
|
|
17
|
+
import { default as st } from "lodash/isFunction.js";
|
|
18
|
+
import { default as it } from "lodash/isInteger.js";
|
|
19
|
+
import { default as ut } from "lodash/isLength.js";
|
|
20
|
+
import { default as dt } from "lodash/isMap.js";
|
|
21
|
+
import { default as pt } from "lodash/isMatch.js";
|
|
22
|
+
import { default as xt } from "lodash/isMatchWith.js";
|
|
23
|
+
import { default as yt } from "lodash/isNaN.js";
|
|
24
|
+
import { default as gt } from "lodash/isNative.js";
|
|
25
|
+
import l from "lodash/isNil.js";
|
|
26
|
+
import { default as ht } from "lodash/isNil.js";
|
|
27
|
+
import { default as Ot } from "lodash/isNull.js";
|
|
28
|
+
import { default as At } from "lodash/isNumber.js";
|
|
29
|
+
import u from "lodash/isObject.js";
|
|
30
|
+
import { default as Bt } from "lodash/isObject.js";
|
|
31
|
+
import { default as kt } from "lodash/isObjectLike.js";
|
|
32
|
+
import { default as $t } from "lodash/isPlainObject.js";
|
|
33
|
+
import { default as Lt } from "lodash/isRegExp.js";
|
|
34
|
+
import { default as Wt } from "lodash/isSafeInteger.js";
|
|
35
|
+
import { default as Pt } from "lodash/isSet.js";
|
|
36
|
+
import { default as vt } from "lodash/isString.js";
|
|
37
|
+
import { default as Vt } from "lodash/isSymbol.js";
|
|
38
|
+
import { default as Tt } from "lodash/isTypedArray.js";
|
|
39
|
+
import { default as zt } from "lodash/isUndefined.js";
|
|
40
|
+
import { default as Ht } from "lodash/isWeakMap.js";
|
|
41
|
+
import { default as Qt } from "lodash/isWeakSet.js";
|
|
42
|
+
function b(t) {
|
|
43
|
+
return t instanceof Promise;
|
|
44
|
+
}
|
|
45
|
+
function y(t) {
|
|
46
|
+
return i(t) && o(t);
|
|
47
|
+
}
|
|
48
|
+
function S(t) {
|
|
49
|
+
return u(t) && o(t);
|
|
50
|
+
}
|
|
51
|
+
function g(t) {
|
|
52
|
+
return l(t) || t === "";
|
|
53
|
+
}
|
|
54
|
+
function j(t) {
|
|
55
|
+
return Object.prototype.toString.call(t) === "[object File]";
|
|
56
|
+
}
|
|
57
|
+
function h(t) {
|
|
58
|
+
return Object.prototype.toString.call(t) === "[object Blob]";
|
|
59
|
+
}
|
|
60
|
+
function E(t) {
|
|
61
|
+
return Object.prototype.toString.call(t) === "[object ReadableStream]";
|
|
62
|
+
}
|
|
63
|
+
const n = typeof ReadableStream == "function", O = typeof ReadableStreamDefaultController == "function", R = typeof ReadableByteStreamController == "function", A = n && new ReadableStream()[Symbol.asyncIterator];
|
|
64
|
+
function N(t) {
|
|
65
|
+
let e = !0;
|
|
66
|
+
try {
|
|
67
|
+
JSON.parse(t);
|
|
68
|
+
} catch (r) {
|
|
69
|
+
e = !1, console.error(r);
|
|
70
|
+
}
|
|
71
|
+
return e;
|
|
72
|
+
}
|
|
73
|
+
function B(t) {
|
|
74
|
+
const e = /^#(?:[0-9a-fA-F]{3}){1,2}$/, r = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/, a = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(1|0|0?\.\d+)\)$/, s = /^hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)$/, f = /^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*(1|0|0?\.\d+)\)$/;
|
|
75
|
+
return e.test(t) || r.test(t) || a.test(t) || s.test(t) || f.test(t);
|
|
76
|
+
}
|
|
77
|
+
function d(t) {
|
|
78
|
+
const e = document.createElement("div");
|
|
79
|
+
return e.style.color = t, e.style.color !== "";
|
|
80
|
+
}
|
|
81
|
+
function C(t) {
|
|
82
|
+
return d(t);
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
$ as isArguments,
|
|
86
|
+
L as isArray,
|
|
87
|
+
W as isArrayBuffer,
|
|
88
|
+
P as isArrayLike,
|
|
89
|
+
v as isArrayLikeObject,
|
|
90
|
+
h as isBlob,
|
|
91
|
+
V as isBoolean,
|
|
92
|
+
T as isBuffer,
|
|
93
|
+
B as isColor,
|
|
94
|
+
d as isColor2,
|
|
95
|
+
z as isDate,
|
|
96
|
+
H as isElement,
|
|
97
|
+
Q as isEmpty,
|
|
98
|
+
y as isEmptyArray,
|
|
99
|
+
S as isEmptyObject,
|
|
100
|
+
g as isEmptyValue,
|
|
101
|
+
Y as isEqual,
|
|
102
|
+
_ as isEqualWith,
|
|
103
|
+
et as isError,
|
|
104
|
+
j as isFile,
|
|
105
|
+
ot as isFinite,
|
|
106
|
+
st as isFunction,
|
|
107
|
+
it as isInteger,
|
|
108
|
+
N as isJSON,
|
|
109
|
+
ut as isLength,
|
|
110
|
+
dt as isMap,
|
|
111
|
+
pt as isMatch,
|
|
112
|
+
xt as isMatchWith,
|
|
113
|
+
yt as isNaN,
|
|
114
|
+
gt as isNative,
|
|
115
|
+
ht as isNil,
|
|
116
|
+
Ot as isNull,
|
|
117
|
+
At as isNumber,
|
|
118
|
+
Bt as isObject,
|
|
119
|
+
kt as isObjectLike,
|
|
120
|
+
$t as isPlainObject,
|
|
121
|
+
b as isPromise,
|
|
122
|
+
R as isReadableByteStreamControllerSupported,
|
|
123
|
+
E as isReadableStream,
|
|
124
|
+
O as isReadableStreamDefaultControllerSupported,
|
|
125
|
+
n as isReadableStreamSupported,
|
|
126
|
+
A as isReadableStreamSymbolAsyncIteratorSupported,
|
|
127
|
+
Lt as isRegExp,
|
|
128
|
+
Wt as isSafeInteger,
|
|
129
|
+
Pt as isSet,
|
|
130
|
+
vt as isString,
|
|
131
|
+
Vt as isSymbol,
|
|
132
|
+
Tt as isTypedArray,
|
|
133
|
+
zt as isUndefined,
|
|
134
|
+
C as isValidColor,
|
|
135
|
+
Ht as isWeakMap,
|
|
136
|
+
Qt as isWeakSet
|
|
137
|
+
};
|
package/math/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Decimal as e } from "../decimal/decimal.js";
|
|
2
|
+
function u(t, n) {
|
|
3
|
+
return new e(t).plus(n).toNumber();
|
|
4
|
+
}
|
|
5
|
+
function i(t, n) {
|
|
6
|
+
return new e(t).minus(n).toNumber();
|
|
7
|
+
}
|
|
8
|
+
function o(t, n) {
|
|
9
|
+
return new e(t).times(n).toNumber();
|
|
10
|
+
}
|
|
11
|
+
function r(t, n) {
|
|
12
|
+
return new e(t).div(n).toNumber();
|
|
13
|
+
}
|
|
14
|
+
const s = u, m = i, c = o, d = r, l = {
|
|
15
|
+
plus: u,
|
|
16
|
+
minus: i,
|
|
17
|
+
times: o,
|
|
18
|
+
div: r,
|
|
19
|
+
add: s,
|
|
20
|
+
subtract: m,
|
|
21
|
+
multiply: c,
|
|
22
|
+
divide: d
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
s as add,
|
|
26
|
+
l as default,
|
|
27
|
+
r as div,
|
|
28
|
+
d as divide,
|
|
29
|
+
i as minus,
|
|
30
|
+
c as multiply,
|
|
31
|
+
u as plus,
|
|
32
|
+
m as subtract,
|
|
33
|
+
o as times
|
|
34
|
+
};
|
package/md5/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
function L(n, e) {
|
|
2
|
+
return n << e | n >>> 32 - e;
|
|
3
|
+
}
|
|
4
|
+
function u(n, e) {
|
|
5
|
+
let f, o, c, l, a;
|
|
6
|
+
return c = n & 2147483648, l = e & 2147483648, f = n & 1073741824, o = e & 1073741824, a = (n & 1073741823) + (e & 1073741823), f & o ? a ^ 2147483648 ^ c ^ l : f | o ? a & 1073741824 ? a ^ 3221225472 ^ c ^ l : a ^ 1073741824 ^ c ^ l : a ^ c ^ l;
|
|
7
|
+
}
|
|
8
|
+
function V(n, e, f) {
|
|
9
|
+
return n & e | ~n & f;
|
|
10
|
+
}
|
|
11
|
+
function D(n, e, f) {
|
|
12
|
+
return n & f | e & ~f;
|
|
13
|
+
}
|
|
14
|
+
function k(n, e, f) {
|
|
15
|
+
return n ^ e ^ f;
|
|
16
|
+
}
|
|
17
|
+
function v(n, e, f) {
|
|
18
|
+
return e ^ (n | ~f);
|
|
19
|
+
}
|
|
20
|
+
function b(n, e, f, o, c, l, a) {
|
|
21
|
+
return n = u(n, u(u(V(e, f, o), c), a)), u(L(n, l), e);
|
|
22
|
+
}
|
|
23
|
+
function i(n, e, f, o, c, l, a) {
|
|
24
|
+
return n = u(n, u(u(D(e, f, o), c), a)), u(L(n, l), e);
|
|
25
|
+
}
|
|
26
|
+
function S(n, e, f, o, c, l, a) {
|
|
27
|
+
return n = u(n, u(u(k(e, f, o), c), a)), u(L(n, l), e);
|
|
28
|
+
}
|
|
29
|
+
function C(n, e, f, o, c, l, a) {
|
|
30
|
+
return n = u(n, u(u(v(e, f, o), c), a)), u(L(n, l), e);
|
|
31
|
+
}
|
|
32
|
+
function E(n) {
|
|
33
|
+
let e, f = n.length, o = f + 8, l = ((o - o % 64) / 64 + 1) * 16, a = Array(l - 1), t = 0, x = 0;
|
|
34
|
+
for (; x < f; )
|
|
35
|
+
e = (x - x % 4) / 4, t = x % 4 * 8, a[e] = a[e] | n.charCodeAt(x) << t, x++;
|
|
36
|
+
return e = (x - x % 4) / 4, t = x % 4 * 8, a[e] = a[e] | 128 << t, a[l - 2] = f << 3, a[l - 1] = f >>> 29, a;
|
|
37
|
+
}
|
|
38
|
+
function I(n) {
|
|
39
|
+
let e = "", f = "", o, c;
|
|
40
|
+
for (c = 0; c <= 3; c++)
|
|
41
|
+
o = n >>> c * 8 & 255, f = "0" + o.toString(16), e = e + f.substring(
|
|
42
|
+
f.length - 2,
|
|
43
|
+
f.length
|
|
44
|
+
);
|
|
45
|
+
return e;
|
|
46
|
+
}
|
|
47
|
+
function M(n) {
|
|
48
|
+
n = n.replace(/\x0d\x0a/g, `
|
|
49
|
+
`);
|
|
50
|
+
let e = "";
|
|
51
|
+
for (let f = 0; f < n.length; f++) {
|
|
52
|
+
let o = n.charCodeAt(f);
|
|
53
|
+
o < 128 ? e += String.fromCharCode(o) : o > 127 && o < 2048 ? (e += String.fromCharCode(o >> 6 | 192), e += String.fromCharCode(o & 63 | 128)) : (e += String.fromCharCode(o >> 12 | 224), e += String.fromCharCode(o >> 6 & 63 | 128), e += String.fromCharCode(o & 63 | 128));
|
|
54
|
+
}
|
|
55
|
+
return e;
|
|
56
|
+
}
|
|
57
|
+
function R(n) {
|
|
58
|
+
let e = [], f, o, c, l, a, t, x, r, d, m = 7, h = 12, g = 17, T = 22, s = 5, p = 9, W = 14, A = 20, y = 4, H = 11, w = 16, O = 23, B = 6, F = 10, N = 15, G = 21;
|
|
59
|
+
for (n = M(n), e = E(n), t = 1732584193, x = 4023233417, r = 2562383102, d = 271733878, f = 0; f < e.length; f += 16)
|
|
60
|
+
o = t, c = x, l = r, a = d, t = b(t, x, r, d, e[f + 0], m, 3614090360), d = b(d, t, x, r, e[f + 1], h, 3905402710), r = b(r, d, t, x, e[f + 2], g, 606105819), x = b(x, r, d, t, e[f + 3], T, 3250441966), t = b(t, x, r, d, e[f + 4], m, 4118548399), d = b(d, t, x, r, e[f + 5], h, 1200080426), r = b(r, d, t, x, e[f + 6], g, 2821735955), x = b(x, r, d, t, e[f + 7], T, 4249261313), t = b(t, x, r, d, e[f + 8], m, 1770035416), d = b(d, t, x, r, e[f + 9], h, 2336552879), r = b(r, d, t, x, e[f + 10], g, 4294925233), x = b(x, r, d, t, e[f + 11], T, 2304563134), t = b(t, x, r, d, e[f + 12], m, 1804603682), d = b(d, t, x, r, e[f + 13], h, 4254626195), r = b(r, d, t, x, e[f + 14], g, 2792965006), x = b(x, r, d, t, e[f + 15], T, 1236535329), t = i(t, x, r, d, e[f + 1], s, 4129170786), d = i(d, t, x, r, e[f + 6], p, 3225465664), r = i(r, d, t, x, e[f + 11], W, 643717713), x = i(x, r, d, t, e[f + 0], A, 3921069994), t = i(t, x, r, d, e[f + 5], s, 3593408605), d = i(d, t, x, r, e[f + 10], p, 38016083), r = i(r, d, t, x, e[f + 15], W, 3634488961), x = i(x, r, d, t, e[f + 4], A, 3889429448), t = i(t, x, r, d, e[f + 9], s, 568446438), d = i(d, t, x, r, e[f + 14], p, 3275163606), r = i(r, d, t, x, e[f + 3], W, 4107603335), x = i(x, r, d, t, e[f + 8], A, 1163531501), t = i(t, x, r, d, e[f + 13], s, 2850285829), d = i(d, t, x, r, e[f + 2], p, 4243563512), r = i(r, d, t, x, e[f + 7], W, 1735328473), x = i(x, r, d, t, e[f + 12], A, 2368359562), t = S(t, x, r, d, e[f + 5], y, 4294588738), d = S(d, t, x, r, e[f + 8], H, 2272392833), r = S(r, d, t, x, e[f + 11], w, 1839030562), x = S(x, r, d, t, e[f + 14], O, 4259657740), t = S(t, x, r, d, e[f + 1], y, 2763975236), d = S(d, t, x, r, e[f + 4], H, 1272893353), r = S(r, d, t, x, e[f + 7], w, 4139469664), x = S(x, r, d, t, e[f + 10], O, 3200236656), t = S(t, x, r, d, e[f + 13], y, 681279174), d = S(d, t, x, r, e[f + 0], H, 3936430074), r = S(r, d, t, x, e[f + 3], w, 3572445317), x = S(x, r, d, t, e[f + 6], O, 76029189), t = S(t, x, r, d, e[f + 9], y, 3654602809), d = S(d, t, x, r, e[f + 12], H, 3873151461), r = S(r, d, t, x, e[f + 15], w, 530742520), x = S(x, r, d, t, e[f + 2], O, 3299628645), t = C(t, x, r, d, e[f + 0], B, 4096336452), d = C(d, t, x, r, e[f + 7], F, 1126891415), r = C(r, d, t, x, e[f + 14], N, 2878612391), x = C(x, r, d, t, e[f + 5], G, 4237533241), t = C(t, x, r, d, e[f + 12], B, 1700485571), d = C(d, t, x, r, e[f + 3], F, 2399980690), r = C(r, d, t, x, e[f + 10], N, 4293915773), x = C(x, r, d, t, e[f + 1], G, 2240044497), t = C(t, x, r, d, e[f + 8], B, 1873313359), d = C(d, t, x, r, e[f + 15], F, 4264355552), r = C(r, d, t, x, e[f + 6], N, 2734768916), x = C(x, r, d, t, e[f + 13], G, 1309151649), t = C(t, x, r, d, e[f + 4], B, 4149444226), d = C(d, t, x, r, e[f + 11], F, 3174756917), r = C(r, d, t, x, e[f + 2], N, 718787259), x = C(x, r, d, t, e[f + 9], G, 3951481745), t = u(t, o), x = u(x, c), r = u(r, l), d = u(d, a);
|
|
61
|
+
return (I(t) + I(x) + I(r) + I(d)).toLowerCase();
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
R as default
|
|
65
|
+
};
|