contentful 11.2.2 → 11.2.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.
@@ -12,6 +12,7 @@ var require$$0$4 = require('tty');
12
12
  var require$$0$3 = require('os');
13
13
  var require$$7 = require('zlib');
14
14
  var require$$9 = require('events');
15
+ var process$1 = require('process');
15
16
 
16
17
  function _OverloadYield(e, d) {
17
18
  this.v = e, this.k = d;
@@ -85,15 +86,27 @@ function AsyncFromSyncIterator(r) {
85
86
  function _awaitAsyncGenerator(e) {
86
87
  return new _OverloadYield(e, 0);
87
88
  }
88
- function _defineProperty$1(e, r, t) {
89
- return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
89
+ function _defineProperty(e, r, t) {
90
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
90
91
  value: t,
91
92
  enumerable: !0,
92
93
  configurable: !0,
93
94
  writable: !0
94
95
  }) : e[r] = t, e;
95
96
  }
96
- function ownKeys$1(e, r) {
97
+ function _inherits(t, e) {
98
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
99
+ t.prototype = Object.create(e && e.prototype, {
100
+ constructor: {
101
+ value: t,
102
+ writable: !0,
103
+ configurable: !0
104
+ }
105
+ }), Object.defineProperty(t, "prototype", {
106
+ writable: !1
107
+ }), e && _setPrototypeOf(t, e);
108
+ }
109
+ function ownKeys(e, r) {
97
110
  var t = Object.keys(e);
98
111
  if (Object.getOwnPropertySymbols) {
99
112
  var o = Object.getOwnPropertySymbols(e);
@@ -103,18 +116,23 @@ function ownKeys$1(e, r) {
103
116
  }
104
117
  return t;
105
118
  }
106
- function _objectSpread2$1(e) {
119
+ function _objectSpread2(e) {
107
120
  for (var r = 1; r < arguments.length; r++) {
108
121
  var t = null != arguments[r] ? arguments[r] : {};
109
- r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) {
110
- _defineProperty$1(e, r, t[r]);
111
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) {
122
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
123
+ _defineProperty(e, r, t[r]);
124
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
112
125
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
113
126
  });
114
127
  }
115
128
  return e;
116
129
  }
117
- function _toPrimitive$1(t, r) {
130
+ function _setPrototypeOf(t, e) {
131
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
132
+ return t.__proto__ = e, t;
133
+ }, _setPrototypeOf(t, e);
134
+ }
135
+ function _toPrimitive(t, r) {
118
136
  if ("object" != typeof t || !t) return t;
119
137
  var e = t[Symbol.toPrimitive];
120
138
  if (void 0 !== e) {
@@ -124,8 +142,8 @@ function _toPrimitive$1(t, r) {
124
142
  }
125
143
  return ("string" === r ? String : Number)(t);
126
144
  }
127
- function _toPropertyKey$1(t) {
128
- var i = _toPrimitive$1(t, "string");
145
+ function _toPropertyKey(t) {
146
+ var i = _toPrimitive(t, "string");
129
147
  return "symbol" == typeof i ? i : i + "";
130
148
  }
131
149
  function _wrapAsyncGenerator(e) {
@@ -195,6 +213,53 @@ AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator ||
195
213
  }, AsyncGenerator.prototype.return = function (e) {
196
214
  return this._invoke("return", e);
197
215
  };
216
+ function _wrapRegExp() {
217
+ _wrapRegExp = function (e, r) {
218
+ return new BabelRegExp(e, void 0, r);
219
+ };
220
+ var e = RegExp.prototype,
221
+ r = new WeakMap();
222
+ function BabelRegExp(e, t, p) {
223
+ var o = RegExp(e, t);
224
+ return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype);
225
+ }
226
+ function buildGroups(e, t) {
227
+ var p = r.get(t);
228
+ return Object.keys(p).reduce(function (r, t) {
229
+ var o = p[t];
230
+ if ("number" == typeof o) r[t] = e[o];else {
231
+ for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++;
232
+ r[t] = e[o[i]];
233
+ }
234
+ return r;
235
+ }, Object.create(null));
236
+ }
237
+ return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) {
238
+ var t = e.exec.call(this, r);
239
+ if (t) {
240
+ t.groups = buildGroups(t, this);
241
+ var p = t.indices;
242
+ p && (p.groups = buildGroups(p, this));
243
+ }
244
+ return t;
245
+ }, BabelRegExp.prototype[Symbol.replace] = function (t, p) {
246
+ if ("string" == typeof p) {
247
+ var o = r.get(this);
248
+ return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) {
249
+ var t = o[r];
250
+ return "$" + (Array.isArray(t) ? t.join("$") : t);
251
+ }));
252
+ }
253
+ if ("function" == typeof p) {
254
+ var i = this;
255
+ return e[Symbol.replace].call(this, t, function () {
256
+ var e = arguments;
257
+ return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e);
258
+ });
259
+ }
260
+ return e[Symbol.replace].call(this, t, p);
261
+ }, _wrapRegExp.apply(this, arguments);
262
+ }
198
263
 
199
264
  function getDefaultExportFromCjs (x) {
200
265
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -13847,7 +13912,7 @@ const typeOfTest = type => thing => typeof thing === type;
13847
13912
  * @returns {boolean} True if value is an Array, otherwise false
13848
13913
  */
13849
13914
  const {
13850
- isArray: isArray$7
13915
+ isArray: isArray$8
13851
13916
  } = Array;
13852
13917
 
13853
13918
  /**
@@ -14062,7 +14127,7 @@ function forEach(obj, fn, {
14062
14127
  /*eslint no-param-reassign:0*/
14063
14128
  obj = [obj];
14064
14129
  }
14065
- if (isArray$7(obj)) {
14130
+ if (isArray$8(obj)) {
14066
14131
  // Iterate over array values
14067
14132
  for (i = 0, l = obj.length; i < l; i++) {
14068
14133
  fn.call(null, obj[i], i, obj);
@@ -14128,7 +14193,7 @@ function merge$1(/* obj1, obj2, obj3, ... */
14128
14193
  result[targetKey] = merge$1(result[targetKey], val);
14129
14194
  } else if (isPlainObject$2(val)) {
14130
14195
  result[targetKey] = merge$1({}, val);
14131
- } else if (isArray$7(val)) {
14196
+ } else if (isArray$8(val)) {
14132
14197
  result[targetKey] = val.slice();
14133
14198
  } else {
14134
14199
  result[targetKey] = val;
@@ -14257,7 +14322,7 @@ const endsWith = (str, searchString, position) => {
14257
14322
  */
14258
14323
  const toArray = thing => {
14259
14324
  if (!thing) return null;
14260
- if (isArray$7(thing)) return thing;
14325
+ if (isArray$8(thing)) return thing;
14261
14326
  let i = thing.length;
14262
14327
  if (!isNumber$1(i)) return null;
14263
14328
  const arr = new Array(i);
@@ -14327,7 +14392,7 @@ const toCamelCase = str => {
14327
14392
  };
14328
14393
 
14329
14394
  /* Creating a function that will check if an object has a property. */
14330
- const hasOwnProperty$3 = (({
14395
+ const hasOwnProperty$4 = (({
14331
14396
  hasOwnProperty
14332
14397
  }) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
14333
14398
 
@@ -14383,7 +14448,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
14383
14448
  obj[value] = true;
14384
14449
  });
14385
14450
  };
14386
- isArray$7(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
14451
+ isArray$8(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
14387
14452
  return obj;
14388
14453
  };
14389
14454
  const noop$1 = () => {};
@@ -14427,7 +14492,7 @@ const toJSONObject = obj => {
14427
14492
  }
14428
14493
  if (!('toJSON' in source)) {
14429
14494
  stack[i] = source;
14430
- const target = isArray$7(source) ? [] : {};
14495
+ const target = isArray$8(source) ? [] : {};
14431
14496
  forEach(source, (value, key) => {
14432
14497
  const reducedValue = visit(value, i + 1);
14433
14498
  !isUndefined(reducedValue) && (target[key] = reducedValue);
@@ -14470,7 +14535,7 @@ const asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global
14470
14535
  // *********************
14471
14536
 
14472
14537
  const utils$1$1 = {
14473
- isArray: isArray$7,
14538
+ isArray: isArray$8,
14474
14539
  isArrayBuffer,
14475
14540
  isBuffer: isBuffer$1,
14476
14541
  isFormData,
@@ -14508,8 +14573,8 @@ const utils$1$1 = {
14508
14573
  forEachEntry,
14509
14574
  matchAll,
14510
14575
  isHTMLForm,
14511
- hasOwnProperty: hasOwnProperty$3,
14512
- hasOwnProp: hasOwnProperty$3,
14576
+ hasOwnProperty: hasOwnProperty$4,
14577
+ hasOwnProp: hasOwnProperty$4,
14513
14578
  // an alias to avoid ESLint no-prototype-builtins detection
14514
14579
  reduceDescriptors,
14515
14580
  freezeMethods,
@@ -15005,7 +15070,7 @@ const utils$3 = /*#__PURE__*/Object.freeze({
15005
15070
  navigator: _navigator,
15006
15071
  origin: origin
15007
15072
  });
15008
- const platform = _objectSpread2$1(_objectSpread2$1({}, utils$3), platform$1);
15073
+ const platform = _objectSpread2(_objectSpread2({}, utils$3), platform$1);
15009
15074
  function toURLEncodedForm(data, options) {
15010
15075
  return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
15011
15076
  visitor: function (value, key, path, helpers) {
@@ -16626,7 +16691,7 @@ const cookies = platform.hasStandardBrowserEnv ?
16626
16691
  },
16627
16692
  remove() {}
16628
16693
  };
16629
- const headersToObject = thing => thing instanceof AxiosHeaders$1 ? _objectSpread2$1({}, thing) : thing;
16694
+ const headersToObject = thing => thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing;
16630
16695
 
16631
16696
  /**
16632
16697
  * Config-specific merge-function which creates a new config-object
@@ -17195,7 +17260,7 @@ const fetchAdapter = isFetchSupported && (async config => {
17195
17260
  // Cloudflare Workers throws when credentials are defined
17196
17261
  // see https://github.com/cloudflare/workerd/issues/902
17197
17262
  const isCredentialsSupported = "credentials" in Request.prototype;
17198
- request = new Request(url, _objectSpread2$1(_objectSpread2$1({}, fetchOptions), {}, {
17263
+ request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
17199
17264
  signal: composedSignal,
17200
17265
  method: method.toUpperCase(),
17201
17266
  headers: headers.normalize().toJSON(),
@@ -17898,161 +17963,57 @@ var axios_1 = axios;
17898
17963
  var axios$1 = /*@__PURE__*/getDefaultExportFromCjs(axios_1);
17899
17964
 
17900
17965
  var toStringFunction$1 = Function.prototype.toString;
17901
- var create$2 = Object.create,
17902
- defineProperty$1 = Object.defineProperty,
17903
- getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor,
17904
- getOwnPropertyNames$1 = Object.getOwnPropertyNames,
17905
- getOwnPropertySymbols$1 = Object.getOwnPropertySymbols,
17906
- getPrototypeOf$1$1 = Object.getPrototypeOf;
17907
- var _a$1 = Object.prototype,
17908
- hasOwnProperty$2 = _a$1.hasOwnProperty,
17909
- propertyIsEnumerable$1 = _a$1.propertyIsEnumerable;
17910
- var SYMBOL_PROPERTIES$1 = typeof getOwnPropertySymbols$1 === 'function';
17911
- var WEAK_MAP$1 = typeof WeakMap === 'function';
17966
+ var create$2 = Object.create;
17967
+ var toStringObject = Object.prototype.toString;
17912
17968
  /**
17913
- * @function createCache
17914
- *
17915
- * @description
17916
- * get a new cache object to prevent circular references
17917
- *
17918
- * @returns the new cache object
17969
+ * @classdesc Fallback cache for when WeakMap is not natively supported
17919
17970
  */
17920
- var createCache$1 = function () {
17921
- if (WEAK_MAP$1) {
17922
- return function () {
17923
- return new WeakMap();
17924
- };
17971
+ var LegacyCache = /** @class */function () {
17972
+ function LegacyCache() {
17973
+ this._keys = [];
17974
+ this._values = [];
17925
17975
  }
17926
- var Cache = /** @class */function () {
17927
- function Cache() {
17928
- this._keys = [];
17929
- this._values = [];
17930
- }
17931
- Cache.prototype.has = function (key) {
17932
- return !!~this._keys.indexOf(key);
17933
- };
17934
- Cache.prototype.get = function (key) {
17935
- return this._values[this._keys.indexOf(key)];
17936
- };
17937
- Cache.prototype.set = function (key, value) {
17938
- this._keys.push(key);
17939
- this._values.push(value);
17940
- };
17941
- return Cache;
17942
- }();
17943
- return function () {
17944
- return new Cache();
17976
+ LegacyCache.prototype.has = function (key) {
17977
+ return !!~this._keys.indexOf(key);
17978
+ };
17979
+ LegacyCache.prototype.get = function (key) {
17980
+ return this._values[this._keys.indexOf(key)];
17981
+ };
17982
+ LegacyCache.prototype.set = function (key, value) {
17983
+ this._keys.push(key);
17984
+ this._values.push(value);
17945
17985
  };
17986
+ return LegacyCache;
17946
17987
  }();
17988
+ function createCacheLegacy() {
17989
+ return new LegacyCache();
17990
+ }
17991
+ function createCacheModern() {
17992
+ return new WeakMap();
17993
+ }
17947
17994
  /**
17948
- * @function getCleanClone
17949
- *
17950
- * @description
17951
- * get an empty version of the object with the same prototype it has
17952
- *
17953
- * @param object the object to build a clean clone from
17954
- * @param realm the realm the object resides in
17955
- * @returns the empty cloned object
17995
+ * Get a new cache object to prevent circular references.
17996
+ */
17997
+ var createCache$1 = typeof WeakMap !== 'undefined' ? createCacheModern : createCacheLegacy;
17998
+ /**
17999
+ * Get an empty version of the object with the same prototype it has.
17956
18000
  */
17957
- var getCleanClone$1 = function (object, realm) {
17958
- var prototype = object.__proto__ || getPrototypeOf$1$1(object);
18001
+ function getCleanClone$1(prototype) {
17959
18002
  if (!prototype) {
17960
18003
  return create$2(null);
17961
18004
  }
17962
18005
  var Constructor = prototype.constructor;
17963
- if (Constructor === realm.Object) {
17964
- return prototype === realm.Object.prototype ? {} : create$2(prototype);
18006
+ if (Constructor === Object) {
18007
+ return prototype === Object.prototype ? {} : create$2(prototype);
17965
18008
  }
17966
- if (~toStringFunction$1.call(Constructor).indexOf('[native code]')) {
18009
+ if (Constructor && ~toStringFunction$1.call(Constructor).indexOf('[native code]')) {
17967
18010
  try {
17968
18011
  return new Constructor();
17969
18012
  } catch (_a) {}
17970
18013
  }
17971
18014
  return create$2(prototype);
17972
- };
17973
- /**
17974
- * @function getObjectCloneLoose
17975
- *
17976
- * @description
17977
- * get a copy of the object based on loose rules, meaning all enumerable keys
17978
- * and symbols are copied, but property descriptors are not considered
17979
- *
17980
- * @param object the object to clone
17981
- * @param realm the realm the object resides in
17982
- * @param handleCopy the function that handles copying the object
17983
- * @returns the copied object
17984
- */
17985
- var getObjectCloneLoose$1 = function (object, realm, handleCopy, cache) {
17986
- var clone = getCleanClone$1(object, realm);
17987
- // set in the cache immediately to be able to reuse the object recursively
17988
- cache.set(object, clone);
17989
- for (var key in object) {
17990
- if (hasOwnProperty$2.call(object, key)) {
17991
- clone[key] = handleCopy(object[key], cache);
17992
- }
17993
- }
17994
- if (SYMBOL_PROPERTIES$1) {
17995
- var symbols = getOwnPropertySymbols$1(object);
17996
- for (var index = 0, length_1 = symbols.length, symbol = void 0; index < length_1; ++index) {
17997
- symbol = symbols[index];
17998
- if (propertyIsEnumerable$1.call(object, symbol)) {
17999
- clone[symbol] = handleCopy(object[symbol], cache);
18000
- }
18001
- }
18002
- }
18003
- return clone;
18004
- };
18005
- /**
18006
- * @function getObjectCloneStrict
18007
- *
18008
- * @description
18009
- * get a copy of the object based on strict rules, meaning all keys and symbols
18010
- * are copied based on the original property descriptors
18011
- *
18012
- * @param object the object to clone
18013
- * @param realm the realm the object resides in
18014
- * @param handleCopy the function that handles copying the object
18015
- * @returns the copied object
18016
- */
18017
- var getObjectCloneStrict$1 = function (object, realm, handleCopy, cache) {
18018
- var clone = getCleanClone$1(object, realm);
18019
- // set in the cache immediately to be able to reuse the object recursively
18020
- cache.set(object, clone);
18021
- var properties = SYMBOL_PROPERTIES$1 ? getOwnPropertyNames$1(object).concat(getOwnPropertySymbols$1(object)) : getOwnPropertyNames$1(object);
18022
- for (var index = 0, length_2 = properties.length, property = void 0, descriptor = void 0; index < length_2; ++index) {
18023
- property = properties[index];
18024
- if (property !== 'callee' && property !== 'caller') {
18025
- descriptor = getOwnPropertyDescriptor$1(object, property);
18026
- if (descriptor) {
18027
- // Only clone the value if actually a value, not a getter / setter.
18028
- if (!descriptor.get && !descriptor.set) {
18029
- descriptor.value = handleCopy(object[property], cache);
18030
- }
18031
- try {
18032
- defineProperty$1(clone, property, descriptor);
18033
- } catch (error) {
18034
- // Tee above can fail on node in edge cases, so fall back to the loose assignment.
18035
- clone[property] = descriptor.value;
18036
- }
18037
- } else {
18038
- // In extra edge cases where the property descriptor cannot be retrived, fall back to
18039
- // the loose assignment.
18040
- clone[property] = handleCopy(object[property], cache);
18041
- }
18042
- }
18043
- }
18044
- return clone;
18045
- };
18046
- /**
18047
- * @function getRegExpFlags
18048
- *
18049
- * @description
18050
- * get the flags to apply to the copied regexp
18051
- *
18052
- * @param regExp the regexp to get the flags of
18053
- * @returns the flags for the regexp
18054
- */
18055
- var getRegExpFlags$1 = function (regExp) {
18015
+ }
18016
+ function getRegExpFlagsLegacy(regExp) {
18056
18017
  var flags = '';
18057
18018
  if (regExp.global) {
18058
18019
  flags += 'g';
@@ -18070,181 +18031,332 @@ var getRegExpFlags$1 = function (regExp) {
18070
18031
  flags += 'y';
18071
18032
  }
18072
18033
  return flags;
18073
- };
18074
-
18075
- // utils
18076
- var isArray$6 = Array.isArray;
18077
- var getPrototypeOf$2 = Object.getPrototypeOf;
18078
- var GLOBAL_THIS$1 = function () {
18079
- if (typeof globalThis !== 'undefined') {
18080
- return globalThis;
18081
- }
18082
- if (typeof self !== 'undefined') {
18083
- return self;
18084
- }
18085
- if (typeof window !== 'undefined') {
18086
- return window;
18087
- }
18088
- if (typeof global !== 'undefined') {
18089
- return global;
18034
+ }
18035
+ function getRegExpFlagsModern(regExp) {
18036
+ return regExp.flags;
18037
+ }
18038
+ /**
18039
+ * Get the flags to apply to the copied regexp.
18040
+ */
18041
+ var getRegExpFlags$1 = /test/g.flags === 'g' ? getRegExpFlagsModern : getRegExpFlagsLegacy;
18042
+ function getTagLegacy(value) {
18043
+ var type = toStringObject.call(value);
18044
+ return type.substring(8, type.length - 1);
18045
+ }
18046
+ function getTagModern(value) {
18047
+ return value[Symbol.toStringTag] || getTagLegacy(value);
18048
+ }
18049
+ /**
18050
+ * Get the tag of the value passed, so that the correct copier can be used.
18051
+ */
18052
+ var getTag = typeof Symbol !== 'undefined' ? getTagModern : getTagLegacy;
18053
+ var defineProperty$1 = Object.defineProperty,
18054
+ getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor,
18055
+ getOwnPropertyNames$1 = Object.getOwnPropertyNames,
18056
+ getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
18057
+ var _a$1 = Object.prototype,
18058
+ hasOwnProperty$3 = _a$1.hasOwnProperty,
18059
+ propertyIsEnumerable$1 = _a$1.propertyIsEnumerable;
18060
+ var SUPPORTS_SYMBOL = typeof getOwnPropertySymbols$1 === 'function';
18061
+ function getStrictPropertiesModern(object) {
18062
+ return getOwnPropertyNames$1(object).concat(getOwnPropertySymbols$1(object));
18063
+ }
18064
+ /**
18065
+ * Get the properites used when copying objects strictly. This includes both keys and symbols.
18066
+ */
18067
+ var getStrictProperties = SUPPORTS_SYMBOL ? getStrictPropertiesModern : getOwnPropertyNames$1;
18068
+ /**
18069
+ * Striclty copy all properties contained on the object.
18070
+ */
18071
+ function copyOwnPropertiesStrict(value, clone, state) {
18072
+ var properties = getStrictProperties(value);
18073
+ for (var index = 0, length_1 = properties.length, property = void 0, descriptor = void 0; index < length_1; ++index) {
18074
+ property = properties[index];
18075
+ if (property === 'callee' || property === 'caller') {
18076
+ continue;
18077
+ }
18078
+ descriptor = getOwnPropertyDescriptor$1(value, property);
18079
+ if (!descriptor) {
18080
+ // In extra edge cases where the property descriptor cannot be retrived, fall back to
18081
+ // the loose assignment.
18082
+ clone[property] = state.copier(value[property], state);
18083
+ continue;
18084
+ }
18085
+ // Only clone the value if actually a value, not a getter / setter.
18086
+ if (!descriptor.get && !descriptor.set) {
18087
+ descriptor.value = state.copier(descriptor.value, state);
18088
+ }
18089
+ try {
18090
+ defineProperty$1(clone, property, descriptor);
18091
+ } catch (error) {
18092
+ // Tee above can fail on node in edge cases, so fall back to the loose assignment.
18093
+ clone[property] = descriptor.value;
18094
+ }
18090
18095
  }
18091
- if (console && console.error) {
18092
- console.error('Unable to locate global object, returning "this".');
18096
+ return clone;
18097
+ }
18098
+ /**
18099
+ * Deeply copy the indexed values in the array.
18100
+ */
18101
+ function copyArrayLoose(array, state) {
18102
+ var clone = new state.Constructor();
18103
+ // set in the cache immediately to be able to reuse the object recursively
18104
+ state.cache.set(array, clone);
18105
+ for (var index = 0, length_2 = array.length; index < length_2; ++index) {
18106
+ clone[index] = state.copier(array[index], state);
18093
18107
  }
18094
- return this;
18095
- }();
18108
+ return clone;
18109
+ }
18096
18110
  /**
18097
- * @function copy
18098
- *
18099
- * @description
18100
- * copy an value deeply as much as possible
18101
- *
18102
- * If `strict` is applied, then all properties (including non-enumerable ones)
18103
- * are copied with their original property descriptors on both objects and arrays.
18104
- *
18105
- * The value is compared to the global constructors in the `realm` provided,
18106
- * and the native constructor is always used to ensure that extensions of native
18107
- * objects (allows in ES2015+) are maintained.
18111
+ * Deeply copy the indexed values in the array, as well as any custom properties.
18112
+ */
18113
+ function copyArrayStrict(array, state) {
18114
+ var clone = new state.Constructor();
18115
+ // set in the cache immediately to be able to reuse the object recursively
18116
+ state.cache.set(array, clone);
18117
+ return copyOwnPropertiesStrict(array, clone, state);
18118
+ }
18119
+ /**
18120
+ * Copy the contents of the ArrayBuffer.
18121
+ */
18122
+ function copyArrayBuffer(arrayBuffer, _state) {
18123
+ return arrayBuffer.slice(0);
18124
+ }
18125
+ /**
18126
+ * Create a new Blob with the contents of the original.
18127
+ */
18128
+ function copyBlob(blob, _state) {
18129
+ return blob.slice(0, blob.size, blob.type);
18130
+ }
18131
+ /**
18132
+ * Create a new DataView with the contents of the original.
18133
+ */
18134
+ function copyDataView(dataView, state) {
18135
+ return new state.Constructor(copyArrayBuffer(dataView.buffer));
18136
+ }
18137
+ /**
18138
+ * Create a new Date based on the time of the original.
18139
+ */
18140
+ function copyDate(date, state) {
18141
+ return new state.Constructor(date.getTime());
18142
+ }
18143
+ /**
18144
+ * Deeply copy the keys and values of the original.
18145
+ */
18146
+ function copyMapLoose(map, state) {
18147
+ var clone = new state.Constructor();
18148
+ // set in the cache immediately to be able to reuse the object recursively
18149
+ state.cache.set(map, clone);
18150
+ map.forEach(function (value, key) {
18151
+ clone.set(key, state.copier(value, state));
18152
+ });
18153
+ return clone;
18154
+ }
18155
+ /**
18156
+ * Deeply copy the keys and values of the original, as well as any custom properties.
18157
+ */
18158
+ function copyMapStrict(map, state) {
18159
+ return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
18160
+ }
18161
+ function copyObjectLooseLegacy(object, state) {
18162
+ var clone = getCleanClone$1(state.prototype);
18163
+ // set in the cache immediately to be able to reuse the object recursively
18164
+ state.cache.set(object, clone);
18165
+ for (var key in object) {
18166
+ if (hasOwnProperty$3.call(object, key)) {
18167
+ clone[key] = state.copier(object[key], state);
18168
+ }
18169
+ }
18170
+ return clone;
18171
+ }
18172
+ function copyObjectLooseModern(object, state) {
18173
+ var clone = getCleanClone$1(state.prototype);
18174
+ // set in the cache immediately to be able to reuse the object recursively
18175
+ state.cache.set(object, clone);
18176
+ for (var key in object) {
18177
+ if (hasOwnProperty$3.call(object, key)) {
18178
+ clone[key] = state.copier(object[key], state);
18179
+ }
18180
+ }
18181
+ var symbols = getOwnPropertySymbols$1(object);
18182
+ for (var index = 0, length_3 = symbols.length, symbol = void 0; index < length_3; ++index) {
18183
+ symbol = symbols[index];
18184
+ if (propertyIsEnumerable$1.call(object, symbol)) {
18185
+ clone[symbol] = state.copier(object[symbol], state);
18186
+ }
18187
+ }
18188
+ return clone;
18189
+ }
18190
+ /**
18191
+ * Deeply copy the properties (keys and symbols) and values of the original.
18192
+ */
18193
+ var copyObjectLoose = SUPPORTS_SYMBOL ? copyObjectLooseModern : copyObjectLooseLegacy;
18194
+ /**
18195
+ * Deeply copy the properties (keys and symbols) and values of the original, as well
18196
+ * as any hidden or non-enumerable properties.
18197
+ */
18198
+ function copyObjectStrict(object, state) {
18199
+ var clone = getCleanClone$1(state.prototype);
18200
+ // set in the cache immediately to be able to reuse the object recursively
18201
+ state.cache.set(object, clone);
18202
+ return copyOwnPropertiesStrict(object, clone, state);
18203
+ }
18204
+ /**
18205
+ * Create a new primitive wrapper from the value of the original.
18206
+ */
18207
+ function copyPrimitiveWrapper(primitiveObject, state) {
18208
+ return new state.Constructor(primitiveObject.valueOf());
18209
+ }
18210
+ /**
18211
+ * Create a new RegExp based on the value and flags of the original.
18212
+ */
18213
+ function copyRegExp(regExp, state) {
18214
+ var clone = new state.Constructor(regExp.source, getRegExpFlags$1(regExp));
18215
+ clone.lastIndex = regExp.lastIndex;
18216
+ return clone;
18217
+ }
18218
+ /**
18219
+ * Return the original value (an identity function).
18108
18220
  *
18109
- * @param value the value to copy
18110
- * @param [options] the options for copying with
18111
- * @param [options.isStrict] should the copy be strict
18112
- * @param [options.realm] the realm (this) value the value is copied from
18113
- * @returns the copied value
18221
+ * @note
18222
+ * THis is used for objects that cannot be copied, such as WeakMap.
18114
18223
  */
18115
- function copy$1(value, options) {
18116
- // manually coalesced instead of default parameters for performance
18117
- var isStrict = !!(options && options.isStrict);
18118
- var realm = options && options.realm || GLOBAL_THIS$1;
18119
- var getObjectClone = isStrict ? getObjectCloneStrict$1 : getObjectCloneLoose$1;
18120
- /**
18121
- * @function handleCopy
18122
- *
18123
- * @description
18124
- * copy the value recursively based on its type
18125
- *
18126
- * @param value the value to copy
18127
- * @returns the copied value
18128
- */
18129
- var handleCopy = function (value, cache) {
18224
+ function copySelf(value, _state) {
18225
+ return value;
18226
+ }
18227
+ /**
18228
+ * Deeply copy the values of the original.
18229
+ */
18230
+ function copySetLoose(set, state) {
18231
+ var clone = new state.Constructor();
18232
+ // set in the cache immediately to be able to reuse the object recursively
18233
+ state.cache.set(set, clone);
18234
+ set.forEach(function (value) {
18235
+ clone.add(state.copier(value, state));
18236
+ });
18237
+ return clone;
18238
+ }
18239
+ /**
18240
+ * Deeply copy the values of the original, as well as any custom properties.
18241
+ */
18242
+ function copySetStrict(set, state) {
18243
+ return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
18244
+ }
18245
+ var isArray$7 = Array.isArray;
18246
+ var assign$1 = Object.assign;
18247
+ var getPrototypeOf$2 = Object.getPrototypeOf || function (obj) {
18248
+ return obj.__proto__;
18249
+ };
18250
+ var DEFAULT_LOOSE_OPTIONS = {
18251
+ array: copyArrayLoose,
18252
+ arrayBuffer: copyArrayBuffer,
18253
+ blob: copyBlob,
18254
+ dataView: copyDataView,
18255
+ date: copyDate,
18256
+ error: copySelf,
18257
+ map: copyMapLoose,
18258
+ object: copyObjectLoose,
18259
+ regExp: copyRegExp,
18260
+ set: copySetLoose
18261
+ };
18262
+ var DEFAULT_STRICT_OPTIONS = assign$1({}, DEFAULT_LOOSE_OPTIONS, {
18263
+ array: copyArrayStrict,
18264
+ map: copyMapStrict,
18265
+ object: copyObjectStrict,
18266
+ set: copySetStrict
18267
+ });
18268
+ /**
18269
+ * Get the copiers used for each specific object tag.
18270
+ */
18271
+ function getTagSpecificCopiers(options) {
18272
+ return {
18273
+ Arguments: options.object,
18274
+ Array: options.array,
18275
+ ArrayBuffer: options.arrayBuffer,
18276
+ Blob: options.blob,
18277
+ Boolean: copyPrimitiveWrapper,
18278
+ DataView: options.dataView,
18279
+ Date: options.date,
18280
+ Error: options.error,
18281
+ Float32Array: options.arrayBuffer,
18282
+ Float64Array: options.arrayBuffer,
18283
+ Int8Array: options.arrayBuffer,
18284
+ Int16Array: options.arrayBuffer,
18285
+ Int32Array: options.arrayBuffer,
18286
+ Map: options.map,
18287
+ Number: copyPrimitiveWrapper,
18288
+ Object: options.object,
18289
+ Promise: copySelf,
18290
+ RegExp: options.regExp,
18291
+ Set: options.set,
18292
+ String: copyPrimitiveWrapper,
18293
+ WeakMap: copySelf,
18294
+ WeakSet: copySelf,
18295
+ Uint8Array: options.arrayBuffer,
18296
+ Uint8ClampedArray: options.arrayBuffer,
18297
+ Uint16Array: options.arrayBuffer,
18298
+ Uint32Array: options.arrayBuffer,
18299
+ Uint64Array: options.arrayBuffer
18300
+ };
18301
+ }
18302
+ /**
18303
+ * Create a custom copier based on the object-specific copy methods passed.
18304
+ */
18305
+ function createCopier(options) {
18306
+ var normalizedOptions = assign$1({}, DEFAULT_LOOSE_OPTIONS, options);
18307
+ var tagSpecificCopiers = getTagSpecificCopiers(normalizedOptions);
18308
+ var array = tagSpecificCopiers.Array,
18309
+ object = tagSpecificCopiers.Object;
18310
+ function copier(value, state) {
18311
+ state.prototype = state.Constructor = undefined;
18130
18312
  if (!value || typeof value !== 'object') {
18131
18313
  return value;
18132
18314
  }
18133
- if (cache.has(value)) {
18134
- return cache.get(value);
18315
+ if (state.cache.has(value)) {
18316
+ return state.cache.get(value);
18135
18317
  }
18136
- var prototype = value.__proto__ || getPrototypeOf$2(value);
18137
- var Constructor = prototype && prototype.constructor;
18318
+ state.prototype = getPrototypeOf$2(value);
18319
+ state.Constructor = state.prototype && state.prototype.constructor;
18138
18320
  // plain objects
18139
- if (!Constructor || Constructor === realm.Object) {
18140
- return getObjectClone(value, realm, handleCopy, cache);
18321
+ if (!state.Constructor || state.Constructor === Object) {
18322
+ return object(value, state);
18141
18323
  }
18142
- var clone;
18143
18324
  // arrays
18144
- if (isArray$6(value)) {
18145
- // if strict, include non-standard properties
18146
- if (isStrict) {
18147
- return getObjectCloneStrict$1(value, realm, handleCopy, cache);
18148
- }
18149
- clone = new Constructor();
18150
- cache.set(value, clone);
18151
- for (var index = 0, length_1 = value.length; index < length_1; ++index) {
18152
- clone[index] = handleCopy(value[index], cache);
18153
- }
18154
- return clone;
18155
- }
18156
- // dates
18157
- if (value instanceof realm.Date) {
18158
- return new Constructor(value.getTime());
18159
- }
18160
- // regexps
18161
- if (value instanceof realm.RegExp) {
18162
- clone = new Constructor(value.source, value.flags || getRegExpFlags$1(value));
18163
- clone.lastIndex = value.lastIndex;
18164
- return clone;
18165
- }
18166
- // maps
18167
- if (realm.Map && value instanceof realm.Map) {
18168
- clone = new Constructor();
18169
- cache.set(value, clone);
18170
- value.forEach(function (value, key) {
18171
- clone.set(key, handleCopy(value, cache));
18172
- });
18173
- return clone;
18174
- }
18175
- // sets
18176
- if (realm.Set && value instanceof realm.Set) {
18177
- clone = new Constructor();
18178
- cache.set(value, clone);
18179
- value.forEach(function (value) {
18180
- clone.add(handleCopy(value, cache));
18181
- });
18182
- return clone;
18183
- }
18184
- // blobs
18185
- if (realm.Blob && value instanceof realm.Blob) {
18186
- return value.slice(0, value.size, value.type);
18187
- }
18188
- // buffers (node-only)
18189
- if (realm.Buffer && realm.Buffer.isBuffer(value)) {
18190
- clone = realm.Buffer.allocUnsafe ? realm.Buffer.allocUnsafe(value.length) : new Constructor(value.length);
18191
- cache.set(value, clone);
18192
- value.copy(clone);
18193
- return clone;
18194
- }
18195
- // arraybuffers / dataviews
18196
- if (realm.ArrayBuffer) {
18197
- // dataviews
18198
- if (realm.ArrayBuffer.isView(value)) {
18199
- clone = new Constructor(value.buffer.slice(0));
18200
- cache.set(value, clone);
18201
- return clone;
18202
- }
18203
- // arraybuffers
18204
- if (value instanceof realm.ArrayBuffer) {
18205
- clone = value.slice(0);
18206
- cache.set(value, clone);
18207
- return clone;
18208
- }
18325
+ if (isArray$7(value)) {
18326
+ return array(value, state);
18209
18327
  }
18210
- // if the value cannot / should not be cloned, don't
18211
- if (
18212
- // promise-like
18213
- typeof value.then === 'function' ||
18214
- // errors
18215
- value instanceof Error ||
18216
- // weakmaps
18217
- realm.WeakMap && value instanceof realm.WeakMap ||
18218
- // weaksets
18219
- realm.WeakSet && value instanceof realm.WeakSet) {
18220
- return value;
18328
+ var tagSpecificCopier = tagSpecificCopiers[getTag(value)];
18329
+ if (tagSpecificCopier) {
18330
+ return tagSpecificCopier(value, state);
18221
18331
  }
18222
- // assume anything left is a custom constructor
18223
- return getObjectClone(value, realm, handleCopy, cache);
18332
+ return typeof value.then === 'function' ? value : object(value, state);
18333
+ }
18334
+ return function copy(value) {
18335
+ return copier(value, {
18336
+ Constructor: undefined,
18337
+ cache: createCache$1(),
18338
+ copier: copier,
18339
+ prototype: undefined
18340
+ });
18224
18341
  };
18225
- return handleCopy(value, createCache$1());
18226
18342
  }
18227
- // Adding reference to allow usage in CommonJS libraries compiled using TSC, which
18228
- // expects there to be a default property on the exported value. See
18229
- // [#37](https://github.com/planttheidea/fast-copy/issues/37) for details.
18230
- copy$1.default = copy$1;
18231
18343
  /**
18232
- * @function strictCopy
18233
- *
18234
- * @description
18235
- * copy the value with `strict` option pre-applied
18236
- *
18237
- * @param value the value to copy
18238
- * @param [options] the options for copying with
18239
- * @param [options.realm] the realm (this) value the value is copied from
18240
- * @returns the copied value
18344
+ * Create a custom copier based on the object-specific copy methods passed, defaulting to the
18345
+ * same internals as `copyStrict`.
18241
18346
  */
18242
- copy$1.strict = function strictCopy(value, options) {
18243
- return copy$1(value, {
18244
- isStrict: true,
18245
- realm: options ? options.realm : void 0
18246
- });
18247
- };
18347
+ function createStrictCopier(options) {
18348
+ return createCopier(assign$1({}, DEFAULT_STRICT_OPTIONS, options));
18349
+ }
18350
+ /**
18351
+ * Copy an value deeply as much as possible, where strict recreation of object properties
18352
+ * are maintained. All properties (including non-enumerable ones) are copied with their
18353
+ * original property descriptors on both objects and arrays.
18354
+ */
18355
+ createStrictCopier({});
18356
+ /**
18357
+ * Copy an value deeply as much as possible.
18358
+ */
18359
+ var index = createCopier({});
18248
18360
 
18249
18361
  /** @type {import('.')} */
18250
18362
  var esErrors = Error;
@@ -19042,7 +19154,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
19042
19154
  depth = 0;
19043
19155
  }
19044
19156
  if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
19045
- return isArray$5(obj) ? '[Array]' : '[Object]';
19157
+ return isArray$6(obj) ? '[Array]' : '[Object]';
19046
19158
  }
19047
19159
  var indent = getIndent(opts, depth);
19048
19160
  if (typeof seen === 'undefined') {
@@ -19089,7 +19201,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
19089
19201
  s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
19090
19202
  return s;
19091
19203
  }
19092
- if (isArray$5(obj)) {
19204
+ if (isArray$6(obj)) {
19093
19205
  if (obj.length === 0) {
19094
19206
  return '[]';
19095
19207
  }
@@ -19189,7 +19301,7 @@ function wrapQuotes(s, defaultStyle, opts) {
19189
19301
  function quote(s) {
19190
19302
  return $replace.call(String(s), /"/g, '&quot;');
19191
19303
  }
19192
- function isArray$5(obj) {
19304
+ function isArray$6(obj) {
19193
19305
  return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
19194
19306
  }
19195
19307
  function isDate(obj) {
@@ -19411,7 +19523,7 @@ function indentedJoin(xs, indent) {
19411
19523
  return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
19412
19524
  }
19413
19525
  function arrObjKeys(obj, inspect) {
19414
- var isArr = isArray$5(obj);
19526
+ var isArr = isArray$6(obj);
19415
19527
  var xs = [];
19416
19528
  if (isArr) {
19417
19529
  xs.length = obj.length;
@@ -19612,7 +19724,7 @@ var formats$3 = {
19612
19724
 
19613
19725
  var formats$2 = formats$3;
19614
19726
  var has$2 = Object.prototype.hasOwnProperty;
19615
- var isArray$4 = Array.isArray;
19727
+ var isArray$5 = Array.isArray;
19616
19728
  var hexTable = function () {
19617
19729
  var array = [];
19618
19730
  for (var i = 0; i < 256; ++i) {
@@ -19624,7 +19736,7 @@ var compactQueue = function compactQueue(queue) {
19624
19736
  while (queue.length > 1) {
19625
19737
  var item = queue.pop();
19626
19738
  var obj = item.obj[item.prop];
19627
- if (isArray$4(obj)) {
19739
+ if (isArray$5(obj)) {
19628
19740
  var compacted = [];
19629
19741
  for (var j = 0; j < obj.length; ++j) {
19630
19742
  if (typeof obj[j] !== 'undefined') {
@@ -19650,7 +19762,7 @@ var merge = function merge(target, source, options) {
19650
19762
  return target;
19651
19763
  }
19652
19764
  if (typeof source !== 'object') {
19653
- if (isArray$4(target)) {
19765
+ if (isArray$5(target)) {
19654
19766
  target.push(source);
19655
19767
  } else if (target && typeof target === 'object') {
19656
19768
  if (options && (options.plainObjects || options.allowPrototypes) || !has$2.call(Object.prototype, source)) {
@@ -19665,10 +19777,10 @@ var merge = function merge(target, source, options) {
19665
19777
  return [target].concat(source);
19666
19778
  }
19667
19779
  var mergeTarget = target;
19668
- if (isArray$4(target) && !isArray$4(source)) {
19780
+ if (isArray$5(target) && !isArray$5(source)) {
19669
19781
  mergeTarget = arrayToObject(target, options);
19670
19782
  }
19671
- if (isArray$4(target) && isArray$4(source)) {
19783
+ if (isArray$5(target) && isArray$5(source)) {
19672
19784
  source.forEach(function (item, i) {
19673
19785
  if (has$2.call(target, i)) {
19674
19786
  var targetItem = target[i];
@@ -19811,7 +19923,7 @@ var combine = function combine(a, b) {
19811
19923
  return [].concat(a, b);
19812
19924
  };
19813
19925
  var maybeMap = function maybeMap(val, fn) {
19814
- if (isArray$4(val)) {
19926
+ if (isArray$5(val)) {
19815
19927
  var mapped = [];
19816
19928
  for (var i = 0; i < val.length; i += 1) {
19817
19929
  mapped.push(fn(val[i]));
@@ -19849,10 +19961,10 @@ var arrayPrefixGenerators = {
19849
19961
  return prefix;
19850
19962
  }
19851
19963
  };
19852
- var isArray$3 = Array.isArray;
19964
+ var isArray$4 = Array.isArray;
19853
19965
  var push = Array.prototype.push;
19854
19966
  var pushToArray = function (arr, valueOrArray) {
19855
- push.apply(arr, isArray$3(valueOrArray) ? valueOrArray : [valueOrArray]);
19967
+ push.apply(arr, isArray$4(valueOrArray) ? valueOrArray : [valueOrArray]);
19856
19968
  };
19857
19969
  var toISO = Date.prototype.toISOString;
19858
19970
  var defaultFormat = formats$1['default'];
@@ -19906,7 +20018,7 @@ var stringify$2 = function stringify(object, prefix, generateArrayPrefix, commaR
19906
20018
  obj = filter(prefix, obj);
19907
20019
  } else if (obj instanceof Date) {
19908
20020
  obj = serializeDate(obj);
19909
- } else if (generateArrayPrefix === 'comma' && isArray$3(obj)) {
20021
+ } else if (generateArrayPrefix === 'comma' && isArray$4(obj)) {
19910
20022
  obj = utils$1.maybeMap(obj, function (value) {
19911
20023
  if (value instanceof Date) {
19912
20024
  return serializeDate(value);
@@ -19932,7 +20044,7 @@ var stringify$2 = function stringify(object, prefix, generateArrayPrefix, commaR
19932
20044
  return values;
19933
20045
  }
19934
20046
  var objKeys;
19935
- if (generateArrayPrefix === 'comma' && isArray$3(obj)) {
20047
+ if (generateArrayPrefix === 'comma' && isArray$4(obj)) {
19936
20048
  // we need to join elements in
19937
20049
  if (encodeValuesOnly && encoder) {
19938
20050
  obj = utils$1.maybeMap(obj, encoder);
@@ -19940,15 +20052,15 @@ var stringify$2 = function stringify(object, prefix, generateArrayPrefix, commaR
19940
20052
  objKeys = [{
19941
20053
  value: obj.length > 0 ? obj.join(',') || null : void undefined
19942
20054
  }];
19943
- } else if (isArray$3(filter)) {
20055
+ } else if (isArray$4(filter)) {
19944
20056
  objKeys = filter;
19945
20057
  } else {
19946
20058
  var keys = Object.keys(obj);
19947
20059
  objKeys = sort ? keys.sort(sort) : keys;
19948
20060
  }
19949
20061
  var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, '%2E') : prefix;
19950
- var adjustedPrefix = commaRoundTrip && isArray$3(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix;
19951
- if (allowEmptyArrays && isArray$3(obj) && obj.length === 0) {
20062
+ var adjustedPrefix = commaRoundTrip && isArray$4(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix;
20063
+ if (allowEmptyArrays && isArray$4(obj) && obj.length === 0) {
19952
20064
  return adjustedPrefix + '[]';
19953
20065
  }
19954
20066
  for (var j = 0; j < objKeys.length; ++j) {
@@ -19958,11 +20070,11 @@ var stringify$2 = function stringify(object, prefix, generateArrayPrefix, commaR
19958
20070
  continue;
19959
20071
  }
19960
20072
  var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, '%2E') : key;
19961
- var keyPrefix = isArray$3(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']');
20073
+ var keyPrefix = isArray$4(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']');
19962
20074
  sideChannel.set(object, step);
19963
20075
  var valueSideChannel = getSideChannel();
19964
20076
  valueSideChannel.set(sentinel, sideChannel);
19965
- pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === 'comma' && encodeValuesOnly && isArray$3(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
20077
+ pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === 'comma' && encodeValuesOnly && isArray$4(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
19966
20078
  }
19967
20079
  return values;
19968
20080
  };
@@ -19992,7 +20104,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
19992
20104
  }
19993
20105
  var formatter = formats$1.formatters[format];
19994
20106
  var filter = defaults$1.filter;
19995
- if (typeof opts.filter === 'function' || isArray$3(opts.filter)) {
20107
+ if (typeof opts.filter === 'function' || isArray$4(opts.filter)) {
19996
20108
  filter = opts.filter;
19997
20109
  }
19998
20110
  var arrayFormat;
@@ -20037,7 +20149,7 @@ var stringify_1 = function (object, opts) {
20037
20149
  if (typeof options.filter === 'function') {
20038
20150
  filter = options.filter;
20039
20151
  obj = filter('', obj);
20040
- } else if (isArray$3(options.filter)) {
20152
+ } else if (isArray$4(options.filter)) {
20041
20153
  filter = options.filter;
20042
20154
  objKeys = filter;
20043
20155
  }
@@ -20077,7 +20189,7 @@ var stringify_1 = function (object, opts) {
20077
20189
 
20078
20190
  var utils = utils$2;
20079
20191
  var has = Object.prototype.hasOwnProperty;
20080
- var isArray$2 = Array.isArray;
20192
+ var isArray$3 = Array.isArray;
20081
20193
  var defaults = {
20082
20194
  allowDots: false,
20083
20195
  allowEmptyArrays: false,
@@ -20167,7 +20279,7 @@ var parseValues = function parseQueryStringValues(str, options) {
20167
20279
  val = interpretNumericEntities(val);
20168
20280
  }
20169
20281
  if (part.indexOf('[]=') > -1) {
20170
- val = isArray$2(val) ? [val] : val;
20282
+ val = isArray$3(val) ? [val] : val;
20171
20283
  }
20172
20284
  var existing = has.call(obj, key);
20173
20285
  if (existing && options.duplicates === 'combine') {
@@ -20337,253 +20449,247 @@ var lib = {
20337
20449
  };
20338
20450
  var qs = /*@__PURE__*/getDefaultExportFromCjs(lib);
20339
20451
 
20340
- /**
20341
- * lodash 4.0.1 (Custom Build) <https://lodash.com/>
20342
- * Build: `lodash modularize exports="npm" -o ./`
20343
- * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
20344
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
20345
- * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
20346
- * Available under MIT license <https://lodash.com/license>
20347
- */
20348
-
20349
- /** `Object#toString` result references. */
20350
- var stringTag = '[object String]';
20351
-
20352
- /** Used for built-in method references. */
20353
- var objectProto$1 = Object.prototype;
20452
+ function asyncToken(instance, getToken) {
20453
+ instance.interceptors.request.use(function (config) {
20454
+ return getToken().then(accessToken => {
20455
+ config.headers.set('Authorization', `Bearer ${accessToken}`);
20456
+ return config;
20457
+ });
20458
+ });
20459
+ }
20354
20460
 
20355
- /**
20356
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
20357
- * of values.
20358
- */
20359
- var objectToString$1 = objectProto$1.toString;
20461
+ function isNode() {
20462
+ /**
20463
+ * Polyfills of 'process' might set process.browser === true
20464
+ *
20465
+ * See:
20466
+ * https://github.com/webpack/node-libs-browser/blob/master/mock/process.js#L8
20467
+ * https://github.com/defunctzombie/node-process/blob/master/browser.js#L156
20468
+ **/
20469
+ return typeof process$1 !== 'undefined' && !process$1.browser;
20470
+ }
20471
+ function isReactNative() {
20472
+ return typeof window !== 'undefined' && 'navigator' in window && 'product' in window.navigator && window.navigator.product === 'ReactNative';
20473
+ }
20474
+ function getNodeVersion() {
20475
+ return process$1.versions && process$1.versions.node ? `v${process$1.versions.node}` : process$1.version;
20476
+ }
20477
+ function getWindow() {
20478
+ return window;
20479
+ }
20480
+ function noop() {
20481
+ return undefined;
20482
+ }
20360
20483
 
20361
- /**
20362
- * Checks if `value` is classified as an `Array` object.
20363
- *
20364
- * @static
20365
- * @memberOf _
20366
- * @type Function
20367
- * @category Lang
20368
- * @param {*} value The value to check.
20369
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
20370
- * @example
20371
- *
20372
- * _.isArray([1, 2, 3]);
20373
- * // => true
20374
- *
20375
- * _.isArray(document.body.children);
20376
- * // => false
20377
- *
20378
- * _.isArray('abc');
20379
- * // => false
20380
- *
20381
- * _.isArray(_.noop);
20382
- * // => false
20383
- */
20384
- var isArray$1 = Array.isArray;
20385
-
20386
- /**
20387
- * Checks if `value` is object-like. A value is object-like if it's not `null`
20388
- * and has a `typeof` result of "object".
20389
- *
20390
- * @static
20391
- * @memberOf _
20392
- * @category Lang
20393
- * @param {*} value The value to check.
20394
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
20395
- * @example
20396
- *
20397
- * _.isObjectLike({});
20398
- * // => true
20399
- *
20400
- * _.isObjectLike([1, 2, 3]);
20401
- * // => true
20402
- *
20403
- * _.isObjectLike(_.noop);
20404
- * // => false
20405
- *
20406
- * _.isObjectLike(null);
20407
- * // => false
20408
- */
20409
- function isObjectLike$1(value) {
20410
- return !!value && typeof value == 'object';
20411
- }
20412
-
20413
- /**
20414
- * Checks if `value` is classified as a `String` primitive or object.
20415
- *
20416
- * @static
20417
- * @memberOf _
20418
- * @category Lang
20419
- * @param {*} value The value to check.
20420
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
20421
- * @example
20422
- *
20423
- * _.isString('abc');
20424
- * // => true
20425
- *
20426
- * _.isString(1);
20427
- * // => false
20428
- */
20429
- function isString(value) {
20430
- return typeof value == 'string' || !isArray$1(value) && isObjectLike$1(value) && objectToString$1.call(value) == stringTag;
20431
- }
20432
- var lodash_isstring = isString;
20433
- var isString$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_isstring);
20434
-
20435
- var pThrottle$2 = {exports: {}};
20436
-
20437
- class AbortError extends Error {
20438
- constructor() {
20439
- super('Throttled function aborted');
20440
- this.name = 'AbortError';
20441
- }
20442
- }
20443
- const pThrottle = ({
20444
- limit,
20445
- interval,
20446
- strict
20447
- }) => {
20448
- if (!Number.isFinite(limit)) {
20449
- throw new TypeError('Expected `limit` to be a finite number');
20450
- }
20451
- if (!Number.isFinite(interval)) {
20452
- throw new TypeError('Expected `interval` to be a finite number');
20453
- }
20454
- const queue = new Map();
20455
- let currentTick = 0;
20456
- let activeCount = 0;
20457
- function windowedDelay() {
20458
- const now = Date.now();
20459
- if (now - currentTick > interval) {
20460
- activeCount = 1;
20461
- currentTick = now;
20462
- return 0;
20484
+ const delay = ms => new Promise(resolve => {
20485
+ setTimeout(resolve, ms);
20486
+ });
20487
+ const defaultWait = attempts => {
20488
+ return Math.pow(Math.SQRT2, attempts);
20489
+ };
20490
+ function rateLimit(instance, maxRetry = 5) {
20491
+ const {
20492
+ responseLogger = noop,
20493
+ requestLogger = noop
20494
+ } = instance.defaults;
20495
+ instance.interceptors.request.use(function (config) {
20496
+ requestLogger(config);
20497
+ return config;
20498
+ }, function (error) {
20499
+ requestLogger(error);
20500
+ return Promise.reject(error);
20501
+ });
20502
+ instance.interceptors.response.use(function (response) {
20503
+ // we don't need to do anything here
20504
+ responseLogger(response);
20505
+ return response;
20506
+ }, async function (error) {
20507
+ const {
20508
+ response
20509
+ } = error;
20510
+ const {
20511
+ config
20512
+ } = error;
20513
+ responseLogger(error);
20514
+ // Do not retry if it is disabled or no request config exists (not an axios error)
20515
+ if (!config || !instance.defaults.retryOnError) {
20516
+ return Promise.reject(error);
20463
20517
  }
20464
- if (activeCount < limit) {
20465
- activeCount++;
20466
- } else {
20467
- currentTick += interval;
20468
- activeCount = 1;
20518
+ // Retried already for max attempts
20519
+ const doneAttempts = config.attempts || 1;
20520
+ if (doneAttempts > maxRetry) {
20521
+ error.attempts = config.attempts;
20522
+ return Promise.reject(error);
20469
20523
  }
20470
- return currentTick - now;
20471
- }
20472
- const strictTicks = [];
20473
- function strictDelay() {
20474
- const now = Date.now();
20475
- if (strictTicks.length < limit) {
20476
- strictTicks.push(now);
20477
- return 0;
20524
+ let retryErrorType = null;
20525
+ let wait = defaultWait(doneAttempts);
20526
+ // Errors without response did not receive anything from the server
20527
+ if (!response) {
20528
+ retryErrorType = 'Connection';
20529
+ } else if (response.status >= 500 && response.status < 600) {
20530
+ // 5** errors are server related
20531
+ retryErrorType = `Server ${response.status}`;
20532
+ } else if (response.status === 429) {
20533
+ // 429 errors are exceeded rate limit exceptions
20534
+ retryErrorType = 'Rate limit';
20535
+ // all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
20536
+ if (response.headers && error.response.headers['x-contentful-ratelimit-reset']) {
20537
+ wait = response.headers['x-contentful-ratelimit-reset'];
20538
+ }
20478
20539
  }
20479
- const earliestTime = strictTicks.shift() + interval;
20480
- if (now >= earliestTime) {
20481
- strictTicks.push(now);
20482
- return 0;
20540
+ if (retryErrorType) {
20541
+ // convert to ms and add jitter
20542
+ wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
20543
+ instance.defaults.logHandler('warning', `${retryErrorType} error occurred. Waiting for ${wait} ms before retrying...`);
20544
+ // increase attempts counter
20545
+ config.attempts = doneAttempts + 1;
20546
+ /* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
20547
+ to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
20548
+ requests still use the original http/httpsAgent property */
20549
+ delete config.httpAgent;
20550
+ delete config.httpsAgent;
20551
+ return delay(wait).then(() => instance(config));
20483
20552
  }
20484
- strictTicks.push(earliestTime);
20485
- return earliestTime - now;
20486
- }
20487
- const getDelay = strict ? strictDelay : windowedDelay;
20488
- return function_ => {
20489
- const throttled = function (...args) {
20490
- if (!throttled.isEnabled) {
20491
- return (async () => function_.apply(this, args))();
20492
- }
20493
- let timeout;
20494
- return new Promise((resolve, reject) => {
20495
- const execute = () => {
20496
- resolve(function_.apply(this, args));
20497
- queue.delete(timeout);
20498
- };
20499
- timeout = setTimeout(execute, getDelay());
20500
- queue.set(timeout, reject);
20501
- });
20502
- };
20503
- throttled.abort = () => {
20504
- for (const timeout of queue.keys()) {
20505
- clearTimeout(timeout);
20506
- queue.get(timeout)(new AbortError());
20507
- }
20508
- queue.clear();
20509
- strictTicks.splice(0, strictTicks.length);
20510
- };
20511
- throttled.isEnabled = true;
20512
- return throttled;
20513
- };
20514
- };
20515
- pThrottle$2.exports = pThrottle;
20516
- pThrottle$2.exports.AbortError = AbortError;
20517
- var pThrottleExports = pThrottle$2.exports;
20518
- var pThrottle$1 = /*@__PURE__*/getDefaultExportFromCjs(pThrottleExports);
20553
+ return Promise.reject(error);
20554
+ });
20555
+ }
20556
+
20557
+ /** Detect free variable `global` from Node.js. */
20558
+ var freeGlobal$1 = typeof global == 'object' && global && global.Object === Object && global;
20559
+ var _freeGlobal = freeGlobal$1;
20560
+
20561
+ var freeGlobal = _freeGlobal;
20562
+
20563
+ /** Detect free variable `self`. */
20564
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
20565
+
20566
+ /** Used as a reference to the global object. */
20567
+ var root$1 = freeGlobal || freeSelf || Function('return this')();
20568
+ var _root = root$1;
20569
+
20570
+ var root = _root;
20571
+
20572
+ /** Built-in value references. */
20573
+ var Symbol$3 = root.Symbol;
20574
+ var _Symbol = Symbol$3;
20575
+
20576
+ var Symbol$2 = _Symbol;
20577
+
20578
+ /** Used for built-in method references. */
20579
+ var objectProto$2 = Object.prototype;
20580
+
20581
+ /** Used to check objects for own properties. */
20582
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
20519
20583
 
20520
20584
  /**
20521
- * lodash (Custom Build) <https://lodash.com/>
20522
- * Build: `lodash modularize exports="npm" -o ./`
20523
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
20524
- * Released under MIT license <https://lodash.com/license>
20525
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
20526
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
20585
+ * Used to resolve the
20586
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
20587
+ * of values.
20527
20588
  */
20589
+ var nativeObjectToString$1 = objectProto$2.toString;
20528
20590
 
20529
- /** `Object#toString` result references. */
20530
- var objectTag = '[object Object]';
20591
+ /** Built-in value references. */
20592
+ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
20531
20593
 
20532
20594
  /**
20533
- * Checks if `value` is a host object in IE < 9.
20595
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
20534
20596
  *
20535
20597
  * @private
20536
- * @param {*} value The value to check.
20537
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
20598
+ * @param {*} value The value to query.
20599
+ * @returns {string} Returns the raw `toStringTag`.
20538
20600
  */
20539
- function isHostObject(value) {
20540
- // Many host objects are `Object` objects that can coerce to strings
20541
- // despite having improperly defined `toString` methods.
20542
- var result = false;
20543
- if (value != null && typeof value.toString != 'function') {
20544
- try {
20545
- result = !!(value + '');
20546
- } catch (e) {}
20601
+ function getRawTag$1(value) {
20602
+ var isOwn = hasOwnProperty$2.call(value, symToStringTag$1),
20603
+ tag = value[symToStringTag$1];
20604
+ try {
20605
+ value[symToStringTag$1] = undefined;
20606
+ var unmasked = true;
20607
+ } catch (e) {}
20608
+ var result = nativeObjectToString$1.call(value);
20609
+ if (unmasked) {
20610
+ if (isOwn) {
20611
+ value[symToStringTag$1] = tag;
20612
+ } else {
20613
+ delete value[symToStringTag$1];
20614
+ }
20547
20615
  }
20548
20616
  return result;
20549
20617
  }
20618
+ var _getRawTag = getRawTag$1;
20619
+
20620
+ /** Used for built-in method references. */
20621
+ var objectProto$1 = Object.prototype;
20550
20622
 
20551
20623
  /**
20552
- * Creates a unary function that invokes `func` with its argument transformed.
20624
+ * Used to resolve the
20625
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
20626
+ * of values.
20627
+ */
20628
+ var nativeObjectToString = objectProto$1.toString;
20629
+
20630
+ /**
20631
+ * Converts `value` to a string using `Object.prototype.toString`.
20553
20632
  *
20554
20633
  * @private
20555
- * @param {Function} func The function to wrap.
20556
- * @param {Function} transform The argument transform.
20557
- * @returns {Function} Returns the new function.
20634
+ * @param {*} value The value to convert.
20635
+ * @returns {string} Returns the converted string.
20558
20636
  */
20559
- function overArg(func, transform) {
20560
- return function (arg) {
20561
- return func(transform(arg));
20562
- };
20637
+ function objectToString$1(value) {
20638
+ return nativeObjectToString.call(value);
20563
20639
  }
20640
+ var _objectToString = objectToString$1;
20564
20641
 
20565
- /** Used for built-in method references. */
20566
- var funcProto = Function.prototype,
20567
- objectProto = Object.prototype;
20568
-
20569
- /** Used to resolve the decompiled source of functions. */
20570
- var funcToString = funcProto.toString;
20642
+ var Symbol$1 = _Symbol,
20643
+ getRawTag = _getRawTag,
20644
+ objectToString = _objectToString;
20571
20645
 
20572
- /** Used to check objects for own properties. */
20573
- var hasOwnProperty$1 = objectProto.hasOwnProperty;
20646
+ /** `Object#toString` result references. */
20647
+ var nullTag = '[object Null]',
20648
+ undefinedTag = '[object Undefined]';
20574
20649
 
20575
- /** Used to infer the `Object` constructor. */
20576
- var objectCtorString = funcToString.call(Object);
20650
+ /** Built-in value references. */
20651
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
20577
20652
 
20578
20653
  /**
20579
- * Used to resolve the
20580
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
20581
- * of values.
20654
+ * The base implementation of `getTag` without fallbacks for buggy environments.
20655
+ *
20656
+ * @private
20657
+ * @param {*} value The value to query.
20658
+ * @returns {string} Returns the `toStringTag`.
20582
20659
  */
20583
- var objectToString = objectProto.toString;
20660
+ function baseGetTag$2(value) {
20661
+ if (value == null) {
20662
+ return value === undefined ? undefinedTag : nullTag;
20663
+ }
20664
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
20665
+ }
20666
+ var _baseGetTag = baseGetTag$2;
20584
20667
 
20585
- /** Built-in value references. */
20586
- var getPrototype = overArg(Object.getPrototypeOf, Object);
20668
+ /**
20669
+ * Checks if `value` is classified as an `Array` object.
20670
+ *
20671
+ * @static
20672
+ * @memberOf _
20673
+ * @since 0.1.0
20674
+ * @category Lang
20675
+ * @param {*} value The value to check.
20676
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
20677
+ * @example
20678
+ *
20679
+ * _.isArray([1, 2, 3]);
20680
+ * // => true
20681
+ *
20682
+ * _.isArray(document.body.children);
20683
+ * // => false
20684
+ *
20685
+ * _.isArray('abc');
20686
+ * // => false
20687
+ *
20688
+ * _.isArray(_.noop);
20689
+ * // => false
20690
+ */
20691
+ var isArray$2 = Array.isArray;
20692
+ var isArray_1 = isArray$2;
20587
20693
 
20588
20694
  /**
20589
20695
  * Checks if `value` is object-like. A value is object-like if it's not `null`
@@ -20609,767 +20715,189 @@ var getPrototype = overArg(Object.getPrototypeOf, Object);
20609
20715
  * _.isObjectLike(null);
20610
20716
  * // => false
20611
20717
  */
20612
- function isObjectLike(value) {
20613
- return !!value && typeof value == 'object';
20718
+ function isObjectLike$2(value) {
20719
+ return value != null && typeof value == 'object';
20614
20720
  }
20721
+ var isObjectLike_1 = isObjectLike$2;
20722
+
20723
+ var baseGetTag$1 = _baseGetTag,
20724
+ isArray$1 = isArray_1,
20725
+ isObjectLike$1 = isObjectLike_1;
20726
+
20727
+ /** `Object#toString` result references. */
20728
+ var stringTag = '[object String]';
20615
20729
 
20616
20730
  /**
20617
- * Checks if `value` is a plain object, that is, an object created by the
20618
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
20731
+ * Checks if `value` is classified as a `String` primitive or object.
20619
20732
  *
20620
20733
  * @static
20734
+ * @since 0.1.0
20621
20735
  * @memberOf _
20622
- * @since 0.8.0
20623
20736
  * @category Lang
20624
20737
  * @param {*} value The value to check.
20625
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
20626
- * @example
20627
- *
20628
- * function Foo() {
20629
- * this.a = 1;
20630
- * }
20631
- *
20632
- * _.isPlainObject(new Foo);
20633
- * // => false
20634
- *
20635
- * _.isPlainObject([1, 2, 3]);
20636
- * // => false
20637
- *
20638
- * _.isPlainObject({ 'x': 0, 'y': 0 });
20639
- * // => true
20640
- *
20641
- * _.isPlainObject(Object.create(null));
20642
- * // => true
20643
- */
20644
- function isPlainObject(value) {
20645
- if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) {
20646
- return false;
20647
- }
20648
- var proto = getPrototype(value);
20649
- if (proto === null) {
20650
- return true;
20651
- }
20652
- var Ctor = hasOwnProperty$1.call(proto, 'constructor') && proto.constructor;
20653
- return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
20654
- }
20655
- var lodash_isplainobject = isPlainObject;
20656
- var isPlainObject$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_isplainobject);
20657
-
20658
- function _arrayLikeToArray(r, a) {
20659
- (null == a || a > r.length) && (a = r.length);
20660
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
20661
- return n;
20662
- }
20663
- function _arrayWithHoles(r) {
20664
- if (Array.isArray(r)) return r;
20665
- }
20666
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
20667
- try {
20668
- var i = n[a](c),
20669
- u = i.value;
20670
- } catch (n) {
20671
- return void e(n);
20672
- }
20673
- i.done ? t(u) : Promise.resolve(u).then(r, o);
20674
- }
20675
- function _asyncToGenerator(n) {
20676
- return function () {
20677
- var t = this,
20678
- e = arguments;
20679
- return new Promise(function (r, o) {
20680
- var a = n.apply(t, e);
20681
- function _next(n) {
20682
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
20683
- }
20684
- function _throw(n) {
20685
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
20686
- }
20687
- _next(void 0);
20688
- });
20689
- };
20690
- }
20691
- function _createForOfIteratorHelper(r, e) {
20692
- var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
20693
- if (!t) {
20694
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
20695
- t && (r = t);
20696
- var n = 0,
20697
- F = function () {};
20698
- return {
20699
- s: F,
20700
- n: function () {
20701
- return n >= r.length ? {
20702
- done: !0
20703
- } : {
20704
- done: !1,
20705
- value: r[n++]
20706
- };
20707
- },
20708
- e: function (r) {
20709
- throw r;
20710
- },
20711
- f: F
20712
- };
20713
- }
20714
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
20715
- }
20716
- var o,
20717
- a = !0,
20718
- u = !1;
20719
- return {
20720
- s: function () {
20721
- t = t.call(r);
20722
- },
20723
- n: function () {
20724
- var r = t.next();
20725
- return a = r.done, r;
20726
- },
20727
- e: function (r) {
20728
- u = !0, o = r;
20729
- },
20730
- f: function () {
20731
- try {
20732
- a || null == t.return || t.return();
20733
- } finally {
20734
- if (u) throw o;
20735
- }
20736
- }
20737
- };
20738
- }
20739
- function _defineProperty(e, r, t) {
20740
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
20741
- value: t,
20742
- enumerable: !0,
20743
- configurable: !0,
20744
- writable: !0
20745
- }) : e[r] = t, e;
20746
- }
20747
- function _inherits(t, e) {
20748
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
20749
- t.prototype = Object.create(e && e.prototype, {
20750
- constructor: {
20751
- value: t,
20752
- writable: !0,
20753
- configurable: !0
20754
- }
20755
- }), Object.defineProperty(t, "prototype", {
20756
- writable: !1
20757
- }), e && _setPrototypeOf(t, e);
20758
- }
20759
- function _iterableToArrayLimit(r, l) {
20760
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
20761
- if (null != t) {
20762
- var e,
20763
- n,
20764
- i,
20765
- u,
20766
- a = [],
20767
- f = !0,
20768
- o = !1;
20769
- try {
20770
- if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
20771
- } catch (r) {
20772
- o = !0, n = r;
20773
- } finally {
20774
- try {
20775
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
20776
- } finally {
20777
- if (o) throw n;
20778
- }
20779
- }
20780
- return a;
20781
- }
20782
- }
20783
- function _nonIterableRest() {
20784
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
20785
- }
20786
- function ownKeys(e, r) {
20787
- var t = Object.keys(e);
20788
- if (Object.getOwnPropertySymbols) {
20789
- var o = Object.getOwnPropertySymbols(e);
20790
- r && (o = o.filter(function (r) {
20791
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
20792
- })), t.push.apply(t, o);
20793
- }
20794
- return t;
20795
- }
20796
- function _objectSpread2(e) {
20797
- for (var r = 1; r < arguments.length; r++) {
20798
- var t = null != arguments[r] ? arguments[r] : {};
20799
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
20800
- _defineProperty(e, r, t[r]);
20801
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
20802
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
20803
- });
20804
- }
20805
- return e;
20806
- }
20807
- function _regeneratorRuntime() {
20808
- _regeneratorRuntime = function () {
20809
- return e;
20810
- };
20811
- var t,
20812
- e = {},
20813
- r = Object.prototype,
20814
- n = r.hasOwnProperty,
20815
- o = Object.defineProperty || function (t, e, r) {
20816
- t[e] = r.value;
20817
- },
20818
- i = "function" == typeof Symbol ? Symbol : {},
20819
- a = i.iterator || "@@iterator",
20820
- c = i.asyncIterator || "@@asyncIterator",
20821
- u = i.toStringTag || "@@toStringTag";
20822
- function define(t, e, r) {
20823
- return Object.defineProperty(t, e, {
20824
- value: r,
20825
- enumerable: !0,
20826
- configurable: !0,
20827
- writable: !0
20828
- }), t[e];
20829
- }
20830
- try {
20831
- define({}, "");
20832
- } catch (t) {
20833
- define = function (t, e, r) {
20834
- return t[e] = r;
20835
- };
20836
- }
20837
- function wrap(t, e, r, n) {
20838
- var i = e && e.prototype instanceof Generator ? e : Generator,
20839
- a = Object.create(i.prototype),
20840
- c = new Context(n || []);
20841
- return o(a, "_invoke", {
20842
- value: makeInvokeMethod(t, r, c)
20843
- }), a;
20844
- }
20845
- function tryCatch(t, e, r) {
20846
- try {
20847
- return {
20848
- type: "normal",
20849
- arg: t.call(e, r)
20850
- };
20851
- } catch (t) {
20852
- return {
20853
- type: "throw",
20854
- arg: t
20855
- };
20856
- }
20857
- }
20858
- e.wrap = wrap;
20859
- var h = "suspendedStart",
20860
- l = "suspendedYield",
20861
- f = "executing",
20862
- s = "completed",
20863
- y = {};
20864
- function Generator() {}
20865
- function GeneratorFunction() {}
20866
- function GeneratorFunctionPrototype() {}
20867
- var p = {};
20868
- define(p, a, function () {
20869
- return this;
20870
- });
20871
- var d = Object.getPrototypeOf,
20872
- v = d && d(d(values([])));
20873
- v && v !== r && n.call(v, a) && (p = v);
20874
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
20875
- function defineIteratorMethods(t) {
20876
- ["next", "throw", "return"].forEach(function (e) {
20877
- define(t, e, function (t) {
20878
- return this._invoke(e, t);
20879
- });
20880
- });
20881
- }
20882
- function AsyncIterator(t, e) {
20883
- function invoke(r, o, i, a) {
20884
- var c = tryCatch(t[r], t, o);
20885
- if ("throw" !== c.type) {
20886
- var u = c.arg,
20887
- h = u.value;
20888
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
20889
- invoke("next", t, i, a);
20890
- }, function (t) {
20891
- invoke("throw", t, i, a);
20892
- }) : e.resolve(h).then(function (t) {
20893
- u.value = t, i(u);
20894
- }, function (t) {
20895
- return invoke("throw", t, i, a);
20896
- });
20897
- }
20898
- a(c.arg);
20899
- }
20900
- var r;
20901
- o(this, "_invoke", {
20902
- value: function (t, n) {
20903
- function callInvokeWithMethodAndArg() {
20904
- return new e(function (e, r) {
20905
- invoke(t, n, e, r);
20906
- });
20907
- }
20908
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
20909
- }
20910
- });
20911
- }
20912
- function makeInvokeMethod(e, r, n) {
20913
- var o = h;
20914
- return function (i, a) {
20915
- if (o === f) throw Error("Generator is already running");
20916
- if (o === s) {
20917
- if ("throw" === i) throw a;
20918
- return {
20919
- value: t,
20920
- done: !0
20921
- };
20922
- }
20923
- for (n.method = i, n.arg = a;;) {
20924
- var c = n.delegate;
20925
- if (c) {
20926
- var u = maybeInvokeDelegate(c, n);
20927
- if (u) {
20928
- if (u === y) continue;
20929
- return u;
20930
- }
20931
- }
20932
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
20933
- if (o === h) throw o = s, n.arg;
20934
- n.dispatchException(n.arg);
20935
- } else "return" === n.method && n.abrupt("return", n.arg);
20936
- o = f;
20937
- var p = tryCatch(e, r, n);
20938
- if ("normal" === p.type) {
20939
- if (o = n.done ? s : l, p.arg === y) continue;
20940
- return {
20941
- value: p.arg,
20942
- done: n.done
20943
- };
20944
- }
20945
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
20946
- }
20947
- };
20948
- }
20949
- function maybeInvokeDelegate(e, r) {
20950
- var n = r.method,
20951
- o = e.iterator[n];
20952
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
20953
- var i = tryCatch(o, e.iterator, r.arg);
20954
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
20955
- var a = i.arg;
20956
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
20957
- }
20958
- function pushTryEntry(t) {
20959
- var e = {
20960
- tryLoc: t[0]
20961
- };
20962
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
20963
- }
20964
- function resetTryEntry(t) {
20965
- var e = t.completion || {};
20966
- e.type = "normal", delete e.arg, t.completion = e;
20967
- }
20968
- function Context(t) {
20969
- this.tryEntries = [{
20970
- tryLoc: "root"
20971
- }], t.forEach(pushTryEntry, this), this.reset(!0);
20972
- }
20973
- function values(e) {
20974
- if (e || "" === e) {
20975
- var r = e[a];
20976
- if (r) return r.call(e);
20977
- if ("function" == typeof e.next) return e;
20978
- if (!isNaN(e.length)) {
20979
- var o = -1,
20980
- i = function next() {
20981
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
20982
- return next.value = t, next.done = !0, next;
20983
- };
20984
- return i.next = i;
20985
- }
20986
- }
20987
- throw new TypeError(typeof e + " is not iterable");
20988
- }
20989
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
20990
- value: GeneratorFunctionPrototype,
20991
- configurable: !0
20992
- }), o(GeneratorFunctionPrototype, "constructor", {
20993
- value: GeneratorFunction,
20994
- configurable: !0
20995
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
20996
- var e = "function" == typeof t && t.constructor;
20997
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
20998
- }, e.mark = function (t) {
20999
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
21000
- }, e.awrap = function (t) {
21001
- return {
21002
- __await: t
21003
- };
21004
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
21005
- return this;
21006
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
21007
- void 0 === i && (i = Promise);
21008
- var a = new AsyncIterator(wrap(t, r, n, o), i);
21009
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
21010
- return t.done ? t.value : a.next();
21011
- });
21012
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
21013
- return this;
21014
- }), define(g, "toString", function () {
21015
- return "[object Generator]";
21016
- }), e.keys = function (t) {
21017
- var e = Object(t),
21018
- r = [];
21019
- for (var n in e) r.push(n);
21020
- return r.reverse(), function next() {
21021
- for (; r.length;) {
21022
- var t = r.pop();
21023
- if (t in e) return next.value = t, next.done = !1, next;
21024
- }
21025
- return next.done = !0, next;
21026
- };
21027
- }, e.values = values, Context.prototype = {
21028
- constructor: Context,
21029
- reset: function (e) {
21030
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
21031
- },
21032
- stop: function () {
21033
- this.done = !0;
21034
- var t = this.tryEntries[0].completion;
21035
- if ("throw" === t.type) throw t.arg;
21036
- return this.rval;
21037
- },
21038
- dispatchException: function (e) {
21039
- if (this.done) throw e;
21040
- var r = this;
21041
- function handle(n, o) {
21042
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
21043
- }
21044
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
21045
- var i = this.tryEntries[o],
21046
- a = i.completion;
21047
- if ("root" === i.tryLoc) return handle("end");
21048
- if (i.tryLoc <= this.prev) {
21049
- var c = n.call(i, "catchLoc"),
21050
- u = n.call(i, "finallyLoc");
21051
- if (c && u) {
21052
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
21053
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
21054
- } else if (c) {
21055
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
21056
- } else {
21057
- if (!u) throw Error("try statement without catch or finally");
21058
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
21059
- }
21060
- }
21061
- }
21062
- },
21063
- abrupt: function (t, e) {
21064
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
21065
- var o = this.tryEntries[r];
21066
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
21067
- var i = o;
21068
- break;
21069
- }
21070
- }
21071
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
21072
- var a = i ? i.completion : {};
21073
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
21074
- },
21075
- complete: function (t, e) {
21076
- if ("throw" === t.type) throw t.arg;
21077
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
21078
- },
21079
- finish: function (t) {
21080
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
21081
- var r = this.tryEntries[e];
21082
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
21083
- }
21084
- },
21085
- catch: function (t) {
21086
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
21087
- var r = this.tryEntries[e];
21088
- if (r.tryLoc === t) {
21089
- var n = r.completion;
21090
- if ("throw" === n.type) {
21091
- var o = n.arg;
21092
- resetTryEntry(r);
21093
- }
21094
- return o;
21095
- }
21096
- }
21097
- throw Error("illegal catch attempt");
21098
- },
21099
- delegateYield: function (e, r, n) {
21100
- return this.delegate = {
21101
- iterator: values(e),
21102
- resultName: r,
21103
- nextLoc: n
21104
- }, "next" === this.method && (this.arg = t), y;
21105
- }
21106
- }, e;
21107
- }
21108
- function _setPrototypeOf(t, e) {
21109
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
21110
- return t.__proto__ = e, t;
21111
- }, _setPrototypeOf(t, e);
21112
- }
21113
- function _slicedToArray$1(r, e) {
21114
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
21115
- }
21116
- function _toPrimitive(t, r) {
21117
- if ("object" != typeof t || !t) return t;
21118
- var e = t[Symbol.toPrimitive];
21119
- if (void 0 !== e) {
21120
- var i = e.call(t, r || "default");
21121
- if ("object" != typeof i) return i;
21122
- throw new TypeError("@@toPrimitive must return a primitive value.");
21123
- }
21124
- return ("string" === r ? String : Number)(t);
21125
- }
21126
- function _toPropertyKey(t) {
21127
- var i = _toPrimitive(t, "string");
21128
- return "symbol" == typeof i ? i : i + "";
21129
- }
21130
- function _typeof$1(o) {
21131
- "@babel/helpers - typeof";
21132
-
21133
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
21134
- return typeof o;
21135
- } : function (o) {
21136
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
21137
- }, _typeof$1(o);
20738
+ * @returns {boolean} Returns `true` if `value` is a string, else `false`.
20739
+ * @example
20740
+ *
20741
+ * _.isString('abc');
20742
+ * // => true
20743
+ *
20744
+ * _.isString(1);
20745
+ * // => false
20746
+ */
20747
+ function isString(value) {
20748
+ return typeof value == 'string' || !isArray$1(value) && isObjectLike$1(value) && baseGetTag$1(value) == stringTag;
21138
20749
  }
21139
- function _unsupportedIterableToArray(r, a) {
21140
- if (r) {
21141
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
21142
- var t = {}.toString.call(r).slice(8, -1);
21143
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
20750
+ var isString_1 = isString;
20751
+ var isString$1 = /*@__PURE__*/getDefaultExportFromCjs(isString_1);
20752
+
20753
+ class AbortError extends Error {
20754
+ constructor() {
20755
+ super('Throttled function aborted');
20756
+ this.name = 'AbortError';
21144
20757
  }
21145
20758
  }
21146
- function _wrapRegExp() {
21147
- _wrapRegExp = function (e, r) {
21148
- return new BabelRegExp(e, void 0, r);
21149
- };
21150
- var e = RegExp.prototype,
21151
- r = new WeakMap();
21152
- function BabelRegExp(e, t, p) {
21153
- var o = RegExp(e, t);
21154
- return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype);
20759
+ function pThrottle({
20760
+ limit,
20761
+ interval,
20762
+ strict,
20763
+ onDelay
20764
+ }) {
20765
+ if (!Number.isFinite(limit)) {
20766
+ throw new TypeError('Expected `limit` to be a finite number');
21155
20767
  }
21156
- function buildGroups(e, t) {
21157
- var p = r.get(t);
21158
- return Object.keys(p).reduce(function (r, t) {
21159
- var o = p[t];
21160
- if ("number" == typeof o) r[t] = e[o];else {
21161
- for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++;
21162
- r[t] = e[o[i]];
21163
- }
21164
- return r;
21165
- }, Object.create(null));
20768
+ if (!Number.isFinite(interval)) {
20769
+ throw new TypeError('Expected `interval` to be a finite number');
21166
20770
  }
21167
- return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) {
21168
- var t = e.exec.call(this, r);
21169
- if (t) {
21170
- t.groups = buildGroups(t, this);
21171
- var p = t.indices;
21172
- p && (p.groups = buildGroups(p, this));
20771
+ const queue = new Map();
20772
+ let currentTick = 0;
20773
+ let activeCount = 0;
20774
+ function windowedDelay() {
20775
+ const now = Date.now();
20776
+ if (now - currentTick > interval) {
20777
+ activeCount = 1;
20778
+ currentTick = now;
20779
+ return 0;
21173
20780
  }
21174
- return t;
21175
- }, BabelRegExp.prototype[Symbol.replace] = function (t, p) {
21176
- if ("string" == typeof p) {
21177
- var o = r.get(this);
21178
- return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) {
21179
- var t = o[r];
21180
- return "$" + (Array.isArray(t) ? t.join("$") : t);
21181
- }));
20781
+ if (activeCount < limit) {
20782
+ activeCount++;
20783
+ } else {
20784
+ currentTick += interval;
20785
+ activeCount = 1;
21182
20786
  }
21183
- if ("function" == typeof p) {
21184
- var i = this;
21185
- return e[Symbol.replace].call(this, t, function () {
21186
- var e = arguments;
21187
- return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e);
21188
- });
20787
+ return currentTick - now;
20788
+ }
20789
+ const strictTicks = [];
20790
+ function strictDelay() {
20791
+ const now = Date.now();
20792
+
20793
+ // Clear the queue if there's a significant delay since the last execution
20794
+ if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
20795
+ strictTicks.length = 0;
21189
20796
  }
21190
- return e[Symbol.replace].call(this, t, p);
21191
- }, _wrapRegExp.apply(this, arguments);
21192
- }
21193
- function asyncToken(instance, getToken) {
21194
- instance.interceptors.request.use(function (config) {
21195
- return getToken().then(function (accessToken) {
21196
- config.headers.set('Authorization', "Bearer ".concat(accessToken));
21197
- return config;
21198
- });
21199
- });
21200
- }
21201
- function isNode() {
21202
- /**
21203
- * Polyfills of 'process' might set process.browser === true
21204
- *
21205
- * See:
21206
- * https://github.com/webpack/node-libs-browser/blob/master/mock/process.js#L8
21207
- * https://github.com/defunctzombie/node-process/blob/master/browser.js#L156
21208
- **/
21209
- return typeof process !== 'undefined' && !process.browser;
21210
- }
21211
- function isReactNative() {
21212
- return typeof window !== 'undefined' && 'navigator' in window && 'product' in window.navigator && window.navigator.product === 'ReactNative';
21213
- }
21214
- function getNodeVersion() {
21215
- return process.versions && process.versions.node ? "v".concat(process.versions.node) : process.version;
21216
- }
21217
- function getWindow() {
21218
- return window;
21219
- }
21220
- function noop() {
21221
- return undefined;
21222
- }
21223
- var delay = function delay(ms) {
21224
- return new Promise(function (resolve) {
21225
- setTimeout(resolve, ms);
21226
- });
21227
- };
21228
- var defaultWait = function defaultWait(attempts) {
21229
- return Math.pow(Math.SQRT2, attempts);
21230
- };
21231
- function rateLimit(instance) {
21232
- var maxRetry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
21233
- var _instance$defaults = instance.defaults,
21234
- _instance$defaults$re = _instance$defaults.responseLogger,
21235
- responseLogger = _instance$defaults$re === void 0 ? noop : _instance$defaults$re,
21236
- _instance$defaults$re2 = _instance$defaults.requestLogger,
21237
- requestLogger = _instance$defaults$re2 === void 0 ? noop : _instance$defaults$re2;
21238
- instance.interceptors.request.use(function (config) {
21239
- requestLogger(config);
21240
- return config;
21241
- }, function (error) {
21242
- requestLogger(error);
21243
- return Promise.reject(error);
21244
- });
21245
- instance.interceptors.response.use(function (response) {
21246
- // we don't need to do anything here
21247
- responseLogger(response);
21248
- return response;
21249
- }, /*#__PURE__*/function () {
21250
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(error) {
21251
- var response, config, doneAttempts, retryErrorType, wait;
21252
- return _regeneratorRuntime().wrap(function _callee$(_context) {
21253
- while (1) switch (_context.prev = _context.next) {
21254
- case 0:
21255
- response = error.response;
21256
- config = error.config;
21257
- responseLogger(error);
21258
- // Do not retry if it is disabled or no request config exists (not an axios error)
21259
- if (!(!config || !instance.defaults.retryOnError)) {
21260
- _context.next = 5;
21261
- break;
21262
- }
21263
- return _context.abrupt("return", Promise.reject(error));
21264
- case 5:
21265
- // Retried already for max attempts
21266
- doneAttempts = config.attempts || 1;
21267
- if (!(doneAttempts > maxRetry)) {
21268
- _context.next = 9;
21269
- break;
21270
- }
21271
- error.attempts = config.attempts;
21272
- return _context.abrupt("return", Promise.reject(error));
21273
- case 9:
21274
- retryErrorType = null;
21275
- wait = defaultWait(doneAttempts); // Errors without response did not receive anything from the server
21276
- if (!response) {
21277
- retryErrorType = 'Connection';
21278
- } else if (response.status >= 500 && response.status < 600) {
21279
- // 5** errors are server related
21280
- retryErrorType = "Server ".concat(response.status);
21281
- } else if (response.status === 429) {
21282
- // 429 errors are exceeded rate limit exceptions
21283
- retryErrorType = 'Rate limit';
21284
- // all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
21285
- if (response.headers && error.response.headers['x-contentful-ratelimit-reset']) {
21286
- wait = response.headers['x-contentful-ratelimit-reset'];
21287
- }
21288
- }
21289
- if (!retryErrorType) {
21290
- _context.next = 19;
21291
- break;
21292
- }
21293
- // convert to ms and add jitter
21294
- wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
21295
- instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
21296
-
21297
- // increase attempts counter
21298
- config.attempts = doneAttempts + 1;
21299
-
21300
- /* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
21301
- to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
21302
- requests still use the original http/httpsAgent property */
21303
- delete config.httpAgent;
21304
- delete config.httpsAgent;
21305
- return _context.abrupt("return", delay(wait).then(function () {
21306
- return instance(config);
21307
- }));
21308
- case 19:
21309
- return _context.abrupt("return", Promise.reject(error));
21310
- case 20:
21311
- case "end":
21312
- return _context.stop();
20797
+
20798
+ // If the queue is not full, add the current time and execute immediately
20799
+ if (strictTicks.length < limit) {
20800
+ strictTicks.push(now);
20801
+ return 0;
20802
+ }
20803
+
20804
+ // Calculate the next execution time based on the first item in the queue
20805
+ const nextExecutionTime = strictTicks[0] + interval;
20806
+
20807
+ // Shift the queue and add the new execution time
20808
+ strictTicks.shift();
20809
+ strictTicks.push(nextExecutionTime);
20810
+
20811
+ // Calculate the delay for the current execution
20812
+ return Math.max(0, nextExecutionTime - now);
20813
+ }
20814
+ const getDelay = strict ? strictDelay : windowedDelay;
20815
+ return function_ => {
20816
+ const throttled = function (...arguments_) {
20817
+ if (!throttled.isEnabled) {
20818
+ return (async () => function_.apply(this, arguments_))();
20819
+ }
20820
+ let timeoutId;
20821
+ return new Promise((resolve, reject) => {
20822
+ const execute = () => {
20823
+ resolve(function_.apply(this, arguments_));
20824
+ queue.delete(timeoutId);
20825
+ };
20826
+ const delay = getDelay();
20827
+ if (delay > 0) {
20828
+ timeoutId = setTimeout(execute, delay);
20829
+ queue.set(timeoutId, reject);
20830
+ onDelay === null || onDelay === void 0 || onDelay(...arguments_);
20831
+ } else {
20832
+ execute();
21313
20833
  }
21314
- }, _callee);
21315
- }));
21316
- return function (_x) {
21317
- return _ref.apply(this, arguments);
20834
+ });
20835
+ };
20836
+ throttled.abort = () => {
20837
+ for (const timeout of queue.keys()) {
20838
+ clearTimeout(timeout);
20839
+ queue.get(timeout)(new AbortError());
20840
+ }
20841
+ queue.clear();
20842
+ strictTicks.splice(0, strictTicks.length);
21318
20843
  };
21319
- }());
20844
+ throttled.isEnabled = true;
20845
+ Object.defineProperty(throttled, 'queueSize', {
20846
+ get() {
20847
+ return queue.size;
20848
+ }
20849
+ });
20850
+ return throttled;
20851
+ };
21320
20852
  }
21321
- var PERCENTAGE_REGEX = /*#__PURE__*/_wrapRegExp(/(\d+)(%)/, {
20853
+
20854
+ const PERCENTAGE_REGEX = /*#__PURE__*/_wrapRegExp(/(\d+)(%)/, {
21322
20855
  value: 1
21323
20856
  });
21324
- function calculateLimit(type) {
21325
- var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 7;
21326
- var limit = max;
20857
+ function calculateLimit(type, max = 7) {
20858
+ let limit = max;
21327
20859
  if (PERCENTAGE_REGEX.test(type)) {
21328
20860
  var _type$match;
21329
- var groups = (_type$match = type.match(PERCENTAGE_REGEX)) === null || _type$match === void 0 ? void 0 : _type$match.groups;
20861
+ const groups = (_type$match = type.match(PERCENTAGE_REGEX)) === null || _type$match === void 0 ? void 0 : _type$match.groups;
21330
20862
  if (groups && groups.value) {
21331
- var percentage = parseInt(groups.value) / 100;
20863
+ const percentage = parseInt(groups.value) / 100;
21332
20864
  limit = Math.round(max * percentage);
21333
20865
  }
21334
20866
  }
21335
20867
  return Math.min(30, Math.max(1, limit));
21336
20868
  }
21337
20869
  function createThrottle(limit, logger) {
21338
- logger('info', "Throttle request to ".concat(limit, "/s"));
21339
- return pThrottle$1({
21340
- limit: limit,
20870
+ logger('info', `Throttle request to ${limit}/s`);
20871
+ return pThrottle({
20872
+ limit,
21341
20873
  interval: 1000,
21342
20874
  strict: false
21343
20875
  });
21344
20876
  }
21345
- var rateLimitThrottle = function (axiosInstance) {
21346
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
21347
- var _axiosInstance$defaul = axiosInstance.defaults.logHandler,
21348
- logHandler = _axiosInstance$defaul === void 0 ? noop : _axiosInstance$defaul;
21349
- var limit = isString$1(type) ? calculateLimit(type) : calculateLimit('auto', type);
21350
- var throttle = createThrottle(limit, logHandler);
21351
- var isCalculated = false;
21352
- var requestInterceptorId = axiosInstance.interceptors.request.use(function (config) {
21353
- return throttle(function () {
21354
- return config;
21355
- })();
20877
+ var rateLimitThrottle = (axiosInstance, type = 'auto') => {
20878
+ const {
20879
+ logHandler = noop
20880
+ } = axiosInstance.defaults;
20881
+ let limit = isString$1(type) ? calculateLimit(type) : calculateLimit('auto', type);
20882
+ let throttle = createThrottle(limit, logHandler);
20883
+ let isCalculated = false;
20884
+ let requestInterceptorId = axiosInstance.interceptors.request.use(config => {
20885
+ return throttle(() => config)();
21356
20886
  }, function (error) {
21357
20887
  return Promise.reject(error);
21358
20888
  });
21359
- var responseInterceptorId = axiosInstance.interceptors.response.use(function (response) {
20889
+ const responseInterceptorId = axiosInstance.interceptors.response.use(response => {
21360
20890
  if (!isCalculated && isString$1(type) && (type === 'auto' || PERCENTAGE_REGEX.test(type)) && response.headers && response.headers['x-contentful-ratelimit-second-limit']) {
21361
- var rawLimit = parseInt(response.headers['x-contentful-ratelimit-second-limit']);
21362
- var nextLimit = calculateLimit(type, rawLimit);
20891
+ const rawLimit = parseInt(response.headers['x-contentful-ratelimit-second-limit']);
20892
+ const nextLimit = calculateLimit(type, rawLimit);
21363
20893
  if (nextLimit !== limit) {
21364
20894
  if (requestInterceptorId) {
21365
20895
  axiosInstance.interceptors.request.eject(requestInterceptorId);
21366
20896
  }
21367
20897
  limit = nextLimit;
21368
20898
  throttle = createThrottle(nextLimit, logHandler);
21369
- requestInterceptorId = axiosInstance.interceptors.request.use(function (config) {
21370
- return throttle(function () {
21371
- return config;
21372
- })();
20899
+ requestInterceptorId = axiosInstance.interceptors.request.use(config => {
20900
+ return throttle(() => config)();
21373
20901
  }, function (error) {
21374
20902
  return Promise.reject(error);
21375
20903
  });
@@ -21380,7 +20908,7 @@ var rateLimitThrottle = function (axiosInstance) {
21380
20908
  }, function (error) {
21381
20909
  return Promise.reject(error);
21382
20910
  });
21383
- return function () {
20911
+ return () => {
21384
20912
  axiosInstance.interceptors.request.eject(requestInterceptorId);
21385
20913
  axiosInstance.interceptors.response.eject(responseInterceptorId);
21386
20914
  };
@@ -21388,8 +20916,14 @@ var rateLimitThrottle = function (axiosInstance) {
21388
20916
 
21389
20917
  // Matches 'sub.host:port' or 'host:port' and extracts hostname and port
21390
20918
  // Also enforces toplevel domain specified, no spaces and no protocol
21391
- var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
21392
-
20919
+ const HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
20920
+ function copyHttpClientParams(options) {
20921
+ const copiedOptions = index(options);
20922
+ // httpAgent and httpsAgent cannot be copied because they can contain private fields
20923
+ copiedOptions.httpAgent = options.httpAgent;
20924
+ copiedOptions.httpsAgent = options.httpsAgent;
20925
+ return copiedOptions;
20926
+ }
21393
20927
  /**
21394
20928
  * Create pre-configured axios instance
21395
20929
  * @private
@@ -21398,20 +20932,18 @@ var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
21398
20932
  * @return {AxiosInstance} Initialized axios instance
21399
20933
  */
21400
20934
  function createHttpClient(axios, options) {
21401
- var defaultConfig = {
20935
+ const defaultConfig = {
21402
20936
  insecure: false,
21403
20937
  retryOnError: true,
21404
20938
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21405
- logHandler: function logHandler(level, data) {
20939
+ logHandler: (level, data) => {
21406
20940
  if (level === 'error' && data) {
21407
- var title = [data.name, data.message].filter(function (a) {
21408
- return a;
21409
- }).join(' - ');
21410
- console.error("[error] ".concat(title));
20941
+ const title = [data.name, data.message].filter(a => a).join(' - ');
20942
+ console.error(`[error] ${title}`);
21411
20943
  console.error(data);
21412
20944
  return;
21413
20945
  }
21414
- console.log("[".concat(level, "] ").concat(data));
20946
+ console.log(`[${level}] ${data}`);
21415
20947
  },
21416
20948
  // Passed to axios
21417
20949
  headers: {},
@@ -21425,40 +20957,36 @@ function createHttpClient(axios, options) {
21425
20957
  // 1GB
21426
20958
  maxBodyLength: 1073741824 // 1GB
21427
20959
  };
21428
- var config = _objectSpread2(_objectSpread2({}, defaultConfig), options);
20960
+ const config = _objectSpread2(_objectSpread2({}, defaultConfig), options);
21429
20961
  if (!config.accessToken) {
21430
- var missingAccessTokenError = new TypeError('Expected parameter accessToken');
20962
+ const missingAccessTokenError = new TypeError('Expected parameter accessToken');
21431
20963
  config.logHandler('error', missingAccessTokenError);
21432
20964
  throw missingAccessTokenError;
21433
20965
  }
21434
-
21435
20966
  // Construct axios baseURL option
21436
- var protocol = config.insecure ? 'http' : 'https';
21437
- var space = config.space ? "".concat(config.space, "/") : '';
21438
- var hostname = config.defaultHostname;
21439
- var port = config.insecure ? 80 : 443;
20967
+ const protocol = config.insecure ? 'http' : 'https';
20968
+ const space = config.space ? `${config.space}/` : '';
20969
+ let hostname = config.defaultHostname;
20970
+ let port = config.insecure ? 80 : 443;
21440
20971
  if (config.host && HOST_REGEX.test(config.host)) {
21441
- var parsed = config.host.split(':');
20972
+ const parsed = config.host.split(':');
21442
20973
  if (parsed.length === 2) {
21443
- var _parsed = _slicedToArray$1(parsed, 2);
21444
- hostname = _parsed[0];
21445
- port = _parsed[1];
20974
+ [hostname, port] = parsed;
21446
20975
  } else {
21447
20976
  hostname = parsed[0];
21448
20977
  }
21449
20978
  }
21450
-
21451
20979
  // Ensure that basePath does start but not end with a slash
21452
20980
  if (config.basePath) {
21453
- config.basePath = "/".concat(config.basePath.split('/').filter(Boolean).join('/'));
20981
+ config.basePath = `/${config.basePath.split('/').filter(Boolean).join('/')}`;
21454
20982
  }
21455
- var baseURL = options.baseURL || "".concat(protocol, "://").concat(hostname, ":").concat(port).concat(config.basePath, "/spaces/").concat(space);
20983
+ const baseURL = options.baseURL || `${protocol}://${hostname}:${port}${config.basePath}/spaces/${space}`;
21456
20984
  if (!config.headers.Authorization && typeof config.accessToken !== 'function') {
21457
20985
  config.headers.Authorization = 'Bearer ' + config.accessToken;
21458
20986
  }
21459
- var axiosOptions = {
20987
+ const axiosOptions = {
21460
20988
  // Axios
21461
- baseURL: baseURL,
20989
+ baseURL,
21462
20990
  headers: config.headers,
21463
20991
  httpAgent: config.httpAgent,
21464
20992
  httpsAgent: config.httpsAgent,
@@ -21468,7 +20996,7 @@ function createHttpClient(axios, options) {
21468
20996
  maxContentLength: config.maxContentLength,
21469
20997
  maxBodyLength: config.maxBodyLength,
21470
20998
  paramsSerializer: {
21471
- serialize: function serialize(params) {
20999
+ serialize: params => {
21472
21000
  return qs.stringify(params);
21473
21001
  }
21474
21002
  },
@@ -21478,9 +21006,8 @@ function createHttpClient(axios, options) {
21478
21006
  requestLogger: config.requestLogger,
21479
21007
  retryOnError: config.retryOnError
21480
21008
  };
21481
- var instance = axios.create(axiosOptions);
21009
+ const instance = axios.create(axiosOptions);
21482
21010
  instance.httpClientParams = options;
21483
-
21484
21011
  /**
21485
21012
  * Creates a new axios instance with the same default base parameters as the
21486
21013
  * current one, and with any overrides passed to the newParams object
@@ -21492,14 +21019,12 @@ function createHttpClient(axios, options) {
21492
21019
  * @return {AxiosInstance} Initialized axios instance
21493
21020
  */
21494
21021
  instance.cloneWithNewParams = function (newParams) {
21495
- return createHttpClient(axios, _objectSpread2(_objectSpread2({}, copy$1(options)), newParams));
21022
+ return createHttpClient(axios, _objectSpread2(_objectSpread2({}, copyHttpClientParams(options)), newParams));
21496
21023
  };
21497
-
21498
21024
  /**
21499
21025
  * Apply interceptors.
21500
21026
  * Please note that the order of interceptors is important
21501
21027
  */
21502
-
21503
21028
  if (config.onBeforeRequest) {
21504
21029
  instance.interceptors.request.use(config.onBeforeRequest);
21505
21030
  }
@@ -21511,46 +21036,34 @@ function createHttpClient(axios, options) {
21511
21036
  }
21512
21037
  rateLimit(instance, config.retryLimit);
21513
21038
  if (config.onError) {
21514
- instance.interceptors.response.use(function (response) {
21515
- return response;
21516
- }, config.onError);
21039
+ instance.interceptors.response.use(response => response, config.onError);
21517
21040
  }
21518
21041
  return instance;
21519
21042
  }
21520
21043
 
21521
- /* eslint-disable @typescript-eslint/no-explicit-any */
21522
21044
  /**
21523
21045
  * Creates request parameters configuration by parsing an existing query object
21524
21046
  * @private
21525
21047
  * @param {Object} query
21526
21048
  * @return {Object} Config object with `params` property, ready to be used in axios
21527
21049
  */
21528
- function createRequestConfig(_ref) {
21529
- var query = _ref.query;
21530
- var config = {};
21050
+ function createRequestConfig({
21051
+ query
21052
+ }) {
21053
+ const config = {};
21531
21054
  delete query.resolveLinks;
21532
- config.params = copy$1(query);
21055
+ config.params = index(query);
21533
21056
  return config;
21534
21057
  }
21535
21058
 
21536
21059
  // copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
21537
-
21538
21060
  function deepFreeze(object) {
21539
- var propNames = Object.getOwnPropertyNames(object);
21540
- var _iterator = _createForOfIteratorHelper(propNames),
21541
- _step;
21542
- try {
21543
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
21544
- var name = _step.value;
21545
- var value = object[name];
21546
- if (value && _typeof$1(value) === 'object') {
21547
- deepFreeze(value);
21548
- }
21061
+ const propNames = Object.getOwnPropertyNames(object);
21062
+ for (const name of propNames) {
21063
+ const value = object[name];
21064
+ if (value && typeof value === 'object') {
21065
+ deepFreeze(value);
21549
21066
  }
21550
- } catch (err) {
21551
- _iterator.e(err);
21552
- } finally {
21553
- _iterator.f();
21554
21067
  }
21555
21068
  return Object.freeze(object);
21556
21069
  }
@@ -21558,17 +21071,18 @@ function freezeSys(obj) {
21558
21071
  deepFreeze(obj.sys || {});
21559
21072
  return obj;
21560
21073
  }
21074
+
21561
21075
  function getBrowserOS() {
21562
- var win = getWindow();
21076
+ const win = getWindow();
21563
21077
  if (!win) {
21564
21078
  return null;
21565
21079
  }
21566
- var userAgent = win.navigator.userAgent;
21080
+ const userAgent = win.navigator.userAgent;
21567
21081
  // TODO: platform is deprecated.
21568
- var platform = win.navigator.platform;
21569
- var macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
21570
- var windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
21571
- var iosPlatforms = ['iPhone', 'iPad', 'iPod'];
21082
+ const platform = win.navigator.platform;
21083
+ const macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
21084
+ const windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
21085
+ const iosPlatforms = ['iPhone', 'iPad', 'iPod'];
21572
21086
  if (macosPlatforms.indexOf(platform) !== -1) {
21573
21087
  return 'macOS';
21574
21088
  } else if (iosPlatforms.indexOf(platform) !== -1) {
@@ -21583,9 +21097,9 @@ function getBrowserOS() {
21583
21097
  return null;
21584
21098
  }
21585
21099
  function getNodeOS() {
21586
- var platform = process.platform || 'linux';
21587
- var version = process.version || '0.0.0';
21588
- var platformMap = {
21100
+ const platform = process$1.platform || 'linux';
21101
+ const version = process$1.version || '0.0.0';
21102
+ const platformMap = {
21589
21103
  android: 'Android',
21590
21104
  aix: 'Linux',
21591
21105
  darwin: 'macOS',
@@ -21596,27 +21110,27 @@ function getNodeOS() {
21596
21110
  win32: 'Windows'
21597
21111
  };
21598
21112
  if (platform in platformMap) {
21599
- return "".concat(platformMap[platform] || 'Linux', "/").concat(version);
21113
+ return `${platformMap[platform] || 'Linux'}/${version}`;
21600
21114
  }
21601
21115
  return null;
21602
21116
  }
21603
21117
  function getUserAgentHeader(sdk, application, integration, feature) {
21604
- var headerParts = [];
21118
+ const headerParts = [];
21605
21119
  if (application) {
21606
- headerParts.push("app ".concat(application));
21120
+ headerParts.push(`app ${application}`);
21607
21121
  }
21608
21122
  if (integration) {
21609
- headerParts.push("integration ".concat(integration));
21123
+ headerParts.push(`integration ${integration}`);
21610
21124
  }
21611
- headerParts.push("sdk ".concat(sdk));
21612
- var platform = null;
21125
+ headerParts.push(`sdk ${sdk}`);
21126
+ let platform = null;
21613
21127
  try {
21614
21128
  if (isReactNative()) {
21615
21129
  platform = getBrowserOS();
21616
21130
  headerParts.push('platform ReactNative');
21617
21131
  } else if (isNode()) {
21618
21132
  platform = getNodeOS();
21619
- headerParts.push("platform node.js/".concat(getNodeVersion()));
21133
+ headerParts.push(`platform node.js/${getNodeVersion()}`);
21620
21134
  } else {
21621
21135
  platform = getBrowserOS();
21622
21136
  headerParts.push('platform browser');
@@ -21625,11 +21139,9 @@ function getUserAgentHeader(sdk, application, integration, feature) {
21625
21139
  platform = null;
21626
21140
  }
21627
21141
  if (platform) {
21628
- headerParts.push("os ".concat(platform));
21142
+ headerParts.push(`os ${platform}`);
21629
21143
  }
21630
- return "".concat(headerParts.filter(function (item) {
21631
- return item !== '';
21632
- }).join('; '), ";");
21144
+ return `${headerParts.filter(item => item !== '').join('; ')};`;
21633
21145
  }
21634
21146
 
21635
21147
  /**
@@ -21645,12 +21157,95 @@ function toPlainObject(data) {
21645
21157
  enumerable: false,
21646
21158
  configurable: false,
21647
21159
  writable: false,
21648
- value: function value() {
21649
- return copy$1(this);
21160
+ value: function () {
21161
+ return index(this);
21650
21162
  }
21651
21163
  });
21652
21164
  }
21653
21165
 
21166
+ /**
21167
+ * Creates a unary function that invokes `func` with its argument transformed.
21168
+ *
21169
+ * @private
21170
+ * @param {Function} func The function to wrap.
21171
+ * @param {Function} transform The argument transform.
21172
+ * @returns {Function} Returns the new function.
21173
+ */
21174
+ function overArg$1(func, transform) {
21175
+ return function (arg) {
21176
+ return func(transform(arg));
21177
+ };
21178
+ }
21179
+ var _overArg = overArg$1;
21180
+
21181
+ var overArg = _overArg;
21182
+
21183
+ /** Built-in value references. */
21184
+ var getPrototype$1 = overArg(Object.getPrototypeOf, Object);
21185
+ var _getPrototype = getPrototype$1;
21186
+
21187
+ var baseGetTag = _baseGetTag,
21188
+ getPrototype = _getPrototype,
21189
+ isObjectLike = isObjectLike_1;
21190
+
21191
+ /** `Object#toString` result references. */
21192
+ var objectTag = '[object Object]';
21193
+
21194
+ /** Used for built-in method references. */
21195
+ var funcProto = Function.prototype,
21196
+ objectProto = Object.prototype;
21197
+
21198
+ /** Used to resolve the decompiled source of functions. */
21199
+ var funcToString = funcProto.toString;
21200
+
21201
+ /** Used to check objects for own properties. */
21202
+ var hasOwnProperty$1 = objectProto.hasOwnProperty;
21203
+
21204
+ /** Used to infer the `Object` constructor. */
21205
+ var objectCtorString = funcToString.call(Object);
21206
+
21207
+ /**
21208
+ * Checks if `value` is a plain object, that is, an object created by the
21209
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
21210
+ *
21211
+ * @static
21212
+ * @memberOf _
21213
+ * @since 0.8.0
21214
+ * @category Lang
21215
+ * @param {*} value The value to check.
21216
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
21217
+ * @example
21218
+ *
21219
+ * function Foo() {
21220
+ * this.a = 1;
21221
+ * }
21222
+ *
21223
+ * _.isPlainObject(new Foo);
21224
+ * // => false
21225
+ *
21226
+ * _.isPlainObject([1, 2, 3]);
21227
+ * // => false
21228
+ *
21229
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
21230
+ * // => true
21231
+ *
21232
+ * _.isPlainObject(Object.create(null));
21233
+ * // => true
21234
+ */
21235
+ function isPlainObject(value) {
21236
+ if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
21237
+ return false;
21238
+ }
21239
+ var proto = getPrototype(value);
21240
+ if (proto === null) {
21241
+ return true;
21242
+ }
21243
+ var Ctor = hasOwnProperty$1.call(proto, 'constructor') && proto.constructor;
21244
+ return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
21245
+ }
21246
+ var isPlainObject_1 = isPlainObject;
21247
+ var isPlainObject$1 = /*@__PURE__*/getDefaultExportFromCjs(isPlainObject_1);
21248
+
21654
21249
  /**
21655
21250
  * Handles errors received from the server. Parses the error into a more useful
21656
21251
  * format, places it in an exception and throws it.
@@ -21660,20 +21255,21 @@ function toPlainObject(data) {
21660
21255
  * @private
21661
21256
  */
21662
21257
  function errorHandler(errorResponse) {
21663
- var config = errorResponse.config,
21664
- response = errorResponse.response;
21665
- var errorName;
21666
-
21258
+ const {
21259
+ config,
21260
+ response
21261
+ } = errorResponse;
21262
+ let errorName;
21667
21263
  // Obscure the Management token
21668
21264
  if (config && config.headers && config.headers['Authorization']) {
21669
- var token = "...".concat(config.headers['Authorization'].toString().substr(-5));
21670
- config.headers['Authorization'] = "Bearer ".concat(token);
21265
+ const token = `...${config.headers['Authorization'].toString().substr(-5)}`;
21266
+ config.headers['Authorization'] = `Bearer ${token}`;
21671
21267
  }
21672
21268
  if (!isPlainObject$1(response) || !isPlainObject$1(config)) {
21673
21269
  throw errorResponse;
21674
21270
  }
21675
- var data = response === null || response === void 0 ? void 0 : response.data;
21676
- var errorData = {
21271
+ const data = response === null || response === void 0 ? void 0 : response.data;
21272
+ const errorData = {
21677
21273
  status: response === null || response === void 0 ? void 0 : response.status,
21678
21274
  statusText: response === null || response === void 0 ? void 0 : response.statusText,
21679
21275
  message: '',
@@ -21687,7 +21283,7 @@ function errorHandler(errorResponse) {
21687
21283
  payloadData: config.data
21688
21284
  };
21689
21285
  }
21690
- if (data && _typeof$1(data) === 'object') {
21286
+ if (data && typeof data === 'object') {
21691
21287
  var _data$sys;
21692
21288
  if ('requestId' in data) {
21693
21289
  errorData.requestId = data.requestId || 'UNKNOWN';
@@ -21700,8 +21296,8 @@ function errorHandler(errorResponse) {
21700
21296
  }
21701
21297
  errorName = (_data$sys = data.sys) === null || _data$sys === void 0 ? void 0 : _data$sys.id;
21702
21298
  }
21703
- var error = new Error();
21704
- error.name = errorName && errorName !== 'Unknown' ? errorName : "".concat(response === null || response === void 0 ? void 0 : response.status, " ").concat(response === null || response === void 0 ? void 0 : response.statusText);
21299
+ const error = new Error();
21300
+ error.name = errorName && errorName !== 'Unknown' ? errorName : `${response === null || response === void 0 ? void 0 : response.status} ${response === null || response === void 0 ? void 0 : response.statusText}`;
21705
21301
  try {
21706
21302
  error.message = JSON.stringify(errorData, null, ' ');
21707
21303
  } catch (_unused) {
@@ -23319,7 +22915,7 @@ function createContentfulApi({
23319
22915
  http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
23320
22916
  }
23321
22917
  return {
23322
- version: "11.2.2",
22918
+ version: "11.2.3",
23323
22919
  getSpace,
23324
22920
  getContentType,
23325
22921
  getContentTypes,
@@ -23438,7 +23034,7 @@ function createClient(params) {
23438
23034
  environment: 'master'
23439
23035
  };
23440
23036
  const config = Object.assign(Object.assign({}, defaultConfig), params);
23441
- const userAgentHeader = getUserAgentHeader(`contentful.js/${"11.2.2"}`, config.application, config.integration);
23037
+ const userAgentHeader = getUserAgentHeader(`contentful.js/${"11.2.3"}`, config.application, config.integration);
23442
23038
  config.headers = Object.assign(Object.assign({}, config.headers), {
23443
23039
  'Content-Type': 'application/vnd.contentful.delivery.v1+json',
23444
23040
  'X-Contentful-User-Agent': userAgentHeader