@authme/util 2.8.45 → 2.8.46
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/index.cjs.js +193 -172
- package/index.esm.js +178 -158
- package/package.json +2 -2
- package/src/lib/const.d.ts +7 -0
- package/src/ui/canvas/video-to-image.d.ts +1 -1
- package/index.esm.d.ts +0 -1
- /package/{index.cjs.d.ts → index.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -23,8 +23,10 @@ import 'core-js/modules/es.typed-array.to-locale-string.js';
|
|
|
23
23
|
import 'core-js/modules/es.typed-array.to-reversed.js';
|
|
24
24
|
import 'core-js/modules/es.typed-array.to-sorted.js';
|
|
25
25
|
import 'core-js/modules/es.typed-array.with.js';
|
|
26
|
-
import 'core-js/modules/
|
|
27
|
-
import 'core-js/modules/
|
|
26
|
+
import 'core-js/modules/es.uint8-array.set-from-base64.js';
|
|
27
|
+
import 'core-js/modules/es.uint8-array.set-from-hex.js';
|
|
28
|
+
import 'core-js/modules/es.uint8-array.to-base64.js';
|
|
29
|
+
import 'core-js/modules/es.uint8-array.to-hex.js';
|
|
28
30
|
import 'core-js/modules/web.atob.js';
|
|
29
31
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
30
32
|
import 'core-js/modules/web.dom-exception.constructor.js';
|
|
@@ -33,12 +35,12 @@ import 'core-js/modules/web.dom-exception.to-string-tag.js';
|
|
|
33
35
|
import 'core-js/modules/es.array.push.js';
|
|
34
36
|
import 'core-js/modules/es.error.cause.js';
|
|
35
37
|
import 'core-js/modules/es.array.includes.js';
|
|
38
|
+
import 'core-js/modules/es.iterator.constructor.js';
|
|
39
|
+
import 'core-js/modules/es.iterator.for-each.js';
|
|
40
|
+
import 'core-js/modules/es.json.parse.js';
|
|
36
41
|
import 'core-js/modules/es.json.stringify.js';
|
|
37
42
|
import 'core-js/modules/es.string.search.js';
|
|
38
43
|
import 'core-js/modules/es.typed-array.uint32-array.js';
|
|
39
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
40
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
41
|
-
import 'core-js/modules/esnext.json.parse.js';
|
|
42
44
|
import 'core-js/modules/web.url-search-params.js';
|
|
43
45
|
import 'core-js/modules/web.url-search-params.delete.js';
|
|
44
46
|
import 'core-js/modules/web.url-search-params.has.js';
|
|
@@ -47,13 +49,13 @@ import require$$0 from 'stream';
|
|
|
47
49
|
import require$$2 from 'events';
|
|
48
50
|
import require$$0$1 from 'buffer';
|
|
49
51
|
import require$$1 from 'util';
|
|
52
|
+
import 'core-js/modules/es.iterator.map.js';
|
|
50
53
|
import 'core-js/modules/es.parse-int.js';
|
|
51
|
-
import 'core-js/modules/esnext.iterator.map.js';
|
|
52
54
|
import 'core-js/modules/es.array.sort.js';
|
|
53
55
|
import 'core-js/modules/es.global-this.js';
|
|
56
|
+
import 'core-js/modules/es.iterator.filter.js';
|
|
54
57
|
import 'core-js/modules/es.number.to-fixed.js';
|
|
55
58
|
import 'core-js/modules/es.string.includes.js';
|
|
56
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
57
59
|
import 'core-js/modules/es.string.starts-with.js';
|
|
58
60
|
import 'core-js/modules/es.string.trim.js';
|
|
59
61
|
|
|
@@ -325,10 +327,66 @@ const verificationErrorMessages = code => {
|
|
|
325
327
|
}
|
|
326
328
|
};
|
|
327
329
|
|
|
328
|
-
|
|
330
|
+
class InvalidTokenError extends Error {
|
|
331
|
+
}
|
|
332
|
+
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
333
|
+
function b64DecodeUnicode(str) {
|
|
334
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
335
|
+
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
336
|
+
if (code.length < 2) {
|
|
337
|
+
code = "0" + code;
|
|
338
|
+
}
|
|
339
|
+
return "%" + code;
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
function base64UrlDecode(str) {
|
|
343
|
+
let output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
344
|
+
switch (output.length % 4) {
|
|
345
|
+
case 0:
|
|
346
|
+
break;
|
|
347
|
+
case 2:
|
|
348
|
+
output += "==";
|
|
349
|
+
break;
|
|
350
|
+
case 3:
|
|
351
|
+
output += "=";
|
|
352
|
+
break;
|
|
353
|
+
default:
|
|
354
|
+
throw new Error("base64 string is not of the correct length");
|
|
355
|
+
}
|
|
356
|
+
try {
|
|
357
|
+
return b64DecodeUnicode(output);
|
|
358
|
+
}
|
|
359
|
+
catch (err) {
|
|
360
|
+
return atob(output);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function jwtDecode(token, options) {
|
|
364
|
+
if (typeof token !== "string") {
|
|
365
|
+
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
366
|
+
}
|
|
367
|
+
options || (options = {});
|
|
368
|
+
const pos = options.header === true ? 0 : 1;
|
|
369
|
+
const part = token.split(".")[pos];
|
|
370
|
+
if (typeof part !== "string") {
|
|
371
|
+
throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
|
|
372
|
+
}
|
|
373
|
+
let decoded;
|
|
374
|
+
try {
|
|
375
|
+
decoded = base64UrlDecode(part);
|
|
376
|
+
}
|
|
377
|
+
catch (e) {
|
|
378
|
+
throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
|
|
379
|
+
}
|
|
380
|
+
try {
|
|
381
|
+
return JSON.parse(decoded);
|
|
382
|
+
}
|
|
383
|
+
catch (e) {
|
|
384
|
+
throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
329
387
|
|
|
330
388
|
function decodeToken(token) {
|
|
331
|
-
const decoded =
|
|
389
|
+
const decoded = jwtDecode(token);
|
|
332
390
|
const {
|
|
333
391
|
exp,
|
|
334
392
|
iat
|
|
@@ -654,7 +712,7 @@ function getDefaultExportFromCjs (x) {
|
|
|
654
712
|
|
|
655
713
|
var FileSaver_min = {exports: {}};
|
|
656
714
|
|
|
657
|
-
(function (module, exports) {
|
|
715
|
+
(function (module, exports$1) {
|
|
658
716
|
(function(a,b){b();})(commonjsGlobal,function(){function b(a,b){return "undefined"==typeof b?b={autoBom:false}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){g(d.response,b,c);},d.onerror=function(){console.error("could not download file");},d.send();}function d(a){var b=new XMLHttpRequest;b.open("HEAD",a,false);try{b.send();}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"));}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",true,true,window,0,0,0,80,20,false,false,false,false,0,null),a.dispatchEvent(b);}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof commonjsGlobal&&commonjsGlobal.global===commonjsGlobal?commonjsGlobal:void 0,a=f.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href);},4E4),setTimeout(function(){e(j);},0));}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else {var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i);});}}:function(b,d,e,g){if(g=g||open("","_blank"),g&&(g.document.title=g.document.body.innerText="downloading..."),"string"==typeof b)return c(b,d,e);var h="application/octet-stream"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&"undefined"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),g?g.location.href=a:location=a,g=null;},k.readAsDataURL(b);}else {var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m);},4E4);}});f.saveAs=g.saveAs=g,(module.exports=g);});
|
|
659
717
|
|
|
660
718
|
|
|
@@ -747,16 +805,16 @@ function requireStream () {
|
|
|
747
805
|
return stream$1;
|
|
748
806
|
}
|
|
749
807
|
|
|
750
|
-
var safeBuffer
|
|
808
|
+
var safeBuffer = {exports: {}};
|
|
751
809
|
|
|
752
810
|
/* eslint-disable node/no-deprecated-api */
|
|
753
811
|
|
|
754
|
-
var hasRequiredSafeBuffer
|
|
812
|
+
var hasRequiredSafeBuffer;
|
|
755
813
|
|
|
756
|
-
function requireSafeBuffer
|
|
757
|
-
if (hasRequiredSafeBuffer
|
|
758
|
-
hasRequiredSafeBuffer
|
|
759
|
-
(function (module, exports) {
|
|
814
|
+
function requireSafeBuffer () {
|
|
815
|
+
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
816
|
+
hasRequiredSafeBuffer = 1;
|
|
817
|
+
(function (module, exports$1) {
|
|
760
818
|
var buffer = require$$0$1;
|
|
761
819
|
var Buffer = buffer.Buffer;
|
|
762
820
|
|
|
@@ -770,8 +828,8 @@ function requireSafeBuffer$1 () {
|
|
|
770
828
|
module.exports = buffer;
|
|
771
829
|
} else {
|
|
772
830
|
// Copy properties from require('buffer')
|
|
773
|
-
copyProps(buffer, exports);
|
|
774
|
-
exports.Buffer = SafeBuffer;
|
|
831
|
+
copyProps(buffer, exports$1);
|
|
832
|
+
exports$1.Buffer = SafeBuffer;
|
|
775
833
|
}
|
|
776
834
|
|
|
777
835
|
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
@@ -818,8 +876,8 @@ function requireSafeBuffer$1 () {
|
|
|
818
876
|
}
|
|
819
877
|
return buffer.SlowBuffer(size)
|
|
820
878
|
};
|
|
821
|
-
} (safeBuffer
|
|
822
|
-
return safeBuffer
|
|
879
|
+
} (safeBuffer, safeBuffer.exports));
|
|
880
|
+
return safeBuffer.exports;
|
|
823
881
|
}
|
|
824
882
|
|
|
825
883
|
var util = {};
|
|
@@ -1006,7 +1064,7 @@ function requireBufferList () {
|
|
|
1006
1064
|
|
|
1007
1065
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1008
1066
|
|
|
1009
|
-
var Buffer = requireSafeBuffer
|
|
1067
|
+
var Buffer = requireSafeBuffer().Buffer;
|
|
1010
1068
|
var util = require$$1;
|
|
1011
1069
|
|
|
1012
1070
|
function copyBuffer(src, target, offset) {
|
|
@@ -1244,7 +1302,7 @@ function require_stream_writable () {
|
|
|
1244
1302
|
|
|
1245
1303
|
/*<replacement>*/
|
|
1246
1304
|
|
|
1247
|
-
var Buffer = requireSafeBuffer
|
|
1305
|
+
var Buffer = requireSafeBuffer().Buffer;
|
|
1248
1306
|
var OurUint8Array = (typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
|
|
1249
1307
|
function _uint8ArrayToBuffer(chunk) {
|
|
1250
1308
|
return Buffer.from(chunk);
|
|
@@ -1965,81 +2023,6 @@ function require_stream_duplex () {
|
|
|
1965
2023
|
|
|
1966
2024
|
var string_decoder = {};
|
|
1967
2025
|
|
|
1968
|
-
var safeBuffer = {exports: {}};
|
|
1969
|
-
|
|
1970
|
-
/* eslint-disable node/no-deprecated-api */
|
|
1971
|
-
|
|
1972
|
-
var hasRequiredSafeBuffer;
|
|
1973
|
-
|
|
1974
|
-
function requireSafeBuffer () {
|
|
1975
|
-
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
1976
|
-
hasRequiredSafeBuffer = 1;
|
|
1977
|
-
(function (module, exports) {
|
|
1978
|
-
var buffer = require$$0$1;
|
|
1979
|
-
var Buffer = buffer.Buffer;
|
|
1980
|
-
|
|
1981
|
-
// alternative to using Object.keys for old browsers
|
|
1982
|
-
function copyProps (src, dst) {
|
|
1983
|
-
for (var key in src) {
|
|
1984
|
-
dst[key] = src[key];
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
1988
|
-
module.exports = buffer;
|
|
1989
|
-
} else {
|
|
1990
|
-
// Copy properties from require('buffer')
|
|
1991
|
-
copyProps(buffer, exports);
|
|
1992
|
-
exports.Buffer = SafeBuffer;
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
1996
|
-
return Buffer(arg, encodingOrOffset, length)
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
// Copy static methods from Buffer
|
|
2000
|
-
copyProps(Buffer, SafeBuffer);
|
|
2001
|
-
|
|
2002
|
-
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
|
2003
|
-
if (typeof arg === 'number') {
|
|
2004
|
-
throw new TypeError('Argument must not be a number')
|
|
2005
|
-
}
|
|
2006
|
-
return Buffer(arg, encodingOrOffset, length)
|
|
2007
|
-
};
|
|
2008
|
-
|
|
2009
|
-
SafeBuffer.alloc = function (size, fill, encoding) {
|
|
2010
|
-
if (typeof size !== 'number') {
|
|
2011
|
-
throw new TypeError('Argument must be a number')
|
|
2012
|
-
}
|
|
2013
|
-
var buf = Buffer(size);
|
|
2014
|
-
if (fill !== undefined) {
|
|
2015
|
-
if (typeof encoding === 'string') {
|
|
2016
|
-
buf.fill(fill, encoding);
|
|
2017
|
-
} else {
|
|
2018
|
-
buf.fill(fill);
|
|
2019
|
-
}
|
|
2020
|
-
} else {
|
|
2021
|
-
buf.fill(0);
|
|
2022
|
-
}
|
|
2023
|
-
return buf
|
|
2024
|
-
};
|
|
2025
|
-
|
|
2026
|
-
SafeBuffer.allocUnsafe = function (size) {
|
|
2027
|
-
if (typeof size !== 'number') {
|
|
2028
|
-
throw new TypeError('Argument must be a number')
|
|
2029
|
-
}
|
|
2030
|
-
return Buffer(size)
|
|
2031
|
-
};
|
|
2032
|
-
|
|
2033
|
-
SafeBuffer.allocUnsafeSlow = function (size) {
|
|
2034
|
-
if (typeof size !== 'number') {
|
|
2035
|
-
throw new TypeError('Argument must be a number')
|
|
2036
|
-
}
|
|
2037
|
-
return buffer.SlowBuffer(size)
|
|
2038
|
-
};
|
|
2039
|
-
} (safeBuffer, safeBuffer.exports));
|
|
2040
|
-
return safeBuffer.exports;
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
2026
|
var hasRequiredString_decoder;
|
|
2044
2027
|
|
|
2045
2028
|
function requireString_decoder () {
|
|
@@ -2359,7 +2342,7 @@ function require_stream_readable () {
|
|
|
2359
2342
|
|
|
2360
2343
|
/*<replacement>*/
|
|
2361
2344
|
|
|
2362
|
-
var Buffer = requireSafeBuffer
|
|
2345
|
+
var Buffer = requireSafeBuffer().Buffer;
|
|
2363
2346
|
var OurUint8Array = (typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
|
|
2364
2347
|
function _uint8ArrayToBuffer(chunk) {
|
|
2365
2348
|
return Buffer.from(chunk);
|
|
@@ -3521,25 +3504,25 @@ var hasRequiredReadable;
|
|
|
3521
3504
|
function requireReadable () {
|
|
3522
3505
|
if (hasRequiredReadable) return readable.exports;
|
|
3523
3506
|
hasRequiredReadable = 1;
|
|
3524
|
-
(function (module, exports) {
|
|
3507
|
+
(function (module, exports$1) {
|
|
3525
3508
|
var Stream = require$$0;
|
|
3526
3509
|
if (process.env.READABLE_STREAM === 'disable' && Stream) {
|
|
3527
3510
|
module.exports = Stream;
|
|
3528
|
-
exports = module.exports = Stream.Readable;
|
|
3529
|
-
exports.Readable = Stream.Readable;
|
|
3530
|
-
exports.Writable = Stream.Writable;
|
|
3531
|
-
exports.Duplex = Stream.Duplex;
|
|
3532
|
-
exports.Transform = Stream.Transform;
|
|
3533
|
-
exports.PassThrough = Stream.PassThrough;
|
|
3534
|
-
exports.Stream = Stream;
|
|
3511
|
+
exports$1 = module.exports = Stream.Readable;
|
|
3512
|
+
exports$1.Readable = Stream.Readable;
|
|
3513
|
+
exports$1.Writable = Stream.Writable;
|
|
3514
|
+
exports$1.Duplex = Stream.Duplex;
|
|
3515
|
+
exports$1.Transform = Stream.Transform;
|
|
3516
|
+
exports$1.PassThrough = Stream.PassThrough;
|
|
3517
|
+
exports$1.Stream = Stream;
|
|
3535
3518
|
} else {
|
|
3536
|
-
exports = module.exports = require_stream_readable();
|
|
3537
|
-
exports.Stream = Stream || exports;
|
|
3538
|
-
exports.Readable = exports;
|
|
3539
|
-
exports.Writable = require_stream_writable();
|
|
3540
|
-
exports.Duplex = require_stream_duplex();
|
|
3541
|
-
exports.Transform = require_stream_transform();
|
|
3542
|
-
exports.PassThrough = require_stream_passthrough();
|
|
3519
|
+
exports$1 = module.exports = require_stream_readable();
|
|
3520
|
+
exports$1.Stream = Stream || exports$1;
|
|
3521
|
+
exports$1.Readable = exports$1;
|
|
3522
|
+
exports$1.Writable = require_stream_writable();
|
|
3523
|
+
exports$1.Duplex = require_stream_duplex();
|
|
3524
|
+
exports$1.Transform = require_stream_transform();
|
|
3525
|
+
exports$1.PassThrough = require_stream_passthrough();
|
|
3543
3526
|
}
|
|
3544
3527
|
} (readable, readable.exports));
|
|
3545
3528
|
return readable.exports;
|
|
@@ -4351,7 +4334,7 @@ var hasRequiredUtils;
|
|
|
4351
4334
|
function requireUtils () {
|
|
4352
4335
|
if (hasRequiredUtils) return utils$q;
|
|
4353
4336
|
hasRequiredUtils = 1;
|
|
4354
|
-
(function (exports) {
|
|
4337
|
+
(function (exports$1) {
|
|
4355
4338
|
|
|
4356
4339
|
var support = support$4;
|
|
4357
4340
|
var base64 = requireBase64();
|
|
@@ -4390,8 +4373,8 @@ function requireUtils () {
|
|
|
4390
4373
|
* @param {String} type the mime type of the blob.
|
|
4391
4374
|
* @return {Blob} the created blob.
|
|
4392
4375
|
*/
|
|
4393
|
-
exports.newBlob = function(part, type) {
|
|
4394
|
-
exports.checkSupport("blob");
|
|
4376
|
+
exports$1.newBlob = function(part, type) {
|
|
4377
|
+
exports$1.checkSupport("blob");
|
|
4395
4378
|
|
|
4396
4379
|
try {
|
|
4397
4380
|
// Blob constructor
|
|
@@ -4526,7 +4509,7 @@ function requireUtils () {
|
|
|
4526
4509
|
// This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2
|
|
4527
4510
|
// TODO : we now have workers that split the work. Do we still need that ?
|
|
4528
4511
|
var chunk = 65536,
|
|
4529
|
-
type = exports.getTypeOf(array),
|
|
4512
|
+
type = exports$1.getTypeOf(array),
|
|
4530
4513
|
canUseApply = true;
|
|
4531
4514
|
if (type === "uint8array") {
|
|
4532
4515
|
canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array;
|
|
@@ -4549,7 +4532,7 @@ function requireUtils () {
|
|
|
4549
4532
|
return arrayToStringHelper.stringifyByChar(array);
|
|
4550
4533
|
}
|
|
4551
4534
|
|
|
4552
|
-
exports.applyFromCharCode = arrayLikeToString;
|
|
4535
|
+
exports$1.applyFromCharCode = arrayLikeToString;
|
|
4553
4536
|
|
|
4554
4537
|
|
|
4555
4538
|
/**
|
|
@@ -4655,7 +4638,7 @@ function requireUtils () {
|
|
|
4655
4638
|
* @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert.
|
|
4656
4639
|
* @throws {Error} an Error if the browser doesn't support the requested output type.
|
|
4657
4640
|
*/
|
|
4658
|
-
exports.transformTo = function(outputType, input) {
|
|
4641
|
+
exports$1.transformTo = function(outputType, input) {
|
|
4659
4642
|
if (!input) {
|
|
4660
4643
|
// undefined, null, etc
|
|
4661
4644
|
// an empty string won't harm.
|
|
@@ -4664,8 +4647,8 @@ function requireUtils () {
|
|
|
4664
4647
|
if (!outputType) {
|
|
4665
4648
|
return input;
|
|
4666
4649
|
}
|
|
4667
|
-
exports.checkSupport(outputType);
|
|
4668
|
-
var inputType = exports.getTypeOf(input);
|
|
4650
|
+
exports$1.checkSupport(outputType);
|
|
4651
|
+
var inputType = exports$1.getTypeOf(input);
|
|
4669
4652
|
var result = transform[inputType][outputType](input);
|
|
4670
4653
|
return result;
|
|
4671
4654
|
};
|
|
@@ -4678,7 +4661,7 @@ function requireUtils () {
|
|
|
4678
4661
|
* @param {string} path A path with / or \ separators
|
|
4679
4662
|
* @returns {string} The path with all relative path components resolved.
|
|
4680
4663
|
*/
|
|
4681
|
-
exports.resolve = function(path) {
|
|
4664
|
+
exports$1.resolve = function(path) {
|
|
4682
4665
|
var parts = path.split("/");
|
|
4683
4666
|
var result = [];
|
|
4684
4667
|
for (var index = 0; index < parts.length; index++) {
|
|
@@ -4701,7 +4684,7 @@ function requireUtils () {
|
|
|
4701
4684
|
* @param {Object} input the input to identify.
|
|
4702
4685
|
* @return {String} the (lowercase) type of the input.
|
|
4703
4686
|
*/
|
|
4704
|
-
exports.getTypeOf = function(input) {
|
|
4687
|
+
exports$1.getTypeOf = function(input) {
|
|
4705
4688
|
if (typeof input === "string") {
|
|
4706
4689
|
return "string";
|
|
4707
4690
|
}
|
|
@@ -4724,22 +4707,22 @@ function requireUtils () {
|
|
|
4724
4707
|
* @param {String} type the type to check.
|
|
4725
4708
|
* @throws {Error} an Error if the browser doesn't support the requested type.
|
|
4726
4709
|
*/
|
|
4727
|
-
exports.checkSupport = function(type) {
|
|
4710
|
+
exports$1.checkSupport = function(type) {
|
|
4728
4711
|
var supported = support[type.toLowerCase()];
|
|
4729
4712
|
if (!supported) {
|
|
4730
4713
|
throw new Error(type + " is not supported by this platform");
|
|
4731
4714
|
}
|
|
4732
4715
|
};
|
|
4733
4716
|
|
|
4734
|
-
exports.MAX_VALUE_16BITS = 65535;
|
|
4735
|
-
exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1
|
|
4717
|
+
exports$1.MAX_VALUE_16BITS = 65535;
|
|
4718
|
+
exports$1.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1
|
|
4736
4719
|
|
|
4737
4720
|
/**
|
|
4738
4721
|
* Prettify a string read as binary.
|
|
4739
4722
|
* @param {string} str the string to prettify.
|
|
4740
4723
|
* @return {string} a pretty string.
|
|
4741
4724
|
*/
|
|
4742
|
-
exports.pretty = function(str) {
|
|
4725
|
+
exports$1.pretty = function(str) {
|
|
4743
4726
|
var res = "",
|
|
4744
4727
|
code, i;
|
|
4745
4728
|
for (i = 0; i < (str || "").length; i++) {
|
|
@@ -4754,7 +4737,7 @@ function requireUtils () {
|
|
|
4754
4737
|
* @param {Function} callback the function to call asynchronously.
|
|
4755
4738
|
* @param {Array} args the arguments to give to the callback.
|
|
4756
4739
|
*/
|
|
4757
|
-
exports.delay = function(callback, args, self) {
|
|
4740
|
+
exports$1.delay = function(callback, args, self) {
|
|
4758
4741
|
setImmediate(function () {
|
|
4759
4742
|
callback.apply(self || null, args || []);
|
|
4760
4743
|
});
|
|
@@ -4766,7 +4749,7 @@ function requireUtils () {
|
|
|
4766
4749
|
* @param {Function} ctor the constructor to augment
|
|
4767
4750
|
* @param {Function} superCtor the parent constructor to use
|
|
4768
4751
|
*/
|
|
4769
|
-
exports.inherits = function (ctor, superCtor) {
|
|
4752
|
+
exports$1.inherits = function (ctor, superCtor) {
|
|
4770
4753
|
var Obj = function() {};
|
|
4771
4754
|
Obj.prototype = superCtor.prototype;
|
|
4772
4755
|
ctor.prototype = new Obj();
|
|
@@ -4778,7 +4761,7 @@ function requireUtils () {
|
|
|
4778
4761
|
* @param {...Object} var_args All objects to merge.
|
|
4779
4762
|
* @return {Object} a new object with the data of the others.
|
|
4780
4763
|
*/
|
|
4781
|
-
exports.extend = function() {
|
|
4764
|
+
exports$1.extend = function() {
|
|
4782
4765
|
var result = {}, i, attr;
|
|
4783
4766
|
for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers
|
|
4784
4767
|
for (attr in arguments[i]) {
|
|
@@ -4799,7 +4782,7 @@ function requireUtils () {
|
|
|
4799
4782
|
* @param {Boolean} isBase64 true if the string content is encoded with base64.
|
|
4800
4783
|
* @return {Promise} a promise in a format usable by JSZip.
|
|
4801
4784
|
*/
|
|
4802
|
-
exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) {
|
|
4785
|
+
exports$1.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) {
|
|
4803
4786
|
|
|
4804
4787
|
// if inputData is already a promise, this flatten it.
|
|
4805
4788
|
var promise = external.Promise.resolve(inputData).then(function(data) {
|
|
@@ -4825,7 +4808,7 @@ function requireUtils () {
|
|
|
4825
4808
|
});
|
|
4826
4809
|
|
|
4827
4810
|
return promise.then(function(data) {
|
|
4828
|
-
var dataType = exports.getTypeOf(data);
|
|
4811
|
+
var dataType = exports$1.getTypeOf(data);
|
|
4829
4812
|
|
|
4830
4813
|
if (!dataType) {
|
|
4831
4814
|
return external.Promise.reject(
|
|
@@ -4835,7 +4818,7 @@ function requireUtils () {
|
|
|
4835
4818
|
}
|
|
4836
4819
|
// special case : it's way easier to work with Uint8Array than with ArrayBuffer
|
|
4837
4820
|
if (dataType === "arraybuffer") {
|
|
4838
|
-
data = exports.transformTo("uint8array", data);
|
|
4821
|
+
data = exports$1.transformTo("uint8array", data);
|
|
4839
4822
|
} else if (dataType === "string") {
|
|
4840
4823
|
if (isBase64) {
|
|
4841
4824
|
data = base64.decode(data);
|
|
@@ -5118,7 +5101,7 @@ GenericWorker$b.prototype = {
|
|
|
5118
5101
|
|
|
5119
5102
|
var GenericWorker_1 = GenericWorker$b;
|
|
5120
5103
|
|
|
5121
|
-
(function (exports) {
|
|
5104
|
+
(function (exports$1) {
|
|
5122
5105
|
|
|
5123
5106
|
var utils = requireUtils();
|
|
5124
5107
|
var support = support$4;
|
|
@@ -5286,7 +5269,7 @@ var GenericWorker_1 = GenericWorker$b;
|
|
|
5286
5269
|
* @param {String} str the string to encode
|
|
5287
5270
|
* @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.
|
|
5288
5271
|
*/
|
|
5289
|
-
exports.utf8encode = function utf8encode(str) {
|
|
5272
|
+
exports$1.utf8encode = function utf8encode(str) {
|
|
5290
5273
|
if (support.nodebuffer) {
|
|
5291
5274
|
return nodejsUtils.newBufferFrom(str, "utf-8");
|
|
5292
5275
|
}
|
|
@@ -5301,7 +5284,7 @@ var GenericWorker_1 = GenericWorker$b;
|
|
|
5301
5284
|
* @param {Array|Uint8Array|Buffer} buf the data de decode
|
|
5302
5285
|
* @return {String} the decoded string.
|
|
5303
5286
|
*/
|
|
5304
|
-
exports.utf8decode = function utf8decode(buf) {
|
|
5287
|
+
exports$1.utf8decode = function utf8decode(buf) {
|
|
5305
5288
|
if (support.nodebuffer) {
|
|
5306
5289
|
return utils.transformTo("nodebuffer", buf).toString("utf-8");
|
|
5307
5290
|
}
|
|
@@ -5355,7 +5338,7 @@ var GenericWorker_1 = GenericWorker$b;
|
|
|
5355
5338
|
}
|
|
5356
5339
|
|
|
5357
5340
|
this.push({
|
|
5358
|
-
data : exports.utf8decode(usableData),
|
|
5341
|
+
data : exports$1.utf8decode(usableData),
|
|
5359
5342
|
meta : chunk.meta
|
|
5360
5343
|
});
|
|
5361
5344
|
};
|
|
@@ -5366,13 +5349,13 @@ var GenericWorker_1 = GenericWorker$b;
|
|
|
5366
5349
|
Utf8DecodeWorker.prototype.flush = function () {
|
|
5367
5350
|
if(this.leftOver && this.leftOver.length) {
|
|
5368
5351
|
this.push({
|
|
5369
|
-
data : exports.utf8decode(this.leftOver),
|
|
5352
|
+
data : exports$1.utf8decode(this.leftOver),
|
|
5370
5353
|
meta : {}
|
|
5371
5354
|
});
|
|
5372
5355
|
this.leftOver = null;
|
|
5373
5356
|
}
|
|
5374
5357
|
};
|
|
5375
|
-
exports.Utf8DecodeWorker = Utf8DecodeWorker;
|
|
5358
|
+
exports$1.Utf8DecodeWorker = Utf8DecodeWorker;
|
|
5376
5359
|
|
|
5377
5360
|
/**
|
|
5378
5361
|
* A worker to endcode string chunks into utf8 encoded binary chunks.
|
|
@@ -5388,11 +5371,11 @@ var GenericWorker_1 = GenericWorker$b;
|
|
|
5388
5371
|
*/
|
|
5389
5372
|
Utf8EncodeWorker.prototype.processChunk = function (chunk) {
|
|
5390
5373
|
this.push({
|
|
5391
|
-
data : exports.utf8encode(chunk.data),
|
|
5374
|
+
data : exports$1.utf8encode(chunk.data),
|
|
5392
5375
|
meta : chunk.meta
|
|
5393
5376
|
});
|
|
5394
5377
|
};
|
|
5395
|
-
exports.Utf8EncodeWorker = Utf8EncodeWorker;
|
|
5378
|
+
exports$1.Utf8EncodeWorker = Utf8EncodeWorker;
|
|
5396
5379
|
} (utf8$5));
|
|
5397
5380
|
|
|
5398
5381
|
var GenericWorker$a = GenericWorker_1;
|
|
@@ -6150,7 +6133,7 @@ var flate = {};
|
|
|
6150
6133
|
|
|
6151
6134
|
var common = {};
|
|
6152
6135
|
|
|
6153
|
-
(function (exports) {
|
|
6136
|
+
(function (exports$1) {
|
|
6154
6137
|
|
|
6155
6138
|
|
|
6156
6139
|
var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
|
|
@@ -6161,7 +6144,7 @@ var common = {};
|
|
|
6161
6144
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
6162
6145
|
}
|
|
6163
6146
|
|
|
6164
|
-
exports.assign = function (obj /*from1, from2, from3, ...*/) {
|
|
6147
|
+
exports$1.assign = function (obj /*from1, from2, from3, ...*/) {
|
|
6165
6148
|
var sources = Array.prototype.slice.call(arguments, 1);
|
|
6166
6149
|
while (sources.length) {
|
|
6167
6150
|
var source = sources.shift();
|
|
@@ -6183,7 +6166,7 @@ var common = {};
|
|
|
6183
6166
|
|
|
6184
6167
|
|
|
6185
6168
|
// reduce buffer size, avoiding mem copy
|
|
6186
|
-
exports.shrinkBuf = function (buf, size) {
|
|
6169
|
+
exports$1.shrinkBuf = function (buf, size) {
|
|
6187
6170
|
if (buf.length === size) { return buf; }
|
|
6188
6171
|
if (buf.subarray) { return buf.subarray(0, size); }
|
|
6189
6172
|
buf.length = size;
|
|
@@ -6240,21 +6223,21 @@ var common = {};
|
|
|
6240
6223
|
|
|
6241
6224
|
// Enable/Disable typed arrays use, for testing
|
|
6242
6225
|
//
|
|
6243
|
-
exports.setTyped = function (on) {
|
|
6226
|
+
exports$1.setTyped = function (on) {
|
|
6244
6227
|
if (on) {
|
|
6245
|
-
exports.Buf8 = Uint8Array;
|
|
6246
|
-
exports.Buf16 = Uint16Array;
|
|
6247
|
-
exports.Buf32 = Int32Array;
|
|
6248
|
-
exports.assign(exports, fnTyped);
|
|
6228
|
+
exports$1.Buf8 = Uint8Array;
|
|
6229
|
+
exports$1.Buf16 = Uint16Array;
|
|
6230
|
+
exports$1.Buf32 = Int32Array;
|
|
6231
|
+
exports$1.assign(exports$1, fnTyped);
|
|
6249
6232
|
} else {
|
|
6250
|
-
exports.Buf8 = Array;
|
|
6251
|
-
exports.Buf16 = Array;
|
|
6252
|
-
exports.Buf32 = Array;
|
|
6253
|
-
exports.assign(exports, fnUntyped);
|
|
6233
|
+
exports$1.Buf8 = Array;
|
|
6234
|
+
exports$1.Buf16 = Array;
|
|
6235
|
+
exports$1.Buf32 = Array;
|
|
6236
|
+
exports$1.assign(exports$1, fnUntyped);
|
|
6254
6237
|
}
|
|
6255
6238
|
};
|
|
6256
6239
|
|
|
6257
|
-
exports.setTyped(TYPED_OK);
|
|
6240
|
+
exports$1.setTyped(TYPED_OK);
|
|
6258
6241
|
} (common));
|
|
6259
6242
|
|
|
6260
6243
|
var deflate$4 = {};
|
|
@@ -15617,7 +15600,7 @@ const uiThemeSmallButton = (dom, buttonStyle) => {
|
|
|
15617
15600
|
|
|
15618
15601
|
var lottie$1 = {exports: {}};
|
|
15619
15602
|
|
|
15620
|
-
(function (module, exports) {
|
|
15603
|
+
(function (module, exports$1) {
|
|
15621
15604
|
(typeof document !== "undefined") && (typeof navigator !== "undefined") && (function (global, factory) {
|
|
15622
15605
|
module.exports = factory() ;
|
|
15623
15606
|
})(commonjsGlobal, (function () {
|
|
@@ -20044,7 +20027,7 @@ var lottie$1 = {exports: {}};
|
|
|
20044
20027
|
|
|
20045
20028
|
// this adds bodymovin to the window object for backwards compatibility
|
|
20046
20029
|
try {
|
|
20047
|
-
if (!(('object' === "undefined" ? "undefined" : _typeof$3(exports)) === 'object' && 'object' !== 'undefined') && !(typeof undefined === 'function' && undefined.amd) // eslint-disable-line no-undef
|
|
20030
|
+
if (!(('object' === "undefined" ? "undefined" : _typeof$3(exports$1)) === 'object' && 'object' !== 'undefined') && !(typeof undefined === 'function' && undefined.amd) // eslint-disable-line no-undef
|
|
20048
20031
|
) {
|
|
20049
20032
|
window.bodymovin = lottie;
|
|
20050
20033
|
}
|
|
@@ -34517,6 +34500,43 @@ window.ononline = () => {
|
|
|
34517
34500
|
});
|
|
34518
34501
|
};
|
|
34519
34502
|
|
|
34503
|
+
/**
|
|
34504
|
+
* 將 API 回傳的主題配置與預設值進行深層合併。
|
|
34505
|
+
* - 不會修改 themeConfigDefault
|
|
34506
|
+
* - 巢狀物件會逐一屬性合併(API 只需提供要覆寫的屬性)
|
|
34507
|
+
* - 自動過濾 null / undefined 值,避免覆蓋預設值
|
|
34508
|
+
*/
|
|
34509
|
+
function mergeThemeConfig(apiConfig) {
|
|
34510
|
+
const result = {};
|
|
34511
|
+
for (const key of Object.keys(themeConfigDefault)) {
|
|
34512
|
+
const defaultVal = themeConfigDefault[key];
|
|
34513
|
+
const apiVal = apiConfig == null ? void 0 : apiConfig[key];
|
|
34514
|
+
if (defaultVal != null && typeof defaultVal === 'object' && !Array.isArray(defaultVal)) {
|
|
34515
|
+
// 巢狀物件:逐一屬性合併,過濾 null/undefined
|
|
34516
|
+
const merged = Object.assign({}, defaultVal);
|
|
34517
|
+
if (apiVal != null && typeof apiVal === 'object') {
|
|
34518
|
+
for (const [k, v] of Object.entries(apiVal)) {
|
|
34519
|
+
if (v != null) {
|
|
34520
|
+
merged[k] = v;
|
|
34521
|
+
}
|
|
34522
|
+
}
|
|
34523
|
+
}
|
|
34524
|
+
result[key] = merged;
|
|
34525
|
+
} else {
|
|
34526
|
+
// 純值:API 有提供且非 null/undefined 才覆寫
|
|
34527
|
+
result[key] = apiVal != null ? apiVal : defaultVal;
|
|
34528
|
+
}
|
|
34529
|
+
}
|
|
34530
|
+
// 保留 API 回傳但預設值沒有的新屬性
|
|
34531
|
+
if (apiConfig != null && typeof apiConfig === 'object') {
|
|
34532
|
+
for (const key of Object.keys(apiConfig)) {
|
|
34533
|
+
if (!(key in result) && apiConfig[key] != null) {
|
|
34534
|
+
result[key] = apiConfig[key];
|
|
34535
|
+
}
|
|
34536
|
+
}
|
|
34537
|
+
}
|
|
34538
|
+
return result;
|
|
34539
|
+
}
|
|
34520
34540
|
const themeConfigDefault = {
|
|
34521
34541
|
isFraudAnimationLoadingPageEnabled: true,
|
|
34522
34542
|
isStatementEnabled: true,
|
|
@@ -34878,7 +34898,7 @@ const themeConfigDefault = {
|
|
|
34878
34898
|
};
|
|
34879
34899
|
|
|
34880
34900
|
var name = "authme/sdk";
|
|
34881
|
-
var version$1 = "2.8.
|
|
34901
|
+
var version$1 = "2.8.46";
|
|
34882
34902
|
var packageInfo = {
|
|
34883
34903
|
name: name,
|
|
34884
34904
|
version: version$1};
|
|
@@ -34888,4 +34908,4 @@ const version = packageInfo.version;
|
|
|
34888
34908
|
(_window$_Symbol$for = (_window = window)[_Symbol$for = Symbol.for('authme-sdk')]) != null ? _window$_Symbol$for : _window[_Symbol$for] = {};
|
|
34889
34909
|
window[Symbol.for('authme-sdk')][packageInfo.name] = version;
|
|
34890
34910
|
|
|
34891
|
-
export { AuthmeError, DEVICE_TYPE, ErrorCode, Icon, RGBToLottieColor, RUN_FUNCTION_NAME, STORAGE_KEY, Storage, TIME_UNIT, UintArrayToBlob, asyncOnLineShowErrorMessage, asyncShowErrorMessage, asyncShowPopup, backgroundRequest, checkOnlineStatus, clearCanvas, colorStringToRGB, colorToRGB, combineResult, cropByRatio, dataURItoBlob, debugLog, debugTools, decodeToken, dropMenu, fontWeight, getCanvasSize, getCssVariable, getDeviceInfo, getImageData, getSystemInfo, hexToRGB, hideElement, hideErrorMessage, hidePopup, isIphone14proOrProMax, isMobile, isMobileOrTablet$1 as isMobileOrTablet, osVersion, requestCamera, resize, retryPromiseWithCondition, showElement, showErrorMessage, showErrorMessageEventName, showPopup, splitResult, startLoadingSDK, startSpinner, stopLoadingSDK, stopSpinner, switchCamera, themeConfigDefault, uiThemeButton, uiThemeDirection, uiThemeHint, uiThemeSmallButton, uiThemeText, uploadModal, useState, verificationErrorMessages, version, videoConstraintsFactory, waitTime };
|
|
34911
|
+
export { AuthmeError, DEVICE_TYPE, ErrorCode, Icon, RGBToLottieColor, RUN_FUNCTION_NAME, STORAGE_KEY, Storage, TIME_UNIT, UintArrayToBlob, asyncOnLineShowErrorMessage, asyncShowErrorMessage, asyncShowPopup, backgroundRequest, checkOnlineStatus, clearCanvas, colorStringToRGB, colorToRGB, combineResult, cropByRatio, dataURItoBlob, debugLog, debugTools, decodeToken, dropMenu, fontWeight, getCanvasSize, getCssVariable, getDeviceInfo, getImageData, getSystemInfo, hexToRGB, hideElement, hideErrorMessage, hidePopup, isIphone14proOrProMax, isMobile, isMobileOrTablet$1 as isMobileOrTablet, mergeThemeConfig, osVersion, requestCamera, resize, retryPromiseWithCondition, showElement, showErrorMessage, showErrorMessageEventName, showPopup, splitResult, startLoadingSDK, startSpinner, stopLoadingSDK, stopSpinner, switchCamera, themeConfigDefault, uiThemeButton, uiThemeDirection, uiThemeHint, uiThemeSmallButton, uiThemeText, uploadModal, useState, verificationErrorMessages, version, videoConstraintsFactory, waitTime };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authme/util",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.46",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"core-js": "^3.6.0"
|
|
6
6
|
},
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
},
|
|
10
10
|
"module": "./index.esm.js",
|
|
11
11
|
"main": "./index.cjs.js",
|
|
12
|
-
"types": "./index.
|
|
12
|
+
"types": "./index.d.ts"
|
|
13
13
|
}
|