@cccsaurora/clue-ui 1.5.0-dev.487 → 1.6.0-dev.524.1

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 (63) hide show
  1. package/{ActionForm-DxbV_aLe.js → ActionForm-C1D2_1Pg.js} +6 -6
  2. package/{AnnotationDetails-EDZRnwin.js → AnnotationDetails-C683Hvym.js} +1 -1
  3. package/{AnnotationPreview-DfLcrcuH.js → AnnotationPreview-Bm9e2UgC.js} +1 -1
  4. package/{ClueEnrichContext-DUxJFS3j.js → ClueEnrichContext-DmERFjhQ.js} +3 -3
  5. package/components/AnnotationDetailPopover.js +3 -3
  6. package/components/AnnotationDetails.js +2 -2
  7. package/components/AnnotationPreview.js +1 -1
  8. package/components/EnrichedCard.js +1 -1
  9. package/components/EnrichedChip.js +3 -3
  10. package/components/EnrichedTypography.js +2 -2
  11. package/components/RetryFailedEnrichments.js +1 -1
  12. package/components/SourcePicker.js +1 -1
  13. package/components/actions/ActionForm.js +2 -2
  14. package/components/actions/ExecutePopover.js +1 -1
  15. package/components/actions/ResultModal.js +1 -1
  16. package/components/actions/formats/index.js +1 -1
  17. package/components/display/graph/elements/NodeCard.js +1 -1
  18. package/components/display/graph/index.js +2 -2
  19. package/components/display/graph/visualizations/cloud/index.js +3 -2
  20. package/components/display/graph/visualizations/icons/TargetIcon.js +0 -1
  21. package/components/display/graph/visualizations/tree/BundleLine.js +2 -1
  22. package/components/display/graph/visualizations/tree/index.js +1 -1
  23. package/components/display/json/index.js +1 -1
  24. package/components/display/markdown/index.js +87 -27
  25. package/components/enrichment/EnrichPopover.js +1 -1
  26. package/components/fetchers/Fetcher.js +1 -1
  27. package/components/fetchers/FetcherResultView.js +1 -1
  28. package/components/group/GroupControl.js +1 -1
  29. package/components/stats/QueryStatus.js +1 -1
  30. package/{index-CVUD9o3t.js → d3-CwtkB99t.js} +15024 -10621
  31. package/database/index.js +2 -2
  32. package/database/replication.js +2 -2
  33. package/hooks/ClueActionContext.js +2 -2
  34. package/hooks/ClueDatabaseContext.d.ts +1 -1
  35. package/hooks/ClueDatabaseContext.js +5 -1
  36. package/hooks/ClueEnrichContext.js +2 -2
  37. package/hooks/ClueFetcherContext.js +1 -1
  38. package/hooks/ClueGroupContext.js +1 -1
  39. package/hooks/CluePopupContext.js +2 -2
  40. package/hooks/ClueProvider.js +3 -3
  41. package/hooks/selectors.js +2 -2
  42. package/hooks/useActionResult.js +1 -1
  43. package/hooks/useAnnotations.js +2 -2
  44. package/hooks/useClue.js +1 -1
  45. package/hooks/useClueActions.js +1 -1
  46. package/hooks/useClueTypeConfig.js +1 -1
  47. package/hooks/useErrors.js +1 -1
  48. package/hooks/useFetcherResult.js +1 -1
  49. package/hooks/useMyHighlights.js +1 -1
  50. package/icons/Action.js +2 -2
  51. package/icons/Assessment.js +1 -1
  52. package/icons/Context.js +3 -3
  53. package/icons/Opinion.js +2 -2
  54. package/{index-DcMufc6R.js → index-Bx5giDpY.js} +730 -250
  55. package/{index-CARYR0Hw.js → index-D1tw5sJ1.js} +94 -27
  56. package/{index-DUEubgWN.js → index-D4JJWbGh.js} +2 -2
  57. package/{index-C8VMJ2QX.js → index-DzbOfIT_.js} +9 -7
  58. package/index.css +2 -11
  59. package/main.js +5 -5
  60. package/package.json +30 -40
  61. package/plugins/json/index.js +1 -1
  62. package/{replication-DzmbOO2P.js → replication-Bxa4yXXZ.js} +134 -50
  63. package/utils/time.js +8 -8
@@ -393,10 +393,16 @@ const isPlainObject = (val) => {
393
393
  return false;
394
394
  }
395
395
  const prototype2 = getPrototypeOf(val);
396
- return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
397
- // evidence the value is tagged/iterable, while ignoring members reachable
398
- // only through shared or terminal prototype boundaries.
399
- !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
396
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
397
+ // value is tagged/iterable, ignoring members reachable only through shared
398
+ // or terminal prototype boundaries. This is exactly what
399
+ // hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
400
+ // above (null, Object.prototype, or a terminal null-prototype template) is
401
+ // a boundary, so the walk never inspects anything but `val`'s own members,
402
+ // and stops before even those when `val` is itself the boundary
403
+ // Object.prototype. Checking that inline avoids allocating the walker's
404
+ // `seen` list twice per call on the mergeConfig / merge hot path.
405
+ (isPrototypeBoundary(val, prototype2, true) || !hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator));
400
406
  };
401
407
  const isEmptyObject = (val) => {
402
408
  if (!isObject(val) || isBuffer(val)) {
@@ -497,11 +503,21 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
497
503
  function merge(...objs) {
498
504
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
499
505
  const result = {};
506
+ const lowerCaseKeys = caseless ? /* @__PURE__ */ Object.create(null) : null;
500
507
  const assignValue = (val, key) => {
501
508
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
502
509
  return;
503
510
  }
504
- const targetKey = caseless && typeof key === "string" && findKey(result, key) || key;
511
+ let targetKey = key;
512
+ if (lowerCaseKeys && typeof key === "string") {
513
+ const lowerKey = key.toLowerCase();
514
+ const knownKey = lowerCaseKeys[lowerKey];
515
+ if (knownKey !== void 0 && hasOwnProperty(result, knownKey)) {
516
+ targetKey = knownKey;
517
+ } else {
518
+ lowerCaseKeys[lowerKey] = key;
519
+ }
520
+ }
505
521
  const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0;
506
522
  if (isPlainObject(existing) && isPlainObject(val)) {
507
523
  result[targetKey] = merge(existing, val);
@@ -519,7 +535,7 @@ function merge(...objs) {
519
535
  continue;
520
536
  }
521
537
  forEach(source, assignValue);
522
- if (typeof source !== "object" || isArray(source)) {
538
+ if (typeof source !== "object" || isArray(source) || !Object.getOwnPropertySymbols) {
523
539
  continue;
524
540
  }
525
541
  const symbols = Object.getOwnPropertySymbols(source);
@@ -615,7 +631,24 @@ const toArray = (thing) => {
615
631
  if (!thing) return null;
616
632
  if (isArray(thing)) return thing;
617
633
  let i = thing.length;
618
- if (!isNumber(i)) return null;
634
+ if (!Number.isSafeInteger(i) || i < 0 || i > 4294967295) return null;
635
+ const indexes = /* @__PURE__ */ new Set();
636
+ const seen = /* @__PURE__ */ new Set();
637
+ let source = thing;
638
+ while (source != null && indexes.size < i) {
639
+ if (seen.has(source)) return null;
640
+ seen.add(source);
641
+ const prototype2 = getPrototypeOf(source);
642
+ if (isPrototypeBoundary(source, prototype2, source === thing)) break;
643
+ Object.getOwnPropertyNames(source).forEach((key) => {
644
+ const index2 = +key;
645
+ if (Number.isInteger(index2) && index2 >= 0 && index2 < i && String(index2) === key && hasOwnProperty(source, key)) {
646
+ indexes.add(index2);
647
+ }
648
+ });
649
+ source = prototype2;
650
+ }
651
+ if (indexes.size !== i) return null;
619
652
  const arr = new Array(i);
620
653
  while (i-- > 0) {
621
654
  arr[i] = thing[i];
@@ -845,7 +878,7 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
845
878
  "user-agent"
846
879
  ]);
847
880
  const parseHeaders = (rawHeaders) => {
848
- const parsed = {};
881
+ const parsed = /* @__PURE__ */ Object.create(null);
849
882
  let key;
850
883
  let val;
851
884
  let i;
@@ -1009,9 +1042,11 @@ function parseParameters(value) {
1009
1042
  return parameters;
1010
1043
  }
1011
1044
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1045
+ const PROTO_HEADER_SLOT = "__Proto__";
1046
+ const headerSlot = (name) => name === "__proto__" ? PROTO_HEADER_SLOT : name;
1012
1047
  function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
1013
1048
  if (utils$1.isFunction(filter2)) {
1014
- return filter2.call(this, value, header);
1049
+ return filter2.call(context, value, header);
1015
1050
  }
1016
1051
  if (isHeaderNameFilter) {
1017
1052
  value = header;
@@ -1056,7 +1091,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
1056
1091
  }
1057
1092
  const key = utils$1.findKey(self2, lHeader);
1058
1093
  if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1059
- self2[key || _header] = normalizeValue(_value);
1094
+ self2[headerSlot(key || _header)] = normalizeValue(_value);
1060
1095
  }
1061
1096
  }
1062
1097
  const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
@@ -1149,7 +1184,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
1149
1184
  }
1150
1185
  normalize(format2) {
1151
1186
  const self2 = this;
1152
- const headers = {};
1187
+ const headers = /* @__PURE__ */ Object.create(null);
1153
1188
  utils$1.forEach(this, (value, header) => {
1154
1189
  const key = utils$1.findKey(headers, header);
1155
1190
  if (key) {
@@ -1157,7 +1192,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
1157
1192
  delete self2[header];
1158
1193
  return;
1159
1194
  }
1160
- const normalized = format2 ? formatHeader(header) : String(header).trim();
1195
+ const normalized = headerSlot(format2 ? formatHeader(header) : String(header).trim());
1161
1196
  if (normalized !== header) {
1162
1197
  delete self2[header];
1163
1198
  }
@@ -1304,6 +1339,28 @@ function aggregateErrorMessage(error) {
1304
1339
  }).filter(Boolean).join("; ");
1305
1340
  return message || error.name || "AggregateError";
1306
1341
  }
1342
+ const CAUSED_BY_SEPARATOR = "\nCaused by: ";
1343
+ const $causeStack = Symbol("causeStack");
1344
+ function getCauseStackIndex(error, stack) {
1345
+ const causeStack = utils$1.hasOwnProp(error, $causeStack) && error[$causeStack];
1346
+ return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
1347
+ }
1348
+ function appendCauseStack(target, source) {
1349
+ try {
1350
+ const sourceStack = source && source.stack;
1351
+ if (typeof sourceStack !== "string" || !sourceStack) {
1352
+ return;
1353
+ }
1354
+ const targetStack = target.stack;
1355
+ if (typeof targetStack !== "string" || !targetStack) {
1356
+ return;
1357
+ }
1358
+ const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
1359
+ target.stack = targetStack + causeStack;
1360
+ Object.defineProperty(target, $causeStack, { __proto__: null, value: causeStack });
1361
+ } catch (e) {
1362
+ }
1363
+ }
1307
1364
  let AxiosError$1 = class AxiosError extends Error {
1308
1365
  static from(error, code, config, request, response, customProps) {
1309
1366
  let message = error.message;
@@ -1319,6 +1376,7 @@ let AxiosError$1 = class AxiosError extends Error {
1319
1376
  configurable: true
1320
1377
  });
1321
1378
  axiosError.name = error.name;
1379
+ appendCauseStack(axiosError, error);
1322
1380
  if (error.status != null && axiosError.status == null) {
1323
1381
  axiosError.status = error.status;
1324
1382
  }
@@ -1603,6 +1661,12 @@ function trimHandlers(handlers) {
1603
1661
  handlers.pop();
1604
1662
  }
1605
1663
  }
1664
+ function normalizeHandlerId(id) {
1665
+ if (typeof id === "string" && id !== "" && String(Number(id)) === id) {
1666
+ return Number(id);
1667
+ }
1668
+ return id;
1669
+ }
1606
1670
  function syncHandlerEntries(manager, internals) {
1607
1671
  const handlers = manager.handlers;
1608
1672
  const length = countHandlers(handlers);
@@ -1673,9 +1737,10 @@ class InterceptorManager {
1673
1737
  eject(id) {
1674
1738
  const internals = this[$internals];
1675
1739
  syncHandlerEntries(this, internals);
1676
- const entry = internals.handlerEntries.get(id);
1740
+ const handlerId = normalizeHandlerId(id);
1741
+ const entry = internals.handlerEntries.get(handlerId);
1677
1742
  if (entry) {
1678
- internals.handlerEntries.delete(id);
1743
+ internals.handlerEntries.delete(handlerId);
1679
1744
  if (this.handlers[entry.index] !== entry.handler) {
1680
1745
  return;
1681
1746
  }
@@ -1732,7 +1797,8 @@ const transitionalDefaults = {
1732
1797
  clarifyTimeoutError: false,
1733
1798
  legacyInterceptorReqResOrdering: true,
1734
1799
  advertiseZstdAcceptEncoding: false,
1735
- validateStatusUndefinedResolves: true
1800
+ validateStatusUndefinedResolves: true,
1801
+ encodeBasicAuthUsername: false
1736
1802
  };
1737
1803
  const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
1738
1804
  const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
@@ -1809,6 +1875,24 @@ function arrayToObject(arr) {
1809
1875
  }
1810
1876
  return obj;
1811
1877
  }
1878
+ function normalizeArray(value) {
1879
+ if (!utils$1.isArray(value)) return value;
1880
+ const keys = Object.keys(value);
1881
+ return keys.length !== value.length || keys.some((key, index2) => key !== String(index2)) ? arrayToObject(value) : value;
1882
+ }
1883
+ function normalizeArrays(obj) {
1884
+ const pending = [obj];
1885
+ while (pending.length) {
1886
+ const target = pending.pop();
1887
+ Object.keys(target).forEach((key) => {
1888
+ const value = target[key] = normalizeArray(target[key]);
1889
+ if (utils$1.isArray(value) || utils$1.isPlainObject(value)) {
1890
+ pending.push(value);
1891
+ }
1892
+ });
1893
+ }
1894
+ return obj;
1895
+ }
1812
1896
  function formDataToJSON(formData) {
1813
1897
  function buildPath(path, value, target, index2) {
1814
1898
  throwIfDepthExceeded(index2);
@@ -1819,6 +1903,7 @@ function formDataToJSON(formData) {
1819
1903
  name = !name && utils$1.isArray(target) ? target.length : name;
1820
1904
  if (isLast) {
1821
1905
  if (utils$1.hasOwnProp(target, name)) {
1906
+ target[name] = normalizeArray(target[name]);
1822
1907
  target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
1823
1908
  } else {
1824
1909
  target[name] = value;
@@ -1839,7 +1924,7 @@ function formDataToJSON(formData) {
1839
1924
  utils$1.forEachEntry(formData, (name, value) => {
1840
1925
  buildPath(parsePropPath(name), value, obj, 0);
1841
1926
  });
1842
- return obj;
1927
+ return normalizeArrays(obj);
1843
1928
  }
1844
1929
  return null;
1845
1930
  }
@@ -2027,8 +2112,82 @@ function normalizeURLForProtocolCheck(url) {
2027
2112
  }
2028
2113
  function parseProtocol(url) {
2029
2114
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2030
- return match && match[1] || "";
2115
+ return match && match[1].toLowerCase() || "";
2031
2116
  }
2117
+ const decodeCookieValue = (value) => {
2118
+ try {
2119
+ return decodeURIComponent(value);
2120
+ } catch (e) {
2121
+ return value;
2122
+ }
2123
+ };
2124
+ const cookies = platform.hasStandardBrowserEnv ? (
2125
+ // Standard browser envs support document.cookie
2126
+ {
2127
+ write(name, value, expires, path, domain, secure, sameSite) {
2128
+ if (typeof document === "undefined") return;
2129
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
2130
+ if (utils$1.isNumber(expires)) {
2131
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
2132
+ }
2133
+ if (utils$1.isString(path)) {
2134
+ cookie.push(`path=${path}`);
2135
+ }
2136
+ if (utils$1.isString(domain)) {
2137
+ cookie.push(`domain=${domain}`);
2138
+ }
2139
+ if (secure === true) {
2140
+ cookie.push("secure");
2141
+ }
2142
+ if (utils$1.isString(sameSite)) {
2143
+ cookie.push(`SameSite=${sameSite}`);
2144
+ }
2145
+ document.cookie = cookie.join("; ");
2146
+ },
2147
+ read(name) {
2148
+ if (typeof document === "undefined") return null;
2149
+ const cookieString = document.cookie;
2150
+ if (!cookieString) return null;
2151
+ const cookies2 = cookieString.split(";");
2152
+ for (let i = 0; i < cookies2.length; i++) {
2153
+ const cookie = cookies2[i].replace(/^\s+/, "");
2154
+ const eq = cookie.indexOf("=");
2155
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
2156
+ return decodeCookieValue(cookie.slice(eq + 1));
2157
+ }
2158
+ }
2159
+ return null;
2160
+ },
2161
+ async readAsync(name) {
2162
+ try {
2163
+ const store = typeof window !== "undefined" && window.cookieStore;
2164
+ if (store && utils$1.isFunction(store.get)) {
2165
+ const cookie = await store.get(name);
2166
+ return cookie ? decodeCookieValue(cookie.value) : null;
2167
+ }
2168
+ } catch (e) {
2169
+ }
2170
+ return this.read(name);
2171
+ },
2172
+ remove(name) {
2173
+ this.write(name, "", Date.now() - 864e5, "/");
2174
+ }
2175
+ }
2176
+ ) : (
2177
+ // Non-standard browser env (web workers, react-native) lack needed support.
2178
+ {
2179
+ write() {
2180
+ },
2181
+ read() {
2182
+ return null;
2183
+ },
2184
+ async readAsync() {
2185
+ return null;
2186
+ },
2187
+ remove() {
2188
+ }
2189
+ }
2190
+ );
2032
2191
  function speedometer(samplesCount, min) {
2033
2192
  samplesCount = samplesCount || 10;
2034
2193
  const bytes = new Array(samplesCount);
@@ -2134,68 +2293,10 @@ const progressEventDecorator = (total, throttled) => {
2134
2293
  ];
2135
2294
  };
2136
2295
  const asyncDecorator = (fn, scheduler = utils$1.asap) => (...args) => scheduler(() => fn(...args));
2137
- const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
2138
- url = new URL(url, platform.origin);
2139
- return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
2140
- })(
2141
- new URL(platform.origin),
2142
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
2143
- ) : () => true;
2144
- const cookies = platform.hasStandardBrowserEnv ? (
2145
- // Standard browser envs support document.cookie
2146
- {
2147
- write(name, value, expires, path, domain, secure, sameSite) {
2148
- if (typeof document === "undefined") return;
2149
- const cookie = [`${name}=${encodeURIComponent(value)}`];
2150
- if (utils$1.isNumber(expires)) {
2151
- cookie.push(`expires=${new Date(expires).toUTCString()}`);
2152
- }
2153
- if (utils$1.isString(path)) {
2154
- cookie.push(`path=${path}`);
2155
- }
2156
- if (utils$1.isString(domain)) {
2157
- cookie.push(`domain=${domain}`);
2158
- }
2159
- if (secure === true) {
2160
- cookie.push("secure");
2161
- }
2162
- if (utils$1.isString(sameSite)) {
2163
- cookie.push(`SameSite=${sameSite}`);
2164
- }
2165
- document.cookie = cookie.join("; ");
2166
- },
2167
- read(name) {
2168
- if (typeof document === "undefined") return null;
2169
- const cookies2 = document.cookie.split(";");
2170
- for (let i = 0; i < cookies2.length; i++) {
2171
- const cookie = cookies2[i].replace(/^\s+/, "");
2172
- const eq = cookie.indexOf("=");
2173
- if (eq !== -1 && cookie.slice(0, eq) === name) {
2174
- try {
2175
- return decodeURIComponent(cookie.slice(eq + 1));
2176
- } catch (e) {
2177
- return cookie.slice(eq + 1);
2178
- }
2179
- }
2180
- }
2181
- return null;
2182
- },
2183
- remove(name) {
2184
- this.write(name, "", Date.now() - 864e5, "/");
2185
- }
2186
- }
2187
- ) : (
2188
- // Non-standard browser env (web workers, react-native) lack needed support.
2189
- {
2190
- write() {
2191
- },
2192
- read() {
2193
- return null;
2194
- },
2195
- remove() {
2196
- }
2197
- }
2198
- );
2296
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2) => (url) => {
2297
+ url = new URL(url, document.baseURI || platform.origin);
2298
+ return origin2.protocol === url.protocol && origin2.host === url.host && origin2.port === url.port;
2299
+ })(new URL(platform.origin)) : () => true;
2199
2300
  function isAbsoluteURL(url) {
2200
2301
  if (typeof url !== "string") {
2201
2302
  return false;
@@ -2255,124 +2356,207 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
2255
2356
  }
2256
2357
  return requestedURL;
2257
2358
  }
2359
+ function assertParamsAcyclic(params) {
2360
+ const pending = [{ value: params }];
2361
+ const active = /* @__PURE__ */ new WeakSet();
2362
+ const visited = /* @__PURE__ */ new WeakSet();
2363
+ while (pending.length) {
2364
+ const { value, done } = pending.pop();
2365
+ if (!utils$1.isPlainObject(value) && !utils$1.isArray(value)) continue;
2366
+ if (done) {
2367
+ active.delete(value);
2368
+ continue;
2369
+ }
2370
+ if (active.has(value)) {
2371
+ throw new AxiosError$1(
2372
+ "Circular reference detected in params",
2373
+ AxiosError$1.ERR_BAD_OPTION_VALUE
2374
+ );
2375
+ }
2376
+ if (visited.has(value)) continue;
2377
+ visited.add(value);
2378
+ active.add(value);
2379
+ pending.push({ value, done: true });
2380
+ const keys = Object.keys(value);
2381
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
2382
+ Object.getOwnPropertySymbols(value).forEach((key) => {
2383
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
2384
+ if (descriptor && descriptor.enumerable) keys.push(key);
2385
+ });
2386
+ }
2387
+ keys.forEach((key) => {
2388
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
2389
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
2390
+ if (descriptor && utils$1.hasOwnProp(descriptor, "value")) {
2391
+ pending.push({ value: descriptor.value });
2392
+ }
2393
+ } else {
2394
+ pending.push({ value: value[key] });
2395
+ }
2396
+ });
2397
+ }
2398
+ }
2258
2399
  const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
2259
2400
  const ownEnumerableKeys = (thing) => {
2260
2401
  if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
2261
2402
  return Object.keys(thing).concat(
2262
- Object.getOwnPropertySymbols(thing).filter(
2263
- (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
2264
- )
2403
+ Object.getOwnPropertySymbols(thing).filter((symbol) => {
2404
+ const descriptor = Object.getOwnPropertyDescriptor(thing, symbol);
2405
+ return descriptor && descriptor.enumerable;
2406
+ })
2265
2407
  );
2266
2408
  }
2267
2409
  return Object.keys(thing);
2268
2410
  };
2269
- function mergeConfig$1(config1, config2) {
2270
- config1 = config1 || {};
2271
- config2 = config2 || {};
2272
- const config = /* @__PURE__ */ Object.create(null);
2273
- Object.defineProperty(config, "hasOwnProperty", {
2274
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
2275
- // this data descriptor into an accessor descriptor on the way in.
2276
- __proto__: null,
2277
- value: Object.prototype.hasOwnProperty,
2278
- enumerable: false,
2279
- writable: true,
2280
- configurable: true
2281
- });
2282
- function getMergedValue(target, source, prop, caseless) {
2283
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2284
- return utils$1.merge.call({ caseless }, target, source);
2285
- } else if (utils$1.isPlainObject(source)) {
2286
- return utils$1.merge({}, source);
2287
- } else if (utils$1.isArray(source)) {
2288
- return source.slice();
2289
- }
2290
- return source;
2411
+ function mergeParams(a, b) {
2412
+ const pending = [];
2413
+ const copies = /* @__PURE__ */ new WeakMap();
2414
+ const empty = {};
2415
+ function copy(target, source) {
2416
+ if (!utils$1.isPlainObject(source)) {
2417
+ return utils$1.isArray(source) ? source.slice() : source;
2418
+ }
2419
+ const base = utils$1.isPlainObject(target) ? target : empty;
2420
+ let bases = copies.get(source);
2421
+ if (!bases) {
2422
+ bases = /* @__PURE__ */ new WeakMap();
2423
+ copies.set(source, bases);
2424
+ }
2425
+ if (bases.has(base)) return bases.get(base);
2426
+ const result2 = {};
2427
+ bases.set(base, result2);
2428
+ pending.push({ base, source, result: result2 });
2429
+ return result2;
2430
+ }
2431
+ const result = utils$1.isUndefined(b) ? copy(void 0, a) : copy(a, b);
2432
+ while (pending.length) {
2433
+ const { base, source, result: target } = pending.pop();
2434
+ const baseKeys = new Set(ownEnumerableKeys(base));
2435
+ const sourceKeys = new Set(ownEnumerableKeys(source));
2436
+ const keys = /* @__PURE__ */ new Set([...baseKeys, ...sourceKeys]);
2437
+ keys.forEach((key) => {
2438
+ if (key === "__proto__" || key === "constructor" || key === "prototype") return;
2439
+ const hasSource = sourceKeys.has(key);
2440
+ const value = hasSource ? source[key] : void 0;
2441
+ const previous = (!hasSource || utils$1.isPlainObject(value)) && baseKeys.has(key) ? base[key] : void 0;
2442
+ target[key] = hasSource ? copy(previous, value) : copy(void 0, previous);
2443
+ });
2291
2444
  }
2292
- function mergeDeepProperties(a, b, prop, caseless) {
2293
- if (!utils$1.isUndefined(b)) {
2294
- return getMergedValue(a, b, prop, caseless);
2295
- } else if (!utils$1.isUndefined(a)) {
2296
- return getMergedValue(void 0, a, prop, caseless);
2297
- }
2445
+ assertParamsAcyclic(result);
2446
+ return result;
2447
+ }
2448
+ function getMergedValue(target, source, prop, caseless) {
2449
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2450
+ return utils$1.merge.call({ caseless }, target, source);
2451
+ } else if (utils$1.isPlainObject(source)) {
2452
+ return utils$1.merge({}, source);
2453
+ } else if (utils$1.isArray(source)) {
2454
+ return source.slice();
2455
+ }
2456
+ return source;
2457
+ }
2458
+ function mergeDeepProperties(a, b, prop, caseless) {
2459
+ if (!utils$1.isUndefined(b)) {
2460
+ return getMergedValue(a, b, prop, caseless);
2461
+ } else if (!utils$1.isUndefined(a)) {
2462
+ return getMergedValue(void 0, a, prop, caseless);
2298
2463
  }
2299
- function valueFromConfig2(a, b) {
2300
- if (!utils$1.isUndefined(b)) {
2301
- return getMergedValue(void 0, b);
2302
- }
2464
+ }
2465
+ function valueFromConfig2(a, b) {
2466
+ if (!utils$1.isUndefined(b)) {
2467
+ return getMergedValue(void 0, b);
2303
2468
  }
2304
- function defaultToConfig2(a, b) {
2305
- if (!utils$1.isUndefined(b)) {
2306
- return getMergedValue(void 0, b);
2307
- } else if (!utils$1.isUndefined(a)) {
2308
- return getMergedValue(void 0, a);
2309
- }
2469
+ }
2470
+ function defaultToConfig2(a, b) {
2471
+ if (!utils$1.isUndefined(b)) {
2472
+ return getMergedValue(void 0, b);
2473
+ } else if (!utils$1.isUndefined(a)) {
2474
+ return getMergedValue(void 0, a);
2310
2475
  }
2311
- function getMergedTransitionalOption(prop) {
2312
- const transitional2 = utils$1.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
2313
- if (!utils$1.isUndefined(transitional2)) {
2314
- if (utils$1.isPlainObject(transitional2)) {
2315
- if (utils$1.hasOwnProp(transitional2, prop)) {
2316
- return transitional2[prop];
2317
- }
2318
- } else {
2319
- return void 0;
2476
+ }
2477
+ function getMergedTransitionalOption(config1, config2, prop) {
2478
+ const transitional2 = utils$1.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
2479
+ if (!utils$1.isUndefined(transitional2)) {
2480
+ if (utils$1.isPlainObject(transitional2)) {
2481
+ if (utils$1.hasOwnProp(transitional2, prop)) {
2482
+ return transitional2[prop];
2320
2483
  }
2484
+ } else {
2485
+ return void 0;
2321
2486
  }
2322
- const transitional1 = utils$1.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
2323
- if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
2324
- return transitional1[prop];
2325
- }
2326
- return void 0;
2327
- }
2328
- function mergeDirectKeys(a, b, prop) {
2329
- if (utils$1.hasOwnProp(config2, prop)) {
2330
- return getMergedValue(a, b);
2331
- } else if (utils$1.hasOwnProp(config1, prop)) {
2332
- return getMergedValue(void 0, a);
2333
- }
2334
- }
2335
- const mergeMap = {
2336
- url: valueFromConfig2,
2337
- method: valueFromConfig2,
2338
- data: valueFromConfig2,
2339
- baseURL: defaultToConfig2,
2340
- transformRequest: defaultToConfig2,
2341
- transformResponse: defaultToConfig2,
2342
- paramsSerializer: defaultToConfig2,
2343
- timeout: defaultToConfig2,
2344
- timeoutErrorMessage: defaultToConfig2,
2345
- withCredentials: defaultToConfig2,
2346
- withXSRFToken: defaultToConfig2,
2347
- adapter: defaultToConfig2,
2348
- responseType: defaultToConfig2,
2349
- xsrfCookieName: defaultToConfig2,
2350
- xsrfHeaderName: defaultToConfig2,
2351
- onUploadProgress: defaultToConfig2,
2352
- onDownloadProgress: defaultToConfig2,
2353
- decompress: defaultToConfig2,
2354
- maxContentLength: defaultToConfig2,
2355
- maxBodyLength: defaultToConfig2,
2356
- beforeRedirect: defaultToConfig2,
2357
- transport: defaultToConfig2,
2358
- httpAgent: defaultToConfig2,
2359
- httpsAgent: defaultToConfig2,
2360
- cancelToken: defaultToConfig2,
2361
- socketPath: defaultToConfig2,
2362
- allowedSocketPaths: defaultToConfig2,
2363
- responseEncoding: defaultToConfig2,
2364
- validateStatus: mergeDirectKeys,
2365
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
2366
- };
2367
- utils$1.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2368
- if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
2487
+ }
2488
+ const transitional1 = utils$1.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
2489
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
2490
+ return transitional1[prop];
2491
+ }
2492
+ return void 0;
2493
+ }
2494
+ function mergeDirectKeys(a, b, prop, config1, config2) {
2495
+ if (utils$1.hasOwnProp(config2, prop)) {
2496
+ return getMergedValue(a, b);
2497
+ } else if (utils$1.hasOwnProp(config1, prop)) {
2498
+ return getMergedValue(void 0, a);
2499
+ }
2500
+ }
2501
+ function mergeHeaders(a, b, prop) {
2502
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
2503
+ }
2504
+ const hasOwnPropertyDescriptor = Object.freeze({
2505
+ __proto__: null,
2506
+ value: Object.prototype.hasOwnProperty,
2507
+ enumerable: false,
2508
+ writable: true,
2509
+ configurable: true
2510
+ });
2511
+ const mergeMap = {
2512
+ url: valueFromConfig2,
2513
+ method: valueFromConfig2,
2514
+ data: valueFromConfig2,
2515
+ baseURL: defaultToConfig2,
2516
+ transformRequest: defaultToConfig2,
2517
+ transformResponse: defaultToConfig2,
2518
+ params: mergeParams,
2519
+ paramsSerializer: defaultToConfig2,
2520
+ timeout: defaultToConfig2,
2521
+ timeoutErrorMessage: defaultToConfig2,
2522
+ withCredentials: defaultToConfig2,
2523
+ withXSRFToken: defaultToConfig2,
2524
+ adapter: defaultToConfig2,
2525
+ responseType: defaultToConfig2,
2526
+ xsrfCookieName: defaultToConfig2,
2527
+ xsrfHeaderName: defaultToConfig2,
2528
+ onUploadProgress: defaultToConfig2,
2529
+ onDownloadProgress: defaultToConfig2,
2530
+ decompress: defaultToConfig2,
2531
+ maxContentLength: defaultToConfig2,
2532
+ maxBodyLength: defaultToConfig2,
2533
+ beforeRedirect: defaultToConfig2,
2534
+ transport: defaultToConfig2,
2535
+ httpAgent: defaultToConfig2,
2536
+ httpsAgent: defaultToConfig2,
2537
+ cancelToken: defaultToConfig2,
2538
+ socketPath: defaultToConfig2,
2539
+ allowedSocketPaths: defaultToConfig2,
2540
+ responseEncoding: defaultToConfig2,
2541
+ validateStatus: mergeDirectKeys,
2542
+ headers: mergeHeaders
2543
+ };
2544
+ function mergeConfig$1(config1, config2) {
2545
+ config1 = config1 || {};
2546
+ config2 = config2 || {};
2547
+ const config = /* @__PURE__ */ Object.create(null);
2548
+ Object.defineProperty(config, "hasOwnProperty", hasOwnPropertyDescriptor);
2549
+ const keys = ownEnumerableKeys({ ...config1, ...config2 });
2550
+ for (let i = 0, len = keys.length; i < len; i++) {
2551
+ const prop = keys[i];
2552
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype") continue;
2369
2553
  const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2370
2554
  const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : void 0;
2371
2555
  const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : void 0;
2372
- const configValue = merge2(a, b, prop);
2556
+ const configValue = merge2 === mergeDirectKeys ? merge2(a, b, prop, config1, config2) : merge2(a, b, prop);
2373
2557
  utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
2374
- });
2375
- if (utils$1.hasOwnProp(config2, "validateStatus") && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption("validateStatusUndefinedResolves") === false) {
2558
+ }
2559
+ if (utils$1.hasOwnProp(config2, "validateStatus") && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption(config1, config2, "validateStatusUndefinedResolves") === false) {
2376
2560
  if (utils$1.hasOwnProp(config1, "validateStatus")) {
2377
2561
  config.validateStatus = getMergedValue(void 0, config1.validateStatus);
2378
2562
  } else {
@@ -2397,7 +2581,8 @@ const encodeUTF8$1 = (str) => encodeURIComponent(str).replace(
2397
2581
  /%([0-9A-F]{2})/gi,
2398
2582
  (_, hex) => String.fromCharCode(parseInt(hex, 16))
2399
2583
  );
2400
- function resolveConfig(config) {
2584
+ const readCookie = (name) => cookies.read(name);
2585
+ function resolveConfig(config, readXsrfCookie = readCookie) {
2401
2586
  const newConfig = mergeConfig$1({}, config);
2402
2587
  const own2 = (key) => utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : void 0;
2403
2588
  const data = own2("data");
@@ -2418,10 +2603,15 @@ function resolveConfig(config) {
2418
2603
  if (auth2) {
2419
2604
  const username = utils$1.getSafeProp(auth2, "username") || "";
2420
2605
  const password = utils$1.getSafeProp(auth2, "password") || "";
2606
+ const transitional2 = own2("transitional");
2607
+ const encodeUsername = transitional2 && utils$1.hasOwnProp(transitional2, "encodeBasicAuthUsername") && transitional2.encodeBasicAuthUsername === true;
2421
2608
  try {
2422
2609
  headers.set(
2423
2610
  "Authorization",
2424
- "Basic " + btoa(username + ":" + (password ? encodeUTF8$1(password) : ""))
2611
+ // Preserve legacy username bytes unless the caller opts in to UTF-8.
2612
+ "Basic " + btoa(
2613
+ (encodeUsername ? encodeUTF8$1(username) : username) + ":" + (password ? encodeUTF8$1(password) : "")
2614
+ )
2425
2615
  );
2426
2616
  } catch (e) {
2427
2617
  throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_OPTION_VALUE, config);
@@ -2441,7 +2631,7 @@ function resolveConfig(config) {
2441
2631
  }
2442
2632
  const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
2443
2633
  if (shouldSendXSRF) {
2444
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2634
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
2445
2635
  if (xsrfValue) {
2446
2636
  headers.set(xsrfHeaderName, xsrfValue);
2447
2637
  }
@@ -2452,16 +2642,50 @@ function resolveConfig(config) {
2452
2642
  const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
2453
2643
  const xhrAdapter = isXHRAdapterSupported && function(config) {
2454
2644
  return new Promise(function dispatchXhrRequest(resolve, reject) {
2455
- const _config = resolveConfig(config);
2645
+ let useAsyncXsrf;
2646
+ try {
2647
+ const store = platform.hasStandardBrowserEnv && typeof window !== "undefined" && window.cookieStore;
2648
+ useAsyncXsrf = store && utils$1.isFunction(store.get);
2649
+ } catch (e) {
2650
+ }
2651
+ let xsrfCookieName;
2652
+ const _config = resolveConfig(
2653
+ config,
2654
+ useAsyncXsrf ? (name) => {
2655
+ xsrfCookieName = name;
2656
+ return null;
2657
+ } : void 0
2658
+ );
2456
2659
  let requestData = _config.data;
2457
2660
  const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
2458
2661
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
2459
2662
  let onCanceled;
2663
+ let timeoutId;
2460
2664
  let uploadThrottled, downloadThrottled;
2461
2665
  let flushUpload, flushDownload, flushDownloadWithEvent;
2462
2666
  function done() {
2463
- flushUpload && flushUpload();
2464
- flushDownload && flushDownload();
2667
+ clearTimeout(timeoutId);
2668
+ try {
2669
+ flushUpload && flushUpload();
2670
+ } catch (err) {
2671
+ setTimeout(() => {
2672
+ throw err;
2673
+ });
2674
+ }
2675
+ try {
2676
+ flushDownload && flushDownload();
2677
+ } catch (err) {
2678
+ setTimeout(() => {
2679
+ throw err;
2680
+ });
2681
+ }
2682
+ if (request) {
2683
+ downloadThrottled && request.removeEventListener("progress", downloadThrottled);
2684
+ if (request.upload) {
2685
+ uploadThrottled && request.upload.removeEventListener("progress", uploadThrottled);
2686
+ flushUpload && request.upload.removeEventListener("loadend", flushUpload);
2687
+ }
2688
+ }
2465
2689
  _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2466
2690
  _config.signal && _config.signal.removeEventListener("abort", onCanceled);
2467
2691
  }
@@ -2547,6 +2771,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
2547
2771
  request = null;
2548
2772
  };
2549
2773
  request.ontimeout = function handleTimeout() {
2774
+ if (!request) return;
2550
2775
  let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
2551
2776
  const transitional2 = _config.transitional || transitionalDefaults;
2552
2777
  if (_config.timeoutErrorMessage) {
@@ -2564,11 +2789,6 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
2564
2789
  request = null;
2565
2790
  };
2566
2791
  requestData === void 0 && requestHeaders.setContentType(null);
2567
- if ("setRequestHeader" in request) {
2568
- utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
2569
- request.setRequestHeader(key, val);
2570
- });
2571
- }
2572
2792
  if (!utils$1.isUndefined(_config.withCredentials)) {
2573
2793
  request.withCredentials = !!_config.withCredentials;
2574
2794
  }
@@ -2593,15 +2813,18 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
2593
2813
  return;
2594
2814
  }
2595
2815
  reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
2596
- request.abort();
2816
+ const xhr = request;
2597
2817
  done();
2598
2818
  request = null;
2819
+ xhr.abort();
2599
2820
  };
2600
2821
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
2822
+ if (!request) return;
2601
2823
  if (_config.signal) {
2602
2824
  _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
2603
2825
  }
2604
2826
  }
2827
+ if (!request) return;
2605
2828
  const protocol = parseProtocol(_config.url);
2606
2829
  if (protocol && !platform.protocols.includes(protocol)) {
2607
2830
  reject(
@@ -2614,7 +2837,58 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
2614
2837
  done();
2615
2838
  return;
2616
2839
  }
2617
- request.send(requestData || null);
2840
+ const sendRequest = () => {
2841
+ if (!request) return;
2842
+ if ("setRequestHeader" in request) {
2843
+ utils$1.forEach(
2844
+ toByteStringHeaderObject(requestHeaders),
2845
+ function setRequestHeader(val, key) {
2846
+ request.setRequestHeader(key, val);
2847
+ }
2848
+ );
2849
+ }
2850
+ request.send(requestData || null);
2851
+ };
2852
+ if (xsrfCookieName) {
2853
+ const now = typeof performance !== "undefined" && utils$1.isFunction(performance.now) ? () => performance.now() : Date.now;
2854
+ const deadline = request.timeout > 0 ? now() + Number(request.timeout) : void 0;
2855
+ const abortOnTimeout = () => {
2856
+ if (!request) return;
2857
+ const xhr = request;
2858
+ xhr.ontimeout();
2859
+ xhr.abort();
2860
+ };
2861
+ if (deadline !== void 0) {
2862
+ const scheduleTimeout = () => {
2863
+ const remaining = deadline - now();
2864
+ if (remaining > 0) {
2865
+ timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 2147483647));
2866
+ } else {
2867
+ abortOnTimeout();
2868
+ }
2869
+ };
2870
+ scheduleTimeout();
2871
+ }
2872
+ cookies.readAsync(xsrfCookieName).then((value) => {
2873
+ if (!request) return;
2874
+ if (deadline !== void 0 && now() >= deadline) {
2875
+ abortOnTimeout();
2876
+ return;
2877
+ }
2878
+ if (value) {
2879
+ const headerName = utils$1.hasOwnProp(_config, "xsrfHeaderName") && _config.xsrfHeaderName;
2880
+ requestHeaders.set(headerName, value);
2881
+ }
2882
+ sendRequest();
2883
+ }).catch((error) => {
2884
+ if (!request) return;
2885
+ reject(AxiosError$1.from(error, null, config, request));
2886
+ done();
2887
+ request = null;
2888
+ });
2889
+ } else {
2890
+ sendRequest();
2891
+ }
2618
2892
  });
2619
2893
  };
2620
2894
  const composeSignals = (signals, timeout) => {
@@ -2645,7 +2919,8 @@ const composeSignals = (signals, timeout) => {
2645
2919
  timer && clearTimeout(timer);
2646
2920
  timer = null;
2647
2921
  signals.forEach((signal2) => {
2648
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
2922
+ const unsubscribeSignal = utils$1.getSafeProp(signal2, "unsubscribe");
2923
+ utils$1.isFunction(unsubscribeSignal) ? unsubscribeSignal.call(signal2, onabort) : signal2.removeEventListener("abort", onabort);
2649
2924
  });
2650
2925
  signals = null;
2651
2926
  };
@@ -2741,6 +3016,106 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
2741
3016
  }
2742
3017
  );
2743
3018
  };
3019
+ const CRLF = "\r\n";
3020
+ const normalizeLines = (value) => String(value).replace(/\r\n|\r|\n/g, CRLF);
3021
+ const escapeName = (value) => String(value).replace(
3022
+ /[\r\n"]/g,
3023
+ (char) => char === "\r" ? "%0D" : char === "\n" ? "%0A" : "%22"
3024
+ );
3025
+ const stringBytes = (value, normalize2) => {
3026
+ let length = 0;
3027
+ for (let i = 0; i < value.length; i++) {
3028
+ const code = value.charCodeAt(i);
3029
+ if (normalize2 && (code === 13 || code === 10)) {
3030
+ if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
3031
+ length += 2;
3032
+ } else if (code < 128) {
3033
+ length++;
3034
+ } else if (code < 2048) {
3035
+ length += 2;
3036
+ } else if (code >= 55296 && code <= 56319 && value.charCodeAt(i + 1) >= 56320 && value.charCodeAt(i + 1) <= 57343) {
3037
+ length += 4;
3038
+ i++;
3039
+ } else {
3040
+ length += 3;
3041
+ }
3042
+ }
3043
+ return length;
3044
+ };
3045
+ class FormDataError extends TypeError {
3046
+ constructor(message, reason) {
3047
+ super(message);
3048
+ this.name = "FormDataError";
3049
+ this.reason = reason;
3050
+ }
3051
+ }
3052
+ function formDataToBlob(form, Blob2, limit, limitError, boundary) {
3053
+ if (!utils$1.isFunction(Blob2)) {
3054
+ throw new FormDataError("Blob is not supported", "blob");
3055
+ }
3056
+ if (!utils$1.isString(boundary) || !/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) || / $/.test(boundary)) {
3057
+ throw new FormDataError("Invalid multipart boundary", "boundary");
3058
+ }
3059
+ const footer = "--" + boundary + "--" + CRLF;
3060
+ let length = footer.length;
3061
+ const parts = [];
3062
+ const checkLength = (extra) => {
3063
+ if (length + extra > limit) throw limitError();
3064
+ };
3065
+ checkLength(0);
3066
+ for (const [name, value] of form) {
3067
+ const isString2 = utils$1.isString(value);
3068
+ const valueLength = isString2 ? stringBytes(value, true) : value.size;
3069
+ if (!Number.isFinite(valueLength) || valueLength < 0) {
3070
+ throw new FormDataError("Unsupported FormData part size", "part");
3071
+ }
3072
+ checkLength(
3073
+ valueLength + stringBytes(name, true) + (!isString2 && value.name ? stringBytes(value.name, false) : 0) + (!isString2 && value.type ? stringBytes(value.type, false) : 0)
3074
+ );
3075
+ let header = "--" + boundary + CRLF + 'Content-Disposition: form-data; name="' + escapeName(normalizeLines(name)) + '"';
3076
+ if (!isString2) {
3077
+ header += '; filename="' + escapeName(utils$1.isString(value.name) ? value.name : "blob") + '"' + CRLF + "Content-Type: " + String(value.type || "application/octet-stream").replace(/[\r\n]/g, "");
3078
+ }
3079
+ header += CRLF + CRLF;
3080
+ const partLength = stringBytes(header, false) + valueLength + CRLF.length;
3081
+ checkLength(partLength);
3082
+ length += partLength;
3083
+ parts.push({ header, value, isString: isString2 });
3084
+ }
3085
+ const blobParts = [];
3086
+ for (const part of parts) {
3087
+ blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF);
3088
+ }
3089
+ blobParts.push(footer);
3090
+ return new Blob2(blobParts, { type: "multipart/form-data; boundary=" + boundary });
3091
+ }
3092
+ function createMultipartBody(form, Blob2, limit, limitError, boundary) {
3093
+ if (!utils$1.isFunction(Blob2)) {
3094
+ throw new AxiosError$1("Blob is not supported", AxiosError$1.ERR_NOT_SUPPORT);
3095
+ }
3096
+ if (boundary === void 0) {
3097
+ if (utils$1.isFunction(platform.generateString)) {
3098
+ boundary = "axios-" + platform.generateString(36, "0123456789abcdef");
3099
+ } else {
3100
+ const crypto = utils$1.global.crypto;
3101
+ if (!crypto || !utils$1.isFunction(crypto.getRandomValues)) {
3102
+ throw new AxiosError$1("Random byte generation is not supported", AxiosError$1.ERR_NOT_SUPPORT);
3103
+ }
3104
+ const random = new Uint8Array(18);
3105
+ crypto.getRandomValues(random);
3106
+ boundary = "axios-" + Array.from(random, (value) => ("0" + value.toString(16)).slice(-2)).join("");
3107
+ }
3108
+ }
3109
+ try {
3110
+ return formDataToBlob(form, Blob2, limit, limitError, boundary);
3111
+ } catch (error) {
3112
+ if (error instanceof FormDataError) {
3113
+ const code = error.reason === "boundary" ? AxiosError$1.ERR_BAD_OPTION_VALUE : AxiosError$1.ERR_BAD_REQUEST;
3114
+ throw new AxiosError$1(error.message, code);
3115
+ }
3116
+ throw error;
3117
+ }
3118
+ }
2744
3119
  const isHexDigit = (charCode) => charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
2745
3120
  const isPercentEncodedByte = (str, i, len) => i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
2746
3121
  const hexValue = (charCode) => charCode <= 57 ? charCode - 48 : (charCode & 223) - 55;
@@ -2797,14 +3172,14 @@ const estimatePercentDecodedBase64Bytes = (body) => {
2797
3172
  }
2798
3173
  return base64Bytes(significant);
2799
3174
  };
2800
- const estimateDataURLBytes = (url, estimateBase64) => {
3175
+ const estimateDataURLBytes = (url, estimateBase64, base64Pattern) => {
2801
3176
  if (!url || typeof url !== "string") return 0;
2802
- if (!url.startsWith("data:")) return 0;
3177
+ if (!/^data:/i.test(url)) return 0;
2803
3178
  const comma = url.indexOf(",");
2804
3179
  if (comma < 0) return 0;
2805
3180
  const meta = url.slice(5, comma);
2806
3181
  const body = url.slice(comma + 1);
2807
- const isBase64 = /;base64/i.test(meta);
3182
+ const isBase64 = base64Pattern.test(meta);
2808
3183
  if (isBase64) {
2809
3184
  return estimateBase64(body);
2810
3185
  }
@@ -2836,10 +3211,11 @@ function estimateDataURLDecodedBytes(url) {
2836
3211
  const fragmentIndex = typeof url === "string" ? url.indexOf("#") : -1;
2837
3212
  return estimateDataURLBytes(
2838
3213
  fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
2839
- estimatePercentDecodedBase64Bytes
3214
+ estimatePercentDecodedBase64Bytes,
3215
+ /; *base64[\t\n\f\r ]*$/i
2840
3216
  );
2841
3217
  }
2842
- const VERSION$1 = "1.20.0";
3218
+ const VERSION$1 = "1.21.1";
2843
3219
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
2844
3220
  const DEFAULT_REQUEST_OPTIONS = {
2845
3221
  cache: "default",
@@ -2891,11 +3267,13 @@ const factory = (env) => {
2891
3267
  },
2892
3268
  {
2893
3269
  Request: globalObject.Request,
2894
- Response: globalObject.Response
3270
+ Response: globalObject.Response,
3271
+ Blob: globalObject.Blob
2895
3272
  },
2896
3273
  env
2897
3274
  );
2898
- const { fetch: envFetch, Request, Response } = env;
3275
+ const envFetch = utils$1.hasOwnProp(env, "fetch") ? env.fetch : void 0;
3276
+ const { Request, Response, Blob: Blob2 } = env;
2899
3277
  const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
2900
3278
  const isRequestSupported = isFunction(Request);
2901
3279
  const isResponseSupported = isFunction(Response);
@@ -2921,6 +3299,13 @@ const factory = (env) => {
2921
3299
  return duplexAccessed && !hasContentType;
2922
3300
  });
2923
3301
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
3302
+ const requestDefaults = Object.assign(/* @__PURE__ */ Object.create(null), DEFAULT_REQUEST_OPTIONS);
3303
+ if (isRequestSupported && !test(() => new Request(platform.origin, requestDefaults))) {
3304
+ delete requestDefaults.cache;
3305
+ if (!test(() => new Request(platform.origin, requestDefaults))) {
3306
+ requestDefaults.cache = DEFAULT_REQUEST_OPTIONS.cache;
3307
+ }
3308
+ }
2924
3309
  const resolvers = {
2925
3310
  stream: supportsResponseStream && ((res) => res.body)
2926
3311
  };
@@ -2946,13 +3331,6 @@ const factory = (env) => {
2946
3331
  if (utils$1.isBlob(body)) {
2947
3332
  return body.size;
2948
3333
  }
2949
- if (utils$1.isSpecCompliantForm(body)) {
2950
- const _request = new Request(platform.origin, {
2951
- method: "POST",
2952
- body
2953
- });
2954
- return (await _request.arrayBuffer()).byteLength;
2955
- }
2956
3334
  if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2957
3335
  return body.byteLength;
2958
3336
  }
@@ -3000,6 +3378,7 @@ const factory = (env) => {
3000
3378
  });
3001
3379
  let requestContentLength;
3002
3380
  let pendingBodyError = null;
3381
+ let pendingResponseError = null;
3003
3382
  const maxBodyLengthError = () => new AxiosError$1(
3004
3383
  "Request body larger than maxBodyLength limit",
3005
3384
  AxiosError$1.ERR_BAD_REQUEST,
@@ -3017,8 +3396,9 @@ const factory = (env) => {
3017
3396
  password
3018
3397
  };
3019
3398
  }
3399
+ let parsedURL;
3020
3400
  if (maybeWithAuthCredentials(url)) {
3021
- const parsedURL = new URL(url, platform.origin);
3401
+ parsedURL = new URL(url, platform.origin);
3022
3402
  if (!auth2 && (parsedURL.username || parsedURL.password)) {
3023
3403
  const urlUsername = decodeURIComponentSafe(parsedURL.username);
3024
3404
  const urlPassword = decodeURIComponentSafe(parsedURL.password);
@@ -3040,8 +3420,8 @@ const factory = (env) => {
3040
3420
  "Basic " + btoa(encodeUTF8((auth2.username || "") + ":" + (auth2.password || "")))
3041
3421
  );
3042
3422
  }
3043
- if (hasMaxContentLength && typeof url === "string" && url.startsWith("data:")) {
3044
- const estimated = estimateDataURLDecodedBytes(url);
3423
+ if (hasMaxContentLength && parsedURL && parsedURL.protocol === "data:") {
3424
+ const estimated = estimateDataURLDecodedBytes(parsedURL.href);
3045
3425
  if (estimated > maxContentLength) {
3046
3426
  throw new AxiosError$1(
3047
3427
  "maxContentLength size of " + maxContentLength + " exceeded",
@@ -3051,6 +3431,23 @@ const factory = (env) => {
3051
3431
  );
3052
3432
  }
3053
3433
  }
3434
+ const formContentType = utils$1.isSpecCompliantForm(data) && AxiosHeaders$1.from(own2("headers")).getContentType();
3435
+ let formBoundary;
3436
+ if (utils$1.isString(formContentType) && /^multipart\/form-data(?:\s*;|$)/i.test(formContentType.trim())) {
3437
+ const parameters = AxiosHeaders$1.parseParameters(formContentType);
3438
+ if (utils$1.hasOwnProp(parameters, "boundary")) formBoundary = parameters.boundary;
3439
+ }
3440
+ if (utils$1.isSpecCompliantForm(data) && method !== "get" && method !== "head" && (hasMaxBodyLength || onUploadProgress && supportsRequestStream || formBoundary !== void 0)) {
3441
+ data = createMultipartBody(
3442
+ data,
3443
+ Blob2,
3444
+ hasMaxBodyLength ? maxBodyLength : Infinity,
3445
+ maxBodyLengthError,
3446
+ formBoundary
3447
+ );
3448
+ headers.setContentType(formBoundary === void 0 ? data.type : formContentType);
3449
+ requestContentLength = data.size;
3450
+ }
3054
3451
  if (hasMaxBodyLength && method !== "get" && method !== "head") {
3055
3452
  const outboundLength = await getBodyLength(data);
3056
3453
  if (typeof outboundLength === "number" && isFinite(outboundLength)) {
@@ -3131,7 +3528,7 @@ const factory = (env) => {
3131
3528
  credentials: isCredentialsSupported ? withCredentials : void 0
3132
3529
  });
3133
3530
  if (isRequestSupported) {
3134
- utils$1.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
3531
+ utils$1.forEach(requestDefaults, (value, key) => {
3135
3532
  if (resolvedOptions[key] === void 0) {
3136
3533
  resolvedOptions[key] = value;
3137
3534
  }
@@ -3179,7 +3576,7 @@ const factory = (env) => {
3179
3576
  if (hasMaxContentLength) {
3180
3577
  bytesRead = loadedBytes;
3181
3578
  if (bytesRead > maxContentLength) {
3182
- throw new AxiosError$1(
3579
+ throw pendingResponseError = new AxiosError$1(
3183
3580
  "maxContentLength size of " + maxContentLength + " exceeded",
3184
3581
  AxiosError$1.ERR_BAD_RESPONSE,
3185
3582
  config,
@@ -3254,6 +3651,9 @@ const factory = (env) => {
3254
3651
  request && !pendingBodyError.request && (pendingBodyError.request = request);
3255
3652
  throw pendingBodyError;
3256
3653
  }
3654
+ if (pendingResponseError) {
3655
+ throw pendingResponseError;
3656
+ }
3257
3657
  if (err instanceof AxiosError$1) {
3258
3658
  request && !err.request && (err.request = request);
3259
3659
  throw err;
@@ -3281,9 +3681,15 @@ const factory = (env) => {
3281
3681
  };
3282
3682
  const seedCache = /* @__PURE__ */ new Map();
3283
3683
  const getFetch = (config) => {
3284
- let env = config && config.env || {};
3285
- const { fetch: fetch2, Request, Response } = env;
3286
- const seeds = [Request, Response, fetch2];
3684
+ const env = /* @__PURE__ */ Object.create(null);
3685
+ const configuredEnv = config && utils$1.hasOwnProp(config, "env") && config.env;
3686
+ ["fetch", "Request", "Response", "Blob"].forEach((key) => {
3687
+ if (configuredEnv && utils$1.hasOwnProp(configuredEnv, key)) {
3688
+ env[key] = configuredEnv[key];
3689
+ }
3690
+ });
3691
+ const { fetch: fetch2, Request, Response, Blob: Blob2 } = env;
3692
+ const seeds = [Request, Response, fetch2, Blob2];
3287
3693
  let len = seeds.length, i = len, seed, target, map = seedCache;
3288
3694
  while (i--) {
3289
3695
  seed = seeds[i];
@@ -3365,6 +3771,12 @@ function throwIfCancellationRequested(config) {
3365
3771
  throw new CanceledError$1(null, config);
3366
3772
  }
3367
3773
  }
3774
+ function resolveClock() {
3775
+ return typeof performance !== "undefined" && utils$1.isFunction(performance.now) ? () => performance.now() : Date.now;
3776
+ }
3777
+ function elapsedSince(now, start) {
3778
+ return Math.max(0, Math.round(now() - start));
3779
+ }
3368
3780
  function dispatchRequest(_config) {
3369
3781
  const config = utils$1.toSafeFlatObject(_config);
3370
3782
  throwIfCancellationRequested(config);
@@ -3374,9 +3786,12 @@ function dispatchRequest(_config) {
3374
3786
  config.headers.setContentType("application/x-www-form-urlencoded", false);
3375
3787
  }
3376
3788
  const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
3789
+ const now = resolveClock();
3790
+ const start = now();
3377
3791
  return adapter(config).then(
3378
3792
  function onAdapterResolution(response) {
3379
3793
  throwIfCancellationRequested(config);
3794
+ response.duration = elapsedSince(now, start);
3380
3795
  config.response = response;
3381
3796
  try {
3382
3797
  response.data = transformData.call(config, config.transformResponse, response);
@@ -3390,6 +3805,7 @@ function dispatchRequest(_config) {
3390
3805
  if (!isCancel$1(reason)) {
3391
3806
  throwIfCancellationRequested(config);
3392
3807
  if (reason && reason.response) {
3808
+ reason.response.duration = elapsedSince(now, start);
3393
3809
  config.response = reason.response;
3394
3810
  try {
3395
3811
  reason.response.data = transformData.call(
@@ -3473,6 +3889,27 @@ const validator = {
3473
3889
  validators: validators$1
3474
3890
  };
3475
3891
  const validators = validator.validators;
3892
+ const isHeadersBucket = (value) => {
3893
+ if (value == null || utils$1.isPlainObject(value) || value instanceof AxiosHeaders$1) {
3894
+ return true;
3895
+ }
3896
+ try {
3897
+ return utils$1.isObject(value) && utils$1.getSafeProp(value, Symbol.toStringTag) === "AxiosHeaders" && [
3898
+ "toJSON",
3899
+ "set",
3900
+ "get",
3901
+ "has",
3902
+ "delete",
3903
+ "clear",
3904
+ "normalize",
3905
+ "concat",
3906
+ "toString",
3907
+ Symbol.iterator
3908
+ ].every((method) => utils$1.isFunction(utils$1.getSafeProp(value, method)));
3909
+ } catch (e) {
3910
+ return false;
3911
+ }
3912
+ };
3476
3913
  let Axios$1 = class Axios {
3477
3914
  constructor(instanceConfig) {
3478
3915
  this.defaults = instanceConfig || {};
@@ -3508,9 +3945,13 @@ let Axios$1 = class Axios {
3508
3945
  } else if (stack) {
3509
3946
  const firstNewlineIndex = stack.indexOf("\n");
3510
3947
  const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
3511
- const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
3512
- if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
3513
- err.stack += "\n" + stack;
3948
+ const duplicateCheckSuffix = secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
3949
+ const currentStack = String(err.stack);
3950
+ const causeIndex = getCauseStackIndex(err, currentStack);
3951
+ const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
3952
+ const causeSection = causeIndex === -1 ? "" : currentStack.slice(causeIndex);
3953
+ if (!stackHead.endsWith(duplicateCheckSuffix)) {
3954
+ err.stack = stackHead + "\n" + stack + causeSection;
3514
3955
  }
3515
3956
  }
3516
3957
  } catch (e) {
@@ -3537,7 +3978,8 @@ let Axios$1 = class Axios {
3537
3978
  clarifyTimeoutError: validators.transitional(validators.boolean),
3538
3979
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
3539
3980
  advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
3540
- validateStatusUndefinedResolves: validators.transitional(validators.boolean)
3981
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean),
3982
+ encodeBasicAuthUsername: validators.transitional(validators.boolean)
3541
3983
  },
3542
3984
  false
3543
3985
  );
@@ -3559,7 +4001,7 @@ let Axios$1 = class Axios {
3559
4001
  }
3560
4002
  }
3561
4003
  if (config.allowAbsoluteUrls !== void 0) ;
3562
- else if (this.defaults.allowAbsoluteUrls !== void 0) {
4004
+ else if (utils$1.hasOwnProp(this.defaults, "allowAbsoluteUrls") && this.defaults.allowAbsoluteUrls !== void 0) {
3563
4005
  config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
3564
4006
  } else {
3565
4007
  config.allowAbsoluteUrls = true;
@@ -3573,9 +4015,16 @@ let Axios$1 = class Axios {
3573
4015
  true
3574
4016
  );
3575
4017
  config.method = (utils$1.getSafeProp(config, "method") || utils$1.getSafeProp(this.defaults, "method") || "get").toLowerCase();
3576
- let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
4018
+ const commonHeaders = utils$1.getSafeProp(headers, "common");
4019
+ const methodHeaders = utils$1.getSafeProp(headers, config.method);
4020
+ const contextHeaders = headers && utils$1.merge(
4021
+ isHeadersBucket(commonHeaders) ? commonHeaders : void 0,
4022
+ isHeadersBucket(methodHeaders) ? methodHeaders : void 0
4023
+ );
3577
4024
  headers && utils$1.forEach(methodList.concat("common"), (method) => {
3578
- delete headers[method];
4025
+ if (isHeadersBucket(utils$1.getSafeProp(headers, method))) {
4026
+ delete headers[method];
4027
+ }
3579
4028
  });
3580
4029
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3581
4030
  const requestInterceptorChain = [];
@@ -3657,7 +4106,7 @@ let Axios$1 = class Axios {
3657
4106
  }
3658
4107
  };
3659
4108
  utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
3660
- Axios$1.prototype[method] = function(url, config) {
4109
+ Axios$1.prototype[method] = async function(url, config) {
3661
4110
  return this.request(
3662
4111
  mergeConfig$1(config || {}, {
3663
4112
  method,
@@ -3669,7 +4118,7 @@ utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoDa
3669
4118
  });
3670
4119
  utils$1.forEach(["post", "put", "patch", "query"], function forEachMethodWithData(method) {
3671
4120
  function generateHTTPMethod(isForm) {
3672
- return function httpMethod(url, data, config) {
4121
+ return async function httpMethod(url, data, config) {
3673
4122
  return this.request(
3674
4123
  mergeConfig$1(config || {}, {
3675
4124
  method,
@@ -4218,7 +4667,7 @@ class AxiosClient {
4218
4667
  method,
4219
4668
  withCredentials: true,
4220
4669
  data: JSON.stringify(body),
4221
- ...axiosConfig ?? {}
4670
+ ...axiosConfig
4222
4671
  };
4223
4672
  try {
4224
4673
  const response = await this.client(config);
@@ -4231,31 +4680,40 @@ class AxiosClient {
4231
4680
  }
4232
4681
  }
4233
4682
  }
4683
+ const SCHEME = "[^/:\\d][^/:]*";
4684
+ const PLAIN_PROTOCOL = new RegExp("^" + SCHEME + ":/*$");
4685
+ const PROTOCOL_PREFIX = new RegExp("^(" + SCHEME + "):/*");
4686
+ const HOST_PORT = /^[^/:]+:\d+(?:[/?#]|$)/;
4234
4687
  function normalize(strArray) {
4235
- var resultArray = [];
4688
+ const resultArray = [];
4689
+ const slashBefore = [];
4690
+ strArray = strArray.filter((part) => part !== "");
4236
4691
  if (strArray.length === 0) {
4237
4692
  return "";
4238
4693
  }
4239
4694
  if (typeof strArray[0] !== "string") {
4240
4695
  throw new TypeError("Url must be a string. Received " + strArray[0]);
4241
4696
  }
4242
- if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) {
4243
- var first = strArray.shift();
4244
- strArray[0] = first + strArray[0];
4697
+ const isHostPort = HOST_PORT.test(strArray[0]);
4698
+ if (PLAIN_PROTOCOL.test(strArray[0]) && strArray.length > 1) {
4699
+ strArray[0] = strArray.shift() + strArray[0];
4700
+ }
4701
+ if (strArray[0] === "/" && strArray.length > 1) {
4702
+ strArray[0] = strArray.shift() + strArray[0];
4245
4703
  }
4246
4704
  if (strArray[0].match(/^file:\/\/\//)) {
4247
- strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1:///");
4248
- } else {
4249
- strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1://");
4705
+ strArray[0] = strArray[0].replace(PROTOCOL_PREFIX, "$1:///");
4706
+ } else if (!isHostPort && !strArray[0].match(/^\[.*:.*\]/)) {
4707
+ strArray[0] = strArray[0].replace(PROTOCOL_PREFIX, "$1://");
4250
4708
  }
4251
- for (var i = 0; i < strArray.length; i++) {
4252
- var component = strArray[i];
4709
+ let prevEndsWithSlash = false;
4710
+ for (let i = 0; i < strArray.length; i++) {
4711
+ let component = strArray[i];
4253
4712
  if (typeof component !== "string") {
4254
4713
  throw new TypeError("Url must be a string. Received " + component);
4255
4714
  }
4256
- if (component === "") {
4257
- continue;
4258
- }
4715
+ const startsWithSlash = component.startsWith("/");
4716
+ const endsWithSlash = component.endsWith("/");
4259
4717
  if (i > 0) {
4260
4718
  component = component.replace(/^[\/]+/, "");
4261
4719
  }
@@ -4264,22 +4722,44 @@ function normalize(strArray) {
4264
4722
  } else {
4265
4723
  component = component.replace(/[\/]+$/, "/");
4266
4724
  }
4725
+ if (component === "") {
4726
+ prevEndsWithSlash = prevEndsWithSlash || startsWithSlash;
4727
+ continue;
4728
+ }
4267
4729
  resultArray.push(component);
4730
+ slashBefore.push(startsWithSlash || prevEndsWithSlash);
4731
+ prevEndsWithSlash = endsWithSlash;
4732
+ }
4733
+ let str = "";
4734
+ for (let i = 0; i < resultArray.length; i++) {
4735
+ const part = resultArray[i];
4736
+ if (i === 0) {
4737
+ str += part;
4738
+ continue;
4739
+ }
4740
+ const prevPart = resultArray[i - 1];
4741
+ if (prevPart && prevPart.endsWith("?")) {
4742
+ str += part;
4743
+ continue;
4744
+ }
4745
+ if (prevPart.endsWith("#")) {
4746
+ str += (slashBefore[i] ? "/" : "") + part;
4747
+ continue;
4748
+ }
4749
+ str += "/" + part;
4268
4750
  }
4269
- var str = resultArray.join("/");
4270
4751
  str = str.replace(/\/(\?|&|#[^!])/g, "$1");
4271
- var parts = str.split("?");
4272
- str = parts.shift() + (parts.length > 0 ? "?" : "") + parts.join("&");
4752
+ const hashIndex = str.indexOf("#");
4753
+ const beforeHash = hashIndex === -1 ? str : str.slice(0, hashIndex);
4754
+ const afterHash = hashIndex === -1 ? "" : str.slice(hashIndex + 1);
4755
+ const [base, ...params] = beforeHash.split(/(?:\?|&)+/);
4756
+ const query = params.filter(Boolean);
4757
+ str = base + (query.length > 0 ? "?" : "") + query.join("&") + (afterHash && afterHash.length > 0 ? "#" + afterHash : "");
4273
4758
  return str;
4274
4759
  }
4275
- function urlJoin() {
4276
- var input;
4277
- if (typeof arguments[0] === "object") {
4278
- input = arguments[0];
4279
- } else {
4280
- input = [].slice.call(arguments);
4281
- }
4282
- return normalize(input);
4760
+ function urlJoin(...args) {
4761
+ const parts = Array.from(Array.isArray(args[0]) ? args[0] : args);
4762
+ return normalize(parts);
4283
4763
  }
4284
4764
  const buildName = (name) => `${MY_LOCAL_STORAGE_PREFIX}.${name}`;
4285
4765
  const removeStored = (name) => {
@@ -4349,9 +4829,9 @@ const joinAllUri = (...urlParts) => {
4349
4829
  const hfetch = async (_uri, method = "get", body, searchParams, axiosConfig) => {
4350
4830
  const authToken = getStored(StorageKey.APP_TOKEN);
4351
4831
  const config = {
4352
- ...axiosConfig ?? {},
4832
+ ...axiosConfig,
4353
4833
  headers: {
4354
- ...(axiosConfig == null ? void 0 : axiosConfig.headers) ?? {},
4834
+ ...axiosConfig == null ? void 0 : axiosConfig.headers,
4355
4835
  "Content-Type": "application/json",
4356
4836
  "X-XSRF-TOKEN": getXSRFCookie()
4357
4837
  }