@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.
@@ -7979,6 +7979,7 @@ var require_axios = __commonJS({
7979
7979
  kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
7980
7980
  }, "isFormData");
7981
7981
  var isURLSearchParams = kindOfTest("URLSearchParams");
7982
+ var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
7982
7983
  var trim = /* @__PURE__ */ __name((str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), "trim");
7983
7984
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
7984
7985
  if (obj === null || typeof obj === "undefined") {
@@ -8191,8 +8192,7 @@ var require_axios = __commonJS({
8191
8192
  var noop = /* @__PURE__ */ __name(() => {
8192
8193
  }, "noop");
8193
8194
  var toFiniteNumber = /* @__PURE__ */ __name((value, defaultValue) => {
8194
- value = +value;
8195
- return Number.isFinite(value) ? value : defaultValue;
8195
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
8196
8196
  }, "toFiniteNumber");
8197
8197
  var ALPHA = "abcdefghijklmnopqrstuvwxyz";
8198
8198
  var DIGIT = "0123456789";
@@ -8248,6 +8248,10 @@ var require_axios = __commonJS({
8248
8248
  isBoolean,
8249
8249
  isObject,
8250
8250
  isPlainObject,
8251
+ isReadableStream,
8252
+ isRequest,
8253
+ isResponse,
8254
+ isHeaders,
8251
8255
  isUndefined,
8252
8256
  isDate,
8253
8257
  isFile,
@@ -8630,11 +8634,13 @@ var require_axios = __commonJS({
8630
8634
  return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
8631
8635
  self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
8632
8636
  })();
8637
+ var origin = hasBrowserEnv && window.location.href || "http://localhost";
8633
8638
  var utils = /* @__PURE__ */ Object.freeze({
8634
8639
  __proto__: null,
8635
8640
  hasBrowserEnv,
8636
8641
  hasStandardBrowserWebWorkerEnv,
8637
- hasStandardBrowserEnv
8642
+ hasStandardBrowserEnv,
8643
+ origin
8638
8644
  });
8639
8645
  var platform = {
8640
8646
  ...utils,
@@ -8723,7 +8729,7 @@ var require_axios = __commonJS({
8723
8729
  __name(stringifySafely, "stringifySafely");
8724
8730
  var defaults = {
8725
8731
  transitional: transitionalDefaults,
8726
- adapter: ["xhr", "http"],
8732
+ adapter: ["xhr", "http", "fetch"],
8727
8733
  transformRequest: [/* @__PURE__ */ __name(function transformRequest(data, headers) {
8728
8734
  const contentType = headers.getContentType() || "";
8729
8735
  const hasJSONContentType = contentType.indexOf("application/json") > -1;
@@ -8735,7 +8741,7 @@ var require_axios = __commonJS({
8735
8741
  if (isFormData2) {
8736
8742
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
8737
8743
  }
8738
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data)) {
8744
+ 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)) {
8739
8745
  return data;
8740
8746
  }
8741
8747
  if (utils$1.isArrayBufferView(data)) {
@@ -8769,6 +8775,9 @@ var require_axios = __commonJS({
8769
8775
  const transitional = this.transitional || defaults.transitional;
8770
8776
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
8771
8777
  const JSONRequested = this.responseType === "json";
8778
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
8779
+ return data;
8780
+ }
8772
8781
  if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
8773
8782
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
8774
8783
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -8938,6 +8947,10 @@ var require_axios = __commonJS({
8938
8947
  setHeaders(header, valueOrRewrite);
8939
8948
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
8940
8949
  setHeaders(parseHeaders(header), valueOrRewrite);
8950
+ } else if (utils$1.isHeaders(header)) {
8951
+ for (const [key, value] of header.entries()) {
8952
+ setHeader(value, key, rewrite);
8953
+ }
8941
8954
  } else {
8942
8955
  header != null && setHeader(valueOrRewrite, header, rewrite);
8943
8956
  }
@@ -9122,92 +9135,6 @@ var require_axios = __commonJS({
9122
9135
  }
9123
9136
  }
9124
9137
  __name(settle, "settle");
9125
- var cookies = platform.hasStandardBrowserEnv ? (
9126
- // Standard browser envs support document.cookie
9127
- {
9128
- write(name, value, expires, path, domain, secure) {
9129
- const cookie = [name + "=" + encodeURIComponent(value)];
9130
- utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
9131
- utils$1.isString(path) && cookie.push("path=" + path);
9132
- utils$1.isString(domain) && cookie.push("domain=" + domain);
9133
- secure === true && cookie.push("secure");
9134
- document.cookie = cookie.join("; ");
9135
- },
9136
- read(name) {
9137
- const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
9138
- return match ? decodeURIComponent(match[3]) : null;
9139
- },
9140
- remove(name) {
9141
- this.write(name, "", Date.now() - 864e5);
9142
- }
9143
- }
9144
- ) : (
9145
- // Non-standard browser env (web workers, react-native) lack needed support.
9146
- {
9147
- write() {
9148
- },
9149
- read() {
9150
- return null;
9151
- },
9152
- remove() {
9153
- }
9154
- }
9155
- );
9156
- function isAbsoluteURL(url) {
9157
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
9158
- }
9159
- __name(isAbsoluteURL, "isAbsoluteURL");
9160
- function combineURLs(baseURL, relativeURL) {
9161
- return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
9162
- }
9163
- __name(combineURLs, "combineURLs");
9164
- function buildFullPath(baseURL, requestedURL) {
9165
- if (baseURL && !isAbsoluteURL(requestedURL)) {
9166
- return combineURLs(baseURL, requestedURL);
9167
- }
9168
- return requestedURL;
9169
- }
9170
- __name(buildFullPath, "buildFullPath");
9171
- var isURLSameOrigin = platform.hasStandardBrowserEnv ? (
9172
- // Standard browser envs have full support of the APIs needed to test
9173
- // whether the request URL is of the same origin as current location.
9174
- (/* @__PURE__ */ __name(function standardBrowserEnv() {
9175
- const msie = /(msie|trident)/i.test(navigator.userAgent);
9176
- const urlParsingNode = document.createElement("a");
9177
- let originURL;
9178
- function resolveURL(url) {
9179
- let href = url;
9180
- if (msie) {
9181
- urlParsingNode.setAttribute("href", href);
9182
- href = urlParsingNode.href;
9183
- }
9184
- urlParsingNode.setAttribute("href", href);
9185
- return {
9186
- href: urlParsingNode.href,
9187
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
9188
- host: urlParsingNode.host,
9189
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
9190
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
9191
- hostname: urlParsingNode.hostname,
9192
- port: urlParsingNode.port,
9193
- pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
9194
- };
9195
- }
9196
- __name(resolveURL, "resolveURL");
9197
- originURL = resolveURL(window.location.href);
9198
- return /* @__PURE__ */ __name(function isURLSameOrigin2(requestURL) {
9199
- const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
9200
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
9201
- }, "isURLSameOrigin");
9202
- }, "standardBrowserEnv"))()
9203
- ) : (
9204
- // Non standard browser envs (web workers, react-native) lack needed support.
9205
- (/* @__PURE__ */ __name(function nonStandardBrowserEnv() {
9206
- return /* @__PURE__ */ __name(function isURLSameOrigin2() {
9207
- return true;
9208
- }, "isURLSameOrigin");
9209
- }, "nonStandardBrowserEnv"))()
9210
- );
9211
9138
  function parseProtocol(url) {
9212
9139
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
9213
9140
  return match && match[1] || "";
@@ -9247,10 +9174,35 @@ var require_axios = __commonJS({
9247
9174
  }, "push");
9248
9175
  }
9249
9176
  __name(speedometer, "speedometer");
9250
- function progressEventReducer(listener, isDownloadStream) {
9177
+ function throttle(fn, freq) {
9178
+ let timestamp = 0;
9179
+ const threshold = 1e3 / freq;
9180
+ let timer = null;
9181
+ return /* @__PURE__ */ __name(function throttled() {
9182
+ const force = this === true;
9183
+ const now = Date.now();
9184
+ if (force || now - timestamp > threshold) {
9185
+ if (timer) {
9186
+ clearTimeout(timer);
9187
+ timer = null;
9188
+ }
9189
+ timestamp = now;
9190
+ return fn.apply(null, arguments);
9191
+ }
9192
+ if (!timer) {
9193
+ timer = setTimeout(() => {
9194
+ timer = null;
9195
+ timestamp = Date.now();
9196
+ return fn.apply(null, arguments);
9197
+ }, threshold - (now - timestamp));
9198
+ }
9199
+ }, "throttled");
9200
+ }
9201
+ __name(throttle, "throttle");
9202
+ var progressEventReducer = /* @__PURE__ */ __name((listener, isDownloadStream, freq = 3) => {
9251
9203
  let bytesNotified = 0;
9252
9204
  const _speedometer = speedometer(50, 250);
9253
- return (e) => {
9205
+ return throttle((e) => {
9254
9206
  const loaded = e.loaded;
9255
9207
  const total = e.lengthComputable ? e.total : void 0;
9256
9208
  const progressBytes = loaded - bytesNotified;
@@ -9264,47 +9216,234 @@ var require_axios = __commonJS({
9264
9216
  bytes: progressBytes,
9265
9217
  rate: rate ? rate : void 0,
9266
9218
  estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
9267
- event: e
9219
+ event: e,
9220
+ lengthComputable: total != null
9268
9221
  };
9269
9222
  data[isDownloadStream ? "download" : "upload"] = true;
9270
9223
  listener(data);
9224
+ }, freq);
9225
+ }, "progressEventReducer");
9226
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? (
9227
+ // Standard browser envs have full support of the APIs needed to test
9228
+ // whether the request URL is of the same origin as current location.
9229
+ (/* @__PURE__ */ __name(function standardBrowserEnv() {
9230
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
9231
+ const urlParsingNode = document.createElement("a");
9232
+ let originURL;
9233
+ function resolveURL(url) {
9234
+ let href = url;
9235
+ if (msie) {
9236
+ urlParsingNode.setAttribute("href", href);
9237
+ href = urlParsingNode.href;
9238
+ }
9239
+ urlParsingNode.setAttribute("href", href);
9240
+ return {
9241
+ href: urlParsingNode.href,
9242
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
9243
+ host: urlParsingNode.host,
9244
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
9245
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
9246
+ hostname: urlParsingNode.hostname,
9247
+ port: urlParsingNode.port,
9248
+ pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
9249
+ };
9250
+ }
9251
+ __name(resolveURL, "resolveURL");
9252
+ originURL = resolveURL(window.location.href);
9253
+ return /* @__PURE__ */ __name(function isURLSameOrigin2(requestURL) {
9254
+ const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
9255
+ return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
9256
+ }, "isURLSameOrigin");
9257
+ }, "standardBrowserEnv"))()
9258
+ ) : (
9259
+ // Non standard browser envs (web workers, react-native) lack needed support.
9260
+ (/* @__PURE__ */ __name(function nonStandardBrowserEnv() {
9261
+ return /* @__PURE__ */ __name(function isURLSameOrigin2() {
9262
+ return true;
9263
+ }, "isURLSameOrigin");
9264
+ }, "nonStandardBrowserEnv"))()
9265
+ );
9266
+ var cookies = platform.hasStandardBrowserEnv ? (
9267
+ // Standard browser envs support document.cookie
9268
+ {
9269
+ write(name, value, expires, path, domain, secure) {
9270
+ const cookie = [name + "=" + encodeURIComponent(value)];
9271
+ utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
9272
+ utils$1.isString(path) && cookie.push("path=" + path);
9273
+ utils$1.isString(domain) && cookie.push("domain=" + domain);
9274
+ secure === true && cookie.push("secure");
9275
+ document.cookie = cookie.join("; ");
9276
+ },
9277
+ read(name) {
9278
+ const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
9279
+ return match ? decodeURIComponent(match[3]) : null;
9280
+ },
9281
+ remove(name) {
9282
+ this.write(name, "", Date.now() - 864e5);
9283
+ }
9284
+ }
9285
+ ) : (
9286
+ // Non-standard browser env (web workers, react-native) lack needed support.
9287
+ {
9288
+ write() {
9289
+ },
9290
+ read() {
9291
+ return null;
9292
+ },
9293
+ remove() {
9294
+ }
9295
+ }
9296
+ );
9297
+ function isAbsoluteURL(url) {
9298
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
9299
+ }
9300
+ __name(isAbsoluteURL, "isAbsoluteURL");
9301
+ function combineURLs(baseURL, relativeURL) {
9302
+ return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
9303
+ }
9304
+ __name(combineURLs, "combineURLs");
9305
+ function buildFullPath(baseURL, requestedURL) {
9306
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
9307
+ return combineURLs(baseURL, requestedURL);
9308
+ }
9309
+ return requestedURL;
9310
+ }
9311
+ __name(buildFullPath, "buildFullPath");
9312
+ var headersToObject = /* @__PURE__ */ __name((thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing, "headersToObject");
9313
+ function mergeConfig(config1, config2) {
9314
+ config2 = config2 || {};
9315
+ const config = {};
9316
+ function getMergedValue(target, source, caseless) {
9317
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
9318
+ return utils$1.merge.call({ caseless }, target, source);
9319
+ } else if (utils$1.isPlainObject(source)) {
9320
+ return utils$1.merge({}, source);
9321
+ } else if (utils$1.isArray(source)) {
9322
+ return source.slice();
9323
+ }
9324
+ return source;
9325
+ }
9326
+ __name(getMergedValue, "getMergedValue");
9327
+ function mergeDeepProperties(a, b, caseless) {
9328
+ if (!utils$1.isUndefined(b)) {
9329
+ return getMergedValue(a, b, caseless);
9330
+ } else if (!utils$1.isUndefined(a)) {
9331
+ return getMergedValue(void 0, a, caseless);
9332
+ }
9333
+ }
9334
+ __name(mergeDeepProperties, "mergeDeepProperties");
9335
+ function valueFromConfig2(a, b) {
9336
+ if (!utils$1.isUndefined(b)) {
9337
+ return getMergedValue(void 0, b);
9338
+ }
9339
+ }
9340
+ __name(valueFromConfig2, "valueFromConfig2");
9341
+ function defaultToConfig2(a, b) {
9342
+ if (!utils$1.isUndefined(b)) {
9343
+ return getMergedValue(void 0, b);
9344
+ } else if (!utils$1.isUndefined(a)) {
9345
+ return getMergedValue(void 0, a);
9346
+ }
9347
+ }
9348
+ __name(defaultToConfig2, "defaultToConfig2");
9349
+ function mergeDirectKeys(a, b, prop) {
9350
+ if (prop in config2) {
9351
+ return getMergedValue(a, b);
9352
+ } else if (prop in config1) {
9353
+ return getMergedValue(void 0, a);
9354
+ }
9355
+ }
9356
+ __name(mergeDirectKeys, "mergeDirectKeys");
9357
+ const mergeMap = {
9358
+ url: valueFromConfig2,
9359
+ method: valueFromConfig2,
9360
+ data: valueFromConfig2,
9361
+ baseURL: defaultToConfig2,
9362
+ transformRequest: defaultToConfig2,
9363
+ transformResponse: defaultToConfig2,
9364
+ paramsSerializer: defaultToConfig2,
9365
+ timeout: defaultToConfig2,
9366
+ timeoutMessage: defaultToConfig2,
9367
+ withCredentials: defaultToConfig2,
9368
+ withXSRFToken: defaultToConfig2,
9369
+ adapter: defaultToConfig2,
9370
+ responseType: defaultToConfig2,
9371
+ xsrfCookieName: defaultToConfig2,
9372
+ xsrfHeaderName: defaultToConfig2,
9373
+ onUploadProgress: defaultToConfig2,
9374
+ onDownloadProgress: defaultToConfig2,
9375
+ decompress: defaultToConfig2,
9376
+ maxContentLength: defaultToConfig2,
9377
+ maxBodyLength: defaultToConfig2,
9378
+ beforeRedirect: defaultToConfig2,
9379
+ transport: defaultToConfig2,
9380
+ httpAgent: defaultToConfig2,
9381
+ httpsAgent: defaultToConfig2,
9382
+ cancelToken: defaultToConfig2,
9383
+ socketPath: defaultToConfig2,
9384
+ responseEncoding: defaultToConfig2,
9385
+ validateStatus: mergeDirectKeys,
9386
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
9271
9387
  };
9388
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), /* @__PURE__ */ __name(function computeConfigValue(prop) {
9389
+ const merge2 = mergeMap[prop] || mergeDeepProperties;
9390
+ const configValue = merge2(config1[prop], config2[prop], prop);
9391
+ utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
9392
+ }, "computeConfigValue"));
9393
+ return config;
9272
9394
  }
9273
- __name(progressEventReducer, "progressEventReducer");
9395
+ __name(mergeConfig, "mergeConfig");
9396
+ var resolveConfig = /* @__PURE__ */ __name((config) => {
9397
+ const newConfig = mergeConfig({}, config);
9398
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
9399
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
9400
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
9401
+ if (auth) {
9402
+ headers.set(
9403
+ "Authorization",
9404
+ "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
9405
+ );
9406
+ }
9407
+ let contentType;
9408
+ if (utils$1.isFormData(data)) {
9409
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
9410
+ headers.setContentType(void 0);
9411
+ } else if ((contentType = headers.getContentType()) !== false) {
9412
+ const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
9413
+ headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
9414
+ }
9415
+ }
9416
+ if (platform.hasStandardBrowserEnv) {
9417
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
9418
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
9419
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
9420
+ if (xsrfValue) {
9421
+ headers.set(xsrfHeaderName, xsrfValue);
9422
+ }
9423
+ }
9424
+ }
9425
+ return newConfig;
9426
+ }, "resolveConfig");
9274
9427
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
9275
9428
  var xhrAdapter = isXHRAdapterSupported && function(config) {
9276
9429
  return new Promise(/* @__PURE__ */ __name(function dispatchXhrRequest(resolve, reject) {
9277
- let requestData = config.data;
9278
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
9279
- let { responseType, withXSRFToken } = config;
9430
+ const _config = resolveConfig(config);
9431
+ let requestData = _config.data;
9432
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
9433
+ let { responseType } = _config;
9280
9434
  let onCanceled;
9281
9435
  function done() {
9282
- if (config.cancelToken) {
9283
- config.cancelToken.unsubscribe(onCanceled);
9436
+ if (_config.cancelToken) {
9437
+ _config.cancelToken.unsubscribe(onCanceled);
9284
9438
  }
9285
- if (config.signal) {
9286
- config.signal.removeEventListener("abort", onCanceled);
9439
+ if (_config.signal) {
9440
+ _config.signal.removeEventListener("abort", onCanceled);
9287
9441
  }
9288
9442
  }
9289
9443
  __name(done, "done");
9290
- let contentType;
9291
- if (utils$1.isFormData(requestData)) {
9292
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
9293
- requestHeaders.setContentType(false);
9294
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
9295
- const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
9296
- requestHeaders.setContentType([type || "multipart/form-data", ...tokens].join("; "));
9297
- }
9298
- }
9299
9444
  let request = new XMLHttpRequest();
9300
- if (config.auth) {
9301
- const username = config.auth.username || "";
9302
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
9303
- requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password));
9304
- }
9305
- const fullPath = buildFullPath(config.baseURL, config.url);
9306
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
9307
- request.timeout = config.timeout;
9445
+ request.open(_config.method.toUpperCase(), _config.url, true);
9446
+ request.timeout = _config.timeout;
9308
9447
  function onloadend() {
9309
9448
  if (!request) {
9310
9449
  return;
@@ -9348,55 +9487,46 @@ var require_axios = __commonJS({
9348
9487
  if (!request) {
9349
9488
  return;
9350
9489
  }
9351
- reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
9490
+ reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, _config, request));
9352
9491
  request = null;
9353
9492
  }, "handleAbort");
9354
9493
  request.onerror = /* @__PURE__ */ __name(function handleError() {
9355
- reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request));
9494
+ reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, _config, request));
9356
9495
  request = null;
9357
9496
  }, "handleError");
9358
9497
  request.ontimeout = /* @__PURE__ */ __name(function handleTimeout() {
9359
- let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
9360
- const transitional = config.transitional || transitionalDefaults;
9361
- if (config.timeoutErrorMessage) {
9362
- timeoutErrorMessage = config.timeoutErrorMessage;
9498
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
9499
+ const transitional = _config.transitional || transitionalDefaults;
9500
+ if (_config.timeoutErrorMessage) {
9501
+ timeoutErrorMessage = _config.timeoutErrorMessage;
9363
9502
  }
9364
9503
  reject(new AxiosError(
9365
9504
  timeoutErrorMessage,
9366
9505
  transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
9367
- config,
9506
+ _config,
9368
9507
  request
9369
9508
  ));
9370
9509
  request = null;
9371
9510
  }, "handleTimeout");
9372
- if (platform.hasStandardBrowserEnv) {
9373
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
9374
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
9375
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
9376
- if (xsrfValue) {
9377
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
9378
- }
9379
- }
9380
- }
9381
9511
  requestData === void 0 && requestHeaders.setContentType(null);
9382
9512
  if ("setRequestHeader" in request) {
9383
9513
  utils$1.forEach(requestHeaders.toJSON(), /* @__PURE__ */ __name(function setRequestHeader(val, key) {
9384
9514
  request.setRequestHeader(key, val);
9385
9515
  }, "setRequestHeader"));
9386
9516
  }
9387
- if (!utils$1.isUndefined(config.withCredentials)) {
9388
- request.withCredentials = !!config.withCredentials;
9517
+ if (!utils$1.isUndefined(_config.withCredentials)) {
9518
+ request.withCredentials = !!_config.withCredentials;
9389
9519
  }
9390
9520
  if (responseType && responseType !== "json") {
9391
- request.responseType = config.responseType;
9521
+ request.responseType = _config.responseType;
9392
9522
  }
9393
- if (typeof config.onDownloadProgress === "function") {
9394
- request.addEventListener("progress", progressEventReducer(config.onDownloadProgress, true));
9523
+ if (typeof _config.onDownloadProgress === "function") {
9524
+ request.addEventListener("progress", progressEventReducer(_config.onDownloadProgress, true));
9395
9525
  }
9396
- if (typeof config.onUploadProgress === "function" && request.upload) {
9397
- request.upload.addEventListener("progress", progressEventReducer(config.onUploadProgress));
9526
+ if (typeof _config.onUploadProgress === "function" && request.upload) {
9527
+ request.upload.addEventListener("progress", progressEventReducer(_config.onUploadProgress));
9398
9528
  }
9399
- if (config.cancelToken || config.signal) {
9529
+ if (_config.cancelToken || _config.signal) {
9400
9530
  onCanceled = /* @__PURE__ */ __name((cancel) => {
9401
9531
  if (!request) {
9402
9532
  return;
@@ -9405,12 +9535,12 @@ var require_axios = __commonJS({
9405
9535
  request.abort();
9406
9536
  request = null;
9407
9537
  }, "onCanceled");
9408
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
9409
- if (config.signal) {
9410
- config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled);
9538
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
9539
+ if (_config.signal) {
9540
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
9411
9541
  }
9412
9542
  }
9413
- const protocol = parseProtocol(fullPath);
9543
+ const protocol = parseProtocol(_config.url);
9414
9544
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
9415
9545
  reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
9416
9546
  return;
@@ -9418,9 +9548,248 @@ var require_axios = __commonJS({
9418
9548
  request.send(requestData || null);
9419
9549
  }, "dispatchXhrRequest"));
9420
9550
  };
9551
+ var composeSignals = /* @__PURE__ */ __name((signals, timeout) => {
9552
+ let controller = new AbortController();
9553
+ let aborted;
9554
+ const onabort = /* @__PURE__ */ __name(function(cancel) {
9555
+ if (!aborted) {
9556
+ aborted = true;
9557
+ unsubscribe();
9558
+ const err = cancel instanceof Error ? cancel : this.reason;
9559
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
9560
+ }
9561
+ }, "onabort");
9562
+ let timer = timeout && setTimeout(() => {
9563
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
9564
+ }, timeout);
9565
+ const unsubscribe = /* @__PURE__ */ __name(() => {
9566
+ if (signals) {
9567
+ timer && clearTimeout(timer);
9568
+ timer = null;
9569
+ signals.forEach((signal2) => {
9570
+ signal2 && (signal2.removeEventListener ? signal2.removeEventListener("abort", onabort) : signal2.unsubscribe(onabort));
9571
+ });
9572
+ signals = null;
9573
+ }
9574
+ }, "unsubscribe");
9575
+ signals.forEach((signal2) => signal2 && signal2.addEventListener && signal2.addEventListener("abort", onabort));
9576
+ const { signal } = controller;
9577
+ signal.unsubscribe = unsubscribe;
9578
+ return [signal, () => {
9579
+ timer && clearTimeout(timer);
9580
+ timer = null;
9581
+ }];
9582
+ }, "composeSignals");
9583
+ var composeSignals$1 = composeSignals;
9584
+ var streamChunk = /* @__PURE__ */ __name(function* (chunk, chunkSize) {
9585
+ let len = chunk.byteLength;
9586
+ if (!chunkSize || len < chunkSize) {
9587
+ yield chunk;
9588
+ return;
9589
+ }
9590
+ let pos = 0;
9591
+ let end;
9592
+ while (pos < len) {
9593
+ end = pos + chunkSize;
9594
+ yield chunk.slice(pos, end);
9595
+ pos = end;
9596
+ }
9597
+ }, "streamChunk");
9598
+ var readBytes = /* @__PURE__ */ __name(async function* (iterable, chunkSize, encode2) {
9599
+ for await (const chunk of iterable) {
9600
+ yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : await encode2(String(chunk)), chunkSize);
9601
+ }
9602
+ }, "readBytes");
9603
+ var trackStream = /* @__PURE__ */ __name((stream, chunkSize, onProgress, onFinish, encode2) => {
9604
+ const iterator = readBytes(stream, chunkSize, encode2);
9605
+ let bytes = 0;
9606
+ return new ReadableStream({
9607
+ type: "bytes",
9608
+ async pull(controller) {
9609
+ const { done, value } = await iterator.next();
9610
+ if (done) {
9611
+ controller.close();
9612
+ onFinish();
9613
+ return;
9614
+ }
9615
+ let len = value.byteLength;
9616
+ onProgress && onProgress(bytes += len);
9617
+ controller.enqueue(new Uint8Array(value));
9618
+ },
9619
+ cancel(reason) {
9620
+ onFinish(reason);
9621
+ return iterator.return();
9622
+ }
9623
+ }, {
9624
+ highWaterMark: 2
9625
+ });
9626
+ }, "trackStream");
9627
+ var fetchProgressDecorator = /* @__PURE__ */ __name((total, fn) => {
9628
+ const lengthComputable = total != null;
9629
+ return (loaded) => setTimeout(() => fn({
9630
+ lengthComputable,
9631
+ total,
9632
+ loaded
9633
+ }));
9634
+ }, "fetchProgressDecorator");
9635
+ var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
9636
+ var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
9637
+ var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
9638
+ var supportsRequestStream = isReadableStreamSupported && (() => {
9639
+ let duplexAccessed = false;
9640
+ const hasContentType = new Request(platform.origin, {
9641
+ body: new ReadableStream(),
9642
+ method: "POST",
9643
+ get duplex() {
9644
+ duplexAccessed = true;
9645
+ return "half";
9646
+ }
9647
+ }).headers.has("Content-Type");
9648
+ return duplexAccessed && !hasContentType;
9649
+ })();
9650
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
9651
+ var supportsResponseStream = isReadableStreamSupported && !!(() => {
9652
+ try {
9653
+ return utils$1.isReadableStream(new Response("").body);
9654
+ } catch (err) {
9655
+ }
9656
+ })();
9657
+ var resolvers = {
9658
+ stream: supportsResponseStream && ((res) => res.body)
9659
+ };
9660
+ isFetchSupported && ((res) => {
9661
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
9662
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
9663
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
9664
+ });
9665
+ });
9666
+ })(new Response());
9667
+ var getBodyLength = /* @__PURE__ */ __name(async (body) => {
9668
+ if (body == null) {
9669
+ return 0;
9670
+ }
9671
+ if (utils$1.isBlob(body)) {
9672
+ return body.size;
9673
+ }
9674
+ if (utils$1.isSpecCompliantForm(body)) {
9675
+ return (await new Request(body).arrayBuffer()).byteLength;
9676
+ }
9677
+ if (utils$1.isArrayBufferView(body)) {
9678
+ return body.byteLength;
9679
+ }
9680
+ if (utils$1.isURLSearchParams(body)) {
9681
+ body = body + "";
9682
+ }
9683
+ if (utils$1.isString(body)) {
9684
+ return (await encodeText(body)).byteLength;
9685
+ }
9686
+ }, "getBodyLength");
9687
+ var resolveBodyLength = /* @__PURE__ */ __name(async (headers, body) => {
9688
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
9689
+ return length == null ? getBodyLength(body) : length;
9690
+ }, "resolveBodyLength");
9691
+ var fetchAdapter = isFetchSupported && (async (config) => {
9692
+ let {
9693
+ url,
9694
+ method,
9695
+ data,
9696
+ signal,
9697
+ cancelToken,
9698
+ timeout,
9699
+ onDownloadProgress,
9700
+ onUploadProgress,
9701
+ responseType,
9702
+ headers,
9703
+ withCredentials = "same-origin",
9704
+ fetchOptions
9705
+ } = resolveConfig(config);
9706
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
9707
+ let [composedSignal, stopTimeout] = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : [];
9708
+ let finished, request;
9709
+ const onFinish = /* @__PURE__ */ __name(() => {
9710
+ !finished && setTimeout(() => {
9711
+ composedSignal && composedSignal.unsubscribe();
9712
+ });
9713
+ finished = true;
9714
+ }, "onFinish");
9715
+ let requestContentLength;
9716
+ try {
9717
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
9718
+ let _request = new Request(url, {
9719
+ method: "POST",
9720
+ body: data,
9721
+ duplex: "half"
9722
+ });
9723
+ let contentTypeHeader;
9724
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
9725
+ headers.setContentType(contentTypeHeader);
9726
+ }
9727
+ if (_request.body) {
9728
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
9729
+ requestContentLength,
9730
+ progressEventReducer(onUploadProgress)
9731
+ ), null, encodeText);
9732
+ }
9733
+ }
9734
+ if (!utils$1.isString(withCredentials)) {
9735
+ withCredentials = withCredentials ? "cors" : "omit";
9736
+ }
9737
+ request = new Request(url, {
9738
+ ...fetchOptions,
9739
+ signal: composedSignal,
9740
+ method: method.toUpperCase(),
9741
+ headers: headers.normalize().toJSON(),
9742
+ body: data,
9743
+ duplex: "half",
9744
+ withCredentials
9745
+ });
9746
+ let response = await fetch(request);
9747
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
9748
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
9749
+ const options = {};
9750
+ ["status", "statusText", "headers"].forEach((prop) => {
9751
+ options[prop] = response[prop];
9752
+ });
9753
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
9754
+ response = new Response(
9755
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(
9756
+ responseContentLength,
9757
+ progressEventReducer(onDownloadProgress, true)
9758
+ ), isStreamResponse && onFinish, encodeText),
9759
+ options
9760
+ );
9761
+ }
9762
+ responseType = responseType || "text";
9763
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
9764
+ !isStreamResponse && onFinish();
9765
+ stopTimeout && stopTimeout();
9766
+ return await new Promise((resolve, reject) => {
9767
+ settle(resolve, reject, {
9768
+ data: responseData,
9769
+ headers: AxiosHeaders$1.from(response.headers),
9770
+ status: response.status,
9771
+ statusText: response.statusText,
9772
+ config,
9773
+ request
9774
+ });
9775
+ });
9776
+ } catch (err) {
9777
+ onFinish();
9778
+ if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
9779
+ throw Object.assign(
9780
+ new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
9781
+ {
9782
+ cause: err.cause || err
9783
+ }
9784
+ );
9785
+ }
9786
+ throw AxiosError.from(err, err && err.code, config, request);
9787
+ }
9788
+ });
9421
9789
  var knownAdapters = {
9422
9790
  http: httpAdapter,
9423
- xhr: xhrAdapter
9791
+ xhr: xhrAdapter,
9792
+ fetch: fetchAdapter
9424
9793
  };
9425
9794
  utils$1.forEach(knownAdapters, (fn, value) => {
9426
9795
  if (fn) {
@@ -9514,91 +9883,7 @@ var require_axios = __commonJS({
9514
9883
  }, "onAdapterRejection"));
9515
9884
  }
9516
9885
  __name(dispatchRequest, "dispatchRequest");
9517
- var headersToObject = /* @__PURE__ */ __name((thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing, "headersToObject");
9518
- function mergeConfig(config1, config2) {
9519
- config2 = config2 || {};
9520
- const config = {};
9521
- function getMergedValue(target, source, caseless) {
9522
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
9523
- return utils$1.merge.call({ caseless }, target, source);
9524
- } else if (utils$1.isPlainObject(source)) {
9525
- return utils$1.merge({}, source);
9526
- } else if (utils$1.isArray(source)) {
9527
- return source.slice();
9528
- }
9529
- return source;
9530
- }
9531
- __name(getMergedValue, "getMergedValue");
9532
- function mergeDeepProperties(a, b, caseless) {
9533
- if (!utils$1.isUndefined(b)) {
9534
- return getMergedValue(a, b, caseless);
9535
- } else if (!utils$1.isUndefined(a)) {
9536
- return getMergedValue(void 0, a, caseless);
9537
- }
9538
- }
9539
- __name(mergeDeepProperties, "mergeDeepProperties");
9540
- function valueFromConfig2(a, b) {
9541
- if (!utils$1.isUndefined(b)) {
9542
- return getMergedValue(void 0, b);
9543
- }
9544
- }
9545
- __name(valueFromConfig2, "valueFromConfig2");
9546
- function defaultToConfig2(a, b) {
9547
- if (!utils$1.isUndefined(b)) {
9548
- return getMergedValue(void 0, b);
9549
- } else if (!utils$1.isUndefined(a)) {
9550
- return getMergedValue(void 0, a);
9551
- }
9552
- }
9553
- __name(defaultToConfig2, "defaultToConfig2");
9554
- function mergeDirectKeys(a, b, prop) {
9555
- if (prop in config2) {
9556
- return getMergedValue(a, b);
9557
- } else if (prop in config1) {
9558
- return getMergedValue(void 0, a);
9559
- }
9560
- }
9561
- __name(mergeDirectKeys, "mergeDirectKeys");
9562
- const mergeMap = {
9563
- url: valueFromConfig2,
9564
- method: valueFromConfig2,
9565
- data: valueFromConfig2,
9566
- baseURL: defaultToConfig2,
9567
- transformRequest: defaultToConfig2,
9568
- transformResponse: defaultToConfig2,
9569
- paramsSerializer: defaultToConfig2,
9570
- timeout: defaultToConfig2,
9571
- timeoutMessage: defaultToConfig2,
9572
- withCredentials: defaultToConfig2,
9573
- withXSRFToken: defaultToConfig2,
9574
- adapter: defaultToConfig2,
9575
- responseType: defaultToConfig2,
9576
- xsrfCookieName: defaultToConfig2,
9577
- xsrfHeaderName: defaultToConfig2,
9578
- onUploadProgress: defaultToConfig2,
9579
- onDownloadProgress: defaultToConfig2,
9580
- decompress: defaultToConfig2,
9581
- maxContentLength: defaultToConfig2,
9582
- maxBodyLength: defaultToConfig2,
9583
- beforeRedirect: defaultToConfig2,
9584
- transport: defaultToConfig2,
9585
- httpAgent: defaultToConfig2,
9586
- httpsAgent: defaultToConfig2,
9587
- cancelToken: defaultToConfig2,
9588
- socketPath: defaultToConfig2,
9589
- responseEncoding: defaultToConfig2,
9590
- validateStatus: mergeDirectKeys,
9591
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
9592
- };
9593
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), /* @__PURE__ */ __name(function computeConfigValue(prop) {
9594
- const merge2 = mergeMap[prop] || mergeDeepProperties;
9595
- const configValue = merge2(config1[prop], config2[prop], prop);
9596
- utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
9597
- }, "computeConfigValue"));
9598
- return config;
9599
- }
9600
- __name(mergeConfig, "mergeConfig");
9601
- var VERSION = "1.6.8";
9886
+ var VERSION = "1.7.2";
9602
9887
  var validators$1 = {};
9603
9888
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
9604
9889
  validators$1[type] = /* @__PURE__ */ __name(function validator2(thing) {
@@ -9685,10 +9970,13 @@ var require_axios = __commonJS({
9685
9970
  let dummy;
9686
9971
  Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
9687
9972
  const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
9688
- if (!err.stack) {
9689
- err.stack = stack;
9690
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
9691
- err.stack += "\n" + stack;
9973
+ try {
9974
+ if (!err.stack) {
9975
+ err.stack = stack;
9976
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
9977
+ err.stack += "\n" + stack;
9978
+ }
9979
+ } catch (e) {
9692
9980
  }
9693
9981
  }
9694
9982
  throw err;