@cccsaurora/clue-ui 1.5.0-dev.469 → 1.5.0-dev.477

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.
Files changed (60) hide show
  1. package/{ActionForm-pbNGEuwp.js → ActionForm-DIAUGhSr.js} +5 -5
  2. package/{AnnotationDetails-C-up01mY.js → AnnotationDetails-DmrYK0Qc.js} +2 -2
  3. package/{AnnotationPreview-CEVRdPnY.js → AnnotationPreview-DAswA7fu.js} +2 -2
  4. package/{ClueEnrichContext-DaGfR7GQ.js → ClueEnrichContext-B76X-cLH.js} +2 -2
  5. package/components/AnnotationBody.js +1 -1
  6. package/components/AnnotationDetailPopover.js +3 -3
  7. package/components/AnnotationDetails.js +3 -3
  8. package/components/AnnotationEntry.js +1 -1
  9. package/components/AnnotationPreview.js +2 -2
  10. package/components/ClassificationChip.js +2 -2
  11. package/components/EnrichedCard.js +2 -2
  12. package/components/EnrichedChip.js +4 -4
  13. package/components/EnrichedTypography.js +2 -2
  14. package/components/ErrorBoundary.js +2 -2
  15. package/components/RetryFailedEnrichments.js +1 -1
  16. package/components/SourcePicker.js +1 -1
  17. package/components/actions/ActionForm.js +1 -1
  18. package/components/actions/ExecutePopover.js +2 -2
  19. package/components/actions/ResultModal.js +2 -2
  20. package/components/actions/formats/index.js +1 -1
  21. package/components/display/graph/elements/NodeCard.js +2 -9
  22. package/components/display/icons/Iconified.js +1 -1
  23. package/components/display/markdown/index.js +1813 -665
  24. package/components/enrichment/EnrichPopover.js +1 -1
  25. package/components/fetchers/Fetcher.js +4 -4
  26. package/components/fetchers/FetcherResultView.js +1 -1
  27. package/components/fetchers/StatusChip.js +1 -1
  28. package/components/group/GroupControl.js +1 -1
  29. package/components/stats/QueryStatus.js +1 -1
  30. package/database/index.js +2 -2
  31. package/database/replication.js +2 -2
  32. package/hooks/ClueActionContext.js +2 -2
  33. package/hooks/ClueDatabaseContext.js +1 -1
  34. package/hooks/ClueEnrichContext.js +3 -3
  35. package/hooks/ClueFetcherContext.js +1 -1
  36. package/hooks/ClueGroupContext.js +1 -1
  37. package/hooks/CluePopupContext.js +2 -2
  38. package/hooks/ClueProvider.js +3 -3
  39. package/hooks/ClueUIPluginContext.js +1 -1
  40. package/hooks/selectors.js +2 -2
  41. package/hooks/useActionResult.js +1 -1
  42. package/hooks/useAnnotations.js +2 -2
  43. package/hooks/useClue.js +1 -1
  44. package/hooks/useClueActions.js +1 -1
  45. package/hooks/useClueTypeConfig.js +1 -1
  46. package/hooks/useErrors.js +1 -1
  47. package/hooks/useFetcherResult.js +1 -1
  48. package/{iconify-DJxl6dC-.js → iconify-CYJTToEF.js} +9 -9
  49. package/icons/Action.js +3 -3
  50. package/icons/Assessment.js +2 -2
  51. package/icons/Context.js +2 -2
  52. package/icons/Opinion.js +2 -2
  53. package/{index-BFOmLhDH.js → index-8lXdRRpV.js} +541 -144
  54. package/{index-Gwnzh4FL.js → index-CPetQxOc.js} +617 -161
  55. package/{index-CWUzifNE.js → index-DT_sunCV.js} +1 -1
  56. package/main.js +5 -5
  57. package/package.json +3 -3
  58. package/plugins/store.js +1 -1
  59. package/{replication-DYXRsbKM.js → replication-DDxxY_CX.js} +1 -1
  60. package/{store-DHP48fQB.js → store-C0DRfMxZ.js} +3 -3
@@ -258,22 +258,82 @@ const { toString } = Object.prototype;
258
258
  const { getPrototypeOf } = Object;
259
259
  const { iterator, toStringTag } = Symbol;
260
260
  const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
261
+ const isUnsafeObjectKey = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
262
+ const isPrototypeBoundary = (obj, prototype2, source) => obj === Object.prototype || !source && prototype2 === null;
263
+ const isSafeAndFullyMutable = (obj) => {
264
+ if (!Object.isExtensible(obj)) {
265
+ return false;
266
+ }
267
+ const props = Object.getOwnPropertyNames(obj);
268
+ if (Object.getOwnPropertySymbols) {
269
+ props.push(...Object.getOwnPropertySymbols(obj));
270
+ }
271
+ return props.every((prop) => {
272
+ if (isUnsafeObjectKey(prop)) {
273
+ return false;
274
+ }
275
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
276
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
277
+ });
278
+ };
261
279
  const hasOwnInPrototypeChain = (thing, prop) => {
262
280
  let obj = thing;
263
281
  const seen = [];
264
- while (obj != null && obj !== Object.prototype) {
282
+ while (obj != null) {
265
283
  if (seen.indexOf(obj) !== -1) {
266
284
  return false;
267
285
  }
268
286
  seen.push(obj);
287
+ const prototype2 = getPrototypeOf(obj);
288
+ if (isPrototypeBoundary(obj, prototype2, obj === thing)) {
289
+ return false;
290
+ }
269
291
  if (hasOwnProperty(obj, prop)) {
270
292
  return true;
271
293
  }
272
- obj = getPrototypeOf(obj);
294
+ obj = prototype2;
273
295
  }
274
296
  return false;
275
297
  };
276
298
  const getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
299
+ const toSafeFlatObject = (thing) => {
300
+ if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
301
+ return thing;
302
+ }
303
+ const sourcePrototype = getPrototypeOf(thing);
304
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
305
+ return thing;
306
+ }
307
+ const result = /* @__PURE__ */ Object.create(null);
308
+ const merged = /* @__PURE__ */ Object.create(null);
309
+ const seen = [];
310
+ let current = thing;
311
+ while (current != null) {
312
+ if (seen.indexOf(current) !== -1) {
313
+ break;
314
+ }
315
+ seen.push(current);
316
+ const prototype2 = current === thing ? sourcePrototype : getPrototypeOf(current);
317
+ if (isPrototypeBoundary(current, prototype2, current === thing)) {
318
+ break;
319
+ }
320
+ const props = Object.getOwnPropertyNames(current);
321
+ if (Object.getOwnPropertySymbols) {
322
+ props.push(...Object.getOwnPropertySymbols(current));
323
+ }
324
+ for (const prop of props) {
325
+ if (isUnsafeObjectKey(prop)) {
326
+ continue;
327
+ }
328
+ if (!hasOwnProperty(merged, prop)) {
329
+ result[prop] = thing[prop];
330
+ merged[prop] = true;
331
+ }
332
+ }
333
+ current = prototype2;
334
+ }
335
+ return result;
336
+ };
277
337
  const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
278
338
  const str = toString.call(thing);
279
339
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -308,9 +368,9 @@ const isPlainObject = (val) => {
308
368
  return false;
309
369
  }
310
370
  const prototype2 = getPrototypeOf(val);
311
- return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
312
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
313
- // than a plain object, while ignoring keys injected onto Object.prototype.
371
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
372
+ // evidence the value is tagged/iterable, while ignoring members reachable
373
+ // only through shared or terminal prototype boundaries.
314
374
  !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
315
375
  };
316
376
  const isEmptyObject = (val) => {
@@ -331,6 +391,7 @@ const isReactNativeBlob = (value) => {
331
391
  const isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
332
392
  const isBlob = kindOfTest("Blob");
333
393
  const isFileList = kindOfTest("FileList");
394
+ const isSet = kindOfTest("Set");
334
395
  const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
335
396
  function getGlobal() {
336
397
  if (typeof globalThis !== "undefined") return globalThis;
@@ -626,11 +687,20 @@ const toJSONObject = (obj) => {
626
687
  }
627
688
  if (!("toJSON" in source)) {
628
689
  visited.add(source);
629
- const target = isArray(source) ? [] : {};
630
- forEach(source, (value, key) => {
631
- const reducedValue = visit(value);
632
- !isUndefined(reducedValue) && (target[key] = reducedValue);
633
- });
690
+ let target;
691
+ if (isSet(source)) {
692
+ target = [];
693
+ for (const value of source) {
694
+ const reducedValue = visit(value);
695
+ !isUndefined(reducedValue) && target.push(reducedValue);
696
+ }
697
+ } else {
698
+ target = isArray(source) ? [] : {};
699
+ forEach(source, (value, key) => {
700
+ const reducedValue = visit(value);
701
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
702
+ });
703
+ }
634
704
  visited.delete(source);
635
705
  return target;
636
706
  }
@@ -711,6 +781,7 @@ const utils$1 = {
711
781
  // an alias to avoid ESLint no-prototype-builtins detection
712
782
  hasOwnInPrototypeChain,
713
783
  getSafeProp,
784
+ toSafeFlatObject,
714
785
  reduceDescriptors,
715
786
  freezeMethods,
716
787
  toObjectSet,
@@ -757,17 +828,18 @@ const parseHeaders = (rawHeaders) => {
757
828
  i = line.indexOf(":");
758
829
  key = line.substring(0, i).trim().toLowerCase();
759
830
  val = line.substring(i + 1).trim();
760
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
831
+ const hasKey = utils$1.hasOwnProp(parsed, key);
832
+ if (!key || hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key)) {
761
833
  return;
762
834
  }
763
835
  if (key === "set-cookie") {
764
- if (parsed[key]) {
836
+ if (hasKey) {
765
837
  parsed[key].push(val);
766
838
  } else {
767
839
  parsed[key] = [val];
768
840
  }
769
841
  } else {
770
- parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
842
+ parsed[key] = hasKey ? parsed[key] + ", " + val : val;
771
843
  }
772
844
  });
773
845
  return parsed;
@@ -808,7 +880,7 @@ function toByteStringHeaderObject(headers) {
808
880
  });
809
881
  return byteStringHeaders;
810
882
  }
811
- const $internals = Symbol("internals");
883
+ const $internals$1 = Symbol("internals");
812
884
  function normalizeHeader(header) {
813
885
  return header && String(header).trim().toLowerCase();
814
886
  }
@@ -827,6 +899,90 @@ function parseTokens(str) {
827
899
  }
828
900
  return tokens;
829
901
  }
902
+ const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
903
+ function trimOWS(value) {
904
+ let start = 0;
905
+ let end = value.length;
906
+ while (start < end) {
907
+ const code = value.charCodeAt(start);
908
+ if (code !== 9 && code !== 32) {
909
+ break;
910
+ }
911
+ start += 1;
912
+ }
913
+ while (end > start) {
914
+ const code = value.charCodeAt(end - 1);
915
+ if (code !== 9 && code !== 32) {
916
+ break;
917
+ }
918
+ end -= 1;
919
+ }
920
+ return start === 0 && end === value.length ? value : value.slice(start, end);
921
+ }
922
+ function decodeQuotedString(value) {
923
+ const last = value.length - 1;
924
+ if (last < 1 || value.charCodeAt(0) !== 34 || value.charCodeAt(last) !== 34) {
925
+ return value;
926
+ }
927
+ let decoded = "";
928
+ for (let i = 1; i < last; i++) {
929
+ const code = value.charCodeAt(i);
930
+ if (code === 34) {
931
+ return value;
932
+ }
933
+ if (code === 92) {
934
+ i += 1;
935
+ if (i >= last) {
936
+ return value;
937
+ }
938
+ }
939
+ decoded += value[i];
940
+ }
941
+ return decoded;
942
+ }
943
+ function parseParameters(value) {
944
+ const parameters = /* @__PURE__ */ Object.create(null);
945
+ const str = String(value);
946
+ let start = 0;
947
+ let quoted = false;
948
+ let escaped = false;
949
+ function parseParameter(end) {
950
+ const part = trimOWS(str.slice(start, end));
951
+ const equals = part.indexOf("=");
952
+ if (equals < 1) {
953
+ return;
954
+ }
955
+ const name = trimOWS(part.slice(0, equals));
956
+ if (!parameterNameRE.test(name)) {
957
+ return;
958
+ }
959
+ const normalizedName = name.toLowerCase();
960
+ if (normalizedName === "__proto__" || normalizedName === "constructor" || normalizedName === "prototype") {
961
+ return;
962
+ }
963
+ const parameterValue = trimOWS(part.slice(equals + 1));
964
+ parameters[normalizedName] = decodeQuotedString(parameterValue);
965
+ }
966
+ for (let i = 0; i < str.length; i++) {
967
+ const code = str.charCodeAt(i);
968
+ if (quoted) {
969
+ if (escaped) {
970
+ escaped = false;
971
+ } else if (code === 92) {
972
+ escaped = true;
973
+ } else if (code === 34) {
974
+ quoted = false;
975
+ }
976
+ } else if (code === 34) {
977
+ quoted = true;
978
+ } else if (code === 44 || code === 59) {
979
+ parseParameter(i);
980
+ start = i + 1;
981
+ }
982
+ }
983
+ parseParameter(str.length);
984
+ return parameters;
985
+ }
830
986
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
831
987
  function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
832
988
  if (utils$1.isFunction(filter2)) {
@@ -1002,7 +1158,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
1002
1158
  return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1003
1159
  }
1004
1160
  getSetCookie() {
1005
- return this.get("set-cookie") || [];
1161
+ const value = this.get("set-cookie");
1162
+ return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
1006
1163
  }
1007
1164
  get [Symbol.toStringTag]() {
1008
1165
  return "AxiosHeaders";
@@ -1010,13 +1167,16 @@ let AxiosHeaders$1 = class AxiosHeaders {
1010
1167
  static from(thing) {
1011
1168
  return thing instanceof this ? thing : new this(thing);
1012
1169
  }
1170
+ static parseParameters(value) {
1171
+ return parseParameters(value);
1172
+ }
1013
1173
  static concat(first, ...targets) {
1014
1174
  const computed = new this(first);
1015
1175
  targets.forEach((target) => computed.set(target));
1016
1176
  return computed;
1017
1177
  }
1018
1178
  static accessor(header) {
1019
- const internals = this[$internals] = this[$internals] = {
1179
+ const internals = this[$internals$1] = this[$internals$1] = {
1020
1180
  accessors: {}
1021
1181
  };
1022
1182
  const accessors = internals.accessors;
@@ -1102,10 +1262,37 @@ function redactConfig(config, redactKeys) {
1102
1262
  };
1103
1263
  return visit(config);
1104
1264
  }
1265
+ function stringifySafely$1(value) {
1266
+ try {
1267
+ return String(value);
1268
+ } catch (err) {
1269
+ return "";
1270
+ }
1271
+ }
1272
+ function aggregateErrorMessage(error) {
1273
+ const message = error.errors.map((entry) => {
1274
+ try {
1275
+ return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
1276
+ } catch (err) {
1277
+ return "";
1278
+ }
1279
+ }).filter(Boolean).join("; ");
1280
+ return message || error.name || "AggregateError";
1281
+ }
1105
1282
  let AxiosError$1 = class AxiosError extends Error {
1106
1283
  static from(error, code, config, request, response, customProps) {
1107
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1108
- axiosError.cause = error;
1284
+ let message = error.message;
1285
+ if (!message && utils$1.isArray(error.errors) && error.errors.length) {
1286
+ message = aggregateErrorMessage(error);
1287
+ }
1288
+ const axiosError = new AxiosError(message, code || error.code, config, request, response);
1289
+ Object.defineProperty(axiosError, "cause", {
1290
+ __proto__: null,
1291
+ value: error,
1292
+ writable: true,
1293
+ enumerable: false,
1294
+ configurable: true
1295
+ });
1109
1296
  axiosError.name = error.name;
1110
1297
  if (error.status != null && axiosError.status == null) {
1111
1298
  axiosError.status = error.status;
@@ -1208,24 +1395,16 @@ function toFormData$1(obj, formData, options) {
1208
1395
  throw new TypeError("target must be an object");
1209
1396
  }
1210
1397
  formData = formData || new FormData();
1211
- options = utils$1.toFlatObject(
1212
- options,
1213
- {
1214
- metaTokens: true,
1215
- dots: false,
1216
- indexes: false
1217
- },
1218
- false,
1219
- function defined(option, source) {
1220
- return !utils$1.isUndefined(source[option]);
1221
- }
1222
- );
1223
- const metaTokens = options.metaTokens;
1224
- const visitor = options.visitor || defaultVisitor;
1225
- const dots = options.dots;
1226
- const indexes = options.indexes;
1227
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
1228
- const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
1398
+ const option = (name, fallback) => {
1399
+ const value = utils$1.getSafeProp(options, name);
1400
+ return utils$1.isUndefined(value) ? fallback : value;
1401
+ };
1402
+ const metaTokens = option("metaTokens", true);
1403
+ const visitor = option("visitor") || defaultVisitor;
1404
+ const dots = option("dots", false);
1405
+ const indexes = option("indexes", false);
1406
+ const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
1407
+ const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH);
1229
1408
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1230
1409
  const stack = [];
1231
1410
  if (!utils$1.isFunction(visitor)) {
@@ -1243,7 +1422,13 @@ function toFormData$1(obj, formData, options) {
1243
1422
  throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
1244
1423
  }
1245
1424
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1246
- return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
1425
+ if (useBlob && typeof _Blob === "function") {
1426
+ return new _Blob([value]);
1427
+ }
1428
+ throw new AxiosError$1(
1429
+ "Blob is not supported. Use a Buffer instead.",
1430
+ AxiosError$1.ERR_NOT_SUPPORT
1431
+ );
1247
1432
  }
1248
1433
  return value;
1249
1434
  }
@@ -1348,9 +1533,7 @@ prototype.append = function append(name, value) {
1348
1533
  this._pairs.push([name, value]);
1349
1534
  };
1350
1535
  prototype.toString = function toString2(encoder) {
1351
- const _encode = encoder ? function(value) {
1352
- return encoder.call(this, value, encode$1);
1353
- } : encode$1;
1536
+ const _encode = encoder ? (value) => encoder.call(this, value, encode$1) : encode$1;
1354
1537
  return this._pairs.map(function each(pair) {
1355
1538
  return _encode(pair[0]) + "=" + _encode(pair[1]);
1356
1539
  }, "").join("&");
@@ -1362,6 +1545,7 @@ function buildURL(url, params, options) {
1362
1545
  if (!params) {
1363
1546
  return url;
1364
1547
  }
1548
+ url = url || "";
1365
1549
  const _options = utils$1.isFunction(options) ? {
1366
1550
  serialize: options
1367
1551
  } : options;
@@ -1382,9 +1566,47 @@ function buildURL(url, params, options) {
1382
1566
  }
1383
1567
  return url;
1384
1568
  }
1569
+ const $internals = Symbol("internals");
1570
+ function countHandlers(handlers) {
1571
+ return handlers ? handlers.length : 0;
1572
+ }
1573
+ function trimHandlers(handlers) {
1574
+ if (!handlers) {
1575
+ return;
1576
+ }
1577
+ while (handlers.length && handlers[handlers.length - 1] === null) {
1578
+ handlers.pop();
1579
+ }
1580
+ }
1581
+ function syncHandlerEntries(manager, internals) {
1582
+ const handlers = manager.handlers;
1583
+ const length = countHandlers(handlers);
1584
+ if (handlers !== internals.handlersRef) {
1585
+ internals.handlersRef = handlers;
1586
+ internals.handlerEntries.clear();
1587
+ } else if (length !== internals.handlersLength) {
1588
+ if (!length) {
1589
+ internals.handlerEntries.clear();
1590
+ } else {
1591
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
1592
+ if (handlers[entry.index] !== entry.handler) {
1593
+ internals.handlerEntries.delete(id);
1594
+ }
1595
+ });
1596
+ }
1597
+ }
1598
+ internals.handlersLength = length;
1599
+ }
1385
1600
  class InterceptorManager {
1386
1601
  constructor() {
1387
1602
  this.handlers = [];
1603
+ this[$internals] = {
1604
+ handlersRef: this.handlers,
1605
+ handlersLength: this.handlers.length,
1606
+ handlerEntries: /* @__PURE__ */ new Map(),
1607
+ iterationDepth: 0,
1608
+ nextId: 0
1609
+ };
1388
1610
  }
1389
1611
  /**
1390
1612
  * Add a new interceptor to the stack
@@ -1396,13 +1618,25 @@ class InterceptorManager {
1396
1618
  * @return {Number} An ID used to remove interceptor later
1397
1619
  */
1398
1620
  use(fulfilled, rejected, options) {
1399
- this.handlers.push({
1621
+ const handler = {
1400
1622
  fulfilled,
1401
1623
  rejected,
1402
1624
  synchronous: options ? options.synchronous : false,
1403
1625
  runWhen: options ? options.runWhen : null
1626
+ };
1627
+ const internals = this[$internals];
1628
+ if (this.handlers == null) {
1629
+ this.handlers = [];
1630
+ }
1631
+ syncHandlerEntries(this, internals);
1632
+ const id = internals.nextId++;
1633
+ this.handlers.push(handler);
1634
+ internals.handlerEntries.set(id, {
1635
+ handler,
1636
+ index: this.handlers.length - 1
1404
1637
  });
1405
- return this.handlers.length - 1;
1638
+ internals.handlersLength = this.handlers.length;
1639
+ return id;
1406
1640
  }
1407
1641
  /**
1408
1642
  * Remove an interceptor from the stack
@@ -1412,8 +1646,19 @@ class InterceptorManager {
1412
1646
  * @returns {void}
1413
1647
  */
1414
1648
  eject(id) {
1415
- if (this.handlers[id]) {
1416
- this.handlers[id] = null;
1649
+ const internals = this[$internals];
1650
+ syncHandlerEntries(this, internals);
1651
+ const entry = internals.handlerEntries.get(id);
1652
+ if (entry) {
1653
+ internals.handlerEntries.delete(id);
1654
+ if (this.handlers[entry.index] !== entry.handler) {
1655
+ return;
1656
+ }
1657
+ this.handlers[entry.index] = null;
1658
+ if (!internals.iterationDepth) {
1659
+ trimHandlers(this.handlers);
1660
+ internals.handlersLength = this.handlers.length;
1661
+ }
1417
1662
  }
1418
1663
  }
1419
1664
  /**
@@ -1424,6 +1669,7 @@ class InterceptorManager {
1424
1669
  clear() {
1425
1670
  if (this.handlers) {
1426
1671
  this.handlers = [];
1672
+ syncHandlerEntries(this, this[$internals]);
1427
1673
  }
1428
1674
  }
1429
1675
  /**
@@ -1437,11 +1683,22 @@ class InterceptorManager {
1437
1683
  * @returns {void}
1438
1684
  */
1439
1685
  forEach(fn) {
1440
- utils$1.forEach(this.handlers, function forEachHandler(h) {
1441
- if (h !== null) {
1442
- fn(h);
1686
+ const internals = this[$internals];
1687
+ syncHandlerEntries(this, internals);
1688
+ internals.iterationDepth++;
1689
+ try {
1690
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
1691
+ if (h !== null) {
1692
+ fn(h);
1693
+ }
1694
+ });
1695
+ } finally {
1696
+ if (!--internals.iterationDepth) {
1697
+ syncHandlerEntries(this, internals);
1698
+ trimHandlers(this.handlers);
1699
+ internals.handlersLength = countHandlers(this.handlers);
1443
1700
  }
1444
- });
1701
+ }
1445
1702
  }
1446
1703
  }
1447
1704
  const transitionalDefaults = {
@@ -1507,7 +1764,7 @@ function throwIfDepthExceeded(index) {
1507
1764
  }
1508
1765
  function parsePropPath(name) {
1509
1766
  const path = [];
1510
- const pattern = /\w+|\[(\w*)]/g;
1767
+ const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
1511
1768
  let match;
1512
1769
  while ((match = pattern.exec(name)) !== null) {
1513
1770
  throwIfDepthExceeded(path.length);
@@ -1561,6 +1818,19 @@ function formDataToJSON(formData) {
1561
1818
  }
1562
1819
  return null;
1563
1820
  }
1821
+ const methodList = Object.freeze([
1822
+ "get",
1823
+ "delete",
1824
+ "head",
1825
+ "options",
1826
+ "post",
1827
+ "put",
1828
+ "patch",
1829
+ "purge",
1830
+ "link",
1831
+ "unlink",
1832
+ "query"
1833
+ ]);
1564
1834
  const own = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : void 0;
1565
1835
  function stringifySafely(rawValue, parser, encoder) {
1566
1836
  if (utils$1.isString(rawValue)) {
@@ -1672,7 +1942,7 @@ const defaults = {
1672
1942
  }
1673
1943
  }
1674
1944
  };
1675
- utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
1945
+ utils$1.forEach(methodList, (method) => {
1676
1946
  defaults.headers[method] = {};
1677
1947
  });
1678
1948
  function transformData(fns, response) {
@@ -1719,6 +1989,17 @@ function settle(resolve, reject, response) {
1719
1989
  ));
1720
1990
  }
1721
1991
  }
1992
+ const urlParserControlCharacters = /[\t\n\r]/g;
1993
+ function normalizeURLForProtocolCheck(url) {
1994
+ if (typeof url !== "string") {
1995
+ return url;
1996
+ }
1997
+ let start = 0;
1998
+ while (start < url.length && url.charCodeAt(start) <= 32) {
1999
+ start++;
2000
+ }
2001
+ return url.slice(start).replace(urlParserControlCharacters, "");
2002
+ }
1722
2003
  function parseProtocol(url) {
1723
2004
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
1724
2005
  return match && match[1] || "";
@@ -1786,18 +2067,19 @@ function throttle(fn, freq) {
1786
2067
  }
1787
2068
  };
1788
2069
  const flush = () => lastArgs && invoke(lastArgs);
1789
- return [throttled, flush];
2070
+ const flushWith = (...args) => invoke(args);
2071
+ return [throttled, flush, flushWith];
1790
2072
  }
1791
2073
  const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
1792
2074
  let bytesNotified = 0;
1793
2075
  const _speedometer = speedometer(50, 250);
1794
2076
  return throttle((e) => {
1795
- if (!e || typeof e.loaded !== "number") {
2077
+ if (!e || !utils$1.isNumber(e.loaded)) {
1796
2078
  return;
1797
2079
  }
1798
2080
  const rawLoaded = e.loaded;
1799
2081
  const total = e.lengthComputable ? e.total : void 0;
1800
- const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
2082
+ const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
1801
2083
  const progressBytes = Math.max(0, loaded - bytesNotified);
1802
2084
  const rate = _speedometer(progressBytes);
1803
2085
  bytesNotified = Math.max(bytesNotified, loaded);
@@ -1826,7 +2108,7 @@ const progressEventDecorator = (total, throttled) => {
1826
2108
  throttled[1]
1827
2109
  ];
1828
2110
  };
1829
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
2111
+ const asyncDecorator = (fn, scheduler = utils$1.asap) => (...args) => scheduler(() => fn(...args));
1830
2112
  const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
1831
2113
  url = new URL(url, platform.origin);
1832
2114
  return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
@@ -1864,7 +2146,11 @@ const cookies = platform.hasStandardBrowserEnv ? (
1864
2146
  const cookie = cookies2[i].replace(/^\s+/, "");
1865
2147
  const eq = cookie.indexOf("=");
1866
2148
  if (eq !== -1 && cookie.slice(0, eq) === name) {
1867
- return decodeURIComponent(cookie.slice(eq + 1));
2149
+ try {
2150
+ return decodeURIComponent(cookie.slice(eq + 1));
2151
+ } catch (e) {
2152
+ return cookie.slice(eq + 1);
2153
+ }
1868
2154
  }
1869
2155
  }
1870
2156
  return null;
@@ -1892,27 +2178,47 @@ function isAbsoluteURL(url) {
1892
2178
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1893
2179
  }
1894
2180
  function combineURLs(baseURL, relativeURL) {
1895
- return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
2181
+ if (!relativeURL) {
2182
+ return baseURL;
2183
+ }
2184
+ let end = baseURL.length;
2185
+ while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
2186
+ end--;
2187
+ }
2188
+ return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
1896
2189
  }
1897
2190
  const malformedHttpProtocol = /^https?:(?!\/\/)/i;
1898
- const httpProtocolControlCharacters = /[\t\n\r]/g;
1899
- function stripLeadingC0ControlOrSpace(url) {
1900
- let i = 0;
1901
- while (i < url.length && url.charCodeAt(i) <= 32) {
1902
- i++;
2191
+ function redactFragment(fragment) {
2192
+ if (!fragment) {
2193
+ return fragment;
1903
2194
  }
1904
- return url.slice(i);
2195
+ return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = "") => {
2196
+ return `${separator}${parameterName}${REDACTED}`;
2197
+ });
1905
2198
  }
1906
- function normalizeURLForProtocolCheck(url) {
1907
- return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, "");
2199
+ function redactSensitiveURLParts(url) {
2200
+ const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
2201
+ const fragmentIndex = redactedURL.indexOf("#");
2202
+ const urlWithoutFragment = fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
2203
+ const redactedURLWithoutFragment = urlWithoutFragment.replace(
2204
+ /([?&][^=&#]*=)[^&#]*/g,
2205
+ `$1${REDACTED}`
2206
+ );
2207
+ if (fragmentIndex === -1) {
2208
+ return redactedURLWithoutFragment;
2209
+ }
2210
+ return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
1908
2211
  }
1909
2212
  function assertValidHttpProtocolURL(url, config) {
1910
- if (typeof url === "string" && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
1911
- throw new AxiosError$1(
1912
- 'Invalid URL: missing "//" after protocol',
1913
- AxiosError$1.ERR_INVALID_URL,
1914
- config
1915
- );
2213
+ if (typeof url === "string") {
2214
+ const normalizedURL = normalizeURLForProtocolCheck(url);
2215
+ if (malformedHttpProtocol.test(normalizedURL)) {
2216
+ throw new AxiosError$1(
2217
+ `Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
2218
+ AxiosError$1.ERR_INVALID_URL,
2219
+ config
2220
+ );
2221
+ }
1916
2222
  }
1917
2223
  }
1918
2224
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
@@ -1925,7 +2231,18 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
1925
2231
  return requestedURL;
1926
2232
  }
1927
2233
  const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
2234
+ const ownEnumerableKeys = (thing) => {
2235
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
2236
+ return Object.keys(thing).concat(
2237
+ Object.getOwnPropertySymbols(thing).filter(
2238
+ (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
2239
+ )
2240
+ );
2241
+ }
2242
+ return Object.keys(thing);
2243
+ };
1928
2244
  function mergeConfig$1(config1, config2) {
2245
+ config1 = config1 || {};
1929
2246
  config2 = config2 || {};
1930
2247
  const config = /* @__PURE__ */ Object.create(null);
1931
2248
  Object.defineProperty(config, "hasOwnProperty", {
@@ -1999,7 +2316,7 @@ function mergeConfig$1(config1, config2) {
1999
2316
  transformResponse: defaultToConfig2,
2000
2317
  paramsSerializer: defaultToConfig2,
2001
2318
  timeout: defaultToConfig2,
2002
- timeoutMessage: defaultToConfig2,
2319
+ timeoutErrorMessage: defaultToConfig2,
2003
2320
  withCredentials: defaultToConfig2,
2004
2321
  withXSRFToken: defaultToConfig2,
2005
2322
  adapter: defaultToConfig2,
@@ -2022,7 +2339,7 @@ function mergeConfig$1(config1, config2) {
2022
2339
  validateStatus: mergeDirectKeys,
2023
2340
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
2024
2341
  };
2025
- utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2342
+ utils$1.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2026
2343
  if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
2027
2344
  const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2028
2345
  const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : void 0;
@@ -2045,7 +2362,7 @@ function setFormDataHeaders(headers, formHeaders, policy) {
2045
2362
  headers.set(formHeaders);
2046
2363
  return;
2047
2364
  }
2048
- Object.entries(formHeaders).forEach(([key, val]) => {
2365
+ Object.entries(formHeaders || {}).forEach(([key, val]) => {
2049
2366
  if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
2050
2367
  headers.set(key, val);
2051
2368
  }
@@ -2076,16 +2393,21 @@ function resolveConfig(config) {
2076
2393
  if (auth2) {
2077
2394
  const username = utils$1.getSafeProp(auth2, "username") || "";
2078
2395
  const password = utils$1.getSafeProp(auth2, "password") || "";
2079
- headers.set(
2080
- "Authorization",
2081
- "Basic " + btoa(username + ":" + (password ? encodeUTF8$1(password) : ""))
2082
- );
2396
+ try {
2397
+ headers.set(
2398
+ "Authorization",
2399
+ "Basic " + btoa(username + ":" + (password ? encodeUTF8$1(password) : ""))
2400
+ );
2401
+ } catch (e) {
2402
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_OPTION_VALUE, config);
2403
+ }
2083
2404
  }
2084
2405
  if (utils$1.isFormData(data)) {
2406
+ const getHeaders = utils$1.getSafeProp(data, "getHeaders");
2085
2407
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
2086
2408
  headers.setContentType(void 0);
2087
- } else if (utils$1.isFunction(data.getHeaders)) {
2088
- setFormDataHeaders(headers, data.getHeaders(), own2("formDataHeaderPolicy"));
2409
+ } else if (utils$1.isFunction(getHeaders)) {
2410
+ setFormDataHeaders(headers, getHeaders.call(data), own2("formDataHeaderPolicy"));
2089
2411
  }
2090
2412
  }
2091
2413
  if (platform.hasStandardBrowserEnv) {
@@ -2111,7 +2433,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
2111
2433
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
2112
2434
  let onCanceled;
2113
2435
  let uploadThrottled, downloadThrottled;
2114
- let flushUpload, flushDownload;
2436
+ let flushUpload, flushDownload, flushDownloadWithEvent;
2115
2437
  function done() {
2116
2438
  flushUpload && flushUpload();
2117
2439
  flushDownload && flushDownload();
@@ -2121,7 +2443,27 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
2121
2443
  let request = new XMLHttpRequest();
2122
2444
  request.open(_config.method.toUpperCase(), _config.url, true);
2123
2445
  request.timeout = _config.timeout;
2124
- function onloadend() {
2446
+ function onloadend(event) {
2447
+ if (!request) {
2448
+ return;
2449
+ }
2450
+ if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
2451
+ reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
2452
+ done();
2453
+ request = null;
2454
+ return;
2455
+ }
2456
+ try {
2457
+ if (event) {
2458
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
2459
+ } else {
2460
+ flushDownload && flushDownload();
2461
+ }
2462
+ } catch (err) {
2463
+ setTimeout(() => {
2464
+ throw err;
2465
+ });
2466
+ }
2125
2467
  if (!request) {
2126
2468
  return;
2127
2469
  }
@@ -2209,7 +2551,10 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
2209
2551
  request.responseType = _config.responseType;
2210
2552
  }
2211
2553
  if (onDownloadProgress) {
2212
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
2554
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
2555
+ onDownloadProgress,
2556
+ true
2557
+ );
2213
2558
  request.addEventListener("progress", downloadThrottled);
2214
2559
  }
2215
2560
  if (onUploadProgress && request.upload) {
@@ -2241,6 +2586,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
2241
2586
  config
2242
2587
  )
2243
2588
  );
2589
+ done();
2244
2590
  return;
2245
2591
  }
2246
2592
  request.send(requestData || null);
@@ -2278,7 +2624,16 @@ const composeSignals = (signals, timeout) => {
2278
2624
  });
2279
2625
  signals = null;
2280
2626
  };
2281
- signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
2627
+ signals.forEach((signal2) => {
2628
+ if (aborted) {
2629
+ return;
2630
+ }
2631
+ if (signal2.aborted) {
2632
+ onabort.call(signal2);
2633
+ return;
2634
+ }
2635
+ signal2.addEventListener("abort", onabort, { once: true });
2636
+ });
2282
2637
  const { signal } = controller;
2283
2638
  signal.unsubscribe = () => utils$1.asap(unsubscribe);
2284
2639
  return signal;
@@ -2363,7 +2718,61 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
2363
2718
  };
2364
2719
  const isHexDigit = (charCode) => charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
2365
2720
  const isPercentEncodedByte = (str, i, len) => i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
2366
- function estimateDataURLDecodedBytes(url) {
2721
+ const hexValue = (charCode) => charCode <= 57 ? charCode - 48 : (charCode & 223) - 55;
2722
+ const isBase64Char = (charCode) => charCode >= 65 && charCode <= 90 || // A-Z
2723
+ charCode >= 97 && charCode <= 122 || // a-z
2724
+ charCode >= 48 && charCode <= 57 || // 0-9
2725
+ charCode === 43 || // +
2726
+ charCode === 47 || // /
2727
+ charCode === 45 || // - (base64url)
2728
+ charCode === 95;
2729
+ const isBase64Whitespace = (charCode) => charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
2730
+ const base64Bytes = (significant) => {
2731
+ const groups = Math.floor(significant / 4);
2732
+ const remainder = significant % 4;
2733
+ return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
2734
+ };
2735
+ const estimateBase64BufferAllocation = (body) => {
2736
+ const len = body.length;
2737
+ let padding = 0;
2738
+ if (len > 0 && body.charCodeAt(len - 1) === 61) {
2739
+ padding++;
2740
+ if (len > 1 && body.charCodeAt(len - 2) === 61) {
2741
+ padding++;
2742
+ }
2743
+ }
2744
+ return Math.floor((len - padding) * 3 / 4);
2745
+ };
2746
+ const estimatePercentDecodedBase64Bytes = (body) => {
2747
+ const len = body.length;
2748
+ let significant = 0;
2749
+ let padding = 0;
2750
+ let invalid = false;
2751
+ for (let i = 0; i < len; i++) {
2752
+ let code = body.charCodeAt(i);
2753
+ if (code === 37 && isPercentEncodedByte(body, i, len)) {
2754
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
2755
+ i += 2;
2756
+ }
2757
+ if (isBase64Whitespace(code)) {
2758
+ continue;
2759
+ }
2760
+ if (code === 61) {
2761
+ padding++;
2762
+ continue;
2763
+ }
2764
+ if (!isBase64Char(code) || padding > 0) {
2765
+ invalid = true;
2766
+ continue;
2767
+ }
2768
+ significant++;
2769
+ }
2770
+ if (invalid || padding > 2 || padding > 0 && (significant + padding) % 4 !== 0 || significant % 4 === 1) {
2771
+ return estimateBase64BufferAllocation(body);
2772
+ }
2773
+ return base64Bytes(significant);
2774
+ };
2775
+ const estimateDataURLBytes = (url, estimateBase64) => {
2367
2776
  if (!url || typeof url !== "string") return 0;
2368
2777
  if (!url.startsWith("data:")) return 0;
2369
2778
  const comma = url.indexOf(",");
@@ -2372,43 +2781,7 @@ function estimateDataURLDecodedBytes(url) {
2372
2781
  const body = url.slice(comma + 1);
2373
2782
  const isBase64 = /;base64/i.test(meta);
2374
2783
  if (isBase64) {
2375
- let effectiveLen = body.length;
2376
- const len = body.length;
2377
- for (let i = 0; i < len; i++) {
2378
- if (body.charCodeAt(i) === 37 && i + 2 < len) {
2379
- const a = body.charCodeAt(i + 1);
2380
- const b = body.charCodeAt(i + 2);
2381
- const isHex = isHexDigit(a) && isHexDigit(b);
2382
- if (isHex) {
2383
- effectiveLen -= 2;
2384
- i += 2;
2385
- }
2386
- }
2387
- }
2388
- let pad = 0;
2389
- let idx = len - 1;
2390
- const tailIsPct3D = (j) => j >= 2 && body.charCodeAt(j - 2) === 37 && // '%'
2391
- body.charCodeAt(j - 1) === 51 && // '3'
2392
- (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
2393
- if (idx >= 0) {
2394
- if (body.charCodeAt(idx) === 61) {
2395
- pad++;
2396
- idx--;
2397
- } else if (tailIsPct3D(idx)) {
2398
- pad++;
2399
- idx -= 3;
2400
- }
2401
- }
2402
- if (pad === 1 && idx >= 0) {
2403
- if (body.charCodeAt(idx) === 61) {
2404
- pad++;
2405
- } else if (tailIsPct3D(idx)) {
2406
- pad++;
2407
- }
2408
- }
2409
- const groups = Math.floor(effectiveLen / 4);
2410
- const bytes2 = groups * 3 - (pad || 0);
2411
- return bytes2 > 0 ? bytes2 : 0;
2784
+ return estimateBase64(body);
2412
2785
  }
2413
2786
  let bytes = 0;
2414
2787
  for (let i = 0, len = body.length; i < len; i++) {
@@ -2433,9 +2806,27 @@ function estimateDataURLDecodedBytes(url) {
2433
2806
  }
2434
2807
  }
2435
2808
  return bytes;
2809
+ };
2810
+ function estimateDataURLDecodedBytes(url) {
2811
+ const fragmentIndex = typeof url === "string" ? url.indexOf("#") : -1;
2812
+ return estimateDataURLBytes(
2813
+ fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
2814
+ estimatePercentDecodedBase64Bytes
2815
+ );
2436
2816
  }
2437
- const VERSION$1 = "1.18.0";
2817
+ const VERSION$1 = "1.20.0";
2438
2818
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
2819
+ const DEFAULT_REQUEST_OPTIONS = {
2820
+ cache: "default",
2821
+ redirect: "follow",
2822
+ referrer: "about:client",
2823
+ referrerPolicy: "",
2824
+ mode: "cors",
2825
+ integrity: "",
2826
+ keepalive: false,
2827
+ priority: "auto",
2828
+ window: null
2829
+ };
2439
2830
  const { isFunction } = utils$1;
2440
2831
  const encodeUTF8 = (str) => encodeURIComponent(str).replace(
2441
2832
  /%([0-9A-F]{2})/gi,
@@ -2566,7 +2957,8 @@ const factory = (env) => {
2566
2957
  withCredentials = "same-origin",
2567
2958
  fetchOptions,
2568
2959
  maxContentLength,
2569
- maxBodyLength
2960
+ maxBodyLength,
2961
+ maxRedirects
2570
2962
  } = resolveConfig(config);
2571
2963
  const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
2572
2964
  const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
@@ -2696,17 +3088,44 @@ const factory = (env) => {
2696
3088
  }
2697
3089
  }
2698
3090
  headers.set("User-Agent", "axios/" + VERSION$1, false);
2699
- const resolvedOptions = {
2700
- ...fetchOptions,
3091
+ const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
3092
+ if (safeFetchOptions) {
3093
+ delete safeFetchOptions.body;
3094
+ delete safeFetchOptions.headers;
3095
+ delete safeFetchOptions.method;
3096
+ delete safeFetchOptions.signal;
3097
+ delete safeFetchOptions.duplex;
3098
+ delete safeFetchOptions.credentials;
3099
+ }
3100
+ const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
2701
3101
  signal: composedSignal,
2702
3102
  method: method.toUpperCase(),
2703
3103
  headers: toByteStringHeaderObject(headers.normalize()),
2704
3104
  body: data,
2705
3105
  duplex: "half",
2706
3106
  credentials: isCredentialsSupported ? withCredentials : void 0
2707
- };
3107
+ });
3108
+ if (isRequestSupported) {
3109
+ utils$1.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
3110
+ if (resolvedOptions[key] === void 0) {
3111
+ resolvedOptions[key] = value;
3112
+ }
3113
+ });
3114
+ if (resolvedOptions.signal === void 0) {
3115
+ resolvedOptions.signal = null;
3116
+ }
3117
+ if (resolvedOptions.body === void 0) {
3118
+ resolvedOptions.body = null;
3119
+ }
3120
+ }
3121
+ if (maxRedirects === 0) {
3122
+ resolvedOptions.redirect = "manual";
3123
+ if (safeFetchOptions) {
3124
+ safeFetchOptions.redirect = "manual";
3125
+ }
3126
+ }
2708
3127
  request = isRequestSupported && new Request(url, resolvedOptions);
2709
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
3128
+ let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url, resolvedOptions));
2710
3129
  const responseHeaders = AxiosHeaders$1.from(response.headers);
2711
3130
  if (hasMaxContentLength) {
2712
3131
  const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
@@ -2795,7 +3214,15 @@ const factory = (env) => {
2795
3214
  const canceledError = composedSignal.reason;
2796
3215
  canceledError.config = config;
2797
3216
  request && (canceledError.request = request);
2798
- err !== canceledError && (canceledError.cause = err);
3217
+ if (err !== canceledError) {
3218
+ Object.defineProperty(canceledError, "cause", {
3219
+ __proto__: null,
3220
+ value: err,
3221
+ writable: true,
3222
+ enumerable: false,
3223
+ configurable: true
3224
+ });
3225
+ }
2799
3226
  throw canceledError;
2800
3227
  }
2801
3228
  if (pendingBodyError) {
@@ -2807,18 +3234,21 @@ const factory = (env) => {
2807
3234
  throw err;
2808
3235
  }
2809
3236
  if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
2810
- throw Object.assign(
2811
- new AxiosError$1(
2812
- "Network Error",
2813
- AxiosError$1.ERR_NETWORK,
2814
- config,
2815
- request,
2816
- err && err.response
2817
- ),
2818
- {
2819
- cause: err.cause || err
2820
- }
3237
+ const networkError = new AxiosError$1(
3238
+ "Network Error",
3239
+ AxiosError$1.ERR_NETWORK,
3240
+ config,
3241
+ request,
3242
+ err && err.response
2821
3243
  );
3244
+ Object.defineProperty(networkError, "cause", {
3245
+ __proto__: null,
3246
+ value: err.cause || err,
3247
+ writable: true,
3248
+ enumerable: false,
3249
+ configurable: true
3250
+ });
3251
+ throw networkError;
2822
3252
  }
2823
3253
  throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
2824
3254
  }
@@ -2885,7 +3315,7 @@ function getAdapter$1(adapters2, config) {
2885
3315
  let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
2886
3316
  throw new AxiosError$1(
2887
3317
  `There is no suitable adapter to dispatch the request ` + s,
2888
- "ERR_NOT_SUPPORT"
3318
+ AxiosError$1.ERR_NOT_SUPPORT
2889
3319
  );
2890
3320
  }
2891
3321
  return adapter;
@@ -2910,9 +3340,10 @@ function throwIfCancellationRequested(config) {
2910
3340
  throw new CanceledError$1(null, config);
2911
3341
  }
2912
3342
  }
2913
- function dispatchRequest(config) {
3343
+ function dispatchRequest(_config) {
3344
+ const config = utils$1.toSafeFlatObject(_config);
2914
3345
  throwIfCancellationRequested(config);
2915
- config.headers = AxiosHeaders$1.from(config.headers);
3346
+ config.headers = AxiosHeaders$1.from(utils$1.getSafeProp(config, "headers"));
2916
3347
  config.data = transformData.call(config, config.transformRequest);
2917
3348
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
2918
3349
  config.headers.setContentType("application/x-www-form-urlencoded", false);
@@ -2988,7 +3419,7 @@ validators$1.spelling = function spelling(correctSpelling) {
2988
3419
  };
2989
3420
  };
2990
3421
  function assertOptions(options, schema, allowUnknown) {
2991
- if (typeof options !== "object") {
3422
+ if (typeof options !== "object" || options === null) {
2992
3423
  throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
2993
3424
  }
2994
3425
  const keys = Object.keys(options);
@@ -3038,16 +3469,15 @@ let Axios$1 = class Axios {
3038
3469
  return await this._request(configOrUrl, config);
3039
3470
  } catch (err) {
3040
3471
  if (err instanceof Error) {
3041
- let dummy = {};
3042
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
3043
- const stack = (() => {
3044
- if (!dummy.stack) {
3045
- return "";
3046
- }
3047
- const firstNewlineIndex = dummy.stack.indexOf("\n");
3048
- return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
3049
- })();
3050
3472
  try {
3473
+ let dummy = {};
3474
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
3475
+ const dummyStack = dummy.stack;
3476
+ let stack = "";
3477
+ if (typeof dummyStack === "string") {
3478
+ const firstNewlineIndex = dummyStack.indexOf("\n");
3479
+ stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
3480
+ }
3051
3481
  if (!err.stack) {
3052
3482
  err.stack = stack;
3053
3483
  } else if (stack) {
@@ -3117,9 +3547,9 @@ let Axios$1 = class Axios {
3117
3547
  },
3118
3548
  true
3119
3549
  );
3120
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
3550
+ config.method = (utils$1.getSafeProp(config, "method") || utils$1.getSafeProp(this.defaults, "method") || "get").toLowerCase();
3121
3551
  let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
3122
- headers && utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
3552
+ headers && utils$1.forEach(methodList.concat("common"), (method) => {
3123
3553
  delete headers[method];
3124
3554
  });
3125
3555
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
@@ -3162,16 +3592,31 @@ let Axios$1 = class Axios {
3162
3592
  const onFulfilled = requestInterceptorChain[i++];
3163
3593
  const onRejected = requestInterceptorChain[i++];
3164
3594
  try {
3165
- newConfig = onFulfilled(newConfig);
3595
+ newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
3166
3596
  } catch (error) {
3167
- onRejected.call(this, error);
3597
+ if (!onRejected) {
3598
+ promise = Promise.reject(error);
3599
+ break;
3600
+ }
3601
+ try {
3602
+ const rejectedResult = onRejected.call(this, error);
3603
+ if (utils$1.isThenable(rejectedResult)) {
3604
+ promise = Promise.resolve(rejectedResult).then(
3605
+ () => dispatchRequest.call(this, newConfig)
3606
+ );
3607
+ }
3608
+ } catch (rejectedError) {
3609
+ promise = Promise.reject(rejectedError);
3610
+ }
3168
3611
  break;
3169
3612
  }
3170
3613
  }
3171
- try {
3172
- promise = dispatchRequest.call(this, newConfig);
3173
- } catch (error) {
3174
- return Promise.reject(error);
3614
+ if (!promise) {
3615
+ try {
3616
+ promise = dispatchRequest.call(this, newConfig);
3617
+ } catch (error) {
3618
+ promise = Promise.reject(error);
3619
+ }
3175
3620
  }
3176
3621
  i = 0;
3177
3622
  len = responseInterceptorChain.length;
@@ -3357,14 +3802,22 @@ const HttpStatusCode$1 = {
3357
3802
  Gone: 410,
3358
3803
  LengthRequired: 411,
3359
3804
  PreconditionFailed: 412,
3805
+ /**
3806
+ * @deprecated Use `ContentTooLarge` instead.
3807
+ */
3360
3808
  PayloadTooLarge: 413,
3809
+ ContentTooLarge: 413,
3361
3810
  UriTooLong: 414,
3362
3811
  UnsupportedMediaType: 415,
3363
3812
  RangeNotSatisfiable: 416,
3364
3813
  ExpectationFailed: 417,
3365
3814
  ImATeapot: 418,
3366
3815
  MisdirectedRequest: 421,
3816
+ /**
3817
+ * @deprecated Use `UnprocessableContent` instead.
3818
+ */
3367
3819
  UnprocessableEntity: 422,
3820
+ UnprocessableContent: 422,
3368
3821
  Locked: 423,
3369
3822
  FailedDependency: 424,
3370
3823
  TooEarly: 425,
@@ -3384,6 +3837,7 @@ const HttpStatusCode$1 = {
3384
3837
  LoopDetected: 508,
3385
3838
  NotExtended: 510,
3386
3839
  NetworkAuthenticationRequired: 511,
3840
+ WebServerReturnsAnUnknownError: 520,
3387
3841
  WebServerIsDown: 521,
3388
3842
  ConnectionTimedOut: 522,
3389
3843
  OriginIsUnreachable: 523,
@@ -3392,7 +3846,9 @@ const HttpStatusCode$1 = {
3392
3846
  InvalidSslCertificate: 526
3393
3847
  };
3394
3848
  Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
3395
- HttpStatusCode$1[value] = key;
3849
+ if (HttpStatusCode$1[value] === void 0) {
3850
+ HttpStatusCode$1[value] = key;
3851
+ }
3396
3852
  });
3397
3853
  function createInstance(defaultConfig) {
3398
3854
  const context = new Axios$1(defaultConfig);