@cedros/pay-react 1.1.22 → 1.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AISettingsSection-BtOxEweU.js → AISettingsSection-DAztmwnN.js} +1 -1
- package/dist/{AISettingsSection-p3iikbSw.mjs → AISettingsSection-DpMIk431.mjs} +2 -2
- package/dist/{AutosaveIndicator-CWbb-VXf.mjs → AutosaveIndicator-BRCqAWqP.mjs} +1 -1
- package/dist/{AutosaveIndicator-C-CH-obR.js → AutosaveIndicator-BnQkKxzr.js} +1 -1
- package/dist/{CedrosContext-D-lnoEkR.js → CedrosContext-7dwmEeUY.js} +2 -2
- package/dist/{CedrosContext-BE6P5PQ0.mjs → CedrosContext-BlArEF7k.mjs} +95 -78
- package/dist/{CryptoButton-Dy-g3bR0.js → CryptoButton-C1AAOOfj.js} +1 -1
- package/dist/{CryptoButton-CksMkZjL.mjs → CryptoButton-CREryx1l.mjs} +2 -2
- package/dist/{FAQSection-byh7zfqI.mjs → FAQSection-Ruzs7a-0.mjs} +1 -1
- package/dist/{FAQSection-DQpF7hVx.js → FAQSection-yw64HLy3.js} +1 -1
- package/dist/{MessagingSection-CK208brx.mjs → MessagingSection-BLRjfBQT.mjs} +2 -2
- package/dist/{MessagingSection-B6EHvjDw.js → MessagingSection-Dp_SaXsv.js} +1 -1
- package/dist/OrdersSection-C2dyWqrR.js +1 -0
- package/dist/OrdersSection-l-MtP9EN.mjs +233 -0
- package/dist/{PaymentSettingsSection-B9H253x1.mjs → PaymentSettingsSection-Bbq93UtC.mjs} +1 -1
- package/dist/{PaymentSettingsSection-Cmmuhmd4.js → PaymentSettingsSection-C5bhLgU7.js} +1 -1
- package/dist/{SettingsSection-DrzGdvHH.js → SettingsSection-D_pKPRrP.js} +1 -1
- package/dist/{SettingsSection-DDLMaEPo.mjs → SettingsSection-DorqCFXE.mjs} +1 -1
- package/dist/SingleCategorySettings-BAND8Zkw.mjs +1006 -0
- package/dist/SingleCategorySettings-Cg-zuJfr.js +3 -0
- package/dist/{StorefrontSection-Dr2ciBVg.mjs → StorefrontSection-FSOxBclu.mjs} +2 -2
- package/dist/{StorefrontSection-DTpZ_GgO.js → StorefrontSection-QZPEZ6Lz.js} +1 -1
- package/dist/{SubscriptionsSection-CU3Ce8r9.mjs → SubscriptionsSection-C4TDXCX2.mjs} +1 -1
- package/dist/{SubscriptionsSection-CYJpArJ8.js → SubscriptionsSection-DYr99VzB.js} +1 -1
- package/dist/Token22Section-Cmn2lKcd.mjs +1685 -0
- package/dist/Token22Section-D3nnUyim.js +1 -0
- package/dist/{WalletManager-QcfgQmap.js → WalletManager-Bwk3rgr1.js} +1 -1
- package/dist/{WalletManager-D78miaJ2.mjs → WalletManager-peBN6RDH.mjs} +1 -1
- package/dist/bn-CHdpZHQm.mjs +1185 -0
- package/dist/bn-RbgIlcHc.js +1 -0
- package/dist/configApi-Ch0Rr7TD.mjs +554 -0
- package/dist/configApi-CxEbCAgG.js +1 -0
- package/dist/crypto-only.js +1 -1
- package/dist/crypto-only.mjs +54 -52
- package/dist/{index-CufXF9Yd.mjs → index-CKNB7XsA.mjs} +6709 -5888
- package/dist/index-vEe2Y39x.js +84 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +34 -32
- package/dist/pay-react_false-CPX8Vyp9.mjs +5 -0
- package/dist/pay-react_false-DaeIe3_l.js +1 -0
- package/dist/{sections-CR7NRsjq.js → sections-Cklkxd85.js} +1 -1
- package/dist/{sections-Bc6ARlND.mjs → sections-Dt6vxDU4.mjs} +1 -1
- package/dist/src/components/CreditsBalance.d.ts +24 -0
- package/dist/src/components/CreditsBalance.d.ts.map +1 -0
- package/dist/src/components/admin/AssetClassesTab.d.ts +20 -0
- package/dist/src/components/admin/AssetClassesTab.d.ts.map +1 -0
- package/dist/src/components/admin/AssetRedemptionManager.d.ts +21 -0
- package/dist/src/components/admin/AssetRedemptionManager.d.ts.map +1 -0
- package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +1 -1
- package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
- package/dist/src/components/admin/GiftCardComplianceTab.d.ts +3 -0
- package/dist/src/components/admin/GiftCardComplianceTab.d.ts.map +1 -0
- package/dist/src/components/admin/LiquidityPoolTab.d.ts +11 -0
- package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -0
- package/dist/src/components/admin/OrdersSection.d.ts +3 -0
- package/dist/src/components/admin/OrdersSection.d.ts.map +1 -0
- package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
- package/dist/src/components/admin/RedemptionFormBuilder.d.ts +25 -0
- package/dist/src/components/admin/RedemptionFormBuilder.d.ts.map +1 -0
- package/dist/src/components/admin/Token22Section.d.ts +3 -0
- package/dist/src/components/admin/Token22Section.d.ts.map +1 -0
- package/dist/src/components/admin/configApi.d.ts.map +1 -1
- package/dist/src/components/admin/index.d.ts +3 -0
- package/dist/src/components/admin/index.d.ts.map +1 -1
- package/dist/src/ecommerce/adapters/mock/mockAdapter.d.ts.map +1 -1
- package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
- package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts +13 -0
- package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts.map +1 -0
- package/dist/src/ecommerce/components/catalog/ProductCard.d.ts.map +1 -1
- package/dist/src/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -1
- package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts +9 -2
- package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts.map +1 -1
- package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts +7 -1
- package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts.map +1 -1
- package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts +22 -0
- package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts.map +1 -0
- package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts +36 -0
- package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts.map +1 -0
- package/dist/src/ecommerce/components/orders/OrderCard.d.ts.map +1 -1
- package/dist/src/ecommerce/components/orders/OrderDetails.d.ts +5 -1
- package/dist/src/ecommerce/components/orders/OrderDetails.d.ts.map +1 -1
- package/dist/src/ecommerce/index.d.ts +6 -0
- package/dist/src/ecommerce/index.d.ts.map +1 -1
- package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts +1 -0
- package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -1
- package/dist/src/ecommerce/state/checkout/useCheckout.d.ts.map +1 -1
- package/dist/src/ecommerce/templates/ProductTemplate.d.ts.map +1 -1
- package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts +5 -1
- package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts.map +1 -1
- package/dist/src/ecommerce/types.d.ts +20 -0
- package/dist/src/ecommerce/types.d.ts.map +1 -1
- package/dist/src/ecommerce/utils/cartItemMetadata.d.ts.map +1 -1
- package/dist/src/ecommerce/utils/safeHref.d.ts +9 -0
- package/dist/src/ecommerce/utils/safeHref.d.ts.map +1 -0
- package/dist/src/hooks/useCreditsBalance.d.ts +32 -0
- package/dist/src/hooks/useCreditsBalance.d.ts.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/managers/CreditsManager.d.ts +15 -0
- package/dist/src/managers/CreditsManager.d.ts.map +1 -1
- package/dist/src/managers/MeteoraPoolManager.d.ts +86 -0
- package/dist/src/managers/MeteoraPoolManager.d.ts.map +1 -0
- package/dist/stripe-only.js +1 -1
- package/dist/stripe-only.mjs +2 -2
- package/dist/{styles-BWrLnaUW.js → styles-21F1-oqx.js} +1 -1
- package/dist/{styles--eKKnfdj.mjs → styles-2VMpwuaI.mjs} +3 -3
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.mjs +1 -1
- package/dist/{walletPool-BqNfOhB0.js → walletPool-Ddv33tej.js} +1 -1
- package/dist/{walletPool-DShNjCQ6.mjs → walletPool-DgQsh7Se.mjs} +1 -1
- package/package.json +5 -1
- package/dist/SingleCategorySettings-BU98SRFV.mjs +0 -1418
- package/dist/SingleCategorySettings-DqcXe-q4.js +0 -3
- package/dist/index-IZ4WcMd7.js +0 -84
|
@@ -0,0 +1,1185 @@
|
|
|
1
|
+
function mi(it, nt) {
|
|
2
|
+
for (var ft = 0; ft < nt.length; ft++) {
|
|
3
|
+
const d = nt[ft];
|
|
4
|
+
if (typeof d != "string" && !Array.isArray(d)) {
|
|
5
|
+
for (const rt in d)
|
|
6
|
+
if (rt !== "default" && !(rt in it)) {
|
|
7
|
+
const l = Object.getOwnPropertyDescriptor(d, rt);
|
|
8
|
+
l && Object.defineProperty(it, rt, l.get ? l : {
|
|
9
|
+
enumerable: !0,
|
|
10
|
+
get: () => d[rt]
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return Object.freeze(Object.defineProperty(it, Symbol.toStringTag, { value: "Module" }));
|
|
16
|
+
}
|
|
17
|
+
function pi(it) {
|
|
18
|
+
return it && it.__esModule && Object.prototype.hasOwnProperty.call(it, "default") ? it.default : it;
|
|
19
|
+
}
|
|
20
|
+
function Mi(it) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(it, "__esModule")) return it;
|
|
22
|
+
var nt = it.default;
|
|
23
|
+
if (typeof nt == "function") {
|
|
24
|
+
var ft = function d() {
|
|
25
|
+
var rt = !1;
|
|
26
|
+
try {
|
|
27
|
+
rt = this instanceof d;
|
|
28
|
+
} catch {
|
|
29
|
+
}
|
|
30
|
+
return rt ? Reflect.construct(nt, arguments, this.constructor) : nt.apply(this, arguments);
|
|
31
|
+
};
|
|
32
|
+
ft.prototype = nt.prototype;
|
|
33
|
+
} else ft = {};
|
|
34
|
+
return Object.defineProperty(ft, "__esModule", { value: !0 }), Object.keys(it).forEach(function(d) {
|
|
35
|
+
var rt = Object.getOwnPropertyDescriptor(it, d);
|
|
36
|
+
Object.defineProperty(ft, d, rt.get ? rt : {
|
|
37
|
+
enumerable: !0,
|
|
38
|
+
get: function() {
|
|
39
|
+
return it[d];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}), ft;
|
|
43
|
+
}
|
|
44
|
+
const ci = {}, gi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
45
|
+
__proto__: null,
|
|
46
|
+
default: ci
|
|
47
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
48
|
+
var lt = { exports: {} };
|
|
49
|
+
const wi = /* @__PURE__ */ Mi(gi);
|
|
50
|
+
var yi = lt.exports, oi;
|
|
51
|
+
function xi() {
|
|
52
|
+
return oi || (oi = 1, (function(it) {
|
|
53
|
+
(function(nt, ft) {
|
|
54
|
+
function d(o, t) {
|
|
55
|
+
if (!o) throw new Error(t || "Assertion failed");
|
|
56
|
+
}
|
|
57
|
+
function rt(o, t) {
|
|
58
|
+
o.super_ = t;
|
|
59
|
+
var r = function() {
|
|
60
|
+
};
|
|
61
|
+
r.prototype = t.prototype, o.prototype = new r(), o.prototype.constructor = o;
|
|
62
|
+
}
|
|
63
|
+
function l(o, t, r) {
|
|
64
|
+
if (l.isBN(o))
|
|
65
|
+
return o;
|
|
66
|
+
this.negative = 0, this.words = null, this.length = 0, this.red = null, o !== null && ((t === "le" || t === "be") && (r = t, t = 10), this._init(o || 0, t || 10, r || "be"));
|
|
67
|
+
}
|
|
68
|
+
typeof nt == "object" ? nt.exports = l : ft.BN = l, l.BN = l, l.wordSize = 26;
|
|
69
|
+
var ot;
|
|
70
|
+
try {
|
|
71
|
+
typeof window < "u" && typeof window.Buffer < "u" ? ot = window.Buffer : ot = wi.Buffer;
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
l.isBN = function(t) {
|
|
75
|
+
return t instanceof l ? !0 : t !== null && typeof t == "object" && t.constructor.wordSize === l.wordSize && Array.isArray(t.words);
|
|
76
|
+
}, l.max = function(t, r) {
|
|
77
|
+
return t.cmp(r) > 0 ? t : r;
|
|
78
|
+
}, l.min = function(t, r) {
|
|
79
|
+
return t.cmp(r) < 0 ? t : r;
|
|
80
|
+
}, l.prototype._init = function(t, r, e) {
|
|
81
|
+
if (typeof t == "number")
|
|
82
|
+
return this._initNumber(t, r, e);
|
|
83
|
+
if (typeof t == "object")
|
|
84
|
+
return this._initArray(t, r, e);
|
|
85
|
+
r === "hex" && (r = 16), d(r === (r | 0) && r >= 2 && r <= 36), t = t.toString().replace(/\s+/g, "");
|
|
86
|
+
var f = 0;
|
|
87
|
+
t[0] === "-" && (f++, this.negative = 1), f < t.length && (r === 16 ? this._parseHex(t, f, e) : (this._parseBase(t, r, f), e === "le" && this._initArray(this.toArray(), r, e)));
|
|
88
|
+
}, l.prototype._initNumber = function(t, r, e) {
|
|
89
|
+
t < 0 && (this.negative = 1, t = -t), t < 67108864 ? (this.words = [t & 67108863], this.length = 1) : t < 4503599627370496 ? (this.words = [
|
|
90
|
+
t & 67108863,
|
|
91
|
+
t / 67108864 & 67108863
|
|
92
|
+
], this.length = 2) : (d(t < 9007199254740992), this.words = [
|
|
93
|
+
t & 67108863,
|
|
94
|
+
t / 67108864 & 67108863,
|
|
95
|
+
1
|
|
96
|
+
], this.length = 3), e === "le" && this._initArray(this.toArray(), r, e);
|
|
97
|
+
}, l.prototype._initArray = function(t, r, e) {
|
|
98
|
+
if (d(typeof t.length == "number"), t.length <= 0)
|
|
99
|
+
return this.words = [0], this.length = 1, this;
|
|
100
|
+
this.length = Math.ceil(t.length / 3), this.words = new Array(this.length);
|
|
101
|
+
for (var f = 0; f < this.length; f++)
|
|
102
|
+
this.words[f] = 0;
|
|
103
|
+
var s, a, u = 0;
|
|
104
|
+
if (e === "be")
|
|
105
|
+
for (f = t.length - 1, s = 0; f >= 0; f -= 3)
|
|
106
|
+
a = t[f] | t[f - 1] << 8 | t[f - 2] << 16, this.words[s] |= a << u & 67108863, this.words[s + 1] = a >>> 26 - u & 67108863, u += 24, u >= 26 && (u -= 26, s++);
|
|
107
|
+
else if (e === "le")
|
|
108
|
+
for (f = 0, s = 0; f < t.length; f += 3)
|
|
109
|
+
a = t[f] | t[f + 1] << 8 | t[f + 2] << 16, this.words[s] |= a << u & 67108863, this.words[s + 1] = a >>> 26 - u & 67108863, u += 24, u >= 26 && (u -= 26, s++);
|
|
110
|
+
return this._strip();
|
|
111
|
+
};
|
|
112
|
+
function Zt(o, t) {
|
|
113
|
+
var r = o.charCodeAt(t);
|
|
114
|
+
if (r >= 48 && r <= 57)
|
|
115
|
+
return r - 48;
|
|
116
|
+
if (r >= 65 && r <= 70)
|
|
117
|
+
return r - 55;
|
|
118
|
+
if (r >= 97 && r <= 102)
|
|
119
|
+
return r - 87;
|
|
120
|
+
d(!1, "Invalid character in " + o);
|
|
121
|
+
}
|
|
122
|
+
function Et(o, t, r) {
|
|
123
|
+
var e = Zt(o, r);
|
|
124
|
+
return r - 1 >= t && (e |= Zt(o, r - 1) << 4), e;
|
|
125
|
+
}
|
|
126
|
+
l.prototype._parseHex = function(t, r, e) {
|
|
127
|
+
this.length = Math.ceil((t.length - r) / 6), this.words = new Array(this.length);
|
|
128
|
+
for (var f = 0; f < this.length; f++)
|
|
129
|
+
this.words[f] = 0;
|
|
130
|
+
var s = 0, a = 0, u;
|
|
131
|
+
if (e === "be")
|
|
132
|
+
for (f = t.length - 1; f >= r; f -= 2)
|
|
133
|
+
u = Et(t, r, f) << s, this.words[a] |= u & 67108863, s >= 18 ? (s -= 18, a += 1, this.words[a] |= u >>> 26) : s += 8;
|
|
134
|
+
else {
|
|
135
|
+
var h = t.length - r;
|
|
136
|
+
for (f = h % 2 === 0 ? r + 1 : r; f < t.length; f += 2)
|
|
137
|
+
u = Et(t, r, f) << s, this.words[a] |= u & 67108863, s >= 18 ? (s -= 18, a += 1, this.words[a] |= u >>> 26) : s += 8;
|
|
138
|
+
}
|
|
139
|
+
this._strip();
|
|
140
|
+
};
|
|
141
|
+
function Tt(o, t, r, e) {
|
|
142
|
+
for (var f = 0, s = 0, a = Math.min(o.length, r), u = t; u < a; u++) {
|
|
143
|
+
var h = o.charCodeAt(u) - 48;
|
|
144
|
+
f *= e, h >= 49 ? s = h - 49 + 10 : h >= 17 ? s = h - 17 + 10 : s = h, d(h >= 0 && s < e, "Invalid character"), f += s;
|
|
145
|
+
}
|
|
146
|
+
return f;
|
|
147
|
+
}
|
|
148
|
+
l.prototype._parseBase = function(t, r, e) {
|
|
149
|
+
this.words = [0], this.length = 1;
|
|
150
|
+
for (var f = 0, s = 1; s <= 67108863; s *= r)
|
|
151
|
+
f++;
|
|
152
|
+
f--, s = s / r | 0;
|
|
153
|
+
for (var a = t.length - e, u = a % f, h = Math.min(a, a - u) + e, i = 0, n = e; n < h; n += f)
|
|
154
|
+
i = Tt(t, n, n + f, r), this.imuln(s), this.words[0] + i < 67108864 ? this.words[0] += i : this._iaddn(i);
|
|
155
|
+
if (u !== 0) {
|
|
156
|
+
var m = 1;
|
|
157
|
+
for (i = Tt(t, n, t.length, r), n = 0; n < u; n++)
|
|
158
|
+
m *= r;
|
|
159
|
+
this.imuln(m), this.words[0] + i < 67108864 ? this.words[0] += i : this._iaddn(i);
|
|
160
|
+
}
|
|
161
|
+
this._strip();
|
|
162
|
+
}, l.prototype.copy = function(t) {
|
|
163
|
+
t.words = new Array(this.length);
|
|
164
|
+
for (var r = 0; r < this.length; r++)
|
|
165
|
+
t.words[r] = this.words[r];
|
|
166
|
+
t.length = this.length, t.negative = this.negative, t.red = this.red;
|
|
167
|
+
};
|
|
168
|
+
function It(o, t) {
|
|
169
|
+
o.words = t.words, o.length = t.length, o.negative = t.negative, o.red = t.red;
|
|
170
|
+
}
|
|
171
|
+
if (l.prototype._move = function(t) {
|
|
172
|
+
It(t, this);
|
|
173
|
+
}, l.prototype.clone = function() {
|
|
174
|
+
var t = new l(null);
|
|
175
|
+
return this.copy(t), t;
|
|
176
|
+
}, l.prototype._expand = function(t) {
|
|
177
|
+
for (; this.length < t; )
|
|
178
|
+
this.words[this.length++] = 0;
|
|
179
|
+
return this;
|
|
180
|
+
}, l.prototype._strip = function() {
|
|
181
|
+
for (; this.length > 1 && this.words[this.length - 1] === 0; )
|
|
182
|
+
this.length--;
|
|
183
|
+
return this._normSign();
|
|
184
|
+
}, l.prototype._normSign = function() {
|
|
185
|
+
return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
|
|
186
|
+
}, typeof Symbol < "u" && typeof Symbol.for == "function")
|
|
187
|
+
try {
|
|
188
|
+
l.prototype[Symbol.for("nodejs.util.inspect.custom")] = ut;
|
|
189
|
+
} catch {
|
|
190
|
+
l.prototype.inspect = ut;
|
|
191
|
+
}
|
|
192
|
+
else
|
|
193
|
+
l.prototype.inspect = ut;
|
|
194
|
+
function ut() {
|
|
195
|
+
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
|
|
196
|
+
}
|
|
197
|
+
var zt = [
|
|
198
|
+
"",
|
|
199
|
+
"0",
|
|
200
|
+
"00",
|
|
201
|
+
"000",
|
|
202
|
+
"0000",
|
|
203
|
+
"00000",
|
|
204
|
+
"000000",
|
|
205
|
+
"0000000",
|
|
206
|
+
"00000000",
|
|
207
|
+
"000000000",
|
|
208
|
+
"0000000000",
|
|
209
|
+
"00000000000",
|
|
210
|
+
"000000000000",
|
|
211
|
+
"0000000000000",
|
|
212
|
+
"00000000000000",
|
|
213
|
+
"000000000000000",
|
|
214
|
+
"0000000000000000",
|
|
215
|
+
"00000000000000000",
|
|
216
|
+
"000000000000000000",
|
|
217
|
+
"0000000000000000000",
|
|
218
|
+
"00000000000000000000",
|
|
219
|
+
"000000000000000000000",
|
|
220
|
+
"0000000000000000000000",
|
|
221
|
+
"00000000000000000000000",
|
|
222
|
+
"000000000000000000000000",
|
|
223
|
+
"0000000000000000000000000"
|
|
224
|
+
], li = [
|
|
225
|
+
0,
|
|
226
|
+
0,
|
|
227
|
+
25,
|
|
228
|
+
16,
|
|
229
|
+
12,
|
|
230
|
+
11,
|
|
231
|
+
10,
|
|
232
|
+
9,
|
|
233
|
+
8,
|
|
234
|
+
8,
|
|
235
|
+
7,
|
|
236
|
+
7,
|
|
237
|
+
7,
|
|
238
|
+
7,
|
|
239
|
+
6,
|
|
240
|
+
6,
|
|
241
|
+
6,
|
|
242
|
+
6,
|
|
243
|
+
6,
|
|
244
|
+
6,
|
|
245
|
+
6,
|
|
246
|
+
5,
|
|
247
|
+
5,
|
|
248
|
+
5,
|
|
249
|
+
5,
|
|
250
|
+
5,
|
|
251
|
+
5,
|
|
252
|
+
5,
|
|
253
|
+
5,
|
|
254
|
+
5,
|
|
255
|
+
5,
|
|
256
|
+
5,
|
|
257
|
+
5,
|
|
258
|
+
5,
|
|
259
|
+
5,
|
|
260
|
+
5,
|
|
261
|
+
5
|
|
262
|
+
], ui = [
|
|
263
|
+
0,
|
|
264
|
+
0,
|
|
265
|
+
33554432,
|
|
266
|
+
43046721,
|
|
267
|
+
16777216,
|
|
268
|
+
48828125,
|
|
269
|
+
60466176,
|
|
270
|
+
40353607,
|
|
271
|
+
16777216,
|
|
272
|
+
43046721,
|
|
273
|
+
1e7,
|
|
274
|
+
19487171,
|
|
275
|
+
35831808,
|
|
276
|
+
62748517,
|
|
277
|
+
7529536,
|
|
278
|
+
11390625,
|
|
279
|
+
16777216,
|
|
280
|
+
24137569,
|
|
281
|
+
34012224,
|
|
282
|
+
47045881,
|
|
283
|
+
64e6,
|
|
284
|
+
4084101,
|
|
285
|
+
5153632,
|
|
286
|
+
6436343,
|
|
287
|
+
7962624,
|
|
288
|
+
9765625,
|
|
289
|
+
11881376,
|
|
290
|
+
14348907,
|
|
291
|
+
17210368,
|
|
292
|
+
20511149,
|
|
293
|
+
243e5,
|
|
294
|
+
28629151,
|
|
295
|
+
33554432,
|
|
296
|
+
39135393,
|
|
297
|
+
45435424,
|
|
298
|
+
52521875,
|
|
299
|
+
60466176
|
|
300
|
+
];
|
|
301
|
+
l.prototype.toString = function(t, r) {
|
|
302
|
+
t = t || 10, r = r | 0 || 1;
|
|
303
|
+
var e;
|
|
304
|
+
if (t === 16 || t === "hex") {
|
|
305
|
+
e = "";
|
|
306
|
+
for (var f = 0, s = 0, a = 0; a < this.length; a++) {
|
|
307
|
+
var u = this.words[a], h = ((u << f | s) & 16777215).toString(16);
|
|
308
|
+
s = u >>> 24 - f & 16777215, f += 2, f >= 26 && (f -= 26, a--), s !== 0 || a !== this.length - 1 ? e = zt[6 - h.length] + h + e : e = h + e;
|
|
309
|
+
}
|
|
310
|
+
for (s !== 0 && (e = s.toString(16) + e); e.length % r !== 0; )
|
|
311
|
+
e = "0" + e;
|
|
312
|
+
return this.negative !== 0 && (e = "-" + e), e;
|
|
313
|
+
}
|
|
314
|
+
if (t === (t | 0) && t >= 2 && t <= 36) {
|
|
315
|
+
var i = li[t], n = ui[t];
|
|
316
|
+
e = "";
|
|
317
|
+
var m = this.clone();
|
|
318
|
+
for (m.negative = 0; !m.isZero(); ) {
|
|
319
|
+
var v = m.modrn(n).toString(t);
|
|
320
|
+
m = m.idivn(n), m.isZero() ? e = v + e : e = zt[i - v.length] + v + e;
|
|
321
|
+
}
|
|
322
|
+
for (this.isZero() && (e = "0" + e); e.length % r !== 0; )
|
|
323
|
+
e = "0" + e;
|
|
324
|
+
return this.negative !== 0 && (e = "-" + e), e;
|
|
325
|
+
}
|
|
326
|
+
d(!1, "Base should be between 2 and 36");
|
|
327
|
+
}, l.prototype.toNumber = function() {
|
|
328
|
+
var t = this.words[0];
|
|
329
|
+
return this.length === 2 ? t += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 ? t += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && d(!1, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -t : t;
|
|
330
|
+
}, l.prototype.toJSON = function() {
|
|
331
|
+
return this.toString(16, 2);
|
|
332
|
+
}, ot && (l.prototype.toBuffer = function(t, r) {
|
|
333
|
+
return this.toArrayLike(ot, t, r);
|
|
334
|
+
}), l.prototype.toArray = function(t, r) {
|
|
335
|
+
return this.toArrayLike(Array, t, r);
|
|
336
|
+
};
|
|
337
|
+
var di = function(t, r) {
|
|
338
|
+
return t.allocUnsafe ? t.allocUnsafe(r) : new t(r);
|
|
339
|
+
};
|
|
340
|
+
l.prototype.toArrayLike = function(t, r, e) {
|
|
341
|
+
this._strip();
|
|
342
|
+
var f = this.byteLength(), s = e || Math.max(1, f);
|
|
343
|
+
d(f <= s, "byte array longer than desired length"), d(s > 0, "Requested array length <= 0");
|
|
344
|
+
var a = di(t, s), u = r === "le" ? "LE" : "BE";
|
|
345
|
+
return this["_toArrayLike" + u](a, f), a;
|
|
346
|
+
}, l.prototype._toArrayLikeLE = function(t, r) {
|
|
347
|
+
for (var e = 0, f = 0, s = 0, a = 0; s < this.length; s++) {
|
|
348
|
+
var u = this.words[s] << a | f;
|
|
349
|
+
t[e++] = u & 255, e < t.length && (t[e++] = u >> 8 & 255), e < t.length && (t[e++] = u >> 16 & 255), a === 6 ? (e < t.length && (t[e++] = u >> 24 & 255), f = 0, a = 0) : (f = u >>> 24, a += 2);
|
|
350
|
+
}
|
|
351
|
+
if (e < t.length)
|
|
352
|
+
for (t[e++] = f; e < t.length; )
|
|
353
|
+
t[e++] = 0;
|
|
354
|
+
}, l.prototype._toArrayLikeBE = function(t, r) {
|
|
355
|
+
for (var e = t.length - 1, f = 0, s = 0, a = 0; s < this.length; s++) {
|
|
356
|
+
var u = this.words[s] << a | f;
|
|
357
|
+
t[e--] = u & 255, e >= 0 && (t[e--] = u >> 8 & 255), e >= 0 && (t[e--] = u >> 16 & 255), a === 6 ? (e >= 0 && (t[e--] = u >> 24 & 255), f = 0, a = 0) : (f = u >>> 24, a += 2);
|
|
358
|
+
}
|
|
359
|
+
if (e >= 0)
|
|
360
|
+
for (t[e--] = f; e >= 0; )
|
|
361
|
+
t[e--] = 0;
|
|
362
|
+
}, Math.clz32 ? l.prototype._countBits = function(t) {
|
|
363
|
+
return 32 - Math.clz32(t);
|
|
364
|
+
} : l.prototype._countBits = function(t) {
|
|
365
|
+
var r = t, e = 0;
|
|
366
|
+
return r >= 4096 && (e += 13, r >>>= 13), r >= 64 && (e += 7, r >>>= 7), r >= 8 && (e += 4, r >>>= 4), r >= 2 && (e += 2, r >>>= 2), e + r;
|
|
367
|
+
}, l.prototype._zeroBits = function(t) {
|
|
368
|
+
if (t === 0) return 26;
|
|
369
|
+
var r = t, e = 0;
|
|
370
|
+
return (r & 8191) === 0 && (e += 13, r >>>= 13), (r & 127) === 0 && (e += 7, r >>>= 7), (r & 15) === 0 && (e += 4, r >>>= 4), (r & 3) === 0 && (e += 2, r >>>= 2), (r & 1) === 0 && e++, e;
|
|
371
|
+
}, l.prototype.bitLength = function() {
|
|
372
|
+
var t = this.words[this.length - 1], r = this._countBits(t);
|
|
373
|
+
return (this.length - 1) * 26 + r;
|
|
374
|
+
};
|
|
375
|
+
function vi(o) {
|
|
376
|
+
for (var t = new Array(o.bitLength()), r = 0; r < t.length; r++) {
|
|
377
|
+
var e = r / 26 | 0, f = r % 26;
|
|
378
|
+
t[r] = o.words[e] >>> f & 1;
|
|
379
|
+
}
|
|
380
|
+
return t;
|
|
381
|
+
}
|
|
382
|
+
l.prototype.zeroBits = function() {
|
|
383
|
+
if (this.isZero()) return 0;
|
|
384
|
+
for (var t = 0, r = 0; r < this.length; r++) {
|
|
385
|
+
var e = this._zeroBits(this.words[r]);
|
|
386
|
+
if (t += e, e !== 26) break;
|
|
387
|
+
}
|
|
388
|
+
return t;
|
|
389
|
+
}, l.prototype.byteLength = function() {
|
|
390
|
+
return Math.ceil(this.bitLength() / 8);
|
|
391
|
+
}, l.prototype.toTwos = function(t) {
|
|
392
|
+
return this.negative !== 0 ? this.abs().inotn(t).iaddn(1) : this.clone();
|
|
393
|
+
}, l.prototype.fromTwos = function(t) {
|
|
394
|
+
return this.testn(t - 1) ? this.notn(t).iaddn(1).ineg() : this.clone();
|
|
395
|
+
}, l.prototype.isNeg = function() {
|
|
396
|
+
return this.negative !== 0;
|
|
397
|
+
}, l.prototype.neg = function() {
|
|
398
|
+
return this.clone().ineg();
|
|
399
|
+
}, l.prototype.ineg = function() {
|
|
400
|
+
return this.isZero() || (this.negative ^= 1), this;
|
|
401
|
+
}, l.prototype.iuor = function(t) {
|
|
402
|
+
for (; this.length < t.length; )
|
|
403
|
+
this.words[this.length++] = 0;
|
|
404
|
+
for (var r = 0; r < t.length; r++)
|
|
405
|
+
this.words[r] = this.words[r] | t.words[r];
|
|
406
|
+
return this._strip();
|
|
407
|
+
}, l.prototype.ior = function(t) {
|
|
408
|
+
return d((this.negative | t.negative) === 0), this.iuor(t);
|
|
409
|
+
}, l.prototype.or = function(t) {
|
|
410
|
+
return this.length > t.length ? this.clone().ior(t) : t.clone().ior(this);
|
|
411
|
+
}, l.prototype.uor = function(t) {
|
|
412
|
+
return this.length > t.length ? this.clone().iuor(t) : t.clone().iuor(this);
|
|
413
|
+
}, l.prototype.iuand = function(t) {
|
|
414
|
+
var r;
|
|
415
|
+
this.length > t.length ? r = t : r = this;
|
|
416
|
+
for (var e = 0; e < r.length; e++)
|
|
417
|
+
this.words[e] = this.words[e] & t.words[e];
|
|
418
|
+
return this.length = r.length, this._strip();
|
|
419
|
+
}, l.prototype.iand = function(t) {
|
|
420
|
+
return d((this.negative | t.negative) === 0), this.iuand(t);
|
|
421
|
+
}, l.prototype.and = function(t) {
|
|
422
|
+
return this.length > t.length ? this.clone().iand(t) : t.clone().iand(this);
|
|
423
|
+
}, l.prototype.uand = function(t) {
|
|
424
|
+
return this.length > t.length ? this.clone().iuand(t) : t.clone().iuand(this);
|
|
425
|
+
}, l.prototype.iuxor = function(t) {
|
|
426
|
+
var r, e;
|
|
427
|
+
this.length > t.length ? (r = this, e = t) : (r = t, e = this);
|
|
428
|
+
for (var f = 0; f < e.length; f++)
|
|
429
|
+
this.words[f] = r.words[f] ^ e.words[f];
|
|
430
|
+
if (this !== r)
|
|
431
|
+
for (; f < r.length; f++)
|
|
432
|
+
this.words[f] = r.words[f];
|
|
433
|
+
return this.length = r.length, this._strip();
|
|
434
|
+
}, l.prototype.ixor = function(t) {
|
|
435
|
+
return d((this.negative | t.negative) === 0), this.iuxor(t);
|
|
436
|
+
}, l.prototype.xor = function(t) {
|
|
437
|
+
return this.length > t.length ? this.clone().ixor(t) : t.clone().ixor(this);
|
|
438
|
+
}, l.prototype.uxor = function(t) {
|
|
439
|
+
return this.length > t.length ? this.clone().iuxor(t) : t.clone().iuxor(this);
|
|
440
|
+
}, l.prototype.inotn = function(t) {
|
|
441
|
+
d(typeof t == "number" && t >= 0);
|
|
442
|
+
var r = Math.ceil(t / 26) | 0, e = t % 26;
|
|
443
|
+
this._expand(r), e > 0 && r--;
|
|
444
|
+
for (var f = 0; f < r; f++)
|
|
445
|
+
this.words[f] = ~this.words[f] & 67108863;
|
|
446
|
+
return e > 0 && (this.words[f] = ~this.words[f] & 67108863 >> 26 - e), this._strip();
|
|
447
|
+
}, l.prototype.notn = function(t) {
|
|
448
|
+
return this.clone().inotn(t);
|
|
449
|
+
}, l.prototype.setn = function(t, r) {
|
|
450
|
+
d(typeof t == "number" && t >= 0);
|
|
451
|
+
var e = t / 26 | 0, f = t % 26;
|
|
452
|
+
return this._expand(e + 1), r ? this.words[e] = this.words[e] | 1 << f : this.words[e] = this.words[e] & ~(1 << f), this._strip();
|
|
453
|
+
}, l.prototype.iadd = function(t) {
|
|
454
|
+
var r;
|
|
455
|
+
if (this.negative !== 0 && t.negative === 0)
|
|
456
|
+
return this.negative = 0, r = this.isub(t), this.negative ^= 1, this._normSign();
|
|
457
|
+
if (this.negative === 0 && t.negative !== 0)
|
|
458
|
+
return t.negative = 0, r = this.isub(t), t.negative = 1, r._normSign();
|
|
459
|
+
var e, f;
|
|
460
|
+
this.length > t.length ? (e = this, f = t) : (e = t, f = this);
|
|
461
|
+
for (var s = 0, a = 0; a < f.length; a++)
|
|
462
|
+
r = (e.words[a] | 0) + (f.words[a] | 0) + s, this.words[a] = r & 67108863, s = r >>> 26;
|
|
463
|
+
for (; s !== 0 && a < e.length; a++)
|
|
464
|
+
r = (e.words[a] | 0) + s, this.words[a] = r & 67108863, s = r >>> 26;
|
|
465
|
+
if (this.length = e.length, s !== 0)
|
|
466
|
+
this.words[this.length] = s, this.length++;
|
|
467
|
+
else if (e !== this)
|
|
468
|
+
for (; a < e.length; a++)
|
|
469
|
+
this.words[a] = e.words[a];
|
|
470
|
+
return this;
|
|
471
|
+
}, l.prototype.add = function(t) {
|
|
472
|
+
var r;
|
|
473
|
+
return t.negative !== 0 && this.negative === 0 ? (t.negative = 0, r = this.sub(t), t.negative ^= 1, r) : t.negative === 0 && this.negative !== 0 ? (this.negative = 0, r = t.sub(this), this.negative = 1, r) : this.length > t.length ? this.clone().iadd(t) : t.clone().iadd(this);
|
|
474
|
+
}, l.prototype.isub = function(t) {
|
|
475
|
+
if (t.negative !== 0) {
|
|
476
|
+
t.negative = 0;
|
|
477
|
+
var r = this.iadd(t);
|
|
478
|
+
return t.negative = 1, r._normSign();
|
|
479
|
+
} else if (this.negative !== 0)
|
|
480
|
+
return this.negative = 0, this.iadd(t), this.negative = 1, this._normSign();
|
|
481
|
+
var e = this.cmp(t);
|
|
482
|
+
if (e === 0)
|
|
483
|
+
return this.negative = 0, this.length = 1, this.words[0] = 0, this;
|
|
484
|
+
var f, s;
|
|
485
|
+
e > 0 ? (f = this, s = t) : (f = t, s = this);
|
|
486
|
+
for (var a = 0, u = 0; u < s.length; u++)
|
|
487
|
+
r = (f.words[u] | 0) - (s.words[u] | 0) + a, a = r >> 26, this.words[u] = r & 67108863;
|
|
488
|
+
for (; a !== 0 && u < f.length; u++)
|
|
489
|
+
r = (f.words[u] | 0) + a, a = r >> 26, this.words[u] = r & 67108863;
|
|
490
|
+
if (a === 0 && u < f.length && f !== this)
|
|
491
|
+
for (; u < f.length; u++)
|
|
492
|
+
this.words[u] = f.words[u];
|
|
493
|
+
return this.length = Math.max(this.length, u), f !== this && (this.negative = 1), this._strip();
|
|
494
|
+
}, l.prototype.sub = function(t) {
|
|
495
|
+
return this.clone().isub(t);
|
|
496
|
+
};
|
|
497
|
+
function Pt(o, t, r) {
|
|
498
|
+
r.negative = t.negative ^ o.negative;
|
|
499
|
+
var e = o.length + t.length | 0;
|
|
500
|
+
r.length = e, e = e - 1 | 0;
|
|
501
|
+
var f = o.words[0] | 0, s = t.words[0] | 0, a = f * s, u = a & 67108863, h = a / 67108864 | 0;
|
|
502
|
+
r.words[0] = u;
|
|
503
|
+
for (var i = 1; i < e; i++) {
|
|
504
|
+
for (var n = h >>> 26, m = h & 67108863, v = Math.min(i, t.length - 1), p = Math.max(0, i - o.length + 1); p <= v; p++) {
|
|
505
|
+
var et = i - p | 0;
|
|
506
|
+
f = o.words[et] | 0, s = t.words[p] | 0, a = f * s + m, n += a / 67108864 | 0, m = a & 67108863;
|
|
507
|
+
}
|
|
508
|
+
r.words[i] = m | 0, h = n | 0;
|
|
509
|
+
}
|
|
510
|
+
return h !== 0 ? r.words[i] = h | 0 : r.length--, r._strip();
|
|
511
|
+
}
|
|
512
|
+
var Kt = function(t, r, e) {
|
|
513
|
+
var f = t.words, s = r.words, a = e.words, u = 0, h, i, n, m = f[0] | 0, v = m & 8191, p = m >>> 13, et = f[1] | 0, M = et & 8191, c = et >>> 13, Ct = f[2] | 0, w = Ct & 8191, y = Ct >>> 13, Ut = f[3] | 0, x = Ut & 8191, _ = Ut >>> 13, Jt = f[4] | 0, b = Jt & 8191, S = Jt >>> 13, Wt = f[5] | 0, A = Wt & 8191, B = Wt >>> 13, Gt = f[6] | 0, k = Gt & 8191, q = Gt >>> 13, Qt = f[7] | 0, N = Qt & 8191, R = Qt >>> 13, Vt = f[8] | 0, L = Vt & 8191, O = Vt >>> 13, Xt = f[9] | 0, Z = Xt & 8191, E = Xt >>> 13, Yt = s[0] | 0, T = Yt & 8191, I = Yt >>> 13, jt = s[1] | 0, z = jt & 8191, P = jt >>> 13, ti = s[2] | 0, K = ti & 8191, D = ti >>> 13, ii = s[3] | 0, F = ii & 8191, $ = ii >>> 13, ri = s[4] | 0, H = ri & 8191, C = ri >>> 13, ei = s[5] | 0, U = ei & 8191, J = ei >>> 13, hi = s[6] | 0, W = hi & 8191, G = hi >>> 13, fi = s[7] | 0, Q = fi & 8191, V = fi >>> 13, ni = s[8] | 0, X = ni & 8191, Y = ni >>> 13, si = s[9] | 0, j = si & 8191, tt = si >>> 13;
|
|
514
|
+
e.negative = t.negative ^ r.negative, e.length = 19, h = Math.imul(v, T), i = Math.imul(v, I), i = i + Math.imul(p, T) | 0, n = Math.imul(p, I);
|
|
515
|
+
var mt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
516
|
+
u = (n + (i >>> 13) | 0) + (mt >>> 26) | 0, mt &= 67108863, h = Math.imul(M, T), i = Math.imul(M, I), i = i + Math.imul(c, T) | 0, n = Math.imul(c, I), h = h + Math.imul(v, z) | 0, i = i + Math.imul(v, P) | 0, i = i + Math.imul(p, z) | 0, n = n + Math.imul(p, P) | 0;
|
|
517
|
+
var pt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
518
|
+
u = (n + (i >>> 13) | 0) + (pt >>> 26) | 0, pt &= 67108863, h = Math.imul(w, T), i = Math.imul(w, I), i = i + Math.imul(y, T) | 0, n = Math.imul(y, I), h = h + Math.imul(M, z) | 0, i = i + Math.imul(M, P) | 0, i = i + Math.imul(c, z) | 0, n = n + Math.imul(c, P) | 0, h = h + Math.imul(v, K) | 0, i = i + Math.imul(v, D) | 0, i = i + Math.imul(p, K) | 0, n = n + Math.imul(p, D) | 0;
|
|
519
|
+
var Mt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
520
|
+
u = (n + (i >>> 13) | 0) + (Mt >>> 26) | 0, Mt &= 67108863, h = Math.imul(x, T), i = Math.imul(x, I), i = i + Math.imul(_, T) | 0, n = Math.imul(_, I), h = h + Math.imul(w, z) | 0, i = i + Math.imul(w, P) | 0, i = i + Math.imul(y, z) | 0, n = n + Math.imul(y, P) | 0, h = h + Math.imul(M, K) | 0, i = i + Math.imul(M, D) | 0, i = i + Math.imul(c, K) | 0, n = n + Math.imul(c, D) | 0, h = h + Math.imul(v, F) | 0, i = i + Math.imul(v, $) | 0, i = i + Math.imul(p, F) | 0, n = n + Math.imul(p, $) | 0;
|
|
521
|
+
var ct = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
522
|
+
u = (n + (i >>> 13) | 0) + (ct >>> 26) | 0, ct &= 67108863, h = Math.imul(b, T), i = Math.imul(b, I), i = i + Math.imul(S, T) | 0, n = Math.imul(S, I), h = h + Math.imul(x, z) | 0, i = i + Math.imul(x, P) | 0, i = i + Math.imul(_, z) | 0, n = n + Math.imul(_, P) | 0, h = h + Math.imul(w, K) | 0, i = i + Math.imul(w, D) | 0, i = i + Math.imul(y, K) | 0, n = n + Math.imul(y, D) | 0, h = h + Math.imul(M, F) | 0, i = i + Math.imul(M, $) | 0, i = i + Math.imul(c, F) | 0, n = n + Math.imul(c, $) | 0, h = h + Math.imul(v, H) | 0, i = i + Math.imul(v, C) | 0, i = i + Math.imul(p, H) | 0, n = n + Math.imul(p, C) | 0;
|
|
523
|
+
var gt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
524
|
+
u = (n + (i >>> 13) | 0) + (gt >>> 26) | 0, gt &= 67108863, h = Math.imul(A, T), i = Math.imul(A, I), i = i + Math.imul(B, T) | 0, n = Math.imul(B, I), h = h + Math.imul(b, z) | 0, i = i + Math.imul(b, P) | 0, i = i + Math.imul(S, z) | 0, n = n + Math.imul(S, P) | 0, h = h + Math.imul(x, K) | 0, i = i + Math.imul(x, D) | 0, i = i + Math.imul(_, K) | 0, n = n + Math.imul(_, D) | 0, h = h + Math.imul(w, F) | 0, i = i + Math.imul(w, $) | 0, i = i + Math.imul(y, F) | 0, n = n + Math.imul(y, $) | 0, h = h + Math.imul(M, H) | 0, i = i + Math.imul(M, C) | 0, i = i + Math.imul(c, H) | 0, n = n + Math.imul(c, C) | 0, h = h + Math.imul(v, U) | 0, i = i + Math.imul(v, J) | 0, i = i + Math.imul(p, U) | 0, n = n + Math.imul(p, J) | 0;
|
|
525
|
+
var wt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
526
|
+
u = (n + (i >>> 13) | 0) + (wt >>> 26) | 0, wt &= 67108863, h = Math.imul(k, T), i = Math.imul(k, I), i = i + Math.imul(q, T) | 0, n = Math.imul(q, I), h = h + Math.imul(A, z) | 0, i = i + Math.imul(A, P) | 0, i = i + Math.imul(B, z) | 0, n = n + Math.imul(B, P) | 0, h = h + Math.imul(b, K) | 0, i = i + Math.imul(b, D) | 0, i = i + Math.imul(S, K) | 0, n = n + Math.imul(S, D) | 0, h = h + Math.imul(x, F) | 0, i = i + Math.imul(x, $) | 0, i = i + Math.imul(_, F) | 0, n = n + Math.imul(_, $) | 0, h = h + Math.imul(w, H) | 0, i = i + Math.imul(w, C) | 0, i = i + Math.imul(y, H) | 0, n = n + Math.imul(y, C) | 0, h = h + Math.imul(M, U) | 0, i = i + Math.imul(M, J) | 0, i = i + Math.imul(c, U) | 0, n = n + Math.imul(c, J) | 0, h = h + Math.imul(v, W) | 0, i = i + Math.imul(v, G) | 0, i = i + Math.imul(p, W) | 0, n = n + Math.imul(p, G) | 0;
|
|
527
|
+
var yt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
528
|
+
u = (n + (i >>> 13) | 0) + (yt >>> 26) | 0, yt &= 67108863, h = Math.imul(N, T), i = Math.imul(N, I), i = i + Math.imul(R, T) | 0, n = Math.imul(R, I), h = h + Math.imul(k, z) | 0, i = i + Math.imul(k, P) | 0, i = i + Math.imul(q, z) | 0, n = n + Math.imul(q, P) | 0, h = h + Math.imul(A, K) | 0, i = i + Math.imul(A, D) | 0, i = i + Math.imul(B, K) | 0, n = n + Math.imul(B, D) | 0, h = h + Math.imul(b, F) | 0, i = i + Math.imul(b, $) | 0, i = i + Math.imul(S, F) | 0, n = n + Math.imul(S, $) | 0, h = h + Math.imul(x, H) | 0, i = i + Math.imul(x, C) | 0, i = i + Math.imul(_, H) | 0, n = n + Math.imul(_, C) | 0, h = h + Math.imul(w, U) | 0, i = i + Math.imul(w, J) | 0, i = i + Math.imul(y, U) | 0, n = n + Math.imul(y, J) | 0, h = h + Math.imul(M, W) | 0, i = i + Math.imul(M, G) | 0, i = i + Math.imul(c, W) | 0, n = n + Math.imul(c, G) | 0, h = h + Math.imul(v, Q) | 0, i = i + Math.imul(v, V) | 0, i = i + Math.imul(p, Q) | 0, n = n + Math.imul(p, V) | 0;
|
|
529
|
+
var xt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
530
|
+
u = (n + (i >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, h = Math.imul(L, T), i = Math.imul(L, I), i = i + Math.imul(O, T) | 0, n = Math.imul(O, I), h = h + Math.imul(N, z) | 0, i = i + Math.imul(N, P) | 0, i = i + Math.imul(R, z) | 0, n = n + Math.imul(R, P) | 0, h = h + Math.imul(k, K) | 0, i = i + Math.imul(k, D) | 0, i = i + Math.imul(q, K) | 0, n = n + Math.imul(q, D) | 0, h = h + Math.imul(A, F) | 0, i = i + Math.imul(A, $) | 0, i = i + Math.imul(B, F) | 0, n = n + Math.imul(B, $) | 0, h = h + Math.imul(b, H) | 0, i = i + Math.imul(b, C) | 0, i = i + Math.imul(S, H) | 0, n = n + Math.imul(S, C) | 0, h = h + Math.imul(x, U) | 0, i = i + Math.imul(x, J) | 0, i = i + Math.imul(_, U) | 0, n = n + Math.imul(_, J) | 0, h = h + Math.imul(w, W) | 0, i = i + Math.imul(w, G) | 0, i = i + Math.imul(y, W) | 0, n = n + Math.imul(y, G) | 0, h = h + Math.imul(M, Q) | 0, i = i + Math.imul(M, V) | 0, i = i + Math.imul(c, Q) | 0, n = n + Math.imul(c, V) | 0, h = h + Math.imul(v, X) | 0, i = i + Math.imul(v, Y) | 0, i = i + Math.imul(p, X) | 0, n = n + Math.imul(p, Y) | 0;
|
|
531
|
+
var _t = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
532
|
+
u = (n + (i >>> 13) | 0) + (_t >>> 26) | 0, _t &= 67108863, h = Math.imul(Z, T), i = Math.imul(Z, I), i = i + Math.imul(E, T) | 0, n = Math.imul(E, I), h = h + Math.imul(L, z) | 0, i = i + Math.imul(L, P) | 0, i = i + Math.imul(O, z) | 0, n = n + Math.imul(O, P) | 0, h = h + Math.imul(N, K) | 0, i = i + Math.imul(N, D) | 0, i = i + Math.imul(R, K) | 0, n = n + Math.imul(R, D) | 0, h = h + Math.imul(k, F) | 0, i = i + Math.imul(k, $) | 0, i = i + Math.imul(q, F) | 0, n = n + Math.imul(q, $) | 0, h = h + Math.imul(A, H) | 0, i = i + Math.imul(A, C) | 0, i = i + Math.imul(B, H) | 0, n = n + Math.imul(B, C) | 0, h = h + Math.imul(b, U) | 0, i = i + Math.imul(b, J) | 0, i = i + Math.imul(S, U) | 0, n = n + Math.imul(S, J) | 0, h = h + Math.imul(x, W) | 0, i = i + Math.imul(x, G) | 0, i = i + Math.imul(_, W) | 0, n = n + Math.imul(_, G) | 0, h = h + Math.imul(w, Q) | 0, i = i + Math.imul(w, V) | 0, i = i + Math.imul(y, Q) | 0, n = n + Math.imul(y, V) | 0, h = h + Math.imul(M, X) | 0, i = i + Math.imul(M, Y) | 0, i = i + Math.imul(c, X) | 0, n = n + Math.imul(c, Y) | 0, h = h + Math.imul(v, j) | 0, i = i + Math.imul(v, tt) | 0, i = i + Math.imul(p, j) | 0, n = n + Math.imul(p, tt) | 0;
|
|
533
|
+
var bt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
534
|
+
u = (n + (i >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, h = Math.imul(Z, z), i = Math.imul(Z, P), i = i + Math.imul(E, z) | 0, n = Math.imul(E, P), h = h + Math.imul(L, K) | 0, i = i + Math.imul(L, D) | 0, i = i + Math.imul(O, K) | 0, n = n + Math.imul(O, D) | 0, h = h + Math.imul(N, F) | 0, i = i + Math.imul(N, $) | 0, i = i + Math.imul(R, F) | 0, n = n + Math.imul(R, $) | 0, h = h + Math.imul(k, H) | 0, i = i + Math.imul(k, C) | 0, i = i + Math.imul(q, H) | 0, n = n + Math.imul(q, C) | 0, h = h + Math.imul(A, U) | 0, i = i + Math.imul(A, J) | 0, i = i + Math.imul(B, U) | 0, n = n + Math.imul(B, J) | 0, h = h + Math.imul(b, W) | 0, i = i + Math.imul(b, G) | 0, i = i + Math.imul(S, W) | 0, n = n + Math.imul(S, G) | 0, h = h + Math.imul(x, Q) | 0, i = i + Math.imul(x, V) | 0, i = i + Math.imul(_, Q) | 0, n = n + Math.imul(_, V) | 0, h = h + Math.imul(w, X) | 0, i = i + Math.imul(w, Y) | 0, i = i + Math.imul(y, X) | 0, n = n + Math.imul(y, Y) | 0, h = h + Math.imul(M, j) | 0, i = i + Math.imul(M, tt) | 0, i = i + Math.imul(c, j) | 0, n = n + Math.imul(c, tt) | 0;
|
|
535
|
+
var St = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
536
|
+
u = (n + (i >>> 13) | 0) + (St >>> 26) | 0, St &= 67108863, h = Math.imul(Z, K), i = Math.imul(Z, D), i = i + Math.imul(E, K) | 0, n = Math.imul(E, D), h = h + Math.imul(L, F) | 0, i = i + Math.imul(L, $) | 0, i = i + Math.imul(O, F) | 0, n = n + Math.imul(O, $) | 0, h = h + Math.imul(N, H) | 0, i = i + Math.imul(N, C) | 0, i = i + Math.imul(R, H) | 0, n = n + Math.imul(R, C) | 0, h = h + Math.imul(k, U) | 0, i = i + Math.imul(k, J) | 0, i = i + Math.imul(q, U) | 0, n = n + Math.imul(q, J) | 0, h = h + Math.imul(A, W) | 0, i = i + Math.imul(A, G) | 0, i = i + Math.imul(B, W) | 0, n = n + Math.imul(B, G) | 0, h = h + Math.imul(b, Q) | 0, i = i + Math.imul(b, V) | 0, i = i + Math.imul(S, Q) | 0, n = n + Math.imul(S, V) | 0, h = h + Math.imul(x, X) | 0, i = i + Math.imul(x, Y) | 0, i = i + Math.imul(_, X) | 0, n = n + Math.imul(_, Y) | 0, h = h + Math.imul(w, j) | 0, i = i + Math.imul(w, tt) | 0, i = i + Math.imul(y, j) | 0, n = n + Math.imul(y, tt) | 0;
|
|
537
|
+
var At = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
538
|
+
u = (n + (i >>> 13) | 0) + (At >>> 26) | 0, At &= 67108863, h = Math.imul(Z, F), i = Math.imul(Z, $), i = i + Math.imul(E, F) | 0, n = Math.imul(E, $), h = h + Math.imul(L, H) | 0, i = i + Math.imul(L, C) | 0, i = i + Math.imul(O, H) | 0, n = n + Math.imul(O, C) | 0, h = h + Math.imul(N, U) | 0, i = i + Math.imul(N, J) | 0, i = i + Math.imul(R, U) | 0, n = n + Math.imul(R, J) | 0, h = h + Math.imul(k, W) | 0, i = i + Math.imul(k, G) | 0, i = i + Math.imul(q, W) | 0, n = n + Math.imul(q, G) | 0, h = h + Math.imul(A, Q) | 0, i = i + Math.imul(A, V) | 0, i = i + Math.imul(B, Q) | 0, n = n + Math.imul(B, V) | 0, h = h + Math.imul(b, X) | 0, i = i + Math.imul(b, Y) | 0, i = i + Math.imul(S, X) | 0, n = n + Math.imul(S, Y) | 0, h = h + Math.imul(x, j) | 0, i = i + Math.imul(x, tt) | 0, i = i + Math.imul(_, j) | 0, n = n + Math.imul(_, tt) | 0;
|
|
539
|
+
var Bt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
540
|
+
u = (n + (i >>> 13) | 0) + (Bt >>> 26) | 0, Bt &= 67108863, h = Math.imul(Z, H), i = Math.imul(Z, C), i = i + Math.imul(E, H) | 0, n = Math.imul(E, C), h = h + Math.imul(L, U) | 0, i = i + Math.imul(L, J) | 0, i = i + Math.imul(O, U) | 0, n = n + Math.imul(O, J) | 0, h = h + Math.imul(N, W) | 0, i = i + Math.imul(N, G) | 0, i = i + Math.imul(R, W) | 0, n = n + Math.imul(R, G) | 0, h = h + Math.imul(k, Q) | 0, i = i + Math.imul(k, V) | 0, i = i + Math.imul(q, Q) | 0, n = n + Math.imul(q, V) | 0, h = h + Math.imul(A, X) | 0, i = i + Math.imul(A, Y) | 0, i = i + Math.imul(B, X) | 0, n = n + Math.imul(B, Y) | 0, h = h + Math.imul(b, j) | 0, i = i + Math.imul(b, tt) | 0, i = i + Math.imul(S, j) | 0, n = n + Math.imul(S, tt) | 0;
|
|
541
|
+
var kt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
542
|
+
u = (n + (i >>> 13) | 0) + (kt >>> 26) | 0, kt &= 67108863, h = Math.imul(Z, U), i = Math.imul(Z, J), i = i + Math.imul(E, U) | 0, n = Math.imul(E, J), h = h + Math.imul(L, W) | 0, i = i + Math.imul(L, G) | 0, i = i + Math.imul(O, W) | 0, n = n + Math.imul(O, G) | 0, h = h + Math.imul(N, Q) | 0, i = i + Math.imul(N, V) | 0, i = i + Math.imul(R, Q) | 0, n = n + Math.imul(R, V) | 0, h = h + Math.imul(k, X) | 0, i = i + Math.imul(k, Y) | 0, i = i + Math.imul(q, X) | 0, n = n + Math.imul(q, Y) | 0, h = h + Math.imul(A, j) | 0, i = i + Math.imul(A, tt) | 0, i = i + Math.imul(B, j) | 0, n = n + Math.imul(B, tt) | 0;
|
|
543
|
+
var qt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
544
|
+
u = (n + (i >>> 13) | 0) + (qt >>> 26) | 0, qt &= 67108863, h = Math.imul(Z, W), i = Math.imul(Z, G), i = i + Math.imul(E, W) | 0, n = Math.imul(E, G), h = h + Math.imul(L, Q) | 0, i = i + Math.imul(L, V) | 0, i = i + Math.imul(O, Q) | 0, n = n + Math.imul(O, V) | 0, h = h + Math.imul(N, X) | 0, i = i + Math.imul(N, Y) | 0, i = i + Math.imul(R, X) | 0, n = n + Math.imul(R, Y) | 0, h = h + Math.imul(k, j) | 0, i = i + Math.imul(k, tt) | 0, i = i + Math.imul(q, j) | 0, n = n + Math.imul(q, tt) | 0;
|
|
545
|
+
var Nt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
546
|
+
u = (n + (i >>> 13) | 0) + (Nt >>> 26) | 0, Nt &= 67108863, h = Math.imul(Z, Q), i = Math.imul(Z, V), i = i + Math.imul(E, Q) | 0, n = Math.imul(E, V), h = h + Math.imul(L, X) | 0, i = i + Math.imul(L, Y) | 0, i = i + Math.imul(O, X) | 0, n = n + Math.imul(O, Y) | 0, h = h + Math.imul(N, j) | 0, i = i + Math.imul(N, tt) | 0, i = i + Math.imul(R, j) | 0, n = n + Math.imul(R, tt) | 0;
|
|
547
|
+
var Rt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
548
|
+
u = (n + (i >>> 13) | 0) + (Rt >>> 26) | 0, Rt &= 67108863, h = Math.imul(Z, X), i = Math.imul(Z, Y), i = i + Math.imul(E, X) | 0, n = Math.imul(E, Y), h = h + Math.imul(L, j) | 0, i = i + Math.imul(L, tt) | 0, i = i + Math.imul(O, j) | 0, n = n + Math.imul(O, tt) | 0;
|
|
549
|
+
var Lt = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
550
|
+
u = (n + (i >>> 13) | 0) + (Lt >>> 26) | 0, Lt &= 67108863, h = Math.imul(Z, j), i = Math.imul(Z, tt), i = i + Math.imul(E, j) | 0, n = Math.imul(E, tt);
|
|
551
|
+
var Ot = (u + h | 0) + ((i & 8191) << 13) | 0;
|
|
552
|
+
return u = (n + (i >>> 13) | 0) + (Ot >>> 26) | 0, Ot &= 67108863, a[0] = mt, a[1] = pt, a[2] = Mt, a[3] = ct, a[4] = gt, a[5] = wt, a[6] = yt, a[7] = xt, a[8] = _t, a[9] = bt, a[10] = St, a[11] = At, a[12] = Bt, a[13] = kt, a[14] = qt, a[15] = Nt, a[16] = Rt, a[17] = Lt, a[18] = Ot, u !== 0 && (a[19] = u, e.length++), e;
|
|
553
|
+
};
|
|
554
|
+
Math.imul || (Kt = Pt);
|
|
555
|
+
function Dt(o, t, r) {
|
|
556
|
+
r.negative = t.negative ^ o.negative, r.length = o.length + t.length;
|
|
557
|
+
for (var e = 0, f = 0, s = 0; s < r.length - 1; s++) {
|
|
558
|
+
var a = f;
|
|
559
|
+
f = 0;
|
|
560
|
+
for (var u = e & 67108863, h = Math.min(s, t.length - 1), i = Math.max(0, s - o.length + 1); i <= h; i++) {
|
|
561
|
+
var n = s - i, m = o.words[n] | 0, v = t.words[i] | 0, p = m * v, et = p & 67108863;
|
|
562
|
+
a = a + (p / 67108864 | 0) | 0, et = et + u | 0, u = et & 67108863, a = a + (et >>> 26) | 0, f += a >>> 26, a &= 67108863;
|
|
563
|
+
}
|
|
564
|
+
r.words[s] = u, e = a, a = f;
|
|
565
|
+
}
|
|
566
|
+
return e !== 0 ? r.words[s] = e : r.length--, r._strip();
|
|
567
|
+
}
|
|
568
|
+
function Ft(o, t, r) {
|
|
569
|
+
return Dt(o, t, r);
|
|
570
|
+
}
|
|
571
|
+
l.prototype.mulTo = function(t, r) {
|
|
572
|
+
var e, f = this.length + t.length;
|
|
573
|
+
return this.length === 10 && t.length === 10 ? e = Kt(this, t, r) : f < 63 ? e = Pt(this, t, r) : f < 1024 ? e = Dt(this, t, r) : e = Ft(this, t, r), e;
|
|
574
|
+
}, l.prototype.mul = function(t) {
|
|
575
|
+
var r = new l(null);
|
|
576
|
+
return r.words = new Array(this.length + t.length), this.mulTo(t, r);
|
|
577
|
+
}, l.prototype.mulf = function(t) {
|
|
578
|
+
var r = new l(null);
|
|
579
|
+
return r.words = new Array(this.length + t.length), Ft(this, t, r);
|
|
580
|
+
}, l.prototype.imul = function(t) {
|
|
581
|
+
return this.clone().mulTo(t, this);
|
|
582
|
+
}, l.prototype.imuln = function(t) {
|
|
583
|
+
var r = t < 0;
|
|
584
|
+
r && (t = -t), d(typeof t == "number"), d(t < 67108864);
|
|
585
|
+
for (var e = 0, f = 0; f < this.length; f++) {
|
|
586
|
+
var s = (this.words[f] | 0) * t, a = (s & 67108863) + (e & 67108863);
|
|
587
|
+
e >>= 26, e += s / 67108864 | 0, e += a >>> 26, this.words[f] = a & 67108863;
|
|
588
|
+
}
|
|
589
|
+
return e !== 0 && (this.words[f] = e, this.length++), this.length = t === 0 ? 1 : this.length, r ? this.ineg() : this;
|
|
590
|
+
}, l.prototype.muln = function(t) {
|
|
591
|
+
return this.clone().imuln(t);
|
|
592
|
+
}, l.prototype.sqr = function() {
|
|
593
|
+
return this.mul(this);
|
|
594
|
+
}, l.prototype.isqr = function() {
|
|
595
|
+
return this.imul(this.clone());
|
|
596
|
+
}, l.prototype.pow = function(t) {
|
|
597
|
+
var r = vi(t);
|
|
598
|
+
if (r.length === 0) return new l(1);
|
|
599
|
+
for (var e = this, f = 0; f < r.length && r[f] === 0; f++, e = e.sqr())
|
|
600
|
+
;
|
|
601
|
+
if (++f < r.length)
|
|
602
|
+
for (var s = e.sqr(); f < r.length; f++, s = s.sqr())
|
|
603
|
+
r[f] !== 0 && (e = e.mul(s));
|
|
604
|
+
return e;
|
|
605
|
+
}, l.prototype.iushln = function(t) {
|
|
606
|
+
d(typeof t == "number" && t >= 0);
|
|
607
|
+
var r = t % 26, e = (t - r) / 26, f = 67108863 >>> 26 - r << 26 - r, s;
|
|
608
|
+
if (r !== 0) {
|
|
609
|
+
var a = 0;
|
|
610
|
+
for (s = 0; s < this.length; s++) {
|
|
611
|
+
var u = this.words[s] & f, h = (this.words[s] | 0) - u << r;
|
|
612
|
+
this.words[s] = h | a, a = u >>> 26 - r;
|
|
613
|
+
}
|
|
614
|
+
a && (this.words[s] = a, this.length++);
|
|
615
|
+
}
|
|
616
|
+
if (e !== 0) {
|
|
617
|
+
for (s = this.length - 1; s >= 0; s--)
|
|
618
|
+
this.words[s + e] = this.words[s];
|
|
619
|
+
for (s = 0; s < e; s++)
|
|
620
|
+
this.words[s] = 0;
|
|
621
|
+
this.length += e;
|
|
622
|
+
}
|
|
623
|
+
return this._strip();
|
|
624
|
+
}, l.prototype.ishln = function(t) {
|
|
625
|
+
return d(this.negative === 0), this.iushln(t);
|
|
626
|
+
}, l.prototype.iushrn = function(t, r, e) {
|
|
627
|
+
d(typeof t == "number" && t >= 0);
|
|
628
|
+
var f;
|
|
629
|
+
r ? f = (r - r % 26) / 26 : f = 0;
|
|
630
|
+
var s = t % 26, a = Math.min((t - s) / 26, this.length), u = 67108863 ^ 67108863 >>> s << s, h = e;
|
|
631
|
+
if (f -= a, f = Math.max(0, f), h) {
|
|
632
|
+
for (var i = 0; i < a; i++)
|
|
633
|
+
h.words[i] = this.words[i];
|
|
634
|
+
h.length = a;
|
|
635
|
+
}
|
|
636
|
+
if (a !== 0) if (this.length > a)
|
|
637
|
+
for (this.length -= a, i = 0; i < this.length; i++)
|
|
638
|
+
this.words[i] = this.words[i + a];
|
|
639
|
+
else
|
|
640
|
+
this.words[0] = 0, this.length = 1;
|
|
641
|
+
var n = 0;
|
|
642
|
+
for (i = this.length - 1; i >= 0 && (n !== 0 || i >= f); i--) {
|
|
643
|
+
var m = this.words[i] | 0;
|
|
644
|
+
this.words[i] = n << 26 - s | m >>> s, n = m & u;
|
|
645
|
+
}
|
|
646
|
+
return h && n !== 0 && (h.words[h.length++] = n), this.length === 0 && (this.words[0] = 0, this.length = 1), this._strip();
|
|
647
|
+
}, l.prototype.ishrn = function(t, r, e) {
|
|
648
|
+
return d(this.negative === 0), this.iushrn(t, r, e);
|
|
649
|
+
}, l.prototype.shln = function(t) {
|
|
650
|
+
return this.clone().ishln(t);
|
|
651
|
+
}, l.prototype.ushln = function(t) {
|
|
652
|
+
return this.clone().iushln(t);
|
|
653
|
+
}, l.prototype.shrn = function(t) {
|
|
654
|
+
return this.clone().ishrn(t);
|
|
655
|
+
}, l.prototype.ushrn = function(t) {
|
|
656
|
+
return this.clone().iushrn(t);
|
|
657
|
+
}, l.prototype.testn = function(t) {
|
|
658
|
+
d(typeof t == "number" && t >= 0);
|
|
659
|
+
var r = t % 26, e = (t - r) / 26, f = 1 << r;
|
|
660
|
+
if (this.length <= e) return !1;
|
|
661
|
+
var s = this.words[e];
|
|
662
|
+
return !!(s & f);
|
|
663
|
+
}, l.prototype.imaskn = function(t) {
|
|
664
|
+
d(typeof t == "number" && t >= 0);
|
|
665
|
+
var r = t % 26, e = (t - r) / 26;
|
|
666
|
+
if (d(this.negative === 0, "imaskn works only with positive numbers"), this.length <= e)
|
|
667
|
+
return this;
|
|
668
|
+
if (r !== 0 && e++, this.length = Math.min(e, this.length), r !== 0) {
|
|
669
|
+
var f = 67108863 ^ 67108863 >>> r << r;
|
|
670
|
+
this.words[this.length - 1] &= f;
|
|
671
|
+
}
|
|
672
|
+
return this._strip();
|
|
673
|
+
}, l.prototype.maskn = function(t) {
|
|
674
|
+
return this.clone().imaskn(t);
|
|
675
|
+
}, l.prototype.iaddn = function(t) {
|
|
676
|
+
return d(typeof t == "number"), d(t < 67108864), t < 0 ? this.isubn(-t) : this.negative !== 0 ? this.length === 1 && (this.words[0] | 0) <= t ? (this.words[0] = t - (this.words[0] | 0), this.negative = 0, this) : (this.negative = 0, this.isubn(t), this.negative = 1, this) : this._iaddn(t);
|
|
677
|
+
}, l.prototype._iaddn = function(t) {
|
|
678
|
+
this.words[0] += t;
|
|
679
|
+
for (var r = 0; r < this.length && this.words[r] >= 67108864; r++)
|
|
680
|
+
this.words[r] -= 67108864, r === this.length - 1 ? this.words[r + 1] = 1 : this.words[r + 1]++;
|
|
681
|
+
return this.length = Math.max(this.length, r + 1), this;
|
|
682
|
+
}, l.prototype.isubn = function(t) {
|
|
683
|
+
if (d(typeof t == "number"), d(t < 67108864), t < 0) return this.iaddn(-t);
|
|
684
|
+
if (this.negative !== 0)
|
|
685
|
+
return this.negative = 0, this.iaddn(t), this.negative = 1, this;
|
|
686
|
+
if (this.words[0] -= t, this.length === 1 && this.words[0] < 0)
|
|
687
|
+
this.words[0] = -this.words[0], this.negative = 1;
|
|
688
|
+
else
|
|
689
|
+
for (var r = 0; r < this.length && this.words[r] < 0; r++)
|
|
690
|
+
this.words[r] += 67108864, this.words[r + 1] -= 1;
|
|
691
|
+
return this._strip();
|
|
692
|
+
}, l.prototype.addn = function(t) {
|
|
693
|
+
return this.clone().iaddn(t);
|
|
694
|
+
}, l.prototype.subn = function(t) {
|
|
695
|
+
return this.clone().isubn(t);
|
|
696
|
+
}, l.prototype.iabs = function() {
|
|
697
|
+
return this.negative = 0, this;
|
|
698
|
+
}, l.prototype.abs = function() {
|
|
699
|
+
return this.clone().iabs();
|
|
700
|
+
}, l.prototype._ishlnsubmul = function(t, r, e) {
|
|
701
|
+
var f = t.length + e, s;
|
|
702
|
+
this._expand(f);
|
|
703
|
+
var a, u = 0;
|
|
704
|
+
for (s = 0; s < t.length; s++) {
|
|
705
|
+
a = (this.words[s + e] | 0) + u;
|
|
706
|
+
var h = (t.words[s] | 0) * r;
|
|
707
|
+
a -= h & 67108863, u = (a >> 26) - (h / 67108864 | 0), this.words[s + e] = a & 67108863;
|
|
708
|
+
}
|
|
709
|
+
for (; s < this.length - e; s++)
|
|
710
|
+
a = (this.words[s + e] | 0) + u, u = a >> 26, this.words[s + e] = a & 67108863;
|
|
711
|
+
if (u === 0) return this._strip();
|
|
712
|
+
for (d(u === -1), u = 0, s = 0; s < this.length; s++)
|
|
713
|
+
a = -(this.words[s] | 0) + u, u = a >> 26, this.words[s] = a & 67108863;
|
|
714
|
+
return this.negative = 1, this._strip();
|
|
715
|
+
}, l.prototype._wordDiv = function(t, r) {
|
|
716
|
+
var e = this.length - t.length, f = this.clone(), s = t, a = s.words[s.length - 1] | 0, u = this._countBits(a);
|
|
717
|
+
e = 26 - u, e !== 0 && (s = s.ushln(e), f.iushln(e), a = s.words[s.length - 1] | 0);
|
|
718
|
+
var h = f.length - s.length, i;
|
|
719
|
+
if (r !== "mod") {
|
|
720
|
+
i = new l(null), i.length = h + 1, i.words = new Array(i.length);
|
|
721
|
+
for (var n = 0; n < i.length; n++)
|
|
722
|
+
i.words[n] = 0;
|
|
723
|
+
}
|
|
724
|
+
var m = f.clone()._ishlnsubmul(s, 1, h);
|
|
725
|
+
m.negative === 0 && (f = m, i && (i.words[h] = 1));
|
|
726
|
+
for (var v = h - 1; v >= 0; v--) {
|
|
727
|
+
var p = (f.words[s.length + v] | 0) * 67108864 + (f.words[s.length + v - 1] | 0);
|
|
728
|
+
for (p = Math.min(p / a | 0, 67108863), f._ishlnsubmul(s, p, v); f.negative !== 0; )
|
|
729
|
+
p--, f.negative = 0, f._ishlnsubmul(s, 1, v), f.isZero() || (f.negative ^= 1);
|
|
730
|
+
i && (i.words[v] = p);
|
|
731
|
+
}
|
|
732
|
+
return i && i._strip(), f._strip(), r !== "div" && e !== 0 && f.iushrn(e), {
|
|
733
|
+
div: i || null,
|
|
734
|
+
mod: f
|
|
735
|
+
};
|
|
736
|
+
}, l.prototype.divmod = function(t, r, e) {
|
|
737
|
+
if (d(!t.isZero()), this.isZero())
|
|
738
|
+
return {
|
|
739
|
+
div: new l(0),
|
|
740
|
+
mod: new l(0)
|
|
741
|
+
};
|
|
742
|
+
var f, s, a;
|
|
743
|
+
return this.negative !== 0 && t.negative === 0 ? (a = this.neg().divmod(t, r), r !== "mod" && (f = a.div.neg()), r !== "div" && (s = a.mod.neg(), e && s.negative !== 0 && s.iadd(t)), {
|
|
744
|
+
div: f,
|
|
745
|
+
mod: s
|
|
746
|
+
}) : this.negative === 0 && t.negative !== 0 ? (a = this.divmod(t.neg(), r), r !== "mod" && (f = a.div.neg()), {
|
|
747
|
+
div: f,
|
|
748
|
+
mod: a.mod
|
|
749
|
+
}) : (this.negative & t.negative) !== 0 ? (a = this.neg().divmod(t.neg(), r), r !== "div" && (s = a.mod.neg(), e && s.negative !== 0 && s.isub(t)), {
|
|
750
|
+
div: a.div,
|
|
751
|
+
mod: s
|
|
752
|
+
}) : t.length > this.length || this.cmp(t) < 0 ? {
|
|
753
|
+
div: new l(0),
|
|
754
|
+
mod: this
|
|
755
|
+
} : t.length === 1 ? r === "div" ? {
|
|
756
|
+
div: this.divn(t.words[0]),
|
|
757
|
+
mod: null
|
|
758
|
+
} : r === "mod" ? {
|
|
759
|
+
div: null,
|
|
760
|
+
mod: new l(this.modrn(t.words[0]))
|
|
761
|
+
} : {
|
|
762
|
+
div: this.divn(t.words[0]),
|
|
763
|
+
mod: new l(this.modrn(t.words[0]))
|
|
764
|
+
} : this._wordDiv(t, r);
|
|
765
|
+
}, l.prototype.div = function(t) {
|
|
766
|
+
return this.divmod(t, "div", !1).div;
|
|
767
|
+
}, l.prototype.mod = function(t) {
|
|
768
|
+
return this.divmod(t, "mod", !1).mod;
|
|
769
|
+
}, l.prototype.umod = function(t) {
|
|
770
|
+
return this.divmod(t, "mod", !0).mod;
|
|
771
|
+
}, l.prototype.divRound = function(t) {
|
|
772
|
+
var r = this.divmod(t);
|
|
773
|
+
if (r.mod.isZero()) return r.div;
|
|
774
|
+
var e = r.div.negative !== 0 ? r.mod.isub(t) : r.mod, f = t.ushrn(1), s = t.andln(1), a = e.cmp(f);
|
|
775
|
+
return a < 0 || s === 1 && a === 0 ? r.div : r.div.negative !== 0 ? r.div.isubn(1) : r.div.iaddn(1);
|
|
776
|
+
}, l.prototype.modrn = function(t) {
|
|
777
|
+
var r = t < 0;
|
|
778
|
+
r && (t = -t), d(t <= 67108863);
|
|
779
|
+
for (var e = (1 << 26) % t, f = 0, s = this.length - 1; s >= 0; s--)
|
|
780
|
+
f = (e * f + (this.words[s] | 0)) % t;
|
|
781
|
+
return r ? -f : f;
|
|
782
|
+
}, l.prototype.modn = function(t) {
|
|
783
|
+
return this.modrn(t);
|
|
784
|
+
}, l.prototype.idivn = function(t) {
|
|
785
|
+
var r = t < 0;
|
|
786
|
+
r && (t = -t), d(t <= 67108863);
|
|
787
|
+
for (var e = 0, f = this.length - 1; f >= 0; f--) {
|
|
788
|
+
var s = (this.words[f] | 0) + e * 67108864;
|
|
789
|
+
this.words[f] = s / t | 0, e = s % t;
|
|
790
|
+
}
|
|
791
|
+
return this._strip(), r ? this.ineg() : this;
|
|
792
|
+
}, l.prototype.divn = function(t) {
|
|
793
|
+
return this.clone().idivn(t);
|
|
794
|
+
}, l.prototype.egcd = function(t) {
|
|
795
|
+
d(t.negative === 0), d(!t.isZero());
|
|
796
|
+
var r = this, e = t.clone();
|
|
797
|
+
r.negative !== 0 ? r = r.umod(t) : r = r.clone();
|
|
798
|
+
for (var f = new l(1), s = new l(0), a = new l(0), u = new l(1), h = 0; r.isEven() && e.isEven(); )
|
|
799
|
+
r.iushrn(1), e.iushrn(1), ++h;
|
|
800
|
+
for (var i = e.clone(), n = r.clone(); !r.isZero(); ) {
|
|
801
|
+
for (var m = 0, v = 1; (r.words[0] & v) === 0 && m < 26; ++m, v <<= 1) ;
|
|
802
|
+
if (m > 0)
|
|
803
|
+
for (r.iushrn(m); m-- > 0; )
|
|
804
|
+
(f.isOdd() || s.isOdd()) && (f.iadd(i), s.isub(n)), f.iushrn(1), s.iushrn(1);
|
|
805
|
+
for (var p = 0, et = 1; (e.words[0] & et) === 0 && p < 26; ++p, et <<= 1) ;
|
|
806
|
+
if (p > 0)
|
|
807
|
+
for (e.iushrn(p); p-- > 0; )
|
|
808
|
+
(a.isOdd() || u.isOdd()) && (a.iadd(i), u.isub(n)), a.iushrn(1), u.iushrn(1);
|
|
809
|
+
r.cmp(e) >= 0 ? (r.isub(e), f.isub(a), s.isub(u)) : (e.isub(r), a.isub(f), u.isub(s));
|
|
810
|
+
}
|
|
811
|
+
return {
|
|
812
|
+
a,
|
|
813
|
+
b: u,
|
|
814
|
+
gcd: e.iushln(h)
|
|
815
|
+
};
|
|
816
|
+
}, l.prototype._invmp = function(t) {
|
|
817
|
+
d(t.negative === 0), d(!t.isZero());
|
|
818
|
+
var r = this, e = t.clone();
|
|
819
|
+
r.negative !== 0 ? r = r.umod(t) : r = r.clone();
|
|
820
|
+
for (var f = new l(1), s = new l(0), a = e.clone(); r.cmpn(1) > 0 && e.cmpn(1) > 0; ) {
|
|
821
|
+
for (var u = 0, h = 1; (r.words[0] & h) === 0 && u < 26; ++u, h <<= 1) ;
|
|
822
|
+
if (u > 0)
|
|
823
|
+
for (r.iushrn(u); u-- > 0; )
|
|
824
|
+
f.isOdd() && f.iadd(a), f.iushrn(1);
|
|
825
|
+
for (var i = 0, n = 1; (e.words[0] & n) === 0 && i < 26; ++i, n <<= 1) ;
|
|
826
|
+
if (i > 0)
|
|
827
|
+
for (e.iushrn(i); i-- > 0; )
|
|
828
|
+
s.isOdd() && s.iadd(a), s.iushrn(1);
|
|
829
|
+
r.cmp(e) >= 0 ? (r.isub(e), f.isub(s)) : (e.isub(r), s.isub(f));
|
|
830
|
+
}
|
|
831
|
+
var m;
|
|
832
|
+
return r.cmpn(1) === 0 ? m = f : m = s, m.cmpn(0) < 0 && m.iadd(t), m;
|
|
833
|
+
}, l.prototype.gcd = function(t) {
|
|
834
|
+
if (this.isZero()) return t.abs();
|
|
835
|
+
if (t.isZero()) return this.abs();
|
|
836
|
+
var r = this.clone(), e = t.clone();
|
|
837
|
+
r.negative = 0, e.negative = 0;
|
|
838
|
+
for (var f = 0; r.isEven() && e.isEven(); f++)
|
|
839
|
+
r.iushrn(1), e.iushrn(1);
|
|
840
|
+
do {
|
|
841
|
+
for (; r.isEven(); )
|
|
842
|
+
r.iushrn(1);
|
|
843
|
+
for (; e.isEven(); )
|
|
844
|
+
e.iushrn(1);
|
|
845
|
+
var s = r.cmp(e);
|
|
846
|
+
if (s < 0) {
|
|
847
|
+
var a = r;
|
|
848
|
+
r = e, e = a;
|
|
849
|
+
} else if (s === 0 || e.cmpn(1) === 0)
|
|
850
|
+
break;
|
|
851
|
+
r.isub(e);
|
|
852
|
+
} while (!0);
|
|
853
|
+
return e.iushln(f);
|
|
854
|
+
}, l.prototype.invm = function(t) {
|
|
855
|
+
return this.egcd(t).a.umod(t);
|
|
856
|
+
}, l.prototype.isEven = function() {
|
|
857
|
+
return (this.words[0] & 1) === 0;
|
|
858
|
+
}, l.prototype.isOdd = function() {
|
|
859
|
+
return (this.words[0] & 1) === 1;
|
|
860
|
+
}, l.prototype.andln = function(t) {
|
|
861
|
+
return this.words[0] & t;
|
|
862
|
+
}, l.prototype.bincn = function(t) {
|
|
863
|
+
d(typeof t == "number");
|
|
864
|
+
var r = t % 26, e = (t - r) / 26, f = 1 << r;
|
|
865
|
+
if (this.length <= e)
|
|
866
|
+
return this._expand(e + 1), this.words[e] |= f, this;
|
|
867
|
+
for (var s = f, a = e; s !== 0 && a < this.length; a++) {
|
|
868
|
+
var u = this.words[a] | 0;
|
|
869
|
+
u += s, s = u >>> 26, u &= 67108863, this.words[a] = u;
|
|
870
|
+
}
|
|
871
|
+
return s !== 0 && (this.words[a] = s, this.length++), this;
|
|
872
|
+
}, l.prototype.isZero = function() {
|
|
873
|
+
return this.length === 1 && this.words[0] === 0;
|
|
874
|
+
}, l.prototype.cmpn = function(t) {
|
|
875
|
+
var r = t < 0;
|
|
876
|
+
if (this.negative !== 0 && !r) return -1;
|
|
877
|
+
if (this.negative === 0 && r) return 1;
|
|
878
|
+
this._strip();
|
|
879
|
+
var e;
|
|
880
|
+
if (this.length > 1)
|
|
881
|
+
e = 1;
|
|
882
|
+
else {
|
|
883
|
+
r && (t = -t), d(t <= 67108863, "Number is too big");
|
|
884
|
+
var f = this.words[0] | 0;
|
|
885
|
+
e = f === t ? 0 : f < t ? -1 : 1;
|
|
886
|
+
}
|
|
887
|
+
return this.negative !== 0 ? -e | 0 : e;
|
|
888
|
+
}, l.prototype.cmp = function(t) {
|
|
889
|
+
if (this.negative !== 0 && t.negative === 0) return -1;
|
|
890
|
+
if (this.negative === 0 && t.negative !== 0) return 1;
|
|
891
|
+
var r = this.ucmp(t);
|
|
892
|
+
return this.negative !== 0 ? -r | 0 : r;
|
|
893
|
+
}, l.prototype.ucmp = function(t) {
|
|
894
|
+
if (this.length > t.length) return 1;
|
|
895
|
+
if (this.length < t.length) return -1;
|
|
896
|
+
for (var r = 0, e = this.length - 1; e >= 0; e--) {
|
|
897
|
+
var f = this.words[e] | 0, s = t.words[e] | 0;
|
|
898
|
+
if (f !== s) {
|
|
899
|
+
f < s ? r = -1 : f > s && (r = 1);
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return r;
|
|
904
|
+
}, l.prototype.gtn = function(t) {
|
|
905
|
+
return this.cmpn(t) === 1;
|
|
906
|
+
}, l.prototype.gt = function(t) {
|
|
907
|
+
return this.cmp(t) === 1;
|
|
908
|
+
}, l.prototype.gten = function(t) {
|
|
909
|
+
return this.cmpn(t) >= 0;
|
|
910
|
+
}, l.prototype.gte = function(t) {
|
|
911
|
+
return this.cmp(t) >= 0;
|
|
912
|
+
}, l.prototype.ltn = function(t) {
|
|
913
|
+
return this.cmpn(t) === -1;
|
|
914
|
+
}, l.prototype.lt = function(t) {
|
|
915
|
+
return this.cmp(t) === -1;
|
|
916
|
+
}, l.prototype.lten = function(t) {
|
|
917
|
+
return this.cmpn(t) <= 0;
|
|
918
|
+
}, l.prototype.lte = function(t) {
|
|
919
|
+
return this.cmp(t) <= 0;
|
|
920
|
+
}, l.prototype.eqn = function(t) {
|
|
921
|
+
return this.cmpn(t) === 0;
|
|
922
|
+
}, l.prototype.eq = function(t) {
|
|
923
|
+
return this.cmp(t) === 0;
|
|
924
|
+
}, l.red = function(t) {
|
|
925
|
+
return new g(t);
|
|
926
|
+
}, l.prototype.toRed = function(t) {
|
|
927
|
+
return d(!this.red, "Already a number in reduction context"), d(this.negative === 0, "red works only with positives"), t.convertTo(this)._forceRed(t);
|
|
928
|
+
}, l.prototype.fromRed = function() {
|
|
929
|
+
return d(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this);
|
|
930
|
+
}, l.prototype._forceRed = function(t) {
|
|
931
|
+
return this.red = t, this;
|
|
932
|
+
}, l.prototype.forceRed = function(t) {
|
|
933
|
+
return d(!this.red, "Already a number in reduction context"), this._forceRed(t);
|
|
934
|
+
}, l.prototype.redAdd = function(t) {
|
|
935
|
+
return d(this.red, "redAdd works only with red numbers"), this.red.add(this, t);
|
|
936
|
+
}, l.prototype.redIAdd = function(t) {
|
|
937
|
+
return d(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, t);
|
|
938
|
+
}, l.prototype.redSub = function(t) {
|
|
939
|
+
return d(this.red, "redSub works only with red numbers"), this.red.sub(this, t);
|
|
940
|
+
}, l.prototype.redISub = function(t) {
|
|
941
|
+
return d(this.red, "redISub works only with red numbers"), this.red.isub(this, t);
|
|
942
|
+
}, l.prototype.redShl = function(t) {
|
|
943
|
+
return d(this.red, "redShl works only with red numbers"), this.red.shl(this, t);
|
|
944
|
+
}, l.prototype.redMul = function(t) {
|
|
945
|
+
return d(this.red, "redMul works only with red numbers"), this.red._verify2(this, t), this.red.mul(this, t);
|
|
946
|
+
}, l.prototype.redIMul = function(t) {
|
|
947
|
+
return d(this.red, "redMul works only with red numbers"), this.red._verify2(this, t), this.red.imul(this, t);
|
|
948
|
+
}, l.prototype.redSqr = function() {
|
|
949
|
+
return d(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this);
|
|
950
|
+
}, l.prototype.redISqr = function() {
|
|
951
|
+
return d(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this);
|
|
952
|
+
}, l.prototype.redSqrt = function() {
|
|
953
|
+
return d(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this);
|
|
954
|
+
}, l.prototype.redInvm = function() {
|
|
955
|
+
return d(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this);
|
|
956
|
+
}, l.prototype.redNeg = function() {
|
|
957
|
+
return d(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this);
|
|
958
|
+
}, l.prototype.redPow = function(t) {
|
|
959
|
+
return d(this.red && !t.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, t);
|
|
960
|
+
};
|
|
961
|
+
var dt = {
|
|
962
|
+
k256: null,
|
|
963
|
+
p224: null,
|
|
964
|
+
p192: null,
|
|
965
|
+
p25519: null
|
|
966
|
+
};
|
|
967
|
+
function ht(o, t) {
|
|
968
|
+
this.name = o, this.p = new l(t, 16), this.n = this.p.bitLength(), this.k = new l(1).iushln(this.n).isub(this.p), this.tmp = this._tmp();
|
|
969
|
+
}
|
|
970
|
+
ht.prototype._tmp = function() {
|
|
971
|
+
var t = new l(null);
|
|
972
|
+
return t.words = new Array(Math.ceil(this.n / 13)), t;
|
|
973
|
+
}, ht.prototype.ireduce = function(t) {
|
|
974
|
+
var r = t, e;
|
|
975
|
+
do
|
|
976
|
+
this.split(r, this.tmp), r = this.imulK(r), r = r.iadd(this.tmp), e = r.bitLength();
|
|
977
|
+
while (e > this.n);
|
|
978
|
+
var f = e < this.n ? -1 : r.ucmp(this.p);
|
|
979
|
+
return f === 0 ? (r.words[0] = 0, r.length = 1) : f > 0 ? r.isub(this.p) : r.strip !== void 0 ? r.strip() : r._strip(), r;
|
|
980
|
+
}, ht.prototype.split = function(t, r) {
|
|
981
|
+
t.iushrn(this.n, 0, r);
|
|
982
|
+
}, ht.prototype.imulK = function(t) {
|
|
983
|
+
return t.imul(this.k);
|
|
984
|
+
};
|
|
985
|
+
function at() {
|
|
986
|
+
ht.call(
|
|
987
|
+
this,
|
|
988
|
+
"k256",
|
|
989
|
+
"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f"
|
|
990
|
+
);
|
|
991
|
+
}
|
|
992
|
+
rt(at, ht), at.prototype.split = function(t, r) {
|
|
993
|
+
for (var e = 4194303, f = Math.min(t.length, 9), s = 0; s < f; s++)
|
|
994
|
+
r.words[s] = t.words[s];
|
|
995
|
+
if (r.length = f, t.length <= 9) {
|
|
996
|
+
t.words[0] = 0, t.length = 1;
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
var a = t.words[9];
|
|
1000
|
+
for (r.words[r.length++] = a & e, s = 10; s < t.length; s++) {
|
|
1001
|
+
var u = t.words[s] | 0;
|
|
1002
|
+
t.words[s - 10] = (u & e) << 4 | a >>> 22, a = u;
|
|
1003
|
+
}
|
|
1004
|
+
a >>>= 22, t.words[s - 10] = a, a === 0 && t.length > 10 ? t.length -= 10 : t.length -= 9;
|
|
1005
|
+
}, at.prototype.imulK = function(t) {
|
|
1006
|
+
t.words[t.length] = 0, t.words[t.length + 1] = 0, t.length += 2;
|
|
1007
|
+
for (var r = 0, e = 0; e < t.length; e++) {
|
|
1008
|
+
var f = t.words[e] | 0;
|
|
1009
|
+
r += f * 977, t.words[e] = r & 67108863, r = f * 64 + (r / 67108864 | 0);
|
|
1010
|
+
}
|
|
1011
|
+
return t.words[t.length - 1] === 0 && (t.length--, t.words[t.length - 1] === 0 && t.length--), t;
|
|
1012
|
+
};
|
|
1013
|
+
function $t() {
|
|
1014
|
+
ht.call(
|
|
1015
|
+
this,
|
|
1016
|
+
"p224",
|
|
1017
|
+
"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001"
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
rt($t, ht);
|
|
1021
|
+
function Ht() {
|
|
1022
|
+
ht.call(
|
|
1023
|
+
this,
|
|
1024
|
+
"p192",
|
|
1025
|
+
"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff"
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
rt(Ht, ht);
|
|
1029
|
+
function vt() {
|
|
1030
|
+
ht.call(
|
|
1031
|
+
this,
|
|
1032
|
+
"25519",
|
|
1033
|
+
"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed"
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
rt(vt, ht), vt.prototype.imulK = function(t) {
|
|
1037
|
+
for (var r = 0, e = 0; e < t.length; e++) {
|
|
1038
|
+
var f = (t.words[e] | 0) * 19 + r, s = f & 67108863;
|
|
1039
|
+
f >>>= 26, t.words[e] = s, r = f;
|
|
1040
|
+
}
|
|
1041
|
+
return r !== 0 && (t.words[t.length++] = r), t;
|
|
1042
|
+
}, l._prime = function(t) {
|
|
1043
|
+
if (dt[t]) return dt[t];
|
|
1044
|
+
var r;
|
|
1045
|
+
if (t === "k256")
|
|
1046
|
+
r = new at();
|
|
1047
|
+
else if (t === "p224")
|
|
1048
|
+
r = new $t();
|
|
1049
|
+
else if (t === "p192")
|
|
1050
|
+
r = new Ht();
|
|
1051
|
+
else if (t === "p25519")
|
|
1052
|
+
r = new vt();
|
|
1053
|
+
else
|
|
1054
|
+
throw new Error("Unknown prime " + t);
|
|
1055
|
+
return dt[t] = r, r;
|
|
1056
|
+
};
|
|
1057
|
+
function g(o) {
|
|
1058
|
+
if (typeof o == "string") {
|
|
1059
|
+
var t = l._prime(o);
|
|
1060
|
+
this.m = t.p, this.prime = t;
|
|
1061
|
+
} else
|
|
1062
|
+
d(o.gtn(1), "modulus must be greater than 1"), this.m = o, this.prime = null;
|
|
1063
|
+
}
|
|
1064
|
+
g.prototype._verify1 = function(t) {
|
|
1065
|
+
d(t.negative === 0, "red works only with positives"), d(t.red, "red works only with red numbers");
|
|
1066
|
+
}, g.prototype._verify2 = function(t, r) {
|
|
1067
|
+
d((t.negative | r.negative) === 0, "red works only with positives"), d(
|
|
1068
|
+
t.red && t.red === r.red,
|
|
1069
|
+
"red works only with red numbers"
|
|
1070
|
+
);
|
|
1071
|
+
}, g.prototype.imod = function(t) {
|
|
1072
|
+
return this.prime ? this.prime.ireduce(t)._forceRed(this) : (It(t, t.umod(this.m)._forceRed(this)), t);
|
|
1073
|
+
}, g.prototype.neg = function(t) {
|
|
1074
|
+
return t.isZero() ? t.clone() : this.m.sub(t)._forceRed(this);
|
|
1075
|
+
}, g.prototype.add = function(t, r) {
|
|
1076
|
+
this._verify2(t, r);
|
|
1077
|
+
var e = t.add(r);
|
|
1078
|
+
return e.cmp(this.m) >= 0 && e.isub(this.m), e._forceRed(this);
|
|
1079
|
+
}, g.prototype.iadd = function(t, r) {
|
|
1080
|
+
this._verify2(t, r);
|
|
1081
|
+
var e = t.iadd(r);
|
|
1082
|
+
return e.cmp(this.m) >= 0 && e.isub(this.m), e;
|
|
1083
|
+
}, g.prototype.sub = function(t, r) {
|
|
1084
|
+
this._verify2(t, r);
|
|
1085
|
+
var e = t.sub(r);
|
|
1086
|
+
return e.cmpn(0) < 0 && e.iadd(this.m), e._forceRed(this);
|
|
1087
|
+
}, g.prototype.isub = function(t, r) {
|
|
1088
|
+
this._verify2(t, r);
|
|
1089
|
+
var e = t.isub(r);
|
|
1090
|
+
return e.cmpn(0) < 0 && e.iadd(this.m), e;
|
|
1091
|
+
}, g.prototype.shl = function(t, r) {
|
|
1092
|
+
return this._verify1(t), this.imod(t.ushln(r));
|
|
1093
|
+
}, g.prototype.imul = function(t, r) {
|
|
1094
|
+
return this._verify2(t, r), this.imod(t.imul(r));
|
|
1095
|
+
}, g.prototype.mul = function(t, r) {
|
|
1096
|
+
return this._verify2(t, r), this.imod(t.mul(r));
|
|
1097
|
+
}, g.prototype.isqr = function(t) {
|
|
1098
|
+
return this.imul(t, t.clone());
|
|
1099
|
+
}, g.prototype.sqr = function(t) {
|
|
1100
|
+
return this.mul(t, t);
|
|
1101
|
+
}, g.prototype.sqrt = function(t) {
|
|
1102
|
+
if (t.isZero()) return t.clone();
|
|
1103
|
+
var r = this.m.andln(3);
|
|
1104
|
+
if (d(r % 2 === 1), r === 3) {
|
|
1105
|
+
var e = this.m.add(new l(1)).iushrn(2);
|
|
1106
|
+
return this.pow(t, e);
|
|
1107
|
+
}
|
|
1108
|
+
for (var f = this.m.subn(1), s = 0; !f.isZero() && f.andln(1) === 0; )
|
|
1109
|
+
s++, f.iushrn(1);
|
|
1110
|
+
d(!f.isZero());
|
|
1111
|
+
var a = new l(1).toRed(this), u = a.redNeg(), h = this.m.subn(1).iushrn(1), i = this.m.bitLength();
|
|
1112
|
+
for (i = new l(2 * i * i).toRed(this); this.pow(i, h).cmp(u) !== 0; )
|
|
1113
|
+
i.redIAdd(u);
|
|
1114
|
+
for (var n = this.pow(i, f), m = this.pow(t, f.addn(1).iushrn(1)), v = this.pow(t, f), p = s; v.cmp(a) !== 0; ) {
|
|
1115
|
+
for (var et = v, M = 0; et.cmp(a) !== 0; M++)
|
|
1116
|
+
et = et.redSqr();
|
|
1117
|
+
d(M < p);
|
|
1118
|
+
var c = this.pow(n, new l(1).iushln(p - M - 1));
|
|
1119
|
+
m = m.redMul(c), n = c.redSqr(), v = v.redMul(n), p = M;
|
|
1120
|
+
}
|
|
1121
|
+
return m;
|
|
1122
|
+
}, g.prototype.invm = function(t) {
|
|
1123
|
+
var r = t._invmp(this.m);
|
|
1124
|
+
return r.negative !== 0 ? (r.negative = 0, this.imod(r).redNeg()) : this.imod(r);
|
|
1125
|
+
}, g.prototype.pow = function(t, r) {
|
|
1126
|
+
if (r.isZero()) return new l(1).toRed(this);
|
|
1127
|
+
if (r.cmpn(1) === 0) return t.clone();
|
|
1128
|
+
var e = 4, f = new Array(1 << e);
|
|
1129
|
+
f[0] = new l(1).toRed(this), f[1] = t;
|
|
1130
|
+
for (var s = 2; s < f.length; s++)
|
|
1131
|
+
f[s] = this.mul(f[s - 1], t);
|
|
1132
|
+
var a = f[0], u = 0, h = 0, i = r.bitLength() % 26;
|
|
1133
|
+
for (i === 0 && (i = 26), s = r.length - 1; s >= 0; s--) {
|
|
1134
|
+
for (var n = r.words[s], m = i - 1; m >= 0; m--) {
|
|
1135
|
+
var v = n >> m & 1;
|
|
1136
|
+
if (a !== f[0] && (a = this.sqr(a)), v === 0 && u === 0) {
|
|
1137
|
+
h = 0;
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1140
|
+
u <<= 1, u |= v, h++, !(h !== e && (s !== 0 || m !== 0)) && (a = this.mul(a, f[u]), h = 0, u = 0);
|
|
1141
|
+
}
|
|
1142
|
+
i = 26;
|
|
1143
|
+
}
|
|
1144
|
+
return a;
|
|
1145
|
+
}, g.prototype.convertTo = function(t) {
|
|
1146
|
+
var r = t.umod(this.m);
|
|
1147
|
+
return r === t ? r.clone() : r;
|
|
1148
|
+
}, g.prototype.convertFrom = function(t) {
|
|
1149
|
+
var r = t.clone();
|
|
1150
|
+
return r.red = null, r;
|
|
1151
|
+
}, l.mont = function(t) {
|
|
1152
|
+
return new st(t);
|
|
1153
|
+
};
|
|
1154
|
+
function st(o) {
|
|
1155
|
+
g.call(this, o), this.shift = this.m.bitLength(), this.shift % 26 !== 0 && (this.shift += 26 - this.shift % 26), this.r = new l(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv);
|
|
1156
|
+
}
|
|
1157
|
+
rt(st, g), st.prototype.convertTo = function(t) {
|
|
1158
|
+
return this.imod(t.ushln(this.shift));
|
|
1159
|
+
}, st.prototype.convertFrom = function(t) {
|
|
1160
|
+
var r = this.imod(t.mul(this.rinv));
|
|
1161
|
+
return r.red = null, r;
|
|
1162
|
+
}, st.prototype.imul = function(t, r) {
|
|
1163
|
+
if (t.isZero() || r.isZero())
|
|
1164
|
+
return t.words[0] = 0, t.length = 1, t;
|
|
1165
|
+
var e = t.imul(r), f = e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), s = e.isub(f).iushrn(this.shift), a = s;
|
|
1166
|
+
return s.cmp(this.m) >= 0 ? a = s.isub(this.m) : s.cmpn(0) < 0 && (a = s.iadd(this.m)), a._forceRed(this);
|
|
1167
|
+
}, st.prototype.mul = function(t, r) {
|
|
1168
|
+
if (t.isZero() || r.isZero()) return new l(0)._forceRed(this);
|
|
1169
|
+
var e = t.mul(r), f = e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), s = e.isub(f).iushrn(this.shift), a = s;
|
|
1170
|
+
return s.cmp(this.m) >= 0 ? a = s.isub(this.m) : s.cmpn(0) < 0 && (a = s.iadd(this.m)), a._forceRed(this);
|
|
1171
|
+
}, st.prototype.invm = function(t) {
|
|
1172
|
+
var r = this.imod(t._invmp(this.m).mul(this.r2));
|
|
1173
|
+
return r._forceRed(this);
|
|
1174
|
+
};
|
|
1175
|
+
})(it, yi);
|
|
1176
|
+
})(lt)), lt.exports;
|
|
1177
|
+
}
|
|
1178
|
+
var ai = xi();
|
|
1179
|
+
const _i = /* @__PURE__ */ pi(ai), bi = /* @__PURE__ */ mi({
|
|
1180
|
+
__proto__: null,
|
|
1181
|
+
default: _i
|
|
1182
|
+
}, [ai]);
|
|
1183
|
+
export {
|
|
1184
|
+
bi as b
|
|
1185
|
+
};
|