ztxkutils 2.5.2 → 2.5.5
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/_commonjsHelpers-bdec4bbd.js +7 -0
- package/dist/authority-17b7fde2.js +210 -210
- package/dist/crypto-c481f616.js +6707 -6707
- package/dist/crypto.js +6791 -2
- package/dist/index.js +3 -2
- package/dist/reqUrl-0a3b1a73.js +8 -8
- package/dist/reqUrl-521cd7e3.js +8 -8
- package/dist/reqUrl-93cf6870.js +8 -8
- package/dist/reqUrl-b19a6e87.js +8 -8
- package/dist/reqUrl-c74197bf.js +8 -8
- package/dist/reqUrl-eba8e6f5.js +8 -8
- package/dist/request-0bc1ca8b.js +2439 -2439
- package/dist/request-35a68ae8.js +2439 -2439
- package/dist/request-4f3e6994.js +2439 -2439
- package/dist/request-56290d29.js +2439 -2439
- package/dist/request-6d95e689.js +2439 -2439
- package/dist/request-74ca7860.js +2440 -2440
- package/dist/request-a8fb5cd3.js +2439 -2439
- package/dist/{request-aff11a10.js → request-d385a629.js} +5 -1
- package/dist/request-ec23b24a.js +2439 -2439
- package/dist/request.js +3 -2
- package/dist/tools-2876d65c.js +22 -22
- package/dist/tools-53fed4bb.js +24 -24
- package/dist/tools-8f036dd3.js +22 -22
- package/dist/tslib.es6-b9033aad.js +3 -3
- package/dist/validate-ebe369e9.js +9 -9
- package/dist/watermark-dom.d.ts +3 -0
- package/dist/watermark.d.ts +20 -0
- package/dist/watermark.js +433 -0
- package/package.json +1 -1
@@ -0,0 +1,7 @@
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
2
|
+
|
3
|
+
function commonjsRequire (path) {
|
4
|
+
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
5
|
+
}
|
6
|
+
|
7
|
+
export { commonjsRequire as a, commonjsGlobal as c };
|
@@ -1,193 +1,193 @@
|
|
1
|
-
/**
|
2
|
-
* base64.ts
|
3
|
-
*
|
4
|
-
* Licensed under the BSD 3-Clause License.
|
5
|
-
* http://opensource.org/licenses/BSD-3-Clause
|
6
|
-
*
|
7
|
-
* References:
|
8
|
-
* http://en.wikipedia.org/wiki/Base64
|
9
|
-
*
|
10
|
-
* @author Dan Kogai (https://github.com/dankogai)
|
11
|
-
*/
|
12
|
-
const _hasatob = typeof atob === 'function';
|
13
|
-
const _hasbtoa = typeof btoa === 'function';
|
14
|
-
const _hasBuffer = typeof Buffer === 'function';
|
15
|
-
const _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined;
|
16
|
-
const _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined;
|
17
|
-
const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
18
|
-
const b64chs = [...b64ch];
|
19
|
-
const b64tab = ((a) => {
|
20
|
-
let tab = {};
|
21
|
-
a.forEach((c, i) => tab[c] = i);
|
22
|
-
return tab;
|
23
|
-
})(b64chs);
|
24
|
-
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
25
|
-
const _fromCC = String.fromCharCode.bind(String);
|
26
|
-
const _U8Afrom = typeof Uint8Array.from === 'function'
|
27
|
-
? Uint8Array.from.bind(Uint8Array)
|
28
|
-
: (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));
|
29
|
-
const _mkUriSafe = (src) => src
|
30
|
-
.replace(/[+\/]/g, (m0) => m0 == '+' ? '-' : '_')
|
31
|
-
.replace(/=+$/m, '');
|
32
|
-
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, '');
|
33
|
-
/**
|
34
|
-
* polyfill version of `btoa`
|
35
|
-
*/
|
36
|
-
const btoaPolyfill = (bin) => {
|
37
|
-
// console.log('polyfilled');
|
38
|
-
let u32, c0, c1, c2, asc = '';
|
39
|
-
const pad = bin.length % 3;
|
40
|
-
for (let i = 0; i < bin.length;) {
|
41
|
-
if ((c0 = bin.charCodeAt(i++)) > 255 ||
|
42
|
-
(c1 = bin.charCodeAt(i++)) > 255 ||
|
43
|
-
(c2 = bin.charCodeAt(i++)) > 255)
|
44
|
-
throw new TypeError('invalid character found');
|
45
|
-
u32 = (c0 << 16) | (c1 << 8) | c2;
|
46
|
-
asc += b64chs[u32 >> 18 & 63]
|
47
|
-
+ b64chs[u32 >> 12 & 63]
|
48
|
-
+ b64chs[u32 >> 6 & 63]
|
49
|
-
+ b64chs[u32 & 63];
|
50
|
-
}
|
51
|
-
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
52
|
-
};
|
53
|
-
/**
|
54
|
-
* does what `window.btoa` of web browsers do.
|
55
|
-
* @param {String} bin binary string
|
56
|
-
* @returns {string} Base64-encoded string
|
57
|
-
*/
|
58
|
-
const _btoa = _hasbtoa ? (bin) => btoa(bin)
|
59
|
-
: _hasBuffer ? (bin) => Buffer.from(bin, 'binary').toString('base64')
|
60
|
-
: btoaPolyfill;
|
61
|
-
const _fromUint8Array = _hasBuffer
|
62
|
-
? (u8a) => Buffer.from(u8a).toString('base64')
|
63
|
-
: (u8a) => {
|
64
|
-
// cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326
|
65
|
-
const maxargs = 0x1000;
|
66
|
-
let strs = [];
|
67
|
-
for (let i = 0, l = u8a.length; i < l; i += maxargs) {
|
68
|
-
strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
69
|
-
}
|
70
|
-
return _btoa(strs.join(''));
|
71
|
-
};
|
72
|
-
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
|
73
|
-
// const utob = (src: string) => unescape(encodeURIComponent(src));
|
74
|
-
// reverting good old fationed regexp
|
75
|
-
const cb_utob = (c) => {
|
76
|
-
if (c.length < 2) {
|
77
|
-
var cc = c.charCodeAt(0);
|
78
|
-
return cc < 0x80 ? c
|
79
|
-
: cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6))
|
80
|
-
+ _fromCC(0x80 | (cc & 0x3f)))
|
81
|
-
: (_fromCC(0xe0 | ((cc >>> 12) & 0x0f))
|
82
|
-
+ _fromCC(0x80 | ((cc >>> 6) & 0x3f))
|
83
|
-
+ _fromCC(0x80 | (cc & 0x3f)));
|
84
|
-
}
|
85
|
-
else {
|
86
|
-
var cc = 0x10000
|
87
|
-
+ (c.charCodeAt(0) - 0xD800) * 0x400
|
88
|
-
+ (c.charCodeAt(1) - 0xDC00);
|
89
|
-
return (_fromCC(0xf0 | ((cc >>> 18) & 0x07))
|
90
|
-
+ _fromCC(0x80 | ((cc >>> 12) & 0x3f))
|
91
|
-
+ _fromCC(0x80 | ((cc >>> 6) & 0x3f))
|
92
|
-
+ _fromCC(0x80 | (cc & 0x3f)));
|
93
|
-
}
|
94
|
-
};
|
95
|
-
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
96
|
-
/**
|
97
|
-
* @deprecated should have been internal use only.
|
98
|
-
* @param {string} src UTF-8 string
|
99
|
-
* @returns {string} UTF-16 string
|
100
|
-
*/
|
101
|
-
const utob = (u) => u.replace(re_utob, cb_utob);
|
102
|
-
//
|
103
|
-
const _encode = _hasBuffer
|
104
|
-
? (s) => Buffer.from(s, 'utf8').toString('base64')
|
105
|
-
: _TE
|
106
|
-
? (s) => _fromUint8Array(_TE.encode(s))
|
107
|
-
: (s) => _btoa(utob(s));
|
108
|
-
/**
|
109
|
-
* converts a UTF-8-encoded string to a Base64 string.
|
110
|
-
* @param {boolean} [urlsafe] if `true` make the result URL-safe
|
111
|
-
* @returns {string} Base64 string
|
112
|
-
*/
|
113
|
-
const encode = (src, urlsafe = false) => urlsafe
|
114
|
-
? _mkUriSafe(_encode(src))
|
115
|
-
: _encode(src);
|
116
|
-
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
|
117
|
-
// const btou = (src: string) => decodeURIComponent(escape(src));
|
118
|
-
// reverting good old fationed regexp
|
119
|
-
const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
120
|
-
const cb_btou = (cccc) => {
|
121
|
-
switch (cccc.length) {
|
122
|
-
case 4:
|
123
|
-
var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
|
124
|
-
| ((0x3f & cccc.charCodeAt(1)) << 12)
|
125
|
-
| ((0x3f & cccc.charCodeAt(2)) << 6)
|
126
|
-
| (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000;
|
127
|
-
return (_fromCC((offset >>> 10) + 0xD800)
|
128
|
-
+ _fromCC((offset & 0x3FF) + 0xDC00));
|
129
|
-
case 3:
|
130
|
-
return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12)
|
131
|
-
| ((0x3f & cccc.charCodeAt(1)) << 6)
|
132
|
-
| (0x3f & cccc.charCodeAt(2)));
|
133
|
-
default:
|
134
|
-
return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6)
|
135
|
-
| (0x3f & cccc.charCodeAt(1)));
|
136
|
-
}
|
137
|
-
};
|
138
|
-
/**
|
139
|
-
* @deprecated should have been internal use only.
|
140
|
-
* @param {string} src UTF-16 string
|
141
|
-
* @returns {string} UTF-8 string
|
142
|
-
*/
|
143
|
-
const btou = (b) => b.replace(re_btou, cb_btou);
|
144
|
-
/**
|
145
|
-
* polyfill version of `atob`
|
146
|
-
*/
|
147
|
-
const atobPolyfill = (asc) => {
|
148
|
-
// console.log('polyfilled');
|
149
|
-
asc = asc.replace(/\s+/g, '');
|
150
|
-
if (!b64re.test(asc))
|
151
|
-
throw new TypeError('malformed base64.');
|
152
|
-
asc += '=='.slice(2 - (asc.length & 3));
|
153
|
-
let u24, bin = '', r1, r2;
|
154
|
-
for (let i = 0; i < asc.length;) {
|
155
|
-
u24 = b64tab[asc.charAt(i++)] << 18
|
156
|
-
| b64tab[asc.charAt(i++)] << 12
|
157
|
-
| (r1 = b64tab[asc.charAt(i++)]) << 6
|
158
|
-
| (r2 = b64tab[asc.charAt(i++)]);
|
159
|
-
bin += r1 === 64 ? _fromCC(u24 >> 16 & 255)
|
160
|
-
: r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255)
|
161
|
-
: _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
|
162
|
-
}
|
163
|
-
return bin;
|
164
|
-
};
|
165
|
-
/**
|
166
|
-
* does what `window.atob` of web browsers do.
|
167
|
-
* @param {String} asc Base64-encoded string
|
168
|
-
* @returns {string} binary string
|
169
|
-
*/
|
170
|
-
const _atob = _hasatob ? (asc) => atob(_tidyB64(asc))
|
171
|
-
: _hasBuffer ? (asc) => Buffer.from(asc, 'base64').toString('binary')
|
172
|
-
: atobPolyfill;
|
173
|
-
//
|
174
|
-
const _toUint8Array = _hasBuffer
|
175
|
-
? (a) => _U8Afrom(Buffer.from(a, 'base64'))
|
176
|
-
: (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0));
|
177
|
-
//
|
178
|
-
const _decode = _hasBuffer
|
179
|
-
? (a) => Buffer.from(a, 'base64').toString('utf8')
|
180
|
-
: _TD
|
181
|
-
? (a) => _TD.decode(_toUint8Array(a))
|
182
|
-
: (a) => btou(_atob(a));
|
183
|
-
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/'));
|
184
|
-
/**
|
185
|
-
* converts a Base64 string to a UTF-8 string.
|
186
|
-
* @param {String} src Base64 string. Both normal and URL-safe are supported
|
187
|
-
* @returns {string} UTF-8 string
|
188
|
-
*/
|
189
|
-
const decode = (src) => _decode(_unURI(src));
|
190
|
-
|
1
|
+
/**
|
2
|
+
* base64.ts
|
3
|
+
*
|
4
|
+
* Licensed under the BSD 3-Clause License.
|
5
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
6
|
+
*
|
7
|
+
* References:
|
8
|
+
* http://en.wikipedia.org/wiki/Base64
|
9
|
+
*
|
10
|
+
* @author Dan Kogai (https://github.com/dankogai)
|
11
|
+
*/
|
12
|
+
const _hasatob = typeof atob === 'function';
|
13
|
+
const _hasbtoa = typeof btoa === 'function';
|
14
|
+
const _hasBuffer = typeof Buffer === 'function';
|
15
|
+
const _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined;
|
16
|
+
const _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined;
|
17
|
+
const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
18
|
+
const b64chs = [...b64ch];
|
19
|
+
const b64tab = ((a) => {
|
20
|
+
let tab = {};
|
21
|
+
a.forEach((c, i) => tab[c] = i);
|
22
|
+
return tab;
|
23
|
+
})(b64chs);
|
24
|
+
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
25
|
+
const _fromCC = String.fromCharCode.bind(String);
|
26
|
+
const _U8Afrom = typeof Uint8Array.from === 'function'
|
27
|
+
? Uint8Array.from.bind(Uint8Array)
|
28
|
+
: (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));
|
29
|
+
const _mkUriSafe = (src) => src
|
30
|
+
.replace(/[+\/]/g, (m0) => m0 == '+' ? '-' : '_')
|
31
|
+
.replace(/=+$/m, '');
|
32
|
+
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, '');
|
33
|
+
/**
|
34
|
+
* polyfill version of `btoa`
|
35
|
+
*/
|
36
|
+
const btoaPolyfill = (bin) => {
|
37
|
+
// console.log('polyfilled');
|
38
|
+
let u32, c0, c1, c2, asc = '';
|
39
|
+
const pad = bin.length % 3;
|
40
|
+
for (let i = 0; i < bin.length;) {
|
41
|
+
if ((c0 = bin.charCodeAt(i++)) > 255 ||
|
42
|
+
(c1 = bin.charCodeAt(i++)) > 255 ||
|
43
|
+
(c2 = bin.charCodeAt(i++)) > 255)
|
44
|
+
throw new TypeError('invalid character found');
|
45
|
+
u32 = (c0 << 16) | (c1 << 8) | c2;
|
46
|
+
asc += b64chs[u32 >> 18 & 63]
|
47
|
+
+ b64chs[u32 >> 12 & 63]
|
48
|
+
+ b64chs[u32 >> 6 & 63]
|
49
|
+
+ b64chs[u32 & 63];
|
50
|
+
}
|
51
|
+
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
52
|
+
};
|
53
|
+
/**
|
54
|
+
* does what `window.btoa` of web browsers do.
|
55
|
+
* @param {String} bin binary string
|
56
|
+
* @returns {string} Base64-encoded string
|
57
|
+
*/
|
58
|
+
const _btoa = _hasbtoa ? (bin) => btoa(bin)
|
59
|
+
: _hasBuffer ? (bin) => Buffer.from(bin, 'binary').toString('base64')
|
60
|
+
: btoaPolyfill;
|
61
|
+
const _fromUint8Array = _hasBuffer
|
62
|
+
? (u8a) => Buffer.from(u8a).toString('base64')
|
63
|
+
: (u8a) => {
|
64
|
+
// cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326
|
65
|
+
const maxargs = 0x1000;
|
66
|
+
let strs = [];
|
67
|
+
for (let i = 0, l = u8a.length; i < l; i += maxargs) {
|
68
|
+
strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
69
|
+
}
|
70
|
+
return _btoa(strs.join(''));
|
71
|
+
};
|
72
|
+
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
|
73
|
+
// const utob = (src: string) => unescape(encodeURIComponent(src));
|
74
|
+
// reverting good old fationed regexp
|
75
|
+
const cb_utob = (c) => {
|
76
|
+
if (c.length < 2) {
|
77
|
+
var cc = c.charCodeAt(0);
|
78
|
+
return cc < 0x80 ? c
|
79
|
+
: cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6))
|
80
|
+
+ _fromCC(0x80 | (cc & 0x3f)))
|
81
|
+
: (_fromCC(0xe0 | ((cc >>> 12) & 0x0f))
|
82
|
+
+ _fromCC(0x80 | ((cc >>> 6) & 0x3f))
|
83
|
+
+ _fromCC(0x80 | (cc & 0x3f)));
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
var cc = 0x10000
|
87
|
+
+ (c.charCodeAt(0) - 0xD800) * 0x400
|
88
|
+
+ (c.charCodeAt(1) - 0xDC00);
|
89
|
+
return (_fromCC(0xf0 | ((cc >>> 18) & 0x07))
|
90
|
+
+ _fromCC(0x80 | ((cc >>> 12) & 0x3f))
|
91
|
+
+ _fromCC(0x80 | ((cc >>> 6) & 0x3f))
|
92
|
+
+ _fromCC(0x80 | (cc & 0x3f)));
|
93
|
+
}
|
94
|
+
};
|
95
|
+
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
96
|
+
/**
|
97
|
+
* @deprecated should have been internal use only.
|
98
|
+
* @param {string} src UTF-8 string
|
99
|
+
* @returns {string} UTF-16 string
|
100
|
+
*/
|
101
|
+
const utob = (u) => u.replace(re_utob, cb_utob);
|
102
|
+
//
|
103
|
+
const _encode = _hasBuffer
|
104
|
+
? (s) => Buffer.from(s, 'utf8').toString('base64')
|
105
|
+
: _TE
|
106
|
+
? (s) => _fromUint8Array(_TE.encode(s))
|
107
|
+
: (s) => _btoa(utob(s));
|
108
|
+
/**
|
109
|
+
* converts a UTF-8-encoded string to a Base64 string.
|
110
|
+
* @param {boolean} [urlsafe] if `true` make the result URL-safe
|
111
|
+
* @returns {string} Base64 string
|
112
|
+
*/
|
113
|
+
const encode = (src, urlsafe = false) => urlsafe
|
114
|
+
? _mkUriSafe(_encode(src))
|
115
|
+
: _encode(src);
|
116
|
+
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
|
117
|
+
// const btou = (src: string) => decodeURIComponent(escape(src));
|
118
|
+
// reverting good old fationed regexp
|
119
|
+
const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
120
|
+
const cb_btou = (cccc) => {
|
121
|
+
switch (cccc.length) {
|
122
|
+
case 4:
|
123
|
+
var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
|
124
|
+
| ((0x3f & cccc.charCodeAt(1)) << 12)
|
125
|
+
| ((0x3f & cccc.charCodeAt(2)) << 6)
|
126
|
+
| (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000;
|
127
|
+
return (_fromCC((offset >>> 10) + 0xD800)
|
128
|
+
+ _fromCC((offset & 0x3FF) + 0xDC00));
|
129
|
+
case 3:
|
130
|
+
return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12)
|
131
|
+
| ((0x3f & cccc.charCodeAt(1)) << 6)
|
132
|
+
| (0x3f & cccc.charCodeAt(2)));
|
133
|
+
default:
|
134
|
+
return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6)
|
135
|
+
| (0x3f & cccc.charCodeAt(1)));
|
136
|
+
}
|
137
|
+
};
|
138
|
+
/**
|
139
|
+
* @deprecated should have been internal use only.
|
140
|
+
* @param {string} src UTF-16 string
|
141
|
+
* @returns {string} UTF-8 string
|
142
|
+
*/
|
143
|
+
const btou = (b) => b.replace(re_btou, cb_btou);
|
144
|
+
/**
|
145
|
+
* polyfill version of `atob`
|
146
|
+
*/
|
147
|
+
const atobPolyfill = (asc) => {
|
148
|
+
// console.log('polyfilled');
|
149
|
+
asc = asc.replace(/\s+/g, '');
|
150
|
+
if (!b64re.test(asc))
|
151
|
+
throw new TypeError('malformed base64.');
|
152
|
+
asc += '=='.slice(2 - (asc.length & 3));
|
153
|
+
let u24, bin = '', r1, r2;
|
154
|
+
for (let i = 0; i < asc.length;) {
|
155
|
+
u24 = b64tab[asc.charAt(i++)] << 18
|
156
|
+
| b64tab[asc.charAt(i++)] << 12
|
157
|
+
| (r1 = b64tab[asc.charAt(i++)]) << 6
|
158
|
+
| (r2 = b64tab[asc.charAt(i++)]);
|
159
|
+
bin += r1 === 64 ? _fromCC(u24 >> 16 & 255)
|
160
|
+
: r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255)
|
161
|
+
: _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
|
162
|
+
}
|
163
|
+
return bin;
|
164
|
+
};
|
165
|
+
/**
|
166
|
+
* does what `window.atob` of web browsers do.
|
167
|
+
* @param {String} asc Base64-encoded string
|
168
|
+
* @returns {string} binary string
|
169
|
+
*/
|
170
|
+
const _atob = _hasatob ? (asc) => atob(_tidyB64(asc))
|
171
|
+
: _hasBuffer ? (asc) => Buffer.from(asc, 'base64').toString('binary')
|
172
|
+
: atobPolyfill;
|
173
|
+
//
|
174
|
+
const _toUint8Array = _hasBuffer
|
175
|
+
? (a) => _U8Afrom(Buffer.from(a, 'base64'))
|
176
|
+
: (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0));
|
177
|
+
//
|
178
|
+
const _decode = _hasBuffer
|
179
|
+
? (a) => Buffer.from(a, 'base64').toString('utf8')
|
180
|
+
: _TD
|
181
|
+
? (a) => _TD.decode(_toUint8Array(a))
|
182
|
+
: (a) => btou(_atob(a));
|
183
|
+
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/'));
|
184
|
+
/**
|
185
|
+
* converts a Base64 string to a UTF-8 string.
|
186
|
+
* @param {String} src Base64 string. Both normal and URL-safe are supported
|
187
|
+
* @returns {string} UTF-8 string
|
188
|
+
*/
|
189
|
+
const decode = (src) => _decode(_unURI(src));
|
190
|
+
|
191
191
|
/**
|
192
192
|
* @description 权限相关操作
|
193
193
|
*/
|
@@ -310,23 +310,23 @@ var getLastUrlPath = function () {
|
|
310
310
|
}
|
311
311
|
};
|
312
312
|
/**返回是否在乾坤下启动 */
|
313
|
-
var isQiankun = function () { return window.__POWERED_BY_QIANKUN__; };
|
314
|
-
|
315
|
-
var authority = /*#__PURE__*/Object.freeze({
|
316
|
-
__proto__: null,
|
317
|
-
getToken: getToken,
|
318
|
-
getRefreshToken: getRefreshToken,
|
319
|
-
setToken: setToken,
|
320
|
-
removeToken: removeToken,
|
321
|
-
setRefreshToken: setRefreshToken,
|
322
|
-
removeRefreshToken: removeRefreshToken,
|
323
|
-
aesEncrypt: aesEncrypt,
|
324
|
-
aesDecrypt: aesDecrypt,
|
325
|
-
BTN_AUTHS: BTN_AUTHS,
|
326
|
-
isBtnAuth: isBtnAuth,
|
327
|
-
setLastUrlPath: setLastUrlPath,
|
328
|
-
getLastUrlPath: getLastUrlPath,
|
329
|
-
isQiankun: isQiankun
|
330
|
-
});
|
331
|
-
|
332
|
-
export { BTN_AUTHS as B, getRefreshToken as a, setRefreshToken as b, authority as c, removeRefreshToken as d, aesEncrypt as e, aesDecrypt as f, getToken as g, setLastUrlPath as h, isBtnAuth as i, getLastUrlPath as j, isQiankun as k, removeToken as r, setToken as s };
|
313
|
+
var isQiankun = function () { return window.__POWERED_BY_QIANKUN__; };
|
314
|
+
|
315
|
+
var authority = /*#__PURE__*/Object.freeze({
|
316
|
+
__proto__: null,
|
317
|
+
getToken: getToken,
|
318
|
+
getRefreshToken: getRefreshToken,
|
319
|
+
setToken: setToken,
|
320
|
+
removeToken: removeToken,
|
321
|
+
setRefreshToken: setRefreshToken,
|
322
|
+
removeRefreshToken: removeRefreshToken,
|
323
|
+
aesEncrypt: aesEncrypt,
|
324
|
+
aesDecrypt: aesDecrypt,
|
325
|
+
BTN_AUTHS: BTN_AUTHS,
|
326
|
+
isBtnAuth: isBtnAuth,
|
327
|
+
setLastUrlPath: setLastUrlPath,
|
328
|
+
getLastUrlPath: getLastUrlPath,
|
329
|
+
isQiankun: isQiankun
|
330
|
+
});
|
331
|
+
|
332
|
+
export { BTN_AUTHS as B, getRefreshToken as a, setRefreshToken as b, authority as c, removeRefreshToken as d, aesEncrypt as e, aesDecrypt as f, getToken as g, setLastUrlPath as h, isBtnAuth as i, getLastUrlPath as j, isQiankun as k, removeToken as r, setToken as s };
|