12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0}),
- (i.Base64 = void 0),
- (i.Base64 = class {
- constructor() {
- this._keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- }
- encode(t) {
- var e,
- i,
- s,
- o,
- a,
- n,
- r = "",
- l = 0;
- for (t = this._utf8_encode(t); l < t.length; )
- (s = (n = t.charCodeAt(l++)) >> 2),
- (o = ((3 & n) << 4) | ((e = t.charCodeAt(l++)) >> 4)),
- (a = ((15 & e) << 2) | ((i = t.charCodeAt(l++)) >> 6)),
- (n = 63 & i),
- isNaN(e) ? (a = n = 64) : isNaN(i) && (n = 64),
- (r =
- r +
- this._keyStr.charAt(s) +
- this._keyStr.charAt(o) +
- this._keyStr.charAt(a) +
- this._keyStr.charAt(n));
- return r;
- }
- decode(t) {
- var e,
- i,
- s,
- o,
- a,
- n = "",
- r = 0;
- for (t = t.replace(/[^A-Za-z0-9\+\/\=]/g, ""); r < t.length; )
- (e = (this._keyStr.indexOf(t.charAt(r++)) << 2) | ((s = this._keyStr.indexOf(t.charAt(r++))) >> 4)),
- (i = ((15 & s) << 4) | ((o = this._keyStr.indexOf(t.charAt(r++))) >> 2)),
- (s = ((3 & o) << 6) | (a = this._keyStr.indexOf(t.charAt(r++)))),
- (n += String.fromCharCode(e)),
- 64 != o && (n += String.fromCharCode(i)),
- 64 != a && (n += String.fromCharCode(s));
- return this._utf8_decode(n);
- }
- _utf8_encode(t) {
- t = t.replace(/\r\n/g, "\n");
- for (var e = "", i = 0; i < t.length; i++) {
- var s = t.charCodeAt(i);
- s < 128
- ? (e += String.fromCharCode(s))
- : (127 < s && s < 2048
- ? (e += String.fromCharCode((s >> 6) | 192))
- : ((e += String.fromCharCode((s >> 12) | 224)),
- (e += String.fromCharCode(((s >> 6) & 63) | 128))),
- (e += String.fromCharCode((63 & s) | 128)));
- }
- return e;
- }
- _utf8_decode(t) {
- for (var e, i, s = "", o = 0, a = 0; o < t.length; )
- (e = t.charCodeAt(o)) < 128
- ? ((s += String.fromCharCode(e)), o++)
- : 191 < e && e < 224
- ? ((a = t.charCodeAt(o + 1)), (s += String.fromCharCode(((31 & e) << 6) | (63 & a))), (o += 2))
- : ((a = t.charCodeAt(o + 1)),
- (i = t.charCodeAt(o + 2)),
- (s += String.fromCharCode(((15 & e) << 12) | ((63 & a) << 6) | (63 & i))),
- (o += 3));
- return s;
- }
- });
|