@oiz/stzh-components 4.4.2 → 4.4.3

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 (57) hide show
  1. package/dist/cjs/{app-globals-14d9de84.js → app-globals-f41fe9b1.js} +2 -2
  2. package/dist/cjs/{app-globals-14d9de84.js.map → app-globals-f41fe9b1.js.map} +1 -1
  3. package/dist/cjs/{axios-0a08e254.js → axios-7101b594.js} +361 -229
  4. package/dist/cjs/axios-7101b594.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/stzh-bathstatus-list.cjs.entry.js +1 -1
  7. package/dist/cjs/stzh-components.cjs.js +1 -1
  8. package/dist/cjs/stzh-microsite-teaserlist.cjs.entry.js +1 -1
  9. package/dist/cjs/stzh-poilist.cjs.entry.js +1 -1
  10. package/dist/cjs/stzh-search.cjs.entry.js +1 -1
  11. package/dist/cjs/stzh-vbz-majorticker.cjs.entry.js +1 -1
  12. package/dist/cjs/stzh-vbz-ticker.cjs.entry.js +1 -1
  13. package/dist/components/index.js +1 -1
  14. package/dist/components/{p-1b0f45c6.js → p-30d100f4.js} +361 -229
  15. package/dist/components/p-30d100f4.js.map +1 -0
  16. package/dist/components/stzh-bathstatus-list.js +1 -1
  17. package/dist/components/stzh-microsite-teaserlist.js +1 -1
  18. package/dist/components/stzh-poilist.js +1 -1
  19. package/dist/components/stzh-search.js +1 -1
  20. package/dist/components/stzh-vbz-majorticker.js +1 -1
  21. package/dist/components/stzh-vbz-ticker.js +1 -1
  22. package/dist/esm/{app-globals-611adbd0.js → app-globals-4d8695ba.js} +2 -2
  23. package/dist/esm/{app-globals-611adbd0.js.map → app-globals-4d8695ba.js.map} +1 -1
  24. package/dist/esm/{axios-8bc4215c.js → axios-b144d3e0.js} +361 -229
  25. package/dist/esm/axios-b144d3e0.js.map +1 -0
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/stzh-bathstatus-list.entry.js +1 -1
  28. package/dist/esm/stzh-components.js +1 -1
  29. package/dist/esm/stzh-microsite-teaserlist.entry.js +1 -1
  30. package/dist/esm/stzh-poilist.entry.js +1 -1
  31. package/dist/esm/stzh-search.entry.js +1 -1
  32. package/dist/esm/stzh-vbz-majorticker.entry.js +1 -1
  33. package/dist/esm/stzh-vbz-ticker.entry.js +1 -1
  34. package/dist/stzh-components/p-30d100f4.js +2 -0
  35. package/dist/stzh-components/p-30d100f4.js.map +1 -0
  36. package/dist/stzh-components/p-357ce1c2.entry.js +2 -0
  37. package/dist/stzh-components/{p-435f3927.entry.js.map → p-357ce1c2.entry.js.map} +1 -1
  38. package/dist/stzh-components/{p-7be5d916.entry.js → p-81223fd0.entry.js} +2 -2
  39. package/dist/stzh-components/{p-d08a74fe.entry.js → p-98eb5017.entry.js} +2 -2
  40. package/dist/stzh-components/{p-97a6fbc6.entry.js → p-a45f19b5.entry.js} +2 -2
  41. package/dist/stzh-components/{p-035cdba2.entry.js → p-adcf8c10.entry.js} +2 -2
  42. package/dist/stzh-components/{p-c6a770a6.js → p-bac2e98e.js} +2 -2
  43. package/dist/stzh-components/{p-ec1efeb8.entry.js → p-d71d4d86.entry.js} +2 -2
  44. package/dist/stzh-components/stzh-components.esm.js +1 -1
  45. package/package.json +1 -1
  46. package/dist/cjs/axios-0a08e254.js.map +0 -1
  47. package/dist/components/p-1b0f45c6.js.map +0 -1
  48. package/dist/esm/axios-8bc4215c.js.map +0 -1
  49. package/dist/stzh-components/p-1b0f45c6.js +0 -2
  50. package/dist/stzh-components/p-1b0f45c6.js.map +0 -1
  51. package/dist/stzh-components/p-435f3927.entry.js +0 -2
  52. /package/dist/stzh-components/{p-7be5d916.entry.js.map → p-81223fd0.entry.js.map} +0 -0
  53. /package/dist/stzh-components/{p-d08a74fe.entry.js.map → p-98eb5017.entry.js.map} +0 -0
  54. /package/dist/stzh-components/{p-97a6fbc6.entry.js.map → p-a45f19b5.entry.js.map} +0 -0
  55. /package/dist/stzh-components/{p-035cdba2.entry.js.map → p-adcf8c10.entry.js.map} +0 -0
  56. /package/dist/stzh-components/{p-c6a770a6.js.map → p-bac2e98e.js.map} +0 -0
  57. /package/dist/stzh-components/{p-ec1efeb8.entry.js.map → p-d71d4d86.entry.js.map} +0 -0
@@ -10,6 +10,7 @@ function bind(fn, thisArg) {
10
10
 
11
11
  const {toString} = Object.prototype;
12
12
  const {getPrototypeOf} = Object;
13
+ const {iterator, toStringTag} = Symbol;
13
14
 
14
15
  const kindOf = (cache => thing => {
15
16
  const str = toString.call(thing);
@@ -50,7 +51,7 @@ const isUndefined = typeOfTest('undefined');
50
51
  */
51
52
  function isBuffer(val) {
52
53
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
53
- && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
54
+ && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
54
55
  }
55
56
 
56
57
  /**
@@ -95,7 +96,7 @@ const isString = typeOfTest('string');
95
96
  * @param {*} val The value to test
96
97
  * @returns {boolean} True if value is a Function, otherwise false
97
98
  */
98
- const isFunction = typeOfTest('function');
99
+ const isFunction$1 = typeOfTest('function');
99
100
 
100
101
  /**
101
102
  * Determine if a value is a Number
@@ -136,7 +137,28 @@ const isPlainObject = (val) => {
136
137
  }
137
138
 
138
139
  const prototype = getPrototypeOf(val);
139
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
140
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
141
+ };
142
+
143
+ /**
144
+ * Determine if a value is an empty object (safely handles Buffers)
145
+ *
146
+ * @param {*} val The value to test
147
+ *
148
+ * @returns {boolean} True if value is an empty object, otherwise false
149
+ */
150
+ const isEmptyObject = (val) => {
151
+ // Early return for non-objects or Buffers to prevent RangeError
152
+ if (!isObject(val) || isBuffer(val)) {
153
+ return false;
154
+ }
155
+
156
+ try {
157
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
158
+ } catch (e) {
159
+ // Fallback for any other objects that might cause RangeError with Object.keys()
160
+ return false;
161
+ }
140
162
  };
141
163
 
142
164
  /**
@@ -182,7 +204,7 @@ const isFileList = kindOfTest('FileList');
182
204
  *
183
205
  * @returns {boolean} True if value is a Stream, otherwise false
184
206
  */
185
- const isStream = (val) => isObject(val) && isFunction(val.pipe);
207
+ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
186
208
 
187
209
  /**
188
210
  * Determine if a value is a FormData
@@ -195,10 +217,10 @@ const isFormData = (thing) => {
195
217
  let kind;
196
218
  return thing && (
197
219
  (typeof FormData === 'function' && thing instanceof FormData) || (
198
- isFunction(thing.append) && (
220
+ isFunction$1(thing.append) && (
199
221
  (kind = kindOf(thing)) === 'formdata' ||
200
222
  // detect form-data instance
201
- (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
223
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
202
224
  )
203
225
  )
204
226
  )
@@ -261,6 +283,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
261
283
  fn.call(null, obj[i], i, obj);
262
284
  }
263
285
  } else {
286
+ // Buffer check
287
+ if (isBuffer(obj)) {
288
+ return;
289
+ }
290
+
264
291
  // Iterate over object keys
265
292
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
266
293
  const len = keys.length;
@@ -274,6 +301,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
274
301
  }
275
302
 
276
303
  function findKey(obj, key) {
304
+ if (isBuffer(obj)){
305
+ return null;
306
+ }
307
+
277
308
  key = key.toLowerCase();
278
309
  const keys = Object.keys(obj);
279
310
  let i = keys.length;
@@ -314,7 +345,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
314
345
  * @returns {Object} Result of all merge properties
315
346
  */
316
347
  function merge(/* obj1, obj2, obj3, ... */) {
317
- const {caseless} = isContextDefined(this) && this || {};
348
+ const {caseless, skipUndefined} = isContextDefined(this) && this || {};
318
349
  const result = {};
319
350
  const assignValue = (val, key) => {
320
351
  const targetKey = caseless && findKey(result, key) || key;
@@ -324,7 +355,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
324
355
  result[targetKey] = merge({}, val);
325
356
  } else if (isArray(val)) {
326
357
  result[targetKey] = val.slice();
327
- } else {
358
+ } else if (!skipUndefined || !isUndefined(val)) {
328
359
  result[targetKey] = val;
329
360
  }
330
361
  };
@@ -347,7 +378,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
347
378
  */
348
379
  const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
349
380
  forEach(b, (val, key) => {
350
- if (thisArg && isFunction(val)) {
381
+ if (thisArg && isFunction$1(val)) {
351
382
  a[key] = bind(val, thisArg);
352
383
  } else {
353
384
  a[key] = val;
@@ -487,13 +518,13 @@ const isTypedArray = (TypedArray => {
487
518
  * @returns {void}
488
519
  */
489
520
  const forEachEntry = (obj, fn) => {
490
- const generator = obj && obj[Symbol.iterator];
521
+ const generator = obj && obj[iterator];
491
522
 
492
- const iterator = generator.call(obj);
523
+ const _iterator = generator.call(obj);
493
524
 
494
525
  let result;
495
526
 
496
- while ((result = iterator.next()) && !result.done) {
527
+ while ((result = _iterator.next()) && !result.done) {
497
528
  const pair = result.value;
498
529
  fn.call(obj, pair[0], pair[1]);
499
530
  }
@@ -563,13 +594,13 @@ const reduceDescriptors = (obj, reducer) => {
563
594
  const freezeMethods = (obj) => {
564
595
  reduceDescriptors(obj, (descriptor, name) => {
565
596
  // skip restricted props in strict mode
566
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
597
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
567
598
  return false;
568
599
  }
569
600
 
570
601
  const value = obj[name];
571
602
 
572
- if (!isFunction(value)) return;
603
+ if (!isFunction$1(value)) return;
573
604
 
574
605
  descriptor.enumerable = false;
575
606
 
@@ -606,6 +637,8 @@ const toFiniteNumber = (value, defaultValue) => {
606
637
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
607
638
  };
608
639
 
640
+
641
+
609
642
  /**
610
643
  * If the thing is a FormData object, return true, otherwise return false.
611
644
  *
@@ -614,7 +647,7 @@ const toFiniteNumber = (value, defaultValue) => {
614
647
  * @returns {boolean}
615
648
  */
616
649
  function isSpecCompliantForm(thing) {
617
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
650
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
618
651
  }
619
652
 
620
653
  const toJSONObject = (obj) => {
@@ -627,6 +660,11 @@ const toJSONObject = (obj) => {
627
660
  return;
628
661
  }
629
662
 
663
+ //Buffer check
664
+ if (isBuffer(source)) {
665
+ return source;
666
+ }
667
+
630
668
  if(!('toJSON' in source)) {
631
669
  stack[i] = source;
632
670
  const target = isArray(source) ? [] : {};
@@ -651,7 +689,7 @@ const toJSONObject = (obj) => {
651
689
  const isAsyncFn = kindOfTest('AsyncFunction');
652
690
 
653
691
  const isThenable = (thing) =>
654
- thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
692
+ thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
655
693
 
656
694
  // original code
657
695
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -675,7 +713,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
675
713
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
676
714
  })(
677
715
  typeof setImmediate === 'function',
678
- isFunction(_global.postMessage)
716
+ isFunction$1(_global.postMessage)
679
717
  );
680
718
 
681
719
  const asap = typeof queueMicrotask !== 'undefined' ?
@@ -683,6 +721,10 @@ const asap = typeof queueMicrotask !== 'undefined' ?
683
721
 
684
722
  // *********************
685
723
 
724
+
725
+ const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
726
+
727
+
686
728
  const utils$1 = {
687
729
  isArray,
688
730
  isArrayBuffer,
@@ -694,6 +736,7 @@ const utils$1 = {
694
736
  isBoolean,
695
737
  isObject,
696
738
  isPlainObject,
739
+ isEmptyObject,
697
740
  isReadableStream,
698
741
  isRequest,
699
742
  isResponse,
@@ -703,7 +746,7 @@ const utils$1 = {
703
746
  isFile,
704
747
  isBlob,
705
748
  isRegExp,
706
- isFunction,
749
+ isFunction: isFunction$1,
707
750
  isStream,
708
751
  isURLSearchParams,
709
752
  isTypedArray,
@@ -738,7 +781,8 @@ const utils$1 = {
738
781
  isAsyncFn,
739
782
  isThenable,
740
783
  setImmediate: _setImmediate,
741
- asap
784
+ asap,
785
+ isIterable
742
786
  };
743
787
 
744
788
  /**
@@ -828,11 +872,18 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
828
872
  return prop !== 'isAxiosError';
829
873
  });
830
874
 
831
- AxiosError.call(axiosError, error.message, code, config, request, response);
875
+ const msg = error && error.message ? error.message : 'Error';
832
876
 
833
- axiosError.cause = error;
877
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
878
+ const errCode = code == null && error ? error.code : code;
879
+ AxiosError.call(axiosError, msg, errCode, config, request, response);
834
880
 
835
- axiosError.name = error.name;
881
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
882
+ if (error && axiosError.cause == null) {
883
+ Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
884
+ }
885
+
886
+ axiosError.name = (error && error.name) || 'Error';
836
887
 
837
888
  customProps && Object.assign(axiosError, customProps);
838
889
 
@@ -957,6 +1008,10 @@ function toFormData(obj, formData, options) {
957
1008
  return value.toISOString();
958
1009
  }
959
1010
 
1011
+ if (utils$1.isBoolean(value)) {
1012
+ return value.toString();
1013
+ }
1014
+
960
1015
  if (!useBlob && utils$1.isBlob(value)) {
961
1016
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
962
1017
  }
@@ -1119,9 +1174,7 @@ function encode(val) {
1119
1174
  replace(/%3A/gi, ':').
1120
1175
  replace(/%24/g, '$').
1121
1176
  replace(/%2C/gi, ',').
1122
- replace(/%20/g, '+').
1123
- replace(/%5B/gi, '[').
1124
- replace(/%5D/gi, ']');
1177
+ replace(/%20/g, '+');
1125
1178
  }
1126
1179
 
1127
1180
  /**
@@ -1320,7 +1373,7 @@ const platform = {
1320
1373
  };
1321
1374
 
1322
1375
  function toURLEncodedForm(data, options) {
1323
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1376
+ return toFormData(data, new platform.classes.URLSearchParams(), {
1324
1377
  visitor: function(value, key, path, helpers) {
1325
1378
  if (platform.isNode && utils$1.isBuffer(value)) {
1326
1379
  this.append(key, value.toString('base64'));
@@ -1328,8 +1381,9 @@ function toURLEncodedForm(data, options) {
1328
1381
  }
1329
1382
 
1330
1383
  return helpers.defaultVisitor.apply(this, arguments);
1331
- }
1332
- }, options));
1384
+ },
1385
+ ...options
1386
+ });
1333
1387
  }
1334
1388
 
1335
1389
  /**
@@ -1525,7 +1579,7 @@ const defaults = {
1525
1579
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
1526
1580
 
1527
1581
  try {
1528
- return JSON.parse(data);
1582
+ return JSON.parse(data, this.parseReviver);
1529
1583
  } catch (e) {
1530
1584
  if (strictJSONParsing) {
1531
1585
  if (e.name === 'SyntaxError') {
@@ -1723,10 +1777,18 @@ class AxiosHeaders {
1723
1777
  setHeaders(header, valueOrRewrite);
1724
1778
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1725
1779
  setHeaders(parseHeaders(header), valueOrRewrite);
1726
- } else if (utils$1.isHeaders(header)) {
1727
- for (const [key, value] of header.entries()) {
1728
- setHeader(value, key, rewrite);
1780
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1781
+ let obj = {}, dest, key;
1782
+ for (const entry of header) {
1783
+ if (!utils$1.isArray(entry)) {
1784
+ throw TypeError('Object iterator must return a key-value pair');
1785
+ }
1786
+
1787
+ obj[key = entry[0]] = (dest = obj[key]) ?
1788
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
1729
1789
  }
1790
+
1791
+ setHeaders(obj, valueOrRewrite);
1730
1792
  } else {
1731
1793
  header != null && setHeader(valueOrRewrite, header, rewrite);
1732
1794
  }
@@ -1868,6 +1930,10 @@ class AxiosHeaders {
1868
1930
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1869
1931
  }
1870
1932
 
1933
+ getSetCookie() {
1934
+ return this.get("set-cookie") || [];
1935
+ }
1936
+
1871
1937
  get [Symbol.toStringTag]() {
1872
1938
  return 'AxiosHeaders';
1873
1939
  }
@@ -2070,7 +2136,7 @@ function throttle(fn, freq) {
2070
2136
  clearTimeout(timer);
2071
2137
  timer = null;
2072
2138
  }
2073
- fn.apply(null, args);
2139
+ fn(...args);
2074
2140
  };
2075
2141
 
2076
2142
  const throttled = (...args) => {
@@ -2227,7 +2293,7 @@ function combineURLs(baseURL, relativeURL) {
2227
2293
  */
2228
2294
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2229
2295
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
2230
- if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
2296
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2231
2297
  return combineURLs(baseURL, requestedURL);
2232
2298
  }
2233
2299
  return requestedURL;
@@ -2326,7 +2392,7 @@ function mergeConfig(config1, config2) {
2326
2392
  headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
2327
2393
  };
2328
2394
 
2329
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2395
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
2330
2396
  const merge = mergeMap[prop] || mergeDeepProperties;
2331
2397
  const configValue = merge(config1[prop], config2[prop], prop);
2332
2398
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -2338,11 +2404,11 @@ function mergeConfig(config1, config2) {
2338
2404
  const resolveConfig = (config) => {
2339
2405
  const newConfig = mergeConfig({}, config);
2340
2406
 
2341
- let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
2407
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
2342
2408
 
2343
2409
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
2344
2410
 
2345
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
2411
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
2346
2412
 
2347
2413
  // HTTP basic authentication
2348
2414
  if (auth) {
@@ -2351,17 +2417,21 @@ const resolveConfig = (config) => {
2351
2417
  );
2352
2418
  }
2353
2419
 
2354
- let contentType;
2355
-
2356
2420
  if (utils$1.isFormData(data)) {
2357
2421
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2358
- headers.setContentType(undefined); // Let the browser set it
2359
- } else if ((contentType = headers.getContentType()) !== false) {
2360
- // fix semicolon duplication issue for ReactNative FormData implementation
2361
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
2362
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
2422
+ headers.setContentType(undefined); // browser handles it
2423
+ } else if (utils$1.isFunction(data.getHeaders)) {
2424
+ // Node.js FormData (like form-data package)
2425
+ const formHeaders = data.getHeaders();
2426
+ // Only set safe headers to avoid overwriting security headers
2427
+ const allowedHeaders = ['content-type', 'content-length'];
2428
+ Object.entries(formHeaders).forEach(([key, val]) => {
2429
+ if (allowedHeaders.includes(key.toLowerCase())) {
2430
+ headers.set(key, val);
2431
+ }
2432
+ });
2363
2433
  }
2364
- }
2434
+ }
2365
2435
 
2366
2436
  // Add xsrf header
2367
2437
  // This is only done if running in a standard browser environment.
@@ -2478,15 +2548,18 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
2478
2548
  };
2479
2549
 
2480
2550
  // Handle low level network errors
2481
- request.onerror = function handleError() {
2482
- // Real errors are hidden from us by the browser
2483
- // onerror should only fire if it's a network error
2484
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2485
-
2486
- // Clean up request
2487
- request = null;
2551
+ request.onerror = function handleError(event) {
2552
+ // Browsers deliver a ProgressEvent in XHR onerror
2553
+ // (message may be empty; when present, surface it)
2554
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
2555
+ const msg = event && event.message ? event.message : 'Network Error';
2556
+ const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
2557
+ // attach the underlying event for consumers who want details
2558
+ err.event = event || null;
2559
+ reject(err);
2560
+ request = null;
2488
2561
  };
2489
-
2562
+
2490
2563
  // Handle timeout
2491
2564
  request.ontimeout = function handleTimeout() {
2492
2565
  let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
@@ -2702,14 +2775,18 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
2702
2775
  })
2703
2776
  };
2704
2777
 
2705
- const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
2706
- const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
2778
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
2779
+
2780
+ const {isFunction} = utils$1;
2781
+
2782
+ const globalFetchAPI = (({Request, Response}) => ({
2783
+ Request, Response
2784
+ }))(utils$1.global);
2785
+
2786
+ const {
2787
+ ReadableStream: ReadableStream$1, TextEncoder
2788
+ } = utils$1.global;
2707
2789
 
2708
- // used only inside the fetch adapter
2709
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
2710
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
2711
- async (str) => new Uint8Array(await new Response(str).arrayBuffer())
2712
- );
2713
2790
 
2714
2791
  const test = (fn, ...args) => {
2715
2792
  try {
@@ -2719,211 +2796,268 @@ const test = (fn, ...args) => {
2719
2796
  }
2720
2797
  };
2721
2798
 
2722
- const supportsRequestStream = isReadableStreamSupported && test(() => {
2723
- let duplexAccessed = false;
2799
+ const factory = (env) => {
2800
+ env = utils$1.merge.call({
2801
+ skipUndefined: true
2802
+ }, globalFetchAPI, env);
2724
2803
 
2725
- const hasContentType = new Request(platform.origin, {
2726
- body: new ReadableStream(),
2727
- method: 'POST',
2728
- get duplex() {
2729
- duplexAccessed = true;
2730
- return 'half';
2731
- },
2732
- }).headers.has('Content-Type');
2804
+ const {fetch: envFetch, Request, Response} = env;
2805
+ const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
2806
+ const isRequestSupported = isFunction(Request);
2807
+ const isResponseSupported = isFunction(Response);
2733
2808
 
2734
- return duplexAccessed && !hasContentType;
2735
- });
2809
+ if (!isFetchSupported) {
2810
+ return false;
2811
+ }
2736
2812
 
2737
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
2813
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
2738
2814
 
2739
- const supportsResponseStream = isReadableStreamSupported &&
2740
- test(() => utils$1.isReadableStream(new Response('').body));
2815
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
2816
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
2817
+ async (str) => new Uint8Array(await new Request(str).arrayBuffer())
2818
+ );
2741
2819
 
2820
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
2821
+ let duplexAccessed = false;
2742
2822
 
2743
- const resolvers = {
2744
- stream: supportsResponseStream && ((res) => res.body)
2745
- };
2823
+ const hasContentType = new Request(platform.origin, {
2824
+ body: new ReadableStream$1(),
2825
+ method: 'POST',
2826
+ get duplex() {
2827
+ duplexAccessed = true;
2828
+ return 'half';
2829
+ },
2830
+ }).headers.has('Content-Type');
2746
2831
 
2747
- isFetchSupported && (((res) => {
2748
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2749
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
2750
- (_, config) => {
2751
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
2752
- });
2832
+ return duplexAccessed && !hasContentType;
2753
2833
  });
2754
- })(new Response));
2755
2834
 
2756
- const getBodyLength = async (body) => {
2757
- if (body == null) {
2758
- return 0;
2759
- }
2835
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
2836
+ test(() => utils$1.isReadableStream(new Response('').body));
2760
2837
 
2761
- if(utils$1.isBlob(body)) {
2762
- return body.size;
2763
- }
2838
+ const resolvers = {
2839
+ stream: supportsResponseStream && ((res) => res.body)
2840
+ };
2764
2841
 
2765
- if(utils$1.isSpecCompliantForm(body)) {
2766
- const _request = new Request(platform.origin, {
2767
- method: 'POST',
2768
- body,
2842
+ isFetchSupported && ((() => {
2843
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2844
+ !resolvers[type] && (resolvers[type] = (res, config) => {
2845
+ let method = res && res[type];
2846
+
2847
+ if (method) {
2848
+ return method.call(res);
2849
+ }
2850
+
2851
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
2852
+ });
2769
2853
  });
2770
- return (await _request.arrayBuffer()).byteLength;
2771
- }
2854
+ })());
2772
2855
 
2773
- if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2774
- return body.byteLength;
2775
- }
2856
+ const getBodyLength = async (body) => {
2857
+ if (body == null) {
2858
+ return 0;
2859
+ }
2776
2860
 
2777
- if(utils$1.isURLSearchParams(body)) {
2778
- body = body + '';
2779
- }
2861
+ if (utils$1.isBlob(body)) {
2862
+ return body.size;
2863
+ }
2780
2864
 
2781
- if(utils$1.isString(body)) {
2782
- return (await encodeText(body)).byteLength;
2783
- }
2784
- };
2865
+ if (utils$1.isSpecCompliantForm(body)) {
2866
+ const _request = new Request(platform.origin, {
2867
+ method: 'POST',
2868
+ body,
2869
+ });
2870
+ return (await _request.arrayBuffer()).byteLength;
2871
+ }
2785
2872
 
2786
- const resolveBodyLength = async (headers, body) => {
2787
- const length = utils$1.toFiniteNumber(headers.getContentLength());
2873
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2874
+ return body.byteLength;
2875
+ }
2788
2876
 
2789
- return length == null ? getBodyLength(body) : length;
2790
- };
2877
+ if (utils$1.isURLSearchParams(body)) {
2878
+ body = body + '';
2879
+ }
2880
+
2881
+ if (utils$1.isString(body)) {
2882
+ return (await encodeText(body)).byteLength;
2883
+ }
2884
+ };
2885
+
2886
+ const resolveBodyLength = async (headers, body) => {
2887
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
2888
+
2889
+ return length == null ? getBodyLength(body) : length;
2890
+ };
2891
+
2892
+ return async (config) => {
2893
+ let {
2894
+ url,
2895
+ method,
2896
+ data,
2897
+ signal,
2898
+ cancelToken,
2899
+ timeout,
2900
+ onDownloadProgress,
2901
+ onUploadProgress,
2902
+ responseType,
2903
+ headers,
2904
+ withCredentials = 'same-origin',
2905
+ fetchOptions
2906
+ } = resolveConfig(config);
2907
+
2908
+ let _fetch = envFetch || fetch;
2909
+
2910
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
2911
+
2912
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2791
2913
 
2792
- const fetchAdapter = isFetchSupported && (async (config) => {
2793
- let {
2794
- url,
2795
- method,
2796
- data,
2797
- signal,
2798
- cancelToken,
2799
- timeout,
2800
- onDownloadProgress,
2801
- onUploadProgress,
2802
- responseType,
2803
- headers,
2804
- withCredentials = 'same-origin',
2805
- fetchOptions
2806
- } = resolveConfig(config);
2807
-
2808
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
2809
-
2810
- let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2811
-
2812
- let request;
2813
-
2814
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2914
+ let request = null;
2915
+
2916
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2815
2917
  composedSignal.unsubscribe();
2816
- });
2918
+ });
2817
2919
 
2818
- let requestContentLength;
2920
+ let requestContentLength;
2819
2921
 
2820
- try {
2821
- if (
2822
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
2823
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
2824
- ) {
2825
- let _request = new Request(url, {
2826
- method: 'POST',
2827
- body: data,
2828
- duplex: "half"
2829
- });
2922
+ try {
2923
+ if (
2924
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
2925
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
2926
+ ) {
2927
+ let _request = new Request(url, {
2928
+ method: 'POST',
2929
+ body: data,
2930
+ duplex: "half"
2931
+ });
2830
2932
 
2831
- let contentTypeHeader;
2933
+ let contentTypeHeader;
2832
2934
 
2833
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
2834
- headers.setContentType(contentTypeHeader);
2835
- }
2935
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
2936
+ headers.setContentType(contentTypeHeader);
2937
+ }
2836
2938
 
2837
- if (_request.body) {
2838
- const [onProgress, flush] = progressEventDecorator(
2839
- requestContentLength,
2840
- progressEventReducer(asyncDecorator(onUploadProgress))
2841
- );
2939
+ if (_request.body) {
2940
+ const [onProgress, flush] = progressEventDecorator(
2941
+ requestContentLength,
2942
+ progressEventReducer(asyncDecorator(onUploadProgress))
2943
+ );
2842
2944
 
2843
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2945
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2946
+ }
2844
2947
  }
2845
- }
2846
2948
 
2847
- if (!utils$1.isString(withCredentials)) {
2848
- withCredentials = withCredentials ? 'include' : 'omit';
2849
- }
2949
+ if (!utils$1.isString(withCredentials)) {
2950
+ withCredentials = withCredentials ? 'include' : 'omit';
2951
+ }
2850
2952
 
2851
- // Cloudflare Workers throws when credentials are defined
2852
- // see https://github.com/cloudflare/workerd/issues/902
2853
- const isCredentialsSupported = "credentials" in Request.prototype;
2854
- request = new Request(url, {
2855
- ...fetchOptions,
2856
- signal: composedSignal,
2857
- method: method.toUpperCase(),
2858
- headers: headers.normalize().toJSON(),
2859
- body: data,
2860
- duplex: "half",
2861
- credentials: isCredentialsSupported ? withCredentials : undefined
2862
- });
2953
+ // Cloudflare Workers throws when credentials are defined
2954
+ // see https://github.com/cloudflare/workerd/issues/902
2955
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
2863
2956
 
2864
- let response = await fetch(request);
2957
+ const resolvedOptions = {
2958
+ ...fetchOptions,
2959
+ signal: composedSignal,
2960
+ method: method.toUpperCase(),
2961
+ headers: headers.normalize().toJSON(),
2962
+ body: data,
2963
+ duplex: "half",
2964
+ credentials: isCredentialsSupported ? withCredentials : undefined
2965
+ };
2865
2966
 
2866
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2967
+ request = isRequestSupported && new Request(url, resolvedOptions);
2867
2968
 
2868
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
2869
- const options = {};
2969
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
2870
2970
 
2871
- ['status', 'statusText', 'headers'].forEach(prop => {
2872
- options[prop] = response[prop];
2873
- });
2971
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2874
2972
 
2875
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
2973
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
2974
+ const options = {};
2876
2975
 
2877
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
2878
- responseContentLength,
2879
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
2880
- ) || [];
2976
+ ['status', 'statusText', 'headers'].forEach(prop => {
2977
+ options[prop] = response[prop];
2978
+ });
2881
2979
 
2882
- response = new Response(
2883
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2884
- flush && flush();
2885
- unsubscribe && unsubscribe();
2886
- }),
2887
- options
2888
- );
2889
- }
2980
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
2890
2981
 
2891
- responseType = responseType || 'text';
2982
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
2983
+ responseContentLength,
2984
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
2985
+ ) || [];
2892
2986
 
2893
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
2987
+ response = new Response(
2988
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2989
+ flush && flush();
2990
+ unsubscribe && unsubscribe();
2991
+ }),
2992
+ options
2993
+ );
2994
+ }
2894
2995
 
2895
- !isStreamResponse && unsubscribe && unsubscribe();
2996
+ responseType = responseType || 'text';
2896
2997
 
2897
- return await new Promise((resolve, reject) => {
2898
- settle(resolve, reject, {
2899
- data: responseData,
2900
- headers: AxiosHeaders$1.from(response.headers),
2901
- status: response.status,
2902
- statusText: response.statusText,
2903
- config,
2904
- request
2905
- });
2906
- })
2907
- } catch (err) {
2908
- unsubscribe && unsubscribe();
2909
-
2910
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
2911
- throw Object.assign(
2912
- new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
2913
- {
2914
- cause: err.cause || err
2915
- }
2916
- )
2998
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
2999
+
3000
+ !isStreamResponse && unsubscribe && unsubscribe();
3001
+
3002
+ return await new Promise((resolve, reject) => {
3003
+ settle(resolve, reject, {
3004
+ data: responseData,
3005
+ headers: AxiosHeaders$1.from(response.headers),
3006
+ status: response.status,
3007
+ statusText: response.statusText,
3008
+ config,
3009
+ request
3010
+ });
3011
+ })
3012
+ } catch (err) {
3013
+ unsubscribe && unsubscribe();
3014
+
3015
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3016
+ throw Object.assign(
3017
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
3018
+ {
3019
+ cause: err.cause || err
3020
+ }
3021
+ )
3022
+ }
3023
+
3024
+ throw AxiosError.from(err, err && err.code, config, request);
2917
3025
  }
3026
+ }
3027
+ };
3028
+
3029
+ const seedCache = new Map();
3030
+
3031
+ const getFetch = (config) => {
3032
+ let env = config ? config.env : {};
3033
+ const {fetch, Request, Response} = env;
3034
+ const seeds = [
3035
+ Request, Response, fetch
3036
+ ];
3037
+
3038
+ let len = seeds.length, i = len,
3039
+ seed, target, map = seedCache;
2918
3040
 
2919
- throw AxiosError.from(err, err && err.code, config, request);
3041
+ while (i--) {
3042
+ seed = seeds[i];
3043
+ target = map.get(seed);
3044
+
3045
+ target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
3046
+
3047
+ map = target;
2920
3048
  }
2921
- });
3049
+
3050
+ return target;
3051
+ };
3052
+
3053
+ getFetch();
2922
3054
 
2923
3055
  const knownAdapters = {
2924
3056
  http: httpAdapter,
2925
3057
  xhr: xhrAdapter,
2926
- fetch: fetchAdapter
3058
+ fetch: {
3059
+ get: getFetch,
3060
+ }
2927
3061
  };
2928
3062
 
2929
3063
  utils$1.forEach(knownAdapters, (fn, value) => {
@@ -2942,7 +3076,7 @@ const renderReason = (reason) => `- ${reason}`;
2942
3076
  const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
2943
3077
 
2944
3078
  const adapters = {
2945
- getAdapter: (adapters) => {
3079
+ getAdapter: (adapters, config) => {
2946
3080
  adapters = utils$1.isArray(adapters) ? adapters : [adapters];
2947
3081
 
2948
3082
  const {length} = adapters;
@@ -2965,7 +3099,7 @@ const adapters = {
2965
3099
  }
2966
3100
  }
2967
3101
 
2968
- if (adapter) {
3102
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
2969
3103
  break;
2970
3104
  }
2971
3105
 
@@ -3033,7 +3167,7 @@ function dispatchRequest(config) {
3033
3167
  config.headers.setContentType('application/x-www-form-urlencoded', false);
3034
3168
  }
3035
3169
 
3036
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
3170
+ const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
3037
3171
 
3038
3172
  return adapter(config).then(function onAdapterResolution(response) {
3039
3173
  throwIfCancellationRequested(config);
@@ -3067,7 +3201,7 @@ function dispatchRequest(config) {
3067
3201
  });
3068
3202
  }
3069
3203
 
3070
- const VERSION = "1.8.1";
3204
+ const VERSION = "1.12.2";
3071
3205
 
3072
3206
  const validators$1 = {};
3073
3207
 
@@ -3175,7 +3309,7 @@ const validators = validator.validators;
3175
3309
  */
3176
3310
  class Axios {
3177
3311
  constructor(instanceConfig) {
3178
- this.defaults = instanceConfig;
3312
+ this.defaults = instanceConfig || {};
3179
3313
  this.interceptors = {
3180
3314
  request: new InterceptorManager$1(),
3181
3315
  response: new InterceptorManager$1()
@@ -3306,8 +3440,8 @@ class Axios {
3306
3440
 
3307
3441
  if (!synchronousRequestInterceptors) {
3308
3442
  const chain = [dispatchRequest.bind(this), undefined];
3309
- chain.unshift.apply(chain, requestInterceptorChain);
3310
- chain.push.apply(chain, responseInterceptorChain);
3443
+ chain.unshift(...requestInterceptorChain);
3444
+ chain.push(...responseInterceptorChain);
3311
3445
  len = chain.length;
3312
3446
 
3313
3447
  promise = Promise.resolve(config);
@@ -3323,8 +3457,6 @@ class Axios {
3323
3457
 
3324
3458
  let newConfig = config;
3325
3459
 
3326
- i = 0;
3327
-
3328
3460
  while (i < len) {
3329
3461
  const onFulfilled = requestInterceptorChain[i++];
3330
3462
  const onRejected = requestInterceptorChain[i++];
@@ -3708,4 +3840,4 @@ const axios$1 = axios;
3708
3840
 
3709
3841
  exports.axios = axios$1;
3710
3842
 
3711
- //# sourceMappingURL=axios-0a08e254.js.map
3843
+ //# sourceMappingURL=axios-7101b594.js.map