@nano-lib/util 1.0.14 → 1.0.15
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/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/index.mjs +2329 -604
- package/lib/utils/crypto.d.ts +7 -0
- package/package.json +6 -3
package/lib/index.mjs
CHANGED
|
@@ -1,273 +1,273 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
4
|
-
document.querySelector(
|
|
1
|
+
const kn = (t, i, o, s) => (t /= s / 2, t < 1 ? o / 2 * t * t + i : (t--, -o / 2 * (t * (t - 2) - 1) + i)), Vn = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || ((t) => window.setTimeout(t, 16.666666666666668));
|
|
2
|
+
function $n(t, i) {
|
|
3
|
+
if (i) {
|
|
4
|
+
document.querySelector(i).scrollTop = t;
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
-
document.documentElement.scrollTop =
|
|
8
|
-
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
function
|
|
13
|
-
const { target:
|
|
14
|
-
let
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
7
|
+
document.documentElement.scrollTop = t, document.body.parentNode.scrollTop = t, document.body.scrollTop = t;
|
|
8
|
+
}
|
|
9
|
+
function jn(t) {
|
|
10
|
+
return t ? document.querySelector(t).scrollTop : document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop;
|
|
11
|
+
}
|
|
12
|
+
function Un(t) {
|
|
13
|
+
const { target: i, to: o = 0, duration: s = 500, callback: u } = t ?? {}, f = jn(i), d = o - f, a = 20;
|
|
14
|
+
let b = 0;
|
|
15
|
+
const m = function() {
|
|
16
|
+
b += a;
|
|
17
|
+
const v = kn(b, f, d, s);
|
|
18
|
+
$n(v, i), b < s ? Vn(m) : u && u();
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
m();
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Zn(t, i) {
|
|
23
23
|
switch (arguments.length) {
|
|
24
24
|
case 1:
|
|
25
|
-
return parseInt((Math.random() *
|
|
25
|
+
return parseInt((Math.random() * t + 1).toString(), 10);
|
|
26
26
|
case 2:
|
|
27
|
-
return parseInt((Math.random() * (
|
|
27
|
+
return parseInt((Math.random() * (i - t + 1) + t).toString(), 10);
|
|
28
28
|
default:
|
|
29
29
|
return 0;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
let
|
|
34
|
-
const
|
|
35
|
-
for (let
|
|
36
|
-
|
|
37
|
-
for (let
|
|
38
|
-
|
|
39
|
-
return e;
|
|
40
|
-
}
|
|
41
|
-
function m(e, t) {
|
|
42
|
-
if (!e) return "-";
|
|
43
|
-
e.toString().length === 10 && (e = +e * 1e3), t ?? (t = "YYYY-MM-DD HH:mm:ss");
|
|
44
|
-
const n = new Date(e), r = (s, c, a = " ") => {
|
|
45
|
-
if (s.length >= c) return s;
|
|
46
|
-
const u = c - s.length;
|
|
47
|
-
let f = Math.ceil(u / a.length);
|
|
48
|
-
for (; f >>= 1; )
|
|
49
|
-
a += a, f === 1 && (a += a);
|
|
50
|
-
return a.slice(0, u) + s;
|
|
51
|
-
};
|
|
52
|
-
let o;
|
|
53
|
-
const i = {
|
|
54
|
-
"Y+": n.getFullYear().toString(),
|
|
55
|
-
"M+": (n.getMonth() + 1).toString(),
|
|
56
|
-
"D+": n.getDate().toString(),
|
|
57
|
-
"H+": n.getHours().toString(),
|
|
58
|
-
"m+": n.getMinutes().toString(),
|
|
59
|
-
"s+": n.getSeconds().toString()
|
|
60
|
-
};
|
|
61
|
-
for (const s in i)
|
|
62
|
-
o = new RegExp("(" + s + ")").exec(t), o && (t = t.replace(o[1], o[1].length == 1 ? i[s] : r(i[s], o[1].length, "0")));
|
|
32
|
+
function Gn() {
|
|
33
|
+
let t = "";
|
|
34
|
+
const i = [];
|
|
35
|
+
for (let o = 0; o <= 15; o++)
|
|
36
|
+
i[o] = o.toString(16);
|
|
37
|
+
for (let o = 1; o <= 36; o++)
|
|
38
|
+
o === 9 || o === 14 || o === 19 || o === 24 ? t += "-" : o === 15 ? t += 4 : o === 20 ? t += i[Math.random() * 4 | 8] : t += i[Math.random() * 16 | 0];
|
|
63
39
|
return t;
|
|
64
40
|
}
|
|
65
|
-
function
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
41
|
+
function xt(t, i) {
|
|
42
|
+
if (!t) return "-";
|
|
43
|
+
t.toString().length === 10 && (t = +t * 1e3), i ?? (i = "YYYY-MM-DD HH:mm:ss");
|
|
44
|
+
const o = new Date(t), s = (d, a, b = " ") => {
|
|
45
|
+
if (d.length >= a) return d;
|
|
46
|
+
const m = a - d.length;
|
|
47
|
+
let v = Math.ceil(m / b.length);
|
|
48
|
+
for (; v >>= 1; )
|
|
49
|
+
b += b, v === 1 && (b += b);
|
|
50
|
+
return b.slice(0, m) + d;
|
|
51
|
+
};
|
|
52
|
+
let u;
|
|
53
|
+
const f = {
|
|
54
|
+
"Y+": o.getFullYear().toString(),
|
|
55
|
+
"M+": (o.getMonth() + 1).toString(),
|
|
56
|
+
"D+": o.getDate().toString(),
|
|
57
|
+
"H+": o.getHours().toString(),
|
|
58
|
+
"m+": o.getMinutes().toString(),
|
|
59
|
+
"s+": o.getSeconds().toString()
|
|
60
|
+
};
|
|
61
|
+
for (const d in f)
|
|
62
|
+
u = new RegExp("(" + d + ")").exec(i), u && (i = i.replace(u[1], u[1].length == 1 ? f[d] : s(f[d], u[1].length, "0")));
|
|
63
|
+
return i;
|
|
64
|
+
}
|
|
65
|
+
function Wn(t, i) {
|
|
66
|
+
`${t}`.length === 10 ? t = parseInt(t + "") * 1e3 : t = +t;
|
|
67
|
+
const o = new Date(t), u = (Date.now() - Number(o)) / 1e3;
|
|
68
|
+
return u < 30 ? "刚刚" : u < 3600 ? `${Math.ceil(u / 60)}分钟前` : u < 3600 * 24 ? `${Math.ceil(u / 3600)}小时前` : u < 3600 * 24 * 2 ? "1天前" : i ? xt(t, i) : `${o.getMonth() + 1}月${o.getDate()}日${o.getHours()}时${o.getMinutes()}分`;
|
|
69
|
+
}
|
|
70
|
+
function Jn(t) {
|
|
71
|
+
const i = t || /* @__PURE__ */ new Date(), o = new Date(i), s = new Date(i);
|
|
72
|
+
return o.setHours(0, 0, 0), s.setHours(23, 59, 59), {
|
|
73
|
+
dateRange: [xt(o), xt(s)],
|
|
74
|
+
timestampRange: [o.getTime(), s.getTime()]
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
set(
|
|
79
|
-
sessionStorage &&
|
|
77
|
+
const Xn = {
|
|
78
|
+
set(t, i) {
|
|
79
|
+
sessionStorage && t && i && sessionStorage.setItem(t, i);
|
|
80
80
|
},
|
|
81
|
-
get(
|
|
82
|
-
return !sessionStorage || !
|
|
81
|
+
get(t) {
|
|
82
|
+
return !sessionStorage || !t ? null : sessionStorage.getItem(t);
|
|
83
83
|
},
|
|
84
|
-
setJSON(
|
|
85
|
-
|
|
84
|
+
setJSON(t, i) {
|
|
85
|
+
i && this.set(t, JSON.stringify(i));
|
|
86
86
|
},
|
|
87
|
-
getJSON(
|
|
88
|
-
const
|
|
89
|
-
return
|
|
87
|
+
getJSON(t) {
|
|
88
|
+
const i = this.get(t);
|
|
89
|
+
return i ? JSON.parse(i) : null;
|
|
90
90
|
},
|
|
91
|
-
remove(
|
|
92
|
-
sessionStorage.removeItem(
|
|
91
|
+
remove(t) {
|
|
92
|
+
sessionStorage.removeItem(t);
|
|
93
93
|
},
|
|
94
94
|
clear() {
|
|
95
95
|
sessionStorage.clear();
|
|
96
96
|
}
|
|
97
|
-
},
|
|
98
|
-
set(
|
|
99
|
-
localStorage &&
|
|
97
|
+
}, Kn = {
|
|
98
|
+
set(t, i) {
|
|
99
|
+
localStorage && t && i && localStorage.setItem(t, i);
|
|
100
100
|
},
|
|
101
|
-
get(
|
|
102
|
-
return !localStorage || !
|
|
101
|
+
get(t) {
|
|
102
|
+
return !localStorage || !t ? null : localStorage.getItem(t);
|
|
103
103
|
},
|
|
104
|
-
setJSON(
|
|
105
|
-
|
|
104
|
+
setJSON(t, i) {
|
|
105
|
+
i && this.set(t, JSON.stringify(i));
|
|
106
106
|
},
|
|
107
|
-
getJSON(
|
|
108
|
-
const
|
|
109
|
-
return
|
|
107
|
+
getJSON(t) {
|
|
108
|
+
const i = this.get(t);
|
|
109
|
+
return i ? JSON.parse(i) : null;
|
|
110
110
|
},
|
|
111
|
-
remove(
|
|
112
|
-
localStorage.removeItem(
|
|
111
|
+
remove(t) {
|
|
112
|
+
localStorage.removeItem(t);
|
|
113
113
|
},
|
|
114
114
|
clear() {
|
|
115
115
|
localStorage.clear();
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
function
|
|
119
|
-
if (!
|
|
118
|
+
function Qn(t, i) {
|
|
119
|
+
if (!t || !i)
|
|
120
120
|
return;
|
|
121
|
-
let
|
|
122
|
-
const
|
|
123
|
-
|
|
121
|
+
let o = t.className;
|
|
122
|
+
const s = o.indexOf(i);
|
|
123
|
+
s === -1 ? o += `${i}` : o = o.substring(0, s) + o.substring(s + i.length), t.className = o;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
return
|
|
125
|
+
function Ct(t, i) {
|
|
126
|
+
return t.className.match(new RegExp("(?:\\s|^)" + i + "(?:\\s|$)"));
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
128
|
+
function tr(t, i) {
|
|
129
|
+
Ct(t, i) || (t.className += ` ${i}`);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
134
|
-
|
|
131
|
+
function er(t, i) {
|
|
132
|
+
if (Ct(t, i)) {
|
|
133
|
+
const o = new RegExp("(?:\\s|^)" + i + "(?:\\s|$)");
|
|
134
|
+
t.className = t.className.replace(o, " ");
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
let
|
|
139
|
-
return function(...
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
function nr(t) {
|
|
138
|
+
let i = !1;
|
|
139
|
+
return function(...o) {
|
|
140
|
+
i || (i = !0, window.requestAnimationFrame(() => {
|
|
141
|
+
t.apply(this, o), i = !1;
|
|
142
142
|
}));
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
145
|
+
function rr(t) {
|
|
146
|
+
t && (t.oncontextmenu = () => !1);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return /^(http(s)?:\/\/)/.test(
|
|
148
|
+
function ir(t) {
|
|
149
|
+
return /^(http(s)?:\/\/)/.test(t);
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
return /^(https?:|mailto:|tel:)/.test(
|
|
151
|
+
function or(t) {
|
|
152
|
+
return /^(https?:|mailto:|tel:)/.test(t);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
return Object.prototype.toString.call(
|
|
154
|
+
function sr(t) {
|
|
155
|
+
return Object.prototype.toString.call(t) === "[object String]";
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(
|
|
157
|
+
function fr(t) {
|
|
158
|
+
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(t);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
return !Object.keys(
|
|
160
|
+
function cr(t) {
|
|
161
|
+
return !Object.keys(t).length;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(
|
|
163
|
+
function ur(t) {
|
|
164
|
+
return /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(t);
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
return new RegExp(`^S*(?=S{${
|
|
166
|
+
function ar(t, i = 8) {
|
|
167
|
+
return new RegExp(`^S*(?=S{${i}},})(?=S*d)(?=S*[A-Z])(?=S*[a-z])(?=S*[!@#$%^&*?])S*$`).test(t);
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
|
|
169
|
+
function hr(t) {
|
|
170
|
+
return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t);
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
return /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/.test(
|
|
172
|
+
function Pt(t) {
|
|
173
|
+
return /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/.test(t);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
return /^0\d{2,3}-?\d{7,8}$/.test(
|
|
175
|
+
function lr(t) {
|
|
176
|
+
return /^0\d{2,3}-?\d{7,8}$/.test(t);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return /^1[3-9]\d{9}$/.test(
|
|
178
|
+
function dr(t) {
|
|
179
|
+
return /^1[3-9]\d{9}$/.test(t);
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const $t = () => {
|
|
182
182
|
};
|
|
183
|
-
function
|
|
184
|
-
return new Promise((
|
|
185
|
-
}
|
|
186
|
-
function
|
|
187
|
-
return new Promise((
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
return clearInterval(
|
|
191
|
-
|
|
183
|
+
function vi(t) {
|
|
184
|
+
return new Promise((i) => setTimeout(i, t));
|
|
185
|
+
}
|
|
186
|
+
function yi(t, i) {
|
|
187
|
+
return new Promise((o) => {
|
|
188
|
+
const s = setInterval(() => {
|
|
189
|
+
if (t === 0)
|
|
190
|
+
return clearInterval(s), o(!0), !1;
|
|
191
|
+
i && i(t), t--;
|
|
192
192
|
}, 1e3);
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
const
|
|
197
|
-
let
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
for (;
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
return
|
|
205
|
-
}
|
|
206
|
-
function
|
|
207
|
-
let
|
|
208
|
-
return function(...
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
},
|
|
195
|
+
function bi(t, i) {
|
|
196
|
+
const o = t.slice(), s = [];
|
|
197
|
+
let u = o.length;
|
|
198
|
+
const f = [];
|
|
199
|
+
if (i > u) return null;
|
|
200
|
+
for (; i--; ) {
|
|
201
|
+
const d = Math.floor(Math.random() * u);
|
|
202
|
+
s[i] = o[d in f ? f[d] : d], f[d] = --u in f ? f[u] : u;
|
|
203
|
+
}
|
|
204
|
+
return s;
|
|
205
|
+
}
|
|
206
|
+
function wi(t, i) {
|
|
207
|
+
let o = null;
|
|
208
|
+
return function(...s) {
|
|
209
|
+
o !== null && clearTimeout(o), o = setTimeout(() => {
|
|
210
|
+
t.apply(this, s), o = null;
|
|
211
|
+
}, i);
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
if (!
|
|
214
|
+
function Ti(t) {
|
|
215
|
+
if (!Pt(t))
|
|
216
216
|
throw new Error("Please provide a valid ID number!");
|
|
217
|
-
const
|
|
218
|
-
return parseInt(
|
|
217
|
+
const i = t.length, o = i === 15 ? t[i - 1] : t[i - 2];
|
|
218
|
+
return parseInt(o) % 2 === 1 ? "1" : "2";
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
if (!
|
|
220
|
+
function Fi(t) {
|
|
221
|
+
if (!Pt(t))
|
|
222
222
|
throw new Error("Please provide a valid ID number!");
|
|
223
|
-
return
|
|
224
|
-
}
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
return
|
|
229
|
-
},
|
|
230
|
-
typeof
|
|
231
|
-
for (const
|
|
232
|
-
|
|
233
|
-
return
|
|
223
|
+
return t.substring(6, 10) + "-" + t.substring(10, 12) + "-" + t.substring(12, 14);
|
|
224
|
+
}
|
|
225
|
+
const pr = (t, i = "") => {
|
|
226
|
+
i || (i = location.origin);
|
|
227
|
+
const o = new RegExp(/^http(s)?:\/\//), s = new RegExp(/^((?:[a-z]+:)?\/\/|data:image\/)(.*)/i);
|
|
228
|
+
return o.test(t) || s.test(t) ? t : i + t;
|
|
229
|
+
}, Si = (t, i = "") => {
|
|
230
|
+
typeof t == "string" && (t = t === "" ? [] : t.split(","));
|
|
231
|
+
for (const o in t)
|
|
232
|
+
t[o] = pr(t[o], i);
|
|
233
|
+
return t;
|
|
234
234
|
};
|
|
235
|
-
function
|
|
236
|
-
let
|
|
237
|
-
return (...
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
},
|
|
241
|
-
(
|
|
242
|
-
(
|
|
235
|
+
function Ei(t) {
|
|
236
|
+
let i = $t;
|
|
237
|
+
return (...o) => new Promise((s, u) => {
|
|
238
|
+
i(), i = () => {
|
|
239
|
+
s = u = $t;
|
|
240
|
+
}, t(...o).then(
|
|
241
|
+
(f) => s(f),
|
|
242
|
+
(f) => u(f)
|
|
243
243
|
);
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
function
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
function de(e) {
|
|
251
|
-
const t = [];
|
|
252
|
-
for (let n = 0; n < e.length; n++)
|
|
253
|
-
e[n] && t.push(e[n]);
|
|
254
|
-
return t;
|
|
246
|
+
function Bi(t, i) {
|
|
247
|
+
const o = document.createElement("a");
|
|
248
|
+
o.download = i, o.href = t, o.click();
|
|
255
249
|
}
|
|
256
|
-
function
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
250
|
+
function gr(t) {
|
|
251
|
+
const i = [];
|
|
252
|
+
for (let o = 0; o < t.length; o++)
|
|
253
|
+
t[o] && i.push(t[o]);
|
|
254
|
+
return i;
|
|
255
|
+
}
|
|
256
|
+
function _i(t, i, o = !1) {
|
|
257
|
+
let s = Math.round(t / i * 1e4) / 100;
|
|
258
|
+
return Number.isNaN(s) && (s = 0), o ? Math.floor(s) : s;
|
|
259
|
+
}
|
|
260
|
+
function Ri(t) {
|
|
261
|
+
const i = document.createElement("link");
|
|
262
|
+
i.rel = "stylesheet", i.href = t, i.crossOrigin = "anonymous", document.getElementsByTagName("head")[0].appendChild(i);
|
|
263
|
+
}
|
|
264
|
+
function Di(t) {
|
|
265
|
+
return new Promise((i, o) => {
|
|
266
|
+
const s = document.createElement("script");
|
|
267
|
+
s.type = "text/javascript", s.src = t, s.onload = () => i(), s.onerror = (u) => o(u), document.getElementsByTagName("head")[0].appendChild(s);
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
|
-
const
|
|
270
|
+
const xr = [
|
|
271
271
|
["date", "YYYY-MM-DD"],
|
|
272
272
|
["daterange", "YYYY-MM-DD"],
|
|
273
273
|
["datetime", "YYYY-MM-DD HH:mm:ss"],
|
|
@@ -277,7 +277,7 @@ const he = [
|
|
|
277
277
|
["year", "YYYY"],
|
|
278
278
|
["yearrange", "YYYY"],
|
|
279
279
|
["time", "HH:mm:ss"]
|
|
280
|
-
],
|
|
280
|
+
], mr = {
|
|
281
281
|
view: "查看",
|
|
282
282
|
add: "添加",
|
|
283
283
|
edit: "编辑",
|
|
@@ -326,7 +326,7 @@ const he = [
|
|
|
326
326
|
export: "导出",
|
|
327
327
|
import: "导入",
|
|
328
328
|
defaultErrorCode: "系统未知错误,请反馈给管理员"
|
|
329
|
-
},
|
|
329
|
+
}, vr = {
|
|
330
330
|
400: "请求失败,请您稍后重试!",
|
|
331
331
|
401: "认证失败,无法访问系统资源!",
|
|
332
332
|
403: "当前操作没有权限!",
|
|
@@ -337,115 +337,115 @@ const he = [
|
|
|
337
337
|
502: "网关错误!",
|
|
338
338
|
503: "服务不可用!",
|
|
339
339
|
504: "网关超时!"
|
|
340
|
-
},
|
|
341
|
-
function
|
|
342
|
-
return
|
|
340
|
+
}, yr = new Map(xr), et = mr, br = vr, ie = ["jpg", "jpeg", "png", "bmp", "gif"], oe = ["mp3", "mp4", "webm", "ogg", "3gp"], se = ["doc", "docx", "xls", "xlsx", "ppt", "txt", "pdf", "zip"], wr = [...ie, ...oe, ...se];
|
|
341
|
+
function Tr(t) {
|
|
342
|
+
return br[t] ?? et.defaultErrorCode;
|
|
343
343
|
}
|
|
344
|
-
function
|
|
345
|
-
return
|
|
344
|
+
function Fr(t) {
|
|
345
|
+
return t == null ? et.unfilled : (t = typeof t == "number" ? `${t}` : t, t === "1" ? et.yes : et.no);
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
return
|
|
347
|
+
function Sr(t) {
|
|
348
|
+
return t == null ? et.unfilled : (t = typeof t == "number" ? `${t}` : t, t === "1" ? et.have : et.noHave);
|
|
349
349
|
}
|
|
350
|
-
function
|
|
351
|
-
return
|
|
350
|
+
function Er(t) {
|
|
351
|
+
return t ? t.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2") : "";
|
|
352
352
|
}
|
|
353
|
-
function
|
|
354
|
-
if (
|
|
355
|
-
const
|
|
356
|
-
return
|
|
353
|
+
function Br(t, i, o) {
|
|
354
|
+
if (i ?? (i = 4), o ?? (o = 4), t) {
|
|
355
|
+
const s = t.length;
|
|
356
|
+
return t.substring(0, i) + "*".repeat(s - i - o) + t.substring(s - o);
|
|
357
357
|
}
|
|
358
358
|
return "";
|
|
359
359
|
}
|
|
360
|
-
function
|
|
361
|
-
return
|
|
360
|
+
function _r(t) {
|
|
361
|
+
return t.replace(/( |^)[a-z]/g, (i) => i.toUpperCase());
|
|
362
362
|
}
|
|
363
|
-
function
|
|
364
|
-
return
|
|
363
|
+
function Rr(t) {
|
|
364
|
+
return t.replace(/( |^)[A-Z]/g, (i) => i.toLowerCase());
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
const
|
|
368
|
-
return
|
|
366
|
+
function Dr(t, i) {
|
|
367
|
+
const o = t.find((s) => s.value === i);
|
|
368
|
+
return o ? o.label : "";
|
|
369
369
|
}
|
|
370
|
-
function
|
|
371
|
-
const
|
|
372
|
-
return Array.from(new Set(
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
var
|
|
376
|
-
const
|
|
377
|
-
|
|
370
|
+
function Ar(t, i, o) {
|
|
371
|
+
const s = [], u = i.split(","), f = o.split(",");
|
|
372
|
+
return Array.from(new Set(u)).forEach((a) => {
|
|
373
|
+
const b = t.find((m) => m.value === a);
|
|
374
|
+
b && f.forEach((m) => {
|
|
375
|
+
var B;
|
|
376
|
+
const v = (B = b.children) == null ? void 0 : B.find((_) => _.value === m);
|
|
377
|
+
v && s.push(v);
|
|
378
378
|
});
|
|
379
|
-
}),
|
|
379
|
+
}), s.map((a) => a.label).join();
|
|
380
|
+
}
|
|
381
|
+
function fe(t, i, o) {
|
|
382
|
+
var f;
|
|
383
|
+
if (!i) return "";
|
|
384
|
+
const s = i.split(","), u = o.find((d) => d.value === s[t]);
|
|
385
|
+
return u ? ((f = u.children) != null && f.length && fe(t + 1, i, u.children), u.label) : "";
|
|
380
386
|
}
|
|
381
|
-
function
|
|
382
|
-
var i;
|
|
387
|
+
function Ir(t, i, o) {
|
|
383
388
|
if (!t) return "";
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if (typeof r == "object") {
|
|
405
|
-
for (const i of Object.keys(r))
|
|
406
|
-
if (r[i] !== null && typeof r[i] < "u") {
|
|
407
|
-
const s = `${n}[${i}]`, c = `${encodeURIComponent(s)}=`;
|
|
408
|
-
t += `${c + encodeURIComponent(r[i])}&`;
|
|
389
|
+
const s = t.split(","), u = [], f = s.length - 1, d = s.findIndex((a) => a === o);
|
|
390
|
+
if (d !== -1) {
|
|
391
|
+
const a = s[f] === o;
|
|
392
|
+
s.splice(a ? 0 : d, a ? f : 1);
|
|
393
|
+
}
|
|
394
|
+
return s.forEach((a) => {
|
|
395
|
+
const b = i.find((m) => m.value === a);
|
|
396
|
+
b && u.push(b);
|
|
397
|
+
}), u.map((a) => a.label).join();
|
|
398
|
+
}
|
|
399
|
+
function Mr(t) {
|
|
400
|
+
let i = "";
|
|
401
|
+
for (const o of Object.keys(t)) {
|
|
402
|
+
const s = t[o], u = `${encodeURIComponent(o)}=`;
|
|
403
|
+
if (s !== null && typeof s < "u")
|
|
404
|
+
if (typeof s == "object") {
|
|
405
|
+
for (const f of Object.keys(s))
|
|
406
|
+
if (s[f] !== null && typeof s[f] < "u") {
|
|
407
|
+
const d = `${o}[${f}]`, a = `${encodeURIComponent(d)}=`;
|
|
408
|
+
i += `${a + encodeURIComponent(s[f])}&`;
|
|
409
409
|
}
|
|
410
410
|
} else
|
|
411
|
-
|
|
411
|
+
i += `${u + encodeURIComponent(s)}&`;
|
|
412
412
|
}
|
|
413
|
-
return
|
|
413
|
+
return i;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
416
|
-
return
|
|
417
|
-
Object.keys(
|
|
415
|
+
function Or(t) {
|
|
416
|
+
return t ? gr(
|
|
417
|
+
Object.keys(t).map((i) => t[i] === void 0 ? "" : `${encodeURIComponent(i)}=${encodeURIComponent(t[i])}`)
|
|
418
418
|
).join("&") : "";
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
const
|
|
422
|
-
if (!
|
|
420
|
+
function qr(t) {
|
|
421
|
+
const i = decodeURIComponent(t.split("?")[1]).replace(/\+/g, " ");
|
|
422
|
+
if (!i)
|
|
423
423
|
return {};
|
|
424
|
-
const
|
|
425
|
-
return
|
|
426
|
-
const
|
|
427
|
-
if (
|
|
428
|
-
const
|
|
429
|
-
|
|
424
|
+
const o = {};
|
|
425
|
+
return i.split("&").forEach((u) => {
|
|
426
|
+
const f = u.indexOf("=");
|
|
427
|
+
if (f !== -1) {
|
|
428
|
+
const d = u.substring(0, f), a = u.substring(f + 1, u.length);
|
|
429
|
+
o[d] = a;
|
|
430
430
|
}
|
|
431
|
-
}),
|
|
431
|
+
}), o;
|
|
432
432
|
}
|
|
433
|
-
var
|
|
433
|
+
var ce = function() {
|
|
434
434
|
if (typeof Map < "u")
|
|
435
435
|
return Map;
|
|
436
|
-
function
|
|
437
|
-
var
|
|
438
|
-
return
|
|
439
|
-
return
|
|
440
|
-
}),
|
|
436
|
+
function t(i, o) {
|
|
437
|
+
var s = -1;
|
|
438
|
+
return i.some(function(u, f) {
|
|
439
|
+
return u[0] === o ? (s = f, !0) : !1;
|
|
440
|
+
}), s;
|
|
441
441
|
}
|
|
442
442
|
return (
|
|
443
443
|
/** @class */
|
|
444
444
|
function() {
|
|
445
|
-
function
|
|
445
|
+
function i() {
|
|
446
446
|
this.__entries__ = [];
|
|
447
447
|
}
|
|
448
|
-
return Object.defineProperty(
|
|
448
|
+
return Object.defineProperty(i.prototype, "size", {
|
|
449
449
|
/**
|
|
450
450
|
* @returns {boolean}
|
|
451
451
|
*/
|
|
@@ -454,433 +454,2158 @@ var I = function() {
|
|
|
454
454
|
},
|
|
455
455
|
enumerable: !0,
|
|
456
456
|
configurable: !0
|
|
457
|
-
}),
|
|
458
|
-
var
|
|
459
|
-
return
|
|
460
|
-
},
|
|
461
|
-
var
|
|
462
|
-
~
|
|
463
|
-
},
|
|
464
|
-
var
|
|
465
|
-
~
|
|
466
|
-
},
|
|
467
|
-
return !!~
|
|
468
|
-
},
|
|
457
|
+
}), i.prototype.get = function(o) {
|
|
458
|
+
var s = t(this.__entries__, o), u = this.__entries__[s];
|
|
459
|
+
return u && u[1];
|
|
460
|
+
}, i.prototype.set = function(o, s) {
|
|
461
|
+
var u = t(this.__entries__, o);
|
|
462
|
+
~u ? this.__entries__[u][1] = s : this.__entries__.push([o, s]);
|
|
463
|
+
}, i.prototype.delete = function(o) {
|
|
464
|
+
var s = this.__entries__, u = t(s, o);
|
|
465
|
+
~u && s.splice(u, 1);
|
|
466
|
+
}, i.prototype.has = function(o) {
|
|
467
|
+
return !!~t(this.__entries__, o);
|
|
468
|
+
}, i.prototype.clear = function() {
|
|
469
469
|
this.__entries__.splice(0);
|
|
470
|
-
},
|
|
471
|
-
|
|
472
|
-
for (var
|
|
473
|
-
var
|
|
474
|
-
|
|
470
|
+
}, i.prototype.forEach = function(o, s) {
|
|
471
|
+
s === void 0 && (s = null);
|
|
472
|
+
for (var u = 0, f = this.__entries__; u < f.length; u++) {
|
|
473
|
+
var d = f[u];
|
|
474
|
+
o.call(s, d[1], d[0]);
|
|
475
475
|
}
|
|
476
|
-
},
|
|
476
|
+
}, i;
|
|
477
477
|
}()
|
|
478
478
|
);
|
|
479
|
-
}(),
|
|
479
|
+
}(), qt = typeof window < "u" && typeof document < "u" && window.document === document, mt = function() {
|
|
480
480
|
return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
|
|
481
|
-
}(),
|
|
482
|
-
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(
|
|
481
|
+
}(), Cr = function() {
|
|
482
|
+
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(mt) : function(t) {
|
|
483
483
|
return setTimeout(function() {
|
|
484
|
-
return
|
|
484
|
+
return t(Date.now());
|
|
485
485
|
}, 1e3 / 60);
|
|
486
486
|
};
|
|
487
|
-
}(),
|
|
488
|
-
function
|
|
489
|
-
var
|
|
490
|
-
function
|
|
491
|
-
|
|
492
|
-
}
|
|
493
|
-
function
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
function
|
|
497
|
-
var
|
|
498
|
-
if (
|
|
499
|
-
if (
|
|
487
|
+
}(), Pr = 2;
|
|
488
|
+
function zr(t, i) {
|
|
489
|
+
var o = !1, s = !1, u = 0;
|
|
490
|
+
function f() {
|
|
491
|
+
o && (o = !1, t()), s && a();
|
|
492
|
+
}
|
|
493
|
+
function d() {
|
|
494
|
+
Cr(f);
|
|
495
|
+
}
|
|
496
|
+
function a() {
|
|
497
|
+
var b = Date.now();
|
|
498
|
+
if (o) {
|
|
499
|
+
if (b - u < Pr)
|
|
500
500
|
return;
|
|
501
|
-
|
|
501
|
+
s = !0;
|
|
502
502
|
} else
|
|
503
|
-
|
|
504
|
-
|
|
503
|
+
o = !0, s = !1, setTimeout(d, i);
|
|
504
|
+
u = b;
|
|
505
505
|
}
|
|
506
|
-
return
|
|
506
|
+
return a;
|
|
507
507
|
}
|
|
508
|
-
var
|
|
508
|
+
var Hr = 20, Lr = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], Nr = typeof MutationObserver < "u", Yr = (
|
|
509
509
|
/** @class */
|
|
510
510
|
function() {
|
|
511
|
-
function
|
|
512
|
-
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh =
|
|
513
|
-
}
|
|
514
|
-
return
|
|
515
|
-
~this.observers_.indexOf(
|
|
516
|
-
},
|
|
517
|
-
var
|
|
518
|
-
~
|
|
519
|
-
},
|
|
520
|
-
var
|
|
521
|
-
|
|
522
|
-
},
|
|
523
|
-
var
|
|
524
|
-
return
|
|
511
|
+
function t() {
|
|
512
|
+
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = zr(this.refresh.bind(this), Hr);
|
|
513
|
+
}
|
|
514
|
+
return t.prototype.addObserver = function(i) {
|
|
515
|
+
~this.observers_.indexOf(i) || this.observers_.push(i), this.connected_ || this.connect_();
|
|
516
|
+
}, t.prototype.removeObserver = function(i) {
|
|
517
|
+
var o = this.observers_, s = o.indexOf(i);
|
|
518
|
+
~s && o.splice(s, 1), !o.length && this.connected_ && this.disconnect_();
|
|
519
|
+
}, t.prototype.refresh = function() {
|
|
520
|
+
var i = this.updateObservers_();
|
|
521
|
+
i && this.refresh();
|
|
522
|
+
}, t.prototype.updateObservers_ = function() {
|
|
523
|
+
var i = this.observers_.filter(function(o) {
|
|
524
|
+
return o.gatherActive(), o.hasActive();
|
|
525
525
|
});
|
|
526
|
-
return
|
|
527
|
-
return
|
|
528
|
-
}),
|
|
529
|
-
},
|
|
530
|
-
!
|
|
526
|
+
return i.forEach(function(o) {
|
|
527
|
+
return o.broadcastActive();
|
|
528
|
+
}), i.length > 0;
|
|
529
|
+
}, t.prototype.connect_ = function() {
|
|
530
|
+
!qt || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), Nr ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
|
|
531
531
|
attributes: !0,
|
|
532
532
|
childList: !0,
|
|
533
533
|
characterData: !0,
|
|
534
534
|
subtree: !0
|
|
535
535
|
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
|
|
536
|
-
},
|
|
537
|
-
!
|
|
538
|
-
},
|
|
539
|
-
var
|
|
540
|
-
return !!~
|
|
536
|
+
}, t.prototype.disconnect_ = function() {
|
|
537
|
+
!qt || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
|
|
538
|
+
}, t.prototype.onTransitionEnd_ = function(i) {
|
|
539
|
+
var o = i.propertyName, s = o === void 0 ? "" : o, u = Lr.some(function(f) {
|
|
540
|
+
return !!~s.indexOf(f);
|
|
541
541
|
});
|
|
542
|
-
|
|
543
|
-
},
|
|
544
|
-
return this.instance_ || (this.instance_ = new
|
|
545
|
-
},
|
|
542
|
+
u && this.refresh();
|
|
543
|
+
}, t.getInstance = function() {
|
|
544
|
+
return this.instance_ || (this.instance_ = new t()), this.instance_;
|
|
545
|
+
}, t.instance_ = null, t;
|
|
546
546
|
}()
|
|
547
|
-
),
|
|
548
|
-
for (var
|
|
549
|
-
var
|
|
550
|
-
Object.defineProperty(
|
|
551
|
-
value:
|
|
547
|
+
), ue = function(t, i) {
|
|
548
|
+
for (var o = 0, s = Object.keys(i); o < s.length; o++) {
|
|
549
|
+
var u = s[o];
|
|
550
|
+
Object.defineProperty(t, u, {
|
|
551
|
+
value: i[u],
|
|
552
552
|
enumerable: !1,
|
|
553
553
|
writable: !1,
|
|
554
554
|
configurable: !0
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
|
-
return
|
|
558
|
-
},
|
|
559
|
-
var
|
|
560
|
-
return
|
|
561
|
-
},
|
|
562
|
-
function
|
|
563
|
-
return parseFloat(
|
|
564
|
-
}
|
|
565
|
-
function
|
|
566
|
-
for (var
|
|
567
|
-
|
|
568
|
-
return
|
|
569
|
-
var
|
|
570
|
-
return
|
|
557
|
+
return t;
|
|
558
|
+
}, ot = function(t) {
|
|
559
|
+
var i = t && t.ownerDocument && t.ownerDocument.defaultView;
|
|
560
|
+
return i || mt;
|
|
561
|
+
}, ae = yt(0, 0, 0, 0);
|
|
562
|
+
function vt(t) {
|
|
563
|
+
return parseFloat(t) || 0;
|
|
564
|
+
}
|
|
565
|
+
function jt(t) {
|
|
566
|
+
for (var i = [], o = 1; o < arguments.length; o++)
|
|
567
|
+
i[o - 1] = arguments[o];
|
|
568
|
+
return i.reduce(function(s, u) {
|
|
569
|
+
var f = t["border-" + u + "-width"];
|
|
570
|
+
return s + vt(f);
|
|
571
571
|
}, 0);
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
for (var
|
|
575
|
-
var
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
return
|
|
579
|
-
}
|
|
580
|
-
function
|
|
581
|
-
var
|
|
582
|
-
return
|
|
583
|
-
}
|
|
584
|
-
function
|
|
585
|
-
var
|
|
586
|
-
if (!
|
|
587
|
-
return
|
|
588
|
-
var
|
|
589
|
-
if (
|
|
590
|
-
var
|
|
591
|
-
Math.abs(
|
|
592
|
-
}
|
|
593
|
-
return
|
|
594
|
-
}
|
|
595
|
-
var
|
|
596
|
-
return typeof SVGGraphicsElement < "u" ? function(
|
|
597
|
-
return
|
|
598
|
-
} : function(
|
|
599
|
-
return
|
|
573
|
+
function kr(t) {
|
|
574
|
+
for (var i = ["top", "right", "bottom", "left"], o = {}, s = 0, u = i; s < u.length; s++) {
|
|
575
|
+
var f = u[s], d = t["padding-" + f];
|
|
576
|
+
o[f] = vt(d);
|
|
577
|
+
}
|
|
578
|
+
return o;
|
|
579
|
+
}
|
|
580
|
+
function Vr(t) {
|
|
581
|
+
var i = t.getBBox();
|
|
582
|
+
return yt(0, 0, i.width, i.height);
|
|
583
|
+
}
|
|
584
|
+
function $r(t) {
|
|
585
|
+
var i = t.clientWidth, o = t.clientHeight;
|
|
586
|
+
if (!i && !o)
|
|
587
|
+
return ae;
|
|
588
|
+
var s = ot(t).getComputedStyle(t), u = kr(s), f = u.left + u.right, d = u.top + u.bottom, a = vt(s.width), b = vt(s.height);
|
|
589
|
+
if (s.boxSizing === "border-box" && (Math.round(a + f) !== i && (a -= jt(s, "left", "right") + f), Math.round(b + d) !== o && (b -= jt(s, "top", "bottom") + d)), !Ur(t)) {
|
|
590
|
+
var m = Math.round(a + f) - i, v = Math.round(b + d) - o;
|
|
591
|
+
Math.abs(m) !== 1 && (a -= m), Math.abs(v) !== 1 && (b -= v);
|
|
592
|
+
}
|
|
593
|
+
return yt(u.left, u.top, a, b);
|
|
594
|
+
}
|
|
595
|
+
var jr = /* @__PURE__ */ function() {
|
|
596
|
+
return typeof SVGGraphicsElement < "u" ? function(t) {
|
|
597
|
+
return t instanceof ot(t).SVGGraphicsElement;
|
|
598
|
+
} : function(t) {
|
|
599
|
+
return t instanceof ot(t).SVGElement && typeof t.getBBox == "function";
|
|
600
600
|
};
|
|
601
601
|
}();
|
|
602
|
-
function
|
|
603
|
-
return
|
|
604
|
-
}
|
|
605
|
-
function
|
|
606
|
-
return
|
|
607
|
-
}
|
|
608
|
-
function
|
|
609
|
-
var
|
|
610
|
-
return
|
|
611
|
-
x:
|
|
612
|
-
y:
|
|
613
|
-
width:
|
|
614
|
-
height:
|
|
615
|
-
top:
|
|
616
|
-
right:
|
|
617
|
-
bottom:
|
|
618
|
-
left:
|
|
619
|
-
}),
|
|
620
|
-
}
|
|
621
|
-
function
|
|
622
|
-
return { x:
|
|
623
|
-
}
|
|
624
|
-
var
|
|
602
|
+
function Ur(t) {
|
|
603
|
+
return t === ot(t).document.documentElement;
|
|
604
|
+
}
|
|
605
|
+
function Zr(t) {
|
|
606
|
+
return qt ? jr(t) ? Vr(t) : $r(t) : ae;
|
|
607
|
+
}
|
|
608
|
+
function Gr(t) {
|
|
609
|
+
var i = t.x, o = t.y, s = t.width, u = t.height, f = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, d = Object.create(f.prototype);
|
|
610
|
+
return ue(d, {
|
|
611
|
+
x: i,
|
|
612
|
+
y: o,
|
|
613
|
+
width: s,
|
|
614
|
+
height: u,
|
|
615
|
+
top: o,
|
|
616
|
+
right: i + s,
|
|
617
|
+
bottom: u + o,
|
|
618
|
+
left: i
|
|
619
|
+
}), d;
|
|
620
|
+
}
|
|
621
|
+
function yt(t, i, o, s) {
|
|
622
|
+
return { x: t, y: i, width: o, height: s };
|
|
623
|
+
}
|
|
624
|
+
var Wr = (
|
|
625
625
|
/** @class */
|
|
626
626
|
function() {
|
|
627
|
-
function
|
|
628
|
-
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ =
|
|
629
|
-
}
|
|
630
|
-
return
|
|
631
|
-
var
|
|
632
|
-
return this.contentRect_ =
|
|
633
|
-
},
|
|
634
|
-
var
|
|
635
|
-
return this.broadcastWidth =
|
|
636
|
-
},
|
|
627
|
+
function t(i) {
|
|
628
|
+
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = yt(0, 0, 0, 0), this.target = i;
|
|
629
|
+
}
|
|
630
|
+
return t.prototype.isActive = function() {
|
|
631
|
+
var i = Zr(this.target);
|
|
632
|
+
return this.contentRect_ = i, i.width !== this.broadcastWidth || i.height !== this.broadcastHeight;
|
|
633
|
+
}, t.prototype.broadcastRect = function() {
|
|
634
|
+
var i = this.contentRect_;
|
|
635
|
+
return this.broadcastWidth = i.width, this.broadcastHeight = i.height, i;
|
|
636
|
+
}, t;
|
|
637
637
|
}()
|
|
638
|
-
),
|
|
638
|
+
), Jr = (
|
|
639
639
|
/** @class */
|
|
640
640
|
/* @__PURE__ */ function() {
|
|
641
|
-
function
|
|
642
|
-
var
|
|
643
|
-
|
|
641
|
+
function t(i, o) {
|
|
642
|
+
var s = Gr(o);
|
|
643
|
+
ue(this, { target: i, contentRect: s });
|
|
644
644
|
}
|
|
645
|
-
return
|
|
645
|
+
return t;
|
|
646
646
|
}()
|
|
647
|
-
),
|
|
647
|
+
), Xr = (
|
|
648
648
|
/** @class */
|
|
649
649
|
function() {
|
|
650
|
-
function
|
|
651
|
-
if (this.activeObservations_ = [], this.observations_ = new
|
|
650
|
+
function t(i, o, s) {
|
|
651
|
+
if (this.activeObservations_ = [], this.observations_ = new ce(), typeof i != "function")
|
|
652
652
|
throw new TypeError("The callback provided as parameter 1 is not a function.");
|
|
653
|
-
this.callback_ =
|
|
653
|
+
this.callback_ = i, this.controller_ = o, this.callbackCtx_ = s;
|
|
654
654
|
}
|
|
655
|
-
return
|
|
655
|
+
return t.prototype.observe = function(i) {
|
|
656
656
|
if (!arguments.length)
|
|
657
657
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
658
658
|
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
659
|
-
if (!(
|
|
659
|
+
if (!(i instanceof ot(i).Element))
|
|
660
660
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
661
|
-
var
|
|
662
|
-
|
|
661
|
+
var o = this.observations_;
|
|
662
|
+
o.has(i) || (o.set(i, new Wr(i)), this.controller_.addObserver(this), this.controller_.refresh());
|
|
663
663
|
}
|
|
664
|
-
},
|
|
664
|
+
}, t.prototype.unobserve = function(i) {
|
|
665
665
|
if (!arguments.length)
|
|
666
666
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
667
667
|
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
668
|
-
if (!(
|
|
668
|
+
if (!(i instanceof ot(i).Element))
|
|
669
669
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
670
|
-
var
|
|
671
|
-
|
|
670
|
+
var o = this.observations_;
|
|
671
|
+
o.has(i) && (o.delete(i), o.size || this.controller_.removeObserver(this));
|
|
672
672
|
}
|
|
673
|
-
},
|
|
673
|
+
}, t.prototype.disconnect = function() {
|
|
674
674
|
this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
|
|
675
|
-
},
|
|
676
|
-
var
|
|
677
|
-
this.clearActive(), this.observations_.forEach(function(
|
|
678
|
-
|
|
675
|
+
}, t.prototype.gatherActive = function() {
|
|
676
|
+
var i = this;
|
|
677
|
+
this.clearActive(), this.observations_.forEach(function(o) {
|
|
678
|
+
o.isActive() && i.activeObservations_.push(o);
|
|
679
679
|
});
|
|
680
|
-
},
|
|
680
|
+
}, t.prototype.broadcastActive = function() {
|
|
681
681
|
if (this.hasActive()) {
|
|
682
|
-
var
|
|
683
|
-
return new
|
|
682
|
+
var i = this.callbackCtx_, o = this.activeObservations_.map(function(s) {
|
|
683
|
+
return new Jr(s.target, s.broadcastRect());
|
|
684
684
|
});
|
|
685
|
-
this.callback_.call(
|
|
685
|
+
this.callback_.call(i, o, i), this.clearActive();
|
|
686
686
|
}
|
|
687
|
-
},
|
|
687
|
+
}, t.prototype.clearActive = function() {
|
|
688
688
|
this.activeObservations_.splice(0);
|
|
689
|
-
},
|
|
689
|
+
}, t.prototype.hasActive = function() {
|
|
690
690
|
return this.activeObservations_.length > 0;
|
|
691
|
-
},
|
|
691
|
+
}, t;
|
|
692
692
|
}()
|
|
693
|
-
),
|
|
693
|
+
), he = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new ce(), le = (
|
|
694
694
|
/** @class */
|
|
695
695
|
/* @__PURE__ */ function() {
|
|
696
|
-
function
|
|
697
|
-
if (!(this instanceof
|
|
696
|
+
function t(i) {
|
|
697
|
+
if (!(this instanceof t))
|
|
698
698
|
throw new TypeError("Cannot call a class as a function.");
|
|
699
699
|
if (!arguments.length)
|
|
700
700
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
701
|
-
var
|
|
702
|
-
|
|
701
|
+
var o = Yr.getInstance(), s = new Xr(i, o, this);
|
|
702
|
+
he.set(this, s);
|
|
703
703
|
}
|
|
704
|
-
return
|
|
704
|
+
return t;
|
|
705
705
|
}()
|
|
706
706
|
);
|
|
707
707
|
[
|
|
708
708
|
"observe",
|
|
709
709
|
"unobserve",
|
|
710
710
|
"disconnect"
|
|
711
|
-
].forEach(function(
|
|
712
|
-
|
|
713
|
-
var
|
|
714
|
-
return (
|
|
711
|
+
].forEach(function(t) {
|
|
712
|
+
le.prototype[t] = function() {
|
|
713
|
+
var i;
|
|
714
|
+
return (i = he.get(this))[t].apply(i, arguments);
|
|
715
715
|
};
|
|
716
716
|
});
|
|
717
|
-
var
|
|
718
|
-
return typeof
|
|
717
|
+
var Kr = function() {
|
|
718
|
+
return typeof mt.ResizeObserver < "u" ? mt.ResizeObserver : le;
|
|
719
719
|
}();
|
|
720
|
-
function
|
|
721
|
-
for (const
|
|
722
|
-
const
|
|
723
|
-
|
|
720
|
+
function Qr(t) {
|
|
721
|
+
for (const i of t) {
|
|
722
|
+
const o = i.target.__resizeListeners__ || [];
|
|
723
|
+
o.length && o.forEach((s) => s());
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
typeof window > "u" || (
|
|
726
|
+
function Ai(t, i) {
|
|
727
|
+
typeof window > "u" || (t.__resizeListeners__ || (t.__resizeListeners__ = [], t.__ro__ = new Kr(Qr), t.__ro__.observe(t)), t.__resizeListeners__.push(i));
|
|
728
728
|
}
|
|
729
|
-
function
|
|
730
|
-
!
|
|
729
|
+
function Ii(t, i) {
|
|
730
|
+
!t || !t.__resizeListeners__ || (t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(i), 1), t.__resizeListeners__.length || t.__ro__.disconnect());
|
|
731
731
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
732
|
+
var gt = { exports: {} }, ti = gt.exports, Ut;
|
|
733
|
+
function bt() {
|
|
734
|
+
return Ut || (Ut = 1, function(t, i) {
|
|
735
|
+
(function() {
|
|
736
|
+
var o, s = 244837814094590, u = (s & 16777215) == 15715070;
|
|
737
|
+
function f(e, n, r) {
|
|
738
|
+
e != null && (typeof e == "number" ? this.fromNumber(e, n, r) : n == null && typeof e != "string" ? this.fromString(e, 256) : this.fromString(e, n));
|
|
739
|
+
}
|
|
740
|
+
function d() {
|
|
741
|
+
return new f(null);
|
|
742
|
+
}
|
|
743
|
+
function a(e, n, r, c, x, y) {
|
|
744
|
+
for (; --y >= 0; ) {
|
|
745
|
+
var S = n * this[e++] + r[c] + x;
|
|
746
|
+
x = Math.floor(S / 67108864), r[c++] = S & 67108863;
|
|
747
|
+
}
|
|
748
|
+
return x;
|
|
749
|
+
}
|
|
750
|
+
function b(e, n, r, c, x, y) {
|
|
751
|
+
for (var S = n & 32767, E = n >> 15; --y >= 0; ) {
|
|
752
|
+
var N = this[e] & 32767, k = this[e++] >> 15, Z = E * N + k * S;
|
|
753
|
+
N = S * N + ((Z & 32767) << 15) + r[c] + (x & 1073741823), x = (N >>> 30) + (Z >>> 15) + E * k + (x >>> 30), r[c++] = N & 1073741823;
|
|
754
|
+
}
|
|
755
|
+
return x;
|
|
756
|
+
}
|
|
757
|
+
function m(e, n, r, c, x, y) {
|
|
758
|
+
for (var S = n & 16383, E = n >> 14; --y >= 0; ) {
|
|
759
|
+
var N = this[e] & 16383, k = this[e++] >> 14, Z = E * N + k * S;
|
|
760
|
+
N = S * N + ((Z & 16383) << 14) + r[c] + x, x = (N >> 28) + (Z >> 14) + E * k, r[c++] = N & 268435455;
|
|
761
|
+
}
|
|
762
|
+
return x;
|
|
763
|
+
}
|
|
764
|
+
var v = typeof navigator < "u";
|
|
765
|
+
v && u && navigator.appName == "Microsoft Internet Explorer" ? (f.prototype.am = b, o = 30) : v && u && navigator.appName != "Netscape" ? (f.prototype.am = a, o = 26) : (f.prototype.am = m, o = 28), f.prototype.DB = o, f.prototype.DM = (1 << o) - 1, f.prototype.DV = 1 << o;
|
|
766
|
+
var B = 52;
|
|
767
|
+
f.prototype.FV = Math.pow(2, B), f.prototype.F1 = B - o, f.prototype.F2 = 2 * o - B;
|
|
768
|
+
var _ = "0123456789abcdefghijklmnopqrstuvwxyz", M = new Array(), R, q;
|
|
769
|
+
for (R = 48, q = 0; q <= 9; ++q) M[R++] = q;
|
|
770
|
+
for (R = 97, q = 10; q < 36; ++q) M[R++] = q;
|
|
771
|
+
for (R = 65, q = 10; q < 36; ++q) M[R++] = q;
|
|
772
|
+
function p(e) {
|
|
773
|
+
return _.charAt(e);
|
|
774
|
+
}
|
|
775
|
+
function w(e, n) {
|
|
776
|
+
var r = M[e.charCodeAt(n)];
|
|
777
|
+
return r ?? -1;
|
|
778
|
+
}
|
|
779
|
+
function g(e) {
|
|
780
|
+
for (var n = this.t - 1; n >= 0; --n) e[n] = this[n];
|
|
781
|
+
e.t = this.t, e.s = this.s;
|
|
782
|
+
}
|
|
783
|
+
function l(e) {
|
|
784
|
+
this.t = 1, this.s = e < 0 ? -1 : 0, e > 0 ? this[0] = e : e < -1 ? this[0] = e + this.DV : this.t = 0;
|
|
785
|
+
}
|
|
786
|
+
function T(e) {
|
|
787
|
+
var n = d();
|
|
788
|
+
return n.fromInt(e), n;
|
|
789
|
+
}
|
|
790
|
+
function h(e, n) {
|
|
791
|
+
var r;
|
|
792
|
+
if (n == 16) r = 4;
|
|
793
|
+
else if (n == 8) r = 3;
|
|
794
|
+
else if (n == 256) r = 8;
|
|
795
|
+
else if (n == 2) r = 1;
|
|
796
|
+
else if (n == 32) r = 5;
|
|
797
|
+
else if (n == 4) r = 2;
|
|
798
|
+
else {
|
|
799
|
+
this.fromRadix(e, n);
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
this.t = 0, this.s = 0;
|
|
803
|
+
for (var c = e.length, x = !1, y = 0; --c >= 0; ) {
|
|
804
|
+
var S = r == 8 ? e[c] & 255 : w(e, c);
|
|
805
|
+
if (S < 0) {
|
|
806
|
+
e.charAt(c) == "-" && (x = !0);
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
x = !1, y == 0 ? this[this.t++] = S : y + r > this.DB ? (this[this.t - 1] |= (S & (1 << this.DB - y) - 1) << y, this[this.t++] = S >> this.DB - y) : this[this.t - 1] |= S << y, y += r, y >= this.DB && (y -= this.DB);
|
|
810
|
+
}
|
|
811
|
+
r == 8 && (e[0] & 128) != 0 && (this.s = -1, y > 0 && (this[this.t - 1] |= (1 << this.DB - y) - 1 << y)), this.clamp(), x && f.ZERO.subTo(this, this);
|
|
812
|
+
}
|
|
813
|
+
function F() {
|
|
814
|
+
for (var e = this.s & this.DM; this.t > 0 && this[this.t - 1] == e; ) --this.t;
|
|
815
|
+
}
|
|
816
|
+
function A(e) {
|
|
817
|
+
if (this.s < 0) return "-" + this.negate().toString(e);
|
|
818
|
+
var n;
|
|
819
|
+
if (e == 16) n = 4;
|
|
820
|
+
else if (e == 8) n = 3;
|
|
821
|
+
else if (e == 2) n = 1;
|
|
822
|
+
else if (e == 32) n = 5;
|
|
823
|
+
else if (e == 4) n = 2;
|
|
824
|
+
else return this.toRadix(e);
|
|
825
|
+
var r = (1 << n) - 1, c, x = !1, y = "", S = this.t, E = this.DB - S * this.DB % n;
|
|
826
|
+
if (S-- > 0)
|
|
827
|
+
for (E < this.DB && (c = this[S] >> E) > 0 && (x = !0, y = p(c)); S >= 0; )
|
|
828
|
+
E < n ? (c = (this[S] & (1 << E) - 1) << n - E, c |= this[--S] >> (E += this.DB - n)) : (c = this[S] >> (E -= n) & r, E <= 0 && (E += this.DB, --S)), c > 0 && (x = !0), x && (y += p(c));
|
|
829
|
+
return x ? y : "0";
|
|
830
|
+
}
|
|
831
|
+
function O() {
|
|
832
|
+
var e = d();
|
|
833
|
+
return f.ZERO.subTo(this, e), e;
|
|
834
|
+
}
|
|
835
|
+
function C() {
|
|
836
|
+
return this.s < 0 ? this.negate() : this;
|
|
837
|
+
}
|
|
838
|
+
function H(e) {
|
|
839
|
+
var n = this.s - e.s;
|
|
840
|
+
if (n != 0) return n;
|
|
841
|
+
var r = this.t;
|
|
842
|
+
if (n = r - e.t, n != 0) return this.s < 0 ? -n : n;
|
|
843
|
+
for (; --r >= 0; ) if ((n = this[r] - e[r]) != 0) return n;
|
|
844
|
+
return 0;
|
|
845
|
+
}
|
|
846
|
+
function D(e) {
|
|
847
|
+
var n = 1, r;
|
|
848
|
+
return (r = e >>> 16) != 0 && (e = r, n += 16), (r = e >> 8) != 0 && (e = r, n += 8), (r = e >> 4) != 0 && (e = r, n += 4), (r = e >> 2) != 0 && (e = r, n += 2), (r = e >> 1) != 0 && (e = r, n += 1), n;
|
|
849
|
+
}
|
|
850
|
+
function P() {
|
|
851
|
+
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + D(this[this.t - 1] ^ this.s & this.DM);
|
|
852
|
+
}
|
|
853
|
+
function z(e, n) {
|
|
854
|
+
var r;
|
|
855
|
+
for (r = this.t - 1; r >= 0; --r) n[r + e] = this[r];
|
|
856
|
+
for (r = e - 1; r >= 0; --r) n[r] = 0;
|
|
857
|
+
n.t = this.t + e, n.s = this.s;
|
|
858
|
+
}
|
|
859
|
+
function L(e, n) {
|
|
860
|
+
for (var r = e; r < this.t; ++r) n[r - e] = this[r];
|
|
861
|
+
n.t = Math.max(this.t - e, 0), n.s = this.s;
|
|
862
|
+
}
|
|
863
|
+
function $(e, n) {
|
|
864
|
+
var r = e % this.DB, c = this.DB - r, x = (1 << c) - 1, y = Math.floor(e / this.DB), S = this.s << r & this.DM, E;
|
|
865
|
+
for (E = this.t - 1; E >= 0; --E)
|
|
866
|
+
n[E + y + 1] = this[E] >> c | S, S = (this[E] & x) << r;
|
|
867
|
+
for (E = y - 1; E >= 0; --E) n[E] = 0;
|
|
868
|
+
n[y] = S, n.t = this.t + y + 1, n.s = this.s, n.clamp();
|
|
869
|
+
}
|
|
870
|
+
function K(e, n) {
|
|
871
|
+
n.s = this.s;
|
|
872
|
+
var r = Math.floor(e / this.DB);
|
|
873
|
+
if (r >= this.t) {
|
|
874
|
+
n.t = 0;
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
var c = e % this.DB, x = this.DB - c, y = (1 << c) - 1;
|
|
878
|
+
n[0] = this[r] >> c;
|
|
879
|
+
for (var S = r + 1; S < this.t; ++S)
|
|
880
|
+
n[S - r - 1] |= (this[S] & y) << x, n[S - r] = this[S] >> c;
|
|
881
|
+
c > 0 && (n[this.t - r - 1] |= (this.s & y) << x), n.t = this.t - r, n.clamp();
|
|
882
|
+
}
|
|
883
|
+
function G(e, n) {
|
|
884
|
+
for (var r = 0, c = 0, x = Math.min(e.t, this.t); r < x; )
|
|
885
|
+
c += this[r] - e[r], n[r++] = c & this.DM, c >>= this.DB;
|
|
886
|
+
if (e.t < this.t) {
|
|
887
|
+
for (c -= e.s; r < this.t; )
|
|
888
|
+
c += this[r], n[r++] = c & this.DM, c >>= this.DB;
|
|
889
|
+
c += this.s;
|
|
890
|
+
} else {
|
|
891
|
+
for (c += this.s; r < e.t; )
|
|
892
|
+
c -= e[r], n[r++] = c & this.DM, c >>= this.DB;
|
|
893
|
+
c -= e.s;
|
|
894
|
+
}
|
|
895
|
+
n.s = c < 0 ? -1 : 0, c < -1 ? n[r++] = this.DV + c : c > 0 && (n[r++] = c), n.t = r, n.clamp();
|
|
896
|
+
}
|
|
897
|
+
function it(e, n) {
|
|
898
|
+
var r = this.abs(), c = e.abs(), x = r.t;
|
|
899
|
+
for (n.t = x + c.t; --x >= 0; ) n[x] = 0;
|
|
900
|
+
for (x = 0; x < c.t; ++x) n[x + r.t] = r.am(0, c[x], n, x, 0, r.t);
|
|
901
|
+
n.s = 0, n.clamp(), this.s != e.s && f.ZERO.subTo(n, n);
|
|
902
|
+
}
|
|
903
|
+
function ct(e) {
|
|
904
|
+
for (var n = this.abs(), r = e.t = 2 * n.t; --r >= 0; ) e[r] = 0;
|
|
905
|
+
for (r = 0; r < n.t - 1; ++r) {
|
|
906
|
+
var c = n.am(r, n[r], e, 2 * r, 0, 1);
|
|
907
|
+
(e[r + n.t] += n.am(r + 1, 2 * n[r], e, 2 * r + 1, c, n.t - r - 1)) >= n.DV && (e[r + n.t] -= n.DV, e[r + n.t + 1] = 1);
|
|
908
|
+
}
|
|
909
|
+
e.t > 0 && (e[e.t - 1] += n.am(r, n[r], e, 2 * r, 0, 1)), e.s = 0, e.clamp();
|
|
910
|
+
}
|
|
911
|
+
function ut(e, n, r) {
|
|
912
|
+
var c = e.abs();
|
|
913
|
+
if (!(c.t <= 0)) {
|
|
914
|
+
var x = this.abs();
|
|
915
|
+
if (x.t < c.t) {
|
|
916
|
+
n != null && n.fromInt(0), r != null && this.copyTo(r);
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
r == null && (r = d());
|
|
920
|
+
var y = d(), S = this.s, E = e.s, N = this.DB - D(c[c.t - 1]);
|
|
921
|
+
N > 0 ? (c.lShiftTo(N, y), x.lShiftTo(N, r)) : (c.copyTo(y), x.copyTo(r));
|
|
922
|
+
var k = y.t, Z = y[k - 1];
|
|
923
|
+
if (Z != 0) {
|
|
924
|
+
var U = Z * (1 << this.F1) + (k > 1 ? y[k - 2] >> this.F2 : 0), Q = this.FV / U, lt = (1 << this.F1) / U, J = 1 << this.F2, X = r.t, dt = X - k, tt = n ?? d();
|
|
925
|
+
for (y.dlShiftTo(dt, tt), r.compareTo(tt) >= 0 && (r[r.t++] = 1, r.subTo(tt, r)), f.ONE.dlShiftTo(k, tt), tt.subTo(y, y); y.t < k; ) y[y.t++] = 0;
|
|
926
|
+
for (; --dt >= 0; ) {
|
|
927
|
+
var St = r[--X] == Z ? this.DM : Math.floor(r[X] * Q + (r[X - 1] + J) * lt);
|
|
928
|
+
if ((r[X] += y.am(0, St, r, dt, 0, k)) < St)
|
|
929
|
+
for (y.dlShiftTo(dt, tt), r.subTo(tt, r); r[X] < --St; ) r.subTo(tt, r);
|
|
930
|
+
}
|
|
931
|
+
n != null && (r.drShiftTo(k, n), S != E && f.ZERO.subTo(n, n)), r.t = k, r.clamp(), N > 0 && r.rShiftTo(N, r), S < 0 && f.ZERO.subTo(r, r);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
function at(e) {
|
|
936
|
+
var n = d();
|
|
937
|
+
return this.abs().divRemTo(e, null, n), this.s < 0 && n.compareTo(f.ZERO) > 0 && e.subTo(n, n), n;
|
|
938
|
+
}
|
|
939
|
+
function I(e) {
|
|
940
|
+
this.m = e;
|
|
941
|
+
}
|
|
942
|
+
function me(e) {
|
|
943
|
+
return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e;
|
|
944
|
+
}
|
|
945
|
+
function ve(e) {
|
|
946
|
+
return e;
|
|
947
|
+
}
|
|
948
|
+
function ye(e) {
|
|
949
|
+
e.divRemTo(this.m, null, e);
|
|
950
|
+
}
|
|
951
|
+
function be(e, n, r) {
|
|
952
|
+
e.multiplyTo(n, r), this.reduce(r);
|
|
953
|
+
}
|
|
954
|
+
function we(e, n) {
|
|
955
|
+
e.squareTo(n), this.reduce(n);
|
|
956
|
+
}
|
|
957
|
+
I.prototype.convert = me, I.prototype.revert = ve, I.prototype.reduce = ye, I.prototype.mulTo = be, I.prototype.sqrTo = we;
|
|
958
|
+
function Te() {
|
|
959
|
+
if (this.t < 1) return 0;
|
|
960
|
+
var e = this[0];
|
|
961
|
+
if ((e & 1) == 0) return 0;
|
|
962
|
+
var n = e & 3;
|
|
963
|
+
return n = n * (2 - (e & 15) * n) & 15, n = n * (2 - (e & 255) * n) & 255, n = n * (2 - ((e & 65535) * n & 65535)) & 65535, n = n * (2 - e * n % this.DV) % this.DV, n > 0 ? this.DV - n : -n;
|
|
964
|
+
}
|
|
965
|
+
function nt(e) {
|
|
966
|
+
this.m = e, this.mp = e.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << e.DB - 15) - 1, this.mt2 = 2 * e.t;
|
|
967
|
+
}
|
|
968
|
+
function Fe(e) {
|
|
969
|
+
var n = d();
|
|
970
|
+
return e.abs().dlShiftTo(this.m.t, n), n.divRemTo(this.m, null, n), e.s < 0 && n.compareTo(f.ZERO) > 0 && this.m.subTo(n, n), n;
|
|
971
|
+
}
|
|
972
|
+
function Se(e) {
|
|
973
|
+
var n = d();
|
|
974
|
+
return e.copyTo(n), this.reduce(n), n;
|
|
975
|
+
}
|
|
976
|
+
function Ee(e) {
|
|
977
|
+
for (; e.t <= this.mt2; )
|
|
978
|
+
e[e.t++] = 0;
|
|
979
|
+
for (var n = 0; n < this.m.t; ++n) {
|
|
980
|
+
var r = e[n] & 32767, c = r * this.mpl + ((r * this.mph + (e[n] >> 15) * this.mpl & this.um) << 15) & e.DM;
|
|
981
|
+
for (r = n + this.m.t, e[r] += this.m.am(0, c, e, n, 0, this.m.t); e[r] >= e.DV; )
|
|
982
|
+
e[r] -= e.DV, e[++r]++;
|
|
983
|
+
}
|
|
984
|
+
e.clamp(), e.drShiftTo(this.m.t, e), e.compareTo(this.m) >= 0 && e.subTo(this.m, e);
|
|
985
|
+
}
|
|
986
|
+
function Be(e, n) {
|
|
987
|
+
e.squareTo(n), this.reduce(n);
|
|
988
|
+
}
|
|
989
|
+
function _e(e, n, r) {
|
|
990
|
+
e.multiplyTo(n, r), this.reduce(r);
|
|
991
|
+
}
|
|
992
|
+
nt.prototype.convert = Fe, nt.prototype.revert = Se, nt.prototype.reduce = Ee, nt.prototype.mulTo = _e, nt.prototype.sqrTo = Be;
|
|
993
|
+
function Re() {
|
|
994
|
+
return (this.t > 0 ? this[0] & 1 : this.s) == 0;
|
|
995
|
+
}
|
|
996
|
+
function De(e, n) {
|
|
997
|
+
if (e > 4294967295 || e < 1) return f.ONE;
|
|
998
|
+
var r = d(), c = d(), x = n.convert(this), y = D(e) - 1;
|
|
999
|
+
for (x.copyTo(r); --y >= 0; )
|
|
1000
|
+
if (n.sqrTo(r, c), (e & 1 << y) > 0) n.mulTo(c, x, r);
|
|
1001
|
+
else {
|
|
1002
|
+
var S = r;
|
|
1003
|
+
r = c, c = S;
|
|
1004
|
+
}
|
|
1005
|
+
return n.revert(r);
|
|
1006
|
+
}
|
|
1007
|
+
function Ae(e, n) {
|
|
1008
|
+
var r;
|
|
1009
|
+
return e < 256 || n.isEven() ? r = new I(n) : r = new nt(n), this.exp(e, r);
|
|
1010
|
+
}
|
|
1011
|
+
f.prototype.copyTo = g, f.prototype.fromInt = l, f.prototype.fromString = h, f.prototype.clamp = F, f.prototype.dlShiftTo = z, f.prototype.drShiftTo = L, f.prototype.lShiftTo = $, f.prototype.rShiftTo = K, f.prototype.subTo = G, f.prototype.multiplyTo = it, f.prototype.squareTo = ct, f.prototype.divRemTo = ut, f.prototype.invDigit = Te, f.prototype.isEven = Re, f.prototype.exp = De, f.prototype.toString = A, f.prototype.negate = O, f.prototype.abs = C, f.prototype.compareTo = H, f.prototype.bitLength = P, f.prototype.mod = at, f.prototype.modPowInt = Ae, f.ZERO = T(0), f.ONE = T(1);
|
|
1012
|
+
function Ie() {
|
|
1013
|
+
var e = d();
|
|
1014
|
+
return this.copyTo(e), e;
|
|
1015
|
+
}
|
|
1016
|
+
function Me() {
|
|
1017
|
+
if (this.s < 0) {
|
|
1018
|
+
if (this.t == 1) return this[0] - this.DV;
|
|
1019
|
+
if (this.t == 0) return -1;
|
|
1020
|
+
} else {
|
|
1021
|
+
if (this.t == 1) return this[0];
|
|
1022
|
+
if (this.t == 0) return 0;
|
|
1023
|
+
}
|
|
1024
|
+
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
|
|
1025
|
+
}
|
|
1026
|
+
function Oe() {
|
|
1027
|
+
return this.t == 0 ? this.s : this[0] << 24 >> 24;
|
|
1028
|
+
}
|
|
1029
|
+
function qe() {
|
|
1030
|
+
return this.t == 0 ? this.s : this[0] << 16 >> 16;
|
|
1031
|
+
}
|
|
1032
|
+
function Ce(e) {
|
|
1033
|
+
return Math.floor(Math.LN2 * this.DB / Math.log(e));
|
|
1034
|
+
}
|
|
1035
|
+
function Pe() {
|
|
1036
|
+
return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
|
|
1037
|
+
}
|
|
1038
|
+
function ze(e) {
|
|
1039
|
+
if (e == null && (e = 10), this.signum() == 0 || e < 2 || e > 36) return "0";
|
|
1040
|
+
var n = this.chunkSize(e), r = Math.pow(e, n), c = T(r), x = d(), y = d(), S = "";
|
|
1041
|
+
for (this.divRemTo(c, x, y); x.signum() > 0; )
|
|
1042
|
+
S = (r + y.intValue()).toString(e).substr(1) + S, x.divRemTo(c, x, y);
|
|
1043
|
+
return y.intValue().toString(e) + S;
|
|
1044
|
+
}
|
|
1045
|
+
function He(e, n) {
|
|
1046
|
+
this.fromInt(0), n == null && (n = 10);
|
|
1047
|
+
for (var r = this.chunkSize(n), c = Math.pow(n, r), x = !1, y = 0, S = 0, E = 0; E < e.length; ++E) {
|
|
1048
|
+
var N = w(e, E);
|
|
1049
|
+
if (N < 0) {
|
|
1050
|
+
e.charAt(E) == "-" && this.signum() == 0 && (x = !0);
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
S = n * S + N, ++y >= r && (this.dMultiply(c), this.dAddOffset(S, 0), y = 0, S = 0);
|
|
1054
|
+
}
|
|
1055
|
+
y > 0 && (this.dMultiply(Math.pow(n, y)), this.dAddOffset(S, 0)), x && f.ZERO.subTo(this, this);
|
|
1056
|
+
}
|
|
1057
|
+
function Le(e, n, r) {
|
|
1058
|
+
if (typeof n == "number")
|
|
1059
|
+
if (e < 2) this.fromInt(1);
|
|
1060
|
+
else
|
|
1061
|
+
for (this.fromNumber(e, r), this.testBit(e - 1) || this.bitwiseTo(f.ONE.shiftLeft(e - 1), wt, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(n); )
|
|
1062
|
+
this.dAddOffset(2, 0), this.bitLength() > e && this.subTo(f.ONE.shiftLeft(e - 1), this);
|
|
1063
|
+
else {
|
|
1064
|
+
var c = new Array(), x = e & 7;
|
|
1065
|
+
c.length = (e >> 3) + 1, n.nextBytes(c), x > 0 ? c[0] &= (1 << x) - 1 : c[0] = 0, this.fromString(c, 256);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
function Ne() {
|
|
1069
|
+
var e = this.t, n = new Array();
|
|
1070
|
+
n[0] = this.s;
|
|
1071
|
+
var r = this.DB - e * this.DB % 8, c, x = 0;
|
|
1072
|
+
if (e-- > 0)
|
|
1073
|
+
for (r < this.DB && (c = this[e] >> r) != (this.s & this.DM) >> r && (n[x++] = c | this.s << this.DB - r); e >= 0; )
|
|
1074
|
+
r < 8 ? (c = (this[e] & (1 << r) - 1) << 8 - r, c |= this[--e] >> (r += this.DB - 8)) : (c = this[e] >> (r -= 8) & 255, r <= 0 && (r += this.DB, --e)), (c & 128) != 0 && (c |= -256), x == 0 && (this.s & 128) != (c & 128) && ++x, (x > 0 || c != this.s) && (n[x++] = c);
|
|
1075
|
+
return n;
|
|
1076
|
+
}
|
|
1077
|
+
function Ye(e) {
|
|
1078
|
+
return this.compareTo(e) == 0;
|
|
1079
|
+
}
|
|
1080
|
+
function ke(e) {
|
|
1081
|
+
return this.compareTo(e) < 0 ? this : e;
|
|
1082
|
+
}
|
|
1083
|
+
function Ve(e) {
|
|
1084
|
+
return this.compareTo(e) > 0 ? this : e;
|
|
1085
|
+
}
|
|
1086
|
+
function $e(e, n, r) {
|
|
1087
|
+
var c, x, y = Math.min(e.t, this.t);
|
|
1088
|
+
for (c = 0; c < y; ++c) r[c] = n(this[c], e[c]);
|
|
1089
|
+
if (e.t < this.t) {
|
|
1090
|
+
for (x = e.s & this.DM, c = y; c < this.t; ++c) r[c] = n(this[c], x);
|
|
1091
|
+
r.t = this.t;
|
|
1092
|
+
} else {
|
|
1093
|
+
for (x = this.s & this.DM, c = y; c < e.t; ++c) r[c] = n(x, e[c]);
|
|
1094
|
+
r.t = e.t;
|
|
1095
|
+
}
|
|
1096
|
+
r.s = n(this.s, e.s), r.clamp();
|
|
1097
|
+
}
|
|
1098
|
+
function je(e, n) {
|
|
1099
|
+
return e & n;
|
|
1100
|
+
}
|
|
1101
|
+
function Ue(e) {
|
|
1102
|
+
var n = d();
|
|
1103
|
+
return this.bitwiseTo(e, je, n), n;
|
|
1104
|
+
}
|
|
1105
|
+
function wt(e, n) {
|
|
1106
|
+
return e | n;
|
|
1107
|
+
}
|
|
1108
|
+
function Ze(e) {
|
|
1109
|
+
var n = d();
|
|
1110
|
+
return this.bitwiseTo(e, wt, n), n;
|
|
1111
|
+
}
|
|
1112
|
+
function zt(e, n) {
|
|
1113
|
+
return e ^ n;
|
|
1114
|
+
}
|
|
1115
|
+
function Ge(e) {
|
|
1116
|
+
var n = d();
|
|
1117
|
+
return this.bitwiseTo(e, zt, n), n;
|
|
1118
|
+
}
|
|
1119
|
+
function Ht(e, n) {
|
|
1120
|
+
return e & ~n;
|
|
1121
|
+
}
|
|
1122
|
+
function We(e) {
|
|
1123
|
+
var n = d();
|
|
1124
|
+
return this.bitwiseTo(e, Ht, n), n;
|
|
1125
|
+
}
|
|
1126
|
+
function Je() {
|
|
1127
|
+
for (var e = d(), n = 0; n < this.t; ++n) e[n] = this.DM & ~this[n];
|
|
1128
|
+
return e.t = this.t, e.s = ~this.s, e;
|
|
1129
|
+
}
|
|
1130
|
+
function Xe(e) {
|
|
1131
|
+
var n = d();
|
|
1132
|
+
return e < 0 ? this.rShiftTo(-e, n) : this.lShiftTo(e, n), n;
|
|
1133
|
+
}
|
|
1134
|
+
function Ke(e) {
|
|
1135
|
+
var n = d();
|
|
1136
|
+
return e < 0 ? this.lShiftTo(-e, n) : this.rShiftTo(e, n), n;
|
|
1137
|
+
}
|
|
1138
|
+
function Qe(e) {
|
|
1139
|
+
if (e == 0) return -1;
|
|
1140
|
+
var n = 0;
|
|
1141
|
+
return (e & 65535) == 0 && (e >>= 16, n += 16), (e & 255) == 0 && (e >>= 8, n += 8), (e & 15) == 0 && (e >>= 4, n += 4), (e & 3) == 0 && (e >>= 2, n += 2), (e & 1) == 0 && ++n, n;
|
|
1142
|
+
}
|
|
1143
|
+
function tn() {
|
|
1144
|
+
for (var e = 0; e < this.t; ++e)
|
|
1145
|
+
if (this[e] != 0) return e * this.DB + Qe(this[e]);
|
|
1146
|
+
return this.s < 0 ? this.t * this.DB : -1;
|
|
1147
|
+
}
|
|
1148
|
+
function en(e) {
|
|
1149
|
+
for (var n = 0; e != 0; )
|
|
1150
|
+
e &= e - 1, ++n;
|
|
1151
|
+
return n;
|
|
1152
|
+
}
|
|
1153
|
+
function nn() {
|
|
1154
|
+
for (var e = 0, n = this.s & this.DM, r = 0; r < this.t; ++r) e += en(this[r] ^ n);
|
|
1155
|
+
return e;
|
|
1156
|
+
}
|
|
1157
|
+
function rn(e) {
|
|
1158
|
+
var n = Math.floor(e / this.DB);
|
|
1159
|
+
return n >= this.t ? this.s != 0 : (this[n] & 1 << e % this.DB) != 0;
|
|
1160
|
+
}
|
|
1161
|
+
function on(e, n) {
|
|
1162
|
+
var r = f.ONE.shiftLeft(e);
|
|
1163
|
+
return this.bitwiseTo(r, n, r), r;
|
|
1164
|
+
}
|
|
1165
|
+
function sn(e) {
|
|
1166
|
+
return this.changeBit(e, wt);
|
|
1167
|
+
}
|
|
1168
|
+
function fn(e) {
|
|
1169
|
+
return this.changeBit(e, Ht);
|
|
1170
|
+
}
|
|
1171
|
+
function cn(e) {
|
|
1172
|
+
return this.changeBit(e, zt);
|
|
1173
|
+
}
|
|
1174
|
+
function un(e, n) {
|
|
1175
|
+
for (var r = 0, c = 0, x = Math.min(e.t, this.t); r < x; )
|
|
1176
|
+
c += this[r] + e[r], n[r++] = c & this.DM, c >>= this.DB;
|
|
1177
|
+
if (e.t < this.t) {
|
|
1178
|
+
for (c += e.s; r < this.t; )
|
|
1179
|
+
c += this[r], n[r++] = c & this.DM, c >>= this.DB;
|
|
1180
|
+
c += this.s;
|
|
1181
|
+
} else {
|
|
1182
|
+
for (c += this.s; r < e.t; )
|
|
1183
|
+
c += e[r], n[r++] = c & this.DM, c >>= this.DB;
|
|
1184
|
+
c += e.s;
|
|
1185
|
+
}
|
|
1186
|
+
n.s = c < 0 ? -1 : 0, c > 0 ? n[r++] = c : c < -1 && (n[r++] = this.DV + c), n.t = r, n.clamp();
|
|
1187
|
+
}
|
|
1188
|
+
function an(e) {
|
|
1189
|
+
var n = d();
|
|
1190
|
+
return this.addTo(e, n), n;
|
|
1191
|
+
}
|
|
1192
|
+
function hn(e) {
|
|
1193
|
+
var n = d();
|
|
1194
|
+
return this.subTo(e, n), n;
|
|
1195
|
+
}
|
|
1196
|
+
function ln(e) {
|
|
1197
|
+
var n = d();
|
|
1198
|
+
return this.multiplyTo(e, n), n;
|
|
1199
|
+
}
|
|
1200
|
+
function dn() {
|
|
1201
|
+
var e = d();
|
|
1202
|
+
return this.squareTo(e), e;
|
|
1203
|
+
}
|
|
1204
|
+
function pn(e) {
|
|
1205
|
+
var n = d();
|
|
1206
|
+
return this.divRemTo(e, n, null), n;
|
|
1207
|
+
}
|
|
1208
|
+
function gn(e) {
|
|
1209
|
+
var n = d();
|
|
1210
|
+
return this.divRemTo(e, null, n), n;
|
|
1211
|
+
}
|
|
1212
|
+
function xn(e) {
|
|
1213
|
+
var n = d(), r = d();
|
|
1214
|
+
return this.divRemTo(e, n, r), new Array(n, r);
|
|
1215
|
+
}
|
|
1216
|
+
function mn(e) {
|
|
1217
|
+
this[this.t] = this.am(0, e - 1, this, 0, 0, this.t), ++this.t, this.clamp();
|
|
1218
|
+
}
|
|
1219
|
+
function vn(e, n) {
|
|
1220
|
+
if (e != 0) {
|
|
1221
|
+
for (; this.t <= n; ) this[this.t++] = 0;
|
|
1222
|
+
for (this[n] += e; this[n] >= this.DV; )
|
|
1223
|
+
this[n] -= this.DV, ++n >= this.t && (this[this.t++] = 0), ++this[n];
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
function st() {
|
|
1227
|
+
}
|
|
1228
|
+
function Lt(e) {
|
|
1229
|
+
return e;
|
|
1230
|
+
}
|
|
1231
|
+
function yn(e, n, r) {
|
|
1232
|
+
e.multiplyTo(n, r);
|
|
1233
|
+
}
|
|
1234
|
+
function bn(e, n) {
|
|
1235
|
+
e.squareTo(n);
|
|
1236
|
+
}
|
|
1237
|
+
st.prototype.convert = Lt, st.prototype.revert = Lt, st.prototype.mulTo = yn, st.prototype.sqrTo = bn;
|
|
1238
|
+
function wn(e) {
|
|
1239
|
+
return this.exp(e, new st());
|
|
1240
|
+
}
|
|
1241
|
+
function Tn(e, n, r) {
|
|
1242
|
+
var c = Math.min(this.t + e.t, n);
|
|
1243
|
+
for (r.s = 0, r.t = c; c > 0; ) r[--c] = 0;
|
|
1244
|
+
var x;
|
|
1245
|
+
for (x = r.t - this.t; c < x; ++c) r[c + this.t] = this.am(0, e[c], r, c, 0, this.t);
|
|
1246
|
+
for (x = Math.min(e.t, n); c < x; ++c) this.am(0, e[c], r, c, 0, n - c);
|
|
1247
|
+
r.clamp();
|
|
1248
|
+
}
|
|
1249
|
+
function Fn(e, n, r) {
|
|
1250
|
+
--n;
|
|
1251
|
+
var c = r.t = this.t + e.t - n;
|
|
1252
|
+
for (r.s = 0; --c >= 0; ) r[c] = 0;
|
|
1253
|
+
for (c = Math.max(n - this.t, 0); c < e.t; ++c)
|
|
1254
|
+
r[this.t + c - n] = this.am(n - c, e[c], r, 0, 0, this.t + c - n);
|
|
1255
|
+
r.clamp(), r.drShiftTo(1, r);
|
|
1256
|
+
}
|
|
1257
|
+
function rt(e) {
|
|
1258
|
+
this.r2 = d(), this.q3 = d(), f.ONE.dlShiftTo(2 * e.t, this.r2), this.mu = this.r2.divide(e), this.m = e;
|
|
1259
|
+
}
|
|
1260
|
+
function Sn(e) {
|
|
1261
|
+
if (e.s < 0 || e.t > 2 * this.m.t) return e.mod(this.m);
|
|
1262
|
+
if (e.compareTo(this.m) < 0) return e;
|
|
1263
|
+
var n = d();
|
|
1264
|
+
return e.copyTo(n), this.reduce(n), n;
|
|
1265
|
+
}
|
|
1266
|
+
function En(e) {
|
|
1267
|
+
return e;
|
|
1268
|
+
}
|
|
1269
|
+
function Bn(e) {
|
|
1270
|
+
for (e.drShiftTo(this.m.t - 1, this.r2), e.t > this.m.t + 1 && (e.t = this.m.t + 1, e.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); e.compareTo(this.r2) < 0; ) e.dAddOffset(1, this.m.t + 1);
|
|
1271
|
+
for (e.subTo(this.r2, e); e.compareTo(this.m) >= 0; ) e.subTo(this.m, e);
|
|
1272
|
+
}
|
|
1273
|
+
function _n(e, n) {
|
|
1274
|
+
e.squareTo(n), this.reduce(n);
|
|
1275
|
+
}
|
|
1276
|
+
function Rn(e, n, r) {
|
|
1277
|
+
e.multiplyTo(n, r), this.reduce(r);
|
|
1278
|
+
}
|
|
1279
|
+
rt.prototype.convert = Sn, rt.prototype.revert = En, rt.prototype.reduce = Bn, rt.prototype.mulTo = Rn, rt.prototype.sqrTo = _n;
|
|
1280
|
+
function Dn(e, n) {
|
|
1281
|
+
var r = e.bitLength(), c, x = T(1), y;
|
|
1282
|
+
if (r <= 0) return x;
|
|
1283
|
+
r < 18 ? c = 1 : r < 48 ? c = 3 : r < 144 ? c = 4 : r < 768 ? c = 5 : c = 6, r < 8 ? y = new I(n) : n.isEven() ? y = new rt(n) : y = new nt(n);
|
|
1284
|
+
var S = new Array(), E = 3, N = c - 1, k = (1 << c) - 1;
|
|
1285
|
+
if (S[1] = y.convert(this), c > 1) {
|
|
1286
|
+
var Z = d();
|
|
1287
|
+
for (y.sqrTo(S[1], Z); E <= k; )
|
|
1288
|
+
S[E] = d(), y.mulTo(Z, S[E - 2], S[E]), E += 2;
|
|
1289
|
+
}
|
|
1290
|
+
var U = e.t - 1, Q, lt = !0, J = d(), X;
|
|
1291
|
+
for (r = D(e[U]) - 1; U >= 0; ) {
|
|
1292
|
+
for (r >= N ? Q = e[U] >> r - N & k : (Q = (e[U] & (1 << r + 1) - 1) << N - r, U > 0 && (Q |= e[U - 1] >> this.DB + r - N)), E = c; (Q & 1) == 0; )
|
|
1293
|
+
Q >>= 1, --E;
|
|
1294
|
+
if ((r -= E) < 0 && (r += this.DB, --U), lt)
|
|
1295
|
+
S[Q].copyTo(x), lt = !1;
|
|
1296
|
+
else {
|
|
1297
|
+
for (; E > 1; )
|
|
1298
|
+
y.sqrTo(x, J), y.sqrTo(J, x), E -= 2;
|
|
1299
|
+
E > 0 ? y.sqrTo(x, J) : (X = x, x = J, J = X), y.mulTo(J, S[Q], x);
|
|
1300
|
+
}
|
|
1301
|
+
for (; U >= 0 && (e[U] & 1 << r) == 0; )
|
|
1302
|
+
y.sqrTo(x, J), X = x, x = J, J = X, --r < 0 && (r = this.DB - 1, --U);
|
|
1303
|
+
}
|
|
1304
|
+
return y.revert(x);
|
|
1305
|
+
}
|
|
1306
|
+
function An(e) {
|
|
1307
|
+
var n = this.s < 0 ? this.negate() : this.clone(), r = e.s < 0 ? e.negate() : e.clone();
|
|
1308
|
+
if (n.compareTo(r) < 0) {
|
|
1309
|
+
var c = n;
|
|
1310
|
+
n = r, r = c;
|
|
1311
|
+
}
|
|
1312
|
+
var x = n.getLowestSetBit(), y = r.getLowestSetBit();
|
|
1313
|
+
if (y < 0) return n;
|
|
1314
|
+
for (x < y && (y = x), y > 0 && (n.rShiftTo(y, n), r.rShiftTo(y, r)); n.signum() > 0; )
|
|
1315
|
+
(x = n.getLowestSetBit()) > 0 && n.rShiftTo(x, n), (x = r.getLowestSetBit()) > 0 && r.rShiftTo(x, r), n.compareTo(r) >= 0 ? (n.subTo(r, n), n.rShiftTo(1, n)) : (r.subTo(n, r), r.rShiftTo(1, r));
|
|
1316
|
+
return y > 0 && r.lShiftTo(y, r), r;
|
|
1317
|
+
}
|
|
1318
|
+
function In(e) {
|
|
1319
|
+
if (e <= 0) return 0;
|
|
1320
|
+
var n = this.DV % e, r = this.s < 0 ? e - 1 : 0;
|
|
1321
|
+
if (this.t > 0)
|
|
1322
|
+
if (n == 0) r = this[0] % e;
|
|
1323
|
+
else for (var c = this.t - 1; c >= 0; --c) r = (n * r + this[c]) % e;
|
|
1324
|
+
return r;
|
|
1325
|
+
}
|
|
1326
|
+
function Mn(e) {
|
|
1327
|
+
var n = e.isEven();
|
|
1328
|
+
if (this.isEven() && n || e.signum() == 0) return f.ZERO;
|
|
1329
|
+
for (var r = e.clone(), c = this.clone(), x = T(1), y = T(0), S = T(0), E = T(1); r.signum() != 0; ) {
|
|
1330
|
+
for (; r.isEven(); )
|
|
1331
|
+
r.rShiftTo(1, r), n ? ((!x.isEven() || !y.isEven()) && (x.addTo(this, x), y.subTo(e, y)), x.rShiftTo(1, x)) : y.isEven() || y.subTo(e, y), y.rShiftTo(1, y);
|
|
1332
|
+
for (; c.isEven(); )
|
|
1333
|
+
c.rShiftTo(1, c), n ? ((!S.isEven() || !E.isEven()) && (S.addTo(this, S), E.subTo(e, E)), S.rShiftTo(1, S)) : E.isEven() || E.subTo(e, E), E.rShiftTo(1, E);
|
|
1334
|
+
r.compareTo(c) >= 0 ? (r.subTo(c, r), n && x.subTo(S, x), y.subTo(E, y)) : (c.subTo(r, c), n && S.subTo(x, S), E.subTo(y, E));
|
|
1335
|
+
}
|
|
1336
|
+
if (c.compareTo(f.ONE) != 0) return f.ZERO;
|
|
1337
|
+
if (E.compareTo(e) >= 0) return E.subtract(e);
|
|
1338
|
+
if (E.signum() < 0) E.addTo(e, E);
|
|
1339
|
+
else return E;
|
|
1340
|
+
return E.signum() < 0 ? E.add(e) : E;
|
|
1341
|
+
}
|
|
1342
|
+
var V = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], On = (1 << 26) / V[V.length - 1];
|
|
1343
|
+
function qn(e) {
|
|
1344
|
+
var n, r = this.abs();
|
|
1345
|
+
if (r.t == 1 && r[0] <= V[V.length - 1]) {
|
|
1346
|
+
for (n = 0; n < V.length; ++n)
|
|
1347
|
+
if (r[0] == V[n]) return !0;
|
|
1348
|
+
return !1;
|
|
1349
|
+
}
|
|
1350
|
+
if (r.isEven()) return !1;
|
|
1351
|
+
for (n = 1; n < V.length; ) {
|
|
1352
|
+
for (var c = V[n], x = n + 1; x < V.length && c < On; ) c *= V[x++];
|
|
1353
|
+
for (c = r.modInt(c); n < x; ) if (c % V[n++] == 0) return !1;
|
|
1354
|
+
}
|
|
1355
|
+
return r.millerRabin(e);
|
|
1356
|
+
}
|
|
1357
|
+
function Cn(e) {
|
|
1358
|
+
var n = this.subtract(f.ONE), r = n.getLowestSetBit();
|
|
1359
|
+
if (r <= 0) return !1;
|
|
1360
|
+
var c = n.shiftRight(r);
|
|
1361
|
+
e = e + 1 >> 1, e > V.length && (e = V.length);
|
|
1362
|
+
for (var x = d(), y = 0; y < e; ++y) {
|
|
1363
|
+
x.fromInt(V[Math.floor(Math.random() * V.length)]);
|
|
1364
|
+
var S = x.modPow(c, this);
|
|
1365
|
+
if (S.compareTo(f.ONE) != 0 && S.compareTo(n) != 0) {
|
|
1366
|
+
for (var E = 1; E++ < r && S.compareTo(n) != 0; )
|
|
1367
|
+
if (S = S.modPowInt(2, this), S.compareTo(f.ONE) == 0) return !1;
|
|
1368
|
+
if (S.compareTo(n) != 0) return !1;
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
return !0;
|
|
1372
|
+
}
|
|
1373
|
+
f.prototype.chunkSize = Ce, f.prototype.toRadix = ze, f.prototype.fromRadix = He, f.prototype.fromNumber = Le, f.prototype.bitwiseTo = $e, f.prototype.changeBit = on, f.prototype.addTo = un, f.prototype.dMultiply = mn, f.prototype.dAddOffset = vn, f.prototype.multiplyLowerTo = Tn, f.prototype.multiplyUpperTo = Fn, f.prototype.modInt = In, f.prototype.millerRabin = Cn, f.prototype.clone = Ie, f.prototype.intValue = Me, f.prototype.byteValue = Oe, f.prototype.shortValue = qe, f.prototype.signum = Pe, f.prototype.toByteArray = Ne, f.prototype.equals = Ye, f.prototype.min = ke, f.prototype.max = Ve, f.prototype.and = Ue, f.prototype.or = Ze, f.prototype.xor = Ge, f.prototype.andNot = We, f.prototype.not = Je, f.prototype.shiftLeft = Xe, f.prototype.shiftRight = Ke, f.prototype.getLowestSetBit = tn, f.prototype.bitCount = nn, f.prototype.testBit = rn, f.prototype.setBit = sn, f.prototype.clearBit = fn, f.prototype.flipBit = cn, f.prototype.add = an, f.prototype.subtract = hn, f.prototype.multiply = ln, f.prototype.divide = pn, f.prototype.remainder = gn, f.prototype.divideAndRemainder = xn, f.prototype.modPow = Dn, f.prototype.modInverse = Mn, f.prototype.pow = wn, f.prototype.gcd = An, f.prototype.isProbablePrime = qn, f.prototype.square = dn, f.prototype.Barrett = rt;
|
|
1374
|
+
var ht, j, Y;
|
|
1375
|
+
function Pn(e) {
|
|
1376
|
+
j[Y++] ^= e & 255, j[Y++] ^= e >> 8 & 255, j[Y++] ^= e >> 16 & 255, j[Y++] ^= e >> 24 & 255, Y >= Ft && (Y -= Ft);
|
|
1377
|
+
}
|
|
1378
|
+
function Nt() {
|
|
1379
|
+
Pn((/* @__PURE__ */ new Date()).getTime());
|
|
1380
|
+
}
|
|
1381
|
+
if (j == null) {
|
|
1382
|
+
j = new Array(), Y = 0;
|
|
1383
|
+
var W;
|
|
1384
|
+
if (typeof window < "u" && window.crypto) {
|
|
1385
|
+
if (window.crypto.getRandomValues) {
|
|
1386
|
+
var Yt = new Uint8Array(32);
|
|
1387
|
+
for (window.crypto.getRandomValues(Yt), W = 0; W < 32; ++W)
|
|
1388
|
+
j[Y++] = Yt[W];
|
|
1389
|
+
} else if (navigator.appName == "Netscape" && navigator.appVersion < "5") {
|
|
1390
|
+
var kt = window.crypto.random(32);
|
|
1391
|
+
for (W = 0; W < kt.length; ++W)
|
|
1392
|
+
j[Y++] = kt.charCodeAt(W) & 255;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
for (; Y < Ft; )
|
|
1396
|
+
W = Math.floor(65536 * Math.random()), j[Y++] = W >>> 8, j[Y++] = W & 255;
|
|
1397
|
+
Y = 0, Nt();
|
|
1398
|
+
}
|
|
1399
|
+
function zn() {
|
|
1400
|
+
if (ht == null) {
|
|
1401
|
+
for (Nt(), ht = Yn(), ht.init(j), Y = 0; Y < j.length; ++Y)
|
|
1402
|
+
j[Y] = 0;
|
|
1403
|
+
Y = 0;
|
|
1404
|
+
}
|
|
1405
|
+
return ht.next();
|
|
1406
|
+
}
|
|
1407
|
+
function Hn(e) {
|
|
1408
|
+
var n;
|
|
1409
|
+
for (n = 0; n < e.length; ++n) e[n] = zn();
|
|
1410
|
+
}
|
|
1411
|
+
function Vt() {
|
|
1412
|
+
}
|
|
1413
|
+
Vt.prototype.nextBytes = Hn;
|
|
1414
|
+
function Tt() {
|
|
1415
|
+
this.i = 0, this.j = 0, this.S = new Array();
|
|
1416
|
+
}
|
|
1417
|
+
function Ln(e) {
|
|
1418
|
+
var n, r, c;
|
|
1419
|
+
for (n = 0; n < 256; ++n)
|
|
1420
|
+
this.S[n] = n;
|
|
1421
|
+
for (r = 0, n = 0; n < 256; ++n)
|
|
1422
|
+
r = r + this.S[n] + e[n % e.length] & 255, c = this.S[n], this.S[n] = this.S[r], this.S[r] = c;
|
|
1423
|
+
this.i = 0, this.j = 0;
|
|
1424
|
+
}
|
|
1425
|
+
function Nn() {
|
|
1426
|
+
var e;
|
|
1427
|
+
return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, e = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = e, this.S[e + this.S[this.i] & 255];
|
|
1428
|
+
}
|
|
1429
|
+
Tt.prototype.init = Ln, Tt.prototype.next = Nn;
|
|
1430
|
+
function Yn() {
|
|
1431
|
+
return new Tt();
|
|
1432
|
+
}
|
|
1433
|
+
var Ft = 256;
|
|
1434
|
+
t.exports = {
|
|
1435
|
+
default: f,
|
|
1436
|
+
BigInteger: f,
|
|
1437
|
+
SecureRandom: Vt
|
|
1438
|
+
};
|
|
1439
|
+
}).call(ti);
|
|
1440
|
+
}(gt)), gt.exports;
|
|
1441
|
+
}
|
|
1442
|
+
var Et, Zt;
|
|
1443
|
+
function ei() {
|
|
1444
|
+
if (Zt) return Et;
|
|
1445
|
+
Zt = 1;
|
|
1446
|
+
const { BigInteger: t } = bt();
|
|
1447
|
+
function i(b) {
|
|
1448
|
+
let m = b.toString(16);
|
|
1449
|
+
if (m[0] !== "-")
|
|
1450
|
+
m.length % 2 === 1 ? m = "0" + m : m.match(/^[0-7]/) || (m = "00" + m);
|
|
1451
|
+
else {
|
|
1452
|
+
m = m.substr(1);
|
|
1453
|
+
let v = m.length;
|
|
1454
|
+
v % 2 === 1 ? v += 1 : m.match(/^[0-7]/) || (v += 2);
|
|
1455
|
+
let B = "";
|
|
1456
|
+
for (let _ = 0; _ < v; _++) B += "f";
|
|
1457
|
+
B = new t(B, 16), m = B.xor(b).add(t.ONE), m = m.toString(16).replace(/^-/, "");
|
|
1458
|
+
}
|
|
1459
|
+
return m;
|
|
1460
|
+
}
|
|
1461
|
+
class o {
|
|
1462
|
+
constructor() {
|
|
1463
|
+
this.tlv = null, this.t = "00", this.l = "00", this.v = "";
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* 获取 der 编码比特流16进制串
|
|
1467
|
+
*/
|
|
1468
|
+
getEncodedHex() {
|
|
1469
|
+
return this.tlv || (this.v = this.getValue(), this.l = this.getLength(), this.tlv = this.t + this.l + this.v), this.tlv;
|
|
1470
|
+
}
|
|
1471
|
+
getLength() {
|
|
1472
|
+
const m = this.v.length / 2;
|
|
1473
|
+
let v = m.toString(16);
|
|
1474
|
+
return v.length % 2 === 1 && (v = "0" + v), m < 128 ? v : (128 + v.length / 2).toString(16) + v;
|
|
1475
|
+
}
|
|
1476
|
+
getValue() {
|
|
1477
|
+
return "";
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
class s extends o {
|
|
1481
|
+
constructor(m) {
|
|
1482
|
+
super(), this.t = "02", m && (this.v = i(m));
|
|
1483
|
+
}
|
|
1484
|
+
getValue() {
|
|
1485
|
+
return this.v;
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
class u extends o {
|
|
1489
|
+
constructor(m) {
|
|
1490
|
+
super(), this.t = "30", this.asn1Array = m;
|
|
1491
|
+
}
|
|
1492
|
+
getValue() {
|
|
1493
|
+
return this.v = this.asn1Array.map((m) => m.getEncodedHex()).join(""), this.v;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
function f(b, m) {
|
|
1497
|
+
return +b[m + 2] < 8 ? 1 : +b.substr(m + 2, 2) & 128;
|
|
1498
|
+
}
|
|
1499
|
+
function d(b, m) {
|
|
1500
|
+
const v = f(b, m), B = b.substr(m + 2, v * 2);
|
|
1501
|
+
return B ? (+B[0] < 8 ? new t(B, 16) : new t(B.substr(2), 16)).intValue() : -1;
|
|
1502
|
+
}
|
|
1503
|
+
function a(b, m) {
|
|
1504
|
+
const v = f(b, m);
|
|
1505
|
+
return m + (v + 1) * 2;
|
|
1506
|
+
}
|
|
1507
|
+
return Et = {
|
|
1508
|
+
/**
|
|
1509
|
+
* ASN.1 der 编码,针对 sm2 签名
|
|
1510
|
+
*/
|
|
1511
|
+
encodeDer(b, m) {
|
|
1512
|
+
const v = new s(b), B = new s(m);
|
|
1513
|
+
return new u([v, B]).getEncodedHex();
|
|
1514
|
+
},
|
|
1515
|
+
/**
|
|
1516
|
+
* 解析 ASN.1 der,针对 sm2 验签
|
|
1517
|
+
*/
|
|
1518
|
+
decodeDer(b) {
|
|
1519
|
+
const m = a(b, 0), v = a(b, m), B = d(b, m), _ = b.substr(v, B * 2), M = v + _.length, R = a(b, M), q = d(b, M), p = b.substr(R, q * 2), w = new t(_, 16), g = new t(p, 16);
|
|
1520
|
+
return { r: w, s: g };
|
|
1521
|
+
}
|
|
1522
|
+
}, Et;
|
|
1523
|
+
}
|
|
1524
|
+
var Bt, Gt;
|
|
1525
|
+
function ni() {
|
|
1526
|
+
if (Gt) return Bt;
|
|
1527
|
+
Gt = 1;
|
|
1528
|
+
const { BigInteger: t } = bt(), i = new t("2"), o = new t("3");
|
|
1529
|
+
class s {
|
|
1530
|
+
constructor(a, b) {
|
|
1531
|
+
this.x = b, this.q = a;
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* 判断相等
|
|
1535
|
+
*/
|
|
1536
|
+
equals(a) {
|
|
1537
|
+
return a === this ? !0 : this.q.equals(a.q) && this.x.equals(a.x);
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* 返回具体数值
|
|
1541
|
+
*/
|
|
1542
|
+
toBigInteger() {
|
|
1543
|
+
return this.x;
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* 取反
|
|
1547
|
+
*/
|
|
1548
|
+
negate() {
|
|
1549
|
+
return new s(this.q, this.x.negate().mod(this.q));
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1552
|
+
* 相加
|
|
1553
|
+
*/
|
|
1554
|
+
add(a) {
|
|
1555
|
+
return new s(this.q, this.x.add(a.toBigInteger()).mod(this.q));
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* 相减
|
|
1559
|
+
*/
|
|
1560
|
+
subtract(a) {
|
|
1561
|
+
return new s(this.q, this.x.subtract(a.toBigInteger()).mod(this.q));
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* 相乘
|
|
1565
|
+
*/
|
|
1566
|
+
multiply(a) {
|
|
1567
|
+
return new s(this.q, this.x.multiply(a.toBigInteger()).mod(this.q));
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* 相除
|
|
1571
|
+
*/
|
|
1572
|
+
divide(a) {
|
|
1573
|
+
return new s(this.q, this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q));
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* 平方
|
|
1577
|
+
*/
|
|
1578
|
+
square() {
|
|
1579
|
+
return new s(this.q, this.x.square().mod(this.q));
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
class u {
|
|
1583
|
+
constructor(a, b, m, v) {
|
|
1584
|
+
this.curve = a, this.x = b, this.y = m, this.z = v ?? t.ONE, this.zinv = null;
|
|
1585
|
+
}
|
|
1586
|
+
getX() {
|
|
1587
|
+
return this.zinv === null && (this.zinv = this.z.modInverse(this.curve.q)), this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q));
|
|
1588
|
+
}
|
|
1589
|
+
getY() {
|
|
1590
|
+
return this.zinv === null && (this.zinv = this.z.modInverse(this.curve.q)), this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q));
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* 判断相等
|
|
1594
|
+
*/
|
|
1595
|
+
equals(a) {
|
|
1596
|
+
return a === this ? !0 : this.isInfinity() ? a.isInfinity() : a.isInfinity() ? this.isInfinity() : a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q).equals(t.ZERO) ? a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q).equals(t.ZERO) : !1;
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* 是否是无穷远点
|
|
1600
|
+
*/
|
|
1601
|
+
isInfinity() {
|
|
1602
|
+
return this.x === null && this.y === null ? !0 : this.z.equals(t.ZERO) && !this.y.toBigInteger().equals(t.ZERO);
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* 取反,x 轴对称点
|
|
1606
|
+
*/
|
|
1607
|
+
negate() {
|
|
1608
|
+
return new u(this.curve, this.x, this.y.negate(), this.z);
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* 相加
|
|
1612
|
+
*
|
|
1613
|
+
* 标准射影坐标系:
|
|
1614
|
+
*
|
|
1615
|
+
* λ1 = x1 * z2
|
|
1616
|
+
* λ2 = x2 * z1
|
|
1617
|
+
* λ3 = λ1 − λ2
|
|
1618
|
+
* λ4 = y1 * z2
|
|
1619
|
+
* λ5 = y2 * z1
|
|
1620
|
+
* λ6 = λ4 − λ5
|
|
1621
|
+
* λ7 = λ1 + λ2
|
|
1622
|
+
* λ8 = z1 * z2
|
|
1623
|
+
* λ9 = λ3^2
|
|
1624
|
+
* λ10 = λ3 * λ9
|
|
1625
|
+
* λ11 = λ8 * λ6^2 − λ7 * λ9
|
|
1626
|
+
* x3 = λ3 * λ11
|
|
1627
|
+
* y3 = λ6 * (λ9 * λ1 − λ11) − λ4 * λ10
|
|
1628
|
+
* z3 = λ10 * λ8
|
|
1629
|
+
*/
|
|
1630
|
+
add(a) {
|
|
1631
|
+
if (this.isInfinity()) return a;
|
|
1632
|
+
if (a.isInfinity()) return this;
|
|
1633
|
+
const b = this.x.toBigInteger(), m = this.y.toBigInteger(), v = this.z, B = a.x.toBigInteger(), _ = a.y.toBigInteger(), M = a.z, R = this.curve.q, q = b.multiply(M).mod(R), p = B.multiply(v).mod(R), w = q.subtract(p), g = m.multiply(M).mod(R), l = _.multiply(v).mod(R), T = g.subtract(l);
|
|
1634
|
+
if (t.ZERO.equals(w))
|
|
1635
|
+
return t.ZERO.equals(T) ? this.twice() : this.curve.infinity;
|
|
1636
|
+
const h = q.add(p), F = v.multiply(M).mod(R), A = w.square().mod(R), O = w.multiply(A).mod(R), C = F.multiply(T.square()).subtract(h.multiply(A)).mod(R), H = w.multiply(C).mod(R), D = T.multiply(A.multiply(q).subtract(C)).subtract(g.multiply(O)).mod(R), P = O.multiply(F).mod(R);
|
|
1637
|
+
return new u(this.curve, this.curve.fromBigInteger(H), this.curve.fromBigInteger(D), P);
|
|
1638
|
+
}
|
|
1639
|
+
/**
|
|
1640
|
+
* 自加
|
|
1641
|
+
*
|
|
1642
|
+
* 标准射影坐标系:
|
|
1643
|
+
*
|
|
1644
|
+
* λ1 = 3 * x1^2 + a * z1^2
|
|
1645
|
+
* λ2 = 2 * y1 * z1
|
|
1646
|
+
* λ3 = y1^2
|
|
1647
|
+
* λ4 = λ3 * x1 * z1
|
|
1648
|
+
* λ5 = λ2^2
|
|
1649
|
+
* λ6 = λ1^2 − 8 * λ4
|
|
1650
|
+
* x3 = λ2 * λ6
|
|
1651
|
+
* y3 = λ1 * (4 * λ4 − λ6) − 2 * λ5 * λ3
|
|
1652
|
+
* z3 = λ2 * λ5
|
|
1653
|
+
*/
|
|
1654
|
+
twice() {
|
|
1655
|
+
if (this.isInfinity()) return this;
|
|
1656
|
+
if (!this.y.toBigInteger().signum()) return this.curve.infinity;
|
|
1657
|
+
const a = this.x.toBigInteger(), b = this.y.toBigInteger(), m = this.z, v = this.curve.q, B = this.curve.a.toBigInteger(), _ = a.square().multiply(o).add(B.multiply(m.square())).mod(v), M = b.shiftLeft(1).multiply(m).mod(v), R = b.square().mod(v), q = R.multiply(a).multiply(m).mod(v), p = M.square().mod(v), w = _.square().subtract(q.shiftLeft(3)).mod(v), g = M.multiply(w).mod(v), l = _.multiply(q.shiftLeft(2).subtract(w)).subtract(p.shiftLeft(1).multiply(R)).mod(v), T = M.multiply(p).mod(v);
|
|
1658
|
+
return new u(this.curve, this.curve.fromBigInteger(g), this.curve.fromBigInteger(l), T);
|
|
1659
|
+
}
|
|
1660
|
+
/**
|
|
1661
|
+
* 倍点计算
|
|
1662
|
+
*/
|
|
1663
|
+
multiply(a) {
|
|
1664
|
+
if (this.isInfinity()) return this;
|
|
1665
|
+
if (!a.signum()) return this.curve.infinity;
|
|
1666
|
+
const b = a.multiply(o), m = this.negate();
|
|
1667
|
+
let v = this;
|
|
1668
|
+
for (let B = b.bitLength() - 2; B > 0; B--) {
|
|
1669
|
+
v = v.twice();
|
|
1670
|
+
const _ = b.testBit(B), M = a.testBit(B);
|
|
1671
|
+
_ !== M && (v = v.add(_ ? this : m));
|
|
1672
|
+
}
|
|
1673
|
+
return v;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
class f {
|
|
1677
|
+
constructor(a, b, m) {
|
|
1678
|
+
this.q = a, this.a = this.fromBigInteger(b), this.b = this.fromBigInteger(m), this.infinity = new u(this, null, null);
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* 判断两个椭圆曲线是否相等
|
|
1682
|
+
*/
|
|
1683
|
+
equals(a) {
|
|
1684
|
+
return a === this ? !0 : this.q.equals(a.q) && this.a.equals(a.a) && this.b.equals(a.b);
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* 生成椭圆曲线域元素
|
|
1688
|
+
*/
|
|
1689
|
+
fromBigInteger(a) {
|
|
1690
|
+
return new s(this.q, a);
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* 解析 16 进制串为椭圆曲线点
|
|
1694
|
+
*/
|
|
1695
|
+
decodePointHex(a) {
|
|
1696
|
+
switch (parseInt(a.substr(0, 2), 16)) {
|
|
1697
|
+
// 第一个字节
|
|
1698
|
+
case 0:
|
|
1699
|
+
return this.infinity;
|
|
1700
|
+
case 2:
|
|
1701
|
+
case 3:
|
|
1702
|
+
const b = this.fromBigInteger(new t(a.substr(2), 16));
|
|
1703
|
+
let m = this.fromBigInteger(b.multiply(b.square()).add(
|
|
1704
|
+
b.multiply(this.a)
|
|
1705
|
+
).add(this.b).toBigInteger().modPow(
|
|
1706
|
+
this.q.divide(new t("4")).add(t.ONE),
|
|
1707
|
+
this.q
|
|
1708
|
+
));
|
|
1709
|
+
return m.toBigInteger().mod(i).equals(new t(a.substr(0, 2), 16).subtract(i)) || (m = m.negate()), new u(this, b, m);
|
|
1710
|
+
case 4:
|
|
1711
|
+
case 6:
|
|
1712
|
+
case 7:
|
|
1713
|
+
const v = (a.length - 2) / 2, B = a.substr(2, v), _ = a.substr(v + 2, v);
|
|
1714
|
+
return new u(this, this.fromBigInteger(new t(B, 16)), this.fromBigInteger(new t(_, 16)));
|
|
1715
|
+
default:
|
|
1716
|
+
return null;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
return Bt = {
|
|
1721
|
+
ECPointFp: u,
|
|
1722
|
+
ECCurveFp: f
|
|
1723
|
+
}, Bt;
|
|
1724
|
+
}
|
|
1725
|
+
var _t, Wt;
|
|
1726
|
+
function ri() {
|
|
1727
|
+
if (Wt) return _t;
|
|
1728
|
+
Wt = 1;
|
|
1729
|
+
const { BigInteger: t, SecureRandom: i } = bt(), { ECCurveFp: o } = ni(), s = new i(), { curve: u, G: f, n: d } = b();
|
|
1730
|
+
function a() {
|
|
1731
|
+
return u;
|
|
1732
|
+
}
|
|
1733
|
+
function b() {
|
|
1734
|
+
const g = new t("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", 16), l = new t("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16), T = new t("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", 16), h = new o(g, l, T), O = h.decodePointHex("04" + "32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7" + "BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0"), C = new t("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16);
|
|
1735
|
+
return { curve: h, G: O, n: C };
|
|
1736
|
+
}
|
|
1737
|
+
function m(g, l, T) {
|
|
1738
|
+
const F = (g ? new t(g, l, T) : new t(d.bitLength(), s)).mod(d.subtract(t.ONE)).add(t.ONE), A = _(F.toString(16), 64), O = f.multiply(F), C = _(O.getX().toBigInteger().toString(16), 64), H = _(O.getY().toBigInteger().toString(16), 64), D = "04" + C + H;
|
|
1739
|
+
return { privateKey: A, publicKey: D };
|
|
1740
|
+
}
|
|
1741
|
+
function v(g) {
|
|
1742
|
+
if (g.length !== 130) throw new Error("Invalid public key to compress");
|
|
1743
|
+
const l = (g.length - 2) / 2, T = g.substr(2, l), h = new t(g.substr(l + 2, l), 16);
|
|
1744
|
+
let F = "03";
|
|
1745
|
+
return h.mod(new t("2")).equals(t.ZERO) && (F = "02"), F + T;
|
|
1746
|
+
}
|
|
1747
|
+
function B(g) {
|
|
1748
|
+
g = unescape(encodeURIComponent(g));
|
|
1749
|
+
const l = g.length, T = [];
|
|
1750
|
+
for (let F = 0; F < l; F++)
|
|
1751
|
+
T[F >>> 2] |= (g.charCodeAt(F) & 255) << 24 - F % 4 * 8;
|
|
1752
|
+
const h = [];
|
|
1753
|
+
for (let F = 0; F < l; F++) {
|
|
1754
|
+
const A = T[F >>> 2] >>> 24 - F % 4 * 8 & 255;
|
|
1755
|
+
h.push((A >>> 4).toString(16)), h.push((A & 15).toString(16));
|
|
1756
|
+
}
|
|
1757
|
+
return h.join("");
|
|
1758
|
+
}
|
|
1759
|
+
function _(g, l) {
|
|
1760
|
+
return g.length >= l ? g : new Array(l - g.length + 1).join("0") + g;
|
|
1761
|
+
}
|
|
1762
|
+
function M(g) {
|
|
1763
|
+
return g.map((l) => (l = l.toString(16), l.length === 1 ? "0" + l : l)).join("");
|
|
1764
|
+
}
|
|
1765
|
+
function R(g) {
|
|
1766
|
+
const l = [];
|
|
1767
|
+
let T = 0;
|
|
1768
|
+
for (let h = 0; h < g.length * 2; h += 2)
|
|
1769
|
+
l[h >>> 3] |= parseInt(g[T], 10) << 24 - h % 8 * 4, T++;
|
|
1770
|
+
try {
|
|
1771
|
+
const h = [];
|
|
1772
|
+
for (let F = 0; F < g.length; F++) {
|
|
1773
|
+
const A = l[F >>> 2] >>> 24 - F % 4 * 8 & 255;
|
|
1774
|
+
h.push(String.fromCharCode(A));
|
|
1775
|
+
}
|
|
1776
|
+
return decodeURIComponent(escape(h.join("")));
|
|
1777
|
+
} catch {
|
|
1778
|
+
throw new Error("Malformed UTF-8 data");
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
function q(g) {
|
|
1782
|
+
const l = [];
|
|
1783
|
+
let T = g.length;
|
|
1784
|
+
T % 2 !== 0 && (g = _(g, T + 1)), T = g.length;
|
|
1785
|
+
for (let h = 0; h < T; h += 2)
|
|
1786
|
+
l.push(parseInt(g.substr(h, 2), 16));
|
|
1787
|
+
return l;
|
|
1788
|
+
}
|
|
1789
|
+
function p(g) {
|
|
1790
|
+
const l = u.decodePointHex(g);
|
|
1791
|
+
if (!l) return !1;
|
|
1792
|
+
const T = l.getX();
|
|
1793
|
+
return l.getY().square().equals(T.multiply(T.square()).add(T.multiply(u.a)).add(u.b));
|
|
1794
|
+
}
|
|
1795
|
+
function w(g, l) {
|
|
1796
|
+
const T = u.decodePointHex(g);
|
|
1797
|
+
if (!T) return !1;
|
|
1798
|
+
const h = u.decodePointHex(l);
|
|
1799
|
+
return h ? T.equals(h) : !1;
|
|
1800
|
+
}
|
|
1801
|
+
return _t = {
|
|
1802
|
+
getGlobalCurve: a,
|
|
1803
|
+
generateEcparam: b,
|
|
1804
|
+
generateKeyPairHex: m,
|
|
1805
|
+
compressPublicKeyHex: v,
|
|
1806
|
+
utf8ToHex: B,
|
|
1807
|
+
leftPad: _,
|
|
1808
|
+
arrayToHex: M,
|
|
1809
|
+
arrayToUtf8: R,
|
|
1810
|
+
hexToArray: q,
|
|
1811
|
+
verifyPublicKey: p,
|
|
1812
|
+
comparePublicKeyHex: w
|
|
1813
|
+
}, _t;
|
|
1814
|
+
}
|
|
1815
|
+
var Rt, Jt;
|
|
1816
|
+
function de() {
|
|
1817
|
+
if (Jt) return Rt;
|
|
1818
|
+
Jt = 1;
|
|
1819
|
+
const t = new Uint32Array(68), i = new Uint32Array(64);
|
|
1820
|
+
function o(B, _) {
|
|
1821
|
+
const M = _ & 31;
|
|
1822
|
+
return B << M | B >>> 32 - M;
|
|
1823
|
+
}
|
|
1824
|
+
function s(B, _) {
|
|
1825
|
+
const M = [];
|
|
1826
|
+
for (let R = B.length - 1; R >= 0; R--) M[R] = (B[R] ^ _[R]) & 255;
|
|
1827
|
+
return M;
|
|
1828
|
+
}
|
|
1829
|
+
function u(B) {
|
|
1830
|
+
return B ^ o(B, 9) ^ o(B, 17);
|
|
1831
|
+
}
|
|
1832
|
+
function f(B) {
|
|
1833
|
+
return B ^ o(B, 15) ^ o(B, 23);
|
|
1834
|
+
}
|
|
1835
|
+
function d(B) {
|
|
1836
|
+
let _ = B.length * 8, M = _ % 512;
|
|
1837
|
+
M = M >= 448 ? 512 - M % 448 - 1 : 448 - M - 1;
|
|
1838
|
+
const R = new Array((M - 7) / 8), q = new Array(8);
|
|
1839
|
+
for (let h = 0, F = R.length; h < F; h++) R[h] = 0;
|
|
1840
|
+
for (let h = 0, F = q.length; h < F; h++) q[h] = 0;
|
|
1841
|
+
_ = _.toString(2);
|
|
1842
|
+
for (let h = 7; h >= 0; h--)
|
|
1843
|
+
if (_.length > 8) {
|
|
1844
|
+
const F = _.length - 8;
|
|
1845
|
+
q[h] = parseInt(_.substr(F), 2), _ = _.substr(0, F);
|
|
1846
|
+
} else _.length > 0 && (q[h] = parseInt(_, 2), _ = "");
|
|
1847
|
+
const p = new Uint8Array([...B, 128, ...R, ...q]), w = new DataView(p.buffer, 0), g = p.length / 64, l = new Uint32Array([1937774191, 1226093241, 388252375, 3666478592, 2842636476, 372324522, 3817729613, 2969243214]);
|
|
1848
|
+
for (let h = 0; h < g; h++) {
|
|
1849
|
+
t.fill(0), i.fill(0);
|
|
1850
|
+
const F = 16 * h;
|
|
1851
|
+
for (let I = 0; I < 16; I++)
|
|
1852
|
+
t[I] = w.getUint32((F + I) * 4, !1);
|
|
1853
|
+
for (let I = 16; I < 68; I++)
|
|
1854
|
+
t[I] = f(t[I - 16] ^ t[I - 9] ^ o(t[I - 3], 15)) ^ o(t[I - 13], 7) ^ t[I - 6];
|
|
1855
|
+
for (let I = 0; I < 64; I++)
|
|
1856
|
+
i[I] = t[I] ^ t[I + 4];
|
|
1857
|
+
const A = 2043430169, O = 2055708042;
|
|
1858
|
+
let C = l[0], H = l[1], D = l[2], P = l[3], z = l[4], L = l[5], $ = l[6], K = l[7], G, it, ct, ut, at;
|
|
1859
|
+
for (let I = 0; I < 64; I++)
|
|
1860
|
+
at = I >= 0 && I <= 15 ? A : O, G = o(o(C, 12) + z + o(at, I), 7), it = G ^ o(C, 12), ct = (I >= 0 && I <= 15 ? C ^ H ^ D : C & H | C & D | H & D) + P + it + i[I], ut = (I >= 0 && I <= 15 ? z ^ L ^ $ : z & L | ~z & $) + K + G + t[I], P = D, D = o(H, 9), H = C, C = ct, K = $, $ = o(L, 19), L = z, z = u(ut);
|
|
1861
|
+
l[0] ^= C, l[1] ^= H, l[2] ^= D, l[3] ^= P, l[4] ^= z, l[5] ^= L, l[6] ^= $, l[7] ^= K;
|
|
1862
|
+
}
|
|
1863
|
+
const T = [];
|
|
1864
|
+
for (let h = 0, F = l.length; h < F; h++) {
|
|
1865
|
+
const A = l[h];
|
|
1866
|
+
T.push((A & 4278190080) >>> 24, (A & 16711680) >>> 16, (A & 65280) >>> 8, A & 255);
|
|
1867
|
+
}
|
|
1868
|
+
return T;
|
|
1869
|
+
}
|
|
1870
|
+
const a = 64, b = new Uint8Array(a), m = new Uint8Array(a);
|
|
1871
|
+
for (let B = 0; B < a; B++)
|
|
1872
|
+
b[B] = 54, m[B] = 92;
|
|
1873
|
+
function v(B, _) {
|
|
1874
|
+
for (_.length > a && (_ = d(_)); _.length < a; ) _.push(0);
|
|
1875
|
+
const M = s(_, b), R = s(_, m), q = d([...M, ...B]);
|
|
1876
|
+
return d([...R, ...q]);
|
|
1877
|
+
}
|
|
1878
|
+
return Rt = {
|
|
1879
|
+
sm3: d,
|
|
1880
|
+
hmac: v
|
|
1881
|
+
}, Rt;
|
|
1882
|
+
}
|
|
1883
|
+
var Dt, Xt;
|
|
1884
|
+
function ii() {
|
|
1885
|
+
if (Xt) return Dt;
|
|
1886
|
+
Xt = 1;
|
|
1887
|
+
const { BigInteger: t } = bt(), { encodeDer: i, decodeDer: o } = ei(), s = ri(), u = de().sm3, { G: f, curve: d, n: a } = s.generateEcparam(), b = 0;
|
|
1888
|
+
function m(p, w, g = 1) {
|
|
1889
|
+
p = typeof p == "string" ? s.hexToArray(s.utf8ToHex(p)) : Array.prototype.slice.call(p), w = s.getGlobalCurve().decodePointHex(w);
|
|
1890
|
+
const l = s.generateKeyPairHex(), T = new t(l.privateKey, 16);
|
|
1891
|
+
let h = l.publicKey;
|
|
1892
|
+
h.length > 128 && (h = h.substr(h.length - 128));
|
|
1893
|
+
const F = w.multiply(T), A = s.hexToArray(s.leftPad(F.getX().toBigInteger().toRadix(16), 64)), O = s.hexToArray(s.leftPad(F.getY().toBigInteger().toRadix(16), 64)), C = s.arrayToHex(u([].concat(A, p, O)));
|
|
1894
|
+
let H = 1, D = 0, P = [];
|
|
1895
|
+
const z = [].concat(A, O), L = () => {
|
|
1896
|
+
P = u([...z, H >> 24 & 255, H >> 16 & 255, H >> 8 & 255, H & 255]), H++, D = 0;
|
|
1897
|
+
};
|
|
1898
|
+
L();
|
|
1899
|
+
for (let K = 0, G = p.length; K < G; K++)
|
|
1900
|
+
D === P.length && L(), p[K] ^= P[D++] & 255;
|
|
1901
|
+
const $ = s.arrayToHex(p);
|
|
1902
|
+
return g === b ? h + $ + C : h + C + $;
|
|
1903
|
+
}
|
|
1904
|
+
function v(p, w, g = 1, {
|
|
1905
|
+
output: l = "string"
|
|
1906
|
+
} = {}) {
|
|
1907
|
+
w = new t(w, 16);
|
|
1908
|
+
let T = p.substr(128, 64), h = p.substr(192);
|
|
1909
|
+
g === b && (T = p.substr(p.length - 64), h = p.substr(128, p.length - 128 - 64));
|
|
1910
|
+
const F = s.hexToArray(h), O = s.getGlobalCurve().decodePointHex("04" + p.substr(0, 128)).multiply(w), C = s.hexToArray(s.leftPad(O.getX().toBigInteger().toRadix(16), 64)), H = s.hexToArray(s.leftPad(O.getY().toBigInteger().toRadix(16), 64));
|
|
1911
|
+
let D = 1, P = 0, z = [];
|
|
1912
|
+
const L = [].concat(C, H), $ = () => {
|
|
1913
|
+
z = u([...L, D >> 24 & 255, D >> 16 & 255, D >> 8 & 255, D & 255]), D++, P = 0;
|
|
1914
|
+
};
|
|
1915
|
+
$();
|
|
1916
|
+
for (let G = 0, it = F.length; G < it; G++)
|
|
1917
|
+
P === z.length && $(), F[G] ^= z[P++] & 255;
|
|
1918
|
+
return s.arrayToHex(u([].concat(C, F, H))) === T.toLowerCase() ? l === "array" ? F : s.arrayToUtf8(F) : l === "array" ? [] : "";
|
|
1919
|
+
}
|
|
1920
|
+
function B(p, w, {
|
|
1921
|
+
pointPool: g,
|
|
1922
|
+
der: l,
|
|
1923
|
+
hash: T,
|
|
1924
|
+
publicKey: h,
|
|
1925
|
+
userId: F
|
|
1926
|
+
} = {}) {
|
|
1927
|
+
let A = typeof p == "string" ? s.utf8ToHex(p) : s.arrayToHex(p);
|
|
1928
|
+
T && (h = h || R(w), A = M(A, h, F));
|
|
1929
|
+
const O = new t(w, 16), C = new t(A, 16);
|
|
1930
|
+
let H = null, D = null, P = null;
|
|
1931
|
+
do {
|
|
1932
|
+
do {
|
|
1933
|
+
let z;
|
|
1934
|
+
g && g.length ? z = g.pop() : z = q(), H = z.k, D = C.add(z.x1).mod(a);
|
|
1935
|
+
} while (D.equals(t.ZERO) || D.add(H).equals(a));
|
|
1936
|
+
P = O.add(t.ONE).modInverse(a).multiply(H.subtract(D.multiply(O))).mod(a);
|
|
1937
|
+
} while (P.equals(t.ZERO));
|
|
1938
|
+
return l ? i(D, P) : s.leftPad(D.toString(16), 64) + s.leftPad(P.toString(16), 64);
|
|
1939
|
+
}
|
|
1940
|
+
function _(p, w, g, { der: l, hash: T, userId: h } = {}) {
|
|
1941
|
+
let F = typeof p == "string" ? s.utf8ToHex(p) : s.arrayToHex(p);
|
|
1942
|
+
T && (F = M(F, g, h));
|
|
1943
|
+
let A, O;
|
|
1944
|
+
if (l) {
|
|
1945
|
+
const L = o(w);
|
|
1946
|
+
A = L.r, O = L.s;
|
|
1947
|
+
} else
|
|
1948
|
+
A = new t(w.substring(0, 64), 16), O = new t(w.substring(64), 16);
|
|
1949
|
+
const C = d.decodePointHex(g), H = new t(F, 16), D = A.add(O).mod(a);
|
|
1950
|
+
if (D.equals(t.ZERO)) return !1;
|
|
1951
|
+
const P = f.multiply(O).add(C.multiply(D)), z = H.add(P.getX().toBigInteger()).mod(a);
|
|
1952
|
+
return A.equals(z);
|
|
1953
|
+
}
|
|
1954
|
+
function M(p, w, g = "1234567812345678") {
|
|
1955
|
+
g = s.utf8ToHex(g);
|
|
1956
|
+
const l = s.leftPad(f.curve.a.toBigInteger().toRadix(16), 64), T = s.leftPad(f.curve.b.toBigInteger().toRadix(16), 64), h = s.leftPad(f.getX().toBigInteger().toRadix(16), 64), F = s.leftPad(f.getY().toBigInteger().toRadix(16), 64);
|
|
1957
|
+
let A, O;
|
|
1958
|
+
if (w.length === 128)
|
|
1959
|
+
A = w.substr(0, 64), O = w.substr(64, 64);
|
|
1960
|
+
else {
|
|
1961
|
+
const P = f.curve.decodePointHex(w);
|
|
1962
|
+
A = s.leftPad(P.getX().toBigInteger().toRadix(16), 64), O = s.leftPad(P.getY().toBigInteger().toRadix(16), 64);
|
|
1963
|
+
}
|
|
1964
|
+
const C = s.hexToArray(g + l + T + h + F + A + O), H = g.length * 4;
|
|
1965
|
+
C.unshift(H & 255), C.unshift(H >> 8 & 255);
|
|
1966
|
+
const D = u(C);
|
|
1967
|
+
return s.arrayToHex(u(D.concat(s.hexToArray(p))));
|
|
1968
|
+
}
|
|
1969
|
+
function R(p) {
|
|
1970
|
+
const w = f.multiply(new t(p, 16)), g = s.leftPad(w.getX().toBigInteger().toString(16), 64), l = s.leftPad(w.getY().toBigInteger().toString(16), 64);
|
|
1971
|
+
return "04" + g + l;
|
|
1972
|
+
}
|
|
1973
|
+
function q() {
|
|
1974
|
+
const p = s.generateKeyPairHex(), w = d.decodePointHex(p.publicKey);
|
|
1975
|
+
return p.k = new t(p.privateKey, 16), p.x1 = w.getX().toBigInteger(), p;
|
|
1976
|
+
}
|
|
1977
|
+
return Dt = {
|
|
1978
|
+
generateKeyPairHex: s.generateKeyPairHex,
|
|
1979
|
+
compressPublicKeyHex: s.compressPublicKeyHex,
|
|
1980
|
+
comparePublicKeyHex: s.comparePublicKeyHex,
|
|
1981
|
+
doEncrypt: m,
|
|
1982
|
+
doDecrypt: v,
|
|
1983
|
+
doSignature: B,
|
|
1984
|
+
doVerifySignature: _,
|
|
1985
|
+
getPublicKeyFromPrivateKey: R,
|
|
1986
|
+
getPoint: q,
|
|
1987
|
+
verifyPublicKey: s.verifyPublicKey
|
|
1988
|
+
}, Dt;
|
|
1989
|
+
}
|
|
1990
|
+
var At, Kt;
|
|
1991
|
+
function oi() {
|
|
1992
|
+
if (Kt) return At;
|
|
1993
|
+
Kt = 1;
|
|
1994
|
+
const { sm3: t, hmac: i } = de();
|
|
1995
|
+
function o(d, a) {
|
|
1996
|
+
return d.length >= a ? d : new Array(a - d.length + 1).join("0") + d;
|
|
1997
|
+
}
|
|
1998
|
+
function s(d) {
|
|
1999
|
+
return d.map((a) => (a = a.toString(16), a.length === 1 ? "0" + a : a)).join("");
|
|
2000
|
+
}
|
|
2001
|
+
function u(d) {
|
|
2002
|
+
const a = [];
|
|
2003
|
+
let b = d.length;
|
|
2004
|
+
b % 2 !== 0 && (d = o(d, b + 1)), b = d.length;
|
|
2005
|
+
for (let m = 0; m < b; m += 2)
|
|
2006
|
+
a.push(parseInt(d.substr(m, 2), 16));
|
|
2007
|
+
return a;
|
|
2008
|
+
}
|
|
2009
|
+
function f(d) {
|
|
2010
|
+
const a = [];
|
|
2011
|
+
for (let b = 0, m = d.length; b < m; b++) {
|
|
2012
|
+
const v = d.codePointAt(b);
|
|
2013
|
+
if (v <= 127)
|
|
2014
|
+
a.push(v);
|
|
2015
|
+
else if (v <= 2047)
|
|
2016
|
+
a.push(192 | v >>> 6), a.push(128 | v & 63);
|
|
2017
|
+
else if (v <= 55295 || v >= 57344 && v <= 65535)
|
|
2018
|
+
a.push(224 | v >>> 12), a.push(128 | v >>> 6 & 63), a.push(128 | v & 63);
|
|
2019
|
+
else if (v >= 65536 && v <= 1114111)
|
|
2020
|
+
b++, a.push(240 | v >>> 18 & 28), a.push(128 | v >>> 12 & 63), a.push(128 | v >>> 6 & 63), a.push(128 | v & 63);
|
|
2021
|
+
else
|
|
2022
|
+
throw a.push(v), new Error("input is not supported");
|
|
2023
|
+
}
|
|
2024
|
+
return a;
|
|
2025
|
+
}
|
|
2026
|
+
return At = function(d, a) {
|
|
2027
|
+
if (d = typeof d == "string" ? f(d) : Array.prototype.slice.call(d), a) {
|
|
2028
|
+
if ((a.mode || "hmac") !== "hmac") throw new Error("invalid mode");
|
|
2029
|
+
let m = a.key;
|
|
2030
|
+
if (!m) throw new Error("invalid key");
|
|
2031
|
+
return m = typeof m == "string" ? u(m) : Array.prototype.slice.call(m), s(i(d, m));
|
|
2032
|
+
}
|
|
2033
|
+
return s(t(d));
|
|
2034
|
+
}, At;
|
|
2035
|
+
}
|
|
2036
|
+
var It, Qt;
|
|
2037
|
+
function si() {
|
|
2038
|
+
if (Qt) return It;
|
|
2039
|
+
Qt = 1;
|
|
2040
|
+
const t = 0, i = 32, o = 16, s = [
|
|
2041
|
+
214,
|
|
2042
|
+
144,
|
|
2043
|
+
233,
|
|
2044
|
+
254,
|
|
2045
|
+
204,
|
|
2046
|
+
225,
|
|
2047
|
+
61,
|
|
2048
|
+
183,
|
|
2049
|
+
22,
|
|
2050
|
+
182,
|
|
2051
|
+
20,
|
|
2052
|
+
194,
|
|
2053
|
+
40,
|
|
2054
|
+
251,
|
|
2055
|
+
44,
|
|
2056
|
+
5,
|
|
2057
|
+
43,
|
|
2058
|
+
103,
|
|
2059
|
+
154,
|
|
2060
|
+
118,
|
|
2061
|
+
42,
|
|
2062
|
+
190,
|
|
2063
|
+
4,
|
|
2064
|
+
195,
|
|
2065
|
+
170,
|
|
2066
|
+
68,
|
|
2067
|
+
19,
|
|
2068
|
+
38,
|
|
2069
|
+
73,
|
|
2070
|
+
134,
|
|
2071
|
+
6,
|
|
2072
|
+
153,
|
|
2073
|
+
156,
|
|
2074
|
+
66,
|
|
2075
|
+
80,
|
|
2076
|
+
244,
|
|
2077
|
+
145,
|
|
2078
|
+
239,
|
|
2079
|
+
152,
|
|
2080
|
+
122,
|
|
2081
|
+
51,
|
|
2082
|
+
84,
|
|
2083
|
+
11,
|
|
2084
|
+
67,
|
|
2085
|
+
237,
|
|
2086
|
+
207,
|
|
2087
|
+
172,
|
|
2088
|
+
98,
|
|
2089
|
+
228,
|
|
2090
|
+
179,
|
|
2091
|
+
28,
|
|
2092
|
+
169,
|
|
2093
|
+
201,
|
|
2094
|
+
8,
|
|
2095
|
+
232,
|
|
2096
|
+
149,
|
|
2097
|
+
128,
|
|
2098
|
+
223,
|
|
2099
|
+
148,
|
|
2100
|
+
250,
|
|
2101
|
+
117,
|
|
2102
|
+
143,
|
|
2103
|
+
63,
|
|
2104
|
+
166,
|
|
2105
|
+
71,
|
|
2106
|
+
7,
|
|
2107
|
+
167,
|
|
2108
|
+
252,
|
|
2109
|
+
243,
|
|
2110
|
+
115,
|
|
2111
|
+
23,
|
|
2112
|
+
186,
|
|
2113
|
+
131,
|
|
2114
|
+
89,
|
|
2115
|
+
60,
|
|
2116
|
+
25,
|
|
2117
|
+
230,
|
|
2118
|
+
133,
|
|
2119
|
+
79,
|
|
2120
|
+
168,
|
|
2121
|
+
104,
|
|
2122
|
+
107,
|
|
2123
|
+
129,
|
|
2124
|
+
178,
|
|
2125
|
+
113,
|
|
2126
|
+
100,
|
|
2127
|
+
218,
|
|
2128
|
+
139,
|
|
2129
|
+
248,
|
|
2130
|
+
235,
|
|
2131
|
+
15,
|
|
2132
|
+
75,
|
|
2133
|
+
112,
|
|
2134
|
+
86,
|
|
2135
|
+
157,
|
|
2136
|
+
53,
|
|
2137
|
+
30,
|
|
2138
|
+
36,
|
|
2139
|
+
14,
|
|
2140
|
+
94,
|
|
2141
|
+
99,
|
|
2142
|
+
88,
|
|
2143
|
+
209,
|
|
2144
|
+
162,
|
|
2145
|
+
37,
|
|
2146
|
+
34,
|
|
2147
|
+
124,
|
|
2148
|
+
59,
|
|
2149
|
+
1,
|
|
2150
|
+
33,
|
|
2151
|
+
120,
|
|
2152
|
+
135,
|
|
2153
|
+
212,
|
|
2154
|
+
0,
|
|
2155
|
+
70,
|
|
2156
|
+
87,
|
|
2157
|
+
159,
|
|
2158
|
+
211,
|
|
2159
|
+
39,
|
|
2160
|
+
82,
|
|
2161
|
+
76,
|
|
2162
|
+
54,
|
|
2163
|
+
2,
|
|
2164
|
+
231,
|
|
2165
|
+
160,
|
|
2166
|
+
196,
|
|
2167
|
+
200,
|
|
2168
|
+
158,
|
|
2169
|
+
234,
|
|
2170
|
+
191,
|
|
2171
|
+
138,
|
|
2172
|
+
210,
|
|
2173
|
+
64,
|
|
2174
|
+
199,
|
|
2175
|
+
56,
|
|
2176
|
+
181,
|
|
2177
|
+
163,
|
|
2178
|
+
247,
|
|
2179
|
+
242,
|
|
2180
|
+
206,
|
|
2181
|
+
249,
|
|
2182
|
+
97,
|
|
2183
|
+
21,
|
|
2184
|
+
161,
|
|
2185
|
+
224,
|
|
2186
|
+
174,
|
|
2187
|
+
93,
|
|
2188
|
+
164,
|
|
2189
|
+
155,
|
|
2190
|
+
52,
|
|
2191
|
+
26,
|
|
2192
|
+
85,
|
|
2193
|
+
173,
|
|
2194
|
+
147,
|
|
2195
|
+
50,
|
|
2196
|
+
48,
|
|
2197
|
+
245,
|
|
2198
|
+
140,
|
|
2199
|
+
177,
|
|
2200
|
+
227,
|
|
2201
|
+
29,
|
|
2202
|
+
246,
|
|
2203
|
+
226,
|
|
2204
|
+
46,
|
|
2205
|
+
130,
|
|
2206
|
+
102,
|
|
2207
|
+
202,
|
|
2208
|
+
96,
|
|
2209
|
+
192,
|
|
2210
|
+
41,
|
|
2211
|
+
35,
|
|
2212
|
+
171,
|
|
2213
|
+
13,
|
|
2214
|
+
83,
|
|
2215
|
+
78,
|
|
2216
|
+
111,
|
|
2217
|
+
213,
|
|
2218
|
+
219,
|
|
2219
|
+
55,
|
|
2220
|
+
69,
|
|
2221
|
+
222,
|
|
2222
|
+
253,
|
|
2223
|
+
142,
|
|
2224
|
+
47,
|
|
2225
|
+
3,
|
|
2226
|
+
255,
|
|
2227
|
+
106,
|
|
2228
|
+
114,
|
|
2229
|
+
109,
|
|
2230
|
+
108,
|
|
2231
|
+
91,
|
|
2232
|
+
81,
|
|
2233
|
+
141,
|
|
2234
|
+
27,
|
|
2235
|
+
175,
|
|
2236
|
+
146,
|
|
2237
|
+
187,
|
|
2238
|
+
221,
|
|
2239
|
+
188,
|
|
2240
|
+
127,
|
|
2241
|
+
17,
|
|
2242
|
+
217,
|
|
2243
|
+
92,
|
|
2244
|
+
65,
|
|
2245
|
+
31,
|
|
2246
|
+
16,
|
|
2247
|
+
90,
|
|
2248
|
+
216,
|
|
2249
|
+
10,
|
|
2250
|
+
193,
|
|
2251
|
+
49,
|
|
2252
|
+
136,
|
|
2253
|
+
165,
|
|
2254
|
+
205,
|
|
2255
|
+
123,
|
|
2256
|
+
189,
|
|
2257
|
+
45,
|
|
2258
|
+
116,
|
|
2259
|
+
208,
|
|
2260
|
+
18,
|
|
2261
|
+
184,
|
|
2262
|
+
229,
|
|
2263
|
+
180,
|
|
2264
|
+
176,
|
|
2265
|
+
137,
|
|
2266
|
+
105,
|
|
2267
|
+
151,
|
|
2268
|
+
74,
|
|
2269
|
+
12,
|
|
2270
|
+
150,
|
|
2271
|
+
119,
|
|
2272
|
+
126,
|
|
2273
|
+
101,
|
|
2274
|
+
185,
|
|
2275
|
+
241,
|
|
2276
|
+
9,
|
|
2277
|
+
197,
|
|
2278
|
+
110,
|
|
2279
|
+
198,
|
|
2280
|
+
132,
|
|
2281
|
+
24,
|
|
2282
|
+
240,
|
|
2283
|
+
125,
|
|
2284
|
+
236,
|
|
2285
|
+
58,
|
|
2286
|
+
220,
|
|
2287
|
+
77,
|
|
2288
|
+
32,
|
|
2289
|
+
121,
|
|
2290
|
+
238,
|
|
2291
|
+
95,
|
|
2292
|
+
62,
|
|
2293
|
+
215,
|
|
2294
|
+
203,
|
|
2295
|
+
57,
|
|
2296
|
+
72
|
|
2297
|
+
], u = [
|
|
2298
|
+
462357,
|
|
2299
|
+
472066609,
|
|
2300
|
+
943670861,
|
|
2301
|
+
1415275113,
|
|
2302
|
+
1886879365,
|
|
2303
|
+
2358483617,
|
|
2304
|
+
2830087869,
|
|
2305
|
+
3301692121,
|
|
2306
|
+
3773296373,
|
|
2307
|
+
4228057617,
|
|
2308
|
+
404694573,
|
|
2309
|
+
876298825,
|
|
2310
|
+
1347903077,
|
|
2311
|
+
1819507329,
|
|
2312
|
+
2291111581,
|
|
2313
|
+
2762715833,
|
|
2314
|
+
3234320085,
|
|
2315
|
+
3705924337,
|
|
2316
|
+
4177462797,
|
|
2317
|
+
337322537,
|
|
2318
|
+
808926789,
|
|
2319
|
+
1280531041,
|
|
2320
|
+
1752135293,
|
|
2321
|
+
2223739545,
|
|
2322
|
+
2695343797,
|
|
2323
|
+
3166948049,
|
|
2324
|
+
3638552301,
|
|
2325
|
+
4110090761,
|
|
2326
|
+
269950501,
|
|
2327
|
+
741554753,
|
|
2328
|
+
1213159005,
|
|
2329
|
+
1684763257
|
|
2330
|
+
];
|
|
2331
|
+
function f(p) {
|
|
2332
|
+
const w = [];
|
|
2333
|
+
for (let g = 0, l = p.length; g < l; g += 2)
|
|
2334
|
+
w.push(parseInt(p.substr(g, 2), 16));
|
|
2335
|
+
return w;
|
|
2336
|
+
}
|
|
2337
|
+
function d(p) {
|
|
2338
|
+
return p.map((w) => (w = w.toString(16), w.length === 1 ? "0" + w : w)).join("");
|
|
2339
|
+
}
|
|
2340
|
+
function a(p) {
|
|
2341
|
+
const w = [];
|
|
2342
|
+
for (let g = 0, l = p.length; g < l; g++) {
|
|
2343
|
+
const T = p.codePointAt(g);
|
|
2344
|
+
if (T <= 127)
|
|
2345
|
+
w.push(T);
|
|
2346
|
+
else if (T <= 2047)
|
|
2347
|
+
w.push(192 | T >>> 6), w.push(128 | T & 63);
|
|
2348
|
+
else if (T <= 55295 || T >= 57344 && T <= 65535)
|
|
2349
|
+
w.push(224 | T >>> 12), w.push(128 | T >>> 6 & 63), w.push(128 | T & 63);
|
|
2350
|
+
else if (T >= 65536 && T <= 1114111)
|
|
2351
|
+
g++, w.push(240 | T >>> 18 & 28), w.push(128 | T >>> 12 & 63), w.push(128 | T >>> 6 & 63), w.push(128 | T & 63);
|
|
2352
|
+
else
|
|
2353
|
+
throw w.push(T), new Error("input is not supported");
|
|
2354
|
+
}
|
|
2355
|
+
return w;
|
|
2356
|
+
}
|
|
2357
|
+
function b(p) {
|
|
2358
|
+
const w = [];
|
|
2359
|
+
for (let g = 0, l = p.length; g < l; g++)
|
|
2360
|
+
p[g] >= 240 && p[g] <= 247 ? (w.push(String.fromCodePoint(((p[g] & 7) << 18) + ((p[g + 1] & 63) << 12) + ((p[g + 2] & 63) << 6) + (p[g + 3] & 63))), g += 3) : p[g] >= 224 && p[g] <= 239 ? (w.push(String.fromCodePoint(((p[g] & 15) << 12) + ((p[g + 1] & 63) << 6) + (p[g + 2] & 63))), g += 2) : p[g] >= 192 && p[g] <= 223 ? (w.push(String.fromCodePoint(((p[g] & 31) << 6) + (p[g + 1] & 63))), g++) : w.push(String.fromCodePoint(p[g]));
|
|
2361
|
+
return w.join("");
|
|
2362
|
+
}
|
|
2363
|
+
function m(p, w) {
|
|
2364
|
+
const g = w & 31;
|
|
2365
|
+
return p << g | p >>> 32 - g;
|
|
2366
|
+
}
|
|
2367
|
+
function v(p) {
|
|
2368
|
+
return (s[p >>> 24 & 255] & 255) << 24 | (s[p >>> 16 & 255] & 255) << 16 | (s[p >>> 8 & 255] & 255) << 8 | s[p & 255] & 255;
|
|
2369
|
+
}
|
|
2370
|
+
function B(p) {
|
|
2371
|
+
return p ^ m(p, 2) ^ m(p, 10) ^ m(p, 18) ^ m(p, 24);
|
|
2372
|
+
}
|
|
2373
|
+
function _(p) {
|
|
2374
|
+
return p ^ m(p, 13) ^ m(p, 23);
|
|
2375
|
+
}
|
|
2376
|
+
function M(p, w, g) {
|
|
2377
|
+
const l = new Array(4), T = new Array(4);
|
|
2378
|
+
for (let h = 0; h < 4; h++)
|
|
2379
|
+
T[0] = p[4 * h] & 255, T[1] = p[4 * h + 1] & 255, T[2] = p[4 * h + 2] & 255, T[3] = p[4 * h + 3] & 255, l[h] = T[0] << 24 | T[1] << 16 | T[2] << 8 | T[3];
|
|
2380
|
+
for (let h = 0, F; h < 32; h += 4)
|
|
2381
|
+
F = l[1] ^ l[2] ^ l[3] ^ g[h + 0], l[0] ^= B(v(F)), F = l[2] ^ l[3] ^ l[0] ^ g[h + 1], l[1] ^= B(v(F)), F = l[3] ^ l[0] ^ l[1] ^ g[h + 2], l[2] ^= B(v(F)), F = l[0] ^ l[1] ^ l[2] ^ g[h + 3], l[3] ^= B(v(F));
|
|
2382
|
+
for (let h = 0; h < 16; h += 4)
|
|
2383
|
+
w[h] = l[3 - h / 4] >>> 24 & 255, w[h + 1] = l[3 - h / 4] >>> 16 & 255, w[h + 2] = l[3 - h / 4] >>> 8 & 255, w[h + 3] = l[3 - h / 4] & 255;
|
|
2384
|
+
}
|
|
2385
|
+
function R(p, w, g) {
|
|
2386
|
+
const l = new Array(4), T = new Array(4);
|
|
2387
|
+
for (let h = 0; h < 4; h++)
|
|
2388
|
+
T[0] = p[0 + 4 * h] & 255, T[1] = p[1 + 4 * h] & 255, T[2] = p[2 + 4 * h] & 255, T[3] = p[3 + 4 * h] & 255, l[h] = T[0] << 24 | T[1] << 16 | T[2] << 8 | T[3];
|
|
2389
|
+
l[0] ^= 2746333894, l[1] ^= 1453994832, l[2] ^= 1736282519, l[3] ^= 2993693404;
|
|
2390
|
+
for (let h = 0, F; h < 32; h += 4)
|
|
2391
|
+
F = l[1] ^ l[2] ^ l[3] ^ u[h + 0], w[h + 0] = l[0] ^= _(v(F)), F = l[2] ^ l[3] ^ l[0] ^ u[h + 1], w[h + 1] = l[1] ^= _(v(F)), F = l[3] ^ l[0] ^ l[1] ^ u[h + 2], w[h + 2] = l[2] ^= _(v(F)), F = l[0] ^ l[1] ^ l[2] ^ u[h + 3], w[h + 3] = l[3] ^= _(v(F));
|
|
2392
|
+
if (g === t)
|
|
2393
|
+
for (let h = 0, F; h < 16; h++)
|
|
2394
|
+
F = w[h], w[h] = w[31 - h], w[31 - h] = F;
|
|
2395
|
+
}
|
|
2396
|
+
function q(p, w, g, {
|
|
2397
|
+
padding: l = "pkcs#7",
|
|
2398
|
+
mode: T,
|
|
2399
|
+
iv: h = [],
|
|
2400
|
+
output: F = "string"
|
|
2401
|
+
} = {}) {
|
|
2402
|
+
if (T === "cbc" && (typeof h == "string" && (h = f(h)), h.length !== 128 / 8))
|
|
2403
|
+
throw new Error("iv is invalid");
|
|
2404
|
+
if (typeof w == "string" && (w = f(w)), w.length !== 128 / 8)
|
|
2405
|
+
throw new Error("key is invalid");
|
|
2406
|
+
if (typeof p == "string" ? g !== t ? p = a(p) : p = f(p) : p = [...p], (l === "pkcs#5" || l === "pkcs#7") && g !== t) {
|
|
2407
|
+
const P = o - p.length % o;
|
|
2408
|
+
for (let z = 0; z < P; z++) p.push(P);
|
|
2409
|
+
}
|
|
2410
|
+
const A = new Array(i);
|
|
2411
|
+
R(w, A, g);
|
|
2412
|
+
const O = [];
|
|
2413
|
+
let C = h, H = p.length, D = 0;
|
|
2414
|
+
for (; H >= o; ) {
|
|
2415
|
+
const P = p.slice(D, D + 16), z = new Array(16);
|
|
2416
|
+
if (T === "cbc")
|
|
2417
|
+
for (let L = 0; L < o; L++)
|
|
2418
|
+
g !== t && (P[L] ^= C[L]);
|
|
2419
|
+
M(P, z, A);
|
|
2420
|
+
for (let L = 0; L < o; L++)
|
|
2421
|
+
T === "cbc" && g === t && (z[L] ^= C[L]), O[D + L] = z[L];
|
|
2422
|
+
T === "cbc" && (g !== t ? C = z : C = P), H -= o, D += o;
|
|
2423
|
+
}
|
|
2424
|
+
if ((l === "pkcs#5" || l === "pkcs#7") && g === t) {
|
|
2425
|
+
const P = O.length, z = O[P - 1];
|
|
2426
|
+
for (let L = 1; L <= z; L++)
|
|
2427
|
+
if (O[P - L] !== z) throw new Error("padding is invalid");
|
|
2428
|
+
O.splice(P - z, z);
|
|
2429
|
+
}
|
|
2430
|
+
return F !== "array" ? g !== t ? d(O) : b(O) : O;
|
|
2431
|
+
}
|
|
2432
|
+
return It = {
|
|
2433
|
+
encrypt(p, w, g) {
|
|
2434
|
+
return q(p, w, 1, g);
|
|
2435
|
+
},
|
|
2436
|
+
decrypt(p, w, g) {
|
|
2437
|
+
return q(p, w, 0, g);
|
|
2438
|
+
}
|
|
2439
|
+
}, It;
|
|
2440
|
+
}
|
|
2441
|
+
var Mt, te;
|
|
2442
|
+
function fi() {
|
|
2443
|
+
return te || (te = 1, Mt = {
|
|
2444
|
+
sm2: ii(),
|
|
2445
|
+
sm3: oi(),
|
|
2446
|
+
sm4: si()
|
|
2447
|
+
}), Mt;
|
|
2448
|
+
}
|
|
2449
|
+
var pe = fi();
|
|
2450
|
+
const ge = pe.sm2, xe = pe.sm4, Mi = (t, i, o = "04") => o + ge.doEncrypt(t, i), Oi = (t, i, o = "04") => ge.doDecrypt(t.startsWith(o) ? t.slice(2) : t, i), qi = (t, i) => xe.encrypt(t, i), Ci = (t, i) => xe.decrypt(t, i);
|
|
2451
|
+
let ft = [], ci = { consecutiveFrames: 0, lastBlinkTime: 0 }, ui = { consecutiveFrames: 0, lastBlinkTime: 0 };
|
|
2452
|
+
const ai = /* @__PURE__ */ new Map([
|
|
2453
|
+
["nod", [mi, 30, 100]],
|
|
2454
|
+
["shake", [xi, 7, 100]],
|
|
2455
|
+
["mouth", [gi, 0.35, 100]],
|
|
2456
|
+
["eye", [pi, 0.3, 100]]
|
|
2457
|
+
]), Pi = ["nod", "shake", "mouth", "eye"], zi = {
|
|
739
2458
|
nod: "请点点头",
|
|
740
2459
|
shake: "请摇摇头",
|
|
741
2460
|
mouth: "请张张嘴",
|
|
742
2461
|
eye: "请眨眨眼"
|
|
743
2462
|
};
|
|
744
|
-
function
|
|
745
|
-
if (
|
|
746
|
-
const
|
|
2463
|
+
function ee(t, i) {
|
|
2464
|
+
if (t.length !== i.length) throw new Error("euclideanDistance: arr1.length !== arr2.length");
|
|
2465
|
+
const o = Array.from(t), s = Array.from(i);
|
|
747
2466
|
return Math.sqrt(
|
|
748
|
-
|
|
2467
|
+
o.map((u, f) => u - s[f]).reduce((u, f) => u + Math.pow(f, 2), 0)
|
|
749
2468
|
);
|
|
750
2469
|
}
|
|
751
|
-
function*
|
|
752
|
-
for (let
|
|
753
|
-
yield
|
|
2470
|
+
function* hi(t, i, o = 8, s = 0) {
|
|
2471
|
+
for (let u = o; u > 0; u--)
|
|
2472
|
+
yield t(i, 0.5, s);
|
|
754
2473
|
}
|
|
755
|
-
function
|
|
756
|
-
return [
|
|
2474
|
+
function pt(t) {
|
|
2475
|
+
return [t.x, t.y];
|
|
757
2476
|
}
|
|
758
|
-
function
|
|
759
|
-
const
|
|
760
|
-
return Math.sqrt(
|
|
2477
|
+
function Ot(t, i) {
|
|
2478
|
+
const o = t.x - i.x, s = t.y - i.y;
|
|
2479
|
+
return Math.sqrt(o * o + s * s);
|
|
761
2480
|
}
|
|
762
|
-
function
|
|
763
|
-
const
|
|
764
|
-
return (
|
|
2481
|
+
function ne(t) {
|
|
2482
|
+
const i = Ot(t[1], t[5]), o = Ot(t[2], t[4]), s = Ot(t[0], t[3]);
|
|
2483
|
+
return (i + o) / (2 * s);
|
|
765
2484
|
}
|
|
766
|
-
function
|
|
767
|
-
const
|
|
768
|
-
return
|
|
2485
|
+
function li(t) {
|
|
2486
|
+
const i = ee(pt(t[13]), pt(t[19])), o = ee(pt(t[0]), pt(t[6]));
|
|
2487
|
+
return i / o;
|
|
769
2488
|
}
|
|
770
|
-
function
|
|
771
|
-
const
|
|
772
|
-
return (
|
|
2489
|
+
function di(t) {
|
|
2490
|
+
const i = t.positions[30], o = t.positions[36], s = t.positions[45], u = (o.x + s.x) / 2;
|
|
2491
|
+
return (i.x - u) / (s.x - o.x) * 30;
|
|
773
2492
|
}
|
|
774
|
-
function
|
|
775
|
-
const
|
|
776
|
-
return !!(
|
|
2493
|
+
function pi(t, i) {
|
|
2494
|
+
const o = Date.now(), s = re(ne(t.getLeftEye()), i, ci, o), u = re(ne(t.getRightEye()), i, ui, o);
|
|
2495
|
+
return !!(s || u);
|
|
777
2496
|
}
|
|
778
|
-
function
|
|
779
|
-
if (
|
|
780
|
-
|
|
781
|
-
else if (
|
|
782
|
-
return
|
|
2497
|
+
function re(t, i, o, s) {
|
|
2498
|
+
if (t < i)
|
|
2499
|
+
o.consecutiveFrames++;
|
|
2500
|
+
else if (o.consecutiveFrames >= 3 && s - o.lastBlinkTime > 500)
|
|
2501
|
+
return o.lastBlinkTime = s, o.consecutiveFrames = 0, !0;
|
|
783
2502
|
return !1;
|
|
784
2503
|
}
|
|
785
|
-
function
|
|
786
|
-
return
|
|
2504
|
+
function gi(t, i) {
|
|
2505
|
+
return li(t.getMouth()) > i;
|
|
787
2506
|
}
|
|
788
|
-
function
|
|
789
|
-
const
|
|
790
|
-
return Math.abs(
|
|
2507
|
+
function xi(t, i) {
|
|
2508
|
+
const o = di(t);
|
|
2509
|
+
return Math.abs(o) > i;
|
|
791
2510
|
}
|
|
792
|
-
function
|
|
793
|
-
const
|
|
794
|
-
if (
|
|
795
|
-
|
|
796
|
-
else if (
|
|
797
|
-
const
|
|
798
|
-
if (Math.max(...
|
|
2511
|
+
function mi(t, i) {
|
|
2512
|
+
const o = ft.length, s = t.positions[33];
|
|
2513
|
+
if (o < 5)
|
|
2514
|
+
ft.push(s.y);
|
|
2515
|
+
else if (o === 5) {
|
|
2516
|
+
const u = Math.min(...ft);
|
|
2517
|
+
if (Math.max(...ft) - u > i)
|
|
799
2518
|
return !0;
|
|
800
|
-
|
|
2519
|
+
ft = [];
|
|
801
2520
|
}
|
|
802
2521
|
return !1;
|
|
803
2522
|
}
|
|
804
|
-
function
|
|
805
|
-
return new Promise((
|
|
806
|
-
const
|
|
807
|
-
|
|
808
|
-
(
|
|
809
|
-
const
|
|
810
|
-
|
|
2523
|
+
function Hi(t, i = "blob", o = 1) {
|
|
2524
|
+
return new Promise((s) => {
|
|
2525
|
+
const u = document.createElement("canvas"), f = u.getContext("2d");
|
|
2526
|
+
u.width = t.videoWidth, u.height = t.videoHeight, f == null || f.drawImage(t, 0, 0, u.width, u.height), i === "blob" ? u.toBlob(
|
|
2527
|
+
(d) => {
|
|
2528
|
+
const a = new FileReader();
|
|
2529
|
+
a.onload = () => s(a.result), a.readAsArrayBuffer(d);
|
|
811
2530
|
},
|
|
812
2531
|
"image/png",
|
|
813
|
-
|
|
814
|
-
) :
|
|
2532
|
+
o
|
|
2533
|
+
) : s(u.toDataURL("image/png", o));
|
|
815
2534
|
});
|
|
816
2535
|
}
|
|
817
|
-
async function
|
|
818
|
-
const [
|
|
819
|
-
if (!
|
|
820
|
-
const
|
|
821
|
-
for (const
|
|
822
|
-
const
|
|
823
|
-
if (!
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
}
|
|
827
|
-
return
|
|
828
|
-
}
|
|
829
|
-
const
|
|
830
|
-
encodeURIToParams:
|
|
831
|
-
paramsToQueryString:
|
|
832
|
-
queryStringToParams:
|
|
833
|
-
errorCodeToString:
|
|
834
|
-
YNToString:
|
|
835
|
-
HNToString:
|
|
836
|
-
valueToLabel:
|
|
837
|
-
chargeToLabel:
|
|
838
|
-
cascaderToLabel:
|
|
839
|
-
multipleSelectToLabel:
|
|
840
|
-
phoneToAsterisk:
|
|
841
|
-
idNumberToAsterisk:
|
|
842
|
-
firstLetterToUpperCase:
|
|
843
|
-
firstLetterToLowerCase:
|
|
844
|
-
},
|
|
845
|
-
validHttp:
|
|
846
|
-
validExternal:
|
|
847
|
-
validString:
|
|
848
|
-
validNumberStr:
|
|
849
|
-
validEmptyObject:
|
|
850
|
-
validURL:
|
|
851
|
-
validPassword:
|
|
852
|
-
validEmail:
|
|
853
|
-
validIdNumber:
|
|
854
|
-
validPhone:
|
|
855
|
-
validTel:
|
|
856
|
-
},
|
|
2536
|
+
async function Li(t, i, o, s = 5) {
|
|
2537
|
+
const [u, f, d] = ai.get(o);
|
|
2538
|
+
if (!u) return !1;
|
|
2539
|
+
const a = [], b = hi(t, i, s, d);
|
|
2540
|
+
for (const m of b) {
|
|
2541
|
+
const v = await m;
|
|
2542
|
+
if (!v) continue;
|
|
2543
|
+
const B = u(v.landmarks, f);
|
|
2544
|
+
a.push(B);
|
|
2545
|
+
}
|
|
2546
|
+
return a.includes(!0);
|
|
2547
|
+
}
|
|
2548
|
+
const Ni = { DATE_VALUE_FORMAT: yr, COMMON_TEXT: et, IMAGE_TYPE: ie, MEDIA_TYPE: oe, DOC_TYPE: se, FILE_TYPE: wr }, Yi = {
|
|
2549
|
+
encodeURIToParams: Mr,
|
|
2550
|
+
paramsToQueryString: Or,
|
|
2551
|
+
queryStringToParams: qr,
|
|
2552
|
+
errorCodeToString: Tr,
|
|
2553
|
+
YNToString: Fr,
|
|
2554
|
+
HNToString: Sr,
|
|
2555
|
+
valueToLabel: Dr,
|
|
2556
|
+
chargeToLabel: Ar,
|
|
2557
|
+
cascaderToLabel: fe,
|
|
2558
|
+
multipleSelectToLabel: Ir,
|
|
2559
|
+
phoneToAsterisk: Er,
|
|
2560
|
+
idNumberToAsterisk: Br,
|
|
2561
|
+
firstLetterToUpperCase: _r,
|
|
2562
|
+
firstLetterToLowerCase: Rr
|
|
2563
|
+
}, ki = {
|
|
2564
|
+
validHttp: ir,
|
|
2565
|
+
validExternal: or,
|
|
2566
|
+
validString: sr,
|
|
2567
|
+
validNumberStr: fr,
|
|
2568
|
+
validEmptyObject: cr,
|
|
2569
|
+
validURL: ur,
|
|
2570
|
+
validPassword: ar,
|
|
2571
|
+
validEmail: hr,
|
|
2572
|
+
validIdNumber: Pt,
|
|
2573
|
+
validPhone: dr,
|
|
2574
|
+
validTel: lr
|
|
2575
|
+
}, Vi = { scrollTo: Un, addClass: tr, removeClass: er, hasClass: Ct, toggleClass: Qn, noContextmenu: rr, useRafThrottle: nr }, $i = { parseTime: xt, getTimeDistance: Wn, getDayRange: Jn }, ji = { local: Kn, session: Xn }, Ui = { uuid: Gn, randomNum: Zn };
|
|
857
2576
|
export {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
2577
|
+
Ni as CONSTANTS,
|
|
2578
|
+
$t as NOOP,
|
|
2579
|
+
Ai as addResizeListener,
|
|
2580
|
+
ji as cacheUtil,
|
|
2581
|
+
yi as countdownTimer,
|
|
2582
|
+
Ei as creatCancelTask,
|
|
2583
|
+
$i as dateUtil,
|
|
2584
|
+
wi as debounce,
|
|
2585
|
+
Bi as downloadFile,
|
|
2586
|
+
Vi as elementUtil,
|
|
2587
|
+
Pi as faceLivingEvent,
|
|
2588
|
+
zi as faceLivingEventHint,
|
|
2589
|
+
Si as getArrayFullUrl,
|
|
2590
|
+
Fi as getBirthdayByIdNumber,
|
|
2591
|
+
Li as getFaceGestureResult,
|
|
2592
|
+
Hi as getFaceVideoFrame,
|
|
2593
|
+
pr as getFullUrl,
|
|
2594
|
+
Ti as getGenderByIdNumber,
|
|
2595
|
+
_i as getPercentage,
|
|
2596
|
+
bi as getRandomItemInArray,
|
|
2597
|
+
Ri as loadCss,
|
|
2598
|
+
Di as loadJs,
|
|
2599
|
+
Ui as randomUtil,
|
|
2600
|
+
Ii as removeResizeListener,
|
|
2601
|
+
vi as sleep,
|
|
2602
|
+
ge as sm2Crypto,
|
|
2603
|
+
Oi as sm2Decrypt,
|
|
2604
|
+
Mi as sm2Encrypt,
|
|
2605
|
+
xe as sm4Crypto,
|
|
2606
|
+
Ci as sm4Decrypt,
|
|
2607
|
+
qi as sm4Encrypt,
|
|
2608
|
+
Yi as toUtil,
|
|
2609
|
+
gr as trimArray,
|
|
2610
|
+
ki as validUtil
|
|
886
2611
|
};
|