| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- const C = "3.9.4", z = C, p = typeof TextDecoder == "function" ? new TextDecoder("utf-8", { ignoreBOM: !0 }) : void 0, b = typeof TextEncoder == "function" ? new TextEncoder() : void 0, P = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", f = Array.prototype.slice.call(P), c = ((t) => {
- let e = {};
- return t.forEach((r, n) => e[r] = n), e;
- })(f), Z = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, o = String.fromCharCode.bind(String), O = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (t) => new Uint8Array(Array.prototype.slice.call(t, 0)), B = (t) => t.replace(/=/g, "").replace(/[+\/]/g, (e) => e == "+" ? "-" : "_"), _ = (t) => t.replace(/[^A-Za-z0-9\+\/]/g, ""), m = (t) => {
- let e, r, n, a, s = "";
- const l = t.length % 3;
- for (let u = 0; u < t.length; ) {
- if ((r = t.charCodeAt(u++)) > 255 || (n = t.charCodeAt(u++)) > 255 || (a = t.charCodeAt(u++)) > 255)
- throw new TypeError("invalid character found");
- e = r << 16 | n << 8 | a, s += f[e >> 18 & 63] + f[e >> 12 & 63] + f[e >> 6 & 63] + f[e & 63];
- }
- return l ? s.slice(0, l - 3) + "===".substring(l) : s;
- }, A = typeof btoa == "function" ? (t) => btoa(t) : m, x = typeof Uint8Array.prototype.toBase64 == "function" ? (t) => t.toBase64() : (t) => {
- let r = [];
- for (let n = 0, a = t.length; n < a; n += 4096)
- r.push(o.apply(null, t.subarray(n, n + 4096)));
- return A(r.join(""));
- }, d = (t, e = !1) => e ? B(x(t)) : x(t), j = (t) => {
- if (t.length < 2) {
- var e = t.charCodeAt(0);
- return e < 128 ? t : e < 2048 ? o(192 | e >>> 6) + o(128 | e & 63) : o(224 | e >>> 12 & 15) + o(128 | e >>> 6 & 63) + o(128 | e & 63);
- } else {
- var e = 65536 + (t.charCodeAt(0) - 55296) * 1024 + (t.charCodeAt(1) - 56320);
- return o(240 | e >>> 18 & 7) + o(128 | e >>> 12 & 63) + o(128 | e >>> 6 & 63) + o(128 | e & 63);
- }
- }, V = /[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\x00-\x7F]/g, F = (t) => t.replace(V, j), g = b ? (t) => x(b.encode(t)) : (t) => A(F(t)), i = (t, e = !1) => e ? B(g(t)) : g(t), U = (t) => i(t, !0), L = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g, N = (t) => {
- switch (t.length) {
- case 4:
- var e = (7 & t.charCodeAt(0)) << 18 | (63 & t.charCodeAt(1)) << 12 | (63 & t.charCodeAt(2)) << 6 | 63 & t.charCodeAt(3), r = e - 65536;
- return o((r >>> 10) + 55296) + o((r & 1023) + 56320);
- case 3:
- return o((15 & t.charCodeAt(0)) << 12 | (63 & t.charCodeAt(1)) << 6 | 63 & t.charCodeAt(2));
- default:
- return o((31 & t.charCodeAt(0)) << 6 | 63 & t.charCodeAt(1));
- }
- }, D = (t) => t.replace(L, N), E = (t) => {
- if (t = t.replace(/\s+/g, ""), !Z.test(t))
- throw new TypeError("malformed base64.");
- t += "==".slice(2 - (t.length & 3));
- let e, r, n, a = [];
- for (let s = 0; s < t.length; )
- e = c[t.charAt(s++)] << 18 | c[t.charAt(s++)] << 12 | (r = c[t.charAt(s++)]) << 6 | (n = c[t.charAt(s++)]), r === 64 ? a.push(o(e >> 16 & 255)) : n === 64 ? a.push(o(e >> 16 & 255, e >> 8 & 255)) : a.push(o(e >> 16 & 255, e >> 8 & 255, e & 255));
- return a.join("");
- }, y = typeof atob == "function" ? (t) => atob(_(t)) : E, R = typeof Uint8Array.fromBase64 == "function" ? (t) => Uint8Array.fromBase64(t) : (t) => O(y(t).split("").map((e) => e.charCodeAt(0))), w = (t) => R(S(t)), $ = p ? (t) => p.decode(R(t)) : (t) => D(y(t)), S = (t) => _(t.replace(/[-_]/g, (e) => e == "-" ? "+" : "/")), h = (t) => $(S(t)), k = (t) => {
- if (typeof t != "string")
- return !1;
- const e = t.replace(/\s+/g, "").replace(/={0,2}$/, "");
- return !/[^\s0-9a-zA-Z\+/]/.test(e) || !/[^\s0-9a-zA-Z\-_]/.test(e);
- }, T = (t) => ({
- value: t,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }), v = function() {
- const t = (e, r) => Object.defineProperty(String.prototype, e, T(r));
- t("fromBase64", function() {
- return h(this);
- }), t("toBase64", function(e) {
- return i(this, e);
- }), t("toBase64URI", function() {
- return i(this, !0);
- }), t("toBase64URL", function() {
- return i(this, !0);
- }), t("toUint8Array", function() {
- return w(this);
- });
- }, I = function() {
- const t = (e, r) => Object.defineProperty(Uint8Array.prototype, e, T(r));
- t("toBase64", function(e) {
- return d(this, e);
- }), t("toBase64URI", function() {
- return d(this, !0);
- }), t("toBase64URL", function() {
- return d(this, !0);
- });
- }, M = () => {
- v(), I();
- }, q = {
- version: C,
- VERSION: z,
- atob: y,
- atobPolyfill: E,
- btoa: A,
- btoaPolyfill: m,
- fromBase64: h,
- toBase64: i,
- encode: i,
- encodeURI: U,
- encodeURL: U,
- utob: F,
- btou: D,
- decode: h,
- isValid: k,
- fromUint8Array: d,
- toUint8Array: w,
- extendString: v,
- extendUint8Array: I,
- extendBuiltins: M
- };
- function G(t = "") {
- return t == null ? "" : q.encode(String(t));
- }
- export {
- G as e
- };
|