@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 CHANGED
@@ -25,8 +25,10 @@ require('core-js/modules/es.typed-array.to-locale-string.js');
25
25
  require('core-js/modules/es.typed-array.to-reversed.js');
26
26
  require('core-js/modules/es.typed-array.to-sorted.js');
27
27
  require('core-js/modules/es.typed-array.with.js');
28
- require('core-js/modules/esnext.uint8-array.to-base64.js');
29
- require('core-js/modules/esnext.uint8-array.to-hex.js');
28
+ require('core-js/modules/es.uint8-array.set-from-base64.js');
29
+ require('core-js/modules/es.uint8-array.set-from-hex.js');
30
+ require('core-js/modules/es.uint8-array.to-base64.js');
31
+ require('core-js/modules/es.uint8-array.to-hex.js');
30
32
  require('core-js/modules/web.atob.js');
31
33
  require('core-js/modules/web.dom-collections.iterator.js');
32
34
  require('core-js/modules/web.dom-exception.constructor.js');
@@ -35,12 +37,12 @@ require('core-js/modules/web.dom-exception.to-string-tag.js');
35
37
  require('core-js/modules/es.array.push.js');
36
38
  require('core-js/modules/es.error.cause.js');
37
39
  require('core-js/modules/es.array.includes.js');
40
+ require('core-js/modules/es.iterator.constructor.js');
41
+ require('core-js/modules/es.iterator.for-each.js');
42
+ require('core-js/modules/es.json.parse.js');
38
43
  require('core-js/modules/es.json.stringify.js');
39
44
  require('core-js/modules/es.string.search.js');
40
45
  require('core-js/modules/es.typed-array.uint32-array.js');
41
- require('core-js/modules/esnext.iterator.constructor.js');
42
- require('core-js/modules/esnext.iterator.for-each.js');
43
- require('core-js/modules/esnext.json.parse.js');
44
46
  require('core-js/modules/web.url-search-params.js');
45
47
  require('core-js/modules/web.url-search-params.delete.js');
46
48
  require('core-js/modules/web.url-search-params.has.js');
@@ -49,13 +51,13 @@ var require$$0 = require('stream');
49
51
  var require$$2 = require('events');
50
52
  var require$$0$1 = require('buffer');
51
53
  var require$$1 = require('util');
54
+ require('core-js/modules/es.iterator.map.js');
52
55
  require('core-js/modules/es.parse-int.js');
53
- require('core-js/modules/esnext.iterator.map.js');
54
56
  require('core-js/modules/es.array.sort.js');
55
57
  require('core-js/modules/es.global-this.js');
58
+ require('core-js/modules/es.iterator.filter.js');
56
59
  require('core-js/modules/es.number.to-fixed.js');
57
60
  require('core-js/modules/es.string.includes.js');
58
- require('core-js/modules/esnext.iterator.filter.js');
59
61
  require('core-js/modules/es.string.starts-with.js');
60
62
  require('core-js/modules/es.string.trim.js');
61
63
 
@@ -327,10 +329,66 @@ const verificationErrorMessages = code => {
327
329
  }
328
330
  };
329
331
 
330
- function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n("Invalid token specified");var o=true===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(".")[o]))}catch(e){throw new n("Invalid token specified: "+e.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";
332
+ class InvalidTokenError extends Error {
333
+ }
334
+ InvalidTokenError.prototype.name = "InvalidTokenError";
335
+ function b64DecodeUnicode(str) {
336
+ return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
337
+ let code = p.charCodeAt(0).toString(16).toUpperCase();
338
+ if (code.length < 2) {
339
+ code = "0" + code;
340
+ }
341
+ return "%" + code;
342
+ }));
343
+ }
344
+ function base64UrlDecode(str) {
345
+ let output = str.replace(/-/g, "+").replace(/_/g, "/");
346
+ switch (output.length % 4) {
347
+ case 0:
348
+ break;
349
+ case 2:
350
+ output += "==";
351
+ break;
352
+ case 3:
353
+ output += "=";
354
+ break;
355
+ default:
356
+ throw new Error("base64 string is not of the correct length");
357
+ }
358
+ try {
359
+ return b64DecodeUnicode(output);
360
+ }
361
+ catch (err) {
362
+ return atob(output);
363
+ }
364
+ }
365
+ function jwtDecode(token, options) {
366
+ if (typeof token !== "string") {
367
+ throw new InvalidTokenError("Invalid token specified: must be a string");
368
+ }
369
+ options || (options = {});
370
+ const pos = options.header === true ? 0 : 1;
371
+ const part = token.split(".")[pos];
372
+ if (typeof part !== "string") {
373
+ throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
374
+ }
375
+ let decoded;
376
+ try {
377
+ decoded = base64UrlDecode(part);
378
+ }
379
+ catch (e) {
380
+ throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
381
+ }
382
+ try {
383
+ return JSON.parse(decoded);
384
+ }
385
+ catch (e) {
386
+ throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
387
+ }
388
+ }
331
389
 
332
390
  function decodeToken(token) {
333
- const decoded = o(token);
391
+ const decoded = jwtDecode(token);
334
392
  const {
335
393
  exp,
336
394
  iat
@@ -656,7 +714,7 @@ function getDefaultExportFromCjs (x) {
656
714
 
657
715
  var FileSaver_min = {exports: {}};
658
716
 
659
- (function (module, exports) {
717
+ (function (module, exports$1) {
660
718
  (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);});
661
719
 
662
720
 
@@ -749,16 +807,16 @@ function requireStream () {
749
807
  return stream$1;
750
808
  }
751
809
 
752
- var safeBuffer$1 = {exports: {}};
810
+ var safeBuffer = {exports: {}};
753
811
 
754
812
  /* eslint-disable node/no-deprecated-api */
755
813
 
756
- var hasRequiredSafeBuffer$1;
814
+ var hasRequiredSafeBuffer;
757
815
 
758
- function requireSafeBuffer$1 () {
759
- if (hasRequiredSafeBuffer$1) return safeBuffer$1.exports;
760
- hasRequiredSafeBuffer$1 = 1;
761
- (function (module, exports) {
816
+ function requireSafeBuffer () {
817
+ if (hasRequiredSafeBuffer) return safeBuffer.exports;
818
+ hasRequiredSafeBuffer = 1;
819
+ (function (module, exports$1) {
762
820
  var buffer = require$$0$1;
763
821
  var Buffer = buffer.Buffer;
764
822
 
@@ -772,8 +830,8 @@ function requireSafeBuffer$1 () {
772
830
  module.exports = buffer;
773
831
  } else {
774
832
  // Copy properties from require('buffer')
775
- copyProps(buffer, exports);
776
- exports.Buffer = SafeBuffer;
833
+ copyProps(buffer, exports$1);
834
+ exports$1.Buffer = SafeBuffer;
777
835
  }
778
836
 
779
837
  function SafeBuffer (arg, encodingOrOffset, length) {
@@ -820,8 +878,8 @@ function requireSafeBuffer$1 () {
820
878
  }
821
879
  return buffer.SlowBuffer(size)
822
880
  };
823
- } (safeBuffer$1, safeBuffer$1.exports));
824
- return safeBuffer$1.exports;
881
+ } (safeBuffer, safeBuffer.exports));
882
+ return safeBuffer.exports;
825
883
  }
826
884
 
827
885
  var util = {};
@@ -1008,7 +1066,7 @@ function requireBufferList () {
1008
1066
 
1009
1067
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1010
1068
 
1011
- var Buffer = requireSafeBuffer$1().Buffer;
1069
+ var Buffer = requireSafeBuffer().Buffer;
1012
1070
  var util = require$$1;
1013
1071
 
1014
1072
  function copyBuffer(src, target, offset) {
@@ -1246,7 +1304,7 @@ function require_stream_writable () {
1246
1304
 
1247
1305
  /*<replacement>*/
1248
1306
 
1249
- var Buffer = requireSafeBuffer$1().Buffer;
1307
+ var Buffer = requireSafeBuffer().Buffer;
1250
1308
  var OurUint8Array = (typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
1251
1309
  function _uint8ArrayToBuffer(chunk) {
1252
1310
  return Buffer.from(chunk);
@@ -1967,81 +2025,6 @@ function require_stream_duplex () {
1967
2025
 
1968
2026
  var string_decoder = {};
1969
2027
 
1970
- var safeBuffer = {exports: {}};
1971
-
1972
- /* eslint-disable node/no-deprecated-api */
1973
-
1974
- var hasRequiredSafeBuffer;
1975
-
1976
- function requireSafeBuffer () {
1977
- if (hasRequiredSafeBuffer) return safeBuffer.exports;
1978
- hasRequiredSafeBuffer = 1;
1979
- (function (module, exports) {
1980
- var buffer = require$$0$1;
1981
- var Buffer = buffer.Buffer;
1982
-
1983
- // alternative to using Object.keys for old browsers
1984
- function copyProps (src, dst) {
1985
- for (var key in src) {
1986
- dst[key] = src[key];
1987
- }
1988
- }
1989
- if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
1990
- module.exports = buffer;
1991
- } else {
1992
- // Copy properties from require('buffer')
1993
- copyProps(buffer, exports);
1994
- exports.Buffer = SafeBuffer;
1995
- }
1996
-
1997
- function SafeBuffer (arg, encodingOrOffset, length) {
1998
- return Buffer(arg, encodingOrOffset, length)
1999
- }
2000
-
2001
- // Copy static methods from Buffer
2002
- copyProps(Buffer, SafeBuffer);
2003
-
2004
- SafeBuffer.from = function (arg, encodingOrOffset, length) {
2005
- if (typeof arg === 'number') {
2006
- throw new TypeError('Argument must not be a number')
2007
- }
2008
- return Buffer(arg, encodingOrOffset, length)
2009
- };
2010
-
2011
- SafeBuffer.alloc = function (size, fill, encoding) {
2012
- if (typeof size !== 'number') {
2013
- throw new TypeError('Argument must be a number')
2014
- }
2015
- var buf = Buffer(size);
2016
- if (fill !== undefined) {
2017
- if (typeof encoding === 'string') {
2018
- buf.fill(fill, encoding);
2019
- } else {
2020
- buf.fill(fill);
2021
- }
2022
- } else {
2023
- buf.fill(0);
2024
- }
2025
- return buf
2026
- };
2027
-
2028
- SafeBuffer.allocUnsafe = function (size) {
2029
- if (typeof size !== 'number') {
2030
- throw new TypeError('Argument must be a number')
2031
- }
2032
- return Buffer(size)
2033
- };
2034
-
2035
- SafeBuffer.allocUnsafeSlow = function (size) {
2036
- if (typeof size !== 'number') {
2037
- throw new TypeError('Argument must be a number')
2038
- }
2039
- return buffer.SlowBuffer(size)
2040
- };
2041
- } (safeBuffer, safeBuffer.exports));
2042
- return safeBuffer.exports;
2043
- }
2044
-
2045
2028
  var hasRequiredString_decoder;
2046
2029
 
2047
2030
  function requireString_decoder () {
@@ -2361,7 +2344,7 @@ function require_stream_readable () {
2361
2344
 
2362
2345
  /*<replacement>*/
2363
2346
 
2364
- var Buffer = requireSafeBuffer$1().Buffer;
2347
+ var Buffer = requireSafeBuffer().Buffer;
2365
2348
  var OurUint8Array = (typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
2366
2349
  function _uint8ArrayToBuffer(chunk) {
2367
2350
  return Buffer.from(chunk);
@@ -3523,25 +3506,25 @@ var hasRequiredReadable;
3523
3506
  function requireReadable () {
3524
3507
  if (hasRequiredReadable) return readable.exports;
3525
3508
  hasRequiredReadable = 1;
3526
- (function (module, exports) {
3509
+ (function (module, exports$1) {
3527
3510
  var Stream = require$$0;
3528
3511
  if (process.env.READABLE_STREAM === 'disable' && Stream) {
3529
3512
  module.exports = Stream;
3530
- exports = module.exports = Stream.Readable;
3531
- exports.Readable = Stream.Readable;
3532
- exports.Writable = Stream.Writable;
3533
- exports.Duplex = Stream.Duplex;
3534
- exports.Transform = Stream.Transform;
3535
- exports.PassThrough = Stream.PassThrough;
3536
- exports.Stream = Stream;
3513
+ exports$1 = module.exports = Stream.Readable;
3514
+ exports$1.Readable = Stream.Readable;
3515
+ exports$1.Writable = Stream.Writable;
3516
+ exports$1.Duplex = Stream.Duplex;
3517
+ exports$1.Transform = Stream.Transform;
3518
+ exports$1.PassThrough = Stream.PassThrough;
3519
+ exports$1.Stream = Stream;
3537
3520
  } else {
3538
- exports = module.exports = require_stream_readable();
3539
- exports.Stream = Stream || exports;
3540
- exports.Readable = exports;
3541
- exports.Writable = require_stream_writable();
3542
- exports.Duplex = require_stream_duplex();
3543
- exports.Transform = require_stream_transform();
3544
- exports.PassThrough = require_stream_passthrough();
3521
+ exports$1 = module.exports = require_stream_readable();
3522
+ exports$1.Stream = Stream || exports$1;
3523
+ exports$1.Readable = exports$1;
3524
+ exports$1.Writable = require_stream_writable();
3525
+ exports$1.Duplex = require_stream_duplex();
3526
+ exports$1.Transform = require_stream_transform();
3527
+ exports$1.PassThrough = require_stream_passthrough();
3545
3528
  }
3546
3529
  } (readable, readable.exports));
3547
3530
  return readable.exports;
@@ -4353,7 +4336,7 @@ var hasRequiredUtils;
4353
4336
  function requireUtils () {
4354
4337
  if (hasRequiredUtils) return utils$q;
4355
4338
  hasRequiredUtils = 1;
4356
- (function (exports) {
4339
+ (function (exports$1) {
4357
4340
 
4358
4341
  var support = support$4;
4359
4342
  var base64 = requireBase64();
@@ -4392,8 +4375,8 @@ function requireUtils () {
4392
4375
  * @param {String} type the mime type of the blob.
4393
4376
  * @return {Blob} the created blob.
4394
4377
  */
4395
- exports.newBlob = function(part, type) {
4396
- exports.checkSupport("blob");
4378
+ exports$1.newBlob = function(part, type) {
4379
+ exports$1.checkSupport("blob");
4397
4380
 
4398
4381
  try {
4399
4382
  // Blob constructor
@@ -4528,7 +4511,7 @@ function requireUtils () {
4528
4511
  // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2
4529
4512
  // TODO : we now have workers that split the work. Do we still need that ?
4530
4513
  var chunk = 65536,
4531
- type = exports.getTypeOf(array),
4514
+ type = exports$1.getTypeOf(array),
4532
4515
  canUseApply = true;
4533
4516
  if (type === "uint8array") {
4534
4517
  canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array;
@@ -4551,7 +4534,7 @@ function requireUtils () {
4551
4534
  return arrayToStringHelper.stringifyByChar(array);
4552
4535
  }
4553
4536
 
4554
- exports.applyFromCharCode = arrayLikeToString;
4537
+ exports$1.applyFromCharCode = arrayLikeToString;
4555
4538
 
4556
4539
 
4557
4540
  /**
@@ -4657,7 +4640,7 @@ function requireUtils () {
4657
4640
  * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert.
4658
4641
  * @throws {Error} an Error if the browser doesn't support the requested output type.
4659
4642
  */
4660
- exports.transformTo = function(outputType, input) {
4643
+ exports$1.transformTo = function(outputType, input) {
4661
4644
  if (!input) {
4662
4645
  // undefined, null, etc
4663
4646
  // an empty string won't harm.
@@ -4666,8 +4649,8 @@ function requireUtils () {
4666
4649
  if (!outputType) {
4667
4650
  return input;
4668
4651
  }
4669
- exports.checkSupport(outputType);
4670
- var inputType = exports.getTypeOf(input);
4652
+ exports$1.checkSupport(outputType);
4653
+ var inputType = exports$1.getTypeOf(input);
4671
4654
  var result = transform[inputType][outputType](input);
4672
4655
  return result;
4673
4656
  };
@@ -4680,7 +4663,7 @@ function requireUtils () {
4680
4663
  * @param {string} path A path with / or \ separators
4681
4664
  * @returns {string} The path with all relative path components resolved.
4682
4665
  */
4683
- exports.resolve = function(path) {
4666
+ exports$1.resolve = function(path) {
4684
4667
  var parts = path.split("/");
4685
4668
  var result = [];
4686
4669
  for (var index = 0; index < parts.length; index++) {
@@ -4703,7 +4686,7 @@ function requireUtils () {
4703
4686
  * @param {Object} input the input to identify.
4704
4687
  * @return {String} the (lowercase) type of the input.
4705
4688
  */
4706
- exports.getTypeOf = function(input) {
4689
+ exports$1.getTypeOf = function(input) {
4707
4690
  if (typeof input === "string") {
4708
4691
  return "string";
4709
4692
  }
@@ -4726,22 +4709,22 @@ function requireUtils () {
4726
4709
  * @param {String} type the type to check.
4727
4710
  * @throws {Error} an Error if the browser doesn't support the requested type.
4728
4711
  */
4729
- exports.checkSupport = function(type) {
4712
+ exports$1.checkSupport = function(type) {
4730
4713
  var supported = support[type.toLowerCase()];
4731
4714
  if (!supported) {
4732
4715
  throw new Error(type + " is not supported by this platform");
4733
4716
  }
4734
4717
  };
4735
4718
 
4736
- exports.MAX_VALUE_16BITS = 65535;
4737
- exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1
4719
+ exports$1.MAX_VALUE_16BITS = 65535;
4720
+ exports$1.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1
4738
4721
 
4739
4722
  /**
4740
4723
  * Prettify a string read as binary.
4741
4724
  * @param {string} str the string to prettify.
4742
4725
  * @return {string} a pretty string.
4743
4726
  */
4744
- exports.pretty = function(str) {
4727
+ exports$1.pretty = function(str) {
4745
4728
  var res = "",
4746
4729
  code, i;
4747
4730
  for (i = 0; i < (str || "").length; i++) {
@@ -4756,7 +4739,7 @@ function requireUtils () {
4756
4739
  * @param {Function} callback the function to call asynchronously.
4757
4740
  * @param {Array} args the arguments to give to the callback.
4758
4741
  */
4759
- exports.delay = function(callback, args, self) {
4742
+ exports$1.delay = function(callback, args, self) {
4760
4743
  setImmediate(function () {
4761
4744
  callback.apply(self || null, args || []);
4762
4745
  });
@@ -4768,7 +4751,7 @@ function requireUtils () {
4768
4751
  * @param {Function} ctor the constructor to augment
4769
4752
  * @param {Function} superCtor the parent constructor to use
4770
4753
  */
4771
- exports.inherits = function (ctor, superCtor) {
4754
+ exports$1.inherits = function (ctor, superCtor) {
4772
4755
  var Obj = function() {};
4773
4756
  Obj.prototype = superCtor.prototype;
4774
4757
  ctor.prototype = new Obj();
@@ -4780,7 +4763,7 @@ function requireUtils () {
4780
4763
  * @param {...Object} var_args All objects to merge.
4781
4764
  * @return {Object} a new object with the data of the others.
4782
4765
  */
4783
- exports.extend = function() {
4766
+ exports$1.extend = function() {
4784
4767
  var result = {}, i, attr;
4785
4768
  for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers
4786
4769
  for (attr in arguments[i]) {
@@ -4801,7 +4784,7 @@ function requireUtils () {
4801
4784
  * @param {Boolean} isBase64 true if the string content is encoded with base64.
4802
4785
  * @return {Promise} a promise in a format usable by JSZip.
4803
4786
  */
4804
- exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) {
4787
+ exports$1.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) {
4805
4788
 
4806
4789
  // if inputData is already a promise, this flatten it.
4807
4790
  var promise = external.Promise.resolve(inputData).then(function(data) {
@@ -4827,7 +4810,7 @@ function requireUtils () {
4827
4810
  });
4828
4811
 
4829
4812
  return promise.then(function(data) {
4830
- var dataType = exports.getTypeOf(data);
4813
+ var dataType = exports$1.getTypeOf(data);
4831
4814
 
4832
4815
  if (!dataType) {
4833
4816
  return external.Promise.reject(
@@ -4837,7 +4820,7 @@ function requireUtils () {
4837
4820
  }
4838
4821
  // special case : it's way easier to work with Uint8Array than with ArrayBuffer
4839
4822
  if (dataType === "arraybuffer") {
4840
- data = exports.transformTo("uint8array", data);
4823
+ data = exports$1.transformTo("uint8array", data);
4841
4824
  } else if (dataType === "string") {
4842
4825
  if (isBase64) {
4843
4826
  data = base64.decode(data);
@@ -5120,7 +5103,7 @@ GenericWorker$b.prototype = {
5120
5103
 
5121
5104
  var GenericWorker_1 = GenericWorker$b;
5122
5105
 
5123
- (function (exports) {
5106
+ (function (exports$1) {
5124
5107
 
5125
5108
  var utils = requireUtils();
5126
5109
  var support = support$4;
@@ -5288,7 +5271,7 @@ var GenericWorker_1 = GenericWorker$b;
5288
5271
  * @param {String} str the string to encode
5289
5272
  * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.
5290
5273
  */
5291
- exports.utf8encode = function utf8encode(str) {
5274
+ exports$1.utf8encode = function utf8encode(str) {
5292
5275
  if (support.nodebuffer) {
5293
5276
  return nodejsUtils.newBufferFrom(str, "utf-8");
5294
5277
  }
@@ -5303,7 +5286,7 @@ var GenericWorker_1 = GenericWorker$b;
5303
5286
  * @param {Array|Uint8Array|Buffer} buf the data de decode
5304
5287
  * @return {String} the decoded string.
5305
5288
  */
5306
- exports.utf8decode = function utf8decode(buf) {
5289
+ exports$1.utf8decode = function utf8decode(buf) {
5307
5290
  if (support.nodebuffer) {
5308
5291
  return utils.transformTo("nodebuffer", buf).toString("utf-8");
5309
5292
  }
@@ -5357,7 +5340,7 @@ var GenericWorker_1 = GenericWorker$b;
5357
5340
  }
5358
5341
 
5359
5342
  this.push({
5360
- data : exports.utf8decode(usableData),
5343
+ data : exports$1.utf8decode(usableData),
5361
5344
  meta : chunk.meta
5362
5345
  });
5363
5346
  };
@@ -5368,13 +5351,13 @@ var GenericWorker_1 = GenericWorker$b;
5368
5351
  Utf8DecodeWorker.prototype.flush = function () {
5369
5352
  if(this.leftOver && this.leftOver.length) {
5370
5353
  this.push({
5371
- data : exports.utf8decode(this.leftOver),
5354
+ data : exports$1.utf8decode(this.leftOver),
5372
5355
  meta : {}
5373
5356
  });
5374
5357
  this.leftOver = null;
5375
5358
  }
5376
5359
  };
5377
- exports.Utf8DecodeWorker = Utf8DecodeWorker;
5360
+ exports$1.Utf8DecodeWorker = Utf8DecodeWorker;
5378
5361
 
5379
5362
  /**
5380
5363
  * A worker to endcode string chunks into utf8 encoded binary chunks.
@@ -5390,11 +5373,11 @@ var GenericWorker_1 = GenericWorker$b;
5390
5373
  */
5391
5374
  Utf8EncodeWorker.prototype.processChunk = function (chunk) {
5392
5375
  this.push({
5393
- data : exports.utf8encode(chunk.data),
5376
+ data : exports$1.utf8encode(chunk.data),
5394
5377
  meta : chunk.meta
5395
5378
  });
5396
5379
  };
5397
- exports.Utf8EncodeWorker = Utf8EncodeWorker;
5380
+ exports$1.Utf8EncodeWorker = Utf8EncodeWorker;
5398
5381
  } (utf8$5));
5399
5382
 
5400
5383
  var GenericWorker$a = GenericWorker_1;
@@ -6152,7 +6135,7 @@ var flate = {};
6152
6135
 
6153
6136
  var common = {};
6154
6137
 
6155
- (function (exports) {
6138
+ (function (exports$1) {
6156
6139
 
6157
6140
 
6158
6141
  var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
@@ -6163,7 +6146,7 @@ var common = {};
6163
6146
  return Object.prototype.hasOwnProperty.call(obj, key);
6164
6147
  }
6165
6148
 
6166
- exports.assign = function (obj /*from1, from2, from3, ...*/) {
6149
+ exports$1.assign = function (obj /*from1, from2, from3, ...*/) {
6167
6150
  var sources = Array.prototype.slice.call(arguments, 1);
6168
6151
  while (sources.length) {
6169
6152
  var source = sources.shift();
@@ -6185,7 +6168,7 @@ var common = {};
6185
6168
 
6186
6169
 
6187
6170
  // reduce buffer size, avoiding mem copy
6188
- exports.shrinkBuf = function (buf, size) {
6171
+ exports$1.shrinkBuf = function (buf, size) {
6189
6172
  if (buf.length === size) { return buf; }
6190
6173
  if (buf.subarray) { return buf.subarray(0, size); }
6191
6174
  buf.length = size;
@@ -6242,21 +6225,21 @@ var common = {};
6242
6225
 
6243
6226
  // Enable/Disable typed arrays use, for testing
6244
6227
  //
6245
- exports.setTyped = function (on) {
6228
+ exports$1.setTyped = function (on) {
6246
6229
  if (on) {
6247
- exports.Buf8 = Uint8Array;
6248
- exports.Buf16 = Uint16Array;
6249
- exports.Buf32 = Int32Array;
6250
- exports.assign(exports, fnTyped);
6230
+ exports$1.Buf8 = Uint8Array;
6231
+ exports$1.Buf16 = Uint16Array;
6232
+ exports$1.Buf32 = Int32Array;
6233
+ exports$1.assign(exports$1, fnTyped);
6251
6234
  } else {
6252
- exports.Buf8 = Array;
6253
- exports.Buf16 = Array;
6254
- exports.Buf32 = Array;
6255
- exports.assign(exports, fnUntyped);
6235
+ exports$1.Buf8 = Array;
6236
+ exports$1.Buf16 = Array;
6237
+ exports$1.Buf32 = Array;
6238
+ exports$1.assign(exports$1, fnUntyped);
6256
6239
  }
6257
6240
  };
6258
6241
 
6259
- exports.setTyped(TYPED_OK);
6242
+ exports$1.setTyped(TYPED_OK);
6260
6243
  } (common));
6261
6244
 
6262
6245
  var deflate$4 = {};
@@ -14984,10 +14967,10 @@ var load = function (data, options) {
14984
14967
  * Representation a of zip file in js
14985
14968
  * @constructor
14986
14969
  */
14987
- function JSZip() {
14970
+ function JSZip$1() {
14988
14971
  // if this constructor is used without `new`, it adds `new` before itself:
14989
- if(!(this instanceof JSZip)) {
14990
- return new JSZip();
14972
+ if(!(this instanceof JSZip$1)) {
14973
+ return new JSZip$1();
14991
14974
  }
14992
14975
 
14993
14976
  if(arguments.length) {
@@ -15009,7 +14992,7 @@ function JSZip() {
15009
14992
  // Where we are in the hierarchy
15010
14993
  this.root = "";
15011
14994
  this.clone = function() {
15012
- var newObj = new JSZip();
14995
+ var newObj = new JSZip$1();
15013
14996
  for (var i in this) {
15014
14997
  if (typeof this[i] !== "function") {
15015
14998
  newObj[i] = this[i];
@@ -15018,23 +15001,23 @@ function JSZip() {
15018
15001
  return newObj;
15019
15002
  };
15020
15003
  }
15021
- JSZip.prototype = object;
15022
- JSZip.prototype.loadAsync = load;
15023
- JSZip.support = support$4;
15024
- JSZip.defaults = defaults$1;
15004
+ JSZip$1.prototype = object;
15005
+ JSZip$1.prototype.loadAsync = load;
15006
+ JSZip$1.support = support$4;
15007
+ JSZip$1.defaults = defaults$1;
15025
15008
 
15026
15009
  // TODO find a better way to handle this version,
15027
15010
  // a require('package.json').version doesn't work with webpack, see #327
15028
- JSZip.version = "3.10.1";
15011
+ JSZip$1.version = "3.10.1";
15029
15012
 
15030
- JSZip.loadAsync = function (content, options) {
15031
- return new JSZip().loadAsync(content, options);
15013
+ JSZip$1.loadAsync = function (content, options) {
15014
+ return new JSZip$1().loadAsync(content, options);
15032
15015
  };
15033
15016
 
15034
- JSZip.external = external$3;
15035
- var lib = JSZip;
15017
+ JSZip$1.external = external$3;
15018
+ var lib = JSZip$1;
15036
15019
 
15037
- var JSZip$1 = /*@__PURE__*/getDefaultExportFromCjs(lib);
15020
+ var JSZip = /*@__PURE__*/getDefaultExportFromCjs(lib);
15038
15021
 
15039
15022
  function fileSaverService() {
15040
15023
  const filesQueue = [];
@@ -15045,7 +15028,7 @@ function fileSaverService() {
15045
15028
  filesQueue.splice(0, filesQueue.length);
15046
15029
  }
15047
15030
  async function saveFiles(fileName, json) {
15048
- const zip = new JSZip$1();
15031
+ const zip = new JSZip();
15049
15032
  filesQueue.forEach(fileItem => {
15050
15033
  zip.file(fileItem.name, fileItem.file);
15051
15034
  });
@@ -15619,7 +15602,7 @@ const uiThemeSmallButton = (dom, buttonStyle) => {
15619
15602
 
15620
15603
  var lottie$1 = {exports: {}};
15621
15604
 
15622
- (function (module, exports) {
15605
+ (function (module, exports$1) {
15623
15606
  (typeof document !== "undefined") && (typeof navigator !== "undefined") && (function (global, factory) {
15624
15607
  module.exports = factory() ;
15625
15608
  })(commonjsGlobal, (function () {
@@ -20046,7 +20029,7 @@ var lottie$1 = {exports: {}};
20046
20029
 
20047
20030
  // this adds bodymovin to the window object for backwards compatibility
20048
20031
  try {
20049
- if (!(('object' === "undefined" ? "undefined" : _typeof$3(exports)) === 'object' && 'object' !== 'undefined') && !(typeof undefined === 'function' && undefined.amd) // eslint-disable-line no-undef
20032
+ if (!(('object' === "undefined" ? "undefined" : _typeof$3(exports$1)) === 'object' && 'object' !== 'undefined') && !(typeof undefined === 'function' && undefined.amd) // eslint-disable-line no-undef
20050
20033
  ) {
20051
20034
  window.bodymovin = lottie;
20052
20035
  }
@@ -34519,6 +34502,43 @@ window.ononline = () => {
34519
34502
  });
34520
34503
  };
34521
34504
 
34505
+ /**
34506
+ * 將 API 回傳的主題配置與預設值進行深層合併。
34507
+ * - 不會修改 themeConfigDefault
34508
+ * - 巢狀物件會逐一屬性合併(API 只需提供要覆寫的屬性)
34509
+ * - 自動過濾 null / undefined 值,避免覆蓋預設值
34510
+ */
34511
+ function mergeThemeConfig(apiConfig) {
34512
+ const result = {};
34513
+ for (const key of Object.keys(themeConfigDefault)) {
34514
+ const defaultVal = themeConfigDefault[key];
34515
+ const apiVal = apiConfig == null ? void 0 : apiConfig[key];
34516
+ if (defaultVal != null && typeof defaultVal === 'object' && !Array.isArray(defaultVal)) {
34517
+ // 巢狀物件:逐一屬性合併,過濾 null/undefined
34518
+ const merged = Object.assign({}, defaultVal);
34519
+ if (apiVal != null && typeof apiVal === 'object') {
34520
+ for (const [k, v] of Object.entries(apiVal)) {
34521
+ if (v != null) {
34522
+ merged[k] = v;
34523
+ }
34524
+ }
34525
+ }
34526
+ result[key] = merged;
34527
+ } else {
34528
+ // 純值:API 有提供且非 null/undefined 才覆寫
34529
+ result[key] = apiVal != null ? apiVal : defaultVal;
34530
+ }
34531
+ }
34532
+ // 保留 API 回傳但預設值沒有的新屬性
34533
+ if (apiConfig != null && typeof apiConfig === 'object') {
34534
+ for (const key of Object.keys(apiConfig)) {
34535
+ if (!(key in result) && apiConfig[key] != null) {
34536
+ result[key] = apiConfig[key];
34537
+ }
34538
+ }
34539
+ }
34540
+ return result;
34541
+ }
34522
34542
  const themeConfigDefault = {
34523
34543
  isFraudAnimationLoadingPageEnabled: true,
34524
34544
  isStatementEnabled: true,
@@ -34880,7 +34900,7 @@ const themeConfigDefault = {
34880
34900
  };
34881
34901
 
34882
34902
  var name = "authme/sdk";
34883
- var version$1 = "2.8.45";
34903
+ var version$1 = "2.8.46";
34884
34904
  var packageInfo = {
34885
34905
  name: name,
34886
34906
  version: version$1};
@@ -34922,6 +34942,7 @@ exports.hidePopup = hidePopup;
34922
34942
  exports.isIphone14proOrProMax = isIphone14proOrProMax;
34923
34943
  exports.isMobile = isMobile;
34924
34944
  exports.isMobileOrTablet = isMobileOrTablet$1;
34945
+ exports.mergeThemeConfig = mergeThemeConfig;
34925
34946
  exports.osVersion = osVersion;
34926
34947
  exports.requestCamera = requestCamera;
34927
34948
  exports.resize = resize;