orange-orm 3.10.2 → 3.10.4

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.
@@ -503,7 +503,7 @@ function validator$1(operation, index, document, existingPathFragment) {
503
503
  }
504
504
  else if (operation.op === 'move' || operation.op === 'copy') {
505
505
  var existingValue = { op: "_get", path: operation.from, value: undefined };
506
- var error = validate$1([existingValue], document);
506
+ var error = validate$2([existingValue], document);
507
507
  if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {
508
508
  throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);
509
509
  }
@@ -517,7 +517,7 @@ function validator$1(operation, index, document, existingPathFragment) {
517
517
  * @param document
518
518
  * @returns {JsonPatchError|undefined}
519
519
  */
520
- function validate$1(sequence, document, externalValidator) {
520
+ function validate$2(sequence, document, externalValidator) {
521
521
  try {
522
522
  if (!Array.isArray(sequence)) {
523
523
  throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
@@ -602,7 +602,7 @@ var core = /*#__PURE__*/Object.freeze({
602
602
  applyPatch: applyPatch,
603
603
  applyReducer: applyReducer,
604
604
  validator: validator$1,
605
- validate: validate$1,
605
+ validate: validate$2,
606
606
  _areEquals: _areEquals
607
607
  });
608
608
 
@@ -805,7 +805,7 @@ var fastJsonPatch = /*#__PURE__*/Object.freeze({
805
805
  applyPatch: applyPatch,
806
806
  applyReducer: applyReducer,
807
807
  validator: validator$1,
808
- validate: validate$1,
808
+ validate: validate$2,
809
809
  _areEquals: _areEquals,
810
810
  unobserve: unobserve,
811
811
  observe: observe,
@@ -844,7 +844,7 @@ var dateToISOString_1 = dateToISOString$1;
844
844
  let dateToISOString = dateToISOString_1;
845
845
  const isNode = (typeof window === 'undefined');
846
846
 
847
- function stringify$4(value) {
847
+ function stringify$5(value) {
848
848
  return JSON.stringify(value, replacer);
849
849
  }
850
850
 
@@ -862,612 +862,693 @@ function isNodeBuffer(object) {
862
862
  return Buffer.isBuffer(object);
863
863
  }
864
864
 
865
- var stringify_1 = stringify$4;
865
+ var stringify_1 = stringify$5;
866
866
 
867
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
868
- // require the crypto API and do not support built-in fallback to lower quality random number
869
- // generators (like Math.random()).
870
- var getRandomValues;
871
- var rnds8 = new Uint8Array(16);
872
- function rng() {
873
- // lazy load so that environments that need to polyfill have a chance to do so
874
- if (!getRandomValues) {
875
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
876
- // find the complete implementation of crypto (msCrypto) on IE11.
877
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
867
+ var cjsBrowser = {};
878
868
 
879
- if (!getRandomValues) {
880
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
881
- }
882
- }
869
+ var max = {};
883
870
 
884
- return getRandomValues(rnds8);
885
- }
871
+ Object.defineProperty(max, "__esModule", { value: true });
872
+ max.default = 'ffffffff-ffff-ffff-ffff-ffffffffffff';
886
873
 
887
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
874
+ var nil = {};
888
875
 
889
- function validate(uuid) {
890
- return typeof uuid === 'string' && REGEX.test(uuid);
891
- }
876
+ Object.defineProperty(nil, "__esModule", { value: true });
877
+ nil.default = '00000000-0000-0000-0000-000000000000';
892
878
 
893
- /**
894
- * Convert array of 16 byte values to UUID string format of the form:
895
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
896
- */
879
+ var parse$1 = {};
897
880
 
898
- var byteToHex = [];
881
+ var validate$1 = {};
899
882
 
900
- for (var i = 0; i < 256; ++i) {
901
- byteToHex.push((i + 0x100).toString(16).substr(1));
902
- }
883
+ var regex = {};
903
884
 
904
- function stringify$3(arr) {
905
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
906
- // Note: Be careful editing this code! It's been tuned for performance
907
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
908
- var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
909
- // of the following:
910
- // - One or more input array values don't map to a hex octet (leading to
911
- // "undefined" in the uuid)
912
- // - Invalid input values for the RFC `version` or `variant` fields
885
+ Object.defineProperty(regex, "__esModule", { value: true });
886
+ regex.default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
913
887
 
914
- if (!validate(uuid)) {
915
- throw TypeError('Stringified UUID is invalid');
916
- }
888
+ Object.defineProperty(validate$1, "__esModule", { value: true });
889
+ const regex_js_1 = regex;
890
+ function validate(uuid) {
891
+ return typeof uuid === 'string' && regex_js_1.default.test(uuid);
892
+ }
893
+ validate$1.default = validate;
917
894
 
918
- return uuid;
895
+ Object.defineProperty(parse$1, "__esModule", { value: true });
896
+ const validate_js_1$2 = validate$1;
897
+ function parse(uuid) {
898
+ if (!(0, validate_js_1$2.default)(uuid)) {
899
+ throw TypeError('Invalid UUID');
900
+ }
901
+ let v;
902
+ return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 0xff, ((v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000) & 0xff, (v / 0x100000000) & 0xff, (v >>> 24) & 0xff, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff);
919
903
  }
904
+ parse$1.default = parse;
920
905
 
921
- //
922
- // Inspired by https://github.com/LiosK/UUID.js
923
- // and http://docs.python.org/library/uuid.html
906
+ var stringify$4 = {};
924
907
 
925
- var _nodeId;
908
+ Object.defineProperty(stringify$4, "__esModule", { value: true });
909
+ stringify$4.unsafeStringify = void 0;
910
+ const validate_js_1$1 = validate$1;
911
+ const byteToHex = [];
912
+ for (let i = 0; i < 256; ++i) {
913
+ byteToHex.push((i + 0x100).toString(16).slice(1));
914
+ }
915
+ function unsafeStringify(arr, offset = 0) {
916
+ return (byteToHex[arr[offset + 0]] +
917
+ byteToHex[arr[offset + 1]] +
918
+ byteToHex[arr[offset + 2]] +
919
+ byteToHex[arr[offset + 3]] +
920
+ '-' +
921
+ byteToHex[arr[offset + 4]] +
922
+ byteToHex[arr[offset + 5]] +
923
+ '-' +
924
+ byteToHex[arr[offset + 6]] +
925
+ byteToHex[arr[offset + 7]] +
926
+ '-' +
927
+ byteToHex[arr[offset + 8]] +
928
+ byteToHex[arr[offset + 9]] +
929
+ '-' +
930
+ byteToHex[arr[offset + 10]] +
931
+ byteToHex[arr[offset + 11]] +
932
+ byteToHex[arr[offset + 12]] +
933
+ byteToHex[arr[offset + 13]] +
934
+ byteToHex[arr[offset + 14]] +
935
+ byteToHex[arr[offset + 15]]).toLowerCase();
936
+ }
937
+ stringify$4.unsafeStringify = unsafeStringify;
938
+ function stringify$3(arr, offset = 0) {
939
+ const uuid = unsafeStringify(arr, offset);
940
+ if (!(0, validate_js_1$1.default)(uuid)) {
941
+ throw TypeError('Stringified UUID is invalid');
942
+ }
943
+ return uuid;
944
+ }
945
+ stringify$4.default = stringify$3;
926
946
 
927
- var _clockseq; // Previous uuid creation time
947
+ var v1$1 = {};
928
948
 
949
+ var rng$1 = {};
929
950
 
930
- var _lastMSecs = 0;
931
- var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
951
+ Object.defineProperty(rng$1, "__esModule", { value: true });
952
+ let getRandomValues;
953
+ const rnds8 = new Uint8Array(16);
954
+ function rng() {
955
+ if (!getRandomValues) {
956
+ if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
957
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
958
+ }
959
+ getRandomValues = crypto.getRandomValues.bind(crypto);
960
+ }
961
+ return getRandomValues(rnds8);
962
+ }
963
+ rng$1.default = rng;
932
964
 
965
+ Object.defineProperty(v1$1, "__esModule", { value: true });
966
+ v1$1.updateV1State = void 0;
967
+ const rng_js_1$2 = rng$1;
968
+ const stringify_js_1$6 = stringify$4;
969
+ const _state$1 = {};
933
970
  function v1(options, buf, offset) {
934
- var i = buf && offset || 0;
935
- var b = buf || new Array(16);
936
- options = options || {};
937
- var node = options.node || _nodeId;
938
- var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
939
- // specified. We do this lazily to minimize issues related to insufficient
940
- // system entropy. See #189
941
-
942
- if (node == null || clockseq == null) {
943
- var seedBytes = options.random || (options.rng || rng)();
944
-
945
- if (node == null) {
946
- // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
947
- node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
971
+ let bytes;
972
+ const isV6 = options?._v6 ?? false;
973
+ if (options) {
974
+ const optionsKeys = Object.keys(options);
975
+ if (optionsKeys.length === 1 && optionsKeys[0] === '_v6') {
976
+ options = undefined;
977
+ }
948
978
  }
949
-
950
- if (clockseq == null) {
951
- // Per 4.2.2, randomize (14 bit) clockseq
952
- clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
979
+ if (options) {
980
+ bytes = v1Bytes(options.random ?? options.rng?.() ?? (0, rng_js_1$2.default)(), options.msecs, options.nsecs, options.clockseq, options.node, buf, offset);
953
981
  }
954
- } // UUID timestamps are 100 nano-second units since the Gregorian epoch,
955
- // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
956
- // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
957
- // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
958
-
959
-
960
- var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
961
- // cycle to simulate higher resolution clock
962
-
963
- var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
964
-
965
- var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
966
-
967
- if (dt < 0 && options.clockseq === undefined) {
968
- clockseq = clockseq + 1 & 0x3fff;
969
- } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
970
- // time interval
971
-
972
-
973
- if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
974
- nsecs = 0;
975
- } // Per 4.2.1.2 Throw error if too many uuids are requested
976
-
977
-
978
- if (nsecs >= 10000) {
979
- throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
980
- }
981
-
982
- _lastMSecs = msecs;
983
- _lastNSecs = nsecs;
984
- _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
985
-
986
- msecs += 12219292800000; // `time_low`
987
-
988
- var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
989
- b[i++] = tl >>> 24 & 0xff;
990
- b[i++] = tl >>> 16 & 0xff;
991
- b[i++] = tl >>> 8 & 0xff;
992
- b[i++] = tl & 0xff; // `time_mid`
993
-
994
- var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
995
- b[i++] = tmh >>> 8 & 0xff;
996
- b[i++] = tmh & 0xff; // `time_high_and_version`
997
-
998
- b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
999
-
1000
- b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
1001
-
1002
- b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
1003
-
1004
- b[i++] = clockseq & 0xff; // `node`
1005
-
1006
- for (var n = 0; n < 6; ++n) {
1007
- b[i + n] = node[n];
1008
- }
1009
-
1010
- return buf || stringify$3(b);
1011
- }
1012
-
1013
- function parse(uuid) {
1014
- if (!validate(uuid)) {
1015
- throw TypeError('Invalid UUID');
1016
- }
1017
-
1018
- var v;
1019
- var arr = new Uint8Array(16); // Parse ########-....-....-....-............
1020
-
1021
- arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
1022
- arr[1] = v >>> 16 & 0xff;
1023
- arr[2] = v >>> 8 & 0xff;
1024
- arr[3] = v & 0xff; // Parse ........-####-....-....-............
1025
-
1026
- arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
1027
- arr[5] = v & 0xff; // Parse ........-....-####-....-............
1028
-
1029
- arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
1030
- arr[7] = v & 0xff; // Parse ........-....-....-####-............
1031
-
1032
- arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
1033
- arr[9] = v & 0xff; // Parse ........-....-....-....-############
1034
- // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
1035
-
1036
- arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
1037
- arr[11] = v / 0x100000000 & 0xff;
1038
- arr[12] = v >>> 24 & 0xff;
1039
- arr[13] = v >>> 16 & 0xff;
1040
- arr[14] = v >>> 8 & 0xff;
1041
- arr[15] = v & 0xff;
1042
- return arr;
982
+ else {
983
+ const now = Date.now();
984
+ const rnds = (0, rng_js_1$2.default)();
985
+ updateV1State(_state$1, now, rnds);
986
+ bytes = v1Bytes(rnds, _state$1.msecs, _state$1.nsecs, isV6 ? undefined : _state$1.clockseq, isV6 ? undefined : _state$1.node, buf, offset);
987
+ }
988
+ return buf ? bytes : (0, stringify_js_1$6.unsafeStringify)(bytes);
1043
989
  }
1044
-
1045
- function stringToBytes(str) {
1046
- str = unescape(encodeURIComponent(str)); // UTF8 escape
1047
-
1048
- var bytes = [];
1049
-
1050
- for (var i = 0; i < str.length; ++i) {
1051
- bytes.push(str.charCodeAt(i));
1052
- }
1053
-
1054
- return bytes;
990
+ function updateV1State(state, now, rnds) {
991
+ state.msecs ??= -Infinity;
992
+ state.nsecs ??= 0;
993
+ if (now === state.msecs) {
994
+ state.nsecs++;
995
+ if (state.nsecs >= 10000) {
996
+ state.node = undefined;
997
+ state.nsecs = 0;
998
+ }
999
+ }
1000
+ else if (now > state.msecs) {
1001
+ state.nsecs = 0;
1002
+ }
1003
+ else if (now < state.msecs) {
1004
+ state.node = undefined;
1005
+ }
1006
+ if (!state.node) {
1007
+ state.node = rnds.slice(10, 16);
1008
+ state.node[0] |= 0x01;
1009
+ state.clockseq = ((rnds[8] << 8) | rnds[9]) & 0x3fff;
1010
+ }
1011
+ state.msecs = now;
1012
+ return state;
1055
1013
  }
1056
-
1057
- var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
1058
- var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
1059
- function v35 (name, version, hashfunc) {
1060
- function generateUUID(value, namespace, buf, offset) {
1061
- if (typeof value === 'string') {
1062
- value = stringToBytes(value);
1014
+ v1$1.updateV1State = updateV1State;
1015
+ function v1Bytes(rnds, msecs, nsecs, clockseq, node, buf, offset = 0) {
1016
+ if (rnds.length < 16) {
1017
+ throw new Error('Random bytes length must be >= 16');
1063
1018
  }
1064
-
1065
- if (typeof namespace === 'string') {
1066
- namespace = parse(namespace);
1019
+ if (!buf) {
1020
+ buf = new Uint8Array(16);
1021
+ offset = 0;
1067
1022
  }
1068
-
1069
- if (namespace.length !== 16) {
1070
- throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
1071
- } // Compute hash of namespace and value, Per 4.3
1072
- // Future: Use spread syntax when supported on all platforms, e.g. `bytes =
1073
- // hashfunc([...namespace, ... value])`
1074
-
1075
-
1076
- var bytes = new Uint8Array(16 + value.length);
1077
- bytes.set(namespace);
1078
- bytes.set(value, namespace.length);
1079
- bytes = hashfunc(bytes);
1080
- bytes[6] = bytes[6] & 0x0f | version;
1081
- bytes[8] = bytes[8] & 0x3f | 0x80;
1082
-
1083
- if (buf) {
1084
- offset = offset || 0;
1085
-
1086
- for (var i = 0; i < 16; ++i) {
1087
- buf[offset + i] = bytes[i];
1088
- }
1089
-
1090
- return buf;
1023
+ else {
1024
+ if (offset < 0 || offset + 16 > buf.length) {
1025
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
1026
+ }
1091
1027
  }
1092
-
1093
- return stringify$3(bytes);
1094
- } // Function#name is not settable on some platforms (#270)
1095
-
1096
-
1097
- try {
1098
- generateUUID.name = name; // eslint-disable-next-line no-empty
1099
- } catch (err) {} // For CommonJS default export support
1100
-
1101
-
1102
- generateUUID.DNS = DNS;
1103
- generateUUID.URL = URL;
1104
- return generateUUID;
1028
+ msecs ??= Date.now();
1029
+ nsecs ??= 0;
1030
+ clockseq ??= ((rnds[8] << 8) | rnds[9]) & 0x3fff;
1031
+ node ??= rnds.slice(10, 16);
1032
+ msecs += 12219292800000;
1033
+ const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
1034
+ buf[offset++] = (tl >>> 24) & 0xff;
1035
+ buf[offset++] = (tl >>> 16) & 0xff;
1036
+ buf[offset++] = (tl >>> 8) & 0xff;
1037
+ buf[offset++] = tl & 0xff;
1038
+ const tmh = ((msecs / 0x100000000) * 10000) & 0xfffffff;
1039
+ buf[offset++] = (tmh >>> 8) & 0xff;
1040
+ buf[offset++] = tmh & 0xff;
1041
+ buf[offset++] = ((tmh >>> 24) & 0xf) | 0x10;
1042
+ buf[offset++] = (tmh >>> 16) & 0xff;
1043
+ buf[offset++] = (clockseq >>> 8) | 0x80;
1044
+ buf[offset++] = clockseq & 0xff;
1045
+ for (let n = 0; n < 6; ++n) {
1046
+ buf[offset++] = node[n];
1047
+ }
1048
+ return buf;
1105
1049
  }
1050
+ v1$1.default = v1;
1106
1051
 
1107
- /*
1108
- * Browser-compatible JavaScript MD5
1109
- *
1110
- * Modification of JavaScript MD5
1111
- * https://github.com/blueimp/JavaScript-MD5
1112
- *
1113
- * Copyright 2011, Sebastian Tschan
1114
- * https://blueimp.net
1115
- *
1116
- * Licensed under the MIT license:
1117
- * https://opensource.org/licenses/MIT
1118
- *
1119
- * Based on
1120
- * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
1121
- * Digest Algorithm, as defined in RFC 1321.
1122
- * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
1123
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
1124
- * Distributed under the BSD License
1125
- * See http://pajhome.org.uk/crypt/md5 for more info.
1126
- */
1127
- function md5(bytes) {
1128
- if (typeof bytes === 'string') {
1129
- var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
1130
-
1131
- bytes = new Uint8Array(msg.length);
1132
-
1133
- for (var i = 0; i < msg.length; ++i) {
1134
- bytes[i] = msg.charCodeAt(i);
1135
- }
1136
- }
1052
+ var v1ToV6$1 = {};
1137
1053
 
1138
- return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
1054
+ Object.defineProperty(v1ToV6$1, "__esModule", { value: true });
1055
+ const parse_js_1$2 = parse$1;
1056
+ const stringify_js_1$5 = stringify$4;
1057
+ function v1ToV6(uuid) {
1058
+ const v1Bytes = typeof uuid === 'string' ? (0, parse_js_1$2.default)(uuid) : uuid;
1059
+ const v6Bytes = _v1ToV6(v1Bytes);
1060
+ return typeof uuid === 'string' ? (0, stringify_js_1$5.unsafeStringify)(v6Bytes) : v6Bytes;
1061
+ }
1062
+ v1ToV6$1.default = v1ToV6;
1063
+ function _v1ToV6(v1Bytes) {
1064
+ return Uint8Array.of(((v1Bytes[6] & 0x0f) << 4) | ((v1Bytes[7] >> 4) & 0x0f), ((v1Bytes[7] & 0x0f) << 4) | ((v1Bytes[4] & 0xf0) >> 4), ((v1Bytes[4] & 0x0f) << 4) | ((v1Bytes[5] & 0xf0) >> 4), ((v1Bytes[5] & 0x0f) << 4) | ((v1Bytes[0] & 0xf0) >> 4), ((v1Bytes[0] & 0x0f) << 4) | ((v1Bytes[1] & 0xf0) >> 4), ((v1Bytes[1] & 0x0f) << 4) | ((v1Bytes[2] & 0xf0) >> 4), 0x60 | (v1Bytes[2] & 0x0f), v1Bytes[3], v1Bytes[8], v1Bytes[9], v1Bytes[10], v1Bytes[11], v1Bytes[12], v1Bytes[13], v1Bytes[14], v1Bytes[15]);
1139
1065
  }
1140
- /*
1141
- * Convert an array of little-endian words to an array of bytes
1142
- */
1143
-
1144
1066
 
1145
- function md5ToHexEncodedArray(input) {
1146
- var output = [];
1147
- var length32 = input.length * 32;
1148
- var hexTab = '0123456789abcdef';
1067
+ var v3 = {};
1149
1068
 
1150
- for (var i = 0; i < length32; i += 8) {
1151
- var x = input[i >> 5] >>> i % 32 & 0xff;
1152
- var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
1153
- output.push(hex);
1154
- }
1069
+ var md5$1 = {};
1155
1070
 
1156
- return output;
1071
+ Object.defineProperty(md5$1, "__esModule", { value: true });
1072
+ function md5(bytes) {
1073
+ const words = uint8ToUint32(bytes);
1074
+ const md5Bytes = wordsToMd5(words, bytes.length * 8);
1075
+ return uint32ToUint8(md5Bytes);
1076
+ }
1077
+ function uint32ToUint8(input) {
1078
+ const bytes = new Uint8Array(input.length * 4);
1079
+ for (let i = 0; i < input.length * 4; i++) {
1080
+ bytes[i] = (input[i >> 2] >>> ((i % 4) * 8)) & 0xff;
1081
+ }
1082
+ return bytes;
1157
1083
  }
1158
- /**
1159
- * Calculate output length with padding and bit length
1160
- */
1161
-
1162
-
1163
1084
  function getOutputLength(inputLength8) {
1164
- return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;
1085
+ return (((inputLength8 + 64) >>> 9) << 4) + 14 + 1;
1165
1086
  }
1166
- /*
1167
- * Calculate the MD5 of an array of little-endian words, and a bit length.
1168
- */
1169
-
1170
-
1171
1087
  function wordsToMd5(x, len) {
1172
- /* append padding */
1173
- x[len >> 5] |= 0x80 << len % 32;
1174
- x[getOutputLength(len) - 1] = len;
1175
- var a = 1732584193;
1176
- var b = -271733879;
1177
- var c = -1732584194;
1178
- var d = 271733878;
1179
-
1180
- for (var i = 0; i < x.length; i += 16) {
1181
- var olda = a;
1182
- var oldb = b;
1183
- var oldc = c;
1184
- var oldd = d;
1185
- a = md5ff(a, b, c, d, x[i], 7, -680876936);
1186
- d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
1187
- c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
1188
- b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
1189
- a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
1190
- d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
1191
- c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
1192
- b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
1193
- a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
1194
- d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
1195
- c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
1196
- b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
1197
- a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
1198
- d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
1199
- c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
1200
- b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
1201
- a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
1202
- d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
1203
- c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
1204
- b = md5gg(b, c, d, a, x[i], 20, -373897302);
1205
- a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
1206
- d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
1207
- c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
1208
- b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
1209
- a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
1210
- d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
1211
- c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
1212
- b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
1213
- a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
1214
- d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
1215
- c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
1216
- b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
1217
- a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
1218
- d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
1219
- c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
1220
- b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
1221
- a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
1222
- d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
1223
- c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
1224
- b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
1225
- a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
1226
- d = md5hh(d, a, b, c, x[i], 11, -358537222);
1227
- c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
1228
- b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
1229
- a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
1230
- d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
1231
- c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
1232
- b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
1233
- a = md5ii(a, b, c, d, x[i], 6, -198630844);
1234
- d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
1235
- c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
1236
- b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
1237
- a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
1238
- d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
1239
- c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
1240
- b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
1241
- a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
1242
- d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
1243
- c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
1244
- b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
1245
- a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
1246
- d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
1247
- c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
1248
- b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
1249
- a = safeAdd(a, olda);
1250
- b = safeAdd(b, oldb);
1251
- c = safeAdd(c, oldc);
1252
- d = safeAdd(d, oldd);
1253
- }
1254
-
1255
- return [a, b, c, d];
1088
+ const xpad = new Uint32Array(getOutputLength(len)).fill(0);
1089
+ xpad.set(x);
1090
+ xpad[len >> 5] |= 0x80 << len % 32;
1091
+ xpad[xpad.length - 1] = len;
1092
+ x = xpad;
1093
+ let a = 1732584193;
1094
+ let b = -271733879;
1095
+ let c = -1732584194;
1096
+ let d = 271733878;
1097
+ for (let i = 0; i < x.length; i += 16) {
1098
+ const olda = a;
1099
+ const oldb = b;
1100
+ const oldc = c;
1101
+ const oldd = d;
1102
+ a = md5ff(a, b, c, d, x[i], 7, -680876936);
1103
+ d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
1104
+ c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
1105
+ b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
1106
+ a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
1107
+ d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
1108
+ c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
1109
+ b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
1110
+ a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
1111
+ d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
1112
+ c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
1113
+ b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
1114
+ a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
1115
+ d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
1116
+ c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
1117
+ b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
1118
+ a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
1119
+ d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
1120
+ c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
1121
+ b = md5gg(b, c, d, a, x[i], 20, -373897302);
1122
+ a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
1123
+ d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
1124
+ c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
1125
+ b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
1126
+ a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
1127
+ d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
1128
+ c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
1129
+ b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
1130
+ a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
1131
+ d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
1132
+ c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
1133
+ b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
1134
+ a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
1135
+ d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
1136
+ c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
1137
+ b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
1138
+ a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
1139
+ d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
1140
+ c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
1141
+ b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
1142
+ a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
1143
+ d = md5hh(d, a, b, c, x[i], 11, -358537222);
1144
+ c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
1145
+ b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
1146
+ a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
1147
+ d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
1148
+ c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
1149
+ b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
1150
+ a = md5ii(a, b, c, d, x[i], 6, -198630844);
1151
+ d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
1152
+ c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
1153
+ b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
1154
+ a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
1155
+ d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
1156
+ c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
1157
+ b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
1158
+ a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
1159
+ d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
1160
+ c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
1161
+ b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
1162
+ a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
1163
+ d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
1164
+ c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
1165
+ b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
1166
+ a = safeAdd(a, olda);
1167
+ b = safeAdd(b, oldb);
1168
+ c = safeAdd(c, oldc);
1169
+ d = safeAdd(d, oldd);
1170
+ }
1171
+ return Uint32Array.of(a, b, c, d);
1256
1172
  }
1257
- /*
1258
- * Convert an array bytes to an array of little-endian words
1259
- * Characters >255 have their high-byte silently ignored.
1260
- */
1261
-
1262
-
1263
- function bytesToWords(input) {
1264
- if (input.length === 0) {
1265
- return [];
1266
- }
1267
-
1268
- var length8 = input.length * 8;
1269
- var output = new Uint32Array(getOutputLength(length8));
1270
-
1271
- for (var i = 0; i < length8; i += 8) {
1272
- output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
1273
- }
1274
-
1275
- return output;
1173
+ function uint8ToUint32(input) {
1174
+ if (input.length === 0) {
1175
+ return new Uint32Array();
1176
+ }
1177
+ const output = new Uint32Array(getOutputLength(input.length * 8)).fill(0);
1178
+ for (let i = 0; i < input.length; i++) {
1179
+ output[i >> 2] |= (input[i] & 0xff) << ((i % 4) * 8);
1180
+ }
1181
+ return output;
1276
1182
  }
1277
- /*
1278
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
1279
- * to work around bugs in some JS interpreters.
1280
- */
1281
-
1282
-
1283
1183
  function safeAdd(x, y) {
1284
- var lsw = (x & 0xffff) + (y & 0xffff);
1285
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
1286
- return msw << 16 | lsw & 0xffff;
1184
+ const lsw = (x & 0xffff) + (y & 0xffff);
1185
+ const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
1186
+ return (msw << 16) | (lsw & 0xffff);
1287
1187
  }
1288
- /*
1289
- * Bitwise rotate a 32-bit number to the left.
1290
- */
1291
-
1292
-
1293
1188
  function bitRotateLeft(num, cnt) {
1294
- return num << cnt | num >>> 32 - cnt;
1189
+ return (num << cnt) | (num >>> (32 - cnt));
1295
1190
  }
1296
- /*
1297
- * These functions implement the four basic operations the algorithm uses.
1298
- */
1299
-
1300
-
1301
1191
  function md5cmn(q, a, b, x, s, t) {
1302
- return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
1192
+ return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
1303
1193
  }
1304
-
1305
1194
  function md5ff(a, b, c, d, x, s, t) {
1306
- return md5cmn(b & c | ~b & d, a, b, x, s, t);
1195
+ return md5cmn((b & c) | (~b & d), a, b, x, s, t);
1307
1196
  }
1308
-
1309
1197
  function md5gg(a, b, c, d, x, s, t) {
1310
- return md5cmn(b & d | c & ~d, a, b, x, s, t);
1198
+ return md5cmn((b & d) | (c & ~d), a, b, x, s, t);
1311
1199
  }
1312
-
1313
1200
  function md5hh(a, b, c, d, x, s, t) {
1314
- return md5cmn(b ^ c ^ d, a, b, x, s, t);
1201
+ return md5cmn(b ^ c ^ d, a, b, x, s, t);
1315
1202
  }
1316
-
1317
1203
  function md5ii(a, b, c, d, x, s, t) {
1318
- return md5cmn(c ^ (b | ~d), a, b, x, s, t);
1204
+ return md5cmn(c ^ (b | ~d), a, b, x, s, t);
1319
1205
  }
1206
+ md5$1.default = md5;
1320
1207
 
1321
- var v3 = v35('v3', 0x30, md5);
1322
- var v3$1 = v3;
1323
-
1324
- function v4(options, buf, offset) {
1325
- options = options || {};
1326
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
1208
+ var v35$1 = {};
1327
1209
 
1328
- rnds[6] = rnds[6] & 0x0f | 0x40;
1329
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
1210
+ Object.defineProperty(v35$1, "__esModule", { value: true });
1211
+ v35$1.URL = v35$1.DNS = v35$1.stringToBytes = void 0;
1212
+ const parse_js_1$1 = parse$1;
1213
+ const stringify_js_1$4 = stringify$4;
1214
+ function stringToBytes(str) {
1215
+ str = unescape(encodeURIComponent(str));
1216
+ const bytes = new Uint8Array(str.length);
1217
+ for (let i = 0; i < str.length; ++i) {
1218
+ bytes[i] = str.charCodeAt(i);
1219
+ }
1220
+ return bytes;
1221
+ }
1222
+ v35$1.stringToBytes = stringToBytes;
1223
+ v35$1.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
1224
+ v35$1.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
1225
+ function v35(version, hash, value, namespace, buf, offset) {
1226
+ const valueBytes = typeof value === 'string' ? stringToBytes(value) : value;
1227
+ const namespaceBytes = typeof namespace === 'string' ? (0, parse_js_1$1.default)(namespace) : namespace;
1228
+ if (typeof namespace === 'string') {
1229
+ namespace = (0, parse_js_1$1.default)(namespace);
1230
+ }
1231
+ if (namespace?.length !== 16) {
1232
+ throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
1233
+ }
1234
+ let bytes = new Uint8Array(16 + valueBytes.length);
1235
+ bytes.set(namespaceBytes);
1236
+ bytes.set(valueBytes, namespaceBytes.length);
1237
+ bytes = hash(bytes);
1238
+ bytes[6] = (bytes[6] & 0x0f) | version;
1239
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
1240
+ if (buf) {
1241
+ offset = offset || 0;
1242
+ for (let i = 0; i < 16; ++i) {
1243
+ buf[offset + i] = bytes[i];
1244
+ }
1245
+ return buf;
1246
+ }
1247
+ return (0, stringify_js_1$4.unsafeStringify)(bytes);
1248
+ }
1249
+ v35$1.default = v35;
1250
+
1251
+ (function (exports) {
1252
+ Object.defineProperty(exports, "__esModule", { value: true });
1253
+ exports.URL = exports.DNS = void 0;
1254
+ const md5_js_1 = md5$1;
1255
+ const v35_js_1 = v35$1;
1256
+ var v35_js_2 = v35$1;
1257
+ Object.defineProperty(exports, "DNS", { enumerable: true, get: function () { return v35_js_2.DNS; } });
1258
+ Object.defineProperty(exports, "URL", { enumerable: true, get: function () { return v35_js_2.URL; } });
1259
+ function v3(value, namespace, buf, offset) {
1260
+ return (0, v35_js_1.default)(0x30, md5_js_1.default, value, namespace, buf, offset);
1261
+ }
1262
+ v3.DNS = v35_js_1.DNS;
1263
+ v3.URL = v35_js_1.URL;
1264
+ exports.default = v3;
1265
+ }(v3));
1330
1266
 
1331
- if (buf) {
1332
- offset = offset || 0;
1267
+ var v4$1 = {};
1333
1268
 
1334
- for (var i = 0; i < 16; ++i) {
1335
- buf[offset + i] = rnds[i];
1336
- }
1269
+ var native = {};
1337
1270
 
1338
- return buf;
1339
- }
1271
+ Object.defineProperty(native, "__esModule", { value: true });
1272
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1273
+ native.default = { randomUUID };
1340
1274
 
1341
- return stringify$3(rnds);
1275
+ Object.defineProperty(v4$1, "__esModule", { value: true });
1276
+ const native_js_1 = native;
1277
+ const rng_js_1$1 = rng$1;
1278
+ const stringify_js_1$3 = stringify$4;
1279
+ function v4(options, buf, offset) {
1280
+ if (native_js_1.default.randomUUID && !buf && !options) {
1281
+ return native_js_1.default.randomUUID();
1282
+ }
1283
+ options = options || {};
1284
+ const rnds = options.random ?? options.rng?.() ?? (0, rng_js_1$1.default)();
1285
+ if (rnds.length < 16) {
1286
+ throw new Error('Random bytes length must be >= 16');
1287
+ }
1288
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
1289
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
1290
+ if (buf) {
1291
+ offset = offset || 0;
1292
+ if (offset < 0 || offset + 16 > buf.length) {
1293
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
1294
+ }
1295
+ for (let i = 0; i < 16; ++i) {
1296
+ buf[offset + i] = rnds[i];
1297
+ }
1298
+ return buf;
1299
+ }
1300
+ return (0, stringify_js_1$3.unsafeStringify)(rnds);
1342
1301
  }
1302
+ v4$1.default = v4;
1343
1303
 
1344
- // Adapted from Chris Veness' SHA1 code at
1345
- // http://www.movable-type.co.uk/scripts/sha1.html
1346
- function f(s, x, y, z) {
1347
- switch (s) {
1348
- case 0:
1349
- return x & y ^ ~x & z;
1350
-
1351
- case 1:
1352
- return x ^ y ^ z;
1304
+ var v5 = {};
1353
1305
 
1354
- case 2:
1355
- return x & y ^ x & z ^ y & z;
1306
+ var sha1$1 = {};
1356
1307
 
1357
- case 3:
1358
- return x ^ y ^ z;
1359
- }
1308
+ Object.defineProperty(sha1$1, "__esModule", { value: true });
1309
+ function f(s, x, y, z) {
1310
+ switch (s) {
1311
+ case 0:
1312
+ return (x & y) ^ (~x & z);
1313
+ case 1:
1314
+ return x ^ y ^ z;
1315
+ case 2:
1316
+ return (x & y) ^ (x & z) ^ (y & z);
1317
+ case 3:
1318
+ return x ^ y ^ z;
1319
+ }
1360
1320
  }
1361
-
1362
1321
  function ROTL(x, n) {
1363
- return x << n | x >>> 32 - n;
1322
+ return (x << n) | (x >>> (32 - n));
1364
1323
  }
1365
-
1366
1324
  function sha1(bytes) {
1367
- var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
1368
- var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
1369
-
1370
- if (typeof bytes === 'string') {
1371
- var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
1372
-
1373
- bytes = [];
1374
-
1375
- for (var i = 0; i < msg.length; ++i) {
1376
- bytes.push(msg.charCodeAt(i));
1325
+ const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
1326
+ const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
1327
+ const newBytes = new Uint8Array(bytes.length + 1);
1328
+ newBytes.set(bytes);
1329
+ newBytes[bytes.length] = 0x80;
1330
+ bytes = newBytes;
1331
+ const l = bytes.length / 4 + 2;
1332
+ const N = Math.ceil(l / 16);
1333
+ const M = new Array(N);
1334
+ for (let i = 0; i < N; ++i) {
1335
+ const arr = new Uint32Array(16);
1336
+ for (let j = 0; j < 16; ++j) {
1337
+ arr[j] =
1338
+ (bytes[i * 64 + j * 4] << 24) |
1339
+ (bytes[i * 64 + j * 4 + 1] << 16) |
1340
+ (bytes[i * 64 + j * 4 + 2] << 8) |
1341
+ bytes[i * 64 + j * 4 + 3];
1342
+ }
1343
+ M[i] = arr;
1344
+ }
1345
+ M[N - 1][14] = ((bytes.length - 1) * 8) / Math.pow(2, 32);
1346
+ M[N - 1][14] = Math.floor(M[N - 1][14]);
1347
+ M[N - 1][15] = ((bytes.length - 1) * 8) & 0xffffffff;
1348
+ for (let i = 0; i < N; ++i) {
1349
+ const W = new Uint32Array(80);
1350
+ for (let t = 0; t < 16; ++t) {
1351
+ W[t] = M[i][t];
1352
+ }
1353
+ for (let t = 16; t < 80; ++t) {
1354
+ W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
1355
+ }
1356
+ let a = H[0];
1357
+ let b = H[1];
1358
+ let c = H[2];
1359
+ let d = H[3];
1360
+ let e = H[4];
1361
+ for (let t = 0; t < 80; ++t) {
1362
+ const s = Math.floor(t / 20);
1363
+ const T = (ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t]) >>> 0;
1364
+ e = d;
1365
+ d = c;
1366
+ c = ROTL(b, 30) >>> 0;
1367
+ b = a;
1368
+ a = T;
1369
+ }
1370
+ H[0] = (H[0] + a) >>> 0;
1371
+ H[1] = (H[1] + b) >>> 0;
1372
+ H[2] = (H[2] + c) >>> 0;
1373
+ H[3] = (H[3] + d) >>> 0;
1374
+ H[4] = (H[4] + e) >>> 0;
1377
1375
  }
1378
- } else if (!Array.isArray(bytes)) {
1379
- // Convert Array-like to Array
1380
- bytes = Array.prototype.slice.call(bytes);
1381
- }
1382
-
1383
- bytes.push(0x80);
1384
- var l = bytes.length / 4 + 2;
1385
- var N = Math.ceil(l / 16);
1386
- var M = new Array(N);
1387
-
1388
- for (var _i = 0; _i < N; ++_i) {
1389
- var arr = new Uint32Array(16);
1390
-
1391
- for (var j = 0; j < 16; ++j) {
1392
- arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3];
1376
+ return Uint8Array.of(H[0] >> 24, H[0] >> 16, H[0] >> 8, H[0], H[1] >> 24, H[1] >> 16, H[1] >> 8, H[1], H[2] >> 24, H[2] >> 16, H[2] >> 8, H[2], H[3] >> 24, H[3] >> 16, H[3] >> 8, H[3], H[4] >> 24, H[4] >> 16, H[4] >> 8, H[4]);
1377
+ }
1378
+ sha1$1.default = sha1;
1379
+
1380
+ (function (exports) {
1381
+ Object.defineProperty(exports, "__esModule", { value: true });
1382
+ exports.URL = exports.DNS = void 0;
1383
+ const sha1_js_1 = sha1$1;
1384
+ const v35_js_1 = v35$1;
1385
+ var v35_js_2 = v35$1;
1386
+ Object.defineProperty(exports, "DNS", { enumerable: true, get: function () { return v35_js_2.DNS; } });
1387
+ Object.defineProperty(exports, "URL", { enumerable: true, get: function () { return v35_js_2.URL; } });
1388
+ function v5(value, namespace, buf, offset) {
1389
+ return (0, v35_js_1.default)(0x50, sha1_js_1.default, value, namespace, buf, offset);
1390
+ }
1391
+ v5.DNS = v35_js_1.DNS;
1392
+ v5.URL = v35_js_1.URL;
1393
+ exports.default = v5;
1394
+ }(v5));
1395
+
1396
+ var v6$1 = {};
1397
+
1398
+ Object.defineProperty(v6$1, "__esModule", { value: true });
1399
+ const stringify_js_1$2 = stringify$4;
1400
+ const v1_js_1 = v1$1;
1401
+ const v1ToV6_js_1 = v1ToV6$1;
1402
+ function v6(options, buf, offset) {
1403
+ options ??= {};
1404
+ offset ??= 0;
1405
+ let bytes = (0, v1_js_1.default)({ ...options, _v6: true }, new Uint8Array(16));
1406
+ bytes = (0, v1ToV6_js_1.default)(bytes);
1407
+ if (buf) {
1408
+ for (let i = 0; i < 16; i++) {
1409
+ buf[offset + i] = bytes[i];
1410
+ }
1411
+ return buf;
1393
1412
  }
1413
+ return (0, stringify_js_1$2.unsafeStringify)(bytes);
1414
+ }
1415
+ v6$1.default = v6;
1394
1416
 
1395
- M[_i] = arr;
1396
- }
1417
+ var v6ToV1$1 = {};
1397
1418
 
1398
- M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
1399
- M[N - 1][14] = Math.floor(M[N - 1][14]);
1400
- M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
1419
+ Object.defineProperty(v6ToV1$1, "__esModule", { value: true });
1420
+ const parse_js_1 = parse$1;
1421
+ const stringify_js_1$1 = stringify$4;
1422
+ function v6ToV1(uuid) {
1423
+ const v6Bytes = typeof uuid === 'string' ? (0, parse_js_1.default)(uuid) : uuid;
1424
+ const v1Bytes = _v6ToV1(v6Bytes);
1425
+ return typeof uuid === 'string' ? (0, stringify_js_1$1.unsafeStringify)(v1Bytes) : v1Bytes;
1426
+ }
1427
+ v6ToV1$1.default = v6ToV1;
1428
+ function _v6ToV1(v6Bytes) {
1429
+ return Uint8Array.of(((v6Bytes[3] & 0x0f) << 4) | ((v6Bytes[4] >> 4) & 0x0f), ((v6Bytes[4] & 0x0f) << 4) | ((v6Bytes[5] & 0xf0) >> 4), ((v6Bytes[5] & 0x0f) << 4) | (v6Bytes[6] & 0x0f), v6Bytes[7], ((v6Bytes[1] & 0x0f) << 4) | ((v6Bytes[2] & 0xf0) >> 4), ((v6Bytes[2] & 0x0f) << 4) | ((v6Bytes[3] & 0xf0) >> 4), 0x10 | ((v6Bytes[0] & 0xf0) >> 4), ((v6Bytes[0] & 0x0f) << 4) | ((v6Bytes[1] & 0xf0) >> 4), v6Bytes[8], v6Bytes[9], v6Bytes[10], v6Bytes[11], v6Bytes[12], v6Bytes[13], v6Bytes[14], v6Bytes[15]);
1430
+ }
1401
1431
 
1402
- for (var _i2 = 0; _i2 < N; ++_i2) {
1403
- var W = new Uint32Array(80);
1432
+ var v7$1 = {};
1404
1433
 
1405
- for (var t = 0; t < 16; ++t) {
1406
- W[t] = M[_i2][t];
1434
+ Object.defineProperty(v7$1, "__esModule", { value: true });
1435
+ v7$1.updateV7State = void 0;
1436
+ const rng_js_1 = rng$1;
1437
+ const stringify_js_1 = stringify$4;
1438
+ const _state = {};
1439
+ function v7(options, buf, offset) {
1440
+ let bytes;
1441
+ if (options) {
1442
+ bytes = v7Bytes(options.random ?? options.rng?.() ?? (0, rng_js_1.default)(), options.msecs, options.seq, buf, offset);
1407
1443
  }
1408
-
1409
- for (var _t = 16; _t < 80; ++_t) {
1410
- W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1);
1444
+ else {
1445
+ const now = Date.now();
1446
+ const rnds = (0, rng_js_1.default)();
1447
+ updateV7State(_state, now, rnds);
1448
+ bytes = v7Bytes(rnds, _state.msecs, _state.seq, buf, offset);
1411
1449
  }
1412
-
1413
- var a = H[0];
1414
- var b = H[1];
1415
- var c = H[2];
1416
- var d = H[3];
1417
- var e = H[4];
1418
-
1419
- for (var _t2 = 0; _t2 < 80; ++_t2) {
1420
- var s = Math.floor(_t2 / 20);
1421
- var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0;
1422
- e = d;
1423
- d = c;
1424
- c = ROTL(b, 30) >>> 0;
1425
- b = a;
1426
- a = T;
1450
+ return buf ? bytes : (0, stringify_js_1.unsafeStringify)(bytes);
1451
+ }
1452
+ function updateV7State(state, now, rnds) {
1453
+ state.msecs ??= -Infinity;
1454
+ state.seq ??= 0;
1455
+ if (now > state.msecs) {
1456
+ state.seq = (rnds[6] << 23) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
1457
+ state.msecs = now;
1427
1458
  }
1428
-
1429
- H[0] = H[0] + a >>> 0;
1430
- H[1] = H[1] + b >>> 0;
1431
- H[2] = H[2] + c >>> 0;
1432
- H[3] = H[3] + d >>> 0;
1433
- H[4] = H[4] + e >>> 0;
1434
- }
1435
-
1436
- return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
1459
+ else {
1460
+ state.seq = (state.seq + 1) | 0;
1461
+ if (state.seq === 0) {
1462
+ state.msecs++;
1463
+ }
1464
+ }
1465
+ return state;
1437
1466
  }
1467
+ v7$1.updateV7State = updateV7State;
1468
+ function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
1469
+ if (rnds.length < 16) {
1470
+ throw new Error('Random bytes length must be >= 16');
1471
+ }
1472
+ if (!buf) {
1473
+ buf = new Uint8Array(16);
1474
+ offset = 0;
1475
+ }
1476
+ else {
1477
+ if (offset < 0 || offset + 16 > buf.length) {
1478
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
1479
+ }
1480
+ }
1481
+ msecs ??= Date.now();
1482
+ seq ??= ((rnds[6] * 0x7f) << 24) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
1483
+ buf[offset++] = (msecs / 0x10000000000) & 0xff;
1484
+ buf[offset++] = (msecs / 0x100000000) & 0xff;
1485
+ buf[offset++] = (msecs / 0x1000000) & 0xff;
1486
+ buf[offset++] = (msecs / 0x10000) & 0xff;
1487
+ buf[offset++] = (msecs / 0x100) & 0xff;
1488
+ buf[offset++] = msecs & 0xff;
1489
+ buf[offset++] = 0x70 | ((seq >>> 28) & 0x0f);
1490
+ buf[offset++] = (seq >>> 20) & 0xff;
1491
+ buf[offset++] = 0x80 | ((seq >>> 14) & 0x3f);
1492
+ buf[offset++] = (seq >>> 6) & 0xff;
1493
+ buf[offset++] = ((seq << 2) & 0xff) | (rnds[10] & 0x03);
1494
+ buf[offset++] = rnds[11];
1495
+ buf[offset++] = rnds[12];
1496
+ buf[offset++] = rnds[13];
1497
+ buf[offset++] = rnds[14];
1498
+ buf[offset++] = rnds[15];
1499
+ return buf;
1500
+ }
1501
+ v7$1.default = v7;
1438
1502
 
1439
- var v5 = v35('v5', 0x50, sha1);
1440
- var v5$1 = v5;
1441
-
1442
- var nil = '00000000-0000-0000-0000-000000000000';
1503
+ var version$1 = {};
1443
1504
 
1505
+ Object.defineProperty(version$1, "__esModule", { value: true });
1506
+ const validate_js_1 = validate$1;
1444
1507
  function version(uuid) {
1445
- if (!validate(uuid)) {
1446
- throw TypeError('Invalid UUID');
1447
- }
1448
-
1449
- return parseInt(uuid.substr(14, 1), 16);
1508
+ if (!(0, validate_js_1.default)(uuid)) {
1509
+ throw TypeError('Invalid UUID');
1510
+ }
1511
+ return parseInt(uuid.slice(14, 15), 16);
1450
1512
  }
1451
-
1452
- var esmBrowser = /*#__PURE__*/Object.freeze({
1453
- __proto__: null,
1454
- v1: v1,
1455
- v3: v3$1,
1456
- v4: v4,
1457
- v5: v5$1,
1458
- NIL: nil,
1459
- version: version,
1460
- validate: validate,
1461
- stringify: stringify$3,
1462
- parse: parse
1463
- });
1464
-
1465
- var require$$1 = /*@__PURE__*/getAugmentedNamespace(esmBrowser);
1513
+ version$1.default = version;
1514
+
1515
+ (function (exports) {
1516
+ Object.defineProperty(exports, "__esModule", { value: true });
1517
+ exports.version = exports.validate = exports.v7 = exports.v6ToV1 = exports.v6 = exports.v5 = exports.v4 = exports.v3 = exports.v1ToV6 = exports.v1 = exports.stringify = exports.parse = exports.NIL = exports.MAX = void 0;
1518
+ var max_js_1 = max;
1519
+ Object.defineProperty(exports, "MAX", { enumerable: true, get: function () { return max_js_1.default; } });
1520
+ var nil_js_1 = nil;
1521
+ Object.defineProperty(exports, "NIL", { enumerable: true, get: function () { return nil_js_1.default; } });
1522
+ var parse_js_1 = parse$1;
1523
+ Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_js_1.default; } });
1524
+ var stringify_js_1 = stringify$4;
1525
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return stringify_js_1.default; } });
1526
+ var v1_js_1 = v1$1;
1527
+ Object.defineProperty(exports, "v1", { enumerable: true, get: function () { return v1_js_1.default; } });
1528
+ var v1ToV6_js_1 = v1ToV6$1;
1529
+ Object.defineProperty(exports, "v1ToV6", { enumerable: true, get: function () { return v1ToV6_js_1.default; } });
1530
+ var v3_js_1 = v3;
1531
+ Object.defineProperty(exports, "v3", { enumerable: true, get: function () { return v3_js_1.default; } });
1532
+ var v4_js_1 = v4$1;
1533
+ Object.defineProperty(exports, "v4", { enumerable: true, get: function () { return v4_js_1.default; } });
1534
+ var v5_js_1 = v5;
1535
+ Object.defineProperty(exports, "v5", { enumerable: true, get: function () { return v5_js_1.default; } });
1536
+ var v6_js_1 = v6$1;
1537
+ Object.defineProperty(exports, "v6", { enumerable: true, get: function () { return v6_js_1.default; } });
1538
+ var v6ToV1_js_1 = v6ToV1$1;
1539
+ Object.defineProperty(exports, "v6ToV1", { enumerable: true, get: function () { return v6ToV1_js_1.default; } });
1540
+ var v7_js_1 = v7$1;
1541
+ Object.defineProperty(exports, "v7", { enumerable: true, get: function () { return v7_js_1.default; } });
1542
+ var validate_js_1 = validate$1;
1543
+ Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_js_1.default; } });
1544
+ var version_js_1 = version$1;
1545
+ Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_js_1.default; } });
1546
+ }(cjsBrowser));
1466
1547
 
1467
1548
  const jsonpatch = require$$0;
1468
1549
  let dateToIsoString = dateToISOString_1;
1469
1550
  let stringify$2 = stringify_1;
1470
- let { v4: uuid$1 } = require$$1;
1551
+ let { v4: uuid$1 } = cjsBrowser;
1471
1552
 
1472
1553
  var createPatch$1 = function createPatch(original, dto, options) {
1473
1554
  let subject = toCompareObject({ d: original }, options, true);
@@ -1587,6 +1668,8 @@ var createPatch$1 = function createPatch(original, dto, options) {
1587
1668
 
1588
1669
  };
1589
1670
 
1671
+ /*! Axios v1.8.3 Copyright (c) 2025 Matt Zabriskie and contributors */
1672
+
1590
1673
  function bind(fn, thisArg) {
1591
1674
  return function wrap() {
1592
1675
  return fn.apply(thisArg, arguments);
@@ -1800,6 +1883,8 @@ const isFormData = (thing) => {
1800
1883
  */
1801
1884
  const isURLSearchParams = kindOfTest('URLSearchParams');
1802
1885
 
1886
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
1887
+
1803
1888
  /**
1804
1889
  * Trim excess whitespace off the beginning and end of a string
1805
1890
  *
@@ -2188,28 +2273,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
2188
2273
  const noop = () => {};
2189
2274
 
2190
2275
  const toFiniteNumber = (value, defaultValue) => {
2191
- value = +value;
2192
- return Number.isFinite(value) ? value : defaultValue;
2193
- };
2194
-
2195
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
2196
-
2197
- const DIGIT = '0123456789';
2198
-
2199
- const ALPHABET = {
2200
- DIGIT,
2201
- ALPHA,
2202
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
2203
- };
2204
-
2205
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
2206
- let str = '';
2207
- const {length} = alphabet;
2208
- while (size--) {
2209
- str += alphabet[Math.random() * length|0];
2210
- }
2211
-
2212
- return str;
2276
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
2213
2277
  };
2214
2278
 
2215
2279
  /**
@@ -2259,6 +2323,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
2259
2323
  const isThenable = (thing) =>
2260
2324
  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
2261
2325
 
2326
+ // original code
2327
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
2328
+
2329
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
2330
+ if (setImmediateSupported) {
2331
+ return setImmediate;
2332
+ }
2333
+
2334
+ return postMessageSupported ? ((token, callbacks) => {
2335
+ _global.addEventListener("message", ({source, data}) => {
2336
+ if (source === _global && data === token) {
2337
+ callbacks.length && callbacks.shift()();
2338
+ }
2339
+ }, false);
2340
+
2341
+ return (cb) => {
2342
+ callbacks.push(cb);
2343
+ _global.postMessage(token, "*");
2344
+ }
2345
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
2346
+ })(
2347
+ typeof setImmediate === 'function',
2348
+ isFunction(_global.postMessage)
2349
+ );
2350
+
2351
+ const asap = typeof queueMicrotask !== 'undefined' ?
2352
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
2353
+
2354
+ // *********************
2355
+
2262
2356
  var utils$1 = {
2263
2357
  isArray,
2264
2358
  isArrayBuffer,
@@ -2270,6 +2364,10 @@ var utils$1 = {
2270
2364
  isBoolean,
2271
2365
  isObject,
2272
2366
  isPlainObject,
2367
+ isReadableStream,
2368
+ isRequest,
2369
+ isResponse,
2370
+ isHeaders,
2273
2371
  isUndefined,
2274
2372
  isDate,
2275
2373
  isFile,
@@ -2305,12 +2403,12 @@ var utils$1 = {
2305
2403
  findKey,
2306
2404
  global: _global,
2307
2405
  isContextDefined,
2308
- ALPHABET,
2309
- generateString,
2310
2406
  isSpecCompliantForm,
2311
2407
  toJSONObject,
2312
2408
  isAsyncFn,
2313
- isThenable
2409
+ isThenable,
2410
+ setImmediate: _setImmediate,
2411
+ asap
2314
2412
  };
2315
2413
 
2316
2414
  /**
@@ -2338,7 +2436,10 @@ function AxiosError(message, code, config, request, response) {
2338
2436
  code && (this.code = code);
2339
2437
  config && (this.config = config);
2340
2438
  request && (this.request = request);
2341
- response && (this.response = response);
2439
+ if (response) {
2440
+ this.response = response;
2441
+ this.status = response.status ? response.status : null;
2442
+ }
2342
2443
  }
2343
2444
 
2344
2445
  utils$1.inherits(AxiosError, Error, {
@@ -2358,7 +2459,7 @@ utils$1.inherits(AxiosError, Error, {
2358
2459
  // Axios
2359
2460
  config: utils$1.toJSONObject(this.config),
2360
2461
  code: this.code,
2361
- status: this.response && this.response.status ? this.response.status : null
2462
+ status: this.status
2362
2463
  };
2363
2464
  }
2364
2465
  });
@@ -2698,7 +2799,7 @@ function encode(val) {
2698
2799
  *
2699
2800
  * @param {string} url The base of the url (e.g., http://www.google.com)
2700
2801
  * @param {object} [params] The params to be appended
2701
- * @param {?object} options
2802
+ * @param {?(object|Function)} options
2702
2803
  *
2703
2804
  * @returns {string} The formatted url
2704
2805
  */
@@ -2710,6 +2811,12 @@ function buildURL(url, params, options) {
2710
2811
 
2711
2812
  const _encode = options && options.encode || encode;
2712
2813
 
2814
+ if (utils$1.isFunction(options)) {
2815
+ options = {
2816
+ serialize: options
2817
+ };
2818
+ }
2819
+
2713
2820
  const serializeFn = options && options.serialize;
2714
2821
 
2715
2822
  let serializedParams;
@@ -2826,6 +2933,8 @@ var platform$1 = {
2826
2933
 
2827
2934
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2828
2935
 
2936
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
2937
+
2829
2938
  /**
2830
2939
  * Determine if we're running in a standard browser environment
2831
2940
  *
@@ -2843,10 +2952,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
2843
2952
  *
2844
2953
  * @returns {boolean}
2845
2954
  */
2846
- const hasStandardBrowserEnv = (
2847
- (product) => {
2848
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
2849
- })(typeof navigator !== 'undefined' && navigator.product);
2955
+ const hasStandardBrowserEnv = hasBrowserEnv &&
2956
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2850
2957
 
2851
2958
  /**
2852
2959
  * Determine if we're running in a standard browser webWorker environment
@@ -2866,11 +2973,15 @@ const hasStandardBrowserWebWorkerEnv = (() => {
2866
2973
  );
2867
2974
  })();
2868
2975
 
2976
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
2977
+
2869
2978
  var utils = /*#__PURE__*/Object.freeze({
2870
2979
  __proto__: null,
2871
2980
  hasBrowserEnv: hasBrowserEnv,
2872
2981
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2873
- hasStandardBrowserEnv: hasStandardBrowserEnv
2982
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
2983
+ navigator: _navigator,
2984
+ origin: origin
2874
2985
  });
2875
2986
 
2876
2987
  var platform = {
@@ -2938,6 +3049,9 @@ function arrayToObject(arr) {
2938
3049
  function formDataToJSON(formData) {
2939
3050
  function buildPath(path, value, target, index) {
2940
3051
  let name = path[index++];
3052
+
3053
+ if (name === '__proto__') return true;
3054
+
2941
3055
  const isNumericKey = Number.isFinite(+name);
2942
3056
  const isLast = index >= path.length;
2943
3057
  name = !name && utils$1.isArray(target) ? target.length : name;
@@ -3007,7 +3121,7 @@ const defaults = {
3007
3121
 
3008
3122
  transitional: transitionalDefaults,
3009
3123
 
3010
- adapter: ['xhr', 'http'],
3124
+ adapter: ['xhr', 'http', 'fetch'],
3011
3125
 
3012
3126
  transformRequest: [function transformRequest(data, headers) {
3013
3127
  const contentType = headers.getContentType() || '';
@@ -3021,9 +3135,6 @@ const defaults = {
3021
3135
  const isFormData = utils$1.isFormData(data);
3022
3136
 
3023
3137
  if (isFormData) {
3024
- if (!hasJSONContentType) {
3025
- return data;
3026
- }
3027
3138
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
3028
3139
  }
3029
3140
 
@@ -3031,7 +3142,8 @@ const defaults = {
3031
3142
  utils$1.isBuffer(data) ||
3032
3143
  utils$1.isStream(data) ||
3033
3144
  utils$1.isFile(data) ||
3034
- utils$1.isBlob(data)
3145
+ utils$1.isBlob(data) ||
3146
+ utils$1.isReadableStream(data)
3035
3147
  ) {
3036
3148
  return data;
3037
3149
  }
@@ -3074,6 +3186,10 @@ const defaults = {
3074
3186
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
3075
3187
  const JSONRequested = this.responseType === 'json';
3076
3188
 
3189
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
3190
+ return data;
3191
+ }
3192
+
3077
3193
  if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
3078
3194
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
3079
3195
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -3277,6 +3393,10 @@ class AxiosHeaders {
3277
3393
  setHeaders(header, valueOrRewrite);
3278
3394
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
3279
3395
  setHeaders(parseHeaders(header), valueOrRewrite);
3396
+ } else if (utils$1.isHeaders(header)) {
3397
+ for (const [key, value] of header.entries()) {
3398
+ setHeader(value, key, rewrite);
3399
+ }
3280
3400
  } else {
3281
3401
  header != null && setHeader(valueOrRewrite, header, rewrite);
3282
3402
  }
@@ -3544,10 +3664,164 @@ function settle(resolve, reject, response) {
3544
3664
  }
3545
3665
  }
3546
3666
 
3547
- var cookies = platform.hasStandardBrowserEnv ?
3667
+ function parseProtocol(url) {
3668
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
3669
+ return match && match[1] || '';
3670
+ }
3548
3671
 
3549
- // Standard browser envs support document.cookie
3550
- {
3672
+ /**
3673
+ * Calculate data maxRate
3674
+ * @param {Number} [samplesCount= 10]
3675
+ * @param {Number} [min= 1000]
3676
+ * @returns {Function}
3677
+ */
3678
+ function speedometer(samplesCount, min) {
3679
+ samplesCount = samplesCount || 10;
3680
+ const bytes = new Array(samplesCount);
3681
+ const timestamps = new Array(samplesCount);
3682
+ let head = 0;
3683
+ let tail = 0;
3684
+ let firstSampleTS;
3685
+
3686
+ min = min !== undefined ? min : 1000;
3687
+
3688
+ return function push(chunkLength) {
3689
+ const now = Date.now();
3690
+
3691
+ const startedAt = timestamps[tail];
3692
+
3693
+ if (!firstSampleTS) {
3694
+ firstSampleTS = now;
3695
+ }
3696
+
3697
+ bytes[head] = chunkLength;
3698
+ timestamps[head] = now;
3699
+
3700
+ let i = tail;
3701
+ let bytesCount = 0;
3702
+
3703
+ while (i !== head) {
3704
+ bytesCount += bytes[i++];
3705
+ i = i % samplesCount;
3706
+ }
3707
+
3708
+ head = (head + 1) % samplesCount;
3709
+
3710
+ if (head === tail) {
3711
+ tail = (tail + 1) % samplesCount;
3712
+ }
3713
+
3714
+ if (now - firstSampleTS < min) {
3715
+ return;
3716
+ }
3717
+
3718
+ const passed = startedAt && now - startedAt;
3719
+
3720
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
3721
+ };
3722
+ }
3723
+
3724
+ /**
3725
+ * Throttle decorator
3726
+ * @param {Function} fn
3727
+ * @param {Number} freq
3728
+ * @return {Function}
3729
+ */
3730
+ function throttle(fn, freq) {
3731
+ let timestamp = 0;
3732
+ let threshold = 1000 / freq;
3733
+ let lastArgs;
3734
+ let timer;
3735
+
3736
+ const invoke = (args, now = Date.now()) => {
3737
+ timestamp = now;
3738
+ lastArgs = null;
3739
+ if (timer) {
3740
+ clearTimeout(timer);
3741
+ timer = null;
3742
+ }
3743
+ fn.apply(null, args);
3744
+ };
3745
+
3746
+ const throttled = (...args) => {
3747
+ const now = Date.now();
3748
+ const passed = now - timestamp;
3749
+ if ( passed >= threshold) {
3750
+ invoke(args, now);
3751
+ } else {
3752
+ lastArgs = args;
3753
+ if (!timer) {
3754
+ timer = setTimeout(() => {
3755
+ timer = null;
3756
+ invoke(lastArgs);
3757
+ }, threshold - passed);
3758
+ }
3759
+ }
3760
+ };
3761
+
3762
+ const flush = () => lastArgs && invoke(lastArgs);
3763
+
3764
+ return [throttled, flush];
3765
+ }
3766
+
3767
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
3768
+ let bytesNotified = 0;
3769
+ const _speedometer = speedometer(50, 250);
3770
+
3771
+ return throttle(e => {
3772
+ const loaded = e.loaded;
3773
+ const total = e.lengthComputable ? e.total : undefined;
3774
+ const progressBytes = loaded - bytesNotified;
3775
+ const rate = _speedometer(progressBytes);
3776
+ const inRange = loaded <= total;
3777
+
3778
+ bytesNotified = loaded;
3779
+
3780
+ const data = {
3781
+ loaded,
3782
+ total,
3783
+ progress: total ? (loaded / total) : undefined,
3784
+ bytes: progressBytes,
3785
+ rate: rate ? rate : undefined,
3786
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
3787
+ event: e,
3788
+ lengthComputable: total != null,
3789
+ [isDownloadStream ? 'download' : 'upload']: true
3790
+ };
3791
+
3792
+ listener(data);
3793
+ }, freq);
3794
+ };
3795
+
3796
+ const progressEventDecorator = (total, throttled) => {
3797
+ const lengthComputable = total != null;
3798
+
3799
+ return [(loaded) => throttled[0]({
3800
+ lengthComputable,
3801
+ total,
3802
+ loaded
3803
+ }), throttled[1]];
3804
+ };
3805
+
3806
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
3807
+
3808
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
3809
+ url = new URL(url, platform.origin);
3810
+
3811
+ return (
3812
+ origin.protocol === url.protocol &&
3813
+ origin.host === url.host &&
3814
+ (isMSIE || origin.port === url.port)
3815
+ );
3816
+ })(
3817
+ new URL(platform.origin),
3818
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
3819
+ ) : () => true;
3820
+
3821
+ var cookies = platform.hasStandardBrowserEnv ?
3822
+
3823
+ // Standard browser envs support document.cookie
3824
+ {
3551
3825
  write(name, value, expires, path, domain, secure) {
3552
3826
  const cookie = [name + '=' + encodeURIComponent(value)];
3553
3827
 
@@ -3607,7 +3881,7 @@ function isAbsoluteURL(url) {
3607
3881
  */
3608
3882
  function combineURLs(baseURL, relativeURL) {
3609
3883
  return relativeURL
3610
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
3884
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
3611
3885
  : baseURL;
3612
3886
  }
3613
3887
 
@@ -3621,207 +3895,191 @@ function combineURLs(baseURL, relativeURL) {
3621
3895
  *
3622
3896
  * @returns {string} The combined full path
3623
3897
  */
3624
- function buildFullPath(baseURL, requestedURL) {
3625
- if (baseURL && !isAbsoluteURL(requestedURL)) {
3898
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
3899
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
3900
+ if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
3626
3901
  return combineURLs(baseURL, requestedURL);
3627
3902
  }
3628
3903
  return requestedURL;
3629
3904
  }
3630
3905
 
3631
- var isURLSameOrigin = platform.hasStandardBrowserEnv ?
3632
-
3633
- // Standard browser envs have full support of the APIs needed to test
3634
- // whether the request URL is of the same origin as current location.
3635
- (function standardBrowserEnv() {
3636
- const msie = /(msie|trident)/i.test(navigator.userAgent);
3637
- const urlParsingNode = document.createElement('a');
3638
- let originURL;
3639
-
3640
- /**
3641
- * Parse a URL to discover its components
3642
- *
3643
- * @param {String} url The URL to be parsed
3644
- * @returns {Object}
3645
- */
3646
- function resolveURL(url) {
3647
- let href = url;
3648
-
3649
- if (msie) {
3650
- // IE needs attribute set twice to normalize properties
3651
- urlParsingNode.setAttribute('href', href);
3652
- href = urlParsingNode.href;
3653
- }
3654
-
3655
- urlParsingNode.setAttribute('href', href);
3656
-
3657
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
3658
- return {
3659
- href: urlParsingNode.href,
3660
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
3661
- host: urlParsingNode.host,
3662
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
3663
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
3664
- hostname: urlParsingNode.hostname,
3665
- port: urlParsingNode.port,
3666
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
3667
- urlParsingNode.pathname :
3668
- '/' + urlParsingNode.pathname
3669
- };
3670
- }
3671
-
3672
- originURL = resolveURL(window.location.href);
3673
-
3674
- /**
3675
- * Determine if a URL shares the same origin as the current location
3676
- *
3677
- * @param {String} requestURL The URL to test
3678
- * @returns {boolean} True if URL shares the same origin, otherwise false
3679
- */
3680
- return function isURLSameOrigin(requestURL) {
3681
- const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
3682
- return (parsed.protocol === originURL.protocol &&
3683
- parsed.host === originURL.host);
3684
- };
3685
- })() :
3686
-
3687
- // Non standard browser envs (web workers, react-native) lack needed support.
3688
- (function nonStandardBrowserEnv() {
3689
- return function isURLSameOrigin() {
3690
- return true;
3691
- };
3692
- })();
3693
-
3694
- function parseProtocol(url) {
3695
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
3696
- return match && match[1] || '';
3697
- }
3906
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
3698
3907
 
3699
3908
  /**
3700
- * Calculate data maxRate
3701
- * @param {Number} [samplesCount= 10]
3702
- * @param {Number} [min= 1000]
3703
- * @returns {Function}
3909
+ * Config-specific merge-function which creates a new config-object
3910
+ * by merging two configuration objects together.
3911
+ *
3912
+ * @param {Object} config1
3913
+ * @param {Object} config2
3914
+ *
3915
+ * @returns {Object} New object resulting from merging config2 to config1
3704
3916
  */
3705
- function speedometer(samplesCount, min) {
3706
- samplesCount = samplesCount || 10;
3707
- const bytes = new Array(samplesCount);
3708
- const timestamps = new Array(samplesCount);
3709
- let head = 0;
3710
- let tail = 0;
3711
- let firstSampleTS;
3917
+ function mergeConfig(config1, config2) {
3918
+ // eslint-disable-next-line no-param-reassign
3919
+ config2 = config2 || {};
3920
+ const config = {};
3712
3921
 
3713
- min = min !== undefined ? min : 1000;
3922
+ function getMergedValue(target, source, prop, caseless) {
3923
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
3924
+ return utils$1.merge.call({caseless}, target, source);
3925
+ } else if (utils$1.isPlainObject(source)) {
3926
+ return utils$1.merge({}, source);
3927
+ } else if (utils$1.isArray(source)) {
3928
+ return source.slice();
3929
+ }
3930
+ return source;
3931
+ }
3714
3932
 
3715
- return function push(chunkLength) {
3716
- const now = Date.now();
3933
+ // eslint-disable-next-line consistent-return
3934
+ function mergeDeepProperties(a, b, prop , caseless) {
3935
+ if (!utils$1.isUndefined(b)) {
3936
+ return getMergedValue(a, b, prop , caseless);
3937
+ } else if (!utils$1.isUndefined(a)) {
3938
+ return getMergedValue(undefined, a, prop , caseless);
3939
+ }
3940
+ }
3717
3941
 
3718
- const startedAt = timestamps[tail];
3942
+ // eslint-disable-next-line consistent-return
3943
+ function valueFromConfig2(a, b) {
3944
+ if (!utils$1.isUndefined(b)) {
3945
+ return getMergedValue(undefined, b);
3946
+ }
3947
+ }
3719
3948
 
3720
- if (!firstSampleTS) {
3721
- firstSampleTS = now;
3949
+ // eslint-disable-next-line consistent-return
3950
+ function defaultToConfig2(a, b) {
3951
+ if (!utils$1.isUndefined(b)) {
3952
+ return getMergedValue(undefined, b);
3953
+ } else if (!utils$1.isUndefined(a)) {
3954
+ return getMergedValue(undefined, a);
3722
3955
  }
3956
+ }
3723
3957
 
3724
- bytes[head] = chunkLength;
3725
- timestamps[head] = now;
3958
+ // eslint-disable-next-line consistent-return
3959
+ function mergeDirectKeys(a, b, prop) {
3960
+ if (prop in config2) {
3961
+ return getMergedValue(a, b);
3962
+ } else if (prop in config1) {
3963
+ return getMergedValue(undefined, a);
3964
+ }
3965
+ }
3726
3966
 
3727
- let i = tail;
3728
- let bytesCount = 0;
3967
+ const mergeMap = {
3968
+ url: valueFromConfig2,
3969
+ method: valueFromConfig2,
3970
+ data: valueFromConfig2,
3971
+ baseURL: defaultToConfig2,
3972
+ transformRequest: defaultToConfig2,
3973
+ transformResponse: defaultToConfig2,
3974
+ paramsSerializer: defaultToConfig2,
3975
+ timeout: defaultToConfig2,
3976
+ timeoutMessage: defaultToConfig2,
3977
+ withCredentials: defaultToConfig2,
3978
+ withXSRFToken: defaultToConfig2,
3979
+ adapter: defaultToConfig2,
3980
+ responseType: defaultToConfig2,
3981
+ xsrfCookieName: defaultToConfig2,
3982
+ xsrfHeaderName: defaultToConfig2,
3983
+ onUploadProgress: defaultToConfig2,
3984
+ onDownloadProgress: defaultToConfig2,
3985
+ decompress: defaultToConfig2,
3986
+ maxContentLength: defaultToConfig2,
3987
+ maxBodyLength: defaultToConfig2,
3988
+ beforeRedirect: defaultToConfig2,
3989
+ transport: defaultToConfig2,
3990
+ httpAgent: defaultToConfig2,
3991
+ httpsAgent: defaultToConfig2,
3992
+ cancelToken: defaultToConfig2,
3993
+ socketPath: defaultToConfig2,
3994
+ responseEncoding: defaultToConfig2,
3995
+ validateStatus: mergeDirectKeys,
3996
+ headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
3997
+ };
3729
3998
 
3730
- while (i !== head) {
3731
- bytesCount += bytes[i++];
3732
- i = i % samplesCount;
3733
- }
3999
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
4000
+ const merge = mergeMap[prop] || mergeDeepProperties;
4001
+ const configValue = merge(config1[prop], config2[prop], prop);
4002
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
4003
+ });
3734
4004
 
3735
- head = (head + 1) % samplesCount;
4005
+ return config;
4006
+ }
3736
4007
 
3737
- if (head === tail) {
3738
- tail = (tail + 1) % samplesCount;
3739
- }
4008
+ var resolveConfig = (config) => {
4009
+ const newConfig = mergeConfig({}, config);
3740
4010
 
3741
- if (now - firstSampleTS < min) {
3742
- return;
3743
- }
4011
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
3744
4012
 
3745
- const passed = startedAt && now - startedAt;
4013
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
3746
4014
 
3747
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
3748
- };
3749
- }
4015
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
3750
4016
 
3751
- function progressEventReducer(listener, isDownloadStream) {
3752
- let bytesNotified = 0;
3753
- const _speedometer = speedometer(50, 250);
4017
+ // HTTP basic authentication
4018
+ if (auth) {
4019
+ headers.set('Authorization', 'Basic ' +
4020
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
4021
+ );
4022
+ }
3754
4023
 
3755
- return e => {
3756
- const loaded = e.loaded;
3757
- const total = e.lengthComputable ? e.total : undefined;
3758
- const progressBytes = loaded - bytesNotified;
3759
- const rate = _speedometer(progressBytes);
3760
- const inRange = loaded <= total;
4024
+ let contentType;
3761
4025
 
3762
- bytesNotified = loaded;
4026
+ if (utils$1.isFormData(data)) {
4027
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
4028
+ headers.setContentType(undefined); // Let the browser set it
4029
+ } else if ((contentType = headers.getContentType()) !== false) {
4030
+ // fix semicolon duplication issue for ReactNative FormData implementation
4031
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
4032
+ headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
4033
+ }
4034
+ }
3763
4035
 
3764
- const data = {
3765
- loaded,
3766
- total,
3767
- progress: total ? (loaded / total) : undefined,
3768
- bytes: progressBytes,
3769
- rate: rate ? rate : undefined,
3770
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
3771
- event: e
3772
- };
4036
+ // Add xsrf header
4037
+ // This is only done if running in a standard browser environment.
4038
+ // Specifically not if we're in a web worker, or react-native.
3773
4039
 
3774
- data[isDownloadStream ? 'download' : 'upload'] = true;
4040
+ if (platform.hasStandardBrowserEnv) {
4041
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
3775
4042
 
3776
- listener(data);
3777
- };
3778
- }
4043
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
4044
+ // Add xsrf header
4045
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
4046
+
4047
+ if (xsrfValue) {
4048
+ headers.set(xsrfHeaderName, xsrfValue);
4049
+ }
4050
+ }
4051
+ }
4052
+
4053
+ return newConfig;
4054
+ };
3779
4055
 
3780
4056
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
3781
4057
 
3782
4058
  var xhrAdapter = isXHRAdapterSupported && function (config) {
3783
4059
  return new Promise(function dispatchXhrRequest(resolve, reject) {
3784
- let requestData = config.data;
3785
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
3786
- let {responseType, withXSRFToken} = config;
4060
+ const _config = resolveConfig(config);
4061
+ let requestData = _config.data;
4062
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
4063
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
3787
4064
  let onCanceled;
3788
- function done() {
3789
- if (config.cancelToken) {
3790
- config.cancelToken.unsubscribe(onCanceled);
3791
- }
4065
+ let uploadThrottled, downloadThrottled;
4066
+ let flushUpload, flushDownload;
3792
4067
 
3793
- if (config.signal) {
3794
- config.signal.removeEventListener('abort', onCanceled);
3795
- }
3796
- }
4068
+ function done() {
4069
+ flushUpload && flushUpload(); // flush events
4070
+ flushDownload && flushDownload(); // flush events
3797
4071
 
3798
- let contentType;
4072
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
3799
4073
 
3800
- if (utils$1.isFormData(requestData)) {
3801
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3802
- requestHeaders.setContentType(false); // Let the browser set it
3803
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
3804
- // fix semicolon duplication issue for ReactNative FormData implementation
3805
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
3806
- requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
3807
- }
4074
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
3808
4075
  }
3809
4076
 
3810
4077
  let request = new XMLHttpRequest();
3811
4078
 
3812
- // HTTP basic authentication
3813
- if (config.auth) {
3814
- const username = config.auth.username || '';
3815
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
3816
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
3817
- }
3818
-
3819
- const fullPath = buildFullPath(config.baseURL, config.url);
3820
-
3821
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
4079
+ request.open(_config.method.toUpperCase(), _config.url, true);
3822
4080
 
3823
4081
  // Set the request timeout in MS
3824
- request.timeout = config.timeout;
4082
+ request.timeout = _config.timeout;
3825
4083
 
3826
4084
  function onloadend() {
3827
4085
  if (!request) {
@@ -3850,152 +4108,492 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3850
4108
  done();
3851
4109
  }, response);
3852
4110
 
3853
- // Clean up request
3854
- request = null;
3855
- }
4111
+ // Clean up request
4112
+ request = null;
4113
+ }
4114
+
4115
+ if ('onloadend' in request) {
4116
+ // Use onloadend if available
4117
+ request.onloadend = onloadend;
4118
+ } else {
4119
+ // Listen for ready state to emulate onloadend
4120
+ request.onreadystatechange = function handleLoad() {
4121
+ if (!request || request.readyState !== 4) {
4122
+ return;
4123
+ }
4124
+
4125
+ // The request errored out and we didn't get a response, this will be
4126
+ // handled by onerror instead
4127
+ // With one exception: request that using file: protocol, most browsers
4128
+ // will return status as 0 even though it's a successful request
4129
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
4130
+ return;
4131
+ }
4132
+ // readystate handler is calling before onerror or ontimeout handlers,
4133
+ // so we should call onloadend on the next 'tick'
4134
+ setTimeout(onloadend);
4135
+ };
4136
+ }
4137
+
4138
+ // Handle browser request cancellation (as opposed to a manual cancellation)
4139
+ request.onabort = function handleAbort() {
4140
+ if (!request) {
4141
+ return;
4142
+ }
4143
+
4144
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
4145
+
4146
+ // Clean up request
4147
+ request = null;
4148
+ };
4149
+
4150
+ // Handle low level network errors
4151
+ request.onerror = function handleError() {
4152
+ // Real errors are hidden from us by the browser
4153
+ // onerror should only fire if it's a network error
4154
+ reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
4155
+
4156
+ // Clean up request
4157
+ request = null;
4158
+ };
4159
+
4160
+ // Handle timeout
4161
+ request.ontimeout = function handleTimeout() {
4162
+ let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
4163
+ const transitional = _config.transitional || transitionalDefaults;
4164
+ if (_config.timeoutErrorMessage) {
4165
+ timeoutErrorMessage = _config.timeoutErrorMessage;
4166
+ }
4167
+ reject(new AxiosError(
4168
+ timeoutErrorMessage,
4169
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
4170
+ config,
4171
+ request));
4172
+
4173
+ // Clean up request
4174
+ request = null;
4175
+ };
4176
+
4177
+ // Remove Content-Type if data is undefined
4178
+ requestData === undefined && requestHeaders.setContentType(null);
4179
+
4180
+ // Add headers to the request
4181
+ if ('setRequestHeader' in request) {
4182
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
4183
+ request.setRequestHeader(key, val);
4184
+ });
4185
+ }
4186
+
4187
+ // Add withCredentials to request if needed
4188
+ if (!utils$1.isUndefined(_config.withCredentials)) {
4189
+ request.withCredentials = !!_config.withCredentials;
4190
+ }
4191
+
4192
+ // Add responseType to request if needed
4193
+ if (responseType && responseType !== 'json') {
4194
+ request.responseType = _config.responseType;
4195
+ }
4196
+
4197
+ // Handle progress if needed
4198
+ if (onDownloadProgress) {
4199
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
4200
+ request.addEventListener('progress', downloadThrottled);
4201
+ }
4202
+
4203
+ // Not all browsers support upload events
4204
+ if (onUploadProgress && request.upload) {
4205
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
4206
+
4207
+ request.upload.addEventListener('progress', uploadThrottled);
4208
+
4209
+ request.upload.addEventListener('loadend', flushUpload);
4210
+ }
4211
+
4212
+ if (_config.cancelToken || _config.signal) {
4213
+ // Handle cancellation
4214
+ // eslint-disable-next-line func-names
4215
+ onCanceled = cancel => {
4216
+ if (!request) {
4217
+ return;
4218
+ }
4219
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
4220
+ request.abort();
4221
+ request = null;
4222
+ };
4223
+
4224
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
4225
+ if (_config.signal) {
4226
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
4227
+ }
4228
+ }
4229
+
4230
+ const protocol = parseProtocol(_config.url);
4231
+
4232
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
4233
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
4234
+ return;
4235
+ }
4236
+
4237
+
4238
+ // Send the request
4239
+ request.send(requestData || null);
4240
+ });
4241
+ };
4242
+
4243
+ const composeSignals = (signals, timeout) => {
4244
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
4245
+
4246
+ if (timeout || length) {
4247
+ let controller = new AbortController();
4248
+
4249
+ let aborted;
4250
+
4251
+ const onabort = function (reason) {
4252
+ if (!aborted) {
4253
+ aborted = true;
4254
+ unsubscribe();
4255
+ const err = reason instanceof Error ? reason : this.reason;
4256
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
4257
+ }
4258
+ };
4259
+
4260
+ let timer = timeout && setTimeout(() => {
4261
+ timer = null;
4262
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
4263
+ }, timeout);
4264
+
4265
+ const unsubscribe = () => {
4266
+ if (signals) {
4267
+ timer && clearTimeout(timer);
4268
+ timer = null;
4269
+ signals.forEach(signal => {
4270
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
4271
+ });
4272
+ signals = null;
4273
+ }
4274
+ };
4275
+
4276
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
4277
+
4278
+ const {signal} = controller;
4279
+
4280
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
4281
+
4282
+ return signal;
4283
+ }
4284
+ };
4285
+
4286
+ var composeSignals$1 = composeSignals;
4287
+
4288
+ const streamChunk = function* (chunk, chunkSize) {
4289
+ let len = chunk.byteLength;
4290
+
4291
+ if (!chunkSize || len < chunkSize) {
4292
+ yield chunk;
4293
+ return;
4294
+ }
4295
+
4296
+ let pos = 0;
4297
+ let end;
4298
+
4299
+ while (pos < len) {
4300
+ end = pos + chunkSize;
4301
+ yield chunk.slice(pos, end);
4302
+ pos = end;
4303
+ }
4304
+ };
4305
+
4306
+ const readBytes = async function* (iterable, chunkSize) {
4307
+ for await (const chunk of readStream(iterable)) {
4308
+ yield* streamChunk(chunk, chunkSize);
4309
+ }
4310
+ };
4311
+
4312
+ const readStream = async function* (stream) {
4313
+ if (stream[Symbol.asyncIterator]) {
4314
+ yield* stream;
4315
+ return;
4316
+ }
4317
+
4318
+ const reader = stream.getReader();
4319
+ try {
4320
+ for (;;) {
4321
+ const {done, value} = await reader.read();
4322
+ if (done) {
4323
+ break;
4324
+ }
4325
+ yield value;
4326
+ }
4327
+ } finally {
4328
+ await reader.cancel();
4329
+ }
4330
+ };
4331
+
4332
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
4333
+ const iterator = readBytes(stream, chunkSize);
4334
+
4335
+ let bytes = 0;
4336
+ let done;
4337
+ let _onFinish = (e) => {
4338
+ if (!done) {
4339
+ done = true;
4340
+ onFinish && onFinish(e);
4341
+ }
4342
+ };
4343
+
4344
+ return new ReadableStream({
4345
+ async pull(controller) {
4346
+ try {
4347
+ const {done, value} = await iterator.next();
4348
+
4349
+ if (done) {
4350
+ _onFinish();
4351
+ controller.close();
4352
+ return;
4353
+ }
4354
+
4355
+ let len = value.byteLength;
4356
+ if (onProgress) {
4357
+ let loadedBytes = bytes += len;
4358
+ onProgress(loadedBytes);
4359
+ }
4360
+ controller.enqueue(new Uint8Array(value));
4361
+ } catch (err) {
4362
+ _onFinish(err);
4363
+ throw err;
4364
+ }
4365
+ },
4366
+ cancel(reason) {
4367
+ _onFinish(reason);
4368
+ return iterator.return();
4369
+ }
4370
+ }, {
4371
+ highWaterMark: 2
4372
+ })
4373
+ };
4374
+
4375
+ const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
4376
+ const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
4377
+
4378
+ // used only inside the fetch adapter
4379
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
4380
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
4381
+ async (str) => new Uint8Array(await new Response(str).arrayBuffer())
4382
+ );
4383
+
4384
+ const test = (fn, ...args) => {
4385
+ try {
4386
+ return !!fn(...args);
4387
+ } catch (e) {
4388
+ return false
4389
+ }
4390
+ };
4391
+
4392
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
4393
+ let duplexAccessed = false;
4394
+
4395
+ const hasContentType = new Request(platform.origin, {
4396
+ body: new ReadableStream(),
4397
+ method: 'POST',
4398
+ get duplex() {
4399
+ duplexAccessed = true;
4400
+ return 'half';
4401
+ },
4402
+ }).headers.has('Content-Type');
4403
+
4404
+ return duplexAccessed && !hasContentType;
4405
+ });
4406
+
4407
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
4408
+
4409
+ const supportsResponseStream = isReadableStreamSupported &&
4410
+ test(() => utils$1.isReadableStream(new Response('').body));
4411
+
4412
+
4413
+ const resolvers = {
4414
+ stream: supportsResponseStream && ((res) => res.body)
4415
+ };
3856
4416
 
3857
- if ('onloadend' in request) {
3858
- // Use onloadend if available
3859
- request.onloadend = onloadend;
3860
- } else {
3861
- // Listen for ready state to emulate onloadend
3862
- request.onreadystatechange = function handleLoad() {
3863
- if (!request || request.readyState !== 4) {
3864
- return;
3865
- }
4417
+ isFetchSupported && (((res) => {
4418
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
4419
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
4420
+ (_, config) => {
4421
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
4422
+ });
4423
+ });
4424
+ })(new Response));
3866
4425
 
3867
- // The request errored out and we didn't get a response, this will be
3868
- // handled by onerror instead
3869
- // With one exception: request that using file: protocol, most browsers
3870
- // will return status as 0 even though it's a successful request
3871
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
3872
- return;
3873
- }
3874
- // readystate handler is calling before onerror or ontimeout handlers,
3875
- // so we should call onloadend on the next 'tick'
3876
- setTimeout(onloadend);
3877
- };
3878
- }
4426
+ const getBodyLength = async (body) => {
4427
+ if (body == null) {
4428
+ return 0;
4429
+ }
3879
4430
 
3880
- // Handle browser request cancellation (as opposed to a manual cancellation)
3881
- request.onabort = function handleAbort() {
3882
- if (!request) {
3883
- return;
3884
- }
4431
+ if(utils$1.isBlob(body)) {
4432
+ return body.size;
4433
+ }
3885
4434
 
3886
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
4435
+ if(utils$1.isSpecCompliantForm(body)) {
4436
+ const _request = new Request(platform.origin, {
4437
+ method: 'POST',
4438
+ body,
4439
+ });
4440
+ return (await _request.arrayBuffer()).byteLength;
4441
+ }
3887
4442
 
3888
- // Clean up request
3889
- request = null;
3890
- };
4443
+ if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
4444
+ return body.byteLength;
4445
+ }
3891
4446
 
3892
- // Handle low level network errors
3893
- request.onerror = function handleError() {
3894
- // Real errors are hidden from us by the browser
3895
- // onerror should only fire if it's a network error
3896
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
4447
+ if(utils$1.isURLSearchParams(body)) {
4448
+ body = body + '';
4449
+ }
3897
4450
 
3898
- // Clean up request
3899
- request = null;
3900
- };
4451
+ if(utils$1.isString(body)) {
4452
+ return (await encodeText(body)).byteLength;
4453
+ }
4454
+ };
3901
4455
 
3902
- // Handle timeout
3903
- request.ontimeout = function handleTimeout() {
3904
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
3905
- const transitional = config.transitional || transitionalDefaults;
3906
- if (config.timeoutErrorMessage) {
3907
- timeoutErrorMessage = config.timeoutErrorMessage;
3908
- }
3909
- reject(new AxiosError(
3910
- timeoutErrorMessage,
3911
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
3912
- config,
3913
- request));
4456
+ const resolveBodyLength = async (headers, body) => {
4457
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
3914
4458
 
3915
- // Clean up request
3916
- request = null;
3917
- };
4459
+ return length == null ? getBodyLength(body) : length;
4460
+ };
3918
4461
 
3919
- // Add xsrf header
3920
- // This is only done if running in a standard browser environment.
3921
- // Specifically not if we're in a web worker, or react-native.
3922
- if(platform.hasStandardBrowserEnv) {
3923
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
4462
+ var fetchAdapter = isFetchSupported && (async (config) => {
4463
+ let {
4464
+ url,
4465
+ method,
4466
+ data,
4467
+ signal,
4468
+ cancelToken,
4469
+ timeout,
4470
+ onDownloadProgress,
4471
+ onUploadProgress,
4472
+ responseType,
4473
+ headers,
4474
+ withCredentials = 'same-origin',
4475
+ fetchOptions
4476
+ } = resolveConfig(config);
4477
+
4478
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
4479
+
4480
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
4481
+
4482
+ let request;
4483
+
4484
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
4485
+ composedSignal.unsubscribe();
4486
+ });
3924
4487
 
3925
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
3926
- // Add xsrf header
3927
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
4488
+ let requestContentLength;
3928
4489
 
3929
- if (xsrfValue) {
3930
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
3931
- }
4490
+ try {
4491
+ if (
4492
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
4493
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
4494
+ ) {
4495
+ let _request = new Request(url, {
4496
+ method: 'POST',
4497
+ body: data,
4498
+ duplex: "half"
4499
+ });
4500
+
4501
+ let contentTypeHeader;
4502
+
4503
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
4504
+ headers.setContentType(contentTypeHeader);
3932
4505
  }
3933
- }
3934
4506
 
3935
- // Remove Content-Type if data is undefined
3936
- requestData === undefined && requestHeaders.setContentType(null);
4507
+ if (_request.body) {
4508
+ const [onProgress, flush] = progressEventDecorator(
4509
+ requestContentLength,
4510
+ progressEventReducer(asyncDecorator(onUploadProgress))
4511
+ );
3937
4512
 
3938
- // Add headers to the request
3939
- if ('setRequestHeader' in request) {
3940
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3941
- request.setRequestHeader(key, val);
3942
- });
4513
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
4514
+ }
3943
4515
  }
3944
4516
 
3945
- // Add withCredentials to request if needed
3946
- if (!utils$1.isUndefined(config.withCredentials)) {
3947
- request.withCredentials = !!config.withCredentials;
4517
+ if (!utils$1.isString(withCredentials)) {
4518
+ withCredentials = withCredentials ? 'include' : 'omit';
3948
4519
  }
3949
4520
 
3950
- // Add responseType to request if needed
3951
- if (responseType && responseType !== 'json') {
3952
- request.responseType = config.responseType;
3953
- }
4521
+ // Cloudflare Workers throws when credentials are defined
4522
+ // see https://github.com/cloudflare/workerd/issues/902
4523
+ const isCredentialsSupported = "credentials" in Request.prototype;
4524
+ request = new Request(url, {
4525
+ ...fetchOptions,
4526
+ signal: composedSignal,
4527
+ method: method.toUpperCase(),
4528
+ headers: headers.normalize().toJSON(),
4529
+ body: data,
4530
+ duplex: "half",
4531
+ credentials: isCredentialsSupported ? withCredentials : undefined
4532
+ });
3954
4533
 
3955
- // Handle progress if needed
3956
- if (typeof config.onDownloadProgress === 'function') {
3957
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
3958
- }
4534
+ let response = await fetch(request);
3959
4535
 
3960
- // Not all browsers support upload events
3961
- if (typeof config.onUploadProgress === 'function' && request.upload) {
3962
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
3963
- }
4536
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3964
4537
 
3965
- if (config.cancelToken || config.signal) {
3966
- // Handle cancellation
3967
- // eslint-disable-next-line func-names
3968
- onCanceled = cancel => {
3969
- if (!request) {
3970
- return;
3971
- }
3972
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3973
- request.abort();
3974
- request = null;
3975
- };
4538
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
4539
+ const options = {};
3976
4540
 
3977
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
3978
- if (config.signal) {
3979
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
3980
- }
3981
- }
4541
+ ['status', 'statusText', 'headers'].forEach(prop => {
4542
+ options[prop] = response[prop];
4543
+ });
3982
4544
 
3983
- const protocol = parseProtocol(fullPath);
4545
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3984
4546
 
3985
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
3986
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3987
- return;
4547
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
4548
+ responseContentLength,
4549
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
4550
+ ) || [];
4551
+
4552
+ response = new Response(
4553
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
4554
+ flush && flush();
4555
+ unsubscribe && unsubscribe();
4556
+ }),
4557
+ options
4558
+ );
3988
4559
  }
3989
4560
 
4561
+ responseType = responseType || 'text';
3990
4562
 
3991
- // Send the request
3992
- request.send(requestData || null);
3993
- });
3994
- };
4563
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
4564
+
4565
+ !isStreamResponse && unsubscribe && unsubscribe();
4566
+
4567
+ return await new Promise((resolve, reject) => {
4568
+ settle(resolve, reject, {
4569
+ data: responseData,
4570
+ headers: AxiosHeaders$1.from(response.headers),
4571
+ status: response.status,
4572
+ statusText: response.statusText,
4573
+ config,
4574
+ request
4575
+ });
4576
+ })
4577
+ } catch (err) {
4578
+ unsubscribe && unsubscribe();
4579
+
4580
+ if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
4581
+ throw Object.assign(
4582
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
4583
+ {
4584
+ cause: err.cause || err
4585
+ }
4586
+ )
4587
+ }
4588
+
4589
+ throw AxiosError.from(err, err && err.code, config, request);
4590
+ }
4591
+ });
3995
4592
 
3996
4593
  const knownAdapters = {
3997
4594
  http: httpAdapter$1,
3998
- xhr: xhrAdapter
4595
+ xhr: xhrAdapter,
4596
+ fetch: fetchAdapter
3999
4597
  };
4000
4598
 
4001
4599
  utils$1.forEach(knownAdapters, (fn, value) => {
@@ -4139,109 +4737,7 @@ function dispatchRequest(config) {
4139
4737
  });
4140
4738
  }
4141
4739
 
4142
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
4143
-
4144
- /**
4145
- * Config-specific merge-function which creates a new config-object
4146
- * by merging two configuration objects together.
4147
- *
4148
- * @param {Object} config1
4149
- * @param {Object} config2
4150
- *
4151
- * @returns {Object} New object resulting from merging config2 to config1
4152
- */
4153
- function mergeConfig(config1, config2) {
4154
- // eslint-disable-next-line no-param-reassign
4155
- config2 = config2 || {};
4156
- const config = {};
4157
-
4158
- function getMergedValue(target, source, caseless) {
4159
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
4160
- return utils$1.merge.call({caseless}, target, source);
4161
- } else if (utils$1.isPlainObject(source)) {
4162
- return utils$1.merge({}, source);
4163
- } else if (utils$1.isArray(source)) {
4164
- return source.slice();
4165
- }
4166
- return source;
4167
- }
4168
-
4169
- // eslint-disable-next-line consistent-return
4170
- function mergeDeepProperties(a, b, caseless) {
4171
- if (!utils$1.isUndefined(b)) {
4172
- return getMergedValue(a, b, caseless);
4173
- } else if (!utils$1.isUndefined(a)) {
4174
- return getMergedValue(undefined, a, caseless);
4175
- }
4176
- }
4177
-
4178
- // eslint-disable-next-line consistent-return
4179
- function valueFromConfig2(a, b) {
4180
- if (!utils$1.isUndefined(b)) {
4181
- return getMergedValue(undefined, b);
4182
- }
4183
- }
4184
-
4185
- // eslint-disable-next-line consistent-return
4186
- function defaultToConfig2(a, b) {
4187
- if (!utils$1.isUndefined(b)) {
4188
- return getMergedValue(undefined, b);
4189
- } else if (!utils$1.isUndefined(a)) {
4190
- return getMergedValue(undefined, a);
4191
- }
4192
- }
4193
-
4194
- // eslint-disable-next-line consistent-return
4195
- function mergeDirectKeys(a, b, prop) {
4196
- if (prop in config2) {
4197
- return getMergedValue(a, b);
4198
- } else if (prop in config1) {
4199
- return getMergedValue(undefined, a);
4200
- }
4201
- }
4202
-
4203
- const mergeMap = {
4204
- url: valueFromConfig2,
4205
- method: valueFromConfig2,
4206
- data: valueFromConfig2,
4207
- baseURL: defaultToConfig2,
4208
- transformRequest: defaultToConfig2,
4209
- transformResponse: defaultToConfig2,
4210
- paramsSerializer: defaultToConfig2,
4211
- timeout: defaultToConfig2,
4212
- timeoutMessage: defaultToConfig2,
4213
- withCredentials: defaultToConfig2,
4214
- withXSRFToken: defaultToConfig2,
4215
- adapter: defaultToConfig2,
4216
- responseType: defaultToConfig2,
4217
- xsrfCookieName: defaultToConfig2,
4218
- xsrfHeaderName: defaultToConfig2,
4219
- onUploadProgress: defaultToConfig2,
4220
- onDownloadProgress: defaultToConfig2,
4221
- decompress: defaultToConfig2,
4222
- maxContentLength: defaultToConfig2,
4223
- maxBodyLength: defaultToConfig2,
4224
- beforeRedirect: defaultToConfig2,
4225
- transport: defaultToConfig2,
4226
- httpAgent: defaultToConfig2,
4227
- httpsAgent: defaultToConfig2,
4228
- cancelToken: defaultToConfig2,
4229
- socketPath: defaultToConfig2,
4230
- responseEncoding: defaultToConfig2,
4231
- validateStatus: mergeDirectKeys,
4232
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
4233
- };
4234
-
4235
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
4236
- const merge = mergeMap[prop] || mergeDeepProperties;
4237
- const configValue = merge(config1[prop], config2[prop], prop);
4238
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
4239
- });
4240
-
4241
- return config;
4242
- }
4243
-
4244
- const VERSION = "1.6.2";
4740
+ const VERSION = "1.8.3";
4245
4741
 
4246
4742
  const validators$1 = {};
4247
4743
 
@@ -4292,6 +4788,14 @@ validators$1.transitional = function transitional(validator, version, message) {
4292
4788
  };
4293
4789
  };
4294
4790
 
4791
+ validators$1.spelling = function spelling(correctSpelling) {
4792
+ return (value, opt) => {
4793
+ // eslint-disable-next-line no-console
4794
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
4795
+ return true;
4796
+ }
4797
+ };
4798
+
4295
4799
  /**
4296
4800
  * Assert object's properties type
4297
4801
  *
@@ -4356,7 +4860,34 @@ class Axios {
4356
4860
  *
4357
4861
  * @returns {Promise} The Promise to be fulfilled
4358
4862
  */
4359
- request(configOrUrl, config) {
4863
+ async request(configOrUrl, config) {
4864
+ try {
4865
+ return await this._request(configOrUrl, config);
4866
+ } catch (err) {
4867
+ if (err instanceof Error) {
4868
+ let dummy = {};
4869
+
4870
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
4871
+
4872
+ // slice off the Error: ... line
4873
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
4874
+ try {
4875
+ if (!err.stack) {
4876
+ err.stack = stack;
4877
+ // match without the 2 top stack lines
4878
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
4879
+ err.stack += '\n' + stack;
4880
+ }
4881
+ } catch (e) {
4882
+ // ignore the case where "stack" is an un-writable property
4883
+ }
4884
+ }
4885
+
4886
+ throw err;
4887
+ }
4888
+ }
4889
+
4890
+ _request(configOrUrl, config) {
4360
4891
  /*eslint no-param-reassign:0*/
4361
4892
  // Allow for axios('example/url'[, config]) a la fetch API
4362
4893
  if (typeof configOrUrl === 'string') {
@@ -4391,6 +4922,18 @@ class Axios {
4391
4922
  }
4392
4923
  }
4393
4924
 
4925
+ // Set config.allowAbsoluteUrls
4926
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
4927
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
4928
+ } else {
4929
+ config.allowAbsoluteUrls = true;
4930
+ }
4931
+
4932
+ validator.assertOptions(config, {
4933
+ baseUrl: validators.spelling('baseURL'),
4934
+ withXsrfToken: validators.spelling('withXSRFToken')
4935
+ }, true);
4936
+
4394
4937
  // Set config.method
4395
4938
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
4396
4939
 
@@ -4481,7 +5024,7 @@ class Axios {
4481
5024
 
4482
5025
  getUri(config) {
4483
5026
  config = mergeConfig(this.defaults, config);
4484
- const fullPath = buildFullPath(config.baseURL, config.url);
5027
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4485
5028
  return buildURL(fullPath, config.params, config.paramsSerializer);
4486
5029
  }
4487
5030
  }
@@ -4621,6 +5164,20 @@ class CancelToken {
4621
5164
  }
4622
5165
  }
4623
5166
 
5167
+ toAbortSignal() {
5168
+ const controller = new AbortController();
5169
+
5170
+ const abort = (err) => {
5171
+ controller.abort(err);
5172
+ };
5173
+
5174
+ this.subscribe(abort);
5175
+
5176
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
5177
+
5178
+ return controller.signal;
5179
+ }
5180
+
4624
5181
  /**
4625
5182
  * Returns an object that contains a new `CancelToken` and a function that, when called,
4626
5183
  * cancels the `CancelToken`.
@@ -4953,7 +5510,7 @@ function netAdapter$1(url, tableName, { axios, tableOptions }) {
4953
5510
  var netAdapter_1 = netAdapter$1;
4954
5511
 
4955
5512
  const stringify$1 = stringify_1;
4956
- const { v4: uuid } = require$$1;
5513
+ const { v4: uuid } = cjsBrowser;
4957
5514
 
4958
5515
  function toKeyPositionMap$1(rows, options) {
4959
5516
  return rows.reduce((map, element, i) => {
@@ -5068,20 +5625,32 @@ function copyBuffer (cur) {
5068
5625
 
5069
5626
  function rfdc (opts) {
5070
5627
  opts = opts || {};
5071
-
5072
5628
  if (opts.circles) return rfdcCircles(opts)
5629
+
5630
+ const constructorHandlers = new Map();
5631
+ constructorHandlers.set(Date, (o) => new Date(o));
5632
+ constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
5633
+ constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
5634
+ if (opts.constructorHandlers) {
5635
+ for (const handler of opts.constructorHandlers) {
5636
+ constructorHandlers.set(handler[0], handler[1]);
5637
+ }
5638
+ }
5639
+
5640
+ let handler = null;
5641
+
5073
5642
  return opts.proto ? cloneProto : clone
5074
5643
 
5075
5644
  function cloneArray (a, fn) {
5076
- var keys = Object.keys(a);
5077
- var a2 = new Array(keys.length);
5078
- for (var i = 0; i < keys.length; i++) {
5079
- var k = keys[i];
5080
- var cur = a[k];
5645
+ const keys = Object.keys(a);
5646
+ const a2 = new Array(keys.length);
5647
+ for (let i = 0; i < keys.length; i++) {
5648
+ const k = keys[i];
5649
+ const cur = a[k];
5081
5650
  if (typeof cur !== 'object' || cur === null) {
5082
5651
  a2[k] = cur;
5083
- } else if (cur instanceof Date) {
5084
- a2[k] = new Date(cur);
5652
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
5653
+ a2[k] = handler(cur, fn);
5085
5654
  } else if (ArrayBuffer.isView(cur)) {
5086
5655
  a2[k] = copyBuffer(cur);
5087
5656
  } else {
@@ -5093,22 +5662,18 @@ function rfdc (opts) {
5093
5662
 
5094
5663
  function clone (o) {
5095
5664
  if (typeof o !== 'object' || o === null) return o
5096
- if (o instanceof Date) return new Date(o)
5097
5665
  if (Array.isArray(o)) return cloneArray(o, clone)
5098
- if (o instanceof Map) return new Map(cloneArray(Array.from(o), clone))
5099
- if (o instanceof Set) return new Set(cloneArray(Array.from(o), clone))
5100
- var o2 = {};
5101
- for (var k in o) {
5666
+ if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
5667
+ return handler(o, clone)
5668
+ }
5669
+ const o2 = {};
5670
+ for (const k in o) {
5102
5671
  if (Object.hasOwnProperty.call(o, k) === false) continue
5103
- var cur = o[k];
5672
+ const cur = o[k];
5104
5673
  if (typeof cur !== 'object' || cur === null) {
5105
5674
  o2[k] = cur;
5106
- } else if (cur instanceof Date) {
5107
- o2[k] = new Date(cur);
5108
- } else if (cur instanceof Map) {
5109
- o2[k] = new Map(cloneArray(Array.from(cur), clone));
5110
- } else if (cur instanceof Set) {
5111
- o2[k] = new Set(cloneArray(Array.from(cur), clone));
5675
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
5676
+ o2[k] = handler(cur, clone);
5112
5677
  } else if (ArrayBuffer.isView(cur)) {
5113
5678
  o2[k] = copyBuffer(cur);
5114
5679
  } else {
@@ -5120,21 +5685,17 @@ function rfdc (opts) {
5120
5685
 
5121
5686
  function cloneProto (o) {
5122
5687
  if (typeof o !== 'object' || o === null) return o
5123
- if (o instanceof Date) return new Date(o)
5124
5688
  if (Array.isArray(o)) return cloneArray(o, cloneProto)
5125
- if (o instanceof Map) return new Map(cloneArray(Array.from(o), cloneProto))
5126
- if (o instanceof Set) return new Set(cloneArray(Array.from(o), cloneProto))
5127
- var o2 = {};
5128
- for (var k in o) {
5129
- var cur = o[k];
5689
+ if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
5690
+ return handler(o, cloneProto)
5691
+ }
5692
+ const o2 = {};
5693
+ for (const k in o) {
5694
+ const cur = o[k];
5130
5695
  if (typeof cur !== 'object' || cur === null) {
5131
5696
  o2[k] = cur;
5132
- } else if (cur instanceof Date) {
5133
- o2[k] = new Date(cur);
5134
- } else if (cur instanceof Map) {
5135
- o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
5136
- } else if (cur instanceof Set) {
5137
- o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
5697
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
5698
+ o2[k] = handler(cur, cloneProto);
5138
5699
  } else if (ArrayBuffer.isView(cur)) {
5139
5700
  o2[k] = copyBuffer(cur);
5140
5701
  } else {
@@ -5146,25 +5707,36 @@ function rfdc (opts) {
5146
5707
  }
5147
5708
 
5148
5709
  function rfdcCircles (opts) {
5149
- var refs = [];
5150
- var refsNew = [];
5710
+ const refs = [];
5711
+ const refsNew = [];
5712
+
5713
+ const constructorHandlers = new Map();
5714
+ constructorHandlers.set(Date, (o) => new Date(o));
5715
+ constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
5716
+ constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
5717
+ if (opts.constructorHandlers) {
5718
+ for (const handler of opts.constructorHandlers) {
5719
+ constructorHandlers.set(handler[0], handler[1]);
5720
+ }
5721
+ }
5151
5722
 
5723
+ let handler = null;
5152
5724
  return opts.proto ? cloneProto : clone
5153
5725
 
5154
5726
  function cloneArray (a, fn) {
5155
- var keys = Object.keys(a);
5156
- var a2 = new Array(keys.length);
5157
- for (var i = 0; i < keys.length; i++) {
5158
- var k = keys[i];
5159
- var cur = a[k];
5727
+ const keys = Object.keys(a);
5728
+ const a2 = new Array(keys.length);
5729
+ for (let i = 0; i < keys.length; i++) {
5730
+ const k = keys[i];
5731
+ const cur = a[k];
5160
5732
  if (typeof cur !== 'object' || cur === null) {
5161
5733
  a2[k] = cur;
5162
- } else if (cur instanceof Date) {
5163
- a2[k] = new Date(cur);
5734
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
5735
+ a2[k] = handler(cur, fn);
5164
5736
  } else if (ArrayBuffer.isView(cur)) {
5165
5737
  a2[k] = copyBuffer(cur);
5166
5738
  } else {
5167
- var index = refs.indexOf(cur);
5739
+ const index = refs.indexOf(cur);
5168
5740
  if (index !== -1) {
5169
5741
  a2[k] = refsNew[index];
5170
5742
  } else {
@@ -5177,28 +5749,24 @@ function rfdcCircles (opts) {
5177
5749
 
5178
5750
  function clone (o) {
5179
5751
  if (typeof o !== 'object' || o === null) return o
5180
- if (o instanceof Date) return new Date(o)
5181
5752
  if (Array.isArray(o)) return cloneArray(o, clone)
5182
- if (o instanceof Map) return new Map(cloneArray(Array.from(o), clone))
5183
- if (o instanceof Set) return new Set(cloneArray(Array.from(o), clone))
5184
- var o2 = {};
5753
+ if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
5754
+ return handler(o, clone)
5755
+ }
5756
+ const o2 = {};
5185
5757
  refs.push(o);
5186
5758
  refsNew.push(o2);
5187
- for (var k in o) {
5759
+ for (const k in o) {
5188
5760
  if (Object.hasOwnProperty.call(o, k) === false) continue
5189
- var cur = o[k];
5761
+ const cur = o[k];
5190
5762
  if (typeof cur !== 'object' || cur === null) {
5191
5763
  o2[k] = cur;
5192
- } else if (cur instanceof Date) {
5193
- o2[k] = new Date(cur);
5194
- } else if (cur instanceof Map) {
5195
- o2[k] = new Map(cloneArray(Array.from(cur), clone));
5196
- } else if (cur instanceof Set) {
5197
- o2[k] = new Set(cloneArray(Array.from(cur), clone));
5764
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
5765
+ o2[k] = handler(cur, clone);
5198
5766
  } else if (ArrayBuffer.isView(cur)) {
5199
5767
  o2[k] = copyBuffer(cur);
5200
5768
  } else {
5201
- var i = refs.indexOf(cur);
5769
+ const i = refs.indexOf(cur);
5202
5770
  if (i !== -1) {
5203
5771
  o2[k] = refsNew[i];
5204
5772
  } else {
@@ -5213,27 +5781,23 @@ function rfdcCircles (opts) {
5213
5781
 
5214
5782
  function cloneProto (o) {
5215
5783
  if (typeof o !== 'object' || o === null) return o
5216
- if (o instanceof Date) return new Date(o)
5217
5784
  if (Array.isArray(o)) return cloneArray(o, cloneProto)
5218
- if (o instanceof Map) return new Map(cloneArray(Array.from(o), cloneProto))
5219
- if (o instanceof Set) return new Set(cloneArray(Array.from(o), cloneProto))
5220
- var o2 = {};
5785
+ if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
5786
+ return handler(o, cloneProto)
5787
+ }
5788
+ const o2 = {};
5221
5789
  refs.push(o);
5222
5790
  refsNew.push(o2);
5223
- for (var k in o) {
5224
- var cur = o[k];
5791
+ for (const k in o) {
5792
+ const cur = o[k];
5225
5793
  if (typeof cur !== 'object' || cur === null) {
5226
5794
  o2[k] = cur;
5227
- } else if (cur instanceof Date) {
5228
- o2[k] = new Date(cur);
5229
- } else if (cur instanceof Map) {
5230
- o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
5231
- } else if (cur instanceof Set) {
5232
- o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
5795
+ } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
5796
+ o2[k] = handler(cur, cloneProto);
5233
5797
  } else if (ArrayBuffer.isView(cur)) {
5234
5798
  o2[k] = copyBuffer(cur);
5235
5799
  } else {
5236
- var i = refs.indexOf(cur);
5800
+ const i = refs.indexOf(cur);
5237
5801
  if (i !== -1) {
5238
5802
  o2[k] = refsNew[i];
5239
5803
  } else {