@dereekb/zoho 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/index.cjs.d.ts +1 -0
  4. package/index.cjs.js +3353 -0
  5. package/index.esm.js +4396 -0
  6. package/nestjs/CHANGELOG.md +16 -0
  7. package/nestjs/README.md +11 -0
  8. package/nestjs/package.json +6 -0
  9. package/nestjs/src/index.d.ts +1 -0
  10. package/nestjs/src/index.js +5 -0
  11. package/nestjs/src/index.js.map +1 -0
  12. package/nestjs/src/lib/accounts/accounts.api.d.ts +11 -0
  13. package/nestjs/src/lib/accounts/accounts.api.js +33 -0
  14. package/nestjs/src/lib/accounts/accounts.api.js.map +1 -0
  15. package/nestjs/src/lib/accounts/accounts.config.d.ts +15 -0
  16. package/nestjs/src/lib/accounts/accounts.config.js +48 -0
  17. package/nestjs/src/lib/accounts/accounts.config.js.map +1 -0
  18. package/nestjs/src/lib/accounts/accounts.service.d.ts +34 -0
  19. package/nestjs/src/lib/accounts/accounts.service.js +152 -0
  20. package/nestjs/src/lib/accounts/accounts.service.js.map +1 -0
  21. package/nestjs/src/lib/accounts/index.d.ts +3 -0
  22. package/nestjs/src/lib/accounts/index.js +7 -0
  23. package/nestjs/src/lib/accounts/index.js.map +1 -0
  24. package/nestjs/src/lib/index.d.ts +3 -0
  25. package/nestjs/src/lib/index.js +7 -0
  26. package/nestjs/src/lib/index.js.map +1 -0
  27. package/nestjs/src/lib/recruit/index.d.ts +3 -0
  28. package/nestjs/src/lib/recruit/index.js +7 -0
  29. package/nestjs/src/lib/recruit/index.js.map +1 -0
  30. package/nestjs/src/lib/recruit/recruit.api.d.ts +16 -0
  31. package/nestjs/src/lib/recruit/recruit.api.js +47 -0
  32. package/nestjs/src/lib/recruit/recruit.api.js.map +1 -0
  33. package/nestjs/src/lib/recruit/recruit.config.d.ts +10 -0
  34. package/nestjs/src/lib/recruit/recruit.config.js +14 -0
  35. package/nestjs/src/lib/recruit/recruit.config.js.map +1 -0
  36. package/nestjs/src/lib/recruit/recruit.module.d.ts +7 -0
  37. package/nestjs/src/lib/recruit/recruit.module.js +54 -0
  38. package/nestjs/src/lib/recruit/recruit.module.js.map +1 -0
  39. package/nestjs/src/lib/zoho.config.d.ts +27 -0
  40. package/nestjs/src/lib/zoho.config.js +52 -0
  41. package/nestjs/src/lib/zoho.config.js.map +1 -0
  42. package/package.json +30 -0
  43. package/src/index.d.ts +1 -0
  44. package/src/lib/accounts/accounts.api.d.ts +27 -0
  45. package/src/lib/accounts/accounts.config.d.ts +45 -0
  46. package/src/lib/accounts/accounts.d.ts +75 -0
  47. package/src/lib/accounts/accounts.error.api.d.ts +28 -0
  48. package/src/lib/accounts/accounts.factory.d.ts +34 -0
  49. package/src/lib/accounts/index.d.ts +5 -0
  50. package/src/lib/index.d.ts +6 -0
  51. package/src/lib/recruit/index.d.ts +5 -0
  52. package/src/lib/recruit/recruit.api.d.ts +144 -0
  53. package/src/lib/recruit/recruit.config.d.ts +23 -0
  54. package/src/lib/recruit/recruit.d.ts +108 -0
  55. package/src/lib/recruit/recruit.error.api.d.ts +29 -0
  56. package/src/lib/recruit/recruit.factory.d.ts +16 -0
  57. package/src/lib/zoho.api.page.d.ts +37 -0
  58. package/src/lib/zoho.config.d.ts +35 -0
  59. package/src/lib/zoho.error.api.d.ts +145 -0
  60. package/src/lib/zoho.type.d.ts +20 -0
package/index.esm.js ADDED
@@ -0,0 +1,4396 @@
1
+ import { escapeStringCharactersFunction, filterMaybeValues, asArray, MS_IN_MINUTE, MS_IN_SECOND } from '@dereekb/util';
2
+ import { BaseError } from 'make-error';
3
+ import { FetchResponseError, FetchRequestFactoryError, fetchJsonFunction, returnNullHandleFetchJsonParseErrorFunction, nodeFetchService } from '@dereekb/util/fetch';
4
+
5
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
+
7
+ var fails$f = function (exec) {
8
+ try {
9
+ return !!exec();
10
+ } catch (error) {
11
+ return true;
12
+ }
13
+ };
14
+
15
+ var fails$e = fails$f;
16
+
17
+ // Detect IE8's incomplete defineProperty implementation
18
+ var descriptors = !fails$e(function () {
19
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
20
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
21
+ });
22
+
23
+ var fails$d = fails$f;
24
+
25
+ var functionBindNative = !fails$d(function () {
26
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
27
+ var test = (function () { /* empty */ }).bind();
28
+ // eslint-disable-next-line no-prototype-builtins -- safe
29
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
30
+ });
31
+
32
+ var NATIVE_BIND$3 = functionBindNative;
33
+
34
+ var FunctionPrototype$2 = Function.prototype;
35
+ var call$f = FunctionPrototype$2.call;
36
+ var uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$2.bind.bind(call$f, call$f);
37
+
38
+ var functionUncurryThis = NATIVE_BIND$3 ? uncurryThisWithBind : function (fn) {
39
+ return function () {
40
+ return call$f.apply(fn, arguments);
41
+ };
42
+ };
43
+
44
+ // we can't use just `it == null` since of `document.all` special case
45
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
46
+ var isNullOrUndefined$4 = function (it) {
47
+ return it === null || it === undefined;
48
+ };
49
+
50
+ var isNullOrUndefined$3 = isNullOrUndefined$4;
51
+
52
+ var $TypeError$d = TypeError;
53
+
54
+ // `RequireObjectCoercible` abstract operation
55
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
56
+ var requireObjectCoercible$2 = function (it) {
57
+ if (isNullOrUndefined$3(it)) throw new $TypeError$d("Can't call method on " + it);
58
+ return it;
59
+ };
60
+
61
+ var requireObjectCoercible$1 = requireObjectCoercible$2;
62
+
63
+ var $Object$4 = Object;
64
+
65
+ // `ToObject` abstract operation
66
+ // https://tc39.es/ecma262/#sec-toobject
67
+ var toObject$4 = function (argument) {
68
+ return $Object$4(requireObjectCoercible$1(argument));
69
+ };
70
+
71
+ var uncurryThis$f = functionUncurryThis;
72
+ var toObject$3 = toObject$4;
73
+
74
+ var hasOwnProperty = uncurryThis$f({}.hasOwnProperty);
75
+
76
+ // `HasOwnProperty` abstract operation
77
+ // https://tc39.es/ecma262/#sec-hasownproperty
78
+ // eslint-disable-next-line es/no-object-hasown -- safe
79
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
80
+ return hasOwnProperty(toObject$3(it), key);
81
+ };
82
+
83
+ var DESCRIPTORS$d = descriptors;
84
+ var hasOwn$b = hasOwnProperty_1;
85
+
86
+ var FunctionPrototype$1 = Function.prototype;
87
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
88
+ var getDescriptor = DESCRIPTORS$d && Object.getOwnPropertyDescriptor;
89
+
90
+ var EXISTS$1 = hasOwn$b(FunctionPrototype$1, 'name');
91
+ // additional protection from minified / mangled / dropped function names
92
+ var PROPER = EXISTS$1 && (function something() { /* empty */ }).name === 'something';
93
+ var CONFIGURABLE$1 = EXISTS$1 && (!DESCRIPTORS$d || (DESCRIPTORS$d && getDescriptor(FunctionPrototype$1, 'name').configurable));
94
+
95
+ var functionName = {
96
+ EXISTS: EXISTS$1,
97
+ PROPER: PROPER,
98
+ CONFIGURABLE: CONFIGURABLE$1
99
+ };
100
+
101
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
102
+ var documentAll = typeof document == 'object' && document.all;
103
+
104
+ // `IsCallable` abstract operation
105
+ // https://tc39.es/ecma262/#sec-iscallable
106
+ // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
107
+ var isCallable$k = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
108
+ return typeof argument == 'function' || argument === documentAll;
109
+ } : function (argument) {
110
+ return typeof argument == 'function';
111
+ };
112
+
113
+ var objectDefineProperty = {};
114
+
115
+ var check = function (it) {
116
+ return it && it.Math === Math && it;
117
+ };
118
+
119
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
120
+ var global$k =
121
+ // eslint-disable-next-line es/no-global-this -- safe
122
+ check(typeof globalThis == 'object' && globalThis) ||
123
+ check(typeof window == 'object' && window) ||
124
+ // eslint-disable-next-line no-restricted-globals -- safe
125
+ check(typeof self == 'object' && self) ||
126
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
127
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
128
+ // eslint-disable-next-line no-new-func -- fallback
129
+ (function () { return this; })() || Function('return this')();
130
+
131
+ var isCallable$j = isCallable$k;
132
+
133
+ var isObject$b = function (it) {
134
+ return typeof it == 'object' ? it !== null : isCallable$j(it);
135
+ };
136
+
137
+ var global$j = global$k;
138
+ var isObject$a = isObject$b;
139
+
140
+ var document$3 = global$j.document;
141
+ // typeof document.createElement is 'object' in old IE
142
+ var EXISTS = isObject$a(document$3) && isObject$a(document$3.createElement);
143
+
144
+ var documentCreateElement$2 = function (it) {
145
+ return EXISTS ? document$3.createElement(it) : {};
146
+ };
147
+
148
+ var DESCRIPTORS$c = descriptors;
149
+ var fails$c = fails$f;
150
+ var createElement$1 = documentCreateElement$2;
151
+
152
+ // Thanks to IE8 for its funny defineProperty
153
+ var ie8DomDefine = !DESCRIPTORS$c && !fails$c(function () {
154
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
155
+ return Object.defineProperty(createElement$1('div'), 'a', {
156
+ get: function () { return 7; }
157
+ }).a !== 7;
158
+ });
159
+
160
+ var DESCRIPTORS$b = descriptors;
161
+ var fails$b = fails$f;
162
+
163
+ // V8 ~ Chrome 36-
164
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
165
+ var v8PrototypeDefineBug = DESCRIPTORS$b && fails$b(function () {
166
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
167
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
168
+ value: 42,
169
+ writable: false
170
+ }).prototype !== 42;
171
+ });
172
+
173
+ var isObject$9 = isObject$b;
174
+
175
+ var $String$5 = String;
176
+ var $TypeError$c = TypeError;
177
+
178
+ // `Assert: Type(argument) is Object`
179
+ var anObject$d = function (argument) {
180
+ if (isObject$9(argument)) return argument;
181
+ throw new $TypeError$c($String$5(argument) + ' is not an object');
182
+ };
183
+
184
+ var NATIVE_BIND$2 = functionBindNative;
185
+
186
+ var call$e = Function.prototype.call;
187
+
188
+ var functionCall = NATIVE_BIND$2 ? call$e.bind(call$e) : function () {
189
+ return call$e.apply(call$e, arguments);
190
+ };
191
+
192
+ var global$i = global$k;
193
+ var isCallable$i = isCallable$k;
194
+
195
+ var aFunction = function (argument) {
196
+ return isCallable$i(argument) ? argument : undefined;
197
+ };
198
+
199
+ var getBuiltIn$7 = function (namespace, method) {
200
+ return arguments.length < 2 ? aFunction(global$i[namespace]) : global$i[namespace] && global$i[namespace][method];
201
+ };
202
+
203
+ var uncurryThis$e = functionUncurryThis;
204
+
205
+ var objectIsPrototypeOf = uncurryThis$e({}.isPrototypeOf);
206
+
207
+ var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
208
+
209
+ var global$h = global$k;
210
+ var userAgent$3 = engineUserAgent;
211
+
212
+ var process$3 = global$h.process;
213
+ var Deno$1 = global$h.Deno;
214
+ var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version;
215
+ var v8 = versions && versions.v8;
216
+ var match, version;
217
+
218
+ if (v8) {
219
+ match = v8.split('.');
220
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
221
+ // but their correct versions are not interesting for us
222
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
223
+ }
224
+
225
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
226
+ // so check `userAgent` even if `.v8` exists, but 0
227
+ if (!version && userAgent$3) {
228
+ match = userAgent$3.match(/Edge\/(\d+)/);
229
+ if (!match || match[1] >= 74) {
230
+ match = userAgent$3.match(/Chrome\/(\d+)/);
231
+ if (match) version = +match[1];
232
+ }
233
+ }
234
+
235
+ var engineV8Version = version;
236
+
237
+ /* eslint-disable es/no-symbol -- required for testing */
238
+ var V8_VERSION$1 = engineV8Version;
239
+ var fails$a = fails$f;
240
+ var global$g = global$k;
241
+
242
+ var $String$4 = global$g.String;
243
+
244
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
245
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$a(function () {
246
+ var symbol = Symbol('symbol detection');
247
+ // Chrome 38 Symbol has incorrect toString conversion
248
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
249
+ // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
250
+ // of course, fail.
251
+ return !$String$4(symbol) || !(Object(symbol) instanceof Symbol) ||
252
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
253
+ !Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
254
+ });
255
+
256
+ /* eslint-disable es/no-symbol -- required for testing */
257
+ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
258
+
259
+ var useSymbolAsUid = NATIVE_SYMBOL$1
260
+ && !Symbol.sham
261
+ && typeof Symbol.iterator == 'symbol';
262
+
263
+ var getBuiltIn$6 = getBuiltIn$7;
264
+ var isCallable$h = isCallable$k;
265
+ var isPrototypeOf$3 = objectIsPrototypeOf;
266
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
267
+
268
+ var $Object$3 = Object;
269
+
270
+ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
271
+ return typeof it == 'symbol';
272
+ } : function (it) {
273
+ var $Symbol = getBuiltIn$6('Symbol');
274
+ return isCallable$h($Symbol) && isPrototypeOf$3($Symbol.prototype, $Object$3(it));
275
+ };
276
+
277
+ var $String$3 = String;
278
+
279
+ var tryToString$4 = function (argument) {
280
+ try {
281
+ return $String$3(argument);
282
+ } catch (error) {
283
+ return 'Object';
284
+ }
285
+ };
286
+
287
+ var isCallable$g = isCallable$k;
288
+ var tryToString$3 = tryToString$4;
289
+
290
+ var $TypeError$b = TypeError;
291
+
292
+ // `Assert: IsCallable(argument) is true`
293
+ var aCallable$9 = function (argument) {
294
+ if (isCallable$g(argument)) return argument;
295
+ throw new $TypeError$b(tryToString$3(argument) + ' is not a function');
296
+ };
297
+
298
+ var aCallable$8 = aCallable$9;
299
+ var isNullOrUndefined$2 = isNullOrUndefined$4;
300
+
301
+ // `GetMethod` abstract operation
302
+ // https://tc39.es/ecma262/#sec-getmethod
303
+ var getMethod$3 = function (V, P) {
304
+ var func = V[P];
305
+ return isNullOrUndefined$2(func) ? undefined : aCallable$8(func);
306
+ };
307
+
308
+ var call$d = functionCall;
309
+ var isCallable$f = isCallable$k;
310
+ var isObject$8 = isObject$b;
311
+
312
+ var $TypeError$a = TypeError;
313
+
314
+ // `OrdinaryToPrimitive` abstract operation
315
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
316
+ var ordinaryToPrimitive$1 = function (input, pref) {
317
+ var fn, val;
318
+ if (pref === 'string' && isCallable$f(fn = input.toString) && !isObject$8(val = call$d(fn, input))) return val;
319
+ if (isCallable$f(fn = input.valueOf) && !isObject$8(val = call$d(fn, input))) return val;
320
+ if (pref !== 'string' && isCallable$f(fn = input.toString) && !isObject$8(val = call$d(fn, input))) return val;
321
+ throw new $TypeError$a("Can't convert object to primitive value");
322
+ };
323
+
324
+ var shared$3 = {exports: {}};
325
+
326
+ var isPure = false;
327
+
328
+ var global$f = global$k;
329
+
330
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
331
+ var defineProperty$6 = Object.defineProperty;
332
+
333
+ var defineGlobalProperty$3 = function (key, value) {
334
+ try {
335
+ defineProperty$6(global$f, key, { value: value, configurable: true, writable: true });
336
+ } catch (error) {
337
+ global$f[key] = value;
338
+ } return value;
339
+ };
340
+
341
+ var global$e = global$k;
342
+ var defineGlobalProperty$2 = defineGlobalProperty$3;
343
+
344
+ var SHARED = '__core-js_shared__';
345
+ var store$3 = global$e[SHARED] || defineGlobalProperty$2(SHARED, {});
346
+
347
+ var sharedStore = store$3;
348
+
349
+ var store$2 = sharedStore;
350
+
351
+ (shared$3.exports = function (key, value) {
352
+ return store$2[key] || (store$2[key] = value !== undefined ? value : {});
353
+ })('versions', []).push({
354
+ version: '3.35.1',
355
+ mode: 'global',
356
+ copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
357
+ license: 'https://github.com/zloirock/core-js/blob/v3.35.1/LICENSE',
358
+ source: 'https://github.com/zloirock/core-js'
359
+ });
360
+
361
+ var uncurryThis$d = functionUncurryThis;
362
+
363
+ var id = 0;
364
+ var postfix = Math.random();
365
+ var toString$2 = uncurryThis$d(1.0.toString);
366
+
367
+ var uid$2 = function (key) {
368
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$2(++id + postfix, 36);
369
+ };
370
+
371
+ var global$d = global$k;
372
+ var shared$2 = shared$3.exports;
373
+ var hasOwn$a = hasOwnProperty_1;
374
+ var uid$1 = uid$2;
375
+ var NATIVE_SYMBOL = symbolConstructorDetection;
376
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
377
+
378
+ var Symbol$1 = global$d.Symbol;
379
+ var WellKnownSymbolsStore = shared$2('wks');
380
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
381
+
382
+ var wellKnownSymbol$h = function (name) {
383
+ if (!hasOwn$a(WellKnownSymbolsStore, name)) {
384
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$a(Symbol$1, name)
385
+ ? Symbol$1[name]
386
+ : createWellKnownSymbol('Symbol.' + name);
387
+ } return WellKnownSymbolsStore[name];
388
+ };
389
+
390
+ var call$c = functionCall;
391
+ var isObject$7 = isObject$b;
392
+ var isSymbol$1 = isSymbol$2;
393
+ var getMethod$2 = getMethod$3;
394
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
395
+ var wellKnownSymbol$g = wellKnownSymbol$h;
396
+
397
+ var $TypeError$9 = TypeError;
398
+ var TO_PRIMITIVE = wellKnownSymbol$g('toPrimitive');
399
+
400
+ // `ToPrimitive` abstract operation
401
+ // https://tc39.es/ecma262/#sec-toprimitive
402
+ var toPrimitive$1 = function (input, pref) {
403
+ if (!isObject$7(input) || isSymbol$1(input)) return input;
404
+ var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
405
+ var result;
406
+ if (exoticToPrim) {
407
+ if (pref === undefined) pref = 'default';
408
+ result = call$c(exoticToPrim, input, pref);
409
+ if (!isObject$7(result) || isSymbol$1(result)) return result;
410
+ throw new $TypeError$9("Can't convert object to primitive value");
411
+ }
412
+ if (pref === undefined) pref = 'number';
413
+ return ordinaryToPrimitive(input, pref);
414
+ };
415
+
416
+ var toPrimitive = toPrimitive$1;
417
+ var isSymbol = isSymbol$2;
418
+
419
+ // `ToPropertyKey` abstract operation
420
+ // https://tc39.es/ecma262/#sec-topropertykey
421
+ var toPropertyKey$2 = function (argument) {
422
+ var key = toPrimitive(argument, 'string');
423
+ return isSymbol(key) ? key : key + '';
424
+ };
425
+
426
+ var DESCRIPTORS$a = descriptors;
427
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
428
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
429
+ var anObject$c = anObject$d;
430
+ var toPropertyKey$1 = toPropertyKey$2;
431
+
432
+ var $TypeError$8 = TypeError;
433
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
434
+ var $defineProperty = Object.defineProperty;
435
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
436
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
437
+ var ENUMERABLE = 'enumerable';
438
+ var CONFIGURABLE = 'configurable';
439
+ var WRITABLE = 'writable';
440
+
441
+ // `Object.defineProperty` method
442
+ // https://tc39.es/ecma262/#sec-object.defineproperty
443
+ objectDefineProperty.f = DESCRIPTORS$a ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
444
+ anObject$c(O);
445
+ P = toPropertyKey$1(P);
446
+ anObject$c(Attributes);
447
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
448
+ var current = $getOwnPropertyDescriptor$1(O, P);
449
+ if (current && current[WRITABLE]) {
450
+ O[P] = Attributes.value;
451
+ Attributes = {
452
+ configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
453
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
454
+ writable: false
455
+ };
456
+ }
457
+ } return $defineProperty(O, P, Attributes);
458
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
459
+ anObject$c(O);
460
+ P = toPropertyKey$1(P);
461
+ anObject$c(Attributes);
462
+ if (IE8_DOM_DEFINE$1) try {
463
+ return $defineProperty(O, P, Attributes);
464
+ } catch (error) { /* empty */ }
465
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$8('Accessors not supported');
466
+ if ('value' in Attributes) O[P] = Attributes.value;
467
+ return O;
468
+ };
469
+
470
+ var makeBuiltIn$3 = {exports: {}};
471
+
472
+ var uncurryThis$c = functionUncurryThis;
473
+ var isCallable$e = isCallable$k;
474
+ var store$1 = sharedStore;
475
+
476
+ var functionToString = uncurryThis$c(Function.toString);
477
+
478
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
479
+ if (!isCallable$e(store$1.inspectSource)) {
480
+ store$1.inspectSource = function (it) {
481
+ return functionToString(it);
482
+ };
483
+ }
484
+
485
+ var inspectSource$3 = store$1.inspectSource;
486
+
487
+ var global$c = global$k;
488
+ var isCallable$d = isCallable$k;
489
+
490
+ var WeakMap$1 = global$c.WeakMap;
491
+
492
+ var weakMapBasicDetection = isCallable$d(WeakMap$1) && /native code/.test(String(WeakMap$1));
493
+
494
+ var createPropertyDescriptor$4 = function (bitmap, value) {
495
+ return {
496
+ enumerable: !(bitmap & 1),
497
+ configurable: !(bitmap & 2),
498
+ writable: !(bitmap & 4),
499
+ value: value
500
+ };
501
+ };
502
+
503
+ var DESCRIPTORS$9 = descriptors;
504
+ var definePropertyModule$3 = objectDefineProperty;
505
+ var createPropertyDescriptor$3 = createPropertyDescriptor$4;
506
+
507
+ var createNonEnumerableProperty$4 = DESCRIPTORS$9 ? function (object, key, value) {
508
+ return definePropertyModule$3.f(object, key, createPropertyDescriptor$3(1, value));
509
+ } : function (object, key, value) {
510
+ object[key] = value;
511
+ return object;
512
+ };
513
+
514
+ var shared$1 = shared$3.exports;
515
+ var uid = uid$2;
516
+
517
+ var keys = shared$1('keys');
518
+
519
+ var sharedKey$3 = function (key) {
520
+ return keys[key] || (keys[key] = uid(key));
521
+ };
522
+
523
+ var hiddenKeys$4 = {};
524
+
525
+ var NATIVE_WEAK_MAP = weakMapBasicDetection;
526
+ var global$b = global$k;
527
+ var isObject$6 = isObject$b;
528
+ var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
529
+ var hasOwn$9 = hasOwnProperty_1;
530
+ var shared = sharedStore;
531
+ var sharedKey$2 = sharedKey$3;
532
+ var hiddenKeys$3 = hiddenKeys$4;
533
+
534
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
535
+ var TypeError$3 = global$b.TypeError;
536
+ var WeakMap = global$b.WeakMap;
537
+ var set$1, get, has;
538
+
539
+ var enforce = function (it) {
540
+ return has(it) ? get(it) : set$1(it, {});
541
+ };
542
+
543
+ var getterFor = function (TYPE) {
544
+ return function (it) {
545
+ var state;
546
+ if (!isObject$6(it) || (state = get(it)).type !== TYPE) {
547
+ throw new TypeError$3('Incompatible receiver, ' + TYPE + ' required');
548
+ } return state;
549
+ };
550
+ };
551
+
552
+ if (NATIVE_WEAK_MAP || shared.state) {
553
+ var store = shared.state || (shared.state = new WeakMap());
554
+ /* eslint-disable no-self-assign -- prototype methods protection */
555
+ store.get = store.get;
556
+ store.has = store.has;
557
+ store.set = store.set;
558
+ /* eslint-enable no-self-assign -- prototype methods protection */
559
+ set$1 = function (it, metadata) {
560
+ if (store.has(it)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED);
561
+ metadata.facade = it;
562
+ store.set(it, metadata);
563
+ return metadata;
564
+ };
565
+ get = function (it) {
566
+ return store.get(it) || {};
567
+ };
568
+ has = function (it) {
569
+ return store.has(it);
570
+ };
571
+ } else {
572
+ var STATE = sharedKey$2('state');
573
+ hiddenKeys$3[STATE] = true;
574
+ set$1 = function (it, metadata) {
575
+ if (hasOwn$9(it, STATE)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED);
576
+ metadata.facade = it;
577
+ createNonEnumerableProperty$3(it, STATE, metadata);
578
+ return metadata;
579
+ };
580
+ get = function (it) {
581
+ return hasOwn$9(it, STATE) ? it[STATE] : {};
582
+ };
583
+ has = function (it) {
584
+ return hasOwn$9(it, STATE);
585
+ };
586
+ }
587
+
588
+ var internalState = {
589
+ set: set$1,
590
+ get: get,
591
+ has: has,
592
+ enforce: enforce,
593
+ getterFor: getterFor
594
+ };
595
+
596
+ var uncurryThis$b = functionUncurryThis;
597
+ var fails$9 = fails$f;
598
+ var isCallable$c = isCallable$k;
599
+ var hasOwn$8 = hasOwnProperty_1;
600
+ var DESCRIPTORS$8 = descriptors;
601
+ var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
602
+ var inspectSource$2 = inspectSource$3;
603
+ var InternalStateModule$3 = internalState;
604
+
605
+ var enforceInternalState = InternalStateModule$3.enforce;
606
+ var getInternalState$1 = InternalStateModule$3.get;
607
+ var $String$2 = String;
608
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
609
+ var defineProperty$5 = Object.defineProperty;
610
+ var stringSlice$2 = uncurryThis$b(''.slice);
611
+ var replace$1 = uncurryThis$b(''.replace);
612
+ var join$1 = uncurryThis$b([].join);
613
+
614
+ var CONFIGURABLE_LENGTH = DESCRIPTORS$8 && !fails$9(function () {
615
+ return defineProperty$5(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
616
+ });
617
+
618
+ var TEMPLATE = String(String).split('String');
619
+
620
+ var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
621
+ if (stringSlice$2($String$2(name), 0, 7) === 'Symbol(') {
622
+ name = '[' + replace$1($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
623
+ }
624
+ if (options && options.getter) name = 'get ' + name;
625
+ if (options && options.setter) name = 'set ' + name;
626
+ if (!hasOwn$8(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
627
+ if (DESCRIPTORS$8) defineProperty$5(value, 'name', { value: name, configurable: true });
628
+ else value.name = name;
629
+ }
630
+ if (CONFIGURABLE_LENGTH && options && hasOwn$8(options, 'arity') && value.length !== options.arity) {
631
+ defineProperty$5(value, 'length', { value: options.arity });
632
+ }
633
+ try {
634
+ if (options && hasOwn$8(options, 'constructor') && options.constructor) {
635
+ if (DESCRIPTORS$8) defineProperty$5(value, 'prototype', { writable: false });
636
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
637
+ } else if (value.prototype) value.prototype = undefined;
638
+ } catch (error) { /* empty */ }
639
+ var state = enforceInternalState(value);
640
+ if (!hasOwn$8(state, 'source')) {
641
+ state.source = join$1(TEMPLATE, typeof name == 'string' ? name : '');
642
+ } return value;
643
+ };
644
+
645
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
646
+ // eslint-disable-next-line no-extend-native -- required
647
+ Function.prototype.toString = makeBuiltIn$2(function toString() {
648
+ return isCallable$c(this) && getInternalState$1(this).source || inspectSource$2(this);
649
+ }, 'toString');
650
+
651
+ var isCallable$b = isCallable$k;
652
+ var definePropertyModule$2 = objectDefineProperty;
653
+ var makeBuiltIn$1 = makeBuiltIn$3.exports;
654
+ var defineGlobalProperty$1 = defineGlobalProperty$3;
655
+
656
+ var defineBuiltIn$8 = function (O, key, value, options) {
657
+ if (!options) options = {};
658
+ var simple = options.enumerable;
659
+ var name = options.name !== undefined ? options.name : key;
660
+ if (isCallable$b(value)) makeBuiltIn$1(value, name, options);
661
+ if (options.global) {
662
+ if (simple) O[key] = value;
663
+ else defineGlobalProperty$1(key, value);
664
+ } else {
665
+ try {
666
+ if (!options.unsafe) delete O[key];
667
+ else if (O[key]) simple = true;
668
+ } catch (error) { /* empty */ }
669
+ if (simple) O[key] = value;
670
+ else definePropertyModule$2.f(O, key, {
671
+ value: value,
672
+ enumerable: false,
673
+ configurable: !options.nonConfigurable,
674
+ writable: !options.nonWritable
675
+ });
676
+ } return O;
677
+ };
678
+
679
+ var wellKnownSymbol$f = wellKnownSymbol$h;
680
+
681
+ var TO_STRING_TAG$2 = wellKnownSymbol$f('toStringTag');
682
+ var test = {};
683
+
684
+ test[TO_STRING_TAG$2] = 'z';
685
+
686
+ var toStringTagSupport = String(test) === '[object z]';
687
+
688
+ var uncurryThis$a = functionUncurryThis;
689
+
690
+ var toString$1 = uncurryThis$a({}.toString);
691
+ var stringSlice$1 = uncurryThis$a(''.slice);
692
+
693
+ var classofRaw$2 = function (it) {
694
+ return stringSlice$1(toString$1(it), 8, -1);
695
+ };
696
+
697
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
698
+ var isCallable$a = isCallable$k;
699
+ var classofRaw$1 = classofRaw$2;
700
+ var wellKnownSymbol$e = wellKnownSymbol$h;
701
+
702
+ var TO_STRING_TAG$1 = wellKnownSymbol$e('toStringTag');
703
+ var $Object$2 = Object;
704
+
705
+ // ES3 wrong here
706
+ var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments';
707
+
708
+ // fallback for IE11 Script Access Denied error
709
+ var tryGet = function (it, key) {
710
+ try {
711
+ return it[key];
712
+ } catch (error) { /* empty */ }
713
+ };
714
+
715
+ // getting tag from ES6+ `Object.prototype.toString`
716
+ var classof$7 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
717
+ var O, tag, result;
718
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
719
+ // @@toStringTag case
720
+ : typeof (tag = tryGet(O = $Object$2(it), TO_STRING_TAG$1)) == 'string' ? tag
721
+ // builtinTag case
722
+ : CORRECT_ARGUMENTS ? classofRaw$1(O)
723
+ // ES3 arguments fallback
724
+ : (result = classofRaw$1(O)) === 'Object' && isCallable$a(O.callee) ? 'Arguments' : result;
725
+ };
726
+
727
+ var classof$6 = classof$7;
728
+
729
+ var $String$1 = String;
730
+
731
+ var toString = function (argument) {
732
+ if (classof$6(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
733
+ return $String$1(argument);
734
+ };
735
+
736
+ var anObject$b = anObject$d;
737
+
738
+ // `RegExp.prototype.flags` getter implementation
739
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
740
+ var regexpFlags = function () {
741
+ var that = anObject$b(this);
742
+ var result = '';
743
+ if (that.hasIndices) result += 'd';
744
+ if (that.global) result += 'g';
745
+ if (that.ignoreCase) result += 'i';
746
+ if (that.multiline) result += 'm';
747
+ if (that.dotAll) result += 's';
748
+ if (that.unicode) result += 'u';
749
+ if (that.unicodeSets) result += 'v';
750
+ if (that.sticky) result += 'y';
751
+ return result;
752
+ };
753
+
754
+ var call$b = functionCall;
755
+ var hasOwn$7 = hasOwnProperty_1;
756
+ var isPrototypeOf$2 = objectIsPrototypeOf;
757
+ var regExpFlags = regexpFlags;
758
+
759
+ var RegExpPrototype$1 = RegExp.prototype;
760
+
761
+ var regexpGetFlags = function (R) {
762
+ var flags = R.flags;
763
+ return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$7(R, 'flags') && isPrototypeOf$2(RegExpPrototype$1, R)
764
+ ? call$b(regExpFlags, R) : flags;
765
+ };
766
+
767
+ var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
768
+ var defineBuiltIn$7 = defineBuiltIn$8;
769
+ var anObject$a = anObject$d;
770
+ var $toString$1 = toString;
771
+ var fails$8 = fails$f;
772
+ var getRegExpFlags = regexpGetFlags;
773
+
774
+ var TO_STRING = 'toString';
775
+ var RegExpPrototype = RegExp.prototype;
776
+ var nativeToString = RegExpPrototype[TO_STRING];
777
+
778
+ var NOT_GENERIC = fails$8(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
779
+ // FF44- RegExp#toString has a wrong name
780
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && nativeToString.name !== TO_STRING;
781
+
782
+ // `RegExp.prototype.toString` method
783
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
784
+ if (NOT_GENERIC || INCORRECT_NAME) {
785
+ defineBuiltIn$7(RegExpPrototype, TO_STRING, function toString() {
786
+ var R = anObject$a(this);
787
+ var pattern = $toString$1(R.source);
788
+ var flags = $toString$1(getRegExpFlags(R));
789
+ return '/' + pattern + '/' + flags;
790
+ }, { unsafe: true });
791
+ }
792
+
793
+ var objectGetOwnPropertyDescriptor = {};
794
+
795
+ var objectPropertyIsEnumerable = {};
796
+
797
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
798
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
799
+ var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
800
+
801
+ // Nashorn ~ JDK8 bug
802
+ var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
803
+
804
+ // `Object.prototype.propertyIsEnumerable` method implementation
805
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
806
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
807
+ var descriptor = getOwnPropertyDescriptor$2(this, V);
808
+ return !!descriptor && descriptor.enumerable;
809
+ } : $propertyIsEnumerable;
810
+
811
+ var uncurryThis$9 = functionUncurryThis;
812
+ var fails$7 = fails$f;
813
+ var classof$5 = classofRaw$2;
814
+
815
+ var $Object$1 = Object;
816
+ var split$1 = uncurryThis$9(''.split);
817
+
818
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
819
+ var indexedObject = fails$7(function () {
820
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
821
+ // eslint-disable-next-line no-prototype-builtins -- safe
822
+ return !$Object$1('z').propertyIsEnumerable(0);
823
+ }) ? function (it) {
824
+ return classof$5(it) === 'String' ? split$1(it, '') : $Object$1(it);
825
+ } : $Object$1;
826
+
827
+ // toObject with fallback for non-array-like ES3 strings
828
+ var IndexedObject$1 = indexedObject;
829
+ var requireObjectCoercible = requireObjectCoercible$2;
830
+
831
+ var toIndexedObject$5 = function (it) {
832
+ return IndexedObject$1(requireObjectCoercible(it));
833
+ };
834
+
835
+ var DESCRIPTORS$7 = descriptors;
836
+ var call$a = functionCall;
837
+ var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
838
+ var createPropertyDescriptor$2 = createPropertyDescriptor$4;
839
+ var toIndexedObject$4 = toIndexedObject$5;
840
+ var toPropertyKey = toPropertyKey$2;
841
+ var hasOwn$6 = hasOwnProperty_1;
842
+ var IE8_DOM_DEFINE = ie8DomDefine;
843
+
844
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
845
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
846
+
847
+ // `Object.getOwnPropertyDescriptor` method
848
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
849
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$7 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
850
+ O = toIndexedObject$4(O);
851
+ P = toPropertyKey(P);
852
+ if (IE8_DOM_DEFINE) try {
853
+ return $getOwnPropertyDescriptor(O, P);
854
+ } catch (error) { /* empty */ }
855
+ if (hasOwn$6(O, P)) return createPropertyDescriptor$2(!call$a(propertyIsEnumerableModule$1.f, O, P), O[P]);
856
+ };
857
+
858
+ var objectGetOwnPropertyNames = {};
859
+
860
+ var ceil = Math.ceil;
861
+ var floor$1 = Math.floor;
862
+
863
+ // `Math.trunc` method
864
+ // https://tc39.es/ecma262/#sec-math.trunc
865
+ // eslint-disable-next-line es/no-math-trunc -- safe
866
+ var mathTrunc = Math.trunc || function trunc(x) {
867
+ var n = +x;
868
+ return (n > 0 ? floor$1 : ceil)(n);
869
+ };
870
+
871
+ var trunc = mathTrunc;
872
+
873
+ // `ToIntegerOrInfinity` abstract operation
874
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
875
+ var toIntegerOrInfinity$2 = function (argument) {
876
+ var number = +argument;
877
+ // eslint-disable-next-line no-self-compare -- NaN check
878
+ return number !== number || number === 0 ? 0 : trunc(number);
879
+ };
880
+
881
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
882
+
883
+ var max = Math.max;
884
+ var min$1 = Math.min;
885
+
886
+ // Helper for a popular repeating case of the spec:
887
+ // Let integer be ? ToInteger(index).
888
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
889
+ var toAbsoluteIndex$1 = function (index, length) {
890
+ var integer = toIntegerOrInfinity$1(index);
891
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
892
+ };
893
+
894
+ var toIntegerOrInfinity = toIntegerOrInfinity$2;
895
+
896
+ var min = Math.min;
897
+
898
+ // `ToLength` abstract operation
899
+ // https://tc39.es/ecma262/#sec-tolength
900
+ var toLength$1 = function (argument) {
901
+ var len = toIntegerOrInfinity(argument);
902
+ return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
903
+ };
904
+
905
+ var toLength = toLength$1;
906
+
907
+ // `LengthOfArrayLike` abstract operation
908
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
909
+ var lengthOfArrayLike$4 = function (obj) {
910
+ return toLength(obj.length);
911
+ };
912
+
913
+ var toIndexedObject$3 = toIndexedObject$5;
914
+ var toAbsoluteIndex = toAbsoluteIndex$1;
915
+ var lengthOfArrayLike$3 = lengthOfArrayLike$4;
916
+
917
+ // `Array.prototype.{ indexOf, includes }` methods implementation
918
+ var createMethod = function (IS_INCLUDES) {
919
+ return function ($this, el, fromIndex) {
920
+ var O = toIndexedObject$3($this);
921
+ var length = lengthOfArrayLike$3(O);
922
+ var index = toAbsoluteIndex(fromIndex, length);
923
+ var value;
924
+ // Array#includes uses SameValueZero equality algorithm
925
+ // eslint-disable-next-line no-self-compare -- NaN check
926
+ if (IS_INCLUDES && el !== el) while (length > index) {
927
+ value = O[index++];
928
+ // eslint-disable-next-line no-self-compare -- NaN check
929
+ if (value !== value) return true;
930
+ // Array#indexOf ignores holes, Array#includes - not
931
+ } else for (;length > index; index++) {
932
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
933
+ } return !IS_INCLUDES && -1;
934
+ };
935
+ };
936
+
937
+ var arrayIncludes = {
938
+ // `Array.prototype.includes` method
939
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
940
+ includes: createMethod(true),
941
+ // `Array.prototype.indexOf` method
942
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
943
+ indexOf: createMethod(false)
944
+ };
945
+
946
+ var uncurryThis$8 = functionUncurryThis;
947
+ var hasOwn$5 = hasOwnProperty_1;
948
+ var toIndexedObject$2 = toIndexedObject$5;
949
+ var indexOf = arrayIncludes.indexOf;
950
+ var hiddenKeys$2 = hiddenKeys$4;
951
+
952
+ var push$1 = uncurryThis$8([].push);
953
+
954
+ var objectKeysInternal = function (object, names) {
955
+ var O = toIndexedObject$2(object);
956
+ var i = 0;
957
+ var result = [];
958
+ var key;
959
+ for (key in O) !hasOwn$5(hiddenKeys$2, key) && hasOwn$5(O, key) && push$1(result, key);
960
+ // Don't enum bug & hidden keys
961
+ while (names.length > i) if (hasOwn$5(O, key = names[i++])) {
962
+ ~indexOf(result, key) || push$1(result, key);
963
+ }
964
+ return result;
965
+ };
966
+
967
+ // IE8- don't enum bug keys
968
+ var enumBugKeys$3 = [
969
+ 'constructor',
970
+ 'hasOwnProperty',
971
+ 'isPrototypeOf',
972
+ 'propertyIsEnumerable',
973
+ 'toLocaleString',
974
+ 'toString',
975
+ 'valueOf'
976
+ ];
977
+
978
+ var internalObjectKeys$1 = objectKeysInternal;
979
+ var enumBugKeys$2 = enumBugKeys$3;
980
+
981
+ var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
982
+
983
+ // `Object.getOwnPropertyNames` method
984
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
985
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
986
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
987
+ return internalObjectKeys$1(O, hiddenKeys$1);
988
+ };
989
+
990
+ var objectGetOwnPropertySymbols = {};
991
+
992
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
993
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
994
+
995
+ var getBuiltIn$5 = getBuiltIn$7;
996
+ var uncurryThis$7 = functionUncurryThis;
997
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
998
+ var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
999
+ var anObject$9 = anObject$d;
1000
+
1001
+ var concat$1 = uncurryThis$7([].concat);
1002
+
1003
+ // all object keys, includes non-enumerable and symbols
1004
+ var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
1005
+ var keys = getOwnPropertyNamesModule.f(anObject$9(it));
1006
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
1007
+ return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
1008
+ };
1009
+
1010
+ var hasOwn$4 = hasOwnProperty_1;
1011
+ var ownKeys = ownKeys$1;
1012
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1013
+ var definePropertyModule$1 = objectDefineProperty;
1014
+
1015
+ var copyConstructorProperties$1 = function (target, source, exceptions) {
1016
+ var keys = ownKeys(source);
1017
+ var defineProperty = definePropertyModule$1.f;
1018
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1019
+ for (var i = 0; i < keys.length; i++) {
1020
+ var key = keys[i];
1021
+ if (!hasOwn$4(target, key) && !(exceptions && hasOwn$4(exceptions, key))) {
1022
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1023
+ }
1024
+ }
1025
+ };
1026
+
1027
+ var fails$6 = fails$f;
1028
+ var isCallable$9 = isCallable$k;
1029
+
1030
+ var replacement = /#|\.prototype\./;
1031
+
1032
+ var isForced$2 = function (feature, detection) {
1033
+ var value = data[normalize(feature)];
1034
+ return value === POLYFILL ? true
1035
+ : value === NATIVE ? false
1036
+ : isCallable$9(detection) ? fails$6(detection)
1037
+ : !!detection;
1038
+ };
1039
+
1040
+ var normalize = isForced$2.normalize = function (string) {
1041
+ return String(string).replace(replacement, '.').toLowerCase();
1042
+ };
1043
+
1044
+ var data = isForced$2.data = {};
1045
+ var NATIVE = isForced$2.NATIVE = 'N';
1046
+ var POLYFILL = isForced$2.POLYFILL = 'P';
1047
+
1048
+ var isForced_1 = isForced$2;
1049
+
1050
+ var global$a = global$k;
1051
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1052
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
1053
+ var defineBuiltIn$6 = defineBuiltIn$8;
1054
+ var defineGlobalProperty = defineGlobalProperty$3;
1055
+ var copyConstructorProperties = copyConstructorProperties$1;
1056
+ var isForced$1 = isForced_1;
1057
+
1058
+ /*
1059
+ options.target - name of the target object
1060
+ options.global - target is the global object
1061
+ options.stat - export as static methods of target
1062
+ options.proto - export as prototype methods of target
1063
+ options.real - real prototype method for the `pure` version
1064
+ options.forced - export even if the native feature is available
1065
+ options.bind - bind methods to the target, required for the `pure` version
1066
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1067
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
1068
+ options.sham - add a flag to not completely full polyfills
1069
+ options.enumerable - export as enumerable property
1070
+ options.dontCallGetSet - prevent calling a getter on target
1071
+ options.name - the .name of the function if it does not match the key
1072
+ */
1073
+ var _export = function (options, source) {
1074
+ var TARGET = options.target;
1075
+ var GLOBAL = options.global;
1076
+ var STATIC = options.stat;
1077
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1078
+ if (GLOBAL) {
1079
+ target = global$a;
1080
+ } else if (STATIC) {
1081
+ target = global$a[TARGET] || defineGlobalProperty(TARGET, {});
1082
+ } else {
1083
+ target = global$a[TARGET] && global$a[TARGET].prototype;
1084
+ }
1085
+ if (target) for (key in source) {
1086
+ sourceProperty = source[key];
1087
+ if (options.dontCallGetSet) {
1088
+ descriptor = getOwnPropertyDescriptor$1(target, key);
1089
+ targetProperty = descriptor && descriptor.value;
1090
+ } else targetProperty = target[key];
1091
+ FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1092
+ // contained in target
1093
+ if (!FORCED && targetProperty !== undefined) {
1094
+ if (typeof sourceProperty == typeof targetProperty) continue;
1095
+ copyConstructorProperties(sourceProperty, targetProperty);
1096
+ }
1097
+ // add a flag to not completely full polyfills
1098
+ if (options.sham || (targetProperty && targetProperty.sham)) {
1099
+ createNonEnumerableProperty$2(sourceProperty, 'sham', true);
1100
+ }
1101
+ defineBuiltIn$6(target, key, sourceProperty, options);
1102
+ }
1103
+ };
1104
+
1105
+ var internalObjectKeys = objectKeysInternal;
1106
+ var enumBugKeys$1 = enumBugKeys$3;
1107
+
1108
+ // `Object.keys` method
1109
+ // https://tc39.es/ecma262/#sec-object.keys
1110
+ // eslint-disable-next-line es/no-object-keys -- safe
1111
+ var objectKeys$2 = Object.keys || function keys(O) {
1112
+ return internalObjectKeys(O, enumBugKeys$1);
1113
+ };
1114
+
1115
+ var DESCRIPTORS$6 = descriptors;
1116
+ var uncurryThis$6 = functionUncurryThis;
1117
+ var call$9 = functionCall;
1118
+ var fails$5 = fails$f;
1119
+ var objectKeys$1 = objectKeys$2;
1120
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1121
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1122
+ var toObject$2 = toObject$4;
1123
+ var IndexedObject = indexedObject;
1124
+
1125
+ // eslint-disable-next-line es/no-object-assign -- safe
1126
+ var $assign = Object.assign;
1127
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1128
+ var defineProperty$4 = Object.defineProperty;
1129
+ var concat = uncurryThis$6([].concat);
1130
+
1131
+ // `Object.assign` method
1132
+ // https://tc39.es/ecma262/#sec-object.assign
1133
+ var objectAssign = !$assign || fails$5(function () {
1134
+ // should have correct order of operations (Edge bug)
1135
+ if (DESCRIPTORS$6 && $assign({ b: 1 }, $assign(defineProperty$4({}, 'a', {
1136
+ enumerable: true,
1137
+ get: function () {
1138
+ defineProperty$4(this, 'b', {
1139
+ value: 3,
1140
+ enumerable: false
1141
+ });
1142
+ }
1143
+ }), { b: 2 })).b !== 1) return true;
1144
+ // should work with symbols and should have deterministic property order (V8 bug)
1145
+ var A = {};
1146
+ var B = {};
1147
+ // eslint-disable-next-line es/no-symbol -- safe
1148
+ var symbol = Symbol('assign detection');
1149
+ var alphabet = 'abcdefghijklmnopqrst';
1150
+ A[symbol] = 7;
1151
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1152
+ return $assign({}, A)[symbol] !== 7 || objectKeys$1($assign({}, B)).join('') !== alphabet;
1153
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1154
+ var T = toObject$2(target);
1155
+ var argumentsLength = arguments.length;
1156
+ var index = 1;
1157
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1158
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
1159
+ while (argumentsLength > index) {
1160
+ var S = IndexedObject(arguments[index++]);
1161
+ var keys = getOwnPropertySymbols ? concat(objectKeys$1(S), getOwnPropertySymbols(S)) : objectKeys$1(S);
1162
+ var length = keys.length;
1163
+ var j = 0;
1164
+ var key;
1165
+ while (length > j) {
1166
+ key = keys[j++];
1167
+ if (!DESCRIPTORS$6 || call$9(propertyIsEnumerable, S, key)) T[key] = S[key];
1168
+ }
1169
+ } return T;
1170
+ } : $assign;
1171
+
1172
+ var $$9 = _export;
1173
+ var assign = objectAssign;
1174
+
1175
+ // `Object.assign` method
1176
+ // https://tc39.es/ecma262/#sec-object.assign
1177
+ // eslint-disable-next-line es/no-object-assign -- required for testing
1178
+ $$9({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1179
+ assign: assign
1180
+ });
1181
+
1182
+ var objectDefineProperties = {};
1183
+
1184
+ var DESCRIPTORS$5 = descriptors;
1185
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1186
+ var definePropertyModule = objectDefineProperty;
1187
+ var anObject$8 = anObject$d;
1188
+ var toIndexedObject$1 = toIndexedObject$5;
1189
+ var objectKeys = objectKeys$2;
1190
+
1191
+ // `Object.defineProperties` method
1192
+ // https://tc39.es/ecma262/#sec-object.defineproperties
1193
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
1194
+ objectDefineProperties.f = DESCRIPTORS$5 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1195
+ anObject$8(O);
1196
+ var props = toIndexedObject$1(Properties);
1197
+ var keys = objectKeys(Properties);
1198
+ var length = keys.length;
1199
+ var index = 0;
1200
+ var key;
1201
+ while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
1202
+ return O;
1203
+ };
1204
+
1205
+ var getBuiltIn$4 = getBuiltIn$7;
1206
+
1207
+ var html$2 = getBuiltIn$4('document', 'documentElement');
1208
+
1209
+ /* global ActiveXObject -- old IE, WSH */
1210
+ var anObject$7 = anObject$d;
1211
+ var definePropertiesModule = objectDefineProperties;
1212
+ var enumBugKeys = enumBugKeys$3;
1213
+ var hiddenKeys = hiddenKeys$4;
1214
+ var html$1 = html$2;
1215
+ var documentCreateElement$1 = documentCreateElement$2;
1216
+ var sharedKey$1 = sharedKey$3;
1217
+
1218
+ var GT = '>';
1219
+ var LT = '<';
1220
+ var PROTOTYPE = 'prototype';
1221
+ var SCRIPT = 'script';
1222
+ var IE_PROTO$1 = sharedKey$1('IE_PROTO');
1223
+
1224
+ var EmptyConstructor = function () { /* empty */ };
1225
+
1226
+ var scriptTag = function (content) {
1227
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1228
+ };
1229
+
1230
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1231
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
1232
+ activeXDocument.write(scriptTag(''));
1233
+ activeXDocument.close();
1234
+ var temp = activeXDocument.parentWindow.Object;
1235
+ activeXDocument = null; // avoid memory leak
1236
+ return temp;
1237
+ };
1238
+
1239
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
1240
+ var NullProtoObjectViaIFrame = function () {
1241
+ // Thrash, waste and sodomy: IE GC bug
1242
+ var iframe = documentCreateElement$1('iframe');
1243
+ var JS = 'java' + SCRIPT + ':';
1244
+ var iframeDocument;
1245
+ iframe.style.display = 'none';
1246
+ html$1.appendChild(iframe);
1247
+ // https://github.com/zloirock/core-js/issues/475
1248
+ iframe.src = String(JS);
1249
+ iframeDocument = iframe.contentWindow.document;
1250
+ iframeDocument.open();
1251
+ iframeDocument.write(scriptTag('document.F=Object'));
1252
+ iframeDocument.close();
1253
+ return iframeDocument.F;
1254
+ };
1255
+
1256
+ // Check for document.domain and active x support
1257
+ // No need to use active x approach when document.domain is not set
1258
+ // see https://github.com/es-shims/es5-shim/issues/150
1259
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1260
+ // avoid IE GC bug
1261
+ var activeXDocument;
1262
+ var NullProtoObject = function () {
1263
+ try {
1264
+ activeXDocument = new ActiveXObject('htmlfile');
1265
+ } catch (error) { /* ignore */ }
1266
+ NullProtoObject = typeof document != 'undefined'
1267
+ ? document.domain && activeXDocument
1268
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1269
+ : NullProtoObjectViaIFrame()
1270
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
1271
+ var length = enumBugKeys.length;
1272
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1273
+ return NullProtoObject();
1274
+ };
1275
+
1276
+ hiddenKeys[IE_PROTO$1] = true;
1277
+
1278
+ // `Object.create` method
1279
+ // https://tc39.es/ecma262/#sec-object.create
1280
+ // eslint-disable-next-line es/no-object-create -- safe
1281
+ var objectCreate = Object.create || function create(O, Properties) {
1282
+ var result;
1283
+ if (O !== null) {
1284
+ EmptyConstructor[PROTOTYPE] = anObject$7(O);
1285
+ result = new EmptyConstructor();
1286
+ EmptyConstructor[PROTOTYPE] = null;
1287
+ // add "__proto__" for Object.getPrototypeOf polyfill
1288
+ result[IE_PROTO$1] = O;
1289
+ } else result = NullProtoObject();
1290
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1291
+ };
1292
+
1293
+ var wellKnownSymbol$d = wellKnownSymbol$h;
1294
+ var create$2 = objectCreate;
1295
+ var defineProperty$3 = objectDefineProperty.f;
1296
+
1297
+ var UNSCOPABLES = wellKnownSymbol$d('unscopables');
1298
+ var ArrayPrototype$1 = Array.prototype;
1299
+
1300
+ // Array.prototype[@@unscopables]
1301
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1302
+ if (ArrayPrototype$1[UNSCOPABLES] === undefined) {
1303
+ defineProperty$3(ArrayPrototype$1, UNSCOPABLES, {
1304
+ configurable: true,
1305
+ value: create$2(null)
1306
+ });
1307
+ }
1308
+
1309
+ // add a key to Array.prototype[@@unscopables]
1310
+ var addToUnscopables$2 = function (key) {
1311
+ ArrayPrototype$1[UNSCOPABLES][key] = true;
1312
+ };
1313
+
1314
+ var iterators = {};
1315
+
1316
+ var fails$4 = fails$f;
1317
+
1318
+ var correctPrototypeGetter = !fails$4(function () {
1319
+ function F() { /* empty */ }
1320
+ F.prototype.constructor = null;
1321
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1322
+ return Object.getPrototypeOf(new F()) !== F.prototype;
1323
+ });
1324
+
1325
+ var hasOwn$3 = hasOwnProperty_1;
1326
+ var isCallable$8 = isCallable$k;
1327
+ var toObject$1 = toObject$4;
1328
+ var sharedKey = sharedKey$3;
1329
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1330
+
1331
+ var IE_PROTO = sharedKey('IE_PROTO');
1332
+ var $Object = Object;
1333
+ var ObjectPrototype = $Object.prototype;
1334
+
1335
+ // `Object.getPrototypeOf` method
1336
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
1337
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
1338
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
1339
+ var object = toObject$1(O);
1340
+ if (hasOwn$3(object, IE_PROTO)) return object[IE_PROTO];
1341
+ var constructor = object.constructor;
1342
+ if (isCallable$8(constructor) && object instanceof constructor) {
1343
+ return constructor.prototype;
1344
+ } return object instanceof $Object ? ObjectPrototype : null;
1345
+ };
1346
+
1347
+ var fails$3 = fails$f;
1348
+ var isCallable$7 = isCallable$k;
1349
+ var isObject$5 = isObject$b;
1350
+ var getPrototypeOf$1 = objectGetPrototypeOf;
1351
+ var defineBuiltIn$5 = defineBuiltIn$8;
1352
+ var wellKnownSymbol$c = wellKnownSymbol$h;
1353
+
1354
+ var ITERATOR$7 = wellKnownSymbol$c('iterator');
1355
+ var BUGGY_SAFARI_ITERATORS$1 = false;
1356
+
1357
+ // `%IteratorPrototype%` object
1358
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1359
+ var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1360
+
1361
+ /* eslint-disable es/no-array-prototype-keys -- safe */
1362
+ if ([].keys) {
1363
+ arrayIterator = [].keys();
1364
+ // Safari 8 has buggy iterators w/o `next`
1365
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1366
+ else {
1367
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1368
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1369
+ }
1370
+ }
1371
+
1372
+ var NEW_ITERATOR_PROTOTYPE = !isObject$5(IteratorPrototype$2) || fails$3(function () {
1373
+ var test = {};
1374
+ // FF44- legacy iterators case
1375
+ return IteratorPrototype$2[ITERATOR$7].call(test) !== test;
1376
+ });
1377
+
1378
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1379
+
1380
+ // `%IteratorPrototype%[@@iterator]()` method
1381
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1382
+ if (!isCallable$7(IteratorPrototype$2[ITERATOR$7])) {
1383
+ defineBuiltIn$5(IteratorPrototype$2, ITERATOR$7, function () {
1384
+ return this;
1385
+ });
1386
+ }
1387
+
1388
+ var iteratorsCore = {
1389
+ IteratorPrototype: IteratorPrototype$2,
1390
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1391
+ };
1392
+
1393
+ var defineProperty$2 = objectDefineProperty.f;
1394
+ var hasOwn$2 = hasOwnProperty_1;
1395
+ var wellKnownSymbol$b = wellKnownSymbol$h;
1396
+
1397
+ var TO_STRING_TAG = wellKnownSymbol$b('toStringTag');
1398
+
1399
+ var setToStringTag$5 = function (target, TAG, STATIC) {
1400
+ if (target && !STATIC) target = target.prototype;
1401
+ if (target && !hasOwn$2(target, TO_STRING_TAG)) {
1402
+ defineProperty$2(target, TO_STRING_TAG, { configurable: true, value: TAG });
1403
+ }
1404
+ };
1405
+
1406
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1407
+ var create$1 = objectCreate;
1408
+ var createPropertyDescriptor$1 = createPropertyDescriptor$4;
1409
+ var setToStringTag$4 = setToStringTag$5;
1410
+ var Iterators$4 = iterators;
1411
+
1412
+ var returnThis$1 = function () { return this; };
1413
+
1414
+ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1415
+ var TO_STRING_TAG = NAME + ' Iterator';
1416
+ IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor$1(+!ENUMERABLE_NEXT, next) });
1417
+ setToStringTag$4(IteratorConstructor, TO_STRING_TAG, false);
1418
+ Iterators$4[TO_STRING_TAG] = returnThis$1;
1419
+ return IteratorConstructor;
1420
+ };
1421
+
1422
+ var uncurryThis$5 = functionUncurryThis;
1423
+ var aCallable$7 = aCallable$9;
1424
+
1425
+ var functionUncurryThisAccessor = function (object, key, method) {
1426
+ try {
1427
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1428
+ return uncurryThis$5(aCallable$7(Object.getOwnPropertyDescriptor(object, key)[method]));
1429
+ } catch (error) { /* empty */ }
1430
+ };
1431
+
1432
+ var isObject$4 = isObject$b;
1433
+
1434
+ var isPossiblePrototype$1 = function (argument) {
1435
+ return isObject$4(argument) || argument === null;
1436
+ };
1437
+
1438
+ var isPossiblePrototype = isPossiblePrototype$1;
1439
+
1440
+ var $String = String;
1441
+ var $TypeError$7 = TypeError;
1442
+
1443
+ var aPossiblePrototype$1 = function (argument) {
1444
+ if (isPossiblePrototype(argument)) return argument;
1445
+ throw new $TypeError$7("Can't set " + $String(argument) + ' as a prototype');
1446
+ };
1447
+
1448
+ /* eslint-disable no-proto -- safe */
1449
+ var uncurryThisAccessor = functionUncurryThisAccessor;
1450
+ var anObject$6 = anObject$d;
1451
+ var aPossiblePrototype = aPossiblePrototype$1;
1452
+
1453
+ // `Object.setPrototypeOf` method
1454
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1455
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1456
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
1457
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1458
+ var CORRECT_SETTER = false;
1459
+ var test = {};
1460
+ var setter;
1461
+ try {
1462
+ setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
1463
+ setter(test, []);
1464
+ CORRECT_SETTER = test instanceof Array;
1465
+ } catch (error) { /* empty */ }
1466
+ return function setPrototypeOf(O, proto) {
1467
+ anObject$6(O);
1468
+ aPossiblePrototype(proto);
1469
+ if (CORRECT_SETTER) setter(O, proto);
1470
+ else O.__proto__ = proto;
1471
+ return O;
1472
+ };
1473
+ }() : undefined);
1474
+
1475
+ var $$8 = _export;
1476
+ var call$8 = functionCall;
1477
+ var FunctionName = functionName;
1478
+ var isCallable$6 = isCallable$k;
1479
+ var createIteratorConstructor$1 = iteratorCreateConstructor;
1480
+ var getPrototypeOf = objectGetPrototypeOf;
1481
+ var setPrototypeOf$1 = objectSetPrototypeOf;
1482
+ var setToStringTag$3 = setToStringTag$5;
1483
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
1484
+ var defineBuiltIn$4 = defineBuiltIn$8;
1485
+ var wellKnownSymbol$a = wellKnownSymbol$h;
1486
+ var Iterators$3 = iterators;
1487
+ var IteratorsCore = iteratorsCore;
1488
+
1489
+ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
1490
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1491
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
1492
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1493
+ var ITERATOR$6 = wellKnownSymbol$a('iterator');
1494
+ var KEYS = 'keys';
1495
+ var VALUES = 'values';
1496
+ var ENTRIES = 'entries';
1497
+
1498
+ var returnThis = function () { return this; };
1499
+
1500
+ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1501
+ createIteratorConstructor$1(IteratorConstructor, NAME, next);
1502
+
1503
+ var getIterationMethod = function (KIND) {
1504
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1505
+ if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
1506
+
1507
+ switch (KIND) {
1508
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1509
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1510
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1511
+ }
1512
+
1513
+ return function () { return new IteratorConstructor(this); };
1514
+ };
1515
+
1516
+ var TO_STRING_TAG = NAME + ' Iterator';
1517
+ var INCORRECT_VALUES_NAME = false;
1518
+ var IterablePrototype = Iterable.prototype;
1519
+ var nativeIterator = IterablePrototype[ITERATOR$6]
1520
+ || IterablePrototype['@@iterator']
1521
+ || DEFAULT && IterablePrototype[DEFAULT];
1522
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1523
+ var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1524
+ var CurrentIteratorPrototype, methods, KEY;
1525
+
1526
+ // fix native
1527
+ if (anyNativeIterator) {
1528
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1529
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1530
+ if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1531
+ if (setPrototypeOf$1) {
1532
+ setPrototypeOf$1(CurrentIteratorPrototype, IteratorPrototype);
1533
+ } else if (!isCallable$6(CurrentIteratorPrototype[ITERATOR$6])) {
1534
+ defineBuiltIn$4(CurrentIteratorPrototype, ITERATOR$6, returnThis);
1535
+ }
1536
+ }
1537
+ // Set @@toStringTag to native iterators
1538
+ setToStringTag$3(CurrentIteratorPrototype, TO_STRING_TAG, true);
1539
+ }
1540
+ }
1541
+
1542
+ // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1543
+ if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1544
+ if (CONFIGURABLE_FUNCTION_NAME) {
1545
+ createNonEnumerableProperty$1(IterablePrototype, 'name', VALUES);
1546
+ } else {
1547
+ INCORRECT_VALUES_NAME = true;
1548
+ defaultIterator = function values() { return call$8(nativeIterator, this); };
1549
+ }
1550
+ }
1551
+
1552
+ // export additional methods
1553
+ if (DEFAULT) {
1554
+ methods = {
1555
+ values: getIterationMethod(VALUES),
1556
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1557
+ entries: getIterationMethod(ENTRIES)
1558
+ };
1559
+ if (FORCED) for (KEY in methods) {
1560
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1561
+ defineBuiltIn$4(IterablePrototype, KEY, methods[KEY]);
1562
+ }
1563
+ } else $$8({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1564
+ }
1565
+
1566
+ // define iterator
1567
+ if (IterablePrototype[ITERATOR$6] !== defaultIterator) {
1568
+ defineBuiltIn$4(IterablePrototype, ITERATOR$6, defaultIterator, { name: DEFAULT });
1569
+ }
1570
+ Iterators$3[NAME] = defaultIterator;
1571
+
1572
+ return methods;
1573
+ };
1574
+
1575
+ // `CreateIterResultObject` abstract operation
1576
+ // https://tc39.es/ecma262/#sec-createiterresultobject
1577
+ var createIterResultObject$2 = function (value, done) {
1578
+ return { value: value, done: done };
1579
+ };
1580
+
1581
+ var toIndexedObject = toIndexedObject$5;
1582
+ var addToUnscopables$1 = addToUnscopables$2;
1583
+ var Iterators$2 = iterators;
1584
+ var InternalStateModule$2 = internalState;
1585
+ var defineProperty$1 = objectDefineProperty.f;
1586
+ var defineIterator = iteratorDefine;
1587
+ var createIterResultObject$1 = createIterResultObject$2;
1588
+ var DESCRIPTORS$4 = descriptors;
1589
+
1590
+ var ARRAY_ITERATOR = 'Array Iterator';
1591
+ var setInternalState$2 = InternalStateModule$2.set;
1592
+ var getInternalState = InternalStateModule$2.getterFor(ARRAY_ITERATOR);
1593
+
1594
+ // `Array.prototype.entries` method
1595
+ // https://tc39.es/ecma262/#sec-array.prototype.entries
1596
+ // `Array.prototype.keys` method
1597
+ // https://tc39.es/ecma262/#sec-array.prototype.keys
1598
+ // `Array.prototype.values` method
1599
+ // https://tc39.es/ecma262/#sec-array.prototype.values
1600
+ // `Array.prototype[@@iterator]` method
1601
+ // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1602
+ // `CreateArrayIterator` internal method
1603
+ // https://tc39.es/ecma262/#sec-createarrayiterator
1604
+ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1605
+ setInternalState$2(this, {
1606
+ type: ARRAY_ITERATOR,
1607
+ target: toIndexedObject(iterated), // target
1608
+ index: 0, // next index
1609
+ kind: kind // kind
1610
+ });
1611
+ // `%ArrayIteratorPrototype%.next` method
1612
+ // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1613
+ }, function () {
1614
+ var state = getInternalState(this);
1615
+ var target = state.target;
1616
+ var index = state.index++;
1617
+ if (!target || index >= target.length) {
1618
+ state.target = undefined;
1619
+ return createIterResultObject$1(undefined, true);
1620
+ }
1621
+ switch (state.kind) {
1622
+ case 'keys': return createIterResultObject$1(index, false);
1623
+ case 'values': return createIterResultObject$1(target[index], false);
1624
+ } return createIterResultObject$1([index, target[index]], false);
1625
+ }, 'values');
1626
+
1627
+ // argumentsList[@@iterator] is %ArrayProto_values%
1628
+ // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1629
+ // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1630
+ var values = Iterators$2.Arguments = Iterators$2.Array;
1631
+
1632
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1633
+ addToUnscopables$1('keys');
1634
+ addToUnscopables$1('values');
1635
+ addToUnscopables$1('entries');
1636
+
1637
+ // V8 ~ Chrome 45- bug
1638
+ if (DESCRIPTORS$4 && values.name !== 'values') try {
1639
+ defineProperty$1(values, 'name', { value: 'values' });
1640
+ } catch (error) { /* empty */ }
1641
+
1642
+ // iterable DOM collections
1643
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1644
+ var domIterables = {
1645
+ CSSRuleList: 0,
1646
+ CSSStyleDeclaration: 0,
1647
+ CSSValueList: 0,
1648
+ ClientRectList: 0,
1649
+ DOMRectList: 0,
1650
+ DOMStringList: 0,
1651
+ DOMTokenList: 1,
1652
+ DataTransferItemList: 0,
1653
+ FileList: 0,
1654
+ HTMLAllCollection: 0,
1655
+ HTMLCollection: 0,
1656
+ HTMLFormElement: 0,
1657
+ HTMLSelectElement: 0,
1658
+ MediaList: 0,
1659
+ MimeTypeArray: 0,
1660
+ NamedNodeMap: 0,
1661
+ NodeList: 1,
1662
+ PaintRequestList: 0,
1663
+ Plugin: 0,
1664
+ PluginArray: 0,
1665
+ SVGLengthList: 0,
1666
+ SVGNumberList: 0,
1667
+ SVGPathSegList: 0,
1668
+ SVGPointList: 0,
1669
+ SVGStringList: 0,
1670
+ SVGTransformList: 0,
1671
+ SourceBufferList: 0,
1672
+ StyleSheetList: 0,
1673
+ TextTrackCueList: 0,
1674
+ TextTrackList: 0,
1675
+ TouchList: 0
1676
+ };
1677
+
1678
+ // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
1679
+ var documentCreateElement = documentCreateElement$2;
1680
+
1681
+ var classList = documentCreateElement('span').classList;
1682
+ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
1683
+
1684
+ var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
1685
+
1686
+ var global$9 = global$k;
1687
+ var DOMIterables = domIterables;
1688
+ var DOMTokenListPrototype = domTokenListPrototype;
1689
+ var ArrayIteratorMethods = es_array_iterator;
1690
+ var createNonEnumerableProperty = createNonEnumerableProperty$4;
1691
+ var setToStringTag$2 = setToStringTag$5;
1692
+ var wellKnownSymbol$9 = wellKnownSymbol$h;
1693
+
1694
+ var ITERATOR$5 = wellKnownSymbol$9('iterator');
1695
+ var ArrayValues = ArrayIteratorMethods.values;
1696
+
1697
+ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1698
+ if (CollectionPrototype) {
1699
+ // some Chrome versions have non-configurable methods on DOMTokenList
1700
+ if (CollectionPrototype[ITERATOR$5] !== ArrayValues) try {
1701
+ createNonEnumerableProperty(CollectionPrototype, ITERATOR$5, ArrayValues);
1702
+ } catch (error) {
1703
+ CollectionPrototype[ITERATOR$5] = ArrayValues;
1704
+ }
1705
+ setToStringTag$2(CollectionPrototype, COLLECTION_NAME, true);
1706
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
1707
+ // some Chrome versions have non-configurable methods on DOMTokenList
1708
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
1709
+ createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
1710
+ } catch (error) {
1711
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
1712
+ }
1713
+ }
1714
+ }
1715
+ };
1716
+
1717
+ for (var COLLECTION_NAME in DOMIterables) {
1718
+ handlePrototype(global$9[COLLECTION_NAME] && global$9[COLLECTION_NAME].prototype, COLLECTION_NAME);
1719
+ }
1720
+
1721
+ handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1722
+
1723
+ var global$8 = global$k;
1724
+ var DESCRIPTORS$3 = descriptors;
1725
+
1726
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1727
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1728
+
1729
+ // Avoid NodeJS experimental warning
1730
+ var safeGetBuiltIn$2 = function (name) {
1731
+ if (!DESCRIPTORS$3) return global$8[name];
1732
+ var descriptor = getOwnPropertyDescriptor(global$8, name);
1733
+ return descriptor && descriptor.value;
1734
+ };
1735
+
1736
+ var fails$2 = fails$f;
1737
+ var wellKnownSymbol$8 = wellKnownSymbol$h;
1738
+ var DESCRIPTORS$2 = descriptors;
1739
+ var IS_PURE = isPure;
1740
+
1741
+ var ITERATOR$4 = wellKnownSymbol$8('iterator');
1742
+
1743
+ var urlConstructorDetection = !fails$2(function () {
1744
+ // eslint-disable-next-line unicorn/relative-url-style -- required for testing
1745
+ var url = new URL('b?a=1&b=2&c=3', 'http://a');
1746
+ var params = url.searchParams;
1747
+ var params2 = new URLSearchParams('a=1&a=2&b=3');
1748
+ var result = '';
1749
+ url.pathname = 'c%20d';
1750
+ params.forEach(function (value, key) {
1751
+ params['delete']('b');
1752
+ result += key + value;
1753
+ });
1754
+ params2['delete']('a', 2);
1755
+ // `undefined` case is a Chromium 117 bug
1756
+ // https://bugs.chromium.org/p/v8/issues/detail?id=14222
1757
+ params2['delete']('b', undefined);
1758
+ return (IS_PURE && (!url.toJSON || !params2.has('a', 1) || params2.has('a', 2) || !params2.has('a', undefined) || params2.has('b')))
1759
+ || (!params.size && (IS_PURE || !DESCRIPTORS$2))
1760
+ || !params.sort
1761
+ || url.href !== 'http://a/c%20d?a=1&c=3'
1762
+ || params.get('c') !== '3'
1763
+ || String(new URLSearchParams('?a=1')) !== 'a=1'
1764
+ || !params[ITERATOR$4]
1765
+ // throws in Edge
1766
+ || new URL('https://a@b').username !== 'a'
1767
+ || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
1768
+ // not punycoded in Edge
1769
+ || new URL('http://тест').host !== 'xn--e1aybc'
1770
+ // not escaped in Chrome 62-
1771
+ || new URL('http://a#б').hash !== '#%D0%B1'
1772
+ // fails in Chrome 66-
1773
+ || result !== 'a1c3'
1774
+ // throws in Safari
1775
+ || new URL('http://x', undefined).host !== 'x';
1776
+ });
1777
+
1778
+ var makeBuiltIn = makeBuiltIn$3.exports;
1779
+ var defineProperty = objectDefineProperty;
1780
+
1781
+ var defineBuiltInAccessor$2 = function (target, name, descriptor) {
1782
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1783
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1784
+ return defineProperty.f(target, name, descriptor);
1785
+ };
1786
+
1787
+ var defineBuiltIn$3 = defineBuiltIn$8;
1788
+
1789
+ var defineBuiltIns$1 = function (target, src, options) {
1790
+ for (var key in src) defineBuiltIn$3(target, key, src[key], options);
1791
+ return target;
1792
+ };
1793
+
1794
+ var isPrototypeOf$1 = objectIsPrototypeOf;
1795
+
1796
+ var $TypeError$6 = TypeError;
1797
+
1798
+ var anInstance$2 = function (it, Prototype) {
1799
+ if (isPrototypeOf$1(Prototype, it)) return it;
1800
+ throw new $TypeError$6('Incorrect invocation');
1801
+ };
1802
+
1803
+ var classofRaw = classofRaw$2;
1804
+ var uncurryThis$4 = functionUncurryThis;
1805
+
1806
+ var functionUncurryThisClause = function (fn) {
1807
+ // Nashorn bug:
1808
+ // https://github.com/zloirock/core-js/issues/1128
1809
+ // https://github.com/zloirock/core-js/issues/1130
1810
+ if (classofRaw(fn) === 'Function') return uncurryThis$4(fn);
1811
+ };
1812
+
1813
+ var uncurryThis$3 = functionUncurryThisClause;
1814
+ var aCallable$6 = aCallable$9;
1815
+ var NATIVE_BIND$1 = functionBindNative;
1816
+
1817
+ var bind$6 = uncurryThis$3(uncurryThis$3.bind);
1818
+
1819
+ // optional / simple context binding
1820
+ var functionBindContext = function (fn, that) {
1821
+ aCallable$6(fn);
1822
+ return that === undefined ? fn : NATIVE_BIND$1 ? bind$6(fn, that) : function (/* ...args */) {
1823
+ return fn.apply(that, arguments);
1824
+ };
1825
+ };
1826
+
1827
+ var classof$4 = classof$7;
1828
+ var getMethod$1 = getMethod$3;
1829
+ var isNullOrUndefined$1 = isNullOrUndefined$4;
1830
+ var Iterators$1 = iterators;
1831
+ var wellKnownSymbol$7 = wellKnownSymbol$h;
1832
+
1833
+ var ITERATOR$3 = wellKnownSymbol$7('iterator');
1834
+
1835
+ var getIteratorMethod$3 = function (it) {
1836
+ if (!isNullOrUndefined$1(it)) return getMethod$1(it, ITERATOR$3)
1837
+ || getMethod$1(it, '@@iterator')
1838
+ || Iterators$1[classof$4(it)];
1839
+ };
1840
+
1841
+ var call$7 = functionCall;
1842
+ var aCallable$5 = aCallable$9;
1843
+ var anObject$5 = anObject$d;
1844
+ var tryToString$2 = tryToString$4;
1845
+ var getIteratorMethod$2 = getIteratorMethod$3;
1846
+
1847
+ var $TypeError$5 = TypeError;
1848
+
1849
+ var getIterator$2 = function (argument, usingIterator) {
1850
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod$2(argument) : usingIterator;
1851
+ if (aCallable$5(iteratorMethod)) return anObject$5(call$7(iteratorMethod, argument));
1852
+ throw new $TypeError$5(tryToString$2(argument) + ' is not iterable');
1853
+ };
1854
+
1855
+ var $TypeError$4 = TypeError;
1856
+
1857
+ var validateArgumentsLength$2 = function (passed, required) {
1858
+ if (passed < required) throw new $TypeError$4('Not enough arguments');
1859
+ return passed;
1860
+ };
1861
+
1862
+ var uncurryThis$2 = functionUncurryThis;
1863
+
1864
+ var arraySlice$2 = uncurryThis$2([].slice);
1865
+
1866
+ var arraySlice$1 = arraySlice$2;
1867
+
1868
+ var floor = Math.floor;
1869
+
1870
+ var sort = function (array, comparefn) {
1871
+ var length = array.length;
1872
+
1873
+ if (length < 8) {
1874
+ // insertion sort
1875
+ var i = 1;
1876
+ var element, j;
1877
+
1878
+ while (i < length) {
1879
+ j = i;
1880
+ element = array[i];
1881
+ while (j && comparefn(array[j - 1], element) > 0) {
1882
+ array[j] = array[--j];
1883
+ }
1884
+ if (j !== i++) array[j] = element;
1885
+ }
1886
+ } else {
1887
+ // merge sort
1888
+ var middle = floor(length / 2);
1889
+ var left = sort(arraySlice$1(array, 0, middle), comparefn);
1890
+ var right = sort(arraySlice$1(array, middle), comparefn);
1891
+ var llength = left.length;
1892
+ var rlength = right.length;
1893
+ var lindex = 0;
1894
+ var rindex = 0;
1895
+
1896
+ while (lindex < llength || rindex < rlength) {
1897
+ array[lindex + rindex] = (lindex < llength && rindex < rlength)
1898
+ ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
1899
+ : lindex < llength ? left[lindex++] : right[rindex++];
1900
+ }
1901
+ }
1902
+
1903
+ return array;
1904
+ };
1905
+
1906
+ var arraySort$1 = sort;
1907
+
1908
+ // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
1909
+
1910
+ var $$7 = _export;
1911
+ var global$7 = global$k;
1912
+ var safeGetBuiltIn$1 = safeGetBuiltIn$2;
1913
+ var call$6 = functionCall;
1914
+ var uncurryThis$1 = functionUncurryThis;
1915
+ var DESCRIPTORS$1 = descriptors;
1916
+ var USE_NATIVE_URL = urlConstructorDetection;
1917
+ var defineBuiltIn$2 = defineBuiltIn$8;
1918
+ var defineBuiltInAccessor$1 = defineBuiltInAccessor$2;
1919
+ var defineBuiltIns = defineBuiltIns$1;
1920
+ var setToStringTag$1 = setToStringTag$5;
1921
+ var createIteratorConstructor = iteratorCreateConstructor;
1922
+ var InternalStateModule$1 = internalState;
1923
+ var anInstance$1 = anInstance$2;
1924
+ var isCallable$5 = isCallable$k;
1925
+ var hasOwn$1 = hasOwnProperty_1;
1926
+ var bind$5 = functionBindContext;
1927
+ var classof$3 = classof$7;
1928
+ var anObject$4 = anObject$d;
1929
+ var isObject$3 = isObject$b;
1930
+ var $toString = toString;
1931
+ var create = objectCreate;
1932
+ var createPropertyDescriptor = createPropertyDescriptor$4;
1933
+ var getIterator$1 = getIterator$2;
1934
+ var getIteratorMethod$1 = getIteratorMethod$3;
1935
+ var createIterResultObject = createIterResultObject$2;
1936
+ var validateArgumentsLength$1 = validateArgumentsLength$2;
1937
+ var wellKnownSymbol$6 = wellKnownSymbol$h;
1938
+ var arraySort = arraySort$1;
1939
+
1940
+ var ITERATOR$2 = wellKnownSymbol$6('iterator');
1941
+ var URL_SEARCH_PARAMS = 'URLSearchParams';
1942
+ var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
1943
+ var setInternalState$1 = InternalStateModule$1.set;
1944
+ var getInternalParamsState = InternalStateModule$1.getterFor(URL_SEARCH_PARAMS);
1945
+ var getInternalIteratorState = InternalStateModule$1.getterFor(URL_SEARCH_PARAMS_ITERATOR);
1946
+
1947
+ var nativeFetch = safeGetBuiltIn$1('fetch');
1948
+ var NativeRequest = safeGetBuiltIn$1('Request');
1949
+ var Headers = safeGetBuiltIn$1('Headers');
1950
+ var RequestPrototype = NativeRequest && NativeRequest.prototype;
1951
+ var HeadersPrototype = Headers && Headers.prototype;
1952
+ var RegExp$1 = global$7.RegExp;
1953
+ var TypeError$2 = global$7.TypeError;
1954
+ var decodeURIComponent = global$7.decodeURIComponent;
1955
+ var encodeURIComponent = global$7.encodeURIComponent;
1956
+ var charAt = uncurryThis$1(''.charAt);
1957
+ var join = uncurryThis$1([].join);
1958
+ var push = uncurryThis$1([].push);
1959
+ var replace = uncurryThis$1(''.replace);
1960
+ var shift = uncurryThis$1([].shift);
1961
+ var splice = uncurryThis$1([].splice);
1962
+ var split = uncurryThis$1(''.split);
1963
+ var stringSlice = uncurryThis$1(''.slice);
1964
+
1965
+ var plus = /\+/g;
1966
+ var sequences = Array(4);
1967
+
1968
+ var percentSequence = function (bytes) {
1969
+ return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp$1('((?:%[\\da-f]{2}){' + bytes + '})', 'gi'));
1970
+ };
1971
+
1972
+ var percentDecode = function (sequence) {
1973
+ try {
1974
+ return decodeURIComponent(sequence);
1975
+ } catch (error) {
1976
+ return sequence;
1977
+ }
1978
+ };
1979
+
1980
+ var deserialize = function (it) {
1981
+ var result = replace(it, plus, ' ');
1982
+ var bytes = 4;
1983
+ try {
1984
+ return decodeURIComponent(result);
1985
+ } catch (error) {
1986
+ while (bytes) {
1987
+ result = replace(result, percentSequence(bytes--), percentDecode);
1988
+ }
1989
+ return result;
1990
+ }
1991
+ };
1992
+
1993
+ var find = /[!'()~]|%20/g;
1994
+
1995
+ var replacements = {
1996
+ '!': '%21',
1997
+ "'": '%27',
1998
+ '(': '%28',
1999
+ ')': '%29',
2000
+ '~': '%7E',
2001
+ '%20': '+'
2002
+ };
2003
+
2004
+ var replacer = function (match) {
2005
+ return replacements[match];
2006
+ };
2007
+
2008
+ var serialize = function (it) {
2009
+ return replace(encodeURIComponent(it), find, replacer);
2010
+ };
2011
+
2012
+ var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
2013
+ setInternalState$1(this, {
2014
+ type: URL_SEARCH_PARAMS_ITERATOR,
2015
+ target: getInternalParamsState(params).entries,
2016
+ index: 0,
2017
+ kind: kind
2018
+ });
2019
+ }, URL_SEARCH_PARAMS, function next() {
2020
+ var state = getInternalIteratorState(this);
2021
+ var target = state.target;
2022
+ var index = state.index++;
2023
+ if (!target || index >= target.length) {
2024
+ state.target = undefined;
2025
+ return createIterResultObject(undefined, true);
2026
+ }
2027
+ var entry = target[index];
2028
+ switch (state.kind) {
2029
+ case 'keys': return createIterResultObject(entry.key, false);
2030
+ case 'values': return createIterResultObject(entry.value, false);
2031
+ } return createIterResultObject([entry.key, entry.value], false);
2032
+ }, true);
2033
+
2034
+ var URLSearchParamsState = function (init) {
2035
+ this.entries = [];
2036
+ this.url = null;
2037
+
2038
+ if (init !== undefined) {
2039
+ if (isObject$3(init)) this.parseObject(init);
2040
+ else this.parseQuery(typeof init == 'string' ? charAt(init, 0) === '?' ? stringSlice(init, 1) : init : $toString(init));
2041
+ }
2042
+ };
2043
+
2044
+ URLSearchParamsState.prototype = {
2045
+ type: URL_SEARCH_PARAMS,
2046
+ bindURL: function (url) {
2047
+ this.url = url;
2048
+ this.update();
2049
+ },
2050
+ parseObject: function (object) {
2051
+ var entries = this.entries;
2052
+ var iteratorMethod = getIteratorMethod$1(object);
2053
+ var iterator, next, step, entryIterator, entryNext, first, second;
2054
+
2055
+ if (iteratorMethod) {
2056
+ iterator = getIterator$1(object, iteratorMethod);
2057
+ next = iterator.next;
2058
+ while (!(step = call$6(next, iterator)).done) {
2059
+ entryIterator = getIterator$1(anObject$4(step.value));
2060
+ entryNext = entryIterator.next;
2061
+ if (
2062
+ (first = call$6(entryNext, entryIterator)).done ||
2063
+ (second = call$6(entryNext, entryIterator)).done ||
2064
+ !call$6(entryNext, entryIterator).done
2065
+ ) throw new TypeError$2('Expected sequence with length 2');
2066
+ push(entries, { key: $toString(first.value), value: $toString(second.value) });
2067
+ }
2068
+ } else for (var key in object) if (hasOwn$1(object, key)) {
2069
+ push(entries, { key: key, value: $toString(object[key]) });
2070
+ }
2071
+ },
2072
+ parseQuery: function (query) {
2073
+ if (query) {
2074
+ var entries = this.entries;
2075
+ var attributes = split(query, '&');
2076
+ var index = 0;
2077
+ var attribute, entry;
2078
+ while (index < attributes.length) {
2079
+ attribute = attributes[index++];
2080
+ if (attribute.length) {
2081
+ entry = split(attribute, '=');
2082
+ push(entries, {
2083
+ key: deserialize(shift(entry)),
2084
+ value: deserialize(join(entry, '='))
2085
+ });
2086
+ }
2087
+ }
2088
+ }
2089
+ },
2090
+ serialize: function () {
2091
+ var entries = this.entries;
2092
+ var result = [];
2093
+ var index = 0;
2094
+ var entry;
2095
+ while (index < entries.length) {
2096
+ entry = entries[index++];
2097
+ push(result, serialize(entry.key) + '=' + serialize(entry.value));
2098
+ } return join(result, '&');
2099
+ },
2100
+ update: function () {
2101
+ this.entries.length = 0;
2102
+ this.parseQuery(this.url.query);
2103
+ },
2104
+ updateURL: function () {
2105
+ if (this.url) this.url.update();
2106
+ }
2107
+ };
2108
+
2109
+ // `URLSearchParams` constructor
2110
+ // https://url.spec.whatwg.org/#interface-urlsearchparams
2111
+ var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
2112
+ anInstance$1(this, URLSearchParamsPrototype);
2113
+ var init = arguments.length > 0 ? arguments[0] : undefined;
2114
+ var state = setInternalState$1(this, new URLSearchParamsState(init));
2115
+ if (!DESCRIPTORS$1) this.size = state.entries.length;
2116
+ };
2117
+
2118
+ var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
2119
+
2120
+ defineBuiltIns(URLSearchParamsPrototype, {
2121
+ // `URLSearchParams.prototype.append` method
2122
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-append
2123
+ append: function append(name, value) {
2124
+ var state = getInternalParamsState(this);
2125
+ validateArgumentsLength$1(arguments.length, 2);
2126
+ push(state.entries, { key: $toString(name), value: $toString(value) });
2127
+ if (!DESCRIPTORS$1) this.length++;
2128
+ state.updateURL();
2129
+ },
2130
+ // `URLSearchParams.prototype.delete` method
2131
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-delete
2132
+ 'delete': function (name /* , value */) {
2133
+ var state = getInternalParamsState(this);
2134
+ var length = validateArgumentsLength$1(arguments.length, 1);
2135
+ var entries = state.entries;
2136
+ var key = $toString(name);
2137
+ var $value = length < 2 ? undefined : arguments[1];
2138
+ var value = $value === undefined ? $value : $toString($value);
2139
+ var index = 0;
2140
+ while (index < entries.length) {
2141
+ var entry = entries[index];
2142
+ if (entry.key === key && (value === undefined || entry.value === value)) {
2143
+ splice(entries, index, 1);
2144
+ if (value !== undefined) break;
2145
+ } else index++;
2146
+ }
2147
+ if (!DESCRIPTORS$1) this.size = entries.length;
2148
+ state.updateURL();
2149
+ },
2150
+ // `URLSearchParams.prototype.get` method
2151
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-get
2152
+ get: function get(name) {
2153
+ var entries = getInternalParamsState(this).entries;
2154
+ validateArgumentsLength$1(arguments.length, 1);
2155
+ var key = $toString(name);
2156
+ var index = 0;
2157
+ for (; index < entries.length; index++) {
2158
+ if (entries[index].key === key) return entries[index].value;
2159
+ }
2160
+ return null;
2161
+ },
2162
+ // `URLSearchParams.prototype.getAll` method
2163
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-getall
2164
+ getAll: function getAll(name) {
2165
+ var entries = getInternalParamsState(this).entries;
2166
+ validateArgumentsLength$1(arguments.length, 1);
2167
+ var key = $toString(name);
2168
+ var result = [];
2169
+ var index = 0;
2170
+ for (; index < entries.length; index++) {
2171
+ if (entries[index].key === key) push(result, entries[index].value);
2172
+ }
2173
+ return result;
2174
+ },
2175
+ // `URLSearchParams.prototype.has` method
2176
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-has
2177
+ has: function has(name /* , value */) {
2178
+ var entries = getInternalParamsState(this).entries;
2179
+ var length = validateArgumentsLength$1(arguments.length, 1);
2180
+ var key = $toString(name);
2181
+ var $value = length < 2 ? undefined : arguments[1];
2182
+ var value = $value === undefined ? $value : $toString($value);
2183
+ var index = 0;
2184
+ while (index < entries.length) {
2185
+ var entry = entries[index++];
2186
+ if (entry.key === key && (value === undefined || entry.value === value)) return true;
2187
+ }
2188
+ return false;
2189
+ },
2190
+ // `URLSearchParams.prototype.set` method
2191
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-set
2192
+ set: function set(name, value) {
2193
+ var state = getInternalParamsState(this);
2194
+ validateArgumentsLength$1(arguments.length, 1);
2195
+ var entries = state.entries;
2196
+ var found = false;
2197
+ var key = $toString(name);
2198
+ var val = $toString(value);
2199
+ var index = 0;
2200
+ var entry;
2201
+ for (; index < entries.length; index++) {
2202
+ entry = entries[index];
2203
+ if (entry.key === key) {
2204
+ if (found) splice(entries, index--, 1);
2205
+ else {
2206
+ found = true;
2207
+ entry.value = val;
2208
+ }
2209
+ }
2210
+ }
2211
+ if (!found) push(entries, { key: key, value: val });
2212
+ if (!DESCRIPTORS$1) this.size = entries.length;
2213
+ state.updateURL();
2214
+ },
2215
+ // `URLSearchParams.prototype.sort` method
2216
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-sort
2217
+ sort: function sort() {
2218
+ var state = getInternalParamsState(this);
2219
+ arraySort(state.entries, function (a, b) {
2220
+ return a.key > b.key ? 1 : -1;
2221
+ });
2222
+ state.updateURL();
2223
+ },
2224
+ // `URLSearchParams.prototype.forEach` method
2225
+ forEach: function forEach(callback /* , thisArg */) {
2226
+ var entries = getInternalParamsState(this).entries;
2227
+ var boundFunction = bind$5(callback, arguments.length > 1 ? arguments[1] : undefined);
2228
+ var index = 0;
2229
+ var entry;
2230
+ while (index < entries.length) {
2231
+ entry = entries[index++];
2232
+ boundFunction(entry.value, entry.key, this);
2233
+ }
2234
+ },
2235
+ // `URLSearchParams.prototype.keys` method
2236
+ keys: function keys() {
2237
+ return new URLSearchParamsIterator(this, 'keys');
2238
+ },
2239
+ // `URLSearchParams.prototype.values` method
2240
+ values: function values() {
2241
+ return new URLSearchParamsIterator(this, 'values');
2242
+ },
2243
+ // `URLSearchParams.prototype.entries` method
2244
+ entries: function entries() {
2245
+ return new URLSearchParamsIterator(this, 'entries');
2246
+ }
2247
+ }, { enumerable: true });
2248
+
2249
+ // `URLSearchParams.prototype[@@iterator]` method
2250
+ defineBuiltIn$2(URLSearchParamsPrototype, ITERATOR$2, URLSearchParamsPrototype.entries, { name: 'entries' });
2251
+
2252
+ // `URLSearchParams.prototype.toString` method
2253
+ // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior
2254
+ defineBuiltIn$2(URLSearchParamsPrototype, 'toString', function toString() {
2255
+ return getInternalParamsState(this).serialize();
2256
+ }, { enumerable: true });
2257
+
2258
+ // `URLSearchParams.prototype.size` getter
2259
+ // https://github.com/whatwg/url/pull/734
2260
+ if (DESCRIPTORS$1) defineBuiltInAccessor$1(URLSearchParamsPrototype, 'size', {
2261
+ get: function size() {
2262
+ return getInternalParamsState(this).entries.length;
2263
+ },
2264
+ configurable: true,
2265
+ enumerable: true
2266
+ });
2267
+
2268
+ setToStringTag$1(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
2269
+
2270
+ $$7({ global: true, constructor: true, forced: !USE_NATIVE_URL }, {
2271
+ URLSearchParams: URLSearchParamsConstructor
2272
+ });
2273
+
2274
+ // Wrap `fetch` and `Request` for correct work with polyfilled `URLSearchParams`
2275
+ if (!USE_NATIVE_URL && isCallable$5(Headers)) {
2276
+ var headersHas = uncurryThis$1(HeadersPrototype.has);
2277
+ var headersSet = uncurryThis$1(HeadersPrototype.set);
2278
+
2279
+ var wrapRequestOptions = function (init) {
2280
+ if (isObject$3(init)) {
2281
+ var body = init.body;
2282
+ var headers;
2283
+ if (classof$3(body) === URL_SEARCH_PARAMS) {
2284
+ headers = init.headers ? new Headers(init.headers) : new Headers();
2285
+ if (!headersHas(headers, 'content-type')) {
2286
+ headersSet(headers, 'content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
2287
+ }
2288
+ return create(init, {
2289
+ body: createPropertyDescriptor(0, $toString(body)),
2290
+ headers: createPropertyDescriptor(0, headers)
2291
+ });
2292
+ }
2293
+ } return init;
2294
+ };
2295
+
2296
+ if (isCallable$5(nativeFetch)) {
2297
+ $$7({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, {
2298
+ fetch: function fetch(input /* , init */) {
2299
+ return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
2300
+ }
2301
+ });
2302
+ }
2303
+
2304
+ if (isCallable$5(NativeRequest)) {
2305
+ var RequestConstructor = function Request(input /* , init */) {
2306
+ anInstance$1(this, RequestPrototype);
2307
+ return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
2308
+ };
2309
+
2310
+ RequestPrototype.constructor = RequestConstructor;
2311
+ RequestConstructor.prototype = RequestPrototype;
2312
+
2313
+ $$7({ global: true, constructor: true, dontCallGetSet: true, forced: true }, {
2314
+ Request: RequestConstructor
2315
+ });
2316
+ }
2317
+ }
2318
+
2319
+ var classof$2 = classofRaw$2;
2320
+
2321
+ // `IsArray` abstract operation
2322
+ // https://tc39.es/ecma262/#sec-isarray
2323
+ // eslint-disable-next-line es/no-array-isarray -- safe
2324
+ var isArray$2 = Array.isArray || function isArray(argument) {
2325
+ return classof$2(argument) === 'Array';
2326
+ };
2327
+
2328
+ var $TypeError$3 = TypeError;
2329
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
2330
+
2331
+ var doesNotExceedSafeInteger$1 = function (it) {
2332
+ if (it > MAX_SAFE_INTEGER) throw $TypeError$3('Maximum allowed index exceeded');
2333
+ return it;
2334
+ };
2335
+
2336
+ var isArray$1 = isArray$2;
2337
+ var lengthOfArrayLike$2 = lengthOfArrayLike$4;
2338
+ var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
2339
+ var bind$4 = functionBindContext;
2340
+
2341
+ // `FlattenIntoArray` abstract operation
2342
+ // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
2343
+ var flattenIntoArray$1 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
2344
+ var targetIndex = start;
2345
+ var sourceIndex = 0;
2346
+ var mapFn = mapper ? bind$4(mapper, thisArg) : false;
2347
+ var element, elementLen;
2348
+
2349
+ while (sourceIndex < sourceLen) {
2350
+ if (sourceIndex in source) {
2351
+ element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
2352
+
2353
+ if (depth > 0 && isArray$1(element)) {
2354
+ elementLen = lengthOfArrayLike$2(element);
2355
+ targetIndex = flattenIntoArray$1(target, original, element, elementLen, targetIndex, depth - 1) - 1;
2356
+ } else {
2357
+ doesNotExceedSafeInteger(targetIndex + 1);
2358
+ target[targetIndex] = element;
2359
+ }
2360
+
2361
+ targetIndex++;
2362
+ }
2363
+ sourceIndex++;
2364
+ }
2365
+ return targetIndex;
2366
+ };
2367
+
2368
+ var flattenIntoArray_1 = flattenIntoArray$1;
2369
+
2370
+ var uncurryThis = functionUncurryThis;
2371
+ var fails$1 = fails$f;
2372
+ var isCallable$4 = isCallable$k;
2373
+ var classof$1 = classof$7;
2374
+ var getBuiltIn$3 = getBuiltIn$7;
2375
+ var inspectSource$1 = inspectSource$3;
2376
+
2377
+ var noop = function () { /* empty */ };
2378
+ var construct = getBuiltIn$3('Reflect', 'construct');
2379
+ var constructorRegExp = /^\s*(?:class|function)\b/;
2380
+ var exec = uncurryThis(constructorRegExp.exec);
2381
+ var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
2382
+
2383
+ var isConstructorModern = function isConstructor(argument) {
2384
+ if (!isCallable$4(argument)) return false;
2385
+ try {
2386
+ construct(noop, [], argument);
2387
+ return true;
2388
+ } catch (error) {
2389
+ return false;
2390
+ }
2391
+ };
2392
+
2393
+ var isConstructorLegacy = function isConstructor(argument) {
2394
+ if (!isCallable$4(argument)) return false;
2395
+ switch (classof$1(argument)) {
2396
+ case 'AsyncFunction':
2397
+ case 'GeneratorFunction':
2398
+ case 'AsyncGeneratorFunction': return false;
2399
+ }
2400
+ try {
2401
+ // we can't check .prototype since constructors produced by .bind haven't it
2402
+ // `Function#toString` throws on some built-it function in some legacy engines
2403
+ // (for example, `DOMQuad` and similar in FF41-)
2404
+ return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$1(argument));
2405
+ } catch (error) {
2406
+ return true;
2407
+ }
2408
+ };
2409
+
2410
+ isConstructorLegacy.sham = true;
2411
+
2412
+ // `IsConstructor` abstract operation
2413
+ // https://tc39.es/ecma262/#sec-isconstructor
2414
+ var isConstructor$2 = !construct || fails$1(function () {
2415
+ var called;
2416
+ return isConstructorModern(isConstructorModern.call)
2417
+ || !isConstructorModern(Object)
2418
+ || !isConstructorModern(function () { called = true; })
2419
+ || called;
2420
+ }) ? isConstructorLegacy : isConstructorModern;
2421
+
2422
+ var isArray = isArray$2;
2423
+ var isConstructor$1 = isConstructor$2;
2424
+ var isObject$2 = isObject$b;
2425
+ var wellKnownSymbol$5 = wellKnownSymbol$h;
2426
+
2427
+ var SPECIES$3 = wellKnownSymbol$5('species');
2428
+ var $Array = Array;
2429
+
2430
+ // a part of `ArraySpeciesCreate` abstract operation
2431
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
2432
+ var arraySpeciesConstructor$1 = function (originalArray) {
2433
+ var C;
2434
+ if (isArray(originalArray)) {
2435
+ C = originalArray.constructor;
2436
+ // cross-realm fallback
2437
+ if (isConstructor$1(C) && (C === $Array || isArray(C.prototype))) C = undefined;
2438
+ else if (isObject$2(C)) {
2439
+ C = C[SPECIES$3];
2440
+ if (C === null) C = undefined;
2441
+ }
2442
+ } return C === undefined ? $Array : C;
2443
+ };
2444
+
2445
+ var arraySpeciesConstructor = arraySpeciesConstructor$1;
2446
+
2447
+ // `ArraySpeciesCreate` abstract operation
2448
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
2449
+ var arraySpeciesCreate$1 = function (originalArray, length) {
2450
+ return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
2451
+ };
2452
+
2453
+ var $$6 = _export;
2454
+ var flattenIntoArray = flattenIntoArray_1;
2455
+ var aCallable$4 = aCallable$9;
2456
+ var toObject = toObject$4;
2457
+ var lengthOfArrayLike$1 = lengthOfArrayLike$4;
2458
+ var arraySpeciesCreate = arraySpeciesCreate$1;
2459
+
2460
+ // `Array.prototype.flatMap` method
2461
+ // https://tc39.es/ecma262/#sec-array.prototype.flatmap
2462
+ $$6({ target: 'Array', proto: true }, {
2463
+ flatMap: function flatMap(callbackfn /* , thisArg */) {
2464
+ var O = toObject(this);
2465
+ var sourceLen = lengthOfArrayLike$1(O);
2466
+ var A;
2467
+ aCallable$4(callbackfn);
2468
+ A = arraySpeciesCreate(O, 0);
2469
+ A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2470
+ return A;
2471
+ }
2472
+ });
2473
+
2474
+ // this method was added to unscopables after implementation
2475
+ // in popular engines, so it's moved to a separate module
2476
+ var addToUnscopables = addToUnscopables$2;
2477
+
2478
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2479
+ addToUnscopables('flatMap');
2480
+
2481
+ /**
2482
+ * Zoho Recruit module name.
2483
+ *
2484
+ * Example "Candidates"
2485
+ */
2486
+
2487
+ /**
2488
+ * Zoho Recruit record id
2489
+ *
2490
+ * Example "576214000000569001"
2491
+ */
2492
+
2493
+ /**
2494
+ * Zoho Recruit custom view id
2495
+ */
2496
+
2497
+ /**
2498
+ * Zoho Recruit territory id
2499
+ */
2500
+
2501
+ /**
2502
+ * The name of a field on a record.
2503
+ */
2504
+
2505
+ /**
2506
+ * Comma separated list of field names
2507
+ */
2508
+
2509
+ /**
2510
+ * A ZohoRecruit record containing the corresponding record's id.
2511
+ */
2512
+
2513
+ /**
2514
+ * A ZohoRecruit record containing record details.
2515
+ */
2516
+
2517
+ /**
2518
+ * Update details returned by the server for an updated object.
2519
+ */
2520
+
2521
+ /**
2522
+ * Encoded criteria string.
2523
+ */
2524
+
2525
+ /**
2526
+ * Creates a ZohoRecruitSearchRecordsCriteriaString from a ZohoRecruitSearchRecordsCriteriaTree.
2527
+ *
2528
+ * If the input tree is empty, returns undefined.
2529
+ */
2530
+ function zohoRecruitSearchRecordsCriteriaString(input) {
2531
+ let result;
2532
+ if (input != null) {
2533
+ switch (typeof input) {
2534
+ case 'string':
2535
+ result = input;
2536
+ break;
2537
+ case 'object':
2538
+ let tree;
2539
+ if (Array.isArray(input)) {
2540
+ tree = {
2541
+ and: [input]
2542
+ };
2543
+ } else {
2544
+ tree = input;
2545
+ }
2546
+ result = zohoRecruitSearchRecordsCriteriaStringForTree(tree);
2547
+ break;
2548
+ }
2549
+ }
2550
+ return result;
2551
+ }
2552
+ function zohoRecruitSearchRecordsCriteriaStringForTree(tree) {
2553
+ function convertToString(value) {
2554
+ let result;
2555
+ if (typeof value === 'object') {
2556
+ // array of criteria entries
2557
+ if (Array.isArray(value)) {
2558
+ result = value.map(zohoRecruitSearchRecordsCriteriaEntryToCriteriaString);
2559
+ } else if (value) {
2560
+ // criteria tree that first needs to be converted to a string
2561
+ result = zohoRecruitSearchRecordsCriteriaStringForTree(value);
2562
+ }
2563
+ } else {
2564
+ result = value;
2565
+ }
2566
+ return result;
2567
+ }
2568
+ function mergeStringValues(values, type) {
2569
+ return values.length > 1 ? `(${values.join(type)})` : values[0]; // wrap in and values
2570
+ }
2571
+
2572
+ function mergeValues(values, type) {
2573
+ const allStrings = filterMaybeValues(values.map(convertToString)).flatMap(asArray);
2574
+ return mergeStringValues(allStrings, type);
2575
+ }
2576
+ const orValues = tree.or ? mergeValues(tree.or, 'or') : undefined;
2577
+ let result = orValues;
2578
+ if (tree.and) {
2579
+ result = mergeValues([mergeValues(tree.and, 'and'), orValues], 'and');
2580
+ }
2581
+ return result;
2582
+ }
2583
+
2584
+ /**
2585
+ * Tree items
2586
+ *
2587
+ * If both AND and OR values are provided at the root tree, then the will be merged together with AND.
2588
+ */
2589
+
2590
+ /**
2591
+ * Escape used for ZohoRecruitSearchRecordsCriteriaString
2592
+ */
2593
+ const escapeZohoFieldValueForCriteriaString = escapeStringCharactersFunction({
2594
+ /**
2595
+ * Parenthesis and commas must be escaped using a backslash
2596
+ */
2597
+ escapeTargets: ['(', ')', ','],
2598
+ escapeCharacter: char => `\\${char}`
2599
+ });
2600
+
2601
+ /**
2602
+ * Converts the input entry to a ZohoRecruitSearchRecordsCriteriaString. Properly escapes any parenthesis or commas.
2603
+ *
2604
+ * @param entry
2605
+ * @returns
2606
+ */
2607
+ function zohoRecruitSearchRecordsCriteriaEntryToCriteriaString(entry) {
2608
+ const escapedValue = escapeZohoFieldValueForCriteriaString(entry.value);
2609
+ return `(${entry.field}:${entry.filter}:${escapedValue})`;
2610
+ }
2611
+
2612
+ var global$6 = global$k;
2613
+ var classof = classofRaw$2;
2614
+
2615
+ var engineIsNode = classof(global$6.process) === 'process';
2616
+
2617
+ var getBuiltIn$2 = getBuiltIn$7;
2618
+ var defineBuiltInAccessor = defineBuiltInAccessor$2;
2619
+ var wellKnownSymbol$4 = wellKnownSymbol$h;
2620
+ var DESCRIPTORS = descriptors;
2621
+
2622
+ var SPECIES$2 = wellKnownSymbol$4('species');
2623
+
2624
+ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
2625
+ var Constructor = getBuiltIn$2(CONSTRUCTOR_NAME);
2626
+
2627
+ if (DESCRIPTORS && Constructor && !Constructor[SPECIES$2]) {
2628
+ defineBuiltInAccessor(Constructor, SPECIES$2, {
2629
+ configurable: true,
2630
+ get: function () { return this; }
2631
+ });
2632
+ }
2633
+ };
2634
+
2635
+ var isConstructor = isConstructor$2;
2636
+ var tryToString$1 = tryToString$4;
2637
+
2638
+ var $TypeError$2 = TypeError;
2639
+
2640
+ // `Assert: IsConstructor(argument) is true`
2641
+ var aConstructor$1 = function (argument) {
2642
+ if (isConstructor(argument)) return argument;
2643
+ throw new $TypeError$2(tryToString$1(argument) + ' is not a constructor');
2644
+ };
2645
+
2646
+ var anObject$3 = anObject$d;
2647
+ var aConstructor = aConstructor$1;
2648
+ var isNullOrUndefined = isNullOrUndefined$4;
2649
+ var wellKnownSymbol$3 = wellKnownSymbol$h;
2650
+
2651
+ var SPECIES$1 = wellKnownSymbol$3('species');
2652
+
2653
+ // `SpeciesConstructor` abstract operation
2654
+ // https://tc39.es/ecma262/#sec-speciesconstructor
2655
+ var speciesConstructor$1 = function (O, defaultConstructor) {
2656
+ var C = anObject$3(O).constructor;
2657
+ var S;
2658
+ return C === undefined || isNullOrUndefined(S = anObject$3(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
2659
+ };
2660
+
2661
+ var NATIVE_BIND = functionBindNative;
2662
+
2663
+ var FunctionPrototype = Function.prototype;
2664
+ var apply$1 = FunctionPrototype.apply;
2665
+ var call$5 = FunctionPrototype.call;
2666
+
2667
+ // eslint-disable-next-line es/no-reflect -- safe
2668
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$5.bind(apply$1) : function () {
2669
+ return call$5.apply(apply$1, arguments);
2670
+ });
2671
+
2672
+ var userAgent$2 = engineUserAgent;
2673
+
2674
+ // eslint-disable-next-line redos/no-vulnerable -- safe
2675
+ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
2676
+
2677
+ var global$5 = global$k;
2678
+ var apply = functionApply;
2679
+ var bind$3 = functionBindContext;
2680
+ var isCallable$3 = isCallable$k;
2681
+ var hasOwn = hasOwnProperty_1;
2682
+ var fails = fails$f;
2683
+ var html = html$2;
2684
+ var arraySlice = arraySlice$2;
2685
+ var createElement = documentCreateElement$2;
2686
+ var validateArgumentsLength = validateArgumentsLength$2;
2687
+ var IS_IOS$1 = engineIsIos;
2688
+ var IS_NODE$3 = engineIsNode;
2689
+
2690
+ var set = global$5.setImmediate;
2691
+ var clear = global$5.clearImmediate;
2692
+ var process$2 = global$5.process;
2693
+ var Dispatch = global$5.Dispatch;
2694
+ var Function$1 = global$5.Function;
2695
+ var MessageChannel = global$5.MessageChannel;
2696
+ var String$1 = global$5.String;
2697
+ var counter = 0;
2698
+ var queue$2 = {};
2699
+ var ONREADYSTATECHANGE = 'onreadystatechange';
2700
+ var $location, defer, channel, port;
2701
+
2702
+ fails(function () {
2703
+ // Deno throws a ReferenceError on `location` access without `--location` flag
2704
+ $location = global$5.location;
2705
+ });
2706
+
2707
+ var run = function (id) {
2708
+ if (hasOwn(queue$2, id)) {
2709
+ var fn = queue$2[id];
2710
+ delete queue$2[id];
2711
+ fn();
2712
+ }
2713
+ };
2714
+
2715
+ var runner = function (id) {
2716
+ return function () {
2717
+ run(id);
2718
+ };
2719
+ };
2720
+
2721
+ var eventListener = function (event) {
2722
+ run(event.data);
2723
+ };
2724
+
2725
+ var globalPostMessageDefer = function (id) {
2726
+ // old engines have not location.origin
2727
+ global$5.postMessage(String$1(id), $location.protocol + '//' + $location.host);
2728
+ };
2729
+
2730
+ // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
2731
+ if (!set || !clear) {
2732
+ set = function setImmediate(handler) {
2733
+ validateArgumentsLength(arguments.length, 1);
2734
+ var fn = isCallable$3(handler) ? handler : Function$1(handler);
2735
+ var args = arraySlice(arguments, 1);
2736
+ queue$2[++counter] = function () {
2737
+ apply(fn, undefined, args);
2738
+ };
2739
+ defer(counter);
2740
+ return counter;
2741
+ };
2742
+ clear = function clearImmediate(id) {
2743
+ delete queue$2[id];
2744
+ };
2745
+ // Node.js 0.8-
2746
+ if (IS_NODE$3) {
2747
+ defer = function (id) {
2748
+ process$2.nextTick(runner(id));
2749
+ };
2750
+ // Sphere (JS game engine) Dispatch API
2751
+ } else if (Dispatch && Dispatch.now) {
2752
+ defer = function (id) {
2753
+ Dispatch.now(runner(id));
2754
+ };
2755
+ // Browsers with MessageChannel, includes WebWorkers
2756
+ // except iOS - https://github.com/zloirock/core-js/issues/624
2757
+ } else if (MessageChannel && !IS_IOS$1) {
2758
+ channel = new MessageChannel();
2759
+ port = channel.port2;
2760
+ channel.port1.onmessage = eventListener;
2761
+ defer = bind$3(port.postMessage, port);
2762
+ // Browsers with postMessage, skip WebWorkers
2763
+ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
2764
+ } else if (
2765
+ global$5.addEventListener &&
2766
+ isCallable$3(global$5.postMessage) &&
2767
+ !global$5.importScripts &&
2768
+ $location && $location.protocol !== 'file:' &&
2769
+ !fails(globalPostMessageDefer)
2770
+ ) {
2771
+ defer = globalPostMessageDefer;
2772
+ global$5.addEventListener('message', eventListener, false);
2773
+ // IE8-
2774
+ } else if (ONREADYSTATECHANGE in createElement('script')) {
2775
+ defer = function (id) {
2776
+ html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
2777
+ html.removeChild(this);
2778
+ run(id);
2779
+ };
2780
+ };
2781
+ // Rest old browsers
2782
+ } else {
2783
+ defer = function (id) {
2784
+ setTimeout(runner(id), 0);
2785
+ };
2786
+ }
2787
+ }
2788
+
2789
+ var task$1 = {
2790
+ set: set,
2791
+ clear: clear
2792
+ };
2793
+
2794
+ var Queue$2 = function () {
2795
+ this.head = null;
2796
+ this.tail = null;
2797
+ };
2798
+
2799
+ Queue$2.prototype = {
2800
+ add: function (item) {
2801
+ var entry = { item: item, next: null };
2802
+ var tail = this.tail;
2803
+ if (tail) tail.next = entry;
2804
+ else this.head = entry;
2805
+ this.tail = entry;
2806
+ },
2807
+ get: function () {
2808
+ var entry = this.head;
2809
+ if (entry) {
2810
+ var next = this.head = entry.next;
2811
+ if (next === null) this.tail = null;
2812
+ return entry.item;
2813
+ }
2814
+ }
2815
+ };
2816
+
2817
+ var queue$1 = Queue$2;
2818
+
2819
+ var userAgent$1 = engineUserAgent;
2820
+
2821
+ var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && typeof Pebble != 'undefined';
2822
+
2823
+ var userAgent = engineUserAgent;
2824
+
2825
+ var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
2826
+
2827
+ var global$4 = global$k;
2828
+ var safeGetBuiltIn = safeGetBuiltIn$2;
2829
+ var bind$2 = functionBindContext;
2830
+ var macrotask = task$1.set;
2831
+ var Queue$1 = queue$1;
2832
+ var IS_IOS = engineIsIos;
2833
+ var IS_IOS_PEBBLE = engineIsIosPebble;
2834
+ var IS_WEBOS_WEBKIT = engineIsWebosWebkit;
2835
+ var IS_NODE$2 = engineIsNode;
2836
+
2837
+ var MutationObserver = global$4.MutationObserver || global$4.WebKitMutationObserver;
2838
+ var document$2 = global$4.document;
2839
+ var process$1 = global$4.process;
2840
+ var Promise$1 = global$4.Promise;
2841
+ var microtask$1 = safeGetBuiltIn('queueMicrotask');
2842
+ var notify$1, toggle, node, promise, then;
2843
+
2844
+ // modern engines have queueMicrotask method
2845
+ if (!microtask$1) {
2846
+ var queue = new Queue$1();
2847
+
2848
+ var flush = function () {
2849
+ var parent, fn;
2850
+ if (IS_NODE$2 && (parent = process$1.domain)) parent.exit();
2851
+ while (fn = queue.get()) try {
2852
+ fn();
2853
+ } catch (error) {
2854
+ if (queue.head) notify$1();
2855
+ throw error;
2856
+ }
2857
+ if (parent) parent.enter();
2858
+ };
2859
+
2860
+ // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
2861
+ // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
2862
+ if (!IS_IOS && !IS_NODE$2 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
2863
+ toggle = true;
2864
+ node = document$2.createTextNode('');
2865
+ new MutationObserver(flush).observe(node, { characterData: true });
2866
+ notify$1 = function () {
2867
+ node.data = toggle = !toggle;
2868
+ };
2869
+ // environments with maybe non-completely correct, but existent Promise
2870
+ } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
2871
+ // Promise.resolve without an argument throws an error in LG WebOS 2
2872
+ promise = Promise$1.resolve(undefined);
2873
+ // workaround of WebKit ~ iOS Safari 10.1 bug
2874
+ promise.constructor = Promise$1;
2875
+ then = bind$2(promise.then, promise);
2876
+ notify$1 = function () {
2877
+ then(flush);
2878
+ };
2879
+ // Node.js without promises
2880
+ } else if (IS_NODE$2) {
2881
+ notify$1 = function () {
2882
+ process$1.nextTick(flush);
2883
+ };
2884
+ // for other environments - macrotask based on:
2885
+ // - setImmediate
2886
+ // - MessageChannel
2887
+ // - window.postMessage
2888
+ // - onreadystatechange
2889
+ // - setTimeout
2890
+ } else {
2891
+ // `webpack` dev server bug on IE global methods - use bind(fn, global)
2892
+ macrotask = bind$2(macrotask, global$4);
2893
+ notify$1 = function () {
2894
+ macrotask(flush);
2895
+ };
2896
+ }
2897
+
2898
+ microtask$1 = function (fn) {
2899
+ if (!queue.head) notify$1();
2900
+ queue.add(fn);
2901
+ };
2902
+ }
2903
+
2904
+ var microtask_1 = microtask$1;
2905
+
2906
+ var hostReportErrors$1 = function (a, b) {
2907
+ try {
2908
+ // eslint-disable-next-line no-console -- safe
2909
+ arguments.length === 1 ? console.error(a) : console.error(a, b);
2910
+ } catch (error) { /* empty */ }
2911
+ };
2912
+
2913
+ var perform$3 = function (exec) {
2914
+ try {
2915
+ return { error: false, value: exec() };
2916
+ } catch (error) {
2917
+ return { error: true, value: error };
2918
+ }
2919
+ };
2920
+
2921
+ var global$3 = global$k;
2922
+
2923
+ var promiseNativeConstructor = global$3.Promise;
2924
+
2925
+ /* global Deno -- Deno case */
2926
+ var engineIsDeno = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
2927
+
2928
+ var IS_DENO$1 = engineIsDeno;
2929
+ var IS_NODE$1 = engineIsNode;
2930
+
2931
+ var engineIsBrowser = !IS_DENO$1 && !IS_NODE$1
2932
+ && typeof window == 'object'
2933
+ && typeof document == 'object';
2934
+
2935
+ var global$2 = global$k;
2936
+ var NativePromiseConstructor$3 = promiseNativeConstructor;
2937
+ var isCallable$2 = isCallable$k;
2938
+ var isForced = isForced_1;
2939
+ var inspectSource = inspectSource$3;
2940
+ var wellKnownSymbol$2 = wellKnownSymbol$h;
2941
+ var IS_BROWSER = engineIsBrowser;
2942
+ var IS_DENO = engineIsDeno;
2943
+ var V8_VERSION = engineV8Version;
2944
+
2945
+ NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
2946
+ var SPECIES = wellKnownSymbol$2('species');
2947
+ var SUBCLASSING = false;
2948
+ var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$2(global$2.PromiseRejectionEvent);
2949
+
2950
+ var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
2951
+ var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
2952
+ var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor$3);
2953
+ // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
2954
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
2955
+ // We can't detect it synchronously, so just check versions
2956
+ if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
2957
+ // We can't use @@species feature detection in V8 since it causes
2958
+ // deoptimization and performance degradation
2959
+ // https://github.com/zloirock/core-js/issues/679
2960
+ if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
2961
+ // Detect correctness of subclassing with @@species support
2962
+ var promise = new NativePromiseConstructor$3(function (resolve) { resolve(1); });
2963
+ var FakePromise = function (exec) {
2964
+ exec(function () { /* empty */ }, function () { /* empty */ });
2965
+ };
2966
+ var constructor = promise.constructor = {};
2967
+ constructor[SPECIES] = FakePromise;
2968
+ SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
2969
+ if (!SUBCLASSING) return true;
2970
+ // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
2971
+ } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT$1;
2972
+ });
2973
+
2974
+ var promiseConstructorDetection = {
2975
+ CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
2976
+ REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
2977
+ SUBCLASSING: SUBCLASSING
2978
+ };
2979
+
2980
+ var newPromiseCapability$2 = {};
2981
+
2982
+ var aCallable$3 = aCallable$9;
2983
+
2984
+ var $TypeError$1 = TypeError;
2985
+
2986
+ var PromiseCapability = function (C) {
2987
+ var resolve, reject;
2988
+ this.promise = new C(function ($$resolve, $$reject) {
2989
+ if (resolve !== undefined || reject !== undefined) throw new $TypeError$1('Bad Promise constructor');
2990
+ resolve = $$resolve;
2991
+ reject = $$reject;
2992
+ });
2993
+ this.resolve = aCallable$3(resolve);
2994
+ this.reject = aCallable$3(reject);
2995
+ };
2996
+
2997
+ // `NewPromiseCapability` abstract operation
2998
+ // https://tc39.es/ecma262/#sec-newpromisecapability
2999
+ newPromiseCapability$2.f = function (C) {
3000
+ return new PromiseCapability(C);
3001
+ };
3002
+
3003
+ var $$5 = _export;
3004
+ var IS_NODE = engineIsNode;
3005
+ var global$1 = global$k;
3006
+ var call$4 = functionCall;
3007
+ var defineBuiltIn$1 = defineBuiltIn$8;
3008
+ var setPrototypeOf = objectSetPrototypeOf;
3009
+ var setToStringTag = setToStringTag$5;
3010
+ var setSpecies = setSpecies$1;
3011
+ var aCallable$2 = aCallable$9;
3012
+ var isCallable$1 = isCallable$k;
3013
+ var isObject$1 = isObject$b;
3014
+ var anInstance = anInstance$2;
3015
+ var speciesConstructor = speciesConstructor$1;
3016
+ var task = task$1.set;
3017
+ var microtask = microtask_1;
3018
+ var hostReportErrors = hostReportErrors$1;
3019
+ var perform$2 = perform$3;
3020
+ var Queue = queue$1;
3021
+ var InternalStateModule = internalState;
3022
+ var NativePromiseConstructor$2 = promiseNativeConstructor;
3023
+ var PromiseConstructorDetection = promiseConstructorDetection;
3024
+ var newPromiseCapabilityModule$3 = newPromiseCapability$2;
3025
+
3026
+ var PROMISE = 'Promise';
3027
+ var FORCED_PROMISE_CONSTRUCTOR$4 = PromiseConstructorDetection.CONSTRUCTOR;
3028
+ var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
3029
+ var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
3030
+ var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
3031
+ var setInternalState = InternalStateModule.set;
3032
+ var NativePromisePrototype$1 = NativePromiseConstructor$2 && NativePromiseConstructor$2.prototype;
3033
+ var PromiseConstructor = NativePromiseConstructor$2;
3034
+ var PromisePrototype = NativePromisePrototype$1;
3035
+ var TypeError$1 = global$1.TypeError;
3036
+ var document$1 = global$1.document;
3037
+ var process = global$1.process;
3038
+ var newPromiseCapability$1 = newPromiseCapabilityModule$3.f;
3039
+ var newGenericPromiseCapability = newPromiseCapability$1;
3040
+
3041
+ var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$1.dispatchEvent);
3042
+ var UNHANDLED_REJECTION = 'unhandledrejection';
3043
+ var REJECTION_HANDLED = 'rejectionhandled';
3044
+ var PENDING = 0;
3045
+ var FULFILLED = 1;
3046
+ var REJECTED = 2;
3047
+ var HANDLED = 1;
3048
+ var UNHANDLED = 2;
3049
+
3050
+ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
3051
+
3052
+ // helpers
3053
+ var isThenable = function (it) {
3054
+ var then;
3055
+ return isObject$1(it) && isCallable$1(then = it.then) ? then : false;
3056
+ };
3057
+
3058
+ var callReaction = function (reaction, state) {
3059
+ var value = state.value;
3060
+ var ok = state.state === FULFILLED;
3061
+ var handler = ok ? reaction.ok : reaction.fail;
3062
+ var resolve = reaction.resolve;
3063
+ var reject = reaction.reject;
3064
+ var domain = reaction.domain;
3065
+ var result, then, exited;
3066
+ try {
3067
+ if (handler) {
3068
+ if (!ok) {
3069
+ if (state.rejection === UNHANDLED) onHandleUnhandled(state);
3070
+ state.rejection = HANDLED;
3071
+ }
3072
+ if (handler === true) result = value;
3073
+ else {
3074
+ if (domain) domain.enter();
3075
+ result = handler(value); // can throw
3076
+ if (domain) {
3077
+ domain.exit();
3078
+ exited = true;
3079
+ }
3080
+ }
3081
+ if (result === reaction.promise) {
3082
+ reject(new TypeError$1('Promise-chain cycle'));
3083
+ } else if (then = isThenable(result)) {
3084
+ call$4(then, result, resolve, reject);
3085
+ } else resolve(result);
3086
+ } else reject(value);
3087
+ } catch (error) {
3088
+ if (domain && !exited) domain.exit();
3089
+ reject(error);
3090
+ }
3091
+ };
3092
+
3093
+ var notify = function (state, isReject) {
3094
+ if (state.notified) return;
3095
+ state.notified = true;
3096
+ microtask(function () {
3097
+ var reactions = state.reactions;
3098
+ var reaction;
3099
+ while (reaction = reactions.get()) {
3100
+ callReaction(reaction, state);
3101
+ }
3102
+ state.notified = false;
3103
+ if (isReject && !state.rejection) onUnhandled(state);
3104
+ });
3105
+ };
3106
+
3107
+ var dispatchEvent = function (name, promise, reason) {
3108
+ var event, handler;
3109
+ if (DISPATCH_EVENT) {
3110
+ event = document$1.createEvent('Event');
3111
+ event.promise = promise;
3112
+ event.reason = reason;
3113
+ event.initEvent(name, false, true);
3114
+ global$1.dispatchEvent(event);
3115
+ } else event = { promise: promise, reason: reason };
3116
+ if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global$1['on' + name])) handler(event);
3117
+ else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
3118
+ };
3119
+
3120
+ var onUnhandled = function (state) {
3121
+ call$4(task, global$1, function () {
3122
+ var promise = state.facade;
3123
+ var value = state.value;
3124
+ var IS_UNHANDLED = isUnhandled(state);
3125
+ var result;
3126
+ if (IS_UNHANDLED) {
3127
+ result = perform$2(function () {
3128
+ if (IS_NODE) {
3129
+ process.emit('unhandledRejection', value, promise);
3130
+ } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
3131
+ });
3132
+ // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
3133
+ state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
3134
+ if (result.error) throw result.value;
3135
+ }
3136
+ });
3137
+ };
3138
+
3139
+ var isUnhandled = function (state) {
3140
+ return state.rejection !== HANDLED && !state.parent;
3141
+ };
3142
+
3143
+ var onHandleUnhandled = function (state) {
3144
+ call$4(task, global$1, function () {
3145
+ var promise = state.facade;
3146
+ if (IS_NODE) {
3147
+ process.emit('rejectionHandled', promise);
3148
+ } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
3149
+ });
3150
+ };
3151
+
3152
+ var bind$1 = function (fn, state, unwrap) {
3153
+ return function (value) {
3154
+ fn(state, value, unwrap);
3155
+ };
3156
+ };
3157
+
3158
+ var internalReject = function (state, value, unwrap) {
3159
+ if (state.done) return;
3160
+ state.done = true;
3161
+ if (unwrap) state = unwrap;
3162
+ state.value = value;
3163
+ state.state = REJECTED;
3164
+ notify(state, true);
3165
+ };
3166
+
3167
+ var internalResolve = function (state, value, unwrap) {
3168
+ if (state.done) return;
3169
+ state.done = true;
3170
+ if (unwrap) state = unwrap;
3171
+ try {
3172
+ if (state.facade === value) throw new TypeError$1("Promise can't be resolved itself");
3173
+ var then = isThenable(value);
3174
+ if (then) {
3175
+ microtask(function () {
3176
+ var wrapper = { done: false };
3177
+ try {
3178
+ call$4(then, value,
3179
+ bind$1(internalResolve, wrapper, state),
3180
+ bind$1(internalReject, wrapper, state)
3181
+ );
3182
+ } catch (error) {
3183
+ internalReject(wrapper, error, state);
3184
+ }
3185
+ });
3186
+ } else {
3187
+ state.value = value;
3188
+ state.state = FULFILLED;
3189
+ notify(state, false);
3190
+ }
3191
+ } catch (error) {
3192
+ internalReject({ done: false }, error, state);
3193
+ }
3194
+ };
3195
+
3196
+ // constructor polyfill
3197
+ if (FORCED_PROMISE_CONSTRUCTOR$4) {
3198
+ // 25.4.3.1 Promise(executor)
3199
+ PromiseConstructor = function Promise(executor) {
3200
+ anInstance(this, PromisePrototype);
3201
+ aCallable$2(executor);
3202
+ call$4(Internal, this);
3203
+ var state = getInternalPromiseState(this);
3204
+ try {
3205
+ executor(bind$1(internalResolve, state), bind$1(internalReject, state));
3206
+ } catch (error) {
3207
+ internalReject(state, error);
3208
+ }
3209
+ };
3210
+
3211
+ PromisePrototype = PromiseConstructor.prototype;
3212
+
3213
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
3214
+ Internal = function Promise(executor) {
3215
+ setInternalState(this, {
3216
+ type: PROMISE,
3217
+ done: false,
3218
+ notified: false,
3219
+ parent: false,
3220
+ reactions: new Queue(),
3221
+ rejection: false,
3222
+ state: PENDING,
3223
+ value: undefined
3224
+ });
3225
+ };
3226
+
3227
+ // `Promise.prototype.then` method
3228
+ // https://tc39.es/ecma262/#sec-promise.prototype.then
3229
+ Internal.prototype = defineBuiltIn$1(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
3230
+ var state = getInternalPromiseState(this);
3231
+ var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
3232
+ state.parent = true;
3233
+ reaction.ok = isCallable$1(onFulfilled) ? onFulfilled : true;
3234
+ reaction.fail = isCallable$1(onRejected) && onRejected;
3235
+ reaction.domain = IS_NODE ? process.domain : undefined;
3236
+ if (state.state === PENDING) state.reactions.add(reaction);
3237
+ else microtask(function () {
3238
+ callReaction(reaction, state);
3239
+ });
3240
+ return reaction.promise;
3241
+ });
3242
+
3243
+ OwnPromiseCapability = function () {
3244
+ var promise = new Internal();
3245
+ var state = getInternalPromiseState(promise);
3246
+ this.promise = promise;
3247
+ this.resolve = bind$1(internalResolve, state);
3248
+ this.reject = bind$1(internalReject, state);
3249
+ };
3250
+
3251
+ newPromiseCapabilityModule$3.f = newPromiseCapability$1 = function (C) {
3252
+ return C === PromiseConstructor || C === PromiseWrapper
3253
+ ? new OwnPromiseCapability(C)
3254
+ : newGenericPromiseCapability(C);
3255
+ };
3256
+
3257
+ if (isCallable$1(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
3258
+ nativeThen = NativePromisePrototype$1.then;
3259
+
3260
+ if (!NATIVE_PROMISE_SUBCLASSING) {
3261
+ // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
3262
+ defineBuiltIn$1(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
3263
+ var that = this;
3264
+ return new PromiseConstructor(function (resolve, reject) {
3265
+ call$4(nativeThen, that, resolve, reject);
3266
+ }).then(onFulfilled, onRejected);
3267
+ // https://github.com/zloirock/core-js/issues/640
3268
+ }, { unsafe: true });
3269
+ }
3270
+
3271
+ // make `.constructor === Promise` work for native promise-based APIs
3272
+ try {
3273
+ delete NativePromisePrototype$1.constructor;
3274
+ } catch (error) { /* empty */ }
3275
+
3276
+ // make `instanceof Promise` work for native promise-based APIs
3277
+ if (setPrototypeOf) {
3278
+ setPrototypeOf(NativePromisePrototype$1, PromisePrototype);
3279
+ }
3280
+ }
3281
+ }
3282
+
3283
+ $$5({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
3284
+ Promise: PromiseConstructor
3285
+ });
3286
+
3287
+ setToStringTag(PromiseConstructor, PROMISE, false);
3288
+ setSpecies(PROMISE);
3289
+
3290
+ var wellKnownSymbol$1 = wellKnownSymbol$h;
3291
+ var Iterators = iterators;
3292
+
3293
+ var ITERATOR$1 = wellKnownSymbol$1('iterator');
3294
+ var ArrayPrototype = Array.prototype;
3295
+
3296
+ // check on default Array iterator
3297
+ var isArrayIteratorMethod$1 = function (it) {
3298
+ return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR$1] === it);
3299
+ };
3300
+
3301
+ var call$3 = functionCall;
3302
+ var anObject$2 = anObject$d;
3303
+ var getMethod = getMethod$3;
3304
+
3305
+ var iteratorClose$1 = function (iterator, kind, value) {
3306
+ var innerResult, innerError;
3307
+ anObject$2(iterator);
3308
+ try {
3309
+ innerResult = getMethod(iterator, 'return');
3310
+ if (!innerResult) {
3311
+ if (kind === 'throw') throw value;
3312
+ return value;
3313
+ }
3314
+ innerResult = call$3(innerResult, iterator);
3315
+ } catch (error) {
3316
+ innerError = true;
3317
+ innerResult = error;
3318
+ }
3319
+ if (kind === 'throw') throw value;
3320
+ if (innerError) throw innerResult;
3321
+ anObject$2(innerResult);
3322
+ return value;
3323
+ };
3324
+
3325
+ var bind = functionBindContext;
3326
+ var call$2 = functionCall;
3327
+ var anObject$1 = anObject$d;
3328
+ var tryToString = tryToString$4;
3329
+ var isArrayIteratorMethod = isArrayIteratorMethod$1;
3330
+ var lengthOfArrayLike = lengthOfArrayLike$4;
3331
+ var isPrototypeOf = objectIsPrototypeOf;
3332
+ var getIterator = getIterator$2;
3333
+ var getIteratorMethod = getIteratorMethod$3;
3334
+ var iteratorClose = iteratorClose$1;
3335
+
3336
+ var $TypeError = TypeError;
3337
+
3338
+ var Result = function (stopped, result) {
3339
+ this.stopped = stopped;
3340
+ this.result = result;
3341
+ };
3342
+
3343
+ var ResultPrototype = Result.prototype;
3344
+
3345
+ var iterate$2 = function (iterable, unboundFunction, options) {
3346
+ var that = options && options.that;
3347
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
3348
+ var IS_RECORD = !!(options && options.IS_RECORD);
3349
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
3350
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
3351
+ var fn = bind(unboundFunction, that);
3352
+ var iterator, iterFn, index, length, result, next, step;
3353
+
3354
+ var stop = function (condition) {
3355
+ if (iterator) iteratorClose(iterator, 'normal', condition);
3356
+ return new Result(true, condition);
3357
+ };
3358
+
3359
+ var callFn = function (value) {
3360
+ if (AS_ENTRIES) {
3361
+ anObject$1(value);
3362
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
3363
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
3364
+ };
3365
+
3366
+ if (IS_RECORD) {
3367
+ iterator = iterable.iterator;
3368
+ } else if (IS_ITERATOR) {
3369
+ iterator = iterable;
3370
+ } else {
3371
+ iterFn = getIteratorMethod(iterable);
3372
+ if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
3373
+ // optimisation for array iterators
3374
+ if (isArrayIteratorMethod(iterFn)) {
3375
+ for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
3376
+ result = callFn(iterable[index]);
3377
+ if (result && isPrototypeOf(ResultPrototype, result)) return result;
3378
+ } return new Result(false);
3379
+ }
3380
+ iterator = getIterator(iterable, iterFn);
3381
+ }
3382
+
3383
+ next = IS_RECORD ? iterable.next : iterator.next;
3384
+ while (!(step = call$2(next, iterator)).done) {
3385
+ try {
3386
+ result = callFn(step.value);
3387
+ } catch (error) {
3388
+ iteratorClose(iterator, 'throw', error);
3389
+ }
3390
+ if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
3391
+ } return new Result(false);
3392
+ };
3393
+
3394
+ var wellKnownSymbol = wellKnownSymbol$h;
3395
+
3396
+ var ITERATOR = wellKnownSymbol('iterator');
3397
+ var SAFE_CLOSING = false;
3398
+
3399
+ try {
3400
+ var called = 0;
3401
+ var iteratorWithReturn = {
3402
+ next: function () {
3403
+ return { done: !!called++ };
3404
+ },
3405
+ 'return': function () {
3406
+ SAFE_CLOSING = true;
3407
+ }
3408
+ };
3409
+ iteratorWithReturn[ITERATOR] = function () {
3410
+ return this;
3411
+ };
3412
+ // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
3413
+ Array.from(iteratorWithReturn, function () { throw 2; });
3414
+ } catch (error) { /* empty */ }
3415
+
3416
+ var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
3417
+ try {
3418
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
3419
+ } catch (error) { return false; } // workaround of old WebKit + `eval` bug
3420
+ var ITERATION_SUPPORT = false;
3421
+ try {
3422
+ var object = {};
3423
+ object[ITERATOR] = function () {
3424
+ return {
3425
+ next: function () {
3426
+ return { done: ITERATION_SUPPORT = true };
3427
+ }
3428
+ };
3429
+ };
3430
+ exec(object);
3431
+ } catch (error) { /* empty */ }
3432
+ return ITERATION_SUPPORT;
3433
+ };
3434
+
3435
+ var NativePromiseConstructor$1 = promiseNativeConstructor;
3436
+ var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
3437
+ var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
3438
+
3439
+ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) {
3440
+ NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
3441
+ });
3442
+
3443
+ var $$4 = _export;
3444
+ var call$1 = functionCall;
3445
+ var aCallable$1 = aCallable$9;
3446
+ var newPromiseCapabilityModule$2 = newPromiseCapability$2;
3447
+ var perform$1 = perform$3;
3448
+ var iterate$1 = iterate$2;
3449
+ var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
3450
+
3451
+ // `Promise.all` method
3452
+ // https://tc39.es/ecma262/#sec-promise.all
3453
+ $$4({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
3454
+ all: function all(iterable) {
3455
+ var C = this;
3456
+ var capability = newPromiseCapabilityModule$2.f(C);
3457
+ var resolve = capability.resolve;
3458
+ var reject = capability.reject;
3459
+ var result = perform$1(function () {
3460
+ var $promiseResolve = aCallable$1(C.resolve);
3461
+ var values = [];
3462
+ var counter = 0;
3463
+ var remaining = 1;
3464
+ iterate$1(iterable, function (promise) {
3465
+ var index = counter++;
3466
+ var alreadyCalled = false;
3467
+ remaining++;
3468
+ call$1($promiseResolve, C, promise).then(function (value) {
3469
+ if (alreadyCalled) return;
3470
+ alreadyCalled = true;
3471
+ values[index] = value;
3472
+ --remaining || resolve(values);
3473
+ }, reject);
3474
+ });
3475
+ --remaining || resolve(values);
3476
+ });
3477
+ if (result.error) reject(result.value);
3478
+ return capability.promise;
3479
+ }
3480
+ });
3481
+
3482
+ var $$3 = _export;
3483
+ var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
3484
+ var NativePromiseConstructor = promiseNativeConstructor;
3485
+ var getBuiltIn$1 = getBuiltIn$7;
3486
+ var isCallable = isCallable$k;
3487
+ var defineBuiltIn = defineBuiltIn$8;
3488
+
3489
+ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
3490
+
3491
+ // `Promise.prototype.catch` method
3492
+ // https://tc39.es/ecma262/#sec-promise.prototype.catch
3493
+ $$3({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
3494
+ 'catch': function (onRejected) {
3495
+ return this.then(undefined, onRejected);
3496
+ }
3497
+ });
3498
+
3499
+ // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
3500
+ if (isCallable(NativePromiseConstructor)) {
3501
+ var method = getBuiltIn$1('Promise').prototype['catch'];
3502
+ if (NativePromisePrototype['catch'] !== method) {
3503
+ defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
3504
+ }
3505
+ }
3506
+
3507
+ var $$2 = _export;
3508
+ var call = functionCall;
3509
+ var aCallable = aCallable$9;
3510
+ var newPromiseCapabilityModule$1 = newPromiseCapability$2;
3511
+ var perform = perform$3;
3512
+ var iterate = iterate$2;
3513
+ var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
3514
+
3515
+ // `Promise.race` method
3516
+ // https://tc39.es/ecma262/#sec-promise.race
3517
+ $$2({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
3518
+ race: function race(iterable) {
3519
+ var C = this;
3520
+ var capability = newPromiseCapabilityModule$1.f(C);
3521
+ var reject = capability.reject;
3522
+ var result = perform(function () {
3523
+ var $promiseResolve = aCallable(C.resolve);
3524
+ iterate(iterable, function (promise) {
3525
+ call($promiseResolve, C, promise).then(capability.resolve, reject);
3526
+ });
3527
+ });
3528
+ if (result.error) reject(result.value);
3529
+ return capability.promise;
3530
+ }
3531
+ });
3532
+
3533
+ var $$1 = _export;
3534
+ var newPromiseCapabilityModule = newPromiseCapability$2;
3535
+ var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
3536
+
3537
+ // `Promise.reject` method
3538
+ // https://tc39.es/ecma262/#sec-promise.reject
3539
+ $$1({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
3540
+ reject: function reject(r) {
3541
+ var capability = newPromiseCapabilityModule.f(this);
3542
+ var capabilityReject = capability.reject;
3543
+ capabilityReject(r);
3544
+ return capability.promise;
3545
+ }
3546
+ });
3547
+
3548
+ var anObject = anObject$d;
3549
+ var isObject = isObject$b;
3550
+ var newPromiseCapability = newPromiseCapability$2;
3551
+
3552
+ var promiseResolve$1 = function (C, x) {
3553
+ anObject(C);
3554
+ if (isObject(x) && x.constructor === C) return x;
3555
+ var promiseCapability = newPromiseCapability.f(C);
3556
+ var resolve = promiseCapability.resolve;
3557
+ resolve(x);
3558
+ return promiseCapability.promise;
3559
+ };
3560
+
3561
+ var $ = _export;
3562
+ var getBuiltIn = getBuiltIn$7;
3563
+ var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
3564
+ var promiseResolve = promiseResolve$1;
3565
+
3566
+ getBuiltIn('Promise');
3567
+
3568
+ // `Promise.resolve` method
3569
+ // https://tc39.es/ecma262/#sec-promise.resolve
3570
+ $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
3571
+ resolve: function resolve(x) {
3572
+ return promiseResolve(this, x);
3573
+ }
3574
+ });
3575
+
3576
+ /**
3577
+ * A code used in some cases to denote success.
3578
+ */
3579
+ const ZOHO_SUCCESS_CODE = 'SUCCESS';
3580
+
3581
+ /**
3582
+ * Zoho Server Error Data
3583
+ *
3584
+ * Always contains a code and message. Details and status are optional.
3585
+ */
3586
+
3587
+ /**
3588
+ * Contains details and a status
3589
+ */
3590
+
3591
+ function zohoServerErrorData(error) {
3592
+ const errorType = typeof error;
3593
+ let errorData;
3594
+ if (errorType === 'object') {
3595
+ errorData = error;
3596
+ } else {
3597
+ errorData = {
3598
+ code: error,
3599
+ message: ''
3600
+ };
3601
+ }
3602
+ return errorData;
3603
+ }
3604
+
3605
+ /**
3606
+ * Zoho Server Error
3607
+ */
3608
+ class ZohoServerError extends BaseError {
3609
+ get code() {
3610
+ return this.error.code;
3611
+ }
3612
+ constructor(error) {
3613
+ super(error.message);
3614
+ this.error = error;
3615
+ }
3616
+ }
3617
+
3618
+ /**
3619
+ * Zoho Server Error that includes the FetchResponseError
3620
+ */
3621
+ class ZohoServerFetchResponseError extends ZohoServerError {
3622
+ constructor(data, responseError) {
3623
+ super(data);
3624
+ this.data = data;
3625
+ this.responseError = responseError;
3626
+ }
3627
+ }
3628
+ /**
3629
+ * Creates a logZohoServerErrorFunction that logs the error to console.
3630
+ *
3631
+ * @param zohoApiNamePrefix Prefix to use when logging. I.E. ZohoRecruitError, etc.
3632
+ * @returns
3633
+ */
3634
+ function logZohoServerErrorFunction(zohoApiNamePrefix) {
3635
+ return error => {
3636
+ if (error instanceof ZohoServerFetchResponseError) {
3637
+ console.log(`${zohoApiNamePrefix}Error(${error.responseError.response.status}): `, {
3638
+ error,
3639
+ errorData: error.data
3640
+ });
3641
+ } else if (error instanceof ZohoServerError) {
3642
+ console.log(`${zohoApiNamePrefix}Error(code:${error.code}): `, {
3643
+ error
3644
+ });
3645
+ } else {
3646
+ console.log(`${zohoApiNamePrefix}Error(name:${error.name}): `, {
3647
+ error
3648
+ });
3649
+ }
3650
+ };
3651
+ }
3652
+
3653
+ /**
3654
+ * Wraps a ConfiguredFetch to support handling errors returned by fetch.
3655
+ *
3656
+ * @param fetch
3657
+ * @returns
3658
+ */
3659
+
3660
+ /**
3661
+ * Wraps a ConfiguredFetch to support handling errors returned by fetch.
3662
+ *
3663
+ * @param fetch
3664
+ * @returns
3665
+ */
3666
+ function handleZohoErrorFetchFactory(parseZohoError, defaultLogError) {
3667
+ return (fetch, logError = defaultLogError) => {
3668
+ return async (x, y) => {
3669
+ try {
3670
+ return await fetch(x, y); // await to catch thrown errors
3671
+ } catch (e) {
3672
+ if (e instanceof FetchResponseError) {
3673
+ const error = await parseZohoError(e);
3674
+ if (error) {
3675
+ logError(error); // log before throwing.
3676
+ throw error;
3677
+ }
3678
+ }
3679
+ throw e;
3680
+ }
3681
+ };
3682
+ };
3683
+ }
3684
+ /**
3685
+ * FetchJsonInterceptJsonResponseFunction that intercepts ZohoServerError responses and throws a ZohoServerError.
3686
+ *
3687
+ * @returns
3688
+ */
3689
+ function interceptZohoErrorResponseFactory(parseZohoServerErrorResponseData) {
3690
+ return (json, response) => {
3691
+ const error = json == null ? void 0 : json.error;
3692
+ if (error != null) {
3693
+ const responseError = new FetchResponseError(response);
3694
+ if (responseError) {
3695
+ const parsedError = parseZohoServerErrorResponseData(json, responseError);
3696
+ if (parsedError) {
3697
+ throw parsedError;
3698
+ }
3699
+ }
3700
+ }
3701
+ return json;
3702
+ };
3703
+ }
3704
+
3705
+ // MARK: Parsed Errors
3706
+ /**
3707
+ * Error in the following (but not limited to) cases:
3708
+ * - An extra parameter is provided
3709
+ */
3710
+ const ZOHO_INTERNAL_ERROR_CODE = 'INTERNAL_ERROR';
3711
+
3712
+ /**
3713
+ * Error when the Zoho API returns an internal error
3714
+ */
3715
+ class ZohoInternalError extends ZohoServerFetchResponseError {}
3716
+
3717
+ /**
3718
+ * Error in the following cases:
3719
+ * - Authorization is not properly constructed ("Invalid Ticket Id")
3720
+ * - OAuth token is expired ("Invalid OAuthtoken")
3721
+ */
3722
+ const ZOHO_INVALID_AUTHORIZATION_ERROR_CODE = '4834';
3723
+
3724
+ /**
3725
+ * Error when the Zoho API returns an invalid authorization error code.
3726
+ */
3727
+ class ZohoInvalidAuthorizationError extends ZohoServerFetchResponseError {}
3728
+
3729
+ /**
3730
+ * Error in the following cases:
3731
+ * - Search query is invalid
3732
+ */
3733
+ const ZOHO_INVALID_QUERY_ERROR_CODE = 'INVALID_QUERY';
3734
+ class ZohoInvalidQueryError extends ZohoServerFetchResponseError {
3735
+ get details() {
3736
+ return this.error.details;
3737
+ }
3738
+ }
3739
+
3740
+ /**
3741
+ * Error when a mandatory field is missing.
3742
+ */
3743
+ const ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE = 'MANDATORY_NOT_FOUND';
3744
+
3745
+ /**
3746
+ * Error when a duplicate record is found with a matching unique field value.
3747
+ */
3748
+ const ZOHO_DUPLICATE_DATA_ERROR_CODE = 'DUPLICATE_DATA';
3749
+
3750
+ /**
3751
+ * Error when some passed data is invalid.
3752
+ */
3753
+ const ZOHO_INVALID_DATA_ERROR_CODE = 'INVALID_DATA';
3754
+
3755
+ /**
3756
+ * Function that parses/transforms a ZohoServerErrorResponseData into a general ZohoServerError or other known error type.
3757
+ *
3758
+ * @param errorResponseData
3759
+ * @param responseError
3760
+ * @returns
3761
+ */
3762
+ function parseZohoServerErrorResponseData(errorResponseData, responseError) {
3763
+ let result;
3764
+ const error = tryFindZohoServerErrorData(errorResponseData, responseError);
3765
+ if (error) {
3766
+ const errorData = zohoServerErrorData(error);
3767
+ switch (errorData.code) {
3768
+ case ZOHO_INTERNAL_ERROR_CODE:
3769
+ result = new ZohoInternalError(errorData, responseError);
3770
+ break;
3771
+ case ZOHO_INVALID_AUTHORIZATION_ERROR_CODE:
3772
+ result = new ZohoInvalidAuthorizationError(errorData, responseError);
3773
+ break;
3774
+ case ZOHO_INVALID_QUERY_ERROR_CODE:
3775
+ result = new ZohoInvalidQueryError(errorData, responseError);
3776
+ break;
3777
+ default:
3778
+ result = new ZohoServerFetchResponseError(errorData, responseError);
3779
+ break;
3780
+ }
3781
+ }
3782
+ return result;
3783
+ }
3784
+
3785
+ /**
3786
+ * Attempts to retrieve an ZohoServerErrorResponseDataError from the input.
3787
+ *
3788
+ * Non-200 errors returned by the Zoho API are returned as the object directly instead of as an ZohoServerErrorResponseData directly.
3789
+ *
3790
+ * @param errorResponseData
3791
+ * @param responseError
3792
+ * @returns
3793
+ */
3794
+ function tryFindZohoServerErrorData(errorResponseData, responseError) {
3795
+ var _error;
3796
+ const error = (_error = errorResponseData.error) != null ? _error : !responseError.response.ok ? errorResponseData : undefined;
3797
+ return error;
3798
+ }
3799
+
3800
+ class ZohoRecruitRecordNoContentError extends BaseError {
3801
+ constructor(moduleName, recordId) {
3802
+ super(`There was no content or matching records for the content. It may not exist.`);
3803
+ this.moduleName = moduleName;
3804
+ this.recordId = recordId;
3805
+ }
3806
+ }
3807
+ class ZohoRecruitRecordCrudError extends ZohoServerError {}
3808
+ class ZohoRecruitRecordCrudMandatoryFieldNotFoundError extends ZohoRecruitRecordCrudError {}
3809
+ class ZohoRecruitRecordCrudDuplicateDataError extends ZohoRecruitRecordCrudError {}
3810
+ class ZohoRecruitRecordCrudInvalidDataError extends ZohoRecruitRecordCrudError {
3811
+ get invalidFieldDetails() {
3812
+ return this.error.details;
3813
+ }
3814
+ }
3815
+ class ZohoRecruitRecordCrudNoMatchingRecordError extends ZohoRecruitRecordCrudInvalidDataError {}
3816
+ function zohoRecruitRecordCrudError(error) {
3817
+ let result;
3818
+ switch (error.code) {
3819
+ case ZOHO_INVALID_DATA_ERROR_CODE:
3820
+ const invalidDataError = new ZohoRecruitRecordCrudInvalidDataError(error);
3821
+ if (invalidDataError.invalidFieldDetails['id']) {
3822
+ result = new ZohoRecruitRecordCrudNoMatchingRecordError(error);
3823
+ } else {
3824
+ result = invalidDataError;
3825
+ }
3826
+ break;
3827
+ case ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE:
3828
+ result = new ZohoRecruitRecordCrudMandatoryFieldNotFoundError(error);
3829
+ break;
3830
+ case ZOHO_DUPLICATE_DATA_ERROR_CODE:
3831
+ result = new ZohoRecruitRecordCrudDuplicateDataError(error);
3832
+ break;
3833
+ default:
3834
+ result = new ZohoRecruitRecordCrudError(error);
3835
+ break;
3836
+ }
3837
+ return result;
3838
+ }
3839
+ function assertRecordDataArrayResultHasContent(moduleName, recordId) {
3840
+ return x => {
3841
+ var _x$data;
3842
+ if (x == null || !((_x$data = x.data) != null && _x$data.length)) {
3843
+ throw new ZohoRecruitRecordNoContentError(moduleName, recordId);
3844
+ } else {
3845
+ return x;
3846
+ }
3847
+ };
3848
+ }
3849
+ const logZohoRecruitErrorToConsole = logZohoServerErrorFunction('ZohoRecruit');
3850
+ async function parseZohoRecruitError(responseError) {
3851
+ const data = await responseError.response.json().catch(x => undefined);
3852
+ let result;
3853
+ if (data) {
3854
+ result = parseZohoRecruitServerErrorResponseData(data, responseError);
3855
+ }
3856
+ return result;
3857
+ }
3858
+ function parseZohoRecruitServerErrorResponseData(errorResponseData, responseError) {
3859
+ let result;
3860
+ const error = tryFindZohoServerErrorData(errorResponseData, responseError);
3861
+ if (error) {
3862
+ const errorData = zohoServerErrorData(error);
3863
+ switch (errorData.code) {
3864
+ // TODO: Add recruit-specific error codes here.
3865
+ default:
3866
+ result = parseZohoServerErrorResponseData(errorResponseData, responseError);
3867
+ break;
3868
+ }
3869
+ }
3870
+ return result;
3871
+ }
3872
+ const interceptZohoRecruitErrorResponse = interceptZohoErrorResponseFactory(parseZohoRecruitServerErrorResponseData);
3873
+ const handleZohoRecruitErrorFetch = handleZohoErrorFetchFactory(parseZohoRecruitError, logZohoRecruitErrorToConsole);
3874
+
3875
+ // MARK: Insert/Update/Upsert Response
3876
+
3877
+ /**
3878
+ * The APIs for Insert, Upsert, and Update have the same structure.
3879
+ *
3880
+ * @returns
3881
+ */
3882
+ function updateRecordLikeFunction(context, fetchUrlPrefix, fetchMethod) {
3883
+ return ({
3884
+ data,
3885
+ module
3886
+ }) => context.fetchJson(`/v2/${module}${fetchUrlPrefix}`, zohoRecruitApiFetchJsonInput(fetchMethod, {
3887
+ data: asArray(data)
3888
+ })).then(x => {
3889
+ const isInputMultipleItems = Array.isArray(data);
3890
+ const result = zohoRecruitMultiRecordResult(asArray(data), x.data);
3891
+ if (isInputMultipleItems) {
3892
+ return result;
3893
+ } else {
3894
+ const {
3895
+ successItems,
3896
+ errorItems
3897
+ } = result;
3898
+ if (errorItems[0] != null) {
3899
+ throw zohoRecruitRecordCrudError(errorItems[0].result);
3900
+ } else {
3901
+ return successItems[0].result.details;
3902
+ }
3903
+ }
3904
+ });
3905
+ }
3906
+
3907
+ // MARK: Insert Record
3908
+
3909
+ /**
3910
+ * Inserts one or more records into Recruit.
3911
+ *
3912
+ * https://www.zoho.com/recruit/developer-guide/apiv2/insert-records.html
3913
+ *
3914
+ * @param context
3915
+ * @returns
3916
+ */
3917
+ function insertRecord(context) {
3918
+ return updateRecordLikeFunction(context, '', 'POST');
3919
+ }
3920
+
3921
+ // MARK: Upsert Record
3922
+
3923
+ /**
3924
+ * Updates or inserts one or more records in Recruit.
3925
+ *
3926
+ * https://www.zoho.com/recruit/developer-guide/apiv2/upsert-records.html
3927
+ *
3928
+ * @param context
3929
+ * @returns
3930
+ */
3931
+ function upsertRecord(context) {
3932
+ return updateRecordLikeFunction(context, '/upsert', 'POST');
3933
+ }
3934
+
3935
+ // MARK: Update Record
3936
+
3937
+ /**
3938
+ * Updates one or more records in Recruit.
3939
+ *
3940
+ * https://www.zoho.com/recruit/developer-guide/apiv2/update-records.html
3941
+ *
3942
+ * @param context
3943
+ * @returns
3944
+ */
3945
+ function updateRecord(context) {
3946
+ return updateRecordLikeFunction(context, '', 'PUT');
3947
+ }
3948
+
3949
+ // MARK: Get Record By Id
3950
+
3951
+ /**
3952
+ * Retrieves a specific record from the given module.
3953
+ *
3954
+ * https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html
3955
+ *
3956
+ * @param context
3957
+ * @returns
3958
+ */
3959
+ function getRecordById(context) {
3960
+ return input => context.fetchJson(`/v2/${input.module}/${input.id}`, zohoRecruitApiFetchJsonInput('GET')).then(assertRecordDataArrayResultHasContent(input.module)).then(x => x.data[0]);
3961
+ }
3962
+
3963
+ // MARK: Get Records
3964
+
3965
+ /**
3966
+ * Retrieves records from the given module. Used for paginating across all records.
3967
+ *
3968
+ * https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html
3969
+ *
3970
+ * @param context
3971
+ * @returns
3972
+ */
3973
+ function getRecords(context) {
3974
+ return input => context.fetchJson(`/v2/${input.module}?${zohoRecruitUrlSearchParamsMinusModule(input).toString()}`, zohoRecruitApiFetchJsonInput('GET'));
3975
+ }
3976
+
3977
+ // MARK: Search Reecords
3978
+ /**
3979
+ * Configuration for searching records.
3980
+ *
3981
+ * Only criteria, email, phone, or word will be used at a single time.
3982
+ */
3983
+
3984
+ /**
3985
+ * Searches records from the given module.
3986
+ *
3987
+ * https://www.zoho.com/recruit/developer-guide/apiv2/search-records.html
3988
+ *
3989
+ * @param context
3990
+ * @returns
3991
+ */
3992
+ function searchRecords(context) {
3993
+ function searchRecordsUrlSearchParams(input) {
3994
+ const baseInput = Object.assign({}, input);
3995
+ delete baseInput.criteria;
3996
+ if (input.criteria != null) {
3997
+ const criteriaString = zohoRecruitSearchRecordsCriteriaString(input.criteria);
3998
+ baseInput.criteria = criteriaString;
3999
+ }
4000
+ const urlParams = zohoRecruitUrlSearchParamsMinusModule(baseInput);
4001
+ return urlParams;
4002
+ }
4003
+ return input => context.fetchJson(`/v2/${input.module}/search?${searchRecordsUrlSearchParams(input).toString()}`, zohoRecruitApiFetchJsonInput('GET')).then(x => x != null ? x : {
4004
+ data: []
4005
+ });
4006
+ }
4007
+
4008
+ // MARK: Util
4009
+ function zohoRecruitUrlSearchParamsMinusModule(input) {
4010
+ const searchParams = new URLSearchParams(input);
4011
+ if (searchParams) {
4012
+ searchParams.delete('module');
4013
+ }
4014
+ return searchParams;
4015
+ }
4016
+ function zohoRecruitApiFetchJsonInput(method, body) {
4017
+ const result = {
4018
+ method,
4019
+ body
4020
+ };
4021
+ return result;
4022
+ }
4023
+
4024
+ // MARK: Multi-Record Results
4025
+
4026
+ function zohoRecruitMultiRecordResult(input, results) {
4027
+ const successItems = [];
4028
+ const errorItems = [];
4029
+ input.forEach((x, i) => {
4030
+ const result = results[i];
4031
+ if (result.status === 'success') {
4032
+ successItems.push({
4033
+ input: x,
4034
+ result: result
4035
+ });
4036
+ } else {
4037
+ errorItems.push({
4038
+ input: x,
4039
+ result: result
4040
+ });
4041
+ }
4042
+ });
4043
+ const result = {
4044
+ successItems,
4045
+ errorItems
4046
+ };
4047
+ return result;
4048
+ }
4049
+
4050
+ const ZOHO_RECRUIT_SERVICE_NAME = 'recruit';
4051
+ function zohoRecruitConfigApiUrl(input) {
4052
+ switch (input) {
4053
+ case 'sandbox':
4054
+ return 'https://recruitsandbox.zoho.com/recruit';
4055
+ case 'production':
4056
+ return 'https://recruit.zoho.com/recruit/';
4057
+ default:
4058
+ return input;
4059
+ }
4060
+ }
4061
+
4062
+ /**
4063
+ * Error in the following cases:
4064
+ * - the refresh token string is invalid
4065
+ */
4066
+ const ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE = 'invalid_code';
4067
+ const ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE = 'invalid_client';
4068
+ /**
4069
+ * Thrown if the call to the Zoho API creating an access token using a refresh token fails.
4070
+ */
4071
+ class ZohoAccountsAccessTokenError extends FetchRequestFactoryError {
4072
+ constructor(errorCode) {
4073
+ super(`ZohoAccountsAccessTokenError: ${errorCode}`);
4074
+ this.errorCode = errorCode;
4075
+ }
4076
+ }
4077
+
4078
+ /**
4079
+ * Thrown if a valid ZohoAccessToken cannot be retrieved successfully.
4080
+ */
4081
+ class ZohoAccountsAuthFailureError extends FetchRequestFactoryError {
4082
+ constructor(reason) {
4083
+ super(`Failed to retrieve proper authentication for the API call. Reason: ${reason}`);
4084
+ this.reason = reason;
4085
+ }
4086
+ }
4087
+ const logZohoAccountsErrorToConsole = logZohoServerErrorFunction('ZohoAccounts');
4088
+ async function parseZohoAccountsError(responseError) {
4089
+ const data = await responseError.response.json().catch(x => undefined);
4090
+ let result;
4091
+ if (data) {
4092
+ result = parseZohoAccountsServerErrorResponseData(data, responseError);
4093
+ }
4094
+ return result;
4095
+ }
4096
+ function parseZohoAccountsServerErrorResponseData(errorResponseData, responseError) {
4097
+ let result;
4098
+ const error = errorResponseData.error;
4099
+ if (error) {
4100
+ const errorData = zohoServerErrorData(error);
4101
+ switch (errorData.code) {
4102
+ case ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE:
4103
+ case ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE:
4104
+ result = new ZohoAccountsAccessTokenError(errorData.code);
4105
+ break;
4106
+ default:
4107
+ result = parseZohoServerErrorResponseData(errorResponseData, responseError);
4108
+ break;
4109
+ }
4110
+ }
4111
+ return result;
4112
+ }
4113
+ const interceptZohoAccountsErrorResponse = interceptZohoErrorResponseFactory(parseZohoAccountsServerErrorResponseData);
4114
+ const handleZohoAccountsErrorFetch = handleZohoErrorFetchFactory(parseZohoAccountsError, logZohoAccountsErrorToConsole);
4115
+
4116
+ /**
4117
+ * Arbitrary key used to identify a specific service's access token. Typically coincides with the ZohoApiServiceName.
4118
+ *
4119
+ * I.E. recruit
4120
+ */
4121
+
4122
+ /**
4123
+ * Access token authorization string generated from a refresh token.
4124
+ */
4125
+
4126
+ /**
4127
+ * Scopes string for a ZohoAccessToken
4128
+ *
4129
+ * Example: "ZohoRecruit.modules.ALL"
4130
+ */
4131
+
4132
+ /**
4133
+ * Api domain string for a ZohoAccessToken
4134
+ *
4135
+ * Example: "https://www.zohoapis.com"
4136
+ */
4137
+
4138
+ /**
4139
+ * Zoho account access token.
4140
+ */
4141
+
4142
+ /**
4143
+ * Used for retrieving and storing ZohoAccessToken values.
4144
+ */
4145
+
4146
+ /**
4147
+ * Source for retriving a ZohoAccessToken.
4148
+ *
4149
+ * Throws an ZohoAccountsAuthRetrievalError error if the token could not be retrieved.
4150
+ */
4151
+
4152
+ /**
4153
+ * A ZohoAccessTokenFactory that always generates a new ZohoAccessToken.
4154
+ */
4155
+
4156
+ /**
4157
+ * Source for retriving a ZohoAccessToken string.
4158
+ *
4159
+ * Throws an ZohoAccountsAuthRetrievalError error if the token could not be retrieved.
4160
+ */
4161
+
4162
+ /**
4163
+ * Generates a new ZohoAccessTokenStringFactory.
4164
+ */
4165
+ function zohoAccessTokenStringFactory(zohoAccessTokenFactory) {
4166
+ return async () => {
4167
+ const token = await zohoAccessTokenFactory();
4168
+ if (!(token != null && token.accessToken)) {
4169
+ throw new ZohoAccountsAuthFailureError();
4170
+ }
4171
+ return token.accessToken;
4172
+ };
4173
+ }
4174
+
4175
+ function zohoRecruitFactory(factoryConfig) {
4176
+ const {
4177
+ accountsContext
4178
+ } = factoryConfig;
4179
+ const accessTokenStringFactory = zohoAccessTokenStringFactory(accountsContext.loadAccessToken);
4180
+ const {
4181
+ logZohoServerErrorFunction,
4182
+ fetchFactory = input => nodeFetchService.makeFetch({
4183
+ baseUrl: input.apiUrl,
4184
+ baseRequest: async () => ({
4185
+ headers: {
4186
+ 'Content-Type': 'application/json',
4187
+ Authorization: `Bearer ${await accessTokenStringFactory()}`
4188
+ }
4189
+ }),
4190
+ timeout: 20 * 1000,
4191
+ // 20 second timeout
4192
+ requireOkResponse: true,
4193
+ // enforce ok response
4194
+ useTimeout: true // use timeout
4195
+ })
4196
+ } = factoryConfig;
4197
+ return config => {
4198
+ if (!config.apiUrl) {
4199
+ throw new Error('ZohoConfig missing api url.');
4200
+ }
4201
+ const apiUrl = zohoRecruitConfigApiUrl(config.apiUrl);
4202
+ const baseFetch = fetchFactory({
4203
+ apiUrl
4204
+ });
4205
+ const fetch = handleZohoRecruitErrorFetch(baseFetch, logZohoServerErrorFunction);
4206
+ const fetchJson = fetchJsonFunction(fetch, {
4207
+ interceptJsonResponse: interceptZohoRecruitErrorResponse,
4208
+ // intercept errors that return status 200
4209
+ handleFetchJsonParseErrorFunction: returnNullHandleFetchJsonParseErrorFunction
4210
+ });
4211
+ const recruitContext = {
4212
+ fetch,
4213
+ fetchJson,
4214
+ config: Object.assign({}, config, {
4215
+ apiUrl
4216
+ })
4217
+ };
4218
+ const zohoRecruit = {
4219
+ recruitContext
4220
+ };
4221
+ return zohoRecruit;
4222
+ };
4223
+ }
4224
+
4225
+ /**
4226
+ * Trades a refresh token for a new AccessToken
4227
+ * @param context
4228
+ * @returns
4229
+ */
4230
+ function accessToken(context) {
4231
+ return input => {
4232
+ var _input$client$clientI, _input$client, _input$client$clientS, _input$client2, _input$refreshToken;
4233
+ return context.fetchJson(`/oauth/v2/token?grant_type=refresh_token&client_id=${(_input$client$clientI = input == null || (_input$client = input.client) == null ? void 0 : _input$client.clientId) != null ? _input$client$clientI : context.config.clientId}&client_secret=${(_input$client$clientS = input == null || (_input$client2 = input.client) == null ? void 0 : _input$client2.clientSecret) != null ? _input$client$clientS : context.config.clientSecret}&refresh_token=${(_input$refreshToken = input == null ? void 0 : input.refreshToken) != null ? _input$refreshToken : context.config.refreshToken}`, zohoAccountsApiFetchJsonInput('POST'));
4234
+ };
4235
+ }
4236
+ function zohoAccountsApiFetchJsonInput(method, body) {
4237
+ const result = {
4238
+ method,
4239
+ body
4240
+ };
4241
+ return result;
4242
+ }
4243
+
4244
+ /**
4245
+ * The Zoho Accounts API URL for the US datacenter.
4246
+ */
4247
+ const ZOHO_ACCOUNTS_US_API_URL = 'https://accounts.zoho.com';
4248
+
4249
+ /**
4250
+ * Url for the Zoho Accounts API.
4251
+ *
4252
+ * You can find a list here of Account URLs here:
4253
+ *
4254
+ * https://help.zoho.com/portal/en/kb/creator/developer-guide/others/url-patterns/articles/know-your-creator-account-s-base-url
4255
+ */
4256
+
4257
+ function zohoAccountsConfigApiUrl(input) {
4258
+ switch (input) {
4259
+ case 'us':
4260
+ return ZOHO_ACCOUNTS_US_API_URL;
4261
+ default:
4262
+ return input;
4263
+ }
4264
+ }
4265
+
4266
+ /**
4267
+ * Configuration for ZohoAccounts.
4268
+ */
4269
+
4270
+ function zohoAccountsFactory(factoryConfig) {
4271
+ const {
4272
+ logZohoServerErrorFunction,
4273
+ fetchFactory = input => nodeFetchService.makeFetch({
4274
+ baseUrl: input.apiUrl,
4275
+ baseRequest: {
4276
+ headers: {
4277
+ 'Content-Type': 'application/json'
4278
+ }
4279
+ },
4280
+ timeout: 20 * 1000,
4281
+ // 20 second timeout
4282
+ requireOkResponse: true,
4283
+ // enforce ok response
4284
+ useTimeout: true // use timeout
4285
+ })
4286
+ } = factoryConfig;
4287
+ return config => {
4288
+ var _config$apiUrl;
4289
+ if (!config.refreshToken) {
4290
+ throw new Error('ZohoAccountsConfig missing refreshToken.');
4291
+ } else if (!config.clientId) {
4292
+ throw new Error('ZohoAccountsConfig missing clientId.');
4293
+ } else if (!config.clientSecret) {
4294
+ throw new Error('ZohoAccountsConfig missing clientSecret.');
4295
+ }
4296
+ const apiUrl = zohoAccountsConfigApiUrl((_config$apiUrl = config.apiUrl) != null ? _config$apiUrl : 'us');
4297
+ const baseFetch = fetchFactory({
4298
+ apiUrl
4299
+ });
4300
+ const fetch = handleZohoAccountsErrorFetch(baseFetch, logZohoServerErrorFunction);
4301
+ const fetchJson = fetchJsonFunction(fetch, {
4302
+ interceptJsonResponse: interceptZohoAccountsErrorResponse,
4303
+ // intercept errors that return status 200
4304
+ handleFetchJsonParseErrorFunction: returnNullHandleFetchJsonParseErrorFunction
4305
+ });
4306
+ const tokenRefresher = async () => {
4307
+ const createdAt = new Date().getTime();
4308
+ const {
4309
+ access_token,
4310
+ api_domain,
4311
+ scope,
4312
+ expires_in
4313
+ } = await accessToken(accountsContext)();
4314
+ const result = {
4315
+ accessToken: access_token,
4316
+ apiDomain: api_domain,
4317
+ expiresIn: expires_in,
4318
+ expiresAt: new Date(createdAt + expires_in * MS_IN_SECOND),
4319
+ scope
4320
+ };
4321
+ return result;
4322
+ };
4323
+ const loadAccessToken = zohoAccountsZohoAccessTokenFactory({
4324
+ tokenRefresher,
4325
+ accessTokenCache: config.accessTokenCache
4326
+ });
4327
+ const accountsContext = {
4328
+ fetch,
4329
+ fetchJson,
4330
+ loadAccessToken,
4331
+ config: Object.assign({}, config, {
4332
+ apiUrl
4333
+ })
4334
+ };
4335
+ const zohoAccounts = {
4336
+ accountsContext
4337
+ };
4338
+ return zohoAccounts;
4339
+ };
4340
+ }
4341
+ /**
4342
+ * Creates a ZohoAccountsZohoAccessTokenFactoryConfig
4343
+ *
4344
+ * @param config
4345
+ * @returns
4346
+ */
4347
+ function zohoAccountsZohoAccessTokenFactory(config) {
4348
+ const {
4349
+ tokenRefresher,
4350
+ accessTokenCache,
4351
+ tokenExpirationBuffer: inputTokenExpirationBuffer
4352
+ } = config;
4353
+ const tokenExpirationBuffer = inputTokenExpirationBuffer != null ? inputTokenExpirationBuffer : MS_IN_MINUTE;
4354
+
4355
+ /**
4356
+ * Caches the token internally here until it expires.
4357
+ */
4358
+ let currentToken = null;
4359
+ return async () => {
4360
+ // load from cache
4361
+ if (!currentToken) {
4362
+ const cachedToken = await (accessTokenCache == null ? void 0 : accessTokenCache.loadCachedToken());
4363
+ if (cachedToken) {
4364
+ currentToken = cachedToken;
4365
+ }
4366
+ }
4367
+
4368
+ // check expiration
4369
+ if (currentToken != null) {
4370
+ const isExpired = new Date().getTime() + tokenExpirationBuffer >= currentToken.expiresAt.getTime();
4371
+ if (isExpired) {
4372
+ currentToken = null;
4373
+ }
4374
+ }
4375
+
4376
+ // load from source
4377
+ if (!currentToken) {
4378
+ try {
4379
+ currentToken = await tokenRefresher();
4380
+ } catch (e) {
4381
+ console.error(`zohoAccountsZohoAccessTokenFactory(): Failed retrieving new token from tokenRefresher: `, e);
4382
+ throw new ZohoAccountsAuthFailureError('Token Refresh Failed');
4383
+ }
4384
+ if (currentToken) {
4385
+ try {
4386
+ await (accessTokenCache == null ? void 0 : accessTokenCache.updateCachedToken(currentToken));
4387
+ } catch (e) {
4388
+ // do nothing
4389
+ }
4390
+ }
4391
+ }
4392
+ return currentToken;
4393
+ };
4394
+ }
4395
+
4396
+ export { ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE, ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE, ZOHO_ACCOUNTS_US_API_URL, ZOHO_DUPLICATE_DATA_ERROR_CODE, ZOHO_INTERNAL_ERROR_CODE, ZOHO_INVALID_AUTHORIZATION_ERROR_CODE, ZOHO_INVALID_DATA_ERROR_CODE, ZOHO_INVALID_QUERY_ERROR_CODE, ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE, ZOHO_RECRUIT_SERVICE_NAME, ZOHO_SUCCESS_CODE, ZohoAccountsAccessTokenError, ZohoAccountsAuthFailureError, ZohoInternalError, ZohoInvalidAuthorizationError, ZohoInvalidQueryError, ZohoRecruitRecordCrudDuplicateDataError, ZohoRecruitRecordCrudError, ZohoRecruitRecordCrudInvalidDataError, ZohoRecruitRecordCrudMandatoryFieldNotFoundError, ZohoRecruitRecordCrudNoMatchingRecordError, ZohoRecruitRecordNoContentError, ZohoServerError, ZohoServerFetchResponseError, accessToken, assertRecordDataArrayResultHasContent, escapeZohoFieldValueForCriteriaString, getRecordById, getRecords, handleZohoAccountsErrorFetch, handleZohoErrorFetchFactory, handleZohoRecruitErrorFetch, insertRecord, interceptZohoAccountsErrorResponse, interceptZohoErrorResponseFactory, interceptZohoRecruitErrorResponse, logZohoAccountsErrorToConsole, logZohoRecruitErrorToConsole, logZohoServerErrorFunction, parseZohoAccountsError, parseZohoAccountsServerErrorResponseData, parseZohoRecruitError, parseZohoRecruitServerErrorResponseData, parseZohoServerErrorResponseData, searchRecords, tryFindZohoServerErrorData, updateRecord, upsertRecord, zohoAccessTokenStringFactory, zohoAccountsApiFetchJsonInput, zohoAccountsConfigApiUrl, zohoAccountsFactory, zohoAccountsZohoAccessTokenFactory, zohoRecruitApiFetchJsonInput, zohoRecruitConfigApiUrl, zohoRecruitFactory, zohoRecruitMultiRecordResult, zohoRecruitRecordCrudError, zohoRecruitSearchRecordsCriteriaEntryToCriteriaString, zohoRecruitSearchRecordsCriteriaString, zohoRecruitSearchRecordsCriteriaStringForTree, zohoRecruitUrlSearchParamsMinusModule, zohoServerErrorData };