@kohost/api-client 3.3.17 → 3.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/defs.js CHANGED
@@ -486,6 +486,7 @@ var require_axios = __commonJS({
486
486
  kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
487
487
  }, "isFormData");
488
488
  var isURLSearchParams = kindOfTest("URLSearchParams");
489
+ var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
489
490
  var trim = /* @__PURE__ */ __name((str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), "trim");
490
491
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
491
492
  if (obj === null || typeof obj === "undefined") {
@@ -698,8 +699,7 @@ var require_axios = __commonJS({
698
699
  var noop = /* @__PURE__ */ __name(() => {
699
700
  }, "noop");
700
701
  var toFiniteNumber = /* @__PURE__ */ __name((value, defaultValue) => {
701
- value = +value;
702
- return Number.isFinite(value) ? value : defaultValue;
702
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
703
703
  }, "toFiniteNumber");
704
704
  var ALPHA = "abcdefghijklmnopqrstuvwxyz";
705
705
  var DIGIT = "0123456789";
@@ -755,6 +755,10 @@ var require_axios = __commonJS({
755
755
  isBoolean,
756
756
  isObject,
757
757
  isPlainObject,
758
+ isReadableStream,
759
+ isRequest,
760
+ isResponse,
761
+ isHeaders,
758
762
  isUndefined,
759
763
  isDate,
760
764
  isFile,
@@ -1137,11 +1141,13 @@ var require_axios = __commonJS({
1137
1141
  return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
1138
1142
  self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
1139
1143
  })();
1144
+ var origin = hasBrowserEnv && window.location.href || "http://localhost";
1140
1145
  var utils = /* @__PURE__ */ Object.freeze({
1141
1146
  __proto__: null,
1142
1147
  hasBrowserEnv,
1143
1148
  hasStandardBrowserWebWorkerEnv,
1144
- hasStandardBrowserEnv
1149
+ hasStandardBrowserEnv,
1150
+ origin
1145
1151
  });
1146
1152
  var platform = {
1147
1153
  ...utils,
@@ -1230,7 +1236,7 @@ var require_axios = __commonJS({
1230
1236
  __name(stringifySafely, "stringifySafely");
1231
1237
  var defaults = {
1232
1238
  transitional: transitionalDefaults,
1233
- adapter: ["xhr", "http"],
1239
+ adapter: ["xhr", "http", "fetch"],
1234
1240
  transformRequest: [/* @__PURE__ */ __name(function transformRequest(data, headers) {
1235
1241
  const contentType = headers.getContentType() || "";
1236
1242
  const hasJSONContentType = contentType.indexOf("application/json") > -1;
@@ -1242,7 +1248,7 @@ var require_axios = __commonJS({
1242
1248
  if (isFormData2) {
1243
1249
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1244
1250
  }
1245
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data)) {
1251
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
1246
1252
  return data;
1247
1253
  }
1248
1254
  if (utils$1.isArrayBufferView(data)) {
@@ -1276,6 +1282,9 @@ var require_axios = __commonJS({
1276
1282
  const transitional = this.transitional || defaults.transitional;
1277
1283
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1278
1284
  const JSONRequested = this.responseType === "json";
1285
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1286
+ return data;
1287
+ }
1279
1288
  if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
1280
1289
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
1281
1290
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -1445,6 +1454,10 @@ var require_axios = __commonJS({
1445
1454
  setHeaders(header, valueOrRewrite);
1446
1455
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1447
1456
  setHeaders(parseHeaders(header), valueOrRewrite);
1457
+ } else if (utils$1.isHeaders(header)) {
1458
+ for (const [key, value] of header.entries()) {
1459
+ setHeader(value, key, rewrite);
1460
+ }
1448
1461
  } else {
1449
1462
  header != null && setHeader(valueOrRewrite, header, rewrite);
1450
1463
  }
@@ -1629,92 +1642,6 @@ var require_axios = __commonJS({
1629
1642
  }
1630
1643
  }
1631
1644
  __name(settle, "settle");
1632
- var cookies = platform.hasStandardBrowserEnv ? (
1633
- // Standard browser envs support document.cookie
1634
- {
1635
- write(name, value, expires, path, domain, secure) {
1636
- const cookie = [name + "=" + encodeURIComponent(value)];
1637
- utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
1638
- utils$1.isString(path) && cookie.push("path=" + path);
1639
- utils$1.isString(domain) && cookie.push("domain=" + domain);
1640
- secure === true && cookie.push("secure");
1641
- document.cookie = cookie.join("; ");
1642
- },
1643
- read(name) {
1644
- const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
1645
- return match ? decodeURIComponent(match[3]) : null;
1646
- },
1647
- remove(name) {
1648
- this.write(name, "", Date.now() - 864e5);
1649
- }
1650
- }
1651
- ) : (
1652
- // Non-standard browser env (web workers, react-native) lack needed support.
1653
- {
1654
- write() {
1655
- },
1656
- read() {
1657
- return null;
1658
- },
1659
- remove() {
1660
- }
1661
- }
1662
- );
1663
- function isAbsoluteURL(url) {
1664
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1665
- }
1666
- __name(isAbsoluteURL, "isAbsoluteURL");
1667
- function combineURLs(baseURL, relativeURL) {
1668
- return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
1669
- }
1670
- __name(combineURLs, "combineURLs");
1671
- function buildFullPath(baseURL, requestedURL) {
1672
- if (baseURL && !isAbsoluteURL(requestedURL)) {
1673
- return combineURLs(baseURL, requestedURL);
1674
- }
1675
- return requestedURL;
1676
- }
1677
- __name(buildFullPath, "buildFullPath");
1678
- var isURLSameOrigin = platform.hasStandardBrowserEnv ? (
1679
- // Standard browser envs have full support of the APIs needed to test
1680
- // whether the request URL is of the same origin as current location.
1681
- (/* @__PURE__ */ __name(function standardBrowserEnv() {
1682
- const msie = /(msie|trident)/i.test(navigator.userAgent);
1683
- const urlParsingNode = document.createElement("a");
1684
- let originURL;
1685
- function resolveURL(url) {
1686
- let href = url;
1687
- if (msie) {
1688
- urlParsingNode.setAttribute("href", href);
1689
- href = urlParsingNode.href;
1690
- }
1691
- urlParsingNode.setAttribute("href", href);
1692
- return {
1693
- href: urlParsingNode.href,
1694
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
1695
- host: urlParsingNode.host,
1696
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
1697
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
1698
- hostname: urlParsingNode.hostname,
1699
- port: urlParsingNode.port,
1700
- pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
1701
- };
1702
- }
1703
- __name(resolveURL, "resolveURL");
1704
- originURL = resolveURL(window.location.href);
1705
- return /* @__PURE__ */ __name(function isURLSameOrigin2(requestURL) {
1706
- const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
1707
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
1708
- }, "isURLSameOrigin");
1709
- }, "standardBrowserEnv"))()
1710
- ) : (
1711
- // Non standard browser envs (web workers, react-native) lack needed support.
1712
- (/* @__PURE__ */ __name(function nonStandardBrowserEnv() {
1713
- return /* @__PURE__ */ __name(function isURLSameOrigin2() {
1714
- return true;
1715
- }, "isURLSameOrigin");
1716
- }, "nonStandardBrowserEnv"))()
1717
- );
1718
1645
  function parseProtocol(url) {
1719
1646
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1720
1647
  return match && match[1] || "";
@@ -1754,10 +1681,35 @@ var require_axios = __commonJS({
1754
1681
  }, "push");
1755
1682
  }
1756
1683
  __name(speedometer, "speedometer");
1757
- function progressEventReducer(listener, isDownloadStream) {
1684
+ function throttle(fn, freq) {
1685
+ let timestamp = 0;
1686
+ const threshold = 1e3 / freq;
1687
+ let timer = null;
1688
+ return /* @__PURE__ */ __name(function throttled() {
1689
+ const force = this === true;
1690
+ const now = Date.now();
1691
+ if (force || now - timestamp > threshold) {
1692
+ if (timer) {
1693
+ clearTimeout(timer);
1694
+ timer = null;
1695
+ }
1696
+ timestamp = now;
1697
+ return fn.apply(null, arguments);
1698
+ }
1699
+ if (!timer) {
1700
+ timer = setTimeout(() => {
1701
+ timer = null;
1702
+ timestamp = Date.now();
1703
+ return fn.apply(null, arguments);
1704
+ }, threshold - (now - timestamp));
1705
+ }
1706
+ }, "throttled");
1707
+ }
1708
+ __name(throttle, "throttle");
1709
+ var progressEventReducer = /* @__PURE__ */ __name((listener, isDownloadStream, freq = 3) => {
1758
1710
  let bytesNotified = 0;
1759
1711
  const _speedometer = speedometer(50, 250);
1760
- return (e) => {
1712
+ return throttle((e) => {
1761
1713
  const loaded = e.loaded;
1762
1714
  const total = e.lengthComputable ? e.total : void 0;
1763
1715
  const progressBytes = loaded - bytesNotified;
@@ -1771,47 +1723,234 @@ var require_axios = __commonJS({
1771
1723
  bytes: progressBytes,
1772
1724
  rate: rate ? rate : void 0,
1773
1725
  estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
1774
- event: e
1726
+ event: e,
1727
+ lengthComputable: total != null
1775
1728
  };
1776
1729
  data[isDownloadStream ? "download" : "upload"] = true;
1777
1730
  listener(data);
1731
+ }, freq);
1732
+ }, "progressEventReducer");
1733
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? (
1734
+ // Standard browser envs have full support of the APIs needed to test
1735
+ // whether the request URL is of the same origin as current location.
1736
+ (/* @__PURE__ */ __name(function standardBrowserEnv() {
1737
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
1738
+ const urlParsingNode = document.createElement("a");
1739
+ let originURL;
1740
+ function resolveURL(url) {
1741
+ let href = url;
1742
+ if (msie) {
1743
+ urlParsingNode.setAttribute("href", href);
1744
+ href = urlParsingNode.href;
1745
+ }
1746
+ urlParsingNode.setAttribute("href", href);
1747
+ return {
1748
+ href: urlParsingNode.href,
1749
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
1750
+ host: urlParsingNode.host,
1751
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
1752
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
1753
+ hostname: urlParsingNode.hostname,
1754
+ port: urlParsingNode.port,
1755
+ pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
1756
+ };
1757
+ }
1758
+ __name(resolveURL, "resolveURL");
1759
+ originURL = resolveURL(window.location.href);
1760
+ return /* @__PURE__ */ __name(function isURLSameOrigin2(requestURL) {
1761
+ const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
1762
+ return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
1763
+ }, "isURLSameOrigin");
1764
+ }, "standardBrowserEnv"))()
1765
+ ) : (
1766
+ // Non standard browser envs (web workers, react-native) lack needed support.
1767
+ (/* @__PURE__ */ __name(function nonStandardBrowserEnv() {
1768
+ return /* @__PURE__ */ __name(function isURLSameOrigin2() {
1769
+ return true;
1770
+ }, "isURLSameOrigin");
1771
+ }, "nonStandardBrowserEnv"))()
1772
+ );
1773
+ var cookies = platform.hasStandardBrowserEnv ? (
1774
+ // Standard browser envs support document.cookie
1775
+ {
1776
+ write(name, value, expires, path, domain, secure) {
1777
+ const cookie = [name + "=" + encodeURIComponent(value)];
1778
+ utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
1779
+ utils$1.isString(path) && cookie.push("path=" + path);
1780
+ utils$1.isString(domain) && cookie.push("domain=" + domain);
1781
+ secure === true && cookie.push("secure");
1782
+ document.cookie = cookie.join("; ");
1783
+ },
1784
+ read(name) {
1785
+ const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
1786
+ return match ? decodeURIComponent(match[3]) : null;
1787
+ },
1788
+ remove(name) {
1789
+ this.write(name, "", Date.now() - 864e5);
1790
+ }
1791
+ }
1792
+ ) : (
1793
+ // Non-standard browser env (web workers, react-native) lack needed support.
1794
+ {
1795
+ write() {
1796
+ },
1797
+ read() {
1798
+ return null;
1799
+ },
1800
+ remove() {
1801
+ }
1802
+ }
1803
+ );
1804
+ function isAbsoluteURL(url) {
1805
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1806
+ }
1807
+ __name(isAbsoluteURL, "isAbsoluteURL");
1808
+ function combineURLs(baseURL, relativeURL) {
1809
+ return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
1810
+ }
1811
+ __name(combineURLs, "combineURLs");
1812
+ function buildFullPath(baseURL, requestedURL) {
1813
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
1814
+ return combineURLs(baseURL, requestedURL);
1815
+ }
1816
+ return requestedURL;
1817
+ }
1818
+ __name(buildFullPath, "buildFullPath");
1819
+ var headersToObject = /* @__PURE__ */ __name((thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing, "headersToObject");
1820
+ function mergeConfig(config1, config2) {
1821
+ config2 = config2 || {};
1822
+ const config = {};
1823
+ function getMergedValue(target, source, caseless) {
1824
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
1825
+ return utils$1.merge.call({ caseless }, target, source);
1826
+ } else if (utils$1.isPlainObject(source)) {
1827
+ return utils$1.merge({}, source);
1828
+ } else if (utils$1.isArray(source)) {
1829
+ return source.slice();
1830
+ }
1831
+ return source;
1832
+ }
1833
+ __name(getMergedValue, "getMergedValue");
1834
+ function mergeDeepProperties(a, b, caseless) {
1835
+ if (!utils$1.isUndefined(b)) {
1836
+ return getMergedValue(a, b, caseless);
1837
+ } else if (!utils$1.isUndefined(a)) {
1838
+ return getMergedValue(void 0, a, caseless);
1839
+ }
1840
+ }
1841
+ __name(mergeDeepProperties, "mergeDeepProperties");
1842
+ function valueFromConfig2(a, b) {
1843
+ if (!utils$1.isUndefined(b)) {
1844
+ return getMergedValue(void 0, b);
1845
+ }
1846
+ }
1847
+ __name(valueFromConfig2, "valueFromConfig2");
1848
+ function defaultToConfig2(a, b) {
1849
+ if (!utils$1.isUndefined(b)) {
1850
+ return getMergedValue(void 0, b);
1851
+ } else if (!utils$1.isUndefined(a)) {
1852
+ return getMergedValue(void 0, a);
1853
+ }
1854
+ }
1855
+ __name(defaultToConfig2, "defaultToConfig2");
1856
+ function mergeDirectKeys(a, b, prop) {
1857
+ if (prop in config2) {
1858
+ return getMergedValue(a, b);
1859
+ } else if (prop in config1) {
1860
+ return getMergedValue(void 0, a);
1861
+ }
1862
+ }
1863
+ __name(mergeDirectKeys, "mergeDirectKeys");
1864
+ const mergeMap = {
1865
+ url: valueFromConfig2,
1866
+ method: valueFromConfig2,
1867
+ data: valueFromConfig2,
1868
+ baseURL: defaultToConfig2,
1869
+ transformRequest: defaultToConfig2,
1870
+ transformResponse: defaultToConfig2,
1871
+ paramsSerializer: defaultToConfig2,
1872
+ timeout: defaultToConfig2,
1873
+ timeoutMessage: defaultToConfig2,
1874
+ withCredentials: defaultToConfig2,
1875
+ withXSRFToken: defaultToConfig2,
1876
+ adapter: defaultToConfig2,
1877
+ responseType: defaultToConfig2,
1878
+ xsrfCookieName: defaultToConfig2,
1879
+ xsrfHeaderName: defaultToConfig2,
1880
+ onUploadProgress: defaultToConfig2,
1881
+ onDownloadProgress: defaultToConfig2,
1882
+ decompress: defaultToConfig2,
1883
+ maxContentLength: defaultToConfig2,
1884
+ maxBodyLength: defaultToConfig2,
1885
+ beforeRedirect: defaultToConfig2,
1886
+ transport: defaultToConfig2,
1887
+ httpAgent: defaultToConfig2,
1888
+ httpsAgent: defaultToConfig2,
1889
+ cancelToken: defaultToConfig2,
1890
+ socketPath: defaultToConfig2,
1891
+ responseEncoding: defaultToConfig2,
1892
+ validateStatus: mergeDirectKeys,
1893
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
1778
1894
  };
1895
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), /* @__PURE__ */ __name(function computeConfigValue(prop) {
1896
+ const merge2 = mergeMap[prop] || mergeDeepProperties;
1897
+ const configValue = merge2(config1[prop], config2[prop], prop);
1898
+ utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
1899
+ }, "computeConfigValue"));
1900
+ return config;
1779
1901
  }
1780
- __name(progressEventReducer, "progressEventReducer");
1902
+ __name(mergeConfig, "mergeConfig");
1903
+ var resolveConfig = /* @__PURE__ */ __name((config) => {
1904
+ const newConfig = mergeConfig({}, config);
1905
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
1906
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
1907
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
1908
+ if (auth) {
1909
+ headers.set(
1910
+ "Authorization",
1911
+ "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
1912
+ );
1913
+ }
1914
+ let contentType;
1915
+ if (utils$1.isFormData(data)) {
1916
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
1917
+ headers.setContentType(void 0);
1918
+ } else if ((contentType = headers.getContentType()) !== false) {
1919
+ const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
1920
+ headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
1921
+ }
1922
+ }
1923
+ if (platform.hasStandardBrowserEnv) {
1924
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
1925
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
1926
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
1927
+ if (xsrfValue) {
1928
+ headers.set(xsrfHeaderName, xsrfValue);
1929
+ }
1930
+ }
1931
+ }
1932
+ return newConfig;
1933
+ }, "resolveConfig");
1781
1934
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
1782
1935
  var xhrAdapter = isXHRAdapterSupported && function(config) {
1783
1936
  return new Promise(/* @__PURE__ */ __name(function dispatchXhrRequest(resolve, reject) {
1784
- let requestData = config.data;
1785
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
1786
- let { responseType, withXSRFToken } = config;
1937
+ const _config = resolveConfig(config);
1938
+ let requestData = _config.data;
1939
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
1940
+ let { responseType } = _config;
1787
1941
  let onCanceled;
1788
1942
  function done() {
1789
- if (config.cancelToken) {
1790
- config.cancelToken.unsubscribe(onCanceled);
1943
+ if (_config.cancelToken) {
1944
+ _config.cancelToken.unsubscribe(onCanceled);
1791
1945
  }
1792
- if (config.signal) {
1793
- config.signal.removeEventListener("abort", onCanceled);
1946
+ if (_config.signal) {
1947
+ _config.signal.removeEventListener("abort", onCanceled);
1794
1948
  }
1795
1949
  }
1796
1950
  __name(done, "done");
1797
- let contentType;
1798
- if (utils$1.isFormData(requestData)) {
1799
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
1800
- requestHeaders.setContentType(false);
1801
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
1802
- const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
1803
- requestHeaders.setContentType([type || "multipart/form-data", ...tokens].join("; "));
1804
- }
1805
- }
1806
1951
  let request = new XMLHttpRequest();
1807
- if (config.auth) {
1808
- const username = config.auth.username || "";
1809
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
1810
- requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password));
1811
- }
1812
- const fullPath = buildFullPath(config.baseURL, config.url);
1813
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
1814
- request.timeout = config.timeout;
1952
+ request.open(_config.method.toUpperCase(), _config.url, true);
1953
+ request.timeout = _config.timeout;
1815
1954
  function onloadend() {
1816
1955
  if (!request) {
1817
1956
  return;
@@ -1855,55 +1994,46 @@ var require_axios = __commonJS({
1855
1994
  if (!request) {
1856
1995
  return;
1857
1996
  }
1858
- reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
1997
+ reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, _config, request));
1859
1998
  request = null;
1860
1999
  }, "handleAbort");
1861
2000
  request.onerror = /* @__PURE__ */ __name(function handleError() {
1862
- reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request));
2001
+ reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, _config, request));
1863
2002
  request = null;
1864
2003
  }, "handleError");
1865
2004
  request.ontimeout = /* @__PURE__ */ __name(function handleTimeout() {
1866
- let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
1867
- const transitional = config.transitional || transitionalDefaults;
1868
- if (config.timeoutErrorMessage) {
1869
- timeoutErrorMessage = config.timeoutErrorMessage;
2005
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
2006
+ const transitional = _config.transitional || transitionalDefaults;
2007
+ if (_config.timeoutErrorMessage) {
2008
+ timeoutErrorMessage = _config.timeoutErrorMessage;
1870
2009
  }
1871
2010
  reject(new AxiosError(
1872
2011
  timeoutErrorMessage,
1873
2012
  transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
1874
- config,
2013
+ _config,
1875
2014
  request
1876
2015
  ));
1877
2016
  request = null;
1878
2017
  }, "handleTimeout");
1879
- if (platform.hasStandardBrowserEnv) {
1880
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
1881
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
1882
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
1883
- if (xsrfValue) {
1884
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
1885
- }
1886
- }
1887
- }
1888
2018
  requestData === void 0 && requestHeaders.setContentType(null);
1889
2019
  if ("setRequestHeader" in request) {
1890
2020
  utils$1.forEach(requestHeaders.toJSON(), /* @__PURE__ */ __name(function setRequestHeader(val, key) {
1891
2021
  request.setRequestHeader(key, val);
1892
2022
  }, "setRequestHeader"));
1893
2023
  }
1894
- if (!utils$1.isUndefined(config.withCredentials)) {
1895
- request.withCredentials = !!config.withCredentials;
2024
+ if (!utils$1.isUndefined(_config.withCredentials)) {
2025
+ request.withCredentials = !!_config.withCredentials;
1896
2026
  }
1897
2027
  if (responseType && responseType !== "json") {
1898
- request.responseType = config.responseType;
2028
+ request.responseType = _config.responseType;
1899
2029
  }
1900
- if (typeof config.onDownloadProgress === "function") {
1901
- request.addEventListener("progress", progressEventReducer(config.onDownloadProgress, true));
2030
+ if (typeof _config.onDownloadProgress === "function") {
2031
+ request.addEventListener("progress", progressEventReducer(_config.onDownloadProgress, true));
1902
2032
  }
1903
- if (typeof config.onUploadProgress === "function" && request.upload) {
1904
- request.upload.addEventListener("progress", progressEventReducer(config.onUploadProgress));
2033
+ if (typeof _config.onUploadProgress === "function" && request.upload) {
2034
+ request.upload.addEventListener("progress", progressEventReducer(_config.onUploadProgress));
1905
2035
  }
1906
- if (config.cancelToken || config.signal) {
2036
+ if (_config.cancelToken || _config.signal) {
1907
2037
  onCanceled = /* @__PURE__ */ __name((cancel) => {
1908
2038
  if (!request) {
1909
2039
  return;
@@ -1912,12 +2042,12 @@ var require_axios = __commonJS({
1912
2042
  request.abort();
1913
2043
  request = null;
1914
2044
  }, "onCanceled");
1915
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
1916
- if (config.signal) {
1917
- config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled);
2045
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
2046
+ if (_config.signal) {
2047
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
1918
2048
  }
1919
2049
  }
1920
- const protocol = parseProtocol(fullPath);
2050
+ const protocol = parseProtocol(_config.url);
1921
2051
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
1922
2052
  reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
1923
2053
  return;
@@ -1925,9 +2055,248 @@ var require_axios = __commonJS({
1925
2055
  request.send(requestData || null);
1926
2056
  }, "dispatchXhrRequest"));
1927
2057
  };
2058
+ var composeSignals = /* @__PURE__ */ __name((signals, timeout) => {
2059
+ let controller = new AbortController();
2060
+ let aborted;
2061
+ const onabort = /* @__PURE__ */ __name(function(cancel) {
2062
+ if (!aborted) {
2063
+ aborted = true;
2064
+ unsubscribe();
2065
+ const err = cancel instanceof Error ? cancel : this.reason;
2066
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
2067
+ }
2068
+ }, "onabort");
2069
+ let timer = timeout && setTimeout(() => {
2070
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
2071
+ }, timeout);
2072
+ const unsubscribe = /* @__PURE__ */ __name(() => {
2073
+ if (signals) {
2074
+ timer && clearTimeout(timer);
2075
+ timer = null;
2076
+ signals.forEach((signal2) => {
2077
+ signal2 && (signal2.removeEventListener ? signal2.removeEventListener("abort", onabort) : signal2.unsubscribe(onabort));
2078
+ });
2079
+ signals = null;
2080
+ }
2081
+ }, "unsubscribe");
2082
+ signals.forEach((signal2) => signal2 && signal2.addEventListener && signal2.addEventListener("abort", onabort));
2083
+ const { signal } = controller;
2084
+ signal.unsubscribe = unsubscribe;
2085
+ return [signal, () => {
2086
+ timer && clearTimeout(timer);
2087
+ timer = null;
2088
+ }];
2089
+ }, "composeSignals");
2090
+ var composeSignals$1 = composeSignals;
2091
+ var streamChunk = /* @__PURE__ */ __name(function* (chunk, chunkSize) {
2092
+ let len = chunk.byteLength;
2093
+ if (!chunkSize || len < chunkSize) {
2094
+ yield chunk;
2095
+ return;
2096
+ }
2097
+ let pos = 0;
2098
+ let end;
2099
+ while (pos < len) {
2100
+ end = pos + chunkSize;
2101
+ yield chunk.slice(pos, end);
2102
+ pos = end;
2103
+ }
2104
+ }, "streamChunk");
2105
+ var readBytes = /* @__PURE__ */ __name(async function* (iterable, chunkSize, encode2) {
2106
+ for await (const chunk of iterable) {
2107
+ yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : await encode2(String(chunk)), chunkSize);
2108
+ }
2109
+ }, "readBytes");
2110
+ var trackStream = /* @__PURE__ */ __name((stream, chunkSize, onProgress, onFinish, encode2) => {
2111
+ const iterator = readBytes(stream, chunkSize, encode2);
2112
+ let bytes = 0;
2113
+ return new ReadableStream({
2114
+ type: "bytes",
2115
+ async pull(controller) {
2116
+ const { done, value } = await iterator.next();
2117
+ if (done) {
2118
+ controller.close();
2119
+ onFinish();
2120
+ return;
2121
+ }
2122
+ let len = value.byteLength;
2123
+ onProgress && onProgress(bytes += len);
2124
+ controller.enqueue(new Uint8Array(value));
2125
+ },
2126
+ cancel(reason) {
2127
+ onFinish(reason);
2128
+ return iterator.return();
2129
+ }
2130
+ }, {
2131
+ highWaterMark: 2
2132
+ });
2133
+ }, "trackStream");
2134
+ var fetchProgressDecorator = /* @__PURE__ */ __name((total, fn) => {
2135
+ const lengthComputable = total != null;
2136
+ return (loaded) => setTimeout(() => fn({
2137
+ lengthComputable,
2138
+ total,
2139
+ loaded
2140
+ }));
2141
+ }, "fetchProgressDecorator");
2142
+ var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
2143
+ var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
2144
+ var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
2145
+ var supportsRequestStream = isReadableStreamSupported && (() => {
2146
+ let duplexAccessed = false;
2147
+ const hasContentType = new Request(platform.origin, {
2148
+ body: new ReadableStream(),
2149
+ method: "POST",
2150
+ get duplex() {
2151
+ duplexAccessed = true;
2152
+ return "half";
2153
+ }
2154
+ }).headers.has("Content-Type");
2155
+ return duplexAccessed && !hasContentType;
2156
+ })();
2157
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
2158
+ var supportsResponseStream = isReadableStreamSupported && !!(() => {
2159
+ try {
2160
+ return utils$1.isReadableStream(new Response("").body);
2161
+ } catch (err) {
2162
+ }
2163
+ })();
2164
+ var resolvers = {
2165
+ stream: supportsResponseStream && ((res) => res.body)
2166
+ };
2167
+ isFetchSupported && ((res) => {
2168
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
2169
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
2170
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
2171
+ });
2172
+ });
2173
+ })(new Response());
2174
+ var getBodyLength = /* @__PURE__ */ __name(async (body) => {
2175
+ if (body == null) {
2176
+ return 0;
2177
+ }
2178
+ if (utils$1.isBlob(body)) {
2179
+ return body.size;
2180
+ }
2181
+ if (utils$1.isSpecCompliantForm(body)) {
2182
+ return (await new Request(body).arrayBuffer()).byteLength;
2183
+ }
2184
+ if (utils$1.isArrayBufferView(body)) {
2185
+ return body.byteLength;
2186
+ }
2187
+ if (utils$1.isURLSearchParams(body)) {
2188
+ body = body + "";
2189
+ }
2190
+ if (utils$1.isString(body)) {
2191
+ return (await encodeText(body)).byteLength;
2192
+ }
2193
+ }, "getBodyLength");
2194
+ var resolveBodyLength = /* @__PURE__ */ __name(async (headers, body) => {
2195
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
2196
+ return length == null ? getBodyLength(body) : length;
2197
+ }, "resolveBodyLength");
2198
+ var fetchAdapter = isFetchSupported && (async (config) => {
2199
+ let {
2200
+ url,
2201
+ method,
2202
+ data,
2203
+ signal,
2204
+ cancelToken,
2205
+ timeout,
2206
+ onDownloadProgress,
2207
+ onUploadProgress,
2208
+ responseType,
2209
+ headers,
2210
+ withCredentials = "same-origin",
2211
+ fetchOptions
2212
+ } = resolveConfig(config);
2213
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
2214
+ let [composedSignal, stopTimeout] = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : [];
2215
+ let finished, request;
2216
+ const onFinish = /* @__PURE__ */ __name(() => {
2217
+ !finished && setTimeout(() => {
2218
+ composedSignal && composedSignal.unsubscribe();
2219
+ });
2220
+ finished = true;
2221
+ }, "onFinish");
2222
+ let requestContentLength;
2223
+ try {
2224
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
2225
+ let _request = new Request(url, {
2226
+ method: "POST",
2227
+ body: data,
2228
+ duplex: "half"
2229
+ });
2230
+ let contentTypeHeader;
2231
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
2232
+ headers.setContentType(contentTypeHeader);
2233
+ }
2234
+ if (_request.body) {
2235
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
2236
+ requestContentLength,
2237
+ progressEventReducer(onUploadProgress)
2238
+ ), null, encodeText);
2239
+ }
2240
+ }
2241
+ if (!utils$1.isString(withCredentials)) {
2242
+ withCredentials = withCredentials ? "cors" : "omit";
2243
+ }
2244
+ request = new Request(url, {
2245
+ ...fetchOptions,
2246
+ signal: composedSignal,
2247
+ method: method.toUpperCase(),
2248
+ headers: headers.normalize().toJSON(),
2249
+ body: data,
2250
+ duplex: "half",
2251
+ withCredentials
2252
+ });
2253
+ let response = await fetch(request);
2254
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
2255
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
2256
+ const options = {};
2257
+ ["status", "statusText", "headers"].forEach((prop) => {
2258
+ options[prop] = response[prop];
2259
+ });
2260
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
2261
+ response = new Response(
2262
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(
2263
+ responseContentLength,
2264
+ progressEventReducer(onDownloadProgress, true)
2265
+ ), isStreamResponse && onFinish, encodeText),
2266
+ options
2267
+ );
2268
+ }
2269
+ responseType = responseType || "text";
2270
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
2271
+ !isStreamResponse && onFinish();
2272
+ stopTimeout && stopTimeout();
2273
+ return await new Promise((resolve, reject) => {
2274
+ settle(resolve, reject, {
2275
+ data: responseData,
2276
+ headers: AxiosHeaders$1.from(response.headers),
2277
+ status: response.status,
2278
+ statusText: response.statusText,
2279
+ config,
2280
+ request
2281
+ });
2282
+ });
2283
+ } catch (err) {
2284
+ onFinish();
2285
+ if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
2286
+ throw Object.assign(
2287
+ new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
2288
+ {
2289
+ cause: err.cause || err
2290
+ }
2291
+ );
2292
+ }
2293
+ throw AxiosError.from(err, err && err.code, config, request);
2294
+ }
2295
+ });
1928
2296
  var knownAdapters = {
1929
2297
  http: httpAdapter,
1930
- xhr: xhrAdapter
2298
+ xhr: xhrAdapter,
2299
+ fetch: fetchAdapter
1931
2300
  };
1932
2301
  utils$1.forEach(knownAdapters, (fn, value) => {
1933
2302
  if (fn) {
@@ -2021,91 +2390,7 @@ var require_axios = __commonJS({
2021
2390
  }, "onAdapterRejection"));
2022
2391
  }
2023
2392
  __name(dispatchRequest, "dispatchRequest");
2024
- var headersToObject = /* @__PURE__ */ __name((thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing, "headersToObject");
2025
- function mergeConfig(config1, config2) {
2026
- config2 = config2 || {};
2027
- const config = {};
2028
- function getMergedValue(target, source, caseless) {
2029
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2030
- return utils$1.merge.call({ caseless }, target, source);
2031
- } else if (utils$1.isPlainObject(source)) {
2032
- return utils$1.merge({}, source);
2033
- } else if (utils$1.isArray(source)) {
2034
- return source.slice();
2035
- }
2036
- return source;
2037
- }
2038
- __name(getMergedValue, "getMergedValue");
2039
- function mergeDeepProperties(a, b, caseless) {
2040
- if (!utils$1.isUndefined(b)) {
2041
- return getMergedValue(a, b, caseless);
2042
- } else if (!utils$1.isUndefined(a)) {
2043
- return getMergedValue(void 0, a, caseless);
2044
- }
2045
- }
2046
- __name(mergeDeepProperties, "mergeDeepProperties");
2047
- function valueFromConfig2(a, b) {
2048
- if (!utils$1.isUndefined(b)) {
2049
- return getMergedValue(void 0, b);
2050
- }
2051
- }
2052
- __name(valueFromConfig2, "valueFromConfig2");
2053
- function defaultToConfig2(a, b) {
2054
- if (!utils$1.isUndefined(b)) {
2055
- return getMergedValue(void 0, b);
2056
- } else if (!utils$1.isUndefined(a)) {
2057
- return getMergedValue(void 0, a);
2058
- }
2059
- }
2060
- __name(defaultToConfig2, "defaultToConfig2");
2061
- function mergeDirectKeys(a, b, prop) {
2062
- if (prop in config2) {
2063
- return getMergedValue(a, b);
2064
- } else if (prop in config1) {
2065
- return getMergedValue(void 0, a);
2066
- }
2067
- }
2068
- __name(mergeDirectKeys, "mergeDirectKeys");
2069
- const mergeMap = {
2070
- url: valueFromConfig2,
2071
- method: valueFromConfig2,
2072
- data: valueFromConfig2,
2073
- baseURL: defaultToConfig2,
2074
- transformRequest: defaultToConfig2,
2075
- transformResponse: defaultToConfig2,
2076
- paramsSerializer: defaultToConfig2,
2077
- timeout: defaultToConfig2,
2078
- timeoutMessage: defaultToConfig2,
2079
- withCredentials: defaultToConfig2,
2080
- withXSRFToken: defaultToConfig2,
2081
- adapter: defaultToConfig2,
2082
- responseType: defaultToConfig2,
2083
- xsrfCookieName: defaultToConfig2,
2084
- xsrfHeaderName: defaultToConfig2,
2085
- onUploadProgress: defaultToConfig2,
2086
- onDownloadProgress: defaultToConfig2,
2087
- decompress: defaultToConfig2,
2088
- maxContentLength: defaultToConfig2,
2089
- maxBodyLength: defaultToConfig2,
2090
- beforeRedirect: defaultToConfig2,
2091
- transport: defaultToConfig2,
2092
- httpAgent: defaultToConfig2,
2093
- httpsAgent: defaultToConfig2,
2094
- cancelToken: defaultToConfig2,
2095
- socketPath: defaultToConfig2,
2096
- responseEncoding: defaultToConfig2,
2097
- validateStatus: mergeDirectKeys,
2098
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2099
- };
2100
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), /* @__PURE__ */ __name(function computeConfigValue(prop) {
2101
- const merge2 = mergeMap[prop] || mergeDeepProperties;
2102
- const configValue = merge2(config1[prop], config2[prop], prop);
2103
- utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
2104
- }, "computeConfigValue"));
2105
- return config;
2106
- }
2107
- __name(mergeConfig, "mergeConfig");
2108
- var VERSION = "1.6.8";
2393
+ var VERSION = "1.7.2";
2109
2394
  var validators$1 = {};
2110
2395
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
2111
2396
  validators$1[type] = /* @__PURE__ */ __name(function validator2(thing) {
@@ -2192,10 +2477,13 @@ var require_axios = __commonJS({
2192
2477
  let dummy;
2193
2478
  Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
2194
2479
  const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
2195
- if (!err.stack) {
2196
- err.stack = stack;
2197
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
2198
- err.stack += "\n" + stack;
2480
+ try {
2481
+ if (!err.stack) {
2482
+ err.stack = stack;
2483
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
2484
+ err.stack += "\n" + stack;
2485
+ }
2486
+ } catch (e) {
2199
2487
  }
2200
2488
  }
2201
2489
  throw err;