qsh-webview-sdk 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -1
- package/dist/index.d.ts +20 -0
- package/dist/uni-webview.es.js +1587 -197
- package/dist/uni-webview.es.js.map +1 -1
- package/dist/uni-webview.umd.js +1 -1
- package/dist/uni-webview.umd.js.map +1 -1
- package/package.json +4 -1
package/dist/uni-webview.es.js
CHANGED
|
@@ -1,339 +1,1729 @@
|
|
|
1
|
-
function
|
|
2
|
-
return window.wx && window.wx.miniProgram
|
|
1
|
+
function qt() {
|
|
2
|
+
return !!(typeof window != "undefined" && window.__wxjs_environment === "miniprogram" || typeof window != "undefined" && window.wx && window.wx.miniProgram || /micromessenger/i.test(navigator.userAgent) && /miniProgram/i.test(navigator.userAgent));
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function At() {
|
|
5
5
|
return typeof window.plus != "undefined";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function _t() {
|
|
8
8
|
return window.__dcloud_weex_postMessage || window.__dcloud_weex_;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function Ot() {
|
|
11
11
|
return window.__uniapp_x_postMessage || window.__uniapp_x_;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function te() {
|
|
14
14
|
return /uni-app/i.test(navigator.userAgent);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function ee() {
|
|
17
17
|
return /Html5Plus/i.test(navigator.userAgent);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
const
|
|
23
|
-
isWeixinMiniProgram:
|
|
24
|
-
isAppPlus:
|
|
25
|
-
isNvue:
|
|
26
|
-
isUvue:
|
|
27
|
-
isUniApp:
|
|
28
|
-
isHtml5Plus:
|
|
29
|
-
type:
|
|
30
|
-
},
|
|
31
|
-
function
|
|
19
|
+
function Tr() {
|
|
20
|
+
return Ot() ? "uvue" : _t() ? "nvue" : qt() ? "weixin" : At() ? "plus" : "h5";
|
|
21
|
+
}
|
|
22
|
+
const re = {
|
|
23
|
+
isWeixinMiniProgram: qt(),
|
|
24
|
+
isAppPlus: At(),
|
|
25
|
+
isNvue: _t(),
|
|
26
|
+
isUvue: Ot(),
|
|
27
|
+
isUniApp: te(),
|
|
28
|
+
isHtml5Plus: ee(),
|
|
29
|
+
type: Tr()
|
|
30
|
+
}, ie = /complete|loaded|interactive/;
|
|
31
|
+
function Fr() {
|
|
32
32
|
window.UniAppJSBridge = !0, document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady", {
|
|
33
33
|
bubbles: !0,
|
|
34
34
|
cancelable: !0
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function Br(u) {
|
|
38
|
+
return te() || ee() ? (window.__uniapp_x_postMessage || window.__uniapp_x_ || window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? document.addEventListener("DOMContentLoaded", u) : window.plus && ie.test(document.readyState) ? setTimeout(u, 0) : document.addEventListener("plusready", u), !0) : !1;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return window.wx && window.wx.miniProgram ? (window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(
|
|
40
|
+
function Er(u) {
|
|
41
|
+
return window.wx && window.wx.miniProgram ? (window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(u, 0) : document.addEventListener("WeixinJSBridgeReady", u), !0) : !1;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
43
|
+
function Pr(u) {
|
|
44
|
+
return Br(u) || Er(u) || (ie.test(document.readyState) ? setTimeout(u, 0) : document.addEventListener("DOMContentLoaded", u)), !0;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return new Promise((
|
|
48
|
-
window.UniAppJSBridge ?
|
|
46
|
+
function Sr() {
|
|
47
|
+
return new Promise((u) => {
|
|
48
|
+
window.UniAppJSBridge ? u() : document.addEventListener("UniAppJSBridgeReady", u, { once: !0 });
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
let
|
|
52
|
-
function
|
|
53
|
-
|
|
51
|
+
let Xt = !1;
|
|
52
|
+
function zt() {
|
|
53
|
+
Xt || (Xt = !0, Pr(Fr));
|
|
54
54
|
}
|
|
55
|
-
let
|
|
56
|
-
function
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
55
|
+
let yt = [];
|
|
56
|
+
function Ir() {
|
|
57
|
+
if (yt.length === 0 && window.plus) {
|
|
58
|
+
const u = plus.webview.currentWebview();
|
|
59
|
+
if (!u)
|
|
60
60
|
throw new Error("plus.webview.currentWebview() is undefined");
|
|
61
|
-
const
|
|
62
|
-
|
|
61
|
+
const h = u.parent(), A = h ? h.id : u.id;
|
|
62
|
+
yt.push(A);
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return yt;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
66
|
+
function Dr(u, h) {
|
|
67
|
+
const A = {
|
|
68
68
|
options: {
|
|
69
69
|
timestamp: +/* @__PURE__ */ new Date()
|
|
70
70
|
},
|
|
71
|
-
name:
|
|
72
|
-
arg:
|
|
71
|
+
name: u,
|
|
72
|
+
arg: h
|
|
73
73
|
};
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
return window.__uniapp_x_postMessage ? window.__uniapp_x_postMessage(
|
|
74
|
+
if (u === "postMessage") {
|
|
75
|
+
const y = { data: h };
|
|
76
|
+
return window.__uniapp_x_postMessage ? window.__uniapp_x_postMessage(y) : window.__uniapp_x_.postMessage(JSON.stringify(y));
|
|
77
77
|
}
|
|
78
|
-
const
|
|
78
|
+
const q = {
|
|
79
79
|
type: "WEB_INVOKE_APPSERVICE",
|
|
80
80
|
args: {
|
|
81
|
-
data:
|
|
82
|
-
webviewIds:
|
|
81
|
+
data: A,
|
|
82
|
+
webviewIds: yt
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
-
window.__uniapp_x_postMessage ? window.__uniapp_x_postMessageToService(
|
|
85
|
+
window.__uniapp_x_postMessage ? window.__uniapp_x_postMessageToService(q) : window.__uniapp_x_.postMessageToService(JSON.stringify(q));
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
87
|
+
function Mr(u, h) {
|
|
88
|
+
const A = {
|
|
89
89
|
options: {
|
|
90
90
|
timestamp: +/* @__PURE__ */ new Date()
|
|
91
91
|
},
|
|
92
|
-
name:
|
|
93
|
-
arg:
|
|
92
|
+
name: u,
|
|
93
|
+
arg: h
|
|
94
94
|
};
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
return window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessage(
|
|
95
|
+
if (u === "postMessage") {
|
|
96
|
+
const y = { data: [h] };
|
|
97
|
+
return window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessage(y) : window.__dcloud_weex_.postMessage(JSON.stringify(y));
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const q = {
|
|
100
100
|
type: "WEB_INVOKE_APPSERVICE",
|
|
101
101
|
args: {
|
|
102
|
-
data:
|
|
103
|
-
webviewIds:
|
|
102
|
+
data: A,
|
|
103
|
+
webviewIds: yt
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(
|
|
106
|
+
window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(q) : window.__dcloud_weex_.postMessageToService(JSON.stringify(q));
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
const
|
|
108
|
+
function Rr(u, h) {
|
|
109
|
+
const A = {
|
|
110
110
|
options: {
|
|
111
111
|
timestamp: +/* @__PURE__ */ new Date()
|
|
112
112
|
},
|
|
113
|
-
name:
|
|
114
|
-
arg:
|
|
115
|
-
},
|
|
113
|
+
name: u,
|
|
114
|
+
arg: h
|
|
115
|
+
}, q = Ir();
|
|
116
116
|
if (plus.webview.getWebviewById("__uniapp__service"))
|
|
117
117
|
plus.webview.postMessageToUniNView({
|
|
118
118
|
type: "WEB_INVOKE_APPSERVICE",
|
|
119
119
|
args: {
|
|
120
|
-
data:
|
|
121
|
-
webviewIds:
|
|
120
|
+
data: A,
|
|
121
|
+
webviewIds: q
|
|
122
122
|
}
|
|
123
123
|
}, "__uniapp__service");
|
|
124
124
|
else {
|
|
125
|
-
const
|
|
125
|
+
const y = JSON.stringify(A), n = JSON.stringify(q);
|
|
126
126
|
plus.webview.getLaunchWebview().evalJS(
|
|
127
|
-
`UniPlusBridge.subscribeHandler("WEB_INVOKE_APPSERVICE",${
|
|
127
|
+
`UniPlusBridge.subscribeHandler("WEB_INVOKE_APPSERVICE",${y},${n});`
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const
|
|
131
|
+
function qr(u, h) {
|
|
132
|
+
const A = {
|
|
133
133
|
options: {
|
|
134
134
|
timestamp: +/* @__PURE__ */ new Date()
|
|
135
135
|
},
|
|
136
|
-
name:
|
|
137
|
-
arg:
|
|
136
|
+
name: u,
|
|
137
|
+
arg: h
|
|
138
138
|
};
|
|
139
139
|
window.parent.postMessage({
|
|
140
140
|
type: "WEB_INVOKE_APPSERVICE",
|
|
141
|
-
data:
|
|
141
|
+
data: A,
|
|
142
142
|
pageId: ""
|
|
143
143
|
}, "*");
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
145
|
+
function ft(u, h) {
|
|
146
|
+
Ot() ? Dr(u, h) : _t() ? Mr(u, h) : At() ? Rr(u, h) : qr(u, h);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
const { url:
|
|
148
|
+
function Ar(u = {}) {
|
|
149
|
+
const { url: h } = u;
|
|
150
150
|
if (window.wx && window.wx.miniProgram)
|
|
151
151
|
return window.wx.miniProgram.navigateTo({
|
|
152
|
-
url:
|
|
152
|
+
url: h
|
|
153
153
|
});
|
|
154
|
-
|
|
155
|
-
url: encodeURI(
|
|
154
|
+
ft("navigateTo", {
|
|
155
|
+
url: encodeURI(h)
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
const { delta:
|
|
158
|
+
function _r(u = {}) {
|
|
159
|
+
const { delta: h = 1 } = u;
|
|
160
160
|
if (window.wx && window.wx.miniProgram)
|
|
161
161
|
return window.wx.miniProgram.navigateBack({
|
|
162
|
-
delta: parseInt(
|
|
162
|
+
delta: parseInt(h)
|
|
163
163
|
});
|
|
164
|
-
|
|
165
|
-
delta: parseInt(
|
|
164
|
+
ft("navigateBack", {
|
|
165
|
+
delta: parseInt(h)
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
const { url:
|
|
168
|
+
function Or(u = {}) {
|
|
169
|
+
const { url: h } = u;
|
|
170
170
|
if (window.wx && window.wx.miniProgram)
|
|
171
171
|
return window.wx.miniProgram.switchTab({
|
|
172
|
-
url:
|
|
172
|
+
url: h
|
|
173
173
|
});
|
|
174
|
-
|
|
175
|
-
url: encodeURI(
|
|
174
|
+
ft("switchTab", {
|
|
175
|
+
url: encodeURI(h)
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
const { url:
|
|
178
|
+
function Cr(u = {}) {
|
|
179
|
+
const { url: h } = u;
|
|
180
180
|
if (window.wx && window.wx.miniProgram)
|
|
181
181
|
return window.wx.miniProgram.reLaunch({
|
|
182
|
-
url:
|
|
182
|
+
url: h
|
|
183
183
|
});
|
|
184
|
-
|
|
185
|
-
url: encodeURI(
|
|
184
|
+
ft("reLaunch", {
|
|
185
|
+
url: encodeURI(h)
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
const { url:
|
|
188
|
+
function Vr(u = {}) {
|
|
189
|
+
const { url: h } = u;
|
|
190
190
|
if (window.wx && window.wx.miniProgram)
|
|
191
191
|
return window.wx.miniProgram.redirectTo({
|
|
192
|
-
url:
|
|
192
|
+
url: h
|
|
193
193
|
});
|
|
194
|
-
|
|
195
|
-
url: encodeURI(
|
|
194
|
+
ft("redirectTo", {
|
|
195
|
+
url: encodeURI(h)
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
function
|
|
199
|
-
const { data:
|
|
198
|
+
function Lr(u = {}) {
|
|
199
|
+
const { data: h = {} } = u;
|
|
200
200
|
if (window.wx && window.wx.miniProgram)
|
|
201
201
|
return window.wx.miniProgram.postMessage({
|
|
202
|
-
data:
|
|
202
|
+
data: h
|
|
203
203
|
});
|
|
204
|
-
|
|
204
|
+
ft("postMessage", h);
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Hr(u) {
|
|
207
207
|
if (window.wx && window.wx.miniProgram && window.wx.miniProgram.getEnv)
|
|
208
|
-
return window.wx.miniProgram.getEnv(
|
|
209
|
-
|
|
208
|
+
return window.wx.miniProgram.getEnv(u);
|
|
209
|
+
u({
|
|
210
210
|
miniprogram: !0,
|
|
211
211
|
weixin: !0
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
|
-
var
|
|
214
|
+
var ne = /* @__PURE__ */ Object.freeze({
|
|
215
215
|
__proto__: null,
|
|
216
|
-
getEnv:
|
|
217
|
-
navigateBack:
|
|
218
|
-
navigateTo:
|
|
219
|
-
postMessage:
|
|
220
|
-
reLaunch:
|
|
221
|
-
redirectTo:
|
|
222
|
-
switchTab:
|
|
216
|
+
getEnv: Hr,
|
|
217
|
+
navigateBack: _r,
|
|
218
|
+
navigateTo: Ar,
|
|
219
|
+
postMessage: Lr,
|
|
220
|
+
reLaunch: Cr,
|
|
221
|
+
redirectTo: Vr,
|
|
222
|
+
switchTab: Or
|
|
223
223
|
});
|
|
224
|
-
function
|
|
225
|
-
const { url:
|
|
226
|
-
|
|
227
|
-
url: encodeURI(
|
|
224
|
+
function Nr(u = {}) {
|
|
225
|
+
const { url: h } = u;
|
|
226
|
+
ft("navigateTo", {
|
|
227
|
+
url: encodeURI(h)
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
const { delta:
|
|
232
|
-
|
|
233
|
-
delta: parseInt(
|
|
230
|
+
function Ur(u = {}) {
|
|
231
|
+
const { delta: h = 1 } = u;
|
|
232
|
+
ft("navigateBack", {
|
|
233
|
+
delta: parseInt(h)
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
const { url:
|
|
238
|
-
|
|
239
|
-
url: encodeURI(
|
|
236
|
+
function zr(u = {}) {
|
|
237
|
+
const { url: h } = u;
|
|
238
|
+
ft("switchTab", {
|
|
239
|
+
url: encodeURI(h)
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
const { url:
|
|
244
|
-
|
|
245
|
-
url: encodeURI(
|
|
242
|
+
function Kr(u = {}) {
|
|
243
|
+
const { url: h } = u;
|
|
244
|
+
ft("reLaunch", {
|
|
245
|
+
url: encodeURI(h)
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
|
-
function
|
|
249
|
-
const { url:
|
|
250
|
-
|
|
251
|
-
url: encodeURI(
|
|
248
|
+
function Wr(u = {}) {
|
|
249
|
+
const { url: h } = u;
|
|
250
|
+
ft("redirectTo", {
|
|
251
|
+
url: encodeURI(h)
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
const { data:
|
|
256
|
-
|
|
254
|
+
function $r(u = {}) {
|
|
255
|
+
const { data: h = {} } = u;
|
|
256
|
+
ft("postMessage", h);
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
const
|
|
260
|
-
let
|
|
261
|
-
|
|
258
|
+
function Zr(u) {
|
|
259
|
+
const h = {};
|
|
260
|
+
let A = !1;
|
|
261
|
+
Ot() ? (h.uvue = !0, A = !0) : _t() ? (h.nvue = !0, A = !0) : At() && (h.plus = !0, A = !0), A ? h.app = !0 : h.h5 = !0, u(h);
|
|
262
262
|
}
|
|
263
|
-
var
|
|
263
|
+
var oe = /* @__PURE__ */ Object.freeze({
|
|
264
264
|
__proto__: null,
|
|
265
|
-
getEnv:
|
|
266
|
-
navigateBack:
|
|
267
|
-
navigateTo:
|
|
268
|
-
postMessage:
|
|
269
|
-
reLaunch:
|
|
270
|
-
redirectTo:
|
|
271
|
-
switchTab:
|
|
265
|
+
getEnv: Zr,
|
|
266
|
+
navigateBack: Ur,
|
|
267
|
+
navigateTo: Nr,
|
|
268
|
+
postMessage: $r,
|
|
269
|
+
reLaunch: Kr,
|
|
270
|
+
redirectTo: Wr,
|
|
271
|
+
switchTab: zr
|
|
272
272
|
});
|
|
273
|
-
function
|
|
274
|
-
return
|
|
273
|
+
function Tt() {
|
|
274
|
+
return qt() ? ne : oe;
|
|
275
|
+
}
|
|
276
|
+
function se(u) {
|
|
277
|
+
return Tt().navigateTo(u);
|
|
275
278
|
}
|
|
276
|
-
function
|
|
277
|
-
return
|
|
279
|
+
function ae(u) {
|
|
280
|
+
return Tt().navigateBack(u);
|
|
278
281
|
}
|
|
279
|
-
function
|
|
280
|
-
return
|
|
282
|
+
function fe(u) {
|
|
283
|
+
return Tt().switchTab(u);
|
|
281
284
|
}
|
|
282
|
-
function
|
|
283
|
-
return
|
|
285
|
+
function ue(u) {
|
|
286
|
+
return Tt().reLaunch(u);
|
|
284
287
|
}
|
|
285
|
-
function
|
|
286
|
-
return
|
|
288
|
+
function he(u) {
|
|
289
|
+
return Tt().redirectTo(u);
|
|
287
290
|
}
|
|
288
|
-
function
|
|
289
|
-
return
|
|
291
|
+
function ce() {
|
|
292
|
+
return qt() ? ne : oe;
|
|
290
293
|
}
|
|
291
|
-
function
|
|
292
|
-
return
|
|
294
|
+
function le(u = {}) {
|
|
295
|
+
return ce().postMessage(u);
|
|
293
296
|
}
|
|
294
|
-
function
|
|
295
|
-
return
|
|
297
|
+
function pe(u) {
|
|
298
|
+
return ce().getEnv(u);
|
|
299
|
+
}
|
|
300
|
+
var Ut = { exports: {} }, Rt = { exports: {} }, Jr = Rt.exports, kt;
|
|
301
|
+
function Gr() {
|
|
302
|
+
return kt || (kt = 1, function(u, h) {
|
|
303
|
+
(function() {
|
|
304
|
+
var A, q = 244837814094590, y = (q & 16777215) == 15715070;
|
|
305
|
+
function n(t, e, r) {
|
|
306
|
+
t != null && (typeof t == "number" ? this.fromNumber(t, e, r) : e == null && typeof t != "string" ? this.fromString(t, 256) : this.fromString(t, e));
|
|
307
|
+
}
|
|
308
|
+
function p() {
|
|
309
|
+
return new n(null);
|
|
310
|
+
}
|
|
311
|
+
function $(t, e, r, i, a, l) {
|
|
312
|
+
for (; --l >= 0; ) {
|
|
313
|
+
var b = e * this[t++] + r[i] + a;
|
|
314
|
+
a = Math.floor(b / 67108864), r[i++] = b & 67108863;
|
|
315
|
+
}
|
|
316
|
+
return a;
|
|
317
|
+
}
|
|
318
|
+
function K(t, e, r, i, a, l) {
|
|
319
|
+
for (var b = e & 32767, E = e >> 15; --l >= 0; ) {
|
|
320
|
+
var W = this[t] & 32767, X = this[t++] >> 15, at = E * W + X * b;
|
|
321
|
+
W = b * W + ((at & 32767) << 15) + r[i] + (a & 1073741823), a = (W >>> 30) + (at >>> 15) + E * X + (a >>> 30), r[i++] = W & 1073741823;
|
|
322
|
+
}
|
|
323
|
+
return a;
|
|
324
|
+
}
|
|
325
|
+
function D(t, e, r, i, a, l) {
|
|
326
|
+
for (var b = e & 16383, E = e >> 14; --l >= 0; ) {
|
|
327
|
+
var W = this[t] & 16383, X = this[t++] >> 14, at = E * W + X * b;
|
|
328
|
+
W = b * W + ((at & 16383) << 14) + r[i] + a, a = (W >> 28) + (at >> 14) + E * X, r[i++] = W & 268435455;
|
|
329
|
+
}
|
|
330
|
+
return a;
|
|
331
|
+
}
|
|
332
|
+
var N = typeof navigator != "undefined";
|
|
333
|
+
N && y && navigator.appName == "Microsoft Internet Explorer" ? (n.prototype.am = K, A = 30) : N && y && navigator.appName != "Netscape" ? (n.prototype.am = $, A = 26) : (n.prototype.am = D, A = 28), n.prototype.DB = A, n.prototype.DM = (1 << A) - 1, n.prototype.DV = 1 << A;
|
|
334
|
+
var _ = 52;
|
|
335
|
+
n.prototype.FV = Math.pow(2, _), n.prototype.F1 = _ - A, n.prototype.F2 = 2 * A - _;
|
|
336
|
+
var d = "0123456789abcdefghijklmnopqrstuvwxyz", I = new Array(), c, P;
|
|
337
|
+
for (c = 48, P = 0; P <= 9; ++P) I[c++] = P;
|
|
338
|
+
for (c = 97, P = 10; P < 36; ++P) I[c++] = P;
|
|
339
|
+
for (c = 65, P = 10; P < 36; ++P) I[c++] = P;
|
|
340
|
+
function g(t) {
|
|
341
|
+
return d.charAt(t);
|
|
342
|
+
}
|
|
343
|
+
function o(t, e) {
|
|
344
|
+
var r = I[t.charCodeAt(e)];
|
|
345
|
+
return r == null ? -1 : r;
|
|
346
|
+
}
|
|
347
|
+
function M(t) {
|
|
348
|
+
for (var e = this.t - 1; e >= 0; --e) t[e] = this[e];
|
|
349
|
+
t.t = this.t, t.s = this.s;
|
|
350
|
+
}
|
|
351
|
+
function S(t) {
|
|
352
|
+
this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0;
|
|
353
|
+
}
|
|
354
|
+
function s(t) {
|
|
355
|
+
var e = p();
|
|
356
|
+
return e.fromInt(t), e;
|
|
357
|
+
}
|
|
358
|
+
function x(t, e) {
|
|
359
|
+
var r;
|
|
360
|
+
if (e == 16) r = 4;
|
|
361
|
+
else if (e == 8) r = 3;
|
|
362
|
+
else if (e == 256) r = 8;
|
|
363
|
+
else if (e == 2) r = 1;
|
|
364
|
+
else if (e == 32) r = 5;
|
|
365
|
+
else if (e == 4) r = 2;
|
|
366
|
+
else {
|
|
367
|
+
this.fromRadix(t, e);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
this.t = 0, this.s = 0;
|
|
371
|
+
for (var i = t.length, a = !1, l = 0; --i >= 0; ) {
|
|
372
|
+
var b = r == 8 ? t[i] & 255 : o(t, i);
|
|
373
|
+
if (b < 0) {
|
|
374
|
+
t.charAt(i) == "-" && (a = !0);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
a = !1, l == 0 ? this[this.t++] = b : l + r > this.DB ? (this[this.t - 1] |= (b & (1 << this.DB - l) - 1) << l, this[this.t++] = b >> this.DB - l) : this[this.t - 1] |= b << l, l += r, l >= this.DB && (l -= this.DB);
|
|
378
|
+
}
|
|
379
|
+
r == 8 && (t[0] & 128) != 0 && (this.s = -1, l > 0 && (this[this.t - 1] |= (1 << this.DB - l) - 1 << l)), this.clamp(), a && n.ZERO.subTo(this, this);
|
|
380
|
+
}
|
|
381
|
+
function T() {
|
|
382
|
+
for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; ) --this.t;
|
|
383
|
+
}
|
|
384
|
+
function f(t) {
|
|
385
|
+
if (this.s < 0) return "-" + this.negate().toString(t);
|
|
386
|
+
var e;
|
|
387
|
+
if (t == 16) e = 4;
|
|
388
|
+
else if (t == 8) e = 3;
|
|
389
|
+
else if (t == 2) e = 1;
|
|
390
|
+
else if (t == 32) e = 5;
|
|
391
|
+
else if (t == 4) e = 2;
|
|
392
|
+
else return this.toRadix(t);
|
|
393
|
+
var r = (1 << e) - 1, i, a = !1, l = "", b = this.t, E = this.DB - b * this.DB % e;
|
|
394
|
+
if (b-- > 0)
|
|
395
|
+
for (E < this.DB && (i = this[b] >> E) > 0 && (a = !0, l = g(i)); b >= 0; )
|
|
396
|
+
E < e ? (i = (this[b] & (1 << E) - 1) << e - E, i |= this[--b] >> (E += this.DB - e)) : (i = this[b] >> (E -= e) & r, E <= 0 && (E += this.DB, --b)), i > 0 && (a = !0), a && (l += g(i));
|
|
397
|
+
return a ? l : "0";
|
|
398
|
+
}
|
|
399
|
+
function w() {
|
|
400
|
+
var t = p();
|
|
401
|
+
return n.ZERO.subTo(this, t), t;
|
|
402
|
+
}
|
|
403
|
+
function v() {
|
|
404
|
+
return this.s < 0 ? this.negate() : this;
|
|
405
|
+
}
|
|
406
|
+
function m(t) {
|
|
407
|
+
var e = this.s - t.s;
|
|
408
|
+
if (e != 0) return e;
|
|
409
|
+
var r = this.t;
|
|
410
|
+
if (e = r - t.t, e != 0) return this.s < 0 ? -e : e;
|
|
411
|
+
for (; --r >= 0; ) if ((e = this[r] - t[r]) != 0) return e;
|
|
412
|
+
return 0;
|
|
413
|
+
}
|
|
414
|
+
function B(t) {
|
|
415
|
+
var e = 1, r;
|
|
416
|
+
return (r = t >>> 16) != 0 && (t = r, e += 16), (r = t >> 8) != 0 && (t = r, e += 8), (r = t >> 4) != 0 && (t = r, e += 4), (r = t >> 2) != 0 && (t = r, e += 2), (r = t >> 1) != 0 && (t = r, e += 1), e;
|
|
417
|
+
}
|
|
418
|
+
function F() {
|
|
419
|
+
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + B(this[this.t - 1] ^ this.s & this.DM);
|
|
420
|
+
}
|
|
421
|
+
function C(t, e) {
|
|
422
|
+
var r;
|
|
423
|
+
for (r = this.t - 1; r >= 0; --r) e[r + t] = this[r];
|
|
424
|
+
for (r = t - 1; r >= 0; --r) e[r] = 0;
|
|
425
|
+
e.t = this.t + t, e.s = this.s;
|
|
426
|
+
}
|
|
427
|
+
function R(t, e) {
|
|
428
|
+
for (var r = t; r < this.t; ++r) e[r - t] = this[r];
|
|
429
|
+
e.t = Math.max(this.t - t, 0), e.s = this.s;
|
|
430
|
+
}
|
|
431
|
+
function O(t, e) {
|
|
432
|
+
var r = t % this.DB, i = this.DB - r, a = (1 << i) - 1, l = Math.floor(t / this.DB), b = this.s << r & this.DM, E;
|
|
433
|
+
for (E = this.t - 1; E >= 0; --E)
|
|
434
|
+
e[E + l + 1] = this[E] >> i | b, b = (this[E] & a) << r;
|
|
435
|
+
for (E = l - 1; E >= 0; --E) e[E] = 0;
|
|
436
|
+
e[l] = b, e.t = this.t + l + 1, e.s = this.s, e.clamp();
|
|
437
|
+
}
|
|
438
|
+
function U(t, e) {
|
|
439
|
+
e.s = this.s;
|
|
440
|
+
var r = Math.floor(t / this.DB);
|
|
441
|
+
if (r >= this.t) {
|
|
442
|
+
e.t = 0;
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
var i = t % this.DB, a = this.DB - i, l = (1 << i) - 1;
|
|
446
|
+
e[0] = this[r] >> i;
|
|
447
|
+
for (var b = r + 1; b < this.t; ++b)
|
|
448
|
+
e[b - r - 1] |= (this[b] & l) << a, e[b - r] = this[b] >> i;
|
|
449
|
+
i > 0 && (e[this.t - r - 1] |= (this.s & l) << a), e.t = this.t - r, e.clamp();
|
|
450
|
+
}
|
|
451
|
+
function H(t, e) {
|
|
452
|
+
for (var r = 0, i = 0, a = Math.min(t.t, this.t); r < a; )
|
|
453
|
+
i += this[r] - t[r], e[r++] = i & this.DM, i >>= this.DB;
|
|
454
|
+
if (t.t < this.t) {
|
|
455
|
+
for (i -= t.s; r < this.t; )
|
|
456
|
+
i += this[r], e[r++] = i & this.DM, i >>= this.DB;
|
|
457
|
+
i += this.s;
|
|
458
|
+
} else {
|
|
459
|
+
for (i += this.s; r < t.t; )
|
|
460
|
+
i -= t[r], e[r++] = i & this.DM, i >>= this.DB;
|
|
461
|
+
i -= t.s;
|
|
462
|
+
}
|
|
463
|
+
e.s = i < 0 ? -1 : 0, i < -1 ? e[r++] = this.DV + i : i > 0 && (e[r++] = i), e.t = r, e.clamp();
|
|
464
|
+
}
|
|
465
|
+
function V(t, e) {
|
|
466
|
+
var r = this.abs(), i = t.abs(), a = r.t;
|
|
467
|
+
for (e.t = a + i.t; --a >= 0; ) e[a] = 0;
|
|
468
|
+
for (a = 0; a < i.t; ++a) e[a + r.t] = r.am(0, i[a], e, a, 0, r.t);
|
|
469
|
+
e.s = 0, e.clamp(), this.s != t.s && n.ZERO.subTo(e, e);
|
|
470
|
+
}
|
|
471
|
+
function L(t) {
|
|
472
|
+
for (var e = this.abs(), r = t.t = 2 * e.t; --r >= 0; ) t[r] = 0;
|
|
473
|
+
for (r = 0; r < e.t - 1; ++r) {
|
|
474
|
+
var i = e.am(r, e[r], t, 2 * r, 0, 1);
|
|
475
|
+
(t[r + e.t] += e.am(r + 1, 2 * e[r], t, 2 * r + 1, i, e.t - r - 1)) >= e.DV && (t[r + e.t] -= e.DV, t[r + e.t + 1] = 1);
|
|
476
|
+
}
|
|
477
|
+
t.t > 0 && (t[t.t - 1] += e.am(r, e[r], t, 2 * r, 0, 1)), t.s = 0, t.clamp();
|
|
478
|
+
}
|
|
479
|
+
function Z(t, e, r) {
|
|
480
|
+
var i = t.abs();
|
|
481
|
+
if (!(i.t <= 0)) {
|
|
482
|
+
var a = this.abs();
|
|
483
|
+
if (a.t < i.t) {
|
|
484
|
+
e != null && e.fromInt(0), r != null && this.copyTo(r);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
r == null && (r = p());
|
|
488
|
+
var l = p(), b = this.s, E = t.s, W = this.DB - B(i[i.t - 1]);
|
|
489
|
+
W > 0 ? (i.lShiftTo(W, l), a.lShiftTo(W, r)) : (i.copyTo(l), a.copyTo(r));
|
|
490
|
+
var X = l.t, at = l[X - 1];
|
|
491
|
+
if (at != 0) {
|
|
492
|
+
var ot = at * (1 << this.F1) + (X > 1 ? l[X - 2] >> this.F2 : 0), pt = this.FV / ot, Dt = (1 << this.F1) / ot, ct = 1 << this.F2, lt = r.t, Mt = lt - X, vt = e == null ? p() : e;
|
|
493
|
+
for (l.dlShiftTo(Mt, vt), r.compareTo(vt) >= 0 && (r[r.t++] = 1, r.subTo(vt, r)), n.ONE.dlShiftTo(X, vt), vt.subTo(l, l); l.t < X; ) l[l.t++] = 0;
|
|
494
|
+
for (; --Mt >= 0; ) {
|
|
495
|
+
var Nt = r[--lt] == at ? this.DM : Math.floor(r[lt] * pt + (r[lt - 1] + ct) * Dt);
|
|
496
|
+
if ((r[lt] += l.am(0, Nt, r, Mt, 0, X)) < Nt)
|
|
497
|
+
for (l.dlShiftTo(Mt, vt), r.subTo(vt, r); r[lt] < --Nt; ) r.subTo(vt, r);
|
|
498
|
+
}
|
|
499
|
+
e != null && (r.drShiftTo(X, e), b != E && n.ZERO.subTo(e, e)), r.t = X, r.clamp(), W > 0 && r.rShiftTo(W, r), b < 0 && n.ZERO.subTo(r, r);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function J(t) {
|
|
504
|
+
var e = p();
|
|
505
|
+
return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(n.ZERO) > 0 && t.subTo(e, e), e;
|
|
506
|
+
}
|
|
507
|
+
function z(t) {
|
|
508
|
+
this.m = t;
|
|
509
|
+
}
|
|
510
|
+
function k(t) {
|
|
511
|
+
return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t;
|
|
512
|
+
}
|
|
513
|
+
function G(t) {
|
|
514
|
+
return t;
|
|
515
|
+
}
|
|
516
|
+
function Q(t) {
|
|
517
|
+
t.divRemTo(this.m, null, t);
|
|
518
|
+
}
|
|
519
|
+
function tt(t, e, r) {
|
|
520
|
+
t.multiplyTo(e, r), this.reduce(r);
|
|
521
|
+
}
|
|
522
|
+
function rt(t, e) {
|
|
523
|
+
t.squareTo(e), this.reduce(e);
|
|
524
|
+
}
|
|
525
|
+
z.prototype.convert = k, z.prototype.revert = G, z.prototype.reduce = Q, z.prototype.mulTo = tt, z.prototype.sqrTo = rt;
|
|
526
|
+
function st() {
|
|
527
|
+
if (this.t < 1) return 0;
|
|
528
|
+
var t = this[0];
|
|
529
|
+
if ((t & 1) == 0) return 0;
|
|
530
|
+
var e = t & 3;
|
|
531
|
+
return e = e * (2 - (t & 15) * e) & 15, e = e * (2 - (t & 255) * e) & 255, e = e * (2 - ((t & 65535) * e & 65535)) & 65535, e = e * (2 - t * e % this.DV) % this.DV, e > 0 ? this.DV - e : -e;
|
|
532
|
+
}
|
|
533
|
+
function ut(t) {
|
|
534
|
+
this.m = t, this.mp = t.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t;
|
|
535
|
+
}
|
|
536
|
+
function gt(t) {
|
|
537
|
+
var e = p();
|
|
538
|
+
return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(n.ZERO) > 0 && this.m.subTo(e, e), e;
|
|
539
|
+
}
|
|
540
|
+
function Ft(t) {
|
|
541
|
+
var e = p();
|
|
542
|
+
return t.copyTo(e), this.reduce(e), e;
|
|
543
|
+
}
|
|
544
|
+
function Bt(t) {
|
|
545
|
+
for (; t.t <= this.mt2; )
|
|
546
|
+
t[t.t++] = 0;
|
|
547
|
+
for (var e = 0; e < this.m.t; ++e) {
|
|
548
|
+
var r = t[e] & 32767, i = r * this.mpl + ((r * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
|
|
549
|
+
for (r = e + this.m.t, t[r] += this.m.am(0, i, t, e, 0, this.m.t); t[r] >= t.DV; )
|
|
550
|
+
t[r] -= t.DV, t[++r]++;
|
|
551
|
+
}
|
|
552
|
+
t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t);
|
|
553
|
+
}
|
|
554
|
+
function Et(t, e) {
|
|
555
|
+
t.squareTo(e), this.reduce(e);
|
|
556
|
+
}
|
|
557
|
+
function Pt(t, e, r) {
|
|
558
|
+
t.multiplyTo(e, r), this.reduce(r);
|
|
559
|
+
}
|
|
560
|
+
ut.prototype.convert = gt, ut.prototype.revert = Ft, ut.prototype.reduce = Bt, ut.prototype.mulTo = Pt, ut.prototype.sqrTo = Et;
|
|
561
|
+
function it() {
|
|
562
|
+
return (this.t > 0 ? this[0] & 1 : this.s) == 0;
|
|
563
|
+
}
|
|
564
|
+
function St(t, e) {
|
|
565
|
+
if (t > 4294967295 || t < 1) return n.ONE;
|
|
566
|
+
var r = p(), i = p(), a = e.convert(this), l = B(t) - 1;
|
|
567
|
+
for (a.copyTo(r); --l >= 0; )
|
|
568
|
+
if (e.sqrTo(r, i), (t & 1 << l) > 0) e.mulTo(i, a, r);
|
|
569
|
+
else {
|
|
570
|
+
var b = r;
|
|
571
|
+
r = i, i = b;
|
|
572
|
+
}
|
|
573
|
+
return e.revert(r);
|
|
574
|
+
}
|
|
575
|
+
function mt(t, e) {
|
|
576
|
+
var r;
|
|
577
|
+
return t < 256 || e.isEven() ? r = new z(e) : r = new ut(e), this.exp(t, r);
|
|
578
|
+
}
|
|
579
|
+
n.prototype.copyTo = M, n.prototype.fromInt = S, n.prototype.fromString = x, n.prototype.clamp = T, n.prototype.dlShiftTo = C, n.prototype.drShiftTo = R, n.prototype.lShiftTo = O, n.prototype.rShiftTo = U, n.prototype.subTo = H, n.prototype.multiplyTo = V, n.prototype.squareTo = L, n.prototype.divRemTo = Z, n.prototype.invDigit = st, n.prototype.isEven = it, n.prototype.exp = St, n.prototype.toString = f, n.prototype.negate = w, n.prototype.abs = v, n.prototype.compareTo = m, n.prototype.bitLength = F, n.prototype.mod = J, n.prototype.modPowInt = mt, n.ZERO = s(0), n.ONE = s(1);
|
|
580
|
+
function Ct() {
|
|
581
|
+
var t = p();
|
|
582
|
+
return this.copyTo(t), t;
|
|
583
|
+
}
|
|
584
|
+
function xt() {
|
|
585
|
+
if (this.s < 0) {
|
|
586
|
+
if (this.t == 1) return this[0] - this.DV;
|
|
587
|
+
if (this.t == 0) return -1;
|
|
588
|
+
} else {
|
|
589
|
+
if (this.t == 1) return this[0];
|
|
590
|
+
if (this.t == 0) return 0;
|
|
591
|
+
}
|
|
592
|
+
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
|
|
593
|
+
}
|
|
594
|
+
function ve() {
|
|
595
|
+
return this.t == 0 ? this.s : this[0] << 24 >> 24;
|
|
596
|
+
}
|
|
597
|
+
function de() {
|
|
598
|
+
return this.t == 0 ? this.s : this[0] << 16 >> 16;
|
|
599
|
+
}
|
|
600
|
+
function xe(t) {
|
|
601
|
+
return Math.floor(Math.LN2 * this.DB / Math.log(t));
|
|
602
|
+
}
|
|
603
|
+
function ge() {
|
|
604
|
+
return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
|
|
605
|
+
}
|
|
606
|
+
function me(t) {
|
|
607
|
+
if (t == null && (t = 10), this.signum() == 0 || t < 2 || t > 36) return "0";
|
|
608
|
+
var e = this.chunkSize(t), r = Math.pow(t, e), i = s(r), a = p(), l = p(), b = "";
|
|
609
|
+
for (this.divRemTo(i, a, l); a.signum() > 0; )
|
|
610
|
+
b = (r + l.intValue()).toString(t).substr(1) + b, a.divRemTo(i, a, l);
|
|
611
|
+
return l.intValue().toString(t) + b;
|
|
612
|
+
}
|
|
613
|
+
function we(t, e) {
|
|
614
|
+
this.fromInt(0), e == null && (e = 10);
|
|
615
|
+
for (var r = this.chunkSize(e), i = Math.pow(e, r), a = !1, l = 0, b = 0, E = 0; E < t.length; ++E) {
|
|
616
|
+
var W = o(t, E);
|
|
617
|
+
if (W < 0) {
|
|
618
|
+
t.charAt(E) == "-" && this.signum() == 0 && (a = !0);
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
b = e * b + W, ++l >= r && (this.dMultiply(i), this.dAddOffset(b, 0), l = 0, b = 0);
|
|
622
|
+
}
|
|
623
|
+
l > 0 && (this.dMultiply(Math.pow(e, l)), this.dAddOffset(b, 0)), a && n.ZERO.subTo(this, this);
|
|
624
|
+
}
|
|
625
|
+
function ye(t, e, r) {
|
|
626
|
+
if (typeof e == "number")
|
|
627
|
+
if (t < 2) this.fromInt(1);
|
|
628
|
+
else
|
|
629
|
+
for (this.fromNumber(t, r), this.testBit(t - 1) || this.bitwiseTo(n.ONE.shiftLeft(t - 1), Vt, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e); )
|
|
630
|
+
this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(n.ONE.shiftLeft(t - 1), this);
|
|
631
|
+
else {
|
|
632
|
+
var i = new Array(), a = t & 7;
|
|
633
|
+
i.length = (t >> 3) + 1, e.nextBytes(i), a > 0 ? i[0] &= (1 << a) - 1 : i[0] = 0, this.fromString(i, 256);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
function be() {
|
|
637
|
+
var t = this.t, e = new Array();
|
|
638
|
+
e[0] = this.s;
|
|
639
|
+
var r = this.DB - t * this.DB % 8, i, a = 0;
|
|
640
|
+
if (t-- > 0)
|
|
641
|
+
for (r < this.DB && (i = this[t] >> r) != (this.s & this.DM) >> r && (e[a++] = i | this.s << this.DB - r); t >= 0; )
|
|
642
|
+
r < 8 ? (i = (this[t] & (1 << r) - 1) << 8 - r, i |= this[--t] >> (r += this.DB - 8)) : (i = this[t] >> (r -= 8) & 255, r <= 0 && (r += this.DB, --t)), (i & 128) != 0 && (i |= -256), a == 0 && (this.s & 128) != (i & 128) && ++a, (a > 0 || i != this.s) && (e[a++] = i);
|
|
643
|
+
return e;
|
|
644
|
+
}
|
|
645
|
+
function Te(t) {
|
|
646
|
+
return this.compareTo(t) == 0;
|
|
647
|
+
}
|
|
648
|
+
function Fe(t) {
|
|
649
|
+
return this.compareTo(t) < 0 ? this : t;
|
|
650
|
+
}
|
|
651
|
+
function Be(t) {
|
|
652
|
+
return this.compareTo(t) > 0 ? this : t;
|
|
653
|
+
}
|
|
654
|
+
function Ee(t, e, r) {
|
|
655
|
+
var i, a, l = Math.min(t.t, this.t);
|
|
656
|
+
for (i = 0; i < l; ++i) r[i] = e(this[i], t[i]);
|
|
657
|
+
if (t.t < this.t) {
|
|
658
|
+
for (a = t.s & this.DM, i = l; i < this.t; ++i) r[i] = e(this[i], a);
|
|
659
|
+
r.t = this.t;
|
|
660
|
+
} else {
|
|
661
|
+
for (a = this.s & this.DM, i = l; i < t.t; ++i) r[i] = e(a, t[i]);
|
|
662
|
+
r.t = t.t;
|
|
663
|
+
}
|
|
664
|
+
r.s = e(this.s, t.s), r.clamp();
|
|
665
|
+
}
|
|
666
|
+
function Pe(t, e) {
|
|
667
|
+
return t & e;
|
|
668
|
+
}
|
|
669
|
+
function Se(t) {
|
|
670
|
+
var e = p();
|
|
671
|
+
return this.bitwiseTo(t, Pe, e), e;
|
|
672
|
+
}
|
|
673
|
+
function Vt(t, e) {
|
|
674
|
+
return t | e;
|
|
675
|
+
}
|
|
676
|
+
function Ie(t) {
|
|
677
|
+
var e = p();
|
|
678
|
+
return this.bitwiseTo(t, Vt, e), e;
|
|
679
|
+
}
|
|
680
|
+
function Kt(t, e) {
|
|
681
|
+
return t ^ e;
|
|
682
|
+
}
|
|
683
|
+
function De(t) {
|
|
684
|
+
var e = p();
|
|
685
|
+
return this.bitwiseTo(t, Kt, e), e;
|
|
686
|
+
}
|
|
687
|
+
function Wt(t, e) {
|
|
688
|
+
return t & ~e;
|
|
689
|
+
}
|
|
690
|
+
function Me(t) {
|
|
691
|
+
var e = p();
|
|
692
|
+
return this.bitwiseTo(t, Wt, e), e;
|
|
693
|
+
}
|
|
694
|
+
function Re() {
|
|
695
|
+
for (var t = p(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e];
|
|
696
|
+
return t.t = this.t, t.s = ~this.s, t;
|
|
697
|
+
}
|
|
698
|
+
function qe(t) {
|
|
699
|
+
var e = p();
|
|
700
|
+
return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e;
|
|
701
|
+
}
|
|
702
|
+
function Ae(t) {
|
|
703
|
+
var e = p();
|
|
704
|
+
return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e;
|
|
705
|
+
}
|
|
706
|
+
function _e(t) {
|
|
707
|
+
if (t == 0) return -1;
|
|
708
|
+
var e = 0;
|
|
709
|
+
return (t & 65535) == 0 && (t >>= 16, e += 16), (t & 255) == 0 && (t >>= 8, e += 8), (t & 15) == 0 && (t >>= 4, e += 4), (t & 3) == 0 && (t >>= 2, e += 2), (t & 1) == 0 && ++e, e;
|
|
710
|
+
}
|
|
711
|
+
function Oe() {
|
|
712
|
+
for (var t = 0; t < this.t; ++t)
|
|
713
|
+
if (this[t] != 0) return t * this.DB + _e(this[t]);
|
|
714
|
+
return this.s < 0 ? this.t * this.DB : -1;
|
|
715
|
+
}
|
|
716
|
+
function Ce(t) {
|
|
717
|
+
for (var e = 0; t != 0; )
|
|
718
|
+
t &= t - 1, ++e;
|
|
719
|
+
return e;
|
|
720
|
+
}
|
|
721
|
+
function Ve() {
|
|
722
|
+
for (var t = 0, e = this.s & this.DM, r = 0; r < this.t; ++r) t += Ce(this[r] ^ e);
|
|
723
|
+
return t;
|
|
724
|
+
}
|
|
725
|
+
function Le(t) {
|
|
726
|
+
var e = Math.floor(t / this.DB);
|
|
727
|
+
return e >= this.t ? this.s != 0 : (this[e] & 1 << t % this.DB) != 0;
|
|
728
|
+
}
|
|
729
|
+
function He(t, e) {
|
|
730
|
+
var r = n.ONE.shiftLeft(t);
|
|
731
|
+
return this.bitwiseTo(r, e, r), r;
|
|
732
|
+
}
|
|
733
|
+
function Ne(t) {
|
|
734
|
+
return this.changeBit(t, Vt);
|
|
735
|
+
}
|
|
736
|
+
function Ue(t) {
|
|
737
|
+
return this.changeBit(t, Wt);
|
|
738
|
+
}
|
|
739
|
+
function ze(t) {
|
|
740
|
+
return this.changeBit(t, Kt);
|
|
741
|
+
}
|
|
742
|
+
function Ke(t, e) {
|
|
743
|
+
for (var r = 0, i = 0, a = Math.min(t.t, this.t); r < a; )
|
|
744
|
+
i += this[r] + t[r], e[r++] = i & this.DM, i >>= this.DB;
|
|
745
|
+
if (t.t < this.t) {
|
|
746
|
+
for (i += t.s; r < this.t; )
|
|
747
|
+
i += this[r], e[r++] = i & this.DM, i >>= this.DB;
|
|
748
|
+
i += this.s;
|
|
749
|
+
} else {
|
|
750
|
+
for (i += this.s; r < t.t; )
|
|
751
|
+
i += t[r], e[r++] = i & this.DM, i >>= this.DB;
|
|
752
|
+
i += t.s;
|
|
753
|
+
}
|
|
754
|
+
e.s = i < 0 ? -1 : 0, i > 0 ? e[r++] = i : i < -1 && (e[r++] = this.DV + i), e.t = r, e.clamp();
|
|
755
|
+
}
|
|
756
|
+
function We(t) {
|
|
757
|
+
var e = p();
|
|
758
|
+
return this.addTo(t, e), e;
|
|
759
|
+
}
|
|
760
|
+
function $e(t) {
|
|
761
|
+
var e = p();
|
|
762
|
+
return this.subTo(t, e), e;
|
|
763
|
+
}
|
|
764
|
+
function Ze(t) {
|
|
765
|
+
var e = p();
|
|
766
|
+
return this.multiplyTo(t, e), e;
|
|
767
|
+
}
|
|
768
|
+
function Je() {
|
|
769
|
+
var t = p();
|
|
770
|
+
return this.squareTo(t), t;
|
|
771
|
+
}
|
|
772
|
+
function Ge(t) {
|
|
773
|
+
var e = p();
|
|
774
|
+
return this.divRemTo(t, e, null), e;
|
|
775
|
+
}
|
|
776
|
+
function Ye(t) {
|
|
777
|
+
var e = p();
|
|
778
|
+
return this.divRemTo(t, null, e), e;
|
|
779
|
+
}
|
|
780
|
+
function Xe(t) {
|
|
781
|
+
var e = p(), r = p();
|
|
782
|
+
return this.divRemTo(t, e, r), new Array(e, r);
|
|
783
|
+
}
|
|
784
|
+
function ke(t) {
|
|
785
|
+
this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp();
|
|
786
|
+
}
|
|
787
|
+
function Qe(t, e) {
|
|
788
|
+
if (t != 0) {
|
|
789
|
+
for (; this.t <= e; ) this[this.t++] = 0;
|
|
790
|
+
for (this[e] += t; this[e] >= this.DV; )
|
|
791
|
+
this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e];
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
function wt() {
|
|
795
|
+
}
|
|
796
|
+
function $t(t) {
|
|
797
|
+
return t;
|
|
798
|
+
}
|
|
799
|
+
function je(t, e, r) {
|
|
800
|
+
t.multiplyTo(e, r);
|
|
801
|
+
}
|
|
802
|
+
function tr(t, e) {
|
|
803
|
+
t.squareTo(e);
|
|
804
|
+
}
|
|
805
|
+
wt.prototype.convert = $t, wt.prototype.revert = $t, wt.prototype.mulTo = je, wt.prototype.sqrTo = tr;
|
|
806
|
+
function er(t) {
|
|
807
|
+
return this.exp(t, new wt());
|
|
808
|
+
}
|
|
809
|
+
function rr(t, e, r) {
|
|
810
|
+
var i = Math.min(this.t + t.t, e);
|
|
811
|
+
for (r.s = 0, r.t = i; i > 0; ) r[--i] = 0;
|
|
812
|
+
var a;
|
|
813
|
+
for (a = r.t - this.t; i < a; ++i) r[i + this.t] = this.am(0, t[i], r, i, 0, this.t);
|
|
814
|
+
for (a = Math.min(t.t, e); i < a; ++i) this.am(0, t[i], r, i, 0, e - i);
|
|
815
|
+
r.clamp();
|
|
816
|
+
}
|
|
817
|
+
function ir(t, e, r) {
|
|
818
|
+
--e;
|
|
819
|
+
var i = r.t = this.t + t.t - e;
|
|
820
|
+
for (r.s = 0; --i >= 0; ) r[i] = 0;
|
|
821
|
+
for (i = Math.max(e - this.t, 0); i < t.t; ++i)
|
|
822
|
+
r[this.t + i - e] = this.am(e - i, t[i], r, 0, 0, this.t + i - e);
|
|
823
|
+
r.clamp(), r.drShiftTo(1, r);
|
|
824
|
+
}
|
|
825
|
+
function dt(t) {
|
|
826
|
+
this.r2 = p(), this.q3 = p(), n.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t), this.m = t;
|
|
827
|
+
}
|
|
828
|
+
function nr(t) {
|
|
829
|
+
if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m);
|
|
830
|
+
if (t.compareTo(this.m) < 0) return t;
|
|
831
|
+
var e = p();
|
|
832
|
+
return t.copyTo(e), this.reduce(e), e;
|
|
833
|
+
}
|
|
834
|
+
function or(t) {
|
|
835
|
+
return t;
|
|
836
|
+
}
|
|
837
|
+
function sr(t) {
|
|
838
|
+
for (t.drShiftTo(this.m.t - 1, this.r2), t.t > this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0; ) t.dAddOffset(1, this.m.t + 1);
|
|
839
|
+
for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0; ) t.subTo(this.m, t);
|
|
840
|
+
}
|
|
841
|
+
function ar(t, e) {
|
|
842
|
+
t.squareTo(e), this.reduce(e);
|
|
843
|
+
}
|
|
844
|
+
function fr(t, e, r) {
|
|
845
|
+
t.multiplyTo(e, r), this.reduce(r);
|
|
846
|
+
}
|
|
847
|
+
dt.prototype.convert = nr, dt.prototype.revert = or, dt.prototype.reduce = sr, dt.prototype.mulTo = fr, dt.prototype.sqrTo = ar;
|
|
848
|
+
function ur(t, e) {
|
|
849
|
+
var r = t.bitLength(), i, a = s(1), l;
|
|
850
|
+
if (r <= 0) return a;
|
|
851
|
+
r < 18 ? i = 1 : r < 48 ? i = 3 : r < 144 ? i = 4 : r < 768 ? i = 5 : i = 6, r < 8 ? l = new z(e) : e.isEven() ? l = new dt(e) : l = new ut(e);
|
|
852
|
+
var b = new Array(), E = 3, W = i - 1, X = (1 << i) - 1;
|
|
853
|
+
if (b[1] = l.convert(this), i > 1) {
|
|
854
|
+
var at = p();
|
|
855
|
+
for (l.sqrTo(b[1], at); E <= X; )
|
|
856
|
+
b[E] = p(), l.mulTo(at, b[E - 2], b[E]), E += 2;
|
|
857
|
+
}
|
|
858
|
+
var ot = t.t - 1, pt, Dt = !0, ct = p(), lt;
|
|
859
|
+
for (r = B(t[ot]) - 1; ot >= 0; ) {
|
|
860
|
+
for (r >= W ? pt = t[ot] >> r - W & X : (pt = (t[ot] & (1 << r + 1) - 1) << W - r, ot > 0 && (pt |= t[ot - 1] >> this.DB + r - W)), E = i; (pt & 1) == 0; )
|
|
861
|
+
pt >>= 1, --E;
|
|
862
|
+
if ((r -= E) < 0 && (r += this.DB, --ot), Dt)
|
|
863
|
+
b[pt].copyTo(a), Dt = !1;
|
|
864
|
+
else {
|
|
865
|
+
for (; E > 1; )
|
|
866
|
+
l.sqrTo(a, ct), l.sqrTo(ct, a), E -= 2;
|
|
867
|
+
E > 0 ? l.sqrTo(a, ct) : (lt = a, a = ct, ct = lt), l.mulTo(ct, b[pt], a);
|
|
868
|
+
}
|
|
869
|
+
for (; ot >= 0 && (t[ot] & 1 << r) == 0; )
|
|
870
|
+
l.sqrTo(a, ct), lt = a, a = ct, ct = lt, --r < 0 && (r = this.DB - 1, --ot);
|
|
871
|
+
}
|
|
872
|
+
return l.revert(a);
|
|
873
|
+
}
|
|
874
|
+
function hr(t) {
|
|
875
|
+
var e = this.s < 0 ? this.negate() : this.clone(), r = t.s < 0 ? t.negate() : t.clone();
|
|
876
|
+
if (e.compareTo(r) < 0) {
|
|
877
|
+
var i = e;
|
|
878
|
+
e = r, r = i;
|
|
879
|
+
}
|
|
880
|
+
var a = e.getLowestSetBit(), l = r.getLowestSetBit();
|
|
881
|
+
if (l < 0) return e;
|
|
882
|
+
for (a < l && (l = a), l > 0 && (e.rShiftTo(l, e), r.rShiftTo(l, r)); e.signum() > 0; )
|
|
883
|
+
(a = e.getLowestSetBit()) > 0 && e.rShiftTo(a, e), (a = r.getLowestSetBit()) > 0 && r.rShiftTo(a, r), e.compareTo(r) >= 0 ? (e.subTo(r, e), e.rShiftTo(1, e)) : (r.subTo(e, r), r.rShiftTo(1, r));
|
|
884
|
+
return l > 0 && r.lShiftTo(l, r), r;
|
|
885
|
+
}
|
|
886
|
+
function cr(t) {
|
|
887
|
+
if (t <= 0) return 0;
|
|
888
|
+
var e = this.DV % t, r = this.s < 0 ? t - 1 : 0;
|
|
889
|
+
if (this.t > 0)
|
|
890
|
+
if (e == 0) r = this[0] % t;
|
|
891
|
+
else for (var i = this.t - 1; i >= 0; --i) r = (e * r + this[i]) % t;
|
|
892
|
+
return r;
|
|
893
|
+
}
|
|
894
|
+
function lr(t) {
|
|
895
|
+
var e = t.isEven();
|
|
896
|
+
if (this.isEven() && e || t.signum() == 0) return n.ZERO;
|
|
897
|
+
for (var r = t.clone(), i = this.clone(), a = s(1), l = s(0), b = s(0), E = s(1); r.signum() != 0; ) {
|
|
898
|
+
for (; r.isEven(); )
|
|
899
|
+
r.rShiftTo(1, r), e ? ((!a.isEven() || !l.isEven()) && (a.addTo(this, a), l.subTo(t, l)), a.rShiftTo(1, a)) : l.isEven() || l.subTo(t, l), l.rShiftTo(1, l);
|
|
900
|
+
for (; i.isEven(); )
|
|
901
|
+
i.rShiftTo(1, i), e ? ((!b.isEven() || !E.isEven()) && (b.addTo(this, b), E.subTo(t, E)), b.rShiftTo(1, b)) : E.isEven() || E.subTo(t, E), E.rShiftTo(1, E);
|
|
902
|
+
r.compareTo(i) >= 0 ? (r.subTo(i, r), e && a.subTo(b, a), l.subTo(E, l)) : (i.subTo(r, i), e && b.subTo(a, b), E.subTo(l, E));
|
|
903
|
+
}
|
|
904
|
+
if (i.compareTo(n.ONE) != 0) return n.ZERO;
|
|
905
|
+
if (E.compareTo(t) >= 0) return E.subtract(t);
|
|
906
|
+
if (E.signum() < 0) E.addTo(t, E);
|
|
907
|
+
else return E;
|
|
908
|
+
return E.signum() < 0 ? E.add(t) : E;
|
|
909
|
+
}
|
|
910
|
+
var et = [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], pr = (1 << 26) / et[et.length - 1];
|
|
911
|
+
function vr(t) {
|
|
912
|
+
var e, r = this.abs();
|
|
913
|
+
if (r.t == 1 && r[0] <= et[et.length - 1]) {
|
|
914
|
+
for (e = 0; e < et.length; ++e)
|
|
915
|
+
if (r[0] == et[e]) return !0;
|
|
916
|
+
return !1;
|
|
917
|
+
}
|
|
918
|
+
if (r.isEven()) return !1;
|
|
919
|
+
for (e = 1; e < et.length; ) {
|
|
920
|
+
for (var i = et[e], a = e + 1; a < et.length && i < pr; ) i *= et[a++];
|
|
921
|
+
for (i = r.modInt(i); e < a; ) if (i % et[e++] == 0) return !1;
|
|
922
|
+
}
|
|
923
|
+
return r.millerRabin(t);
|
|
924
|
+
}
|
|
925
|
+
function dr(t) {
|
|
926
|
+
var e = this.subtract(n.ONE), r = e.getLowestSetBit();
|
|
927
|
+
if (r <= 0) return !1;
|
|
928
|
+
var i = e.shiftRight(r);
|
|
929
|
+
t = t + 1 >> 1, t > et.length && (t = et.length);
|
|
930
|
+
for (var a = p(), l = 0; l < t; ++l) {
|
|
931
|
+
a.fromInt(et[Math.floor(Math.random() * et.length)]);
|
|
932
|
+
var b = a.modPow(i, this);
|
|
933
|
+
if (b.compareTo(n.ONE) != 0 && b.compareTo(e) != 0) {
|
|
934
|
+
for (var E = 1; E++ < r && b.compareTo(e) != 0; )
|
|
935
|
+
if (b = b.modPowInt(2, this), b.compareTo(n.ONE) == 0) return !1;
|
|
936
|
+
if (b.compareTo(e) != 0) return !1;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return !0;
|
|
940
|
+
}
|
|
941
|
+
n.prototype.chunkSize = xe, n.prototype.toRadix = me, n.prototype.fromRadix = we, n.prototype.fromNumber = ye, n.prototype.bitwiseTo = Ee, n.prototype.changeBit = He, n.prototype.addTo = Ke, n.prototype.dMultiply = ke, n.prototype.dAddOffset = Qe, n.prototype.multiplyLowerTo = rr, n.prototype.multiplyUpperTo = ir, n.prototype.modInt = cr, n.prototype.millerRabin = dr, n.prototype.clone = Ct, n.prototype.intValue = xt, n.prototype.byteValue = ve, n.prototype.shortValue = de, n.prototype.signum = ge, n.prototype.toByteArray = be, n.prototype.equals = Te, n.prototype.min = Fe, n.prototype.max = Be, n.prototype.and = Se, n.prototype.or = Ie, n.prototype.xor = De, n.prototype.andNot = Me, n.prototype.not = Re, n.prototype.shiftLeft = qe, n.prototype.shiftRight = Ae, n.prototype.getLowestSetBit = Oe, n.prototype.bitCount = Ve, n.prototype.testBit = Le, n.prototype.setBit = Ne, n.prototype.clearBit = Ue, n.prototype.flipBit = ze, n.prototype.add = We, n.prototype.subtract = $e, n.prototype.multiply = Ze, n.prototype.divide = Ge, n.prototype.remainder = Ye, n.prototype.divideAndRemainder = Xe, n.prototype.modPow = ur, n.prototype.modInverse = lr, n.prototype.pow = er, n.prototype.gcd = hr, n.prototype.isProbablePrime = vr, n.prototype.square = Je, n.prototype.Barrett = dt;
|
|
942
|
+
var It, nt, Y;
|
|
943
|
+
function xr(t) {
|
|
944
|
+
nt[Y++] ^= t & 255, nt[Y++] ^= t >> 8 & 255, nt[Y++] ^= t >> 16 & 255, nt[Y++] ^= t >> 24 & 255, Y >= Ht && (Y -= Ht);
|
|
945
|
+
}
|
|
946
|
+
function Zt() {
|
|
947
|
+
xr((/* @__PURE__ */ new Date()).getTime());
|
|
948
|
+
}
|
|
949
|
+
if (nt == null) {
|
|
950
|
+
nt = new Array(), Y = 0;
|
|
951
|
+
var ht;
|
|
952
|
+
if (typeof window != "undefined" && window.crypto) {
|
|
953
|
+
if (window.crypto.getRandomValues) {
|
|
954
|
+
var Jt = new Uint8Array(32);
|
|
955
|
+
for (window.crypto.getRandomValues(Jt), ht = 0; ht < 32; ++ht)
|
|
956
|
+
nt[Y++] = Jt[ht];
|
|
957
|
+
} else if (navigator.appName == "Netscape" && navigator.appVersion < "5") {
|
|
958
|
+
var Gt = window.crypto.random(32);
|
|
959
|
+
for (ht = 0; ht < Gt.length; ++ht)
|
|
960
|
+
nt[Y++] = Gt.charCodeAt(ht) & 255;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
for (; Y < Ht; )
|
|
964
|
+
ht = Math.floor(65536 * Math.random()), nt[Y++] = ht >>> 8, nt[Y++] = ht & 255;
|
|
965
|
+
Y = 0, Zt();
|
|
966
|
+
}
|
|
967
|
+
function gr() {
|
|
968
|
+
if (It == null) {
|
|
969
|
+
for (Zt(), It = br(), It.init(nt), Y = 0; Y < nt.length; ++Y)
|
|
970
|
+
nt[Y] = 0;
|
|
971
|
+
Y = 0;
|
|
972
|
+
}
|
|
973
|
+
return It.next();
|
|
974
|
+
}
|
|
975
|
+
function mr(t) {
|
|
976
|
+
var e;
|
|
977
|
+
for (e = 0; e < t.length; ++e) t[e] = gr();
|
|
978
|
+
}
|
|
979
|
+
function Yt() {
|
|
980
|
+
}
|
|
981
|
+
Yt.prototype.nextBytes = mr;
|
|
982
|
+
function Lt() {
|
|
983
|
+
this.i = 0, this.j = 0, this.S = new Array();
|
|
984
|
+
}
|
|
985
|
+
function wr(t) {
|
|
986
|
+
var e, r, i;
|
|
987
|
+
for (e = 0; e < 256; ++e)
|
|
988
|
+
this.S[e] = e;
|
|
989
|
+
for (r = 0, e = 0; e < 256; ++e)
|
|
990
|
+
r = r + this.S[e] + t[e % t.length] & 255, i = this.S[e], this.S[e] = this.S[r], this.S[r] = i;
|
|
991
|
+
this.i = 0, this.j = 0;
|
|
992
|
+
}
|
|
993
|
+
function yr() {
|
|
994
|
+
var t;
|
|
995
|
+
return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t, this.S[t + this.S[this.i] & 255];
|
|
996
|
+
}
|
|
997
|
+
Lt.prototype.init = wr, Lt.prototype.next = yr;
|
|
998
|
+
function br() {
|
|
999
|
+
return new Lt();
|
|
1000
|
+
}
|
|
1001
|
+
var Ht = 256;
|
|
1002
|
+
u.exports = {
|
|
1003
|
+
default: n,
|
|
1004
|
+
BigInteger: n,
|
|
1005
|
+
SecureRandom: Yt
|
|
1006
|
+
};
|
|
1007
|
+
}).call(Jr);
|
|
1008
|
+
}(Rt)), Rt.exports;
|
|
296
1009
|
}
|
|
297
|
-
|
|
298
|
-
|
|
1010
|
+
var Qt;
|
|
1011
|
+
function Yr() {
|
|
1012
|
+
return Qt || (Qt = 1, function(u) {
|
|
1013
|
+
u.exports = /******/
|
|
1014
|
+
function(h) {
|
|
1015
|
+
var A = {};
|
|
1016
|
+
function q(y) {
|
|
1017
|
+
if (A[y])
|
|
1018
|
+
return A[y].exports;
|
|
1019
|
+
var n = A[y] = {
|
|
1020
|
+
/******/
|
|
1021
|
+
i: y,
|
|
1022
|
+
/******/
|
|
1023
|
+
l: !1,
|
|
1024
|
+
/******/
|
|
1025
|
+
exports: {}
|
|
1026
|
+
/******/
|
|
1027
|
+
};
|
|
1028
|
+
return h[y].call(n.exports, n, n.exports, q), n.l = !0, n.exports;
|
|
1029
|
+
}
|
|
1030
|
+
return q.m = h, q.c = A, q.d = function(y, n, p) {
|
|
1031
|
+
q.o(y, n) || Object.defineProperty(y, n, { enumerable: !0, get: p });
|
|
1032
|
+
}, q.r = function(y) {
|
|
1033
|
+
typeof Symbol != "undefined" && Symbol.toStringTag && Object.defineProperty(y, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(y, "__esModule", { value: !0 });
|
|
1034
|
+
}, q.t = function(y, n) {
|
|
1035
|
+
if (n & 1 && (y = q(y)), n & 8 || n & 4 && typeof y == "object" && y && y.__esModule) return y;
|
|
1036
|
+
var p = /* @__PURE__ */ Object.create(null);
|
|
1037
|
+
if (q.r(p), Object.defineProperty(p, "default", { enumerable: !0, value: y }), n & 2 && typeof y != "string") for (var $ in y) q.d(p, $, function(K) {
|
|
1038
|
+
return y[K];
|
|
1039
|
+
}.bind(null, $));
|
|
1040
|
+
return p;
|
|
1041
|
+
}, q.n = function(y) {
|
|
1042
|
+
var n = y && y.__esModule ? (
|
|
1043
|
+
/******/
|
|
1044
|
+
function() {
|
|
1045
|
+
return y.default;
|
|
1046
|
+
}
|
|
1047
|
+
) : (
|
|
1048
|
+
/******/
|
|
1049
|
+
function() {
|
|
1050
|
+
return y;
|
|
1051
|
+
}
|
|
1052
|
+
);
|
|
1053
|
+
return q.d(n, "a", n), n;
|
|
1054
|
+
}, q.o = function(y, n) {
|
|
1055
|
+
return Object.prototype.hasOwnProperty.call(y, n);
|
|
1056
|
+
}, q.p = "", q(q.s = 2);
|
|
1057
|
+
}([
|
|
1058
|
+
/* 0 */
|
|
1059
|
+
/***/
|
|
1060
|
+
function(h, A) {
|
|
1061
|
+
h.exports = Gr();
|
|
1062
|
+
},
|
|
1063
|
+
/* 1 */
|
|
1064
|
+
/***/
|
|
1065
|
+
function(h, A, q) {
|
|
1066
|
+
var y = new Uint32Array(68), n = new Uint32Array(64);
|
|
1067
|
+
function p(g, o) {
|
|
1068
|
+
var M = o & 31;
|
|
1069
|
+
return g << M | g >>> 32 - M;
|
|
1070
|
+
}
|
|
1071
|
+
function $(g, o) {
|
|
1072
|
+
for (var M = [], S = g.length - 1; S >= 0; S--)
|
|
1073
|
+
M[S] = (g[S] ^ o[S]) & 255;
|
|
1074
|
+
return M;
|
|
1075
|
+
}
|
|
1076
|
+
function K(g) {
|
|
1077
|
+
return g ^ p(g, 9) ^ p(g, 17);
|
|
1078
|
+
}
|
|
1079
|
+
function D(g) {
|
|
1080
|
+
return g ^ p(g, 15) ^ p(g, 23);
|
|
1081
|
+
}
|
|
1082
|
+
function N(g) {
|
|
1083
|
+
var o = g.length * 8, M = o % 512;
|
|
1084
|
+
M = M >= 448 ? 512 - M % 448 - 1 : 448 - M - 1;
|
|
1085
|
+
for (var S = new Array((M - 7) / 8), s = new Array(8), x = 0, T = S.length; x < T; x++)
|
|
1086
|
+
S[x] = 0;
|
|
1087
|
+
for (var f = 0, w = s.length; f < w; f++)
|
|
1088
|
+
s[f] = 0;
|
|
1089
|
+
o = o.toString(2);
|
|
1090
|
+
for (var v = 7; v >= 0; v--)
|
|
1091
|
+
if (o.length > 8) {
|
|
1092
|
+
var m = o.length - 8;
|
|
1093
|
+
s[v] = parseInt(o.substr(m), 2), o = o.substr(0, m);
|
|
1094
|
+
} else o.length > 0 && (s[v] = parseInt(o, 2), o = "");
|
|
1095
|
+
for (var B = new Uint8Array([].concat(g, [128], S, s)), F = new DataView(B.buffer, 0), C = B.length / 64, R = new Uint32Array([1937774191, 1226093241, 388252375, 3666478592, 2842636476, 372324522, 3817729613, 2969243214]), O = 0; O < C; O++) {
|
|
1096
|
+
y.fill(0), n.fill(0);
|
|
1097
|
+
for (var U = 16 * O, H = 0; H < 16; H++)
|
|
1098
|
+
y[H] = F.getUint32((U + H) * 4, !1);
|
|
1099
|
+
for (var V = 16; V < 68; V++)
|
|
1100
|
+
y[V] = D(y[V - 16] ^ y[V - 9] ^ p(y[V - 3], 15)) ^ p(y[V - 13], 7) ^ y[V - 6];
|
|
1101
|
+
for (var L = 0; L < 64; L++)
|
|
1102
|
+
n[L] = y[L] ^ y[L + 4];
|
|
1103
|
+
for (var Z = 2043430169, J = 2055708042, z = R[0], k = R[1], G = R[2], Q = R[3], tt = R[4], rt = R[5], st = R[6], ut = R[7], gt = void 0, Ft = void 0, Bt = void 0, Et = void 0, Pt = void 0, it = 0; it < 64; it++)
|
|
1104
|
+
Pt = it >= 0 && it <= 15 ? Z : J, gt = p(p(z, 12) + tt + p(Pt, it), 7), Ft = gt ^ p(z, 12), Bt = (it >= 0 && it <= 15 ? z ^ k ^ G : z & k | z & G | k & G) + Q + Ft + n[it], Et = (it >= 0 && it <= 15 ? tt ^ rt ^ st : tt & rt | ~tt & st) + ut + gt + y[it], Q = G, G = p(k, 9), k = z, z = Bt, ut = st, st = p(rt, 19), rt = tt, tt = K(Et);
|
|
1105
|
+
R[0] ^= z, R[1] ^= k, R[2] ^= G, R[3] ^= Q, R[4] ^= tt, R[5] ^= rt, R[6] ^= st, R[7] ^= ut;
|
|
1106
|
+
}
|
|
1107
|
+
for (var St = [], mt = 0, Ct = R.length; mt < Ct; mt++) {
|
|
1108
|
+
var xt = R[mt];
|
|
1109
|
+
St.push((xt & 4278190080) >>> 24, (xt & 16711680) >>> 16, (xt & 65280) >>> 8, xt & 255);
|
|
1110
|
+
}
|
|
1111
|
+
return St;
|
|
1112
|
+
}
|
|
1113
|
+
for (var _ = 64, d = new Uint8Array(_), I = new Uint8Array(_), c = 0; c < _; c++)
|
|
1114
|
+
d[c] = 54, I[c] = 92;
|
|
1115
|
+
function P(g, o) {
|
|
1116
|
+
for (o.length > _ && (o = N(o)); o.length < _; )
|
|
1117
|
+
o.push(0);
|
|
1118
|
+
var M = $(o, d), S = $(o, I), s = N([].concat(M, g));
|
|
1119
|
+
return N([].concat(S, s));
|
|
1120
|
+
}
|
|
1121
|
+
h.exports = {
|
|
1122
|
+
sm3: N,
|
|
1123
|
+
hmac: P
|
|
1124
|
+
};
|
|
1125
|
+
},
|
|
1126
|
+
/* 2 */
|
|
1127
|
+
/***/
|
|
1128
|
+
function(h, A, q) {
|
|
1129
|
+
h.exports = {
|
|
1130
|
+
sm2: q(3),
|
|
1131
|
+
sm3: q(7),
|
|
1132
|
+
sm4: q(8)
|
|
1133
|
+
};
|
|
1134
|
+
},
|
|
1135
|
+
/* 3 */
|
|
1136
|
+
/***/
|
|
1137
|
+
function(h, A, q) {
|
|
1138
|
+
var y = q(0), n = y.BigInteger, p = q(4), $ = p.encodeDer, K = p.decodeDer, D = q(5), N = q(1).sm3, _ = D.generateEcparam(), d = _.G, I = _.curve, c = _.n, P = 0;
|
|
1139
|
+
function g(f, w) {
|
|
1140
|
+
var v = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
|
|
1141
|
+
f = typeof f == "string" ? D.hexToArray(D.utf8ToHex(f)) : Array.prototype.slice.call(f), w = D.getGlobalCurve().decodePointHex(w);
|
|
1142
|
+
var m = D.generateKeyPairHex(), B = new n(m.privateKey, 16), F = m.publicKey;
|
|
1143
|
+
F.length > 128 && (F = F.substr(F.length - 128));
|
|
1144
|
+
var C = w.multiply(B), R = D.hexToArray(D.leftPad(C.getX().toBigInteger().toRadix(16), 64)), O = D.hexToArray(D.leftPad(C.getY().toBigInteger().toRadix(16), 64)), U = D.arrayToHex(N([].concat(R, f, O))), H = 1, V = 0, L = [], Z = [].concat(R, O), J = function() {
|
|
1145
|
+
L = N([].concat(Z, [H >> 24 & 255, H >> 16 & 255, H >> 8 & 255, H & 255])), H++, V = 0;
|
|
1146
|
+
};
|
|
1147
|
+
J();
|
|
1148
|
+
for (var z = 0, k = f.length; z < k; z++)
|
|
1149
|
+
V === L.length && J(), f[z] ^= L[V++] & 255;
|
|
1150
|
+
var G = D.arrayToHex(f);
|
|
1151
|
+
return v === P ? F + G + U : F + U + G;
|
|
1152
|
+
}
|
|
1153
|
+
function o(f, w) {
|
|
1154
|
+
var v = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, m = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, B = m.output, F = B === void 0 ? "string" : B;
|
|
1155
|
+
w = new n(w, 16);
|
|
1156
|
+
var C = f.substr(128, 64), R = f.substr(192);
|
|
1157
|
+
v === P && (C = f.substr(f.length - 64), R = f.substr(128, f.length - 128 - 64));
|
|
1158
|
+
var O = D.hexToArray(R), U = D.getGlobalCurve().decodePointHex("04" + f.substr(0, 128)), H = U.multiply(w), V = D.hexToArray(D.leftPad(H.getX().toBigInteger().toRadix(16), 64)), L = D.hexToArray(D.leftPad(H.getY().toBigInteger().toRadix(16), 64)), Z = 1, J = 0, z = [], k = [].concat(V, L), G = function() {
|
|
1159
|
+
z = N([].concat(k, [Z >> 24 & 255, Z >> 16 & 255, Z >> 8 & 255, Z & 255])), Z++, J = 0;
|
|
1160
|
+
};
|
|
1161
|
+
G();
|
|
1162
|
+
for (var Q = 0, tt = O.length; Q < tt; Q++)
|
|
1163
|
+
J === z.length && G(), O[Q] ^= z[J++] & 255;
|
|
1164
|
+
var rt = D.arrayToHex(N([].concat(V, O, L)));
|
|
1165
|
+
return rt === C.toLowerCase() ? F === "array" ? O : D.arrayToUtf8(O) : F === "array" ? [] : "";
|
|
1166
|
+
}
|
|
1167
|
+
function M(f, w) {
|
|
1168
|
+
var v = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, m = v.pointPool, B = v.der, F = v.hash, C = v.publicKey, R = v.userId, O = typeof f == "string" ? D.utf8ToHex(f) : D.arrayToHex(f);
|
|
1169
|
+
F && (C = C || x(w), O = s(O, C, R));
|
|
1170
|
+
var U = new n(w, 16), H = new n(O, 16), V = null, L = null, Z = null;
|
|
1171
|
+
do {
|
|
1172
|
+
do {
|
|
1173
|
+
var J = void 0;
|
|
1174
|
+
m && m.length ? J = m.pop() : J = T(), V = J.k, L = H.add(J.x1).mod(c);
|
|
1175
|
+
} while (L.equals(n.ZERO) || L.add(V).equals(c));
|
|
1176
|
+
Z = U.add(n.ONE).modInverse(c).multiply(V.subtract(L.multiply(U))).mod(c);
|
|
1177
|
+
} while (Z.equals(n.ZERO));
|
|
1178
|
+
return B ? $(L, Z) : D.leftPad(L.toString(16), 64) + D.leftPad(Z.toString(16), 64);
|
|
1179
|
+
}
|
|
1180
|
+
function S(f, w, v) {
|
|
1181
|
+
var m = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, B = m.der, F = m.hash, C = m.userId, R = typeof f == "string" ? D.utf8ToHex(f) : D.arrayToHex(f);
|
|
1182
|
+
F && (R = s(R, v, C));
|
|
1183
|
+
var O = void 0, U = void 0;
|
|
1184
|
+
if (B) {
|
|
1185
|
+
var H = K(w);
|
|
1186
|
+
O = H.r, U = H.s;
|
|
1187
|
+
} else
|
|
1188
|
+
O = new n(w.substring(0, 64), 16), U = new n(w.substring(64), 16);
|
|
1189
|
+
var V = I.decodePointHex(v), L = new n(R, 16), Z = O.add(U).mod(c);
|
|
1190
|
+
if (Z.equals(n.ZERO)) return !1;
|
|
1191
|
+
var J = d.multiply(U).add(V.multiply(Z)), z = L.add(J.getX().toBigInteger()).mod(c);
|
|
1192
|
+
return O.equals(z);
|
|
1193
|
+
}
|
|
1194
|
+
function s(f, w) {
|
|
1195
|
+
var v = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1234567812345678";
|
|
1196
|
+
v = D.utf8ToHex(v);
|
|
1197
|
+
var m = D.leftPad(d.curve.a.toBigInteger().toRadix(16), 64), B = D.leftPad(d.curve.b.toBigInteger().toRadix(16), 64), F = D.leftPad(d.getX().toBigInteger().toRadix(16), 64), C = D.leftPad(d.getY().toBigInteger().toRadix(16), 64), R = void 0, O = void 0;
|
|
1198
|
+
if (w.length === 128)
|
|
1199
|
+
R = w.substr(0, 64), O = w.substr(64, 64);
|
|
1200
|
+
else {
|
|
1201
|
+
var U = d.curve.decodePointHex(w);
|
|
1202
|
+
R = D.leftPad(U.getX().toBigInteger().toRadix(16), 64), O = D.leftPad(U.getY().toBigInteger().toRadix(16), 64);
|
|
1203
|
+
}
|
|
1204
|
+
var H = D.hexToArray(v + m + B + F + C + R + O), V = v.length * 4;
|
|
1205
|
+
H.unshift(V & 255), H.unshift(V >> 8 & 255);
|
|
1206
|
+
var L = N(H);
|
|
1207
|
+
return D.arrayToHex(N(L.concat(D.hexToArray(f))));
|
|
1208
|
+
}
|
|
1209
|
+
function x(f) {
|
|
1210
|
+
var w = d.multiply(new n(f, 16)), v = D.leftPad(w.getX().toBigInteger().toString(16), 64), m = D.leftPad(w.getY().toBigInteger().toString(16), 64);
|
|
1211
|
+
return "04" + v + m;
|
|
1212
|
+
}
|
|
1213
|
+
function T() {
|
|
1214
|
+
var f = D.generateKeyPairHex(), w = I.decodePointHex(f.publicKey);
|
|
1215
|
+
return f.k = new n(f.privateKey, 16), f.x1 = w.getX().toBigInteger(), f;
|
|
1216
|
+
}
|
|
1217
|
+
h.exports = {
|
|
1218
|
+
generateKeyPairHex: D.generateKeyPairHex,
|
|
1219
|
+
compressPublicKeyHex: D.compressPublicKeyHex,
|
|
1220
|
+
comparePublicKeyHex: D.comparePublicKeyHex,
|
|
1221
|
+
doEncrypt: g,
|
|
1222
|
+
doDecrypt: o,
|
|
1223
|
+
doSignature: M,
|
|
1224
|
+
doVerifySignature: S,
|
|
1225
|
+
getPublicKeyFromPrivateKey: x,
|
|
1226
|
+
getPoint: T,
|
|
1227
|
+
verifyPublicKey: D.verifyPublicKey
|
|
1228
|
+
};
|
|
1229
|
+
},
|
|
1230
|
+
/* 4 */
|
|
1231
|
+
/***/
|
|
1232
|
+
function(h, A, q) {
|
|
1233
|
+
function y(g, o) {
|
|
1234
|
+
if (!g)
|
|
1235
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1236
|
+
return o && (typeof o == "object" || typeof o == "function") ? o : g;
|
|
1237
|
+
}
|
|
1238
|
+
function n(g, o) {
|
|
1239
|
+
if (typeof o != "function" && o !== null)
|
|
1240
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof o);
|
|
1241
|
+
g.prototype = Object.create(o && o.prototype, { constructor: { value: g, enumerable: !1, writable: !0, configurable: !0 } }), o && (Object.setPrototypeOf ? Object.setPrototypeOf(g, o) : g.__proto__ = o);
|
|
1242
|
+
}
|
|
1243
|
+
function p(g, o) {
|
|
1244
|
+
if (!(g instanceof o))
|
|
1245
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1246
|
+
}
|
|
1247
|
+
var $ = q(0), K = $.BigInteger;
|
|
1248
|
+
function D(g) {
|
|
1249
|
+
var o = g.toString(16);
|
|
1250
|
+
if (o[0] !== "-")
|
|
1251
|
+
o.length % 2 === 1 ? o = "0" + o : o.match(/^[0-7]/) || (o = "00" + o);
|
|
1252
|
+
else {
|
|
1253
|
+
o = o.substr(1);
|
|
1254
|
+
var M = o.length;
|
|
1255
|
+
M % 2 === 1 ? M += 1 : o.match(/^[0-7]/) || (M += 2);
|
|
1256
|
+
for (var S = "", s = 0; s < M; s++)
|
|
1257
|
+
S += "f";
|
|
1258
|
+
S = new K(S, 16), o = S.xor(g).add(K.ONE), o = o.toString(16).replace(/^-/, "");
|
|
1259
|
+
}
|
|
1260
|
+
return o;
|
|
1261
|
+
}
|
|
1262
|
+
var N = function() {
|
|
1263
|
+
function g() {
|
|
1264
|
+
p(this, g), this.tlv = null, this.t = "00", this.l = "00", this.v = "";
|
|
1265
|
+
}
|
|
1266
|
+
return g.prototype.getEncodedHex = function() {
|
|
1267
|
+
return this.tlv || (this.v = this.getValue(), this.l = this.getLength(), this.tlv = this.t + this.l + this.v), this.tlv;
|
|
1268
|
+
}, g.prototype.getLength = function() {
|
|
1269
|
+
var M = this.v.length / 2, S = M.toString(16);
|
|
1270
|
+
if (S.length % 2 === 1 && (S = "0" + S), M < 128)
|
|
1271
|
+
return S;
|
|
1272
|
+
var s = 128 + S.length / 2;
|
|
1273
|
+
return s.toString(16) + S;
|
|
1274
|
+
}, g.prototype.getValue = function() {
|
|
1275
|
+
return "";
|
|
1276
|
+
}, g;
|
|
1277
|
+
}(), _ = function(g) {
|
|
1278
|
+
n(o, g);
|
|
1279
|
+
function o(M) {
|
|
1280
|
+
p(this, o);
|
|
1281
|
+
var S = y(this, g.call(this));
|
|
1282
|
+
return S.t = "02", M && (S.v = D(M)), S;
|
|
1283
|
+
}
|
|
1284
|
+
return o.prototype.getValue = function() {
|
|
1285
|
+
return this.v;
|
|
1286
|
+
}, o;
|
|
1287
|
+
}(N), d = function(g) {
|
|
1288
|
+
n(o, g);
|
|
1289
|
+
function o(M) {
|
|
1290
|
+
p(this, o);
|
|
1291
|
+
var S = y(this, g.call(this));
|
|
1292
|
+
return S.t = "30", S.asn1Array = M, S;
|
|
1293
|
+
}
|
|
1294
|
+
return o.prototype.getValue = function() {
|
|
1295
|
+
return this.v = this.asn1Array.map(function(S) {
|
|
1296
|
+
return S.getEncodedHex();
|
|
1297
|
+
}).join(""), this.v;
|
|
1298
|
+
}, o;
|
|
1299
|
+
}(N);
|
|
1300
|
+
function I(g, o) {
|
|
1301
|
+
return +g[o + 2] < 8 ? 1 : +g.substr(o + 2, 2) & 128;
|
|
1302
|
+
}
|
|
1303
|
+
function c(g, o) {
|
|
1304
|
+
var M = I(g, o), S = g.substr(o + 2, M * 2);
|
|
1305
|
+
if (!S) return -1;
|
|
1306
|
+
var s = +S[0] < 8 ? new K(S, 16) : new K(S.substr(2), 16);
|
|
1307
|
+
return s.intValue();
|
|
1308
|
+
}
|
|
1309
|
+
function P(g, o) {
|
|
1310
|
+
var M = I(g, o);
|
|
1311
|
+
return o + (M + 1) * 2;
|
|
1312
|
+
}
|
|
1313
|
+
h.exports = {
|
|
1314
|
+
/**
|
|
1315
|
+
* ASN.1 der 编码,针对 sm2 签名
|
|
1316
|
+
*/
|
|
1317
|
+
encodeDer: function(o, M) {
|
|
1318
|
+
var S = new _(o), s = new _(M), x = new d([S, s]);
|
|
1319
|
+
return x.getEncodedHex();
|
|
1320
|
+
},
|
|
1321
|
+
/**
|
|
1322
|
+
* 解析 ASN.1 der,针对 sm2 验签
|
|
1323
|
+
*/
|
|
1324
|
+
decodeDer: function(o) {
|
|
1325
|
+
var M = P(o, 0), S = P(o, M), s = c(o, M), x = o.substr(S, s * 2), T = S + x.length, f = P(o, T), w = c(o, T), v = o.substr(f, w * 2), m = new K(x, 16), B = new K(v, 16);
|
|
1326
|
+
return { r: m, s: B };
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1329
|
+
},
|
|
1330
|
+
/* 5 */
|
|
1331
|
+
/***/
|
|
1332
|
+
function(h, A, q) {
|
|
1333
|
+
var y = q(0), n = y.BigInteger, p = y.SecureRandom, $ = q(6), K = $.ECCurveFp, D = new p(), N = P(), _ = N.curve, d = N.G, I = N.n;
|
|
1334
|
+
function c() {
|
|
1335
|
+
return _;
|
|
1336
|
+
}
|
|
1337
|
+
function P() {
|
|
1338
|
+
var v = new n("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", 16), m = new n("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16), B = new n("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", 16), F = new K(v, m, B), C = "32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7", R = "BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0", O = F.decodePointHex("04" + C + R), U = new n("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16);
|
|
1339
|
+
return { curve: F, G: O, n: U };
|
|
1340
|
+
}
|
|
1341
|
+
function g(v, m, B) {
|
|
1342
|
+
var F = v ? new n(v, m, B) : new n(I.bitLength(), D), C = F.mod(I.subtract(n.ONE)).add(n.ONE), R = S(C.toString(16), 64), O = d.multiply(C), U = S(O.getX().toBigInteger().toString(16), 64), H = S(O.getY().toBigInteger().toString(16), 64), V = "04" + U + H;
|
|
1343
|
+
return { privateKey: R, publicKey: V };
|
|
1344
|
+
}
|
|
1345
|
+
function o(v) {
|
|
1346
|
+
if (v.length !== 130) throw new Error("Invalid public key to compress");
|
|
1347
|
+
var m = (v.length - 2) / 2, B = v.substr(2, m), F = new n(v.substr(m + 2, m), 16), C = "03";
|
|
1348
|
+
return F.mod(new n("2")).equals(n.ZERO) && (C = "02"), C + B;
|
|
1349
|
+
}
|
|
1350
|
+
function M(v) {
|
|
1351
|
+
v = unescape(encodeURIComponent(v));
|
|
1352
|
+
for (var m = v.length, B = [], F = 0; F < m; F++)
|
|
1353
|
+
B[F >>> 2] |= (v.charCodeAt(F) & 255) << 24 - F % 4 * 8;
|
|
1354
|
+
for (var C = [], R = 0; R < m; R++) {
|
|
1355
|
+
var O = B[R >>> 2] >>> 24 - R % 4 * 8 & 255;
|
|
1356
|
+
C.push((O >>> 4).toString(16)), C.push((O & 15).toString(16));
|
|
1357
|
+
}
|
|
1358
|
+
return C.join("");
|
|
1359
|
+
}
|
|
1360
|
+
function S(v, m) {
|
|
1361
|
+
return v.length >= m ? v : new Array(m - v.length + 1).join("0") + v;
|
|
1362
|
+
}
|
|
1363
|
+
function s(v) {
|
|
1364
|
+
return v.map(function(m) {
|
|
1365
|
+
return m = m.toString(16), m.length === 1 ? "0" + m : m;
|
|
1366
|
+
}).join("");
|
|
1367
|
+
}
|
|
1368
|
+
function x(v) {
|
|
1369
|
+
for (var m = [], B = 0, F = 0; F < v.length * 2; F += 2)
|
|
1370
|
+
m[F >>> 3] |= parseInt(v[B], 10) << 24 - F % 8 * 4, B++;
|
|
1371
|
+
try {
|
|
1372
|
+
for (var C = [], R = 0; R < v.length; R++) {
|
|
1373
|
+
var O = m[R >>> 2] >>> 24 - R % 4 * 8 & 255;
|
|
1374
|
+
C.push(String.fromCharCode(O));
|
|
1375
|
+
}
|
|
1376
|
+
return decodeURIComponent(escape(C.join("")));
|
|
1377
|
+
} catch (U) {
|
|
1378
|
+
throw new Error("Malformed UTF-8 data");
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
function T(v) {
|
|
1382
|
+
var m = [], B = v.length;
|
|
1383
|
+
B % 2 !== 0 && (v = S(v, B + 1)), B = v.length;
|
|
1384
|
+
for (var F = 0; F < B; F += 2)
|
|
1385
|
+
m.push(parseInt(v.substr(F, 2), 16));
|
|
1386
|
+
return m;
|
|
1387
|
+
}
|
|
1388
|
+
function f(v) {
|
|
1389
|
+
var m = _.decodePointHex(v);
|
|
1390
|
+
if (!m) return !1;
|
|
1391
|
+
var B = m.getX(), F = m.getY();
|
|
1392
|
+
return F.square().equals(B.multiply(B.square()).add(B.multiply(_.a)).add(_.b));
|
|
1393
|
+
}
|
|
1394
|
+
function w(v, m) {
|
|
1395
|
+
var B = _.decodePointHex(v);
|
|
1396
|
+
if (!B) return !1;
|
|
1397
|
+
var F = _.decodePointHex(m);
|
|
1398
|
+
return F ? B.equals(F) : !1;
|
|
1399
|
+
}
|
|
1400
|
+
h.exports = {
|
|
1401
|
+
getGlobalCurve: c,
|
|
1402
|
+
generateEcparam: P,
|
|
1403
|
+
generateKeyPairHex: g,
|
|
1404
|
+
compressPublicKeyHex: o,
|
|
1405
|
+
utf8ToHex: M,
|
|
1406
|
+
leftPad: S,
|
|
1407
|
+
arrayToHex: s,
|
|
1408
|
+
arrayToUtf8: x,
|
|
1409
|
+
hexToArray: T,
|
|
1410
|
+
verifyPublicKey: f,
|
|
1411
|
+
comparePublicKeyHex: w
|
|
1412
|
+
};
|
|
1413
|
+
},
|
|
1414
|
+
/* 6 */
|
|
1415
|
+
/***/
|
|
1416
|
+
function(h, A, q) {
|
|
1417
|
+
function y(d, I) {
|
|
1418
|
+
if (!(d instanceof I))
|
|
1419
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1420
|
+
}
|
|
1421
|
+
var n = q(0), p = n.BigInteger, $ = new p("2"), K = new p("3"), D = function() {
|
|
1422
|
+
function d(I, c) {
|
|
1423
|
+
y(this, d), this.x = c, this.q = I;
|
|
1424
|
+
}
|
|
1425
|
+
return d.prototype.equals = function(c) {
|
|
1426
|
+
return c === this ? !0 : this.q.equals(c.q) && this.x.equals(c.x);
|
|
1427
|
+
}, d.prototype.toBigInteger = function() {
|
|
1428
|
+
return this.x;
|
|
1429
|
+
}, d.prototype.negate = function() {
|
|
1430
|
+
return new d(this.q, this.x.negate().mod(this.q));
|
|
1431
|
+
}, d.prototype.add = function(c) {
|
|
1432
|
+
return new d(this.q, this.x.add(c.toBigInteger()).mod(this.q));
|
|
1433
|
+
}, d.prototype.subtract = function(c) {
|
|
1434
|
+
return new d(this.q, this.x.subtract(c.toBigInteger()).mod(this.q));
|
|
1435
|
+
}, d.prototype.multiply = function(c) {
|
|
1436
|
+
return new d(this.q, this.x.multiply(c.toBigInteger()).mod(this.q));
|
|
1437
|
+
}, d.prototype.divide = function(c) {
|
|
1438
|
+
return new d(this.q, this.x.multiply(c.toBigInteger().modInverse(this.q)).mod(this.q));
|
|
1439
|
+
}, d.prototype.square = function() {
|
|
1440
|
+
return new d(this.q, this.x.square().mod(this.q));
|
|
1441
|
+
}, d;
|
|
1442
|
+
}(), N = function() {
|
|
1443
|
+
function d(I, c, P, g) {
|
|
1444
|
+
y(this, d), this.curve = I, this.x = c, this.y = P, this.z = g == null ? p.ONE : g, this.zinv = null;
|
|
1445
|
+
}
|
|
1446
|
+
return d.prototype.getX = function() {
|
|
1447
|
+
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));
|
|
1448
|
+
}, d.prototype.getY = function() {
|
|
1449
|
+
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));
|
|
1450
|
+
}, d.prototype.equals = function(c) {
|
|
1451
|
+
if (c === this) return !0;
|
|
1452
|
+
if (this.isInfinity()) return c.isInfinity();
|
|
1453
|
+
if (c.isInfinity()) return this.isInfinity();
|
|
1454
|
+
var P = c.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(c.z)).mod(this.curve.q);
|
|
1455
|
+
if (!P.equals(p.ZERO)) return !1;
|
|
1456
|
+
var g = c.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(c.z)).mod(this.curve.q);
|
|
1457
|
+
return g.equals(p.ZERO);
|
|
1458
|
+
}, d.prototype.isInfinity = function() {
|
|
1459
|
+
return this.x === null && this.y === null ? !0 : this.z.equals(p.ZERO) && !this.y.toBigInteger().equals(p.ZERO);
|
|
1460
|
+
}, d.prototype.negate = function() {
|
|
1461
|
+
return new d(this.curve, this.x, this.y.negate(), this.z);
|
|
1462
|
+
}, d.prototype.add = function(c) {
|
|
1463
|
+
if (this.isInfinity()) return c;
|
|
1464
|
+
if (c.isInfinity()) return this;
|
|
1465
|
+
var P = this.x.toBigInteger(), g = this.y.toBigInteger(), o = this.z, M = c.x.toBigInteger(), S = c.y.toBigInteger(), s = c.z, x = this.curve.q, T = P.multiply(s).mod(x), f = M.multiply(o).mod(x), w = T.subtract(f), v = g.multiply(s).mod(x), m = S.multiply(o).mod(x), B = v.subtract(m);
|
|
1466
|
+
if (p.ZERO.equals(w))
|
|
1467
|
+
return p.ZERO.equals(B) ? this.twice() : this.curve.infinity;
|
|
1468
|
+
var F = T.add(f), C = o.multiply(s).mod(x), R = w.square().mod(x), O = w.multiply(R).mod(x), U = C.multiply(B.square()).subtract(F.multiply(R)).mod(x), H = w.multiply(U).mod(x), V = B.multiply(R.multiply(T).subtract(U)).subtract(v.multiply(O)).mod(x), L = O.multiply(C).mod(x);
|
|
1469
|
+
return new d(this.curve, this.curve.fromBigInteger(H), this.curve.fromBigInteger(V), L);
|
|
1470
|
+
}, d.prototype.twice = function() {
|
|
1471
|
+
if (this.isInfinity()) return this;
|
|
1472
|
+
if (!this.y.toBigInteger().signum()) return this.curve.infinity;
|
|
1473
|
+
var c = this.x.toBigInteger(), P = this.y.toBigInteger(), g = this.z, o = this.curve.q, M = this.curve.a.toBigInteger(), S = c.square().multiply(K).add(M.multiply(g.square())).mod(o), s = P.shiftLeft(1).multiply(g).mod(o), x = P.square().mod(o), T = x.multiply(c).multiply(g).mod(o), f = s.square().mod(o), w = S.square().subtract(T.shiftLeft(3)).mod(o), v = s.multiply(w).mod(o), m = S.multiply(T.shiftLeft(2).subtract(w)).subtract(f.shiftLeft(1).multiply(x)).mod(o), B = s.multiply(f).mod(o);
|
|
1474
|
+
return new d(this.curve, this.curve.fromBigInteger(v), this.curve.fromBigInteger(m), B);
|
|
1475
|
+
}, d.prototype.multiply = function(c) {
|
|
1476
|
+
if (this.isInfinity()) return this;
|
|
1477
|
+
if (!c.signum()) return this.curve.infinity;
|
|
1478
|
+
for (var P = c.multiply(K), g = this.negate(), o = this, M = P.bitLength() - 2; M > 0; M--) {
|
|
1479
|
+
o = o.twice();
|
|
1480
|
+
var S = P.testBit(M), s = c.testBit(M);
|
|
1481
|
+
S !== s && (o = o.add(S ? this : g));
|
|
1482
|
+
}
|
|
1483
|
+
return o;
|
|
1484
|
+
}, d;
|
|
1485
|
+
}(), _ = function() {
|
|
1486
|
+
function d(I, c, P) {
|
|
1487
|
+
y(this, d), this.q = I, this.a = this.fromBigInteger(c), this.b = this.fromBigInteger(P), this.infinity = new N(this, null, null);
|
|
1488
|
+
}
|
|
1489
|
+
return d.prototype.equals = function(c) {
|
|
1490
|
+
return c === this ? !0 : this.q.equals(c.q) && this.a.equals(c.a) && this.b.equals(c.b);
|
|
1491
|
+
}, d.prototype.fromBigInteger = function(c) {
|
|
1492
|
+
return new D(this.q, c);
|
|
1493
|
+
}, d.prototype.decodePointHex = function(c) {
|
|
1494
|
+
switch (parseInt(c.substr(0, 2), 16)) {
|
|
1495
|
+
// 第一个字节
|
|
1496
|
+
case 0:
|
|
1497
|
+
return this.infinity;
|
|
1498
|
+
case 2:
|
|
1499
|
+
case 3:
|
|
1500
|
+
var P = this.fromBigInteger(new p(c.substr(2), 16)), g = this.fromBigInteger(P.multiply(P.square()).add(P.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new p("4")).add(p.ONE), this.q));
|
|
1501
|
+
return g.toBigInteger().mod($).equals(new p(c.substr(0, 2), 16).subtract($)) || (g = g.negate()), new N(this, P, g);
|
|
1502
|
+
case 4:
|
|
1503
|
+
case 6:
|
|
1504
|
+
case 7:
|
|
1505
|
+
var o = (c.length - 2) / 2, M = c.substr(2, o), S = c.substr(o + 2, o);
|
|
1506
|
+
return new N(this, this.fromBigInteger(new p(M, 16)), this.fromBigInteger(new p(S, 16)));
|
|
1507
|
+
default:
|
|
1508
|
+
return null;
|
|
1509
|
+
}
|
|
1510
|
+
}, d;
|
|
1511
|
+
}();
|
|
1512
|
+
h.exports = {
|
|
1513
|
+
ECPointFp: N,
|
|
1514
|
+
ECCurveFp: _
|
|
1515
|
+
};
|
|
1516
|
+
},
|
|
1517
|
+
/* 7 */
|
|
1518
|
+
/***/
|
|
1519
|
+
function(h, A, q) {
|
|
1520
|
+
var y = q(1), n = y.sm3, p = y.hmac;
|
|
1521
|
+
function $(_, d) {
|
|
1522
|
+
return _.length >= d ? _ : new Array(d - _.length + 1).join("0") + _;
|
|
1523
|
+
}
|
|
1524
|
+
function K(_) {
|
|
1525
|
+
return _.map(function(d) {
|
|
1526
|
+
return d = d.toString(16), d.length === 1 ? "0" + d : d;
|
|
1527
|
+
}).join("");
|
|
1528
|
+
}
|
|
1529
|
+
function D(_) {
|
|
1530
|
+
var d = [], I = _.length;
|
|
1531
|
+
I % 2 !== 0 && (_ = $(_, I + 1)), I = _.length;
|
|
1532
|
+
for (var c = 0; c < I; c += 2)
|
|
1533
|
+
d.push(parseInt(_.substr(c, 2), 16));
|
|
1534
|
+
return d;
|
|
1535
|
+
}
|
|
1536
|
+
function N(_) {
|
|
1537
|
+
for (var d = [], I = 0, c = _.length; I < c; I++) {
|
|
1538
|
+
var P = _.codePointAt(I);
|
|
1539
|
+
if (P <= 127)
|
|
1540
|
+
d.push(P);
|
|
1541
|
+
else if (P <= 2047)
|
|
1542
|
+
d.push(192 | P >>> 6), d.push(128 | P & 63);
|
|
1543
|
+
else if (P <= 55295 || P >= 57344 && P <= 65535)
|
|
1544
|
+
d.push(224 | P >>> 12), d.push(128 | P >>> 6 & 63), d.push(128 | P & 63);
|
|
1545
|
+
else if (P >= 65536 && P <= 1114111)
|
|
1546
|
+
I++, d.push(240 | P >>> 18 & 28), d.push(128 | P >>> 12 & 63), d.push(128 | P >>> 6 & 63), d.push(128 | P & 63);
|
|
1547
|
+
else
|
|
1548
|
+
throw d.push(P), new Error("input is not supported");
|
|
1549
|
+
}
|
|
1550
|
+
return d;
|
|
1551
|
+
}
|
|
1552
|
+
h.exports = function(_, d) {
|
|
1553
|
+
if (_ = typeof _ == "string" ? N(_) : Array.prototype.slice.call(_), d) {
|
|
1554
|
+
var I = d.mode || "hmac";
|
|
1555
|
+
if (I !== "hmac") throw new Error("invalid mode");
|
|
1556
|
+
var c = d.key;
|
|
1557
|
+
if (!c) throw new Error("invalid key");
|
|
1558
|
+
return c = typeof c == "string" ? D(c) : Array.prototype.slice.call(c), K(p(_, c));
|
|
1559
|
+
}
|
|
1560
|
+
return K(n(_));
|
|
1561
|
+
};
|
|
1562
|
+
},
|
|
1563
|
+
/* 8 */
|
|
1564
|
+
/***/
|
|
1565
|
+
function(h, A, q) {
|
|
1566
|
+
var y = 0, n = 32, p = 16, $ = [214, 144, 233, 254, 204, 225, 61, 183, 22, 182, 20, 194, 40, 251, 44, 5, 43, 103, 154, 118, 42, 190, 4, 195, 170, 68, 19, 38, 73, 134, 6, 153, 156, 66, 80, 244, 145, 239, 152, 122, 51, 84, 11, 67, 237, 207, 172, 98, 228, 179, 28, 169, 201, 8, 232, 149, 128, 223, 148, 250, 117, 143, 63, 166, 71, 7, 167, 252, 243, 115, 23, 186, 131, 89, 60, 25, 230, 133, 79, 168, 104, 107, 129, 178, 113, 100, 218, 139, 248, 235, 15, 75, 112, 86, 157, 53, 30, 36, 14, 94, 99, 88, 209, 162, 37, 34, 124, 59, 1, 33, 120, 135, 212, 0, 70, 87, 159, 211, 39, 82, 76, 54, 2, 231, 160, 196, 200, 158, 234, 191, 138, 210, 64, 199, 56, 181, 163, 247, 242, 206, 249, 97, 21, 161, 224, 174, 93, 164, 155, 52, 26, 85, 173, 147, 50, 48, 245, 140, 177, 227, 29, 246, 226, 46, 130, 102, 202, 96, 192, 41, 35, 171, 13, 83, 78, 111, 213, 219, 55, 69, 222, 253, 142, 47, 3, 255, 106, 114, 109, 108, 91, 81, 141, 27, 175, 146, 187, 221, 188, 127, 17, 217, 92, 65, 31, 16, 90, 216, 10, 193, 49, 136, 165, 205, 123, 189, 45, 116, 208, 18, 184, 229, 180, 176, 137, 105, 151, 74, 12, 150, 119, 126, 101, 185, 241, 9, 197, 110, 198, 132, 24, 240, 125, 236, 58, 220, 77, 32, 121, 238, 95, 62, 215, 203, 57, 72], K = [462357, 472066609, 943670861, 1415275113, 1886879365, 2358483617, 2830087869, 3301692121, 3773296373, 4228057617, 404694573, 876298825, 1347903077, 1819507329, 2291111581, 2762715833, 3234320085, 3705924337, 4177462797, 337322537, 808926789, 1280531041, 1752135293, 2223739545, 2695343797, 3166948049, 3638552301, 4110090761, 269950501, 741554753, 1213159005, 1684763257];
|
|
1567
|
+
function D(s) {
|
|
1568
|
+
for (var x = [], T = 0, f = s.length; T < f; T += 2)
|
|
1569
|
+
x.push(parseInt(s.substr(T, 2), 16));
|
|
1570
|
+
return x;
|
|
1571
|
+
}
|
|
1572
|
+
function N(s) {
|
|
1573
|
+
return s.map(function(x) {
|
|
1574
|
+
return x = x.toString(16), x.length === 1 ? "0" + x : x;
|
|
1575
|
+
}).join("");
|
|
1576
|
+
}
|
|
1577
|
+
function _(s) {
|
|
1578
|
+
for (var x = [], T = 0, f = s.length; T < f; T++) {
|
|
1579
|
+
var w = s.codePointAt(T);
|
|
1580
|
+
if (w <= 127)
|
|
1581
|
+
x.push(w);
|
|
1582
|
+
else if (w <= 2047)
|
|
1583
|
+
x.push(192 | w >>> 6), x.push(128 | w & 63);
|
|
1584
|
+
else if (w <= 55295 || w >= 57344 && w <= 65535)
|
|
1585
|
+
x.push(224 | w >>> 12), x.push(128 | w >>> 6 & 63), x.push(128 | w & 63);
|
|
1586
|
+
else if (w >= 65536 && w <= 1114111)
|
|
1587
|
+
T++, x.push(240 | w >>> 18 & 28), x.push(128 | w >>> 12 & 63), x.push(128 | w >>> 6 & 63), x.push(128 | w & 63);
|
|
1588
|
+
else
|
|
1589
|
+
throw x.push(w), new Error("input is not supported");
|
|
1590
|
+
}
|
|
1591
|
+
return x;
|
|
1592
|
+
}
|
|
1593
|
+
function d(s) {
|
|
1594
|
+
for (var x = [], T = 0, f = s.length; T < f; T++)
|
|
1595
|
+
s[T] >= 240 && s[T] <= 247 ? (x.push(String.fromCodePoint(((s[T] & 7) << 18) + ((s[T + 1] & 63) << 12) + ((s[T + 2] & 63) << 6) + (s[T + 3] & 63))), T += 3) : s[T] >= 224 && s[T] <= 239 ? (x.push(String.fromCodePoint(((s[T] & 15) << 12) + ((s[T + 1] & 63) << 6) + (s[T + 2] & 63))), T += 2) : s[T] >= 192 && s[T] <= 223 ? (x.push(String.fromCodePoint(((s[T] & 31) << 6) + (s[T + 1] & 63))), T++) : x.push(String.fromCodePoint(s[T]));
|
|
1596
|
+
return x.join("");
|
|
1597
|
+
}
|
|
1598
|
+
function I(s, x) {
|
|
1599
|
+
var T = x & 31;
|
|
1600
|
+
return s << T | s >>> 32 - T;
|
|
1601
|
+
}
|
|
1602
|
+
function c(s) {
|
|
1603
|
+
return ($[s >>> 24 & 255] & 255) << 24 | ($[s >>> 16 & 255] & 255) << 16 | ($[s >>> 8 & 255] & 255) << 8 | $[s & 255] & 255;
|
|
1604
|
+
}
|
|
1605
|
+
function P(s) {
|
|
1606
|
+
return s ^ I(s, 2) ^ I(s, 10) ^ I(s, 18) ^ I(s, 24);
|
|
1607
|
+
}
|
|
1608
|
+
function g(s) {
|
|
1609
|
+
return s ^ I(s, 13) ^ I(s, 23);
|
|
1610
|
+
}
|
|
1611
|
+
function o(s, x, T) {
|
|
1612
|
+
for (var f = new Array(4), w = new Array(4), v = 0; v < 4; v++)
|
|
1613
|
+
w[0] = s[4 * v] & 255, w[1] = s[4 * v + 1] & 255, w[2] = s[4 * v + 2] & 255, w[3] = s[4 * v + 3] & 255, f[v] = w[0] << 24 | w[1] << 16 | w[2] << 8 | w[3];
|
|
1614
|
+
for (var m = 0, B; m < 32; m += 4)
|
|
1615
|
+
B = f[1] ^ f[2] ^ f[3] ^ T[m + 0], f[0] ^= P(c(B)), B = f[2] ^ f[3] ^ f[0] ^ T[m + 1], f[1] ^= P(c(B)), B = f[3] ^ f[0] ^ f[1] ^ T[m + 2], f[2] ^= P(c(B)), B = f[0] ^ f[1] ^ f[2] ^ T[m + 3], f[3] ^= P(c(B));
|
|
1616
|
+
for (var F = 0; F < 16; F += 4)
|
|
1617
|
+
x[F] = f[3 - F / 4] >>> 24 & 255, x[F + 1] = f[3 - F / 4] >>> 16 & 255, x[F + 2] = f[3 - F / 4] >>> 8 & 255, x[F + 3] = f[3 - F / 4] & 255;
|
|
1618
|
+
}
|
|
1619
|
+
function M(s, x, T) {
|
|
1620
|
+
for (var f = new Array(4), w = new Array(4), v = 0; v < 4; v++)
|
|
1621
|
+
w[0] = s[0 + 4 * v] & 255, w[1] = s[1 + 4 * v] & 255, w[2] = s[2 + 4 * v] & 255, w[3] = s[3 + 4 * v] & 255, f[v] = w[0] << 24 | w[1] << 16 | w[2] << 8 | w[3];
|
|
1622
|
+
f[0] ^= 2746333894, f[1] ^= 1453994832, f[2] ^= 1736282519, f[3] ^= 2993693404;
|
|
1623
|
+
for (var m = 0, B; m < 32; m += 4)
|
|
1624
|
+
B = f[1] ^ f[2] ^ f[3] ^ K[m + 0], x[m + 0] = f[0] ^= g(c(B)), B = f[2] ^ f[3] ^ f[0] ^ K[m + 1], x[m + 1] = f[1] ^= g(c(B)), B = f[3] ^ f[0] ^ f[1] ^ K[m + 2], x[m + 2] = f[2] ^= g(c(B)), B = f[0] ^ f[1] ^ f[2] ^ K[m + 3], x[m + 3] = f[3] ^= g(c(B));
|
|
1625
|
+
if (T === y)
|
|
1626
|
+
for (var F = 0, C; F < 16; F++)
|
|
1627
|
+
C = x[F], x[F] = x[31 - F], x[31 - F] = C;
|
|
1628
|
+
}
|
|
1629
|
+
function S(s, x, T) {
|
|
1630
|
+
var f = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, w = f.padding, v = w === void 0 ? "pkcs#7" : w, m = f.mode, B = f.iv, F = B === void 0 ? [] : B, C = f.output, R = C === void 0 ? "string" : C;
|
|
1631
|
+
if (m === "cbc" && (typeof F == "string" && (F = D(F)), F.length !== 128 / 8))
|
|
1632
|
+
throw new Error("iv is invalid");
|
|
1633
|
+
if (typeof x == "string" && (x = D(x)), x.length !== 128 / 8)
|
|
1634
|
+
throw new Error("key is invalid");
|
|
1635
|
+
if (typeof s == "string" ? T !== y ? s = _(s) : s = D(s) : s = [].concat(s), (v === "pkcs#5" || v === "pkcs#7") && T !== y)
|
|
1636
|
+
for (var O = p - s.length % p, U = 0; U < O; U++)
|
|
1637
|
+
s.push(O);
|
|
1638
|
+
var H = new Array(n);
|
|
1639
|
+
M(x, H, T);
|
|
1640
|
+
for (var V = [], L = F, Z = s.length, J = 0; Z >= p; ) {
|
|
1641
|
+
var z = s.slice(J, J + 16), k = new Array(16);
|
|
1642
|
+
if (m === "cbc")
|
|
1643
|
+
for (var G = 0; G < p; G++)
|
|
1644
|
+
T !== y && (z[G] ^= L[G]);
|
|
1645
|
+
o(z, k, H);
|
|
1646
|
+
for (var Q = 0; Q < p; Q++)
|
|
1647
|
+
m === "cbc" && T === y && (k[Q] ^= L[Q]), V[J + Q] = k[Q];
|
|
1648
|
+
m === "cbc" && (T !== y ? L = k : L = z), Z -= p, J += p;
|
|
1649
|
+
}
|
|
1650
|
+
if ((v === "pkcs#5" || v === "pkcs#7") && T === y) {
|
|
1651
|
+
for (var tt = V.length, rt = V[tt - 1], st = 1; st <= rt; st++)
|
|
1652
|
+
if (V[tt - st] !== rt) throw new Error("padding is invalid");
|
|
1653
|
+
V.splice(tt - rt, rt);
|
|
1654
|
+
}
|
|
1655
|
+
return R !== "array" ? T !== y ? N(V) : d(V) : V;
|
|
1656
|
+
}
|
|
1657
|
+
h.exports = {
|
|
1658
|
+
encrypt: function(x, T, f) {
|
|
1659
|
+
return S(x, T, 1, f);
|
|
1660
|
+
},
|
|
1661
|
+
decrypt: function(x, T, f) {
|
|
1662
|
+
return S(x, T, 0, f);
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
/******/
|
|
1667
|
+
]);
|
|
1668
|
+
}(Ut)), Ut.exports;
|
|
299
1669
|
}
|
|
300
|
-
|
|
301
|
-
|
|
1670
|
+
var j = Yr();
|
|
1671
|
+
const Xr = (u) => j.sm2.generateKeyPairHex(u), kr = (u, h, A = 1, q) => j.sm2.doEncrypt(u, h, A, q), Qr = (u, h, A = 1, q) => j.sm2.doDecrypt(u, h, A, q), jr = (u, h, A) => j.sm2.doSignature(u, h, A), ti = (u, h, A, q) => j.sm2.doVerifySignature(u, h, A, q), ei = (u) => j.sm2.getPublicKeyFromPrivateKey(u), ri = () => j.sm2.getPoint(), ii = (u) => j.sm2.compressPublicKeyHex(u), ni = (u, h) => j.sm2.comparePublicKeyHex(u, h), oi = (u) => j.sm2.verifyPublicKey(u), si = (u, h) => j.sm3(u, h), ai = (u, h, A) => j.sm4.encrypt(u, h, A), fi = (u, h, A) => j.sm4.decrypt(u, h, A), ui = { sm2: j.sm2, sm3: j.sm3, sm4: j.sm4 };
|
|
1672
|
+
var hi = {
|
|
1673
|
+
sm2GenerateKeyPair: Xr,
|
|
1674
|
+
sm2Encrypt: kr,
|
|
1675
|
+
sm2Decrypt: Qr,
|
|
1676
|
+
sm2Sign: jr,
|
|
1677
|
+
sm2Verify: ti,
|
|
1678
|
+
sm2GetPublicKey: ei,
|
|
1679
|
+
sm2GetPoint: ri,
|
|
1680
|
+
sm2CompressPublicKey: ii,
|
|
1681
|
+
sm2ComparePublicKey: ni,
|
|
1682
|
+
sm2VerifyPublicKey: oi,
|
|
1683
|
+
sm3Hash: si,
|
|
1684
|
+
sm4Encrypt: ai,
|
|
1685
|
+
sm4Decrypt: fi,
|
|
1686
|
+
__raw__: ui
|
|
1687
|
+
};
|
|
1688
|
+
typeof window != "undefined" && (document.readyState === "complete" || document.readyState === "interactive" ? setTimeout(() => zt(), 0) : document.addEventListener("DOMContentLoaded", () => {
|
|
1689
|
+
zt();
|
|
302
1690
|
}));
|
|
303
|
-
const
|
|
1691
|
+
const bt = {
|
|
304
1692
|
// 导航 API
|
|
305
|
-
navigateTo:
|
|
306
|
-
navigateBack:
|
|
307
|
-
switchTab:
|
|
308
|
-
reLaunch:
|
|
309
|
-
redirectTo:
|
|
1693
|
+
navigateTo: se,
|
|
1694
|
+
navigateBack: ae,
|
|
1695
|
+
switchTab: fe,
|
|
1696
|
+
reLaunch: ue,
|
|
1697
|
+
redirectTo: he,
|
|
310
1698
|
// 消息 API
|
|
311
|
-
postMessage:
|
|
312
|
-
getEnv:
|
|
1699
|
+
postMessage: le,
|
|
1700
|
+
getEnv: pe,
|
|
1701
|
+
// 加密 API
|
|
1702
|
+
crypto: hi,
|
|
313
1703
|
// 环境信息
|
|
314
|
-
environment:
|
|
1704
|
+
environment: re,
|
|
315
1705
|
// 等待桥接准备就绪
|
|
316
|
-
ready:
|
|
1706
|
+
ready: Sr,
|
|
317
1707
|
// 添加手动初始化方法(供需要手动控制的场景使用)
|
|
318
|
-
init:
|
|
1708
|
+
init: zt,
|
|
319
1709
|
// WebView 对象(兼容旧版本)
|
|
320
1710
|
webView: null
|
|
321
1711
|
};
|
|
322
|
-
|
|
323
|
-
navigateTo:
|
|
324
|
-
navigateBack:
|
|
325
|
-
switchTab:
|
|
326
|
-
reLaunch:
|
|
327
|
-
redirectTo:
|
|
328
|
-
postMessage:
|
|
329
|
-
getEnv:
|
|
1712
|
+
re.isWeixinMiniProgram ? bt.webView = window.wx && window.wx.miniProgram : bt.webView = {
|
|
1713
|
+
navigateTo: se,
|
|
1714
|
+
navigateBack: ae,
|
|
1715
|
+
switchTab: fe,
|
|
1716
|
+
reLaunch: ue,
|
|
1717
|
+
redirectTo: he,
|
|
1718
|
+
postMessage: le,
|
|
1719
|
+
getEnv: pe
|
|
330
1720
|
};
|
|
331
|
-
const
|
|
332
|
-
Object.keys(
|
|
333
|
-
|
|
1721
|
+
const jt = typeof window.uni != "undefined" ? window.uni : {};
|
|
1722
|
+
Object.keys(jt).forEach((u) => {
|
|
1723
|
+
bt.hasOwnProperty(u) || (bt[u] = jt[u]);
|
|
334
1724
|
});
|
|
335
|
-
typeof window != "undefined" && (window.qsh =
|
|
1725
|
+
typeof window != "undefined" && (window.qsh = bt);
|
|
336
1726
|
export {
|
|
337
|
-
|
|
1727
|
+
bt as default
|
|
338
1728
|
};
|
|
339
1729
|
//# sourceMappingURL=uni-webview.es.js.map
|