@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.cjs.js ADDED
@@ -0,0 +1,3353 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var util = require('@dereekb/util');
6
+ var makeError = require('make-error');
7
+ var fetch = require('@dereekb/util/fetch');
8
+
9
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
+
11
+ var fails$e = function (exec) {
12
+ try {
13
+ return !!exec();
14
+ } catch (error) {
15
+ return true;
16
+ }
17
+ };
18
+
19
+ var fails$d = fails$e;
20
+
21
+ // Detect IE8's incomplete defineProperty implementation
22
+ var descriptors = !fails$d(function () {
23
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
24
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
25
+ });
26
+
27
+ var fails$c = fails$e;
28
+
29
+ var functionBindNative = !fails$c(function () {
30
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
31
+ var test = (function () { /* empty */ }).bind();
32
+ // eslint-disable-next-line no-prototype-builtins -- safe
33
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
34
+ });
35
+
36
+ var NATIVE_BIND$2 = functionBindNative;
37
+
38
+ var FunctionPrototype$1 = Function.prototype;
39
+ var call$9 = FunctionPrototype$1.call;
40
+ var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$1.bind.bind(call$9, call$9);
41
+
42
+ var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
43
+ return function () {
44
+ return call$9.apply(fn, arguments);
45
+ };
46
+ };
47
+
48
+ // we can't use just `it == null` since of `document.all` special case
49
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
50
+ var isNullOrUndefined$3 = function (it) {
51
+ return it === null || it === undefined;
52
+ };
53
+
54
+ var isNullOrUndefined$2 = isNullOrUndefined$3;
55
+
56
+ var $TypeError$a = TypeError;
57
+
58
+ // `RequireObjectCoercible` abstract operation
59
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
60
+ var requireObjectCoercible$2 = function (it) {
61
+ if (isNullOrUndefined$2(it)) throw new $TypeError$a("Can't call method on " + it);
62
+ return it;
63
+ };
64
+
65
+ var requireObjectCoercible$1 = requireObjectCoercible$2;
66
+
67
+ var $Object$4 = Object;
68
+
69
+ // `ToObject` abstract operation
70
+ // https://tc39.es/ecma262/#sec-toobject
71
+ var toObject$4 = function (argument) {
72
+ return $Object$4(requireObjectCoercible$1(argument));
73
+ };
74
+
75
+ var uncurryThis$f = functionUncurryThis;
76
+ var toObject$3 = toObject$4;
77
+
78
+ var hasOwnProperty = uncurryThis$f({}.hasOwnProperty);
79
+
80
+ // `HasOwnProperty` abstract operation
81
+ // https://tc39.es/ecma262/#sec-hasownproperty
82
+ // eslint-disable-next-line es/no-object-hasown -- safe
83
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
84
+ return hasOwnProperty(toObject$3(it), key);
85
+ };
86
+
87
+ var DESCRIPTORS$c = descriptors;
88
+ var hasOwn$a = hasOwnProperty_1;
89
+
90
+ var FunctionPrototype = Function.prototype;
91
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
92
+ var getDescriptor = DESCRIPTORS$c && Object.getOwnPropertyDescriptor;
93
+
94
+ var EXISTS$1 = hasOwn$a(FunctionPrototype, 'name');
95
+ // additional protection from minified / mangled / dropped function names
96
+ var PROPER = EXISTS$1 && (function something() { /* empty */ }).name === 'something';
97
+ var CONFIGURABLE$1 = EXISTS$1 && (!DESCRIPTORS$c || (DESCRIPTORS$c && getDescriptor(FunctionPrototype, 'name').configurable));
98
+
99
+ var functionName = {
100
+ EXISTS: EXISTS$1,
101
+ PROPER: PROPER,
102
+ CONFIGURABLE: CONFIGURABLE$1
103
+ };
104
+
105
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
106
+ var documentAll = typeof document == 'object' && document.all;
107
+
108
+ // `IsCallable` abstract operation
109
+ // https://tc39.es/ecma262/#sec-iscallable
110
+ // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
111
+ var isCallable$g = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
112
+ return typeof argument == 'function' || argument === documentAll;
113
+ } : function (argument) {
114
+ return typeof argument == 'function';
115
+ };
116
+
117
+ var objectDefineProperty = {};
118
+
119
+ var check = function (it) {
120
+ return it && it.Math === Math && it;
121
+ };
122
+
123
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
124
+ var global$e =
125
+ // eslint-disable-next-line es/no-global-this -- safe
126
+ check(typeof globalThis == 'object' && globalThis) ||
127
+ check(typeof window == 'object' && window) ||
128
+ // eslint-disable-next-line no-restricted-globals -- safe
129
+ check(typeof self == 'object' && self) ||
130
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
131
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
132
+ // eslint-disable-next-line no-new-func -- fallback
133
+ (function () { return this; })() || Function('return this')();
134
+
135
+ var isCallable$f = isCallable$g;
136
+
137
+ var isObject$9 = function (it) {
138
+ return typeof it == 'object' ? it !== null : isCallable$f(it);
139
+ };
140
+
141
+ var global$d = global$e;
142
+ var isObject$8 = isObject$9;
143
+
144
+ var document$1 = global$d.document;
145
+ // typeof document.createElement is 'object' in old IE
146
+ var EXISTS = isObject$8(document$1) && isObject$8(document$1.createElement);
147
+
148
+ var documentCreateElement$2 = function (it) {
149
+ return EXISTS ? document$1.createElement(it) : {};
150
+ };
151
+
152
+ var DESCRIPTORS$b = descriptors;
153
+ var fails$b = fails$e;
154
+ var createElement = documentCreateElement$2;
155
+
156
+ // Thanks to IE8 for its funny defineProperty
157
+ var ie8DomDefine = !DESCRIPTORS$b && !fails$b(function () {
158
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
159
+ return Object.defineProperty(createElement('div'), 'a', {
160
+ get: function () { return 7; }
161
+ }).a !== 7;
162
+ });
163
+
164
+ var DESCRIPTORS$a = descriptors;
165
+ var fails$a = fails$e;
166
+
167
+ // V8 ~ Chrome 36-
168
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
169
+ var v8PrototypeDefineBug = DESCRIPTORS$a && fails$a(function () {
170
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
171
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
172
+ value: 42,
173
+ writable: false
174
+ }).prototype !== 42;
175
+ });
176
+
177
+ var isObject$7 = isObject$9;
178
+
179
+ var $String$5 = String;
180
+ var $TypeError$9 = TypeError;
181
+
182
+ // `Assert: Type(argument) is Object`
183
+ var anObject$9 = function (argument) {
184
+ if (isObject$7(argument)) return argument;
185
+ throw new $TypeError$9($String$5(argument) + ' is not an object');
186
+ };
187
+
188
+ var NATIVE_BIND$1 = functionBindNative;
189
+
190
+ var call$8 = Function.prototype.call;
191
+
192
+ var functionCall = NATIVE_BIND$1 ? call$8.bind(call$8) : function () {
193
+ return call$8.apply(call$8, arguments);
194
+ };
195
+
196
+ var global$c = global$e;
197
+ var isCallable$e = isCallable$g;
198
+
199
+ var aFunction = function (argument) {
200
+ return isCallable$e(argument) ? argument : undefined;
201
+ };
202
+
203
+ var getBuiltIn$4 = function (namespace, method) {
204
+ return arguments.length < 2 ? aFunction(global$c[namespace]) : global$c[namespace] && global$c[namespace][method];
205
+ };
206
+
207
+ var uncurryThis$e = functionUncurryThis;
208
+
209
+ var objectIsPrototypeOf = uncurryThis$e({}.isPrototypeOf);
210
+
211
+ var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
212
+
213
+ var global$b = global$e;
214
+ var userAgent = engineUserAgent;
215
+
216
+ var process = global$b.process;
217
+ var Deno = global$b.Deno;
218
+ var versions = process && process.versions || Deno && Deno.version;
219
+ var v8 = versions && versions.v8;
220
+ var match, version;
221
+
222
+ if (v8) {
223
+ match = v8.split('.');
224
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
225
+ // but their correct versions are not interesting for us
226
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
227
+ }
228
+
229
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
230
+ // so check `userAgent` even if `.v8` exists, but 0
231
+ if (!version && userAgent) {
232
+ match = userAgent.match(/Edge\/(\d+)/);
233
+ if (!match || match[1] >= 74) {
234
+ match = userAgent.match(/Chrome\/(\d+)/);
235
+ if (match) version = +match[1];
236
+ }
237
+ }
238
+
239
+ var engineV8Version = version;
240
+
241
+ /* eslint-disable es/no-symbol -- required for testing */
242
+ var V8_VERSION = engineV8Version;
243
+ var fails$9 = fails$e;
244
+ var global$a = global$e;
245
+
246
+ var $String$4 = global$a.String;
247
+
248
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
249
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$9(function () {
250
+ var symbol = Symbol('symbol detection');
251
+ // Chrome 38 Symbol has incorrect toString conversion
252
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
253
+ // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
254
+ // of course, fail.
255
+ return !$String$4(symbol) || !(Object(symbol) instanceof Symbol) ||
256
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
257
+ !Symbol.sham && V8_VERSION && V8_VERSION < 41;
258
+ });
259
+
260
+ /* eslint-disable es/no-symbol -- required for testing */
261
+ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
262
+
263
+ var useSymbolAsUid = NATIVE_SYMBOL$1
264
+ && !Symbol.sham
265
+ && typeof Symbol.iterator == 'symbol';
266
+
267
+ var getBuiltIn$3 = getBuiltIn$4;
268
+ var isCallable$d = isCallable$g;
269
+ var isPrototypeOf$2 = objectIsPrototypeOf;
270
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
271
+
272
+ var $Object$3 = Object;
273
+
274
+ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
275
+ return typeof it == 'symbol';
276
+ } : function (it) {
277
+ var $Symbol = getBuiltIn$3('Symbol');
278
+ return isCallable$d($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$3(it));
279
+ };
280
+
281
+ var $String$3 = String;
282
+
283
+ var tryToString$2 = function (argument) {
284
+ try {
285
+ return $String$3(argument);
286
+ } catch (error) {
287
+ return 'Object';
288
+ }
289
+ };
290
+
291
+ var isCallable$c = isCallable$g;
292
+ var tryToString$1 = tryToString$2;
293
+
294
+ var $TypeError$8 = TypeError;
295
+
296
+ // `Assert: IsCallable(argument) is true`
297
+ var aCallable$5 = function (argument) {
298
+ if (isCallable$c(argument)) return argument;
299
+ throw new $TypeError$8(tryToString$1(argument) + ' is not a function');
300
+ };
301
+
302
+ var aCallable$4 = aCallable$5;
303
+ var isNullOrUndefined$1 = isNullOrUndefined$3;
304
+
305
+ // `GetMethod` abstract operation
306
+ // https://tc39.es/ecma262/#sec-getmethod
307
+ var getMethod$2 = function (V, P) {
308
+ var func = V[P];
309
+ return isNullOrUndefined$1(func) ? undefined : aCallable$4(func);
310
+ };
311
+
312
+ var call$7 = functionCall;
313
+ var isCallable$b = isCallable$g;
314
+ var isObject$6 = isObject$9;
315
+
316
+ var $TypeError$7 = TypeError;
317
+
318
+ // `OrdinaryToPrimitive` abstract operation
319
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
320
+ var ordinaryToPrimitive$1 = function (input, pref) {
321
+ var fn, val;
322
+ if (pref === 'string' && isCallable$b(fn = input.toString) && !isObject$6(val = call$7(fn, input))) return val;
323
+ if (isCallable$b(fn = input.valueOf) && !isObject$6(val = call$7(fn, input))) return val;
324
+ if (pref !== 'string' && isCallable$b(fn = input.toString) && !isObject$6(val = call$7(fn, input))) return val;
325
+ throw new $TypeError$7("Can't convert object to primitive value");
326
+ };
327
+
328
+ var shared$3 = {exports: {}};
329
+
330
+ var isPure = false;
331
+
332
+ var global$9 = global$e;
333
+
334
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
335
+ var defineProperty$6 = Object.defineProperty;
336
+
337
+ var defineGlobalProperty$3 = function (key, value) {
338
+ try {
339
+ defineProperty$6(global$9, key, { value: value, configurable: true, writable: true });
340
+ } catch (error) {
341
+ global$9[key] = value;
342
+ } return value;
343
+ };
344
+
345
+ var global$8 = global$e;
346
+ var defineGlobalProperty$2 = defineGlobalProperty$3;
347
+
348
+ var SHARED = '__core-js_shared__';
349
+ var store$3 = global$8[SHARED] || defineGlobalProperty$2(SHARED, {});
350
+
351
+ var sharedStore = store$3;
352
+
353
+ var store$2 = sharedStore;
354
+
355
+ (shared$3.exports = function (key, value) {
356
+ return store$2[key] || (store$2[key] = value !== undefined ? value : {});
357
+ })('versions', []).push({
358
+ version: '3.35.1',
359
+ mode: 'global',
360
+ copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
361
+ license: 'https://github.com/zloirock/core-js/blob/v3.35.1/LICENSE',
362
+ source: 'https://github.com/zloirock/core-js'
363
+ });
364
+
365
+ var uncurryThis$d = functionUncurryThis;
366
+
367
+ var id = 0;
368
+ var postfix = Math.random();
369
+ var toString$2 = uncurryThis$d(1.0.toString);
370
+
371
+ var uid$2 = function (key) {
372
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$2(++id + postfix, 36);
373
+ };
374
+
375
+ var global$7 = global$e;
376
+ var shared$2 = shared$3.exports;
377
+ var hasOwn$9 = hasOwnProperty_1;
378
+ var uid$1 = uid$2;
379
+ var NATIVE_SYMBOL = symbolConstructorDetection;
380
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
381
+
382
+ var Symbol$1 = global$7.Symbol;
383
+ var WellKnownSymbolsStore = shared$2('wks');
384
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
385
+
386
+ var wellKnownSymbol$c = function (name) {
387
+ if (!hasOwn$9(WellKnownSymbolsStore, name)) {
388
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$9(Symbol$1, name)
389
+ ? Symbol$1[name]
390
+ : createWellKnownSymbol('Symbol.' + name);
391
+ } return WellKnownSymbolsStore[name];
392
+ };
393
+
394
+ var call$6 = functionCall;
395
+ var isObject$5 = isObject$9;
396
+ var isSymbol$1 = isSymbol$2;
397
+ var getMethod$1 = getMethod$2;
398
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
399
+ var wellKnownSymbol$b = wellKnownSymbol$c;
400
+
401
+ var $TypeError$6 = TypeError;
402
+ var TO_PRIMITIVE = wellKnownSymbol$b('toPrimitive');
403
+
404
+ // `ToPrimitive` abstract operation
405
+ // https://tc39.es/ecma262/#sec-toprimitive
406
+ var toPrimitive$1 = function (input, pref) {
407
+ if (!isObject$5(input) || isSymbol$1(input)) return input;
408
+ var exoticToPrim = getMethod$1(input, TO_PRIMITIVE);
409
+ var result;
410
+ if (exoticToPrim) {
411
+ if (pref === undefined) pref = 'default';
412
+ result = call$6(exoticToPrim, input, pref);
413
+ if (!isObject$5(result) || isSymbol$1(result)) return result;
414
+ throw new $TypeError$6("Can't convert object to primitive value");
415
+ }
416
+ if (pref === undefined) pref = 'number';
417
+ return ordinaryToPrimitive(input, pref);
418
+ };
419
+
420
+ var toPrimitive = toPrimitive$1;
421
+ var isSymbol = isSymbol$2;
422
+
423
+ // `ToPropertyKey` abstract operation
424
+ // https://tc39.es/ecma262/#sec-topropertykey
425
+ var toPropertyKey$2 = function (argument) {
426
+ var key = toPrimitive(argument, 'string');
427
+ return isSymbol(key) ? key : key + '';
428
+ };
429
+
430
+ var DESCRIPTORS$9 = descriptors;
431
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
432
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
433
+ var anObject$8 = anObject$9;
434
+ var toPropertyKey$1 = toPropertyKey$2;
435
+
436
+ var $TypeError$5 = TypeError;
437
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
438
+ var $defineProperty = Object.defineProperty;
439
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
440
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
441
+ var ENUMERABLE = 'enumerable';
442
+ var CONFIGURABLE = 'configurable';
443
+ var WRITABLE = 'writable';
444
+
445
+ // `Object.defineProperty` method
446
+ // https://tc39.es/ecma262/#sec-object.defineproperty
447
+ objectDefineProperty.f = DESCRIPTORS$9 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
448
+ anObject$8(O);
449
+ P = toPropertyKey$1(P);
450
+ anObject$8(Attributes);
451
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
452
+ var current = $getOwnPropertyDescriptor$1(O, P);
453
+ if (current && current[WRITABLE]) {
454
+ O[P] = Attributes.value;
455
+ Attributes = {
456
+ configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
457
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
458
+ writable: false
459
+ };
460
+ }
461
+ } return $defineProperty(O, P, Attributes);
462
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
463
+ anObject$8(O);
464
+ P = toPropertyKey$1(P);
465
+ anObject$8(Attributes);
466
+ if (IE8_DOM_DEFINE$1) try {
467
+ return $defineProperty(O, P, Attributes);
468
+ } catch (error) { /* empty */ }
469
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$5('Accessors not supported');
470
+ if ('value' in Attributes) O[P] = Attributes.value;
471
+ return O;
472
+ };
473
+
474
+ var makeBuiltIn$3 = {exports: {}};
475
+
476
+ var uncurryThis$c = functionUncurryThis;
477
+ var isCallable$a = isCallable$g;
478
+ var store$1 = sharedStore;
479
+
480
+ var functionToString = uncurryThis$c(Function.toString);
481
+
482
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
483
+ if (!isCallable$a(store$1.inspectSource)) {
484
+ store$1.inspectSource = function (it) {
485
+ return functionToString(it);
486
+ };
487
+ }
488
+
489
+ var inspectSource$2 = store$1.inspectSource;
490
+
491
+ var global$6 = global$e;
492
+ var isCallable$9 = isCallable$g;
493
+
494
+ var WeakMap$1 = global$6.WeakMap;
495
+
496
+ var weakMapBasicDetection = isCallable$9(WeakMap$1) && /native code/.test(String(WeakMap$1));
497
+
498
+ var createPropertyDescriptor$4 = function (bitmap, value) {
499
+ return {
500
+ enumerable: !(bitmap & 1),
501
+ configurable: !(bitmap & 2),
502
+ writable: !(bitmap & 4),
503
+ value: value
504
+ };
505
+ };
506
+
507
+ var DESCRIPTORS$8 = descriptors;
508
+ var definePropertyModule$3 = objectDefineProperty;
509
+ var createPropertyDescriptor$3 = createPropertyDescriptor$4;
510
+
511
+ var createNonEnumerableProperty$4 = DESCRIPTORS$8 ? function (object, key, value) {
512
+ return definePropertyModule$3.f(object, key, createPropertyDescriptor$3(1, value));
513
+ } : function (object, key, value) {
514
+ object[key] = value;
515
+ return object;
516
+ };
517
+
518
+ var shared$1 = shared$3.exports;
519
+ var uid = uid$2;
520
+
521
+ var keys = shared$1('keys');
522
+
523
+ var sharedKey$3 = function (key) {
524
+ return keys[key] || (keys[key] = uid(key));
525
+ };
526
+
527
+ var hiddenKeys$4 = {};
528
+
529
+ var NATIVE_WEAK_MAP = weakMapBasicDetection;
530
+ var global$5 = global$e;
531
+ var isObject$4 = isObject$9;
532
+ var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
533
+ var hasOwn$8 = hasOwnProperty_1;
534
+ var shared = sharedStore;
535
+ var sharedKey$2 = sharedKey$3;
536
+ var hiddenKeys$3 = hiddenKeys$4;
537
+
538
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
539
+ var TypeError$2 = global$5.TypeError;
540
+ var WeakMap = global$5.WeakMap;
541
+ var set, get, has;
542
+
543
+ var enforce = function (it) {
544
+ return has(it) ? get(it) : set(it, {});
545
+ };
546
+
547
+ var getterFor = function (TYPE) {
548
+ return function (it) {
549
+ var state;
550
+ if (!isObject$4(it) || (state = get(it)).type !== TYPE) {
551
+ throw new TypeError$2('Incompatible receiver, ' + TYPE + ' required');
552
+ } return state;
553
+ };
554
+ };
555
+
556
+ if (NATIVE_WEAK_MAP || shared.state) {
557
+ var store = shared.state || (shared.state = new WeakMap());
558
+ /* eslint-disable no-self-assign -- prototype methods protection */
559
+ store.get = store.get;
560
+ store.has = store.has;
561
+ store.set = store.set;
562
+ /* eslint-enable no-self-assign -- prototype methods protection */
563
+ set = function (it, metadata) {
564
+ if (store.has(it)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
565
+ metadata.facade = it;
566
+ store.set(it, metadata);
567
+ return metadata;
568
+ };
569
+ get = function (it) {
570
+ return store.get(it) || {};
571
+ };
572
+ has = function (it) {
573
+ return store.has(it);
574
+ };
575
+ } else {
576
+ var STATE = sharedKey$2('state');
577
+ hiddenKeys$3[STATE] = true;
578
+ set = function (it, metadata) {
579
+ if (hasOwn$8(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
580
+ metadata.facade = it;
581
+ createNonEnumerableProperty$3(it, STATE, metadata);
582
+ return metadata;
583
+ };
584
+ get = function (it) {
585
+ return hasOwn$8(it, STATE) ? it[STATE] : {};
586
+ };
587
+ has = function (it) {
588
+ return hasOwn$8(it, STATE);
589
+ };
590
+ }
591
+
592
+ var internalState = {
593
+ set: set,
594
+ get: get,
595
+ has: has,
596
+ enforce: enforce,
597
+ getterFor: getterFor
598
+ };
599
+
600
+ var uncurryThis$b = functionUncurryThis;
601
+ var fails$8 = fails$e;
602
+ var isCallable$8 = isCallable$g;
603
+ var hasOwn$7 = hasOwnProperty_1;
604
+ var DESCRIPTORS$7 = descriptors;
605
+ var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
606
+ var inspectSource$1 = inspectSource$2;
607
+ var InternalStateModule$2 = internalState;
608
+
609
+ var enforceInternalState = InternalStateModule$2.enforce;
610
+ var getInternalState$1 = InternalStateModule$2.get;
611
+ var $String$2 = String;
612
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
613
+ var defineProperty$5 = Object.defineProperty;
614
+ var stringSlice$2 = uncurryThis$b(''.slice);
615
+ var replace$1 = uncurryThis$b(''.replace);
616
+ var join$1 = uncurryThis$b([].join);
617
+
618
+ var CONFIGURABLE_LENGTH = DESCRIPTORS$7 && !fails$8(function () {
619
+ return defineProperty$5(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
620
+ });
621
+
622
+ var TEMPLATE = String(String).split('String');
623
+
624
+ var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
625
+ if (stringSlice$2($String$2(name), 0, 7) === 'Symbol(') {
626
+ name = '[' + replace$1($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
627
+ }
628
+ if (options && options.getter) name = 'get ' + name;
629
+ if (options && options.setter) name = 'set ' + name;
630
+ if (!hasOwn$7(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
631
+ if (DESCRIPTORS$7) defineProperty$5(value, 'name', { value: name, configurable: true });
632
+ else value.name = name;
633
+ }
634
+ if (CONFIGURABLE_LENGTH && options && hasOwn$7(options, 'arity') && value.length !== options.arity) {
635
+ defineProperty$5(value, 'length', { value: options.arity });
636
+ }
637
+ try {
638
+ if (options && hasOwn$7(options, 'constructor') && options.constructor) {
639
+ if (DESCRIPTORS$7) defineProperty$5(value, 'prototype', { writable: false });
640
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
641
+ } else if (value.prototype) value.prototype = undefined;
642
+ } catch (error) { /* empty */ }
643
+ var state = enforceInternalState(value);
644
+ if (!hasOwn$7(state, 'source')) {
645
+ state.source = join$1(TEMPLATE, typeof name == 'string' ? name : '');
646
+ } return value;
647
+ };
648
+
649
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
650
+ // eslint-disable-next-line no-extend-native -- required
651
+ Function.prototype.toString = makeBuiltIn$2(function toString() {
652
+ return isCallable$8(this) && getInternalState$1(this).source || inspectSource$1(this);
653
+ }, 'toString');
654
+
655
+ var isCallable$7 = isCallable$g;
656
+ var definePropertyModule$2 = objectDefineProperty;
657
+ var makeBuiltIn$1 = makeBuiltIn$3.exports;
658
+ var defineGlobalProperty$1 = defineGlobalProperty$3;
659
+
660
+ var defineBuiltIn$6 = function (O, key, value, options) {
661
+ if (!options) options = {};
662
+ var simple = options.enumerable;
663
+ var name = options.name !== undefined ? options.name : key;
664
+ if (isCallable$7(value)) makeBuiltIn$1(value, name, options);
665
+ if (options.global) {
666
+ if (simple) O[key] = value;
667
+ else defineGlobalProperty$1(key, value);
668
+ } else {
669
+ try {
670
+ if (!options.unsafe) delete O[key];
671
+ else if (O[key]) simple = true;
672
+ } catch (error) { /* empty */ }
673
+ if (simple) O[key] = value;
674
+ else definePropertyModule$2.f(O, key, {
675
+ value: value,
676
+ enumerable: false,
677
+ configurable: !options.nonConfigurable,
678
+ writable: !options.nonWritable
679
+ });
680
+ } return O;
681
+ };
682
+
683
+ var wellKnownSymbol$a = wellKnownSymbol$c;
684
+
685
+ var TO_STRING_TAG$2 = wellKnownSymbol$a('toStringTag');
686
+ var test = {};
687
+
688
+ test[TO_STRING_TAG$2] = 'z';
689
+
690
+ var toStringTagSupport = String(test) === '[object z]';
691
+
692
+ var uncurryThis$a = functionUncurryThis;
693
+
694
+ var toString$1 = uncurryThis$a({}.toString);
695
+ var stringSlice$1 = uncurryThis$a(''.slice);
696
+
697
+ var classofRaw$2 = function (it) {
698
+ return stringSlice$1(toString$1(it), 8, -1);
699
+ };
700
+
701
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
702
+ var isCallable$6 = isCallable$g;
703
+ var classofRaw$1 = classofRaw$2;
704
+ var wellKnownSymbol$9 = wellKnownSymbol$c;
705
+
706
+ var TO_STRING_TAG$1 = wellKnownSymbol$9('toStringTag');
707
+ var $Object$2 = Object;
708
+
709
+ // ES3 wrong here
710
+ var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments';
711
+
712
+ // fallback for IE11 Script Access Denied error
713
+ var tryGet = function (it, key) {
714
+ try {
715
+ return it[key];
716
+ } catch (error) { /* empty */ }
717
+ };
718
+
719
+ // getting tag from ES6+ `Object.prototype.toString`
720
+ var classof$6 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
721
+ var O, tag, result;
722
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
723
+ // @@toStringTag case
724
+ : typeof (tag = tryGet(O = $Object$2(it), TO_STRING_TAG$1)) == 'string' ? tag
725
+ // builtinTag case
726
+ : CORRECT_ARGUMENTS ? classofRaw$1(O)
727
+ // ES3 arguments fallback
728
+ : (result = classofRaw$1(O)) === 'Object' && isCallable$6(O.callee) ? 'Arguments' : result;
729
+ };
730
+
731
+ var classof$5 = classof$6;
732
+
733
+ var $String$1 = String;
734
+
735
+ var toString = function (argument) {
736
+ if (classof$5(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
737
+ return $String$1(argument);
738
+ };
739
+
740
+ var anObject$7 = anObject$9;
741
+
742
+ // `RegExp.prototype.flags` getter implementation
743
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
744
+ var regexpFlags = function () {
745
+ var that = anObject$7(this);
746
+ var result = '';
747
+ if (that.hasIndices) result += 'd';
748
+ if (that.global) result += 'g';
749
+ if (that.ignoreCase) result += 'i';
750
+ if (that.multiline) result += 'm';
751
+ if (that.dotAll) result += 's';
752
+ if (that.unicode) result += 'u';
753
+ if (that.unicodeSets) result += 'v';
754
+ if (that.sticky) result += 'y';
755
+ return result;
756
+ };
757
+
758
+ var call$5 = functionCall;
759
+ var hasOwn$6 = hasOwnProperty_1;
760
+ var isPrototypeOf$1 = objectIsPrototypeOf;
761
+ var regExpFlags = regexpFlags;
762
+
763
+ var RegExpPrototype$1 = RegExp.prototype;
764
+
765
+ var regexpGetFlags = function (R) {
766
+ var flags = R.flags;
767
+ return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$6(R, 'flags') && isPrototypeOf$1(RegExpPrototype$1, R)
768
+ ? call$5(regExpFlags, R) : flags;
769
+ };
770
+
771
+ var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
772
+ var defineBuiltIn$5 = defineBuiltIn$6;
773
+ var anObject$6 = anObject$9;
774
+ var $toString$1 = toString;
775
+ var fails$7 = fails$e;
776
+ var getRegExpFlags = regexpGetFlags;
777
+
778
+ var TO_STRING = 'toString';
779
+ var RegExpPrototype = RegExp.prototype;
780
+ var nativeToString = RegExpPrototype[TO_STRING];
781
+
782
+ var NOT_GENERIC = fails$7(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
783
+ // FF44- RegExp#toString has a wrong name
784
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && nativeToString.name !== TO_STRING;
785
+
786
+ // `RegExp.prototype.toString` method
787
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
788
+ if (NOT_GENERIC || INCORRECT_NAME) {
789
+ defineBuiltIn$5(RegExpPrototype, TO_STRING, function toString() {
790
+ var R = anObject$6(this);
791
+ var pattern = $toString$1(R.source);
792
+ var flags = $toString$1(getRegExpFlags(R));
793
+ return '/' + pattern + '/' + flags;
794
+ }, { unsafe: true });
795
+ }
796
+
797
+ var objectGetOwnPropertyDescriptor = {};
798
+
799
+ var objectPropertyIsEnumerable = {};
800
+
801
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
802
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
803
+ var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
804
+
805
+ // Nashorn ~ JDK8 bug
806
+ var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
807
+
808
+ // `Object.prototype.propertyIsEnumerable` method implementation
809
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
810
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
811
+ var descriptor = getOwnPropertyDescriptor$2(this, V);
812
+ return !!descriptor && descriptor.enumerable;
813
+ } : $propertyIsEnumerable;
814
+
815
+ var uncurryThis$9 = functionUncurryThis;
816
+ var fails$6 = fails$e;
817
+ var classof$4 = classofRaw$2;
818
+
819
+ var $Object$1 = Object;
820
+ var split$1 = uncurryThis$9(''.split);
821
+
822
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
823
+ var indexedObject = fails$6(function () {
824
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
825
+ // eslint-disable-next-line no-prototype-builtins -- safe
826
+ return !$Object$1('z').propertyIsEnumerable(0);
827
+ }) ? function (it) {
828
+ return classof$4(it) === 'String' ? split$1(it, '') : $Object$1(it);
829
+ } : $Object$1;
830
+
831
+ // toObject with fallback for non-array-like ES3 strings
832
+ var IndexedObject$1 = indexedObject;
833
+ var requireObjectCoercible = requireObjectCoercible$2;
834
+
835
+ var toIndexedObject$5 = function (it) {
836
+ return IndexedObject$1(requireObjectCoercible(it));
837
+ };
838
+
839
+ var DESCRIPTORS$6 = descriptors;
840
+ var call$4 = functionCall;
841
+ var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
842
+ var createPropertyDescriptor$2 = createPropertyDescriptor$4;
843
+ var toIndexedObject$4 = toIndexedObject$5;
844
+ var toPropertyKey = toPropertyKey$2;
845
+ var hasOwn$5 = hasOwnProperty_1;
846
+ var IE8_DOM_DEFINE = ie8DomDefine;
847
+
848
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
849
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
850
+
851
+ // `Object.getOwnPropertyDescriptor` method
852
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
853
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$6 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
854
+ O = toIndexedObject$4(O);
855
+ P = toPropertyKey(P);
856
+ if (IE8_DOM_DEFINE) try {
857
+ return $getOwnPropertyDescriptor(O, P);
858
+ } catch (error) { /* empty */ }
859
+ if (hasOwn$5(O, P)) return createPropertyDescriptor$2(!call$4(propertyIsEnumerableModule$1.f, O, P), O[P]);
860
+ };
861
+
862
+ var objectGetOwnPropertyNames = {};
863
+
864
+ var ceil = Math.ceil;
865
+ var floor$1 = Math.floor;
866
+
867
+ // `Math.trunc` method
868
+ // https://tc39.es/ecma262/#sec-math.trunc
869
+ // eslint-disable-next-line es/no-math-trunc -- safe
870
+ var mathTrunc = Math.trunc || function trunc(x) {
871
+ var n = +x;
872
+ return (n > 0 ? floor$1 : ceil)(n);
873
+ };
874
+
875
+ var trunc = mathTrunc;
876
+
877
+ // `ToIntegerOrInfinity` abstract operation
878
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
879
+ var toIntegerOrInfinity$2 = function (argument) {
880
+ var number = +argument;
881
+ // eslint-disable-next-line no-self-compare -- NaN check
882
+ return number !== number || number === 0 ? 0 : trunc(number);
883
+ };
884
+
885
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
886
+
887
+ var max = Math.max;
888
+ var min$1 = Math.min;
889
+
890
+ // Helper for a popular repeating case of the spec:
891
+ // Let integer be ? ToInteger(index).
892
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
893
+ var toAbsoluteIndex$1 = function (index, length) {
894
+ var integer = toIntegerOrInfinity$1(index);
895
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
896
+ };
897
+
898
+ var toIntegerOrInfinity = toIntegerOrInfinity$2;
899
+
900
+ var min = Math.min;
901
+
902
+ // `ToLength` abstract operation
903
+ // https://tc39.es/ecma262/#sec-tolength
904
+ var toLength$1 = function (argument) {
905
+ var len = toIntegerOrInfinity(argument);
906
+ return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
907
+ };
908
+
909
+ var toLength = toLength$1;
910
+
911
+ // `LengthOfArrayLike` abstract operation
912
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
913
+ var lengthOfArrayLike$3 = function (obj) {
914
+ return toLength(obj.length);
915
+ };
916
+
917
+ var toIndexedObject$3 = toIndexedObject$5;
918
+ var toAbsoluteIndex = toAbsoluteIndex$1;
919
+ var lengthOfArrayLike$2 = lengthOfArrayLike$3;
920
+
921
+ // `Array.prototype.{ indexOf, includes }` methods implementation
922
+ var createMethod = function (IS_INCLUDES) {
923
+ return function ($this, el, fromIndex) {
924
+ var O = toIndexedObject$3($this);
925
+ var length = lengthOfArrayLike$2(O);
926
+ var index = toAbsoluteIndex(fromIndex, length);
927
+ var value;
928
+ // Array#includes uses SameValueZero equality algorithm
929
+ // eslint-disable-next-line no-self-compare -- NaN check
930
+ if (IS_INCLUDES && el !== el) while (length > index) {
931
+ value = O[index++];
932
+ // eslint-disable-next-line no-self-compare -- NaN check
933
+ if (value !== value) return true;
934
+ // Array#indexOf ignores holes, Array#includes - not
935
+ } else for (;length > index; index++) {
936
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
937
+ } return !IS_INCLUDES && -1;
938
+ };
939
+ };
940
+
941
+ var arrayIncludes = {
942
+ // `Array.prototype.includes` method
943
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
944
+ includes: createMethod(true),
945
+ // `Array.prototype.indexOf` method
946
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
947
+ indexOf: createMethod(false)
948
+ };
949
+
950
+ var uncurryThis$8 = functionUncurryThis;
951
+ var hasOwn$4 = hasOwnProperty_1;
952
+ var toIndexedObject$2 = toIndexedObject$5;
953
+ var indexOf = arrayIncludes.indexOf;
954
+ var hiddenKeys$2 = hiddenKeys$4;
955
+
956
+ var push$1 = uncurryThis$8([].push);
957
+
958
+ var objectKeysInternal = function (object, names) {
959
+ var O = toIndexedObject$2(object);
960
+ var i = 0;
961
+ var result = [];
962
+ var key;
963
+ for (key in O) !hasOwn$4(hiddenKeys$2, key) && hasOwn$4(O, key) && push$1(result, key);
964
+ // Don't enum bug & hidden keys
965
+ while (names.length > i) if (hasOwn$4(O, key = names[i++])) {
966
+ ~indexOf(result, key) || push$1(result, key);
967
+ }
968
+ return result;
969
+ };
970
+
971
+ // IE8- don't enum bug keys
972
+ var enumBugKeys$3 = [
973
+ 'constructor',
974
+ 'hasOwnProperty',
975
+ 'isPrototypeOf',
976
+ 'propertyIsEnumerable',
977
+ 'toLocaleString',
978
+ 'toString',
979
+ 'valueOf'
980
+ ];
981
+
982
+ var internalObjectKeys$1 = objectKeysInternal;
983
+ var enumBugKeys$2 = enumBugKeys$3;
984
+
985
+ var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
986
+
987
+ // `Object.getOwnPropertyNames` method
988
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
989
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
990
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
991
+ return internalObjectKeys$1(O, hiddenKeys$1);
992
+ };
993
+
994
+ var objectGetOwnPropertySymbols = {};
995
+
996
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
997
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
998
+
999
+ var getBuiltIn$2 = getBuiltIn$4;
1000
+ var uncurryThis$7 = functionUncurryThis;
1001
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1002
+ var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
1003
+ var anObject$5 = anObject$9;
1004
+
1005
+ var concat$1 = uncurryThis$7([].concat);
1006
+
1007
+ // all object keys, includes non-enumerable and symbols
1008
+ var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
1009
+ var keys = getOwnPropertyNamesModule.f(anObject$5(it));
1010
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
1011
+ return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
1012
+ };
1013
+
1014
+ var hasOwn$3 = hasOwnProperty_1;
1015
+ var ownKeys = ownKeys$1;
1016
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1017
+ var definePropertyModule$1 = objectDefineProperty;
1018
+
1019
+ var copyConstructorProperties$1 = function (target, source, exceptions) {
1020
+ var keys = ownKeys(source);
1021
+ var defineProperty = definePropertyModule$1.f;
1022
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1023
+ for (var i = 0; i < keys.length; i++) {
1024
+ var key = keys[i];
1025
+ if (!hasOwn$3(target, key) && !(exceptions && hasOwn$3(exceptions, key))) {
1026
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1027
+ }
1028
+ }
1029
+ };
1030
+
1031
+ var fails$5 = fails$e;
1032
+ var isCallable$5 = isCallable$g;
1033
+
1034
+ var replacement = /#|\.prototype\./;
1035
+
1036
+ var isForced$1 = function (feature, detection) {
1037
+ var value = data[normalize(feature)];
1038
+ return value === POLYFILL ? true
1039
+ : value === NATIVE ? false
1040
+ : isCallable$5(detection) ? fails$5(detection)
1041
+ : !!detection;
1042
+ };
1043
+
1044
+ var normalize = isForced$1.normalize = function (string) {
1045
+ return String(string).replace(replacement, '.').toLowerCase();
1046
+ };
1047
+
1048
+ var data = isForced$1.data = {};
1049
+ var NATIVE = isForced$1.NATIVE = 'N';
1050
+ var POLYFILL = isForced$1.POLYFILL = 'P';
1051
+
1052
+ var isForced_1 = isForced$1;
1053
+
1054
+ var global$4 = global$e;
1055
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1056
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
1057
+ var defineBuiltIn$4 = defineBuiltIn$6;
1058
+ var defineGlobalProperty = defineGlobalProperty$3;
1059
+ var copyConstructorProperties = copyConstructorProperties$1;
1060
+ var isForced = isForced_1;
1061
+
1062
+ /*
1063
+ options.target - name of the target object
1064
+ options.global - target is the global object
1065
+ options.stat - export as static methods of target
1066
+ options.proto - export as prototype methods of target
1067
+ options.real - real prototype method for the `pure` version
1068
+ options.forced - export even if the native feature is available
1069
+ options.bind - bind methods to the target, required for the `pure` version
1070
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1071
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
1072
+ options.sham - add a flag to not completely full polyfills
1073
+ options.enumerable - export as enumerable property
1074
+ options.dontCallGetSet - prevent calling a getter on target
1075
+ options.name - the .name of the function if it does not match the key
1076
+ */
1077
+ var _export = function (options, source) {
1078
+ var TARGET = options.target;
1079
+ var GLOBAL = options.global;
1080
+ var STATIC = options.stat;
1081
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1082
+ if (GLOBAL) {
1083
+ target = global$4;
1084
+ } else if (STATIC) {
1085
+ target = global$4[TARGET] || defineGlobalProperty(TARGET, {});
1086
+ } else {
1087
+ target = global$4[TARGET] && global$4[TARGET].prototype;
1088
+ }
1089
+ if (target) for (key in source) {
1090
+ sourceProperty = source[key];
1091
+ if (options.dontCallGetSet) {
1092
+ descriptor = getOwnPropertyDescriptor$1(target, key);
1093
+ targetProperty = descriptor && descriptor.value;
1094
+ } else targetProperty = target[key];
1095
+ FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1096
+ // contained in target
1097
+ if (!FORCED && targetProperty !== undefined) {
1098
+ if (typeof sourceProperty == typeof targetProperty) continue;
1099
+ copyConstructorProperties(sourceProperty, targetProperty);
1100
+ }
1101
+ // add a flag to not completely full polyfills
1102
+ if (options.sham || (targetProperty && targetProperty.sham)) {
1103
+ createNonEnumerableProperty$2(sourceProperty, 'sham', true);
1104
+ }
1105
+ defineBuiltIn$4(target, key, sourceProperty, options);
1106
+ }
1107
+ };
1108
+
1109
+ var internalObjectKeys = objectKeysInternal;
1110
+ var enumBugKeys$1 = enumBugKeys$3;
1111
+
1112
+ // `Object.keys` method
1113
+ // https://tc39.es/ecma262/#sec-object.keys
1114
+ // eslint-disable-next-line es/no-object-keys -- safe
1115
+ var objectKeys$2 = Object.keys || function keys(O) {
1116
+ return internalObjectKeys(O, enumBugKeys$1);
1117
+ };
1118
+
1119
+ var DESCRIPTORS$5 = descriptors;
1120
+ var uncurryThis$6 = functionUncurryThis;
1121
+ var call$3 = functionCall;
1122
+ var fails$4 = fails$e;
1123
+ var objectKeys$1 = objectKeys$2;
1124
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1125
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1126
+ var toObject$2 = toObject$4;
1127
+ var IndexedObject = indexedObject;
1128
+
1129
+ // eslint-disable-next-line es/no-object-assign -- safe
1130
+ var $assign = Object.assign;
1131
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1132
+ var defineProperty$4 = Object.defineProperty;
1133
+ var concat = uncurryThis$6([].concat);
1134
+
1135
+ // `Object.assign` method
1136
+ // https://tc39.es/ecma262/#sec-object.assign
1137
+ var objectAssign = !$assign || fails$4(function () {
1138
+ // should have correct order of operations (Edge bug)
1139
+ if (DESCRIPTORS$5 && $assign({ b: 1 }, $assign(defineProperty$4({}, 'a', {
1140
+ enumerable: true,
1141
+ get: function () {
1142
+ defineProperty$4(this, 'b', {
1143
+ value: 3,
1144
+ enumerable: false
1145
+ });
1146
+ }
1147
+ }), { b: 2 })).b !== 1) return true;
1148
+ // should work with symbols and should have deterministic property order (V8 bug)
1149
+ var A = {};
1150
+ var B = {};
1151
+ // eslint-disable-next-line es/no-symbol -- safe
1152
+ var symbol = Symbol('assign detection');
1153
+ var alphabet = 'abcdefghijklmnopqrst';
1154
+ A[symbol] = 7;
1155
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1156
+ return $assign({}, A)[symbol] !== 7 || objectKeys$1($assign({}, B)).join('') !== alphabet;
1157
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1158
+ var T = toObject$2(target);
1159
+ var argumentsLength = arguments.length;
1160
+ var index = 1;
1161
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1162
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
1163
+ while (argumentsLength > index) {
1164
+ var S = IndexedObject(arguments[index++]);
1165
+ var keys = getOwnPropertySymbols ? concat(objectKeys$1(S), getOwnPropertySymbols(S)) : objectKeys$1(S);
1166
+ var length = keys.length;
1167
+ var j = 0;
1168
+ var key;
1169
+ while (length > j) {
1170
+ key = keys[j++];
1171
+ if (!DESCRIPTORS$5 || call$3(propertyIsEnumerable, S, key)) T[key] = S[key];
1172
+ }
1173
+ } return T;
1174
+ } : $assign;
1175
+
1176
+ var $$3 = _export;
1177
+ var assign = objectAssign;
1178
+
1179
+ // `Object.assign` method
1180
+ // https://tc39.es/ecma262/#sec-object.assign
1181
+ // eslint-disable-next-line es/no-object-assign -- required for testing
1182
+ $$3({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1183
+ assign: assign
1184
+ });
1185
+
1186
+ var objectDefineProperties = {};
1187
+
1188
+ var DESCRIPTORS$4 = descriptors;
1189
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1190
+ var definePropertyModule = objectDefineProperty;
1191
+ var anObject$4 = anObject$9;
1192
+ var toIndexedObject$1 = toIndexedObject$5;
1193
+ var objectKeys = objectKeys$2;
1194
+
1195
+ // `Object.defineProperties` method
1196
+ // https://tc39.es/ecma262/#sec-object.defineproperties
1197
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
1198
+ objectDefineProperties.f = DESCRIPTORS$4 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1199
+ anObject$4(O);
1200
+ var props = toIndexedObject$1(Properties);
1201
+ var keys = objectKeys(Properties);
1202
+ var length = keys.length;
1203
+ var index = 0;
1204
+ var key;
1205
+ while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
1206
+ return O;
1207
+ };
1208
+
1209
+ var getBuiltIn$1 = getBuiltIn$4;
1210
+
1211
+ var html$1 = getBuiltIn$1('document', 'documentElement');
1212
+
1213
+ /* global ActiveXObject -- old IE, WSH */
1214
+ var anObject$3 = anObject$9;
1215
+ var definePropertiesModule = objectDefineProperties;
1216
+ var enumBugKeys = enumBugKeys$3;
1217
+ var hiddenKeys = hiddenKeys$4;
1218
+ var html = html$1;
1219
+ var documentCreateElement$1 = documentCreateElement$2;
1220
+ var sharedKey$1 = sharedKey$3;
1221
+
1222
+ var GT = '>';
1223
+ var LT = '<';
1224
+ var PROTOTYPE = 'prototype';
1225
+ var SCRIPT = 'script';
1226
+ var IE_PROTO$1 = sharedKey$1('IE_PROTO');
1227
+
1228
+ var EmptyConstructor = function () { /* empty */ };
1229
+
1230
+ var scriptTag = function (content) {
1231
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1232
+ };
1233
+
1234
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1235
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
1236
+ activeXDocument.write(scriptTag(''));
1237
+ activeXDocument.close();
1238
+ var temp = activeXDocument.parentWindow.Object;
1239
+ activeXDocument = null; // avoid memory leak
1240
+ return temp;
1241
+ };
1242
+
1243
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
1244
+ var NullProtoObjectViaIFrame = function () {
1245
+ // Thrash, waste and sodomy: IE GC bug
1246
+ var iframe = documentCreateElement$1('iframe');
1247
+ var JS = 'java' + SCRIPT + ':';
1248
+ var iframeDocument;
1249
+ iframe.style.display = 'none';
1250
+ html.appendChild(iframe);
1251
+ // https://github.com/zloirock/core-js/issues/475
1252
+ iframe.src = String(JS);
1253
+ iframeDocument = iframe.contentWindow.document;
1254
+ iframeDocument.open();
1255
+ iframeDocument.write(scriptTag('document.F=Object'));
1256
+ iframeDocument.close();
1257
+ return iframeDocument.F;
1258
+ };
1259
+
1260
+ // Check for document.domain and active x support
1261
+ // No need to use active x approach when document.domain is not set
1262
+ // see https://github.com/es-shims/es5-shim/issues/150
1263
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1264
+ // avoid IE GC bug
1265
+ var activeXDocument;
1266
+ var NullProtoObject = function () {
1267
+ try {
1268
+ activeXDocument = new ActiveXObject('htmlfile');
1269
+ } catch (error) { /* ignore */ }
1270
+ NullProtoObject = typeof document != 'undefined'
1271
+ ? document.domain && activeXDocument
1272
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1273
+ : NullProtoObjectViaIFrame()
1274
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
1275
+ var length = enumBugKeys.length;
1276
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1277
+ return NullProtoObject();
1278
+ };
1279
+
1280
+ hiddenKeys[IE_PROTO$1] = true;
1281
+
1282
+ // `Object.create` method
1283
+ // https://tc39.es/ecma262/#sec-object.create
1284
+ // eslint-disable-next-line es/no-object-create -- safe
1285
+ var objectCreate = Object.create || function create(O, Properties) {
1286
+ var result;
1287
+ if (O !== null) {
1288
+ EmptyConstructor[PROTOTYPE] = anObject$3(O);
1289
+ result = new EmptyConstructor();
1290
+ EmptyConstructor[PROTOTYPE] = null;
1291
+ // add "__proto__" for Object.getPrototypeOf polyfill
1292
+ result[IE_PROTO$1] = O;
1293
+ } else result = NullProtoObject();
1294
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1295
+ };
1296
+
1297
+ var wellKnownSymbol$8 = wellKnownSymbol$c;
1298
+ var create$2 = objectCreate;
1299
+ var defineProperty$3 = objectDefineProperty.f;
1300
+
1301
+ var UNSCOPABLES = wellKnownSymbol$8('unscopables');
1302
+ var ArrayPrototype = Array.prototype;
1303
+
1304
+ // Array.prototype[@@unscopables]
1305
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1306
+ if (ArrayPrototype[UNSCOPABLES] === undefined) {
1307
+ defineProperty$3(ArrayPrototype, UNSCOPABLES, {
1308
+ configurable: true,
1309
+ value: create$2(null)
1310
+ });
1311
+ }
1312
+
1313
+ // add a key to Array.prototype[@@unscopables]
1314
+ var addToUnscopables$2 = function (key) {
1315
+ ArrayPrototype[UNSCOPABLES][key] = true;
1316
+ };
1317
+
1318
+ var iterators = {};
1319
+
1320
+ var fails$3 = fails$e;
1321
+
1322
+ var correctPrototypeGetter = !fails$3(function () {
1323
+ function F() { /* empty */ }
1324
+ F.prototype.constructor = null;
1325
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1326
+ return Object.getPrototypeOf(new F()) !== F.prototype;
1327
+ });
1328
+
1329
+ var hasOwn$2 = hasOwnProperty_1;
1330
+ var isCallable$4 = isCallable$g;
1331
+ var toObject$1 = toObject$4;
1332
+ var sharedKey = sharedKey$3;
1333
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1334
+
1335
+ var IE_PROTO = sharedKey('IE_PROTO');
1336
+ var $Object = Object;
1337
+ var ObjectPrototype = $Object.prototype;
1338
+
1339
+ // `Object.getPrototypeOf` method
1340
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
1341
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
1342
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
1343
+ var object = toObject$1(O);
1344
+ if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
1345
+ var constructor = object.constructor;
1346
+ if (isCallable$4(constructor) && object instanceof constructor) {
1347
+ return constructor.prototype;
1348
+ } return object instanceof $Object ? ObjectPrototype : null;
1349
+ };
1350
+
1351
+ var fails$2 = fails$e;
1352
+ var isCallable$3 = isCallable$g;
1353
+ var isObject$3 = isObject$9;
1354
+ var getPrototypeOf$1 = objectGetPrototypeOf;
1355
+ var defineBuiltIn$3 = defineBuiltIn$6;
1356
+ var wellKnownSymbol$7 = wellKnownSymbol$c;
1357
+
1358
+ var ITERATOR$5 = wellKnownSymbol$7('iterator');
1359
+ var BUGGY_SAFARI_ITERATORS$1 = false;
1360
+
1361
+ // `%IteratorPrototype%` object
1362
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1363
+ var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1364
+
1365
+ /* eslint-disable es/no-array-prototype-keys -- safe */
1366
+ if ([].keys) {
1367
+ arrayIterator = [].keys();
1368
+ // Safari 8 has buggy iterators w/o `next`
1369
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1370
+ else {
1371
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1372
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1373
+ }
1374
+ }
1375
+
1376
+ var NEW_ITERATOR_PROTOTYPE = !isObject$3(IteratorPrototype$2) || fails$2(function () {
1377
+ var test = {};
1378
+ // FF44- legacy iterators case
1379
+ return IteratorPrototype$2[ITERATOR$5].call(test) !== test;
1380
+ });
1381
+
1382
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1383
+
1384
+ // `%IteratorPrototype%[@@iterator]()` method
1385
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1386
+ if (!isCallable$3(IteratorPrototype$2[ITERATOR$5])) {
1387
+ defineBuiltIn$3(IteratorPrototype$2, ITERATOR$5, function () {
1388
+ return this;
1389
+ });
1390
+ }
1391
+
1392
+ var iteratorsCore = {
1393
+ IteratorPrototype: IteratorPrototype$2,
1394
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1395
+ };
1396
+
1397
+ var defineProperty$2 = objectDefineProperty.f;
1398
+ var hasOwn$1 = hasOwnProperty_1;
1399
+ var wellKnownSymbol$6 = wellKnownSymbol$c;
1400
+
1401
+ var TO_STRING_TAG = wellKnownSymbol$6('toStringTag');
1402
+
1403
+ var setToStringTag$4 = function (target, TAG, STATIC) {
1404
+ if (target && !STATIC) target = target.prototype;
1405
+ if (target && !hasOwn$1(target, TO_STRING_TAG)) {
1406
+ defineProperty$2(target, TO_STRING_TAG, { configurable: true, value: TAG });
1407
+ }
1408
+ };
1409
+
1410
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1411
+ var create$1 = objectCreate;
1412
+ var createPropertyDescriptor$1 = createPropertyDescriptor$4;
1413
+ var setToStringTag$3 = setToStringTag$4;
1414
+ var Iterators$3 = iterators;
1415
+
1416
+ var returnThis$1 = function () { return this; };
1417
+
1418
+ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1419
+ var TO_STRING_TAG = NAME + ' Iterator';
1420
+ IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor$1(+!ENUMERABLE_NEXT, next) });
1421
+ setToStringTag$3(IteratorConstructor, TO_STRING_TAG, false);
1422
+ Iterators$3[TO_STRING_TAG] = returnThis$1;
1423
+ return IteratorConstructor;
1424
+ };
1425
+
1426
+ var uncurryThis$5 = functionUncurryThis;
1427
+ var aCallable$3 = aCallable$5;
1428
+
1429
+ var functionUncurryThisAccessor = function (object, key, method) {
1430
+ try {
1431
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1432
+ return uncurryThis$5(aCallable$3(Object.getOwnPropertyDescriptor(object, key)[method]));
1433
+ } catch (error) { /* empty */ }
1434
+ };
1435
+
1436
+ var isObject$2 = isObject$9;
1437
+
1438
+ var isPossiblePrototype$1 = function (argument) {
1439
+ return isObject$2(argument) || argument === null;
1440
+ };
1441
+
1442
+ var isPossiblePrototype = isPossiblePrototype$1;
1443
+
1444
+ var $String = String;
1445
+ var $TypeError$4 = TypeError;
1446
+
1447
+ var aPossiblePrototype$1 = function (argument) {
1448
+ if (isPossiblePrototype(argument)) return argument;
1449
+ throw new $TypeError$4("Can't set " + $String(argument) + ' as a prototype');
1450
+ };
1451
+
1452
+ /* eslint-disable no-proto -- safe */
1453
+ var uncurryThisAccessor = functionUncurryThisAccessor;
1454
+ var anObject$2 = anObject$9;
1455
+ var aPossiblePrototype = aPossiblePrototype$1;
1456
+
1457
+ // `Object.setPrototypeOf` method
1458
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1459
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1460
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
1461
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1462
+ var CORRECT_SETTER = false;
1463
+ var test = {};
1464
+ var setter;
1465
+ try {
1466
+ setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
1467
+ setter(test, []);
1468
+ CORRECT_SETTER = test instanceof Array;
1469
+ } catch (error) { /* empty */ }
1470
+ return function setPrototypeOf(O, proto) {
1471
+ anObject$2(O);
1472
+ aPossiblePrototype(proto);
1473
+ if (CORRECT_SETTER) setter(O, proto);
1474
+ else O.__proto__ = proto;
1475
+ return O;
1476
+ };
1477
+ }() : undefined);
1478
+
1479
+ var $$2 = _export;
1480
+ var call$2 = functionCall;
1481
+ var FunctionName = functionName;
1482
+ var isCallable$2 = isCallable$g;
1483
+ var createIteratorConstructor$1 = iteratorCreateConstructor;
1484
+ var getPrototypeOf = objectGetPrototypeOf;
1485
+ var setPrototypeOf = objectSetPrototypeOf;
1486
+ var setToStringTag$2 = setToStringTag$4;
1487
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
1488
+ var defineBuiltIn$2 = defineBuiltIn$6;
1489
+ var wellKnownSymbol$5 = wellKnownSymbol$c;
1490
+ var Iterators$2 = iterators;
1491
+ var IteratorsCore = iteratorsCore;
1492
+
1493
+ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
1494
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1495
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
1496
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1497
+ var ITERATOR$4 = wellKnownSymbol$5('iterator');
1498
+ var KEYS = 'keys';
1499
+ var VALUES = 'values';
1500
+ var ENTRIES = 'entries';
1501
+
1502
+ var returnThis = function () { return this; };
1503
+
1504
+ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1505
+ createIteratorConstructor$1(IteratorConstructor, NAME, next);
1506
+
1507
+ var getIterationMethod = function (KIND) {
1508
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1509
+ if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
1510
+
1511
+ switch (KIND) {
1512
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1513
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1514
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1515
+ }
1516
+
1517
+ return function () { return new IteratorConstructor(this); };
1518
+ };
1519
+
1520
+ var TO_STRING_TAG = NAME + ' Iterator';
1521
+ var INCORRECT_VALUES_NAME = false;
1522
+ var IterablePrototype = Iterable.prototype;
1523
+ var nativeIterator = IterablePrototype[ITERATOR$4]
1524
+ || IterablePrototype['@@iterator']
1525
+ || DEFAULT && IterablePrototype[DEFAULT];
1526
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1527
+ var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1528
+ var CurrentIteratorPrototype, methods, KEY;
1529
+
1530
+ // fix native
1531
+ if (anyNativeIterator) {
1532
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1533
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1534
+ if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1535
+ if (setPrototypeOf) {
1536
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
1537
+ } else if (!isCallable$2(CurrentIteratorPrototype[ITERATOR$4])) {
1538
+ defineBuiltIn$2(CurrentIteratorPrototype, ITERATOR$4, returnThis);
1539
+ }
1540
+ }
1541
+ // Set @@toStringTag to native iterators
1542
+ setToStringTag$2(CurrentIteratorPrototype, TO_STRING_TAG, true);
1543
+ }
1544
+ }
1545
+
1546
+ // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1547
+ if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1548
+ if (CONFIGURABLE_FUNCTION_NAME) {
1549
+ createNonEnumerableProperty$1(IterablePrototype, 'name', VALUES);
1550
+ } else {
1551
+ INCORRECT_VALUES_NAME = true;
1552
+ defaultIterator = function values() { return call$2(nativeIterator, this); };
1553
+ }
1554
+ }
1555
+
1556
+ // export additional methods
1557
+ if (DEFAULT) {
1558
+ methods = {
1559
+ values: getIterationMethod(VALUES),
1560
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1561
+ entries: getIterationMethod(ENTRIES)
1562
+ };
1563
+ if (FORCED) for (KEY in methods) {
1564
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1565
+ defineBuiltIn$2(IterablePrototype, KEY, methods[KEY]);
1566
+ }
1567
+ } else $$2({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1568
+ }
1569
+
1570
+ // define iterator
1571
+ if (IterablePrototype[ITERATOR$4] !== defaultIterator) {
1572
+ defineBuiltIn$2(IterablePrototype, ITERATOR$4, defaultIterator, { name: DEFAULT });
1573
+ }
1574
+ Iterators$2[NAME] = defaultIterator;
1575
+
1576
+ return methods;
1577
+ };
1578
+
1579
+ // `CreateIterResultObject` abstract operation
1580
+ // https://tc39.es/ecma262/#sec-createiterresultobject
1581
+ var createIterResultObject$2 = function (value, done) {
1582
+ return { value: value, done: done };
1583
+ };
1584
+
1585
+ var toIndexedObject = toIndexedObject$5;
1586
+ var addToUnscopables$1 = addToUnscopables$2;
1587
+ var Iterators$1 = iterators;
1588
+ var InternalStateModule$1 = internalState;
1589
+ var defineProperty$1 = objectDefineProperty.f;
1590
+ var defineIterator = iteratorDefine;
1591
+ var createIterResultObject$1 = createIterResultObject$2;
1592
+ var DESCRIPTORS$3 = descriptors;
1593
+
1594
+ var ARRAY_ITERATOR = 'Array Iterator';
1595
+ var setInternalState$1 = InternalStateModule$1.set;
1596
+ var getInternalState = InternalStateModule$1.getterFor(ARRAY_ITERATOR);
1597
+
1598
+ // `Array.prototype.entries` method
1599
+ // https://tc39.es/ecma262/#sec-array.prototype.entries
1600
+ // `Array.prototype.keys` method
1601
+ // https://tc39.es/ecma262/#sec-array.prototype.keys
1602
+ // `Array.prototype.values` method
1603
+ // https://tc39.es/ecma262/#sec-array.prototype.values
1604
+ // `Array.prototype[@@iterator]` method
1605
+ // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1606
+ // `CreateArrayIterator` internal method
1607
+ // https://tc39.es/ecma262/#sec-createarrayiterator
1608
+ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1609
+ setInternalState$1(this, {
1610
+ type: ARRAY_ITERATOR,
1611
+ target: toIndexedObject(iterated), // target
1612
+ index: 0, // next index
1613
+ kind: kind // kind
1614
+ });
1615
+ // `%ArrayIteratorPrototype%.next` method
1616
+ // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1617
+ }, function () {
1618
+ var state = getInternalState(this);
1619
+ var target = state.target;
1620
+ var index = state.index++;
1621
+ if (!target || index >= target.length) {
1622
+ state.target = undefined;
1623
+ return createIterResultObject$1(undefined, true);
1624
+ }
1625
+ switch (state.kind) {
1626
+ case 'keys': return createIterResultObject$1(index, false);
1627
+ case 'values': return createIterResultObject$1(target[index], false);
1628
+ } return createIterResultObject$1([index, target[index]], false);
1629
+ }, 'values');
1630
+
1631
+ // argumentsList[@@iterator] is %ArrayProto_values%
1632
+ // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1633
+ // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1634
+ var values = Iterators$1.Arguments = Iterators$1.Array;
1635
+
1636
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1637
+ addToUnscopables$1('keys');
1638
+ addToUnscopables$1('values');
1639
+ addToUnscopables$1('entries');
1640
+
1641
+ // V8 ~ Chrome 45- bug
1642
+ if (DESCRIPTORS$3 && values.name !== 'values') try {
1643
+ defineProperty$1(values, 'name', { value: 'values' });
1644
+ } catch (error) { /* empty */ }
1645
+
1646
+ // iterable DOM collections
1647
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1648
+ var domIterables = {
1649
+ CSSRuleList: 0,
1650
+ CSSStyleDeclaration: 0,
1651
+ CSSValueList: 0,
1652
+ ClientRectList: 0,
1653
+ DOMRectList: 0,
1654
+ DOMStringList: 0,
1655
+ DOMTokenList: 1,
1656
+ DataTransferItemList: 0,
1657
+ FileList: 0,
1658
+ HTMLAllCollection: 0,
1659
+ HTMLCollection: 0,
1660
+ HTMLFormElement: 0,
1661
+ HTMLSelectElement: 0,
1662
+ MediaList: 0,
1663
+ MimeTypeArray: 0,
1664
+ NamedNodeMap: 0,
1665
+ NodeList: 1,
1666
+ PaintRequestList: 0,
1667
+ Plugin: 0,
1668
+ PluginArray: 0,
1669
+ SVGLengthList: 0,
1670
+ SVGNumberList: 0,
1671
+ SVGPathSegList: 0,
1672
+ SVGPointList: 0,
1673
+ SVGStringList: 0,
1674
+ SVGTransformList: 0,
1675
+ SourceBufferList: 0,
1676
+ StyleSheetList: 0,
1677
+ TextTrackCueList: 0,
1678
+ TextTrackList: 0,
1679
+ TouchList: 0
1680
+ };
1681
+
1682
+ // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
1683
+ var documentCreateElement = documentCreateElement$2;
1684
+
1685
+ var classList = documentCreateElement('span').classList;
1686
+ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
1687
+
1688
+ var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
1689
+
1690
+ var global$3 = global$e;
1691
+ var DOMIterables = domIterables;
1692
+ var DOMTokenListPrototype = domTokenListPrototype;
1693
+ var ArrayIteratorMethods = es_array_iterator;
1694
+ var createNonEnumerableProperty = createNonEnumerableProperty$4;
1695
+ var setToStringTag$1 = setToStringTag$4;
1696
+ var wellKnownSymbol$4 = wellKnownSymbol$c;
1697
+
1698
+ var ITERATOR$3 = wellKnownSymbol$4('iterator');
1699
+ var ArrayValues = ArrayIteratorMethods.values;
1700
+
1701
+ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1702
+ if (CollectionPrototype) {
1703
+ // some Chrome versions have non-configurable methods on DOMTokenList
1704
+ if (CollectionPrototype[ITERATOR$3] !== ArrayValues) try {
1705
+ createNonEnumerableProperty(CollectionPrototype, ITERATOR$3, ArrayValues);
1706
+ } catch (error) {
1707
+ CollectionPrototype[ITERATOR$3] = ArrayValues;
1708
+ }
1709
+ setToStringTag$1(CollectionPrototype, COLLECTION_NAME, true);
1710
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
1711
+ // some Chrome versions have non-configurable methods on DOMTokenList
1712
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
1713
+ createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
1714
+ } catch (error) {
1715
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
1716
+ }
1717
+ }
1718
+ }
1719
+ };
1720
+
1721
+ for (var COLLECTION_NAME in DOMIterables) {
1722
+ handlePrototype(global$3[COLLECTION_NAME] && global$3[COLLECTION_NAME].prototype, COLLECTION_NAME);
1723
+ }
1724
+
1725
+ handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1726
+
1727
+ var global$2 = global$e;
1728
+ var DESCRIPTORS$2 = descriptors;
1729
+
1730
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1731
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1732
+
1733
+ // Avoid NodeJS experimental warning
1734
+ var safeGetBuiltIn$1 = function (name) {
1735
+ if (!DESCRIPTORS$2) return global$2[name];
1736
+ var descriptor = getOwnPropertyDescriptor(global$2, name);
1737
+ return descriptor && descriptor.value;
1738
+ };
1739
+
1740
+ var fails$1 = fails$e;
1741
+ var wellKnownSymbol$3 = wellKnownSymbol$c;
1742
+ var DESCRIPTORS$1 = descriptors;
1743
+ var IS_PURE = isPure;
1744
+
1745
+ var ITERATOR$2 = wellKnownSymbol$3('iterator');
1746
+
1747
+ var urlConstructorDetection = !fails$1(function () {
1748
+ // eslint-disable-next-line unicorn/relative-url-style -- required for testing
1749
+ var url = new URL('b?a=1&b=2&c=3', 'http://a');
1750
+ var params = url.searchParams;
1751
+ var params2 = new URLSearchParams('a=1&a=2&b=3');
1752
+ var result = '';
1753
+ url.pathname = 'c%20d';
1754
+ params.forEach(function (value, key) {
1755
+ params['delete']('b');
1756
+ result += key + value;
1757
+ });
1758
+ params2['delete']('a', 2);
1759
+ // `undefined` case is a Chromium 117 bug
1760
+ // https://bugs.chromium.org/p/v8/issues/detail?id=14222
1761
+ params2['delete']('b', undefined);
1762
+ return (IS_PURE && (!url.toJSON || !params2.has('a', 1) || params2.has('a', 2) || !params2.has('a', undefined) || params2.has('b')))
1763
+ || (!params.size && (IS_PURE || !DESCRIPTORS$1))
1764
+ || !params.sort
1765
+ || url.href !== 'http://a/c%20d?a=1&c=3'
1766
+ || params.get('c') !== '3'
1767
+ || String(new URLSearchParams('?a=1')) !== 'a=1'
1768
+ || !params[ITERATOR$2]
1769
+ // throws in Edge
1770
+ || new URL('https://a@b').username !== 'a'
1771
+ || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
1772
+ // not punycoded in Edge
1773
+ || new URL('http://тест').host !== 'xn--e1aybc'
1774
+ // not escaped in Chrome 62-
1775
+ || new URL('http://a#б').hash !== '#%D0%B1'
1776
+ // fails in Chrome 66-
1777
+ || result !== 'a1c3'
1778
+ // throws in Safari
1779
+ || new URL('http://x', undefined).host !== 'x';
1780
+ });
1781
+
1782
+ var makeBuiltIn = makeBuiltIn$3.exports;
1783
+ var defineProperty = objectDefineProperty;
1784
+
1785
+ var defineBuiltInAccessor$1 = function (target, name, descriptor) {
1786
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1787
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1788
+ return defineProperty.f(target, name, descriptor);
1789
+ };
1790
+
1791
+ var defineBuiltIn$1 = defineBuiltIn$6;
1792
+
1793
+ var defineBuiltIns$1 = function (target, src, options) {
1794
+ for (var key in src) defineBuiltIn$1(target, key, src[key], options);
1795
+ return target;
1796
+ };
1797
+
1798
+ var isPrototypeOf = objectIsPrototypeOf;
1799
+
1800
+ var $TypeError$3 = TypeError;
1801
+
1802
+ var anInstance$1 = function (it, Prototype) {
1803
+ if (isPrototypeOf(Prototype, it)) return it;
1804
+ throw new $TypeError$3('Incorrect invocation');
1805
+ };
1806
+
1807
+ var classofRaw = classofRaw$2;
1808
+ var uncurryThis$4 = functionUncurryThis;
1809
+
1810
+ var functionUncurryThisClause = function (fn) {
1811
+ // Nashorn bug:
1812
+ // https://github.com/zloirock/core-js/issues/1128
1813
+ // https://github.com/zloirock/core-js/issues/1130
1814
+ if (classofRaw(fn) === 'Function') return uncurryThis$4(fn);
1815
+ };
1816
+
1817
+ var uncurryThis$3 = functionUncurryThisClause;
1818
+ var aCallable$2 = aCallable$5;
1819
+ var NATIVE_BIND = functionBindNative;
1820
+
1821
+ var bind$2 = uncurryThis$3(uncurryThis$3.bind);
1822
+
1823
+ // optional / simple context binding
1824
+ var functionBindContext = function (fn, that) {
1825
+ aCallable$2(fn);
1826
+ return that === undefined ? fn : NATIVE_BIND ? bind$2(fn, that) : function (/* ...args */) {
1827
+ return fn.apply(that, arguments);
1828
+ };
1829
+ };
1830
+
1831
+ var classof$3 = classof$6;
1832
+ var getMethod = getMethod$2;
1833
+ var isNullOrUndefined = isNullOrUndefined$3;
1834
+ var Iterators = iterators;
1835
+ var wellKnownSymbol$2 = wellKnownSymbol$c;
1836
+
1837
+ var ITERATOR$1 = wellKnownSymbol$2('iterator');
1838
+
1839
+ var getIteratorMethod$2 = function (it) {
1840
+ if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR$1)
1841
+ || getMethod(it, '@@iterator')
1842
+ || Iterators[classof$3(it)];
1843
+ };
1844
+
1845
+ var call$1 = functionCall;
1846
+ var aCallable$1 = aCallable$5;
1847
+ var anObject$1 = anObject$9;
1848
+ var tryToString = tryToString$2;
1849
+ var getIteratorMethod$1 = getIteratorMethod$2;
1850
+
1851
+ var $TypeError$2 = TypeError;
1852
+
1853
+ var getIterator$1 = function (argument, usingIterator) {
1854
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
1855
+ if (aCallable$1(iteratorMethod)) return anObject$1(call$1(iteratorMethod, argument));
1856
+ throw new $TypeError$2(tryToString(argument) + ' is not iterable');
1857
+ };
1858
+
1859
+ var $TypeError$1 = TypeError;
1860
+
1861
+ var validateArgumentsLength$1 = function (passed, required) {
1862
+ if (passed < required) throw new $TypeError$1('Not enough arguments');
1863
+ return passed;
1864
+ };
1865
+
1866
+ var uncurryThis$2 = functionUncurryThis;
1867
+
1868
+ var arraySlice$1 = uncurryThis$2([].slice);
1869
+
1870
+ var arraySlice = arraySlice$1;
1871
+
1872
+ var floor = Math.floor;
1873
+
1874
+ var sort = function (array, comparefn) {
1875
+ var length = array.length;
1876
+
1877
+ if (length < 8) {
1878
+ // insertion sort
1879
+ var i = 1;
1880
+ var element, j;
1881
+
1882
+ while (i < length) {
1883
+ j = i;
1884
+ element = array[i];
1885
+ while (j && comparefn(array[j - 1], element) > 0) {
1886
+ array[j] = array[--j];
1887
+ }
1888
+ if (j !== i++) array[j] = element;
1889
+ }
1890
+ } else {
1891
+ // merge sort
1892
+ var middle = floor(length / 2);
1893
+ var left = sort(arraySlice(array, 0, middle), comparefn);
1894
+ var right = sort(arraySlice(array, middle), comparefn);
1895
+ var llength = left.length;
1896
+ var rlength = right.length;
1897
+ var lindex = 0;
1898
+ var rindex = 0;
1899
+
1900
+ while (lindex < llength || rindex < rlength) {
1901
+ array[lindex + rindex] = (lindex < llength && rindex < rlength)
1902
+ ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
1903
+ : lindex < llength ? left[lindex++] : right[rindex++];
1904
+ }
1905
+ }
1906
+
1907
+ return array;
1908
+ };
1909
+
1910
+ var arraySort$1 = sort;
1911
+
1912
+ // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
1913
+
1914
+ var $$1 = _export;
1915
+ var global$1 = global$e;
1916
+ var safeGetBuiltIn = safeGetBuiltIn$1;
1917
+ var call = functionCall;
1918
+ var uncurryThis$1 = functionUncurryThis;
1919
+ var DESCRIPTORS = descriptors;
1920
+ var USE_NATIVE_URL = urlConstructorDetection;
1921
+ var defineBuiltIn = defineBuiltIn$6;
1922
+ var defineBuiltInAccessor = defineBuiltInAccessor$1;
1923
+ var defineBuiltIns = defineBuiltIns$1;
1924
+ var setToStringTag = setToStringTag$4;
1925
+ var createIteratorConstructor = iteratorCreateConstructor;
1926
+ var InternalStateModule = internalState;
1927
+ var anInstance = anInstance$1;
1928
+ var isCallable$1 = isCallable$g;
1929
+ var hasOwn = hasOwnProperty_1;
1930
+ var bind$1 = functionBindContext;
1931
+ var classof$2 = classof$6;
1932
+ var anObject = anObject$9;
1933
+ var isObject$1 = isObject$9;
1934
+ var $toString = toString;
1935
+ var create = objectCreate;
1936
+ var createPropertyDescriptor = createPropertyDescriptor$4;
1937
+ var getIterator = getIterator$1;
1938
+ var getIteratorMethod = getIteratorMethod$2;
1939
+ var createIterResultObject = createIterResultObject$2;
1940
+ var validateArgumentsLength = validateArgumentsLength$1;
1941
+ var wellKnownSymbol$1 = wellKnownSymbol$c;
1942
+ var arraySort = arraySort$1;
1943
+
1944
+ var ITERATOR = wellKnownSymbol$1('iterator');
1945
+ var URL_SEARCH_PARAMS = 'URLSearchParams';
1946
+ var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
1947
+ var setInternalState = InternalStateModule.set;
1948
+ var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);
1949
+ var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);
1950
+
1951
+ var nativeFetch = safeGetBuiltIn('fetch');
1952
+ var NativeRequest = safeGetBuiltIn('Request');
1953
+ var Headers = safeGetBuiltIn('Headers');
1954
+ var RequestPrototype = NativeRequest && NativeRequest.prototype;
1955
+ var HeadersPrototype = Headers && Headers.prototype;
1956
+ var RegExp$1 = global$1.RegExp;
1957
+ var TypeError$1 = global$1.TypeError;
1958
+ var decodeURIComponent = global$1.decodeURIComponent;
1959
+ var encodeURIComponent = global$1.encodeURIComponent;
1960
+ var charAt = uncurryThis$1(''.charAt);
1961
+ var join = uncurryThis$1([].join);
1962
+ var push = uncurryThis$1([].push);
1963
+ var replace = uncurryThis$1(''.replace);
1964
+ var shift = uncurryThis$1([].shift);
1965
+ var splice = uncurryThis$1([].splice);
1966
+ var split = uncurryThis$1(''.split);
1967
+ var stringSlice = uncurryThis$1(''.slice);
1968
+
1969
+ var plus = /\+/g;
1970
+ var sequences = Array(4);
1971
+
1972
+ var percentSequence = function (bytes) {
1973
+ return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp$1('((?:%[\\da-f]{2}){' + bytes + '})', 'gi'));
1974
+ };
1975
+
1976
+ var percentDecode = function (sequence) {
1977
+ try {
1978
+ return decodeURIComponent(sequence);
1979
+ } catch (error) {
1980
+ return sequence;
1981
+ }
1982
+ };
1983
+
1984
+ var deserialize = function (it) {
1985
+ var result = replace(it, plus, ' ');
1986
+ var bytes = 4;
1987
+ try {
1988
+ return decodeURIComponent(result);
1989
+ } catch (error) {
1990
+ while (bytes) {
1991
+ result = replace(result, percentSequence(bytes--), percentDecode);
1992
+ }
1993
+ return result;
1994
+ }
1995
+ };
1996
+
1997
+ var find = /[!'()~]|%20/g;
1998
+
1999
+ var replacements = {
2000
+ '!': '%21',
2001
+ "'": '%27',
2002
+ '(': '%28',
2003
+ ')': '%29',
2004
+ '~': '%7E',
2005
+ '%20': '+'
2006
+ };
2007
+
2008
+ var replacer = function (match) {
2009
+ return replacements[match];
2010
+ };
2011
+
2012
+ var serialize = function (it) {
2013
+ return replace(encodeURIComponent(it), find, replacer);
2014
+ };
2015
+
2016
+ var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
2017
+ setInternalState(this, {
2018
+ type: URL_SEARCH_PARAMS_ITERATOR,
2019
+ target: getInternalParamsState(params).entries,
2020
+ index: 0,
2021
+ kind: kind
2022
+ });
2023
+ }, URL_SEARCH_PARAMS, function next() {
2024
+ var state = getInternalIteratorState(this);
2025
+ var target = state.target;
2026
+ var index = state.index++;
2027
+ if (!target || index >= target.length) {
2028
+ state.target = undefined;
2029
+ return createIterResultObject(undefined, true);
2030
+ }
2031
+ var entry = target[index];
2032
+ switch (state.kind) {
2033
+ case 'keys': return createIterResultObject(entry.key, false);
2034
+ case 'values': return createIterResultObject(entry.value, false);
2035
+ } return createIterResultObject([entry.key, entry.value], false);
2036
+ }, true);
2037
+
2038
+ var URLSearchParamsState = function (init) {
2039
+ this.entries = [];
2040
+ this.url = null;
2041
+
2042
+ if (init !== undefined) {
2043
+ if (isObject$1(init)) this.parseObject(init);
2044
+ else this.parseQuery(typeof init == 'string' ? charAt(init, 0) === '?' ? stringSlice(init, 1) : init : $toString(init));
2045
+ }
2046
+ };
2047
+
2048
+ URLSearchParamsState.prototype = {
2049
+ type: URL_SEARCH_PARAMS,
2050
+ bindURL: function (url) {
2051
+ this.url = url;
2052
+ this.update();
2053
+ },
2054
+ parseObject: function (object) {
2055
+ var entries = this.entries;
2056
+ var iteratorMethod = getIteratorMethod(object);
2057
+ var iterator, next, step, entryIterator, entryNext, first, second;
2058
+
2059
+ if (iteratorMethod) {
2060
+ iterator = getIterator(object, iteratorMethod);
2061
+ next = iterator.next;
2062
+ while (!(step = call(next, iterator)).done) {
2063
+ entryIterator = getIterator(anObject(step.value));
2064
+ entryNext = entryIterator.next;
2065
+ if (
2066
+ (first = call(entryNext, entryIterator)).done ||
2067
+ (second = call(entryNext, entryIterator)).done ||
2068
+ !call(entryNext, entryIterator).done
2069
+ ) throw new TypeError$1('Expected sequence with length 2');
2070
+ push(entries, { key: $toString(first.value), value: $toString(second.value) });
2071
+ }
2072
+ } else for (var key in object) if (hasOwn(object, key)) {
2073
+ push(entries, { key: key, value: $toString(object[key]) });
2074
+ }
2075
+ },
2076
+ parseQuery: function (query) {
2077
+ if (query) {
2078
+ var entries = this.entries;
2079
+ var attributes = split(query, '&');
2080
+ var index = 0;
2081
+ var attribute, entry;
2082
+ while (index < attributes.length) {
2083
+ attribute = attributes[index++];
2084
+ if (attribute.length) {
2085
+ entry = split(attribute, '=');
2086
+ push(entries, {
2087
+ key: deserialize(shift(entry)),
2088
+ value: deserialize(join(entry, '='))
2089
+ });
2090
+ }
2091
+ }
2092
+ }
2093
+ },
2094
+ serialize: function () {
2095
+ var entries = this.entries;
2096
+ var result = [];
2097
+ var index = 0;
2098
+ var entry;
2099
+ while (index < entries.length) {
2100
+ entry = entries[index++];
2101
+ push(result, serialize(entry.key) + '=' + serialize(entry.value));
2102
+ } return join(result, '&');
2103
+ },
2104
+ update: function () {
2105
+ this.entries.length = 0;
2106
+ this.parseQuery(this.url.query);
2107
+ },
2108
+ updateURL: function () {
2109
+ if (this.url) this.url.update();
2110
+ }
2111
+ };
2112
+
2113
+ // `URLSearchParams` constructor
2114
+ // https://url.spec.whatwg.org/#interface-urlsearchparams
2115
+ var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
2116
+ anInstance(this, URLSearchParamsPrototype);
2117
+ var init = arguments.length > 0 ? arguments[0] : undefined;
2118
+ var state = setInternalState(this, new URLSearchParamsState(init));
2119
+ if (!DESCRIPTORS) this.size = state.entries.length;
2120
+ };
2121
+
2122
+ var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
2123
+
2124
+ defineBuiltIns(URLSearchParamsPrototype, {
2125
+ // `URLSearchParams.prototype.append` method
2126
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-append
2127
+ append: function append(name, value) {
2128
+ var state = getInternalParamsState(this);
2129
+ validateArgumentsLength(arguments.length, 2);
2130
+ push(state.entries, { key: $toString(name), value: $toString(value) });
2131
+ if (!DESCRIPTORS) this.length++;
2132
+ state.updateURL();
2133
+ },
2134
+ // `URLSearchParams.prototype.delete` method
2135
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-delete
2136
+ 'delete': function (name /* , value */) {
2137
+ var state = getInternalParamsState(this);
2138
+ var length = validateArgumentsLength(arguments.length, 1);
2139
+ var entries = state.entries;
2140
+ var key = $toString(name);
2141
+ var $value = length < 2 ? undefined : arguments[1];
2142
+ var value = $value === undefined ? $value : $toString($value);
2143
+ var index = 0;
2144
+ while (index < entries.length) {
2145
+ var entry = entries[index];
2146
+ if (entry.key === key && (value === undefined || entry.value === value)) {
2147
+ splice(entries, index, 1);
2148
+ if (value !== undefined) break;
2149
+ } else index++;
2150
+ }
2151
+ if (!DESCRIPTORS) this.size = entries.length;
2152
+ state.updateURL();
2153
+ },
2154
+ // `URLSearchParams.prototype.get` method
2155
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-get
2156
+ get: function get(name) {
2157
+ var entries = getInternalParamsState(this).entries;
2158
+ validateArgumentsLength(arguments.length, 1);
2159
+ var key = $toString(name);
2160
+ var index = 0;
2161
+ for (; index < entries.length; index++) {
2162
+ if (entries[index].key === key) return entries[index].value;
2163
+ }
2164
+ return null;
2165
+ },
2166
+ // `URLSearchParams.prototype.getAll` method
2167
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-getall
2168
+ getAll: function getAll(name) {
2169
+ var entries = getInternalParamsState(this).entries;
2170
+ validateArgumentsLength(arguments.length, 1);
2171
+ var key = $toString(name);
2172
+ var result = [];
2173
+ var index = 0;
2174
+ for (; index < entries.length; index++) {
2175
+ if (entries[index].key === key) push(result, entries[index].value);
2176
+ }
2177
+ return result;
2178
+ },
2179
+ // `URLSearchParams.prototype.has` method
2180
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-has
2181
+ has: function has(name /* , value */) {
2182
+ var entries = getInternalParamsState(this).entries;
2183
+ var length = validateArgumentsLength(arguments.length, 1);
2184
+ var key = $toString(name);
2185
+ var $value = length < 2 ? undefined : arguments[1];
2186
+ var value = $value === undefined ? $value : $toString($value);
2187
+ var index = 0;
2188
+ while (index < entries.length) {
2189
+ var entry = entries[index++];
2190
+ if (entry.key === key && (value === undefined || entry.value === value)) return true;
2191
+ }
2192
+ return false;
2193
+ },
2194
+ // `URLSearchParams.prototype.set` method
2195
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-set
2196
+ set: function set(name, value) {
2197
+ var state = getInternalParamsState(this);
2198
+ validateArgumentsLength(arguments.length, 1);
2199
+ var entries = state.entries;
2200
+ var found = false;
2201
+ var key = $toString(name);
2202
+ var val = $toString(value);
2203
+ var index = 0;
2204
+ var entry;
2205
+ for (; index < entries.length; index++) {
2206
+ entry = entries[index];
2207
+ if (entry.key === key) {
2208
+ if (found) splice(entries, index--, 1);
2209
+ else {
2210
+ found = true;
2211
+ entry.value = val;
2212
+ }
2213
+ }
2214
+ }
2215
+ if (!found) push(entries, { key: key, value: val });
2216
+ if (!DESCRIPTORS) this.size = entries.length;
2217
+ state.updateURL();
2218
+ },
2219
+ // `URLSearchParams.prototype.sort` method
2220
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-sort
2221
+ sort: function sort() {
2222
+ var state = getInternalParamsState(this);
2223
+ arraySort(state.entries, function (a, b) {
2224
+ return a.key > b.key ? 1 : -1;
2225
+ });
2226
+ state.updateURL();
2227
+ },
2228
+ // `URLSearchParams.prototype.forEach` method
2229
+ forEach: function forEach(callback /* , thisArg */) {
2230
+ var entries = getInternalParamsState(this).entries;
2231
+ var boundFunction = bind$1(callback, arguments.length > 1 ? arguments[1] : undefined);
2232
+ var index = 0;
2233
+ var entry;
2234
+ while (index < entries.length) {
2235
+ entry = entries[index++];
2236
+ boundFunction(entry.value, entry.key, this);
2237
+ }
2238
+ },
2239
+ // `URLSearchParams.prototype.keys` method
2240
+ keys: function keys() {
2241
+ return new URLSearchParamsIterator(this, 'keys');
2242
+ },
2243
+ // `URLSearchParams.prototype.values` method
2244
+ values: function values() {
2245
+ return new URLSearchParamsIterator(this, 'values');
2246
+ },
2247
+ // `URLSearchParams.prototype.entries` method
2248
+ entries: function entries() {
2249
+ return new URLSearchParamsIterator(this, 'entries');
2250
+ }
2251
+ }, { enumerable: true });
2252
+
2253
+ // `URLSearchParams.prototype[@@iterator]` method
2254
+ defineBuiltIn(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, { name: 'entries' });
2255
+
2256
+ // `URLSearchParams.prototype.toString` method
2257
+ // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior
2258
+ defineBuiltIn(URLSearchParamsPrototype, 'toString', function toString() {
2259
+ return getInternalParamsState(this).serialize();
2260
+ }, { enumerable: true });
2261
+
2262
+ // `URLSearchParams.prototype.size` getter
2263
+ // https://github.com/whatwg/url/pull/734
2264
+ if (DESCRIPTORS) defineBuiltInAccessor(URLSearchParamsPrototype, 'size', {
2265
+ get: function size() {
2266
+ return getInternalParamsState(this).entries.length;
2267
+ },
2268
+ configurable: true,
2269
+ enumerable: true
2270
+ });
2271
+
2272
+ setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
2273
+
2274
+ $$1({ global: true, constructor: true, forced: !USE_NATIVE_URL }, {
2275
+ URLSearchParams: URLSearchParamsConstructor
2276
+ });
2277
+
2278
+ // Wrap `fetch` and `Request` for correct work with polyfilled `URLSearchParams`
2279
+ if (!USE_NATIVE_URL && isCallable$1(Headers)) {
2280
+ var headersHas = uncurryThis$1(HeadersPrototype.has);
2281
+ var headersSet = uncurryThis$1(HeadersPrototype.set);
2282
+
2283
+ var wrapRequestOptions = function (init) {
2284
+ if (isObject$1(init)) {
2285
+ var body = init.body;
2286
+ var headers;
2287
+ if (classof$2(body) === URL_SEARCH_PARAMS) {
2288
+ headers = init.headers ? new Headers(init.headers) : new Headers();
2289
+ if (!headersHas(headers, 'content-type')) {
2290
+ headersSet(headers, 'content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
2291
+ }
2292
+ return create(init, {
2293
+ body: createPropertyDescriptor(0, $toString(body)),
2294
+ headers: createPropertyDescriptor(0, headers)
2295
+ });
2296
+ }
2297
+ } return init;
2298
+ };
2299
+
2300
+ if (isCallable$1(nativeFetch)) {
2301
+ $$1({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, {
2302
+ fetch: function fetch(input /* , init */) {
2303
+ return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
2304
+ }
2305
+ });
2306
+ }
2307
+
2308
+ if (isCallable$1(NativeRequest)) {
2309
+ var RequestConstructor = function Request(input /* , init */) {
2310
+ anInstance(this, RequestPrototype);
2311
+ return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
2312
+ };
2313
+
2314
+ RequestPrototype.constructor = RequestConstructor;
2315
+ RequestConstructor.prototype = RequestPrototype;
2316
+
2317
+ $$1({ global: true, constructor: true, dontCallGetSet: true, forced: true }, {
2318
+ Request: RequestConstructor
2319
+ });
2320
+ }
2321
+ }
2322
+
2323
+ var classof$1 = classofRaw$2;
2324
+
2325
+ // `IsArray` abstract operation
2326
+ // https://tc39.es/ecma262/#sec-isarray
2327
+ // eslint-disable-next-line es/no-array-isarray -- safe
2328
+ var isArray$2 = Array.isArray || function isArray(argument) {
2329
+ return classof$1(argument) === 'Array';
2330
+ };
2331
+
2332
+ var $TypeError = TypeError;
2333
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
2334
+
2335
+ var doesNotExceedSafeInteger$1 = function (it) {
2336
+ if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
2337
+ return it;
2338
+ };
2339
+
2340
+ var isArray$1 = isArray$2;
2341
+ var lengthOfArrayLike$1 = lengthOfArrayLike$3;
2342
+ var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
2343
+ var bind = functionBindContext;
2344
+
2345
+ // `FlattenIntoArray` abstract operation
2346
+ // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
2347
+ var flattenIntoArray$1 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
2348
+ var targetIndex = start;
2349
+ var sourceIndex = 0;
2350
+ var mapFn = mapper ? bind(mapper, thisArg) : false;
2351
+ var element, elementLen;
2352
+
2353
+ while (sourceIndex < sourceLen) {
2354
+ if (sourceIndex in source) {
2355
+ element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
2356
+
2357
+ if (depth > 0 && isArray$1(element)) {
2358
+ elementLen = lengthOfArrayLike$1(element);
2359
+ targetIndex = flattenIntoArray$1(target, original, element, elementLen, targetIndex, depth - 1) - 1;
2360
+ } else {
2361
+ doesNotExceedSafeInteger(targetIndex + 1);
2362
+ target[targetIndex] = element;
2363
+ }
2364
+
2365
+ targetIndex++;
2366
+ }
2367
+ sourceIndex++;
2368
+ }
2369
+ return targetIndex;
2370
+ };
2371
+
2372
+ var flattenIntoArray_1 = flattenIntoArray$1;
2373
+
2374
+ var uncurryThis = functionUncurryThis;
2375
+ var fails = fails$e;
2376
+ var isCallable = isCallable$g;
2377
+ var classof = classof$6;
2378
+ var getBuiltIn = getBuiltIn$4;
2379
+ var inspectSource = inspectSource$2;
2380
+
2381
+ var noop = function () { /* empty */ };
2382
+ var construct = getBuiltIn('Reflect', 'construct');
2383
+ var constructorRegExp = /^\s*(?:class|function)\b/;
2384
+ var exec = uncurryThis(constructorRegExp.exec);
2385
+ var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
2386
+
2387
+ var isConstructorModern = function isConstructor(argument) {
2388
+ if (!isCallable(argument)) return false;
2389
+ try {
2390
+ construct(noop, [], argument);
2391
+ return true;
2392
+ } catch (error) {
2393
+ return false;
2394
+ }
2395
+ };
2396
+
2397
+ var isConstructorLegacy = function isConstructor(argument) {
2398
+ if (!isCallable(argument)) return false;
2399
+ switch (classof(argument)) {
2400
+ case 'AsyncFunction':
2401
+ case 'GeneratorFunction':
2402
+ case 'AsyncGeneratorFunction': return false;
2403
+ }
2404
+ try {
2405
+ // we can't check .prototype since constructors produced by .bind haven't it
2406
+ // `Function#toString` throws on some built-it function in some legacy engines
2407
+ // (for example, `DOMQuad` and similar in FF41-)
2408
+ return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
2409
+ } catch (error) {
2410
+ return true;
2411
+ }
2412
+ };
2413
+
2414
+ isConstructorLegacy.sham = true;
2415
+
2416
+ // `IsConstructor` abstract operation
2417
+ // https://tc39.es/ecma262/#sec-isconstructor
2418
+ var isConstructor$1 = !construct || fails(function () {
2419
+ var called;
2420
+ return isConstructorModern(isConstructorModern.call)
2421
+ || !isConstructorModern(Object)
2422
+ || !isConstructorModern(function () { called = true; })
2423
+ || called;
2424
+ }) ? isConstructorLegacy : isConstructorModern;
2425
+
2426
+ var isArray = isArray$2;
2427
+ var isConstructor = isConstructor$1;
2428
+ var isObject = isObject$9;
2429
+ var wellKnownSymbol = wellKnownSymbol$c;
2430
+
2431
+ var SPECIES = wellKnownSymbol('species');
2432
+ var $Array = Array;
2433
+
2434
+ // a part of `ArraySpeciesCreate` abstract operation
2435
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
2436
+ var arraySpeciesConstructor$1 = function (originalArray) {
2437
+ var C;
2438
+ if (isArray(originalArray)) {
2439
+ C = originalArray.constructor;
2440
+ // cross-realm fallback
2441
+ if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
2442
+ else if (isObject(C)) {
2443
+ C = C[SPECIES];
2444
+ if (C === null) C = undefined;
2445
+ }
2446
+ } return C === undefined ? $Array : C;
2447
+ };
2448
+
2449
+ var arraySpeciesConstructor = arraySpeciesConstructor$1;
2450
+
2451
+ // `ArraySpeciesCreate` abstract operation
2452
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
2453
+ var arraySpeciesCreate$1 = function (originalArray, length) {
2454
+ return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
2455
+ };
2456
+
2457
+ var $ = _export;
2458
+ var flattenIntoArray = flattenIntoArray_1;
2459
+ var aCallable = aCallable$5;
2460
+ var toObject = toObject$4;
2461
+ var lengthOfArrayLike = lengthOfArrayLike$3;
2462
+ var arraySpeciesCreate = arraySpeciesCreate$1;
2463
+
2464
+ // `Array.prototype.flatMap` method
2465
+ // https://tc39.es/ecma262/#sec-array.prototype.flatmap
2466
+ $({ target: 'Array', proto: true }, {
2467
+ flatMap: function flatMap(callbackfn /* , thisArg */) {
2468
+ var O = toObject(this);
2469
+ var sourceLen = lengthOfArrayLike(O);
2470
+ var A;
2471
+ aCallable(callbackfn);
2472
+ A = arraySpeciesCreate(O, 0);
2473
+ A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2474
+ return A;
2475
+ }
2476
+ });
2477
+
2478
+ // this method was added to unscopables after implementation
2479
+ // in popular engines, so it's moved to a separate module
2480
+ var addToUnscopables = addToUnscopables$2;
2481
+
2482
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2483
+ addToUnscopables('flatMap');
2484
+
2485
+ /**
2486
+ * Creates a ZohoRecruitSearchRecordsCriteriaString from a ZohoRecruitSearchRecordsCriteriaTree.
2487
+ *
2488
+ * If the input tree is empty, returns undefined.
2489
+ */
2490
+ function zohoRecruitSearchRecordsCriteriaString(input) {
2491
+ let result;
2492
+ if (input != null) {
2493
+ switch (typeof input) {
2494
+ case 'string':
2495
+ result = input;
2496
+ break;
2497
+ case 'object':
2498
+ let tree;
2499
+ if (Array.isArray(input)) {
2500
+ tree = {
2501
+ and: [input]
2502
+ };
2503
+ } else {
2504
+ tree = input;
2505
+ }
2506
+ result = zohoRecruitSearchRecordsCriteriaStringForTree(tree);
2507
+ break;
2508
+ }
2509
+ }
2510
+ return result;
2511
+ }
2512
+ function zohoRecruitSearchRecordsCriteriaStringForTree(tree) {
2513
+ function convertToString(value) {
2514
+ let result;
2515
+ if (typeof value === 'object') {
2516
+ // array of criteria entries
2517
+ if (Array.isArray(value)) {
2518
+ result = value.map(zohoRecruitSearchRecordsCriteriaEntryToCriteriaString);
2519
+ } else if (value) {
2520
+ // criteria tree that first needs to be converted to a string
2521
+ result = zohoRecruitSearchRecordsCriteriaStringForTree(value);
2522
+ }
2523
+ } else {
2524
+ result = value;
2525
+ }
2526
+ return result;
2527
+ }
2528
+ function mergeStringValues(values, type) {
2529
+ return values.length > 1 ? `(${values.join(type)})` : values[0]; // wrap in and values
2530
+ }
2531
+
2532
+ function mergeValues(values, type) {
2533
+ const allStrings = util.filterMaybeValues(values.map(convertToString)).flatMap(util.asArray);
2534
+ return mergeStringValues(allStrings, type);
2535
+ }
2536
+ const orValues = tree.or ? mergeValues(tree.or, 'or') : undefined;
2537
+ let result = orValues;
2538
+ if (tree.and) {
2539
+ result = mergeValues([mergeValues(tree.and, 'and'), orValues], 'and');
2540
+ }
2541
+ return result;
2542
+ }
2543
+ /**
2544
+ * Escape used for ZohoRecruitSearchRecordsCriteriaString
2545
+ */
2546
+ const escapeZohoFieldValueForCriteriaString = util.escapeStringCharactersFunction({
2547
+ /**
2548
+ * Parenthesis and commas must be escaped using a backslash
2549
+ */
2550
+ escapeTargets: ['(', ')', ','],
2551
+ escapeCharacter: char => `\\${char}`
2552
+ });
2553
+ /**
2554
+ * Converts the input entry to a ZohoRecruitSearchRecordsCriteriaString. Properly escapes any parenthesis or commas.
2555
+ *
2556
+ * @param entry
2557
+ * @returns
2558
+ */
2559
+ function zohoRecruitSearchRecordsCriteriaEntryToCriteriaString(entry) {
2560
+ const escapedValue = escapeZohoFieldValueForCriteriaString(entry.value);
2561
+ return `(${entry.field}:${entry.filter}:${escapedValue})`;
2562
+ }
2563
+
2564
+ /******************************************************************************
2565
+ Copyright (c) Microsoft Corporation.
2566
+
2567
+ Permission to use, copy, modify, and/or distribute this software for any
2568
+ purpose with or without fee is hereby granted.
2569
+
2570
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2571
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2572
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2573
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2574
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2575
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2576
+ PERFORMANCE OF THIS SOFTWARE.
2577
+ ***************************************************************************** */
2578
+
2579
+ function __awaiter(thisArg, _arguments, P, generator) {
2580
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2581
+ return new (P || (P = Promise))(function (resolve, reject) {
2582
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2583
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2584
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2585
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2586
+ });
2587
+ }
2588
+
2589
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2590
+ var e = new Error(message);
2591
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2592
+ };
2593
+
2594
+ /**
2595
+ * A code used in some cases to denote success.
2596
+ */
2597
+ const ZOHO_SUCCESS_CODE = 'SUCCESS';
2598
+ function zohoServerErrorData(error) {
2599
+ const errorType = typeof error;
2600
+ let errorData;
2601
+ if (errorType === 'object') {
2602
+ errorData = error;
2603
+ } else {
2604
+ errorData = {
2605
+ code: error,
2606
+ message: ''
2607
+ };
2608
+ }
2609
+ return errorData;
2610
+ }
2611
+ /**
2612
+ * Zoho Server Error
2613
+ */
2614
+ class ZohoServerError extends makeError.BaseError {
2615
+ get code() {
2616
+ return this.error.code;
2617
+ }
2618
+ constructor(error) {
2619
+ super(error.message);
2620
+ this.error = error;
2621
+ }
2622
+ }
2623
+ /**
2624
+ * Zoho Server Error that includes the FetchResponseError
2625
+ */
2626
+ class ZohoServerFetchResponseError extends ZohoServerError {
2627
+ constructor(data, responseError) {
2628
+ super(data);
2629
+ this.data = data;
2630
+ this.responseError = responseError;
2631
+ }
2632
+ }
2633
+ /**
2634
+ * Creates a logZohoServerErrorFunction that logs the error to console.
2635
+ *
2636
+ * @param zohoApiNamePrefix Prefix to use when logging. I.E. ZohoRecruitError, etc.
2637
+ * @returns
2638
+ */
2639
+ function logZohoServerErrorFunction(zohoApiNamePrefix) {
2640
+ return error => {
2641
+ if (error instanceof ZohoServerFetchResponseError) {
2642
+ console.log(`${zohoApiNamePrefix}Error(${error.responseError.response.status}): `, {
2643
+ error,
2644
+ errorData: error.data
2645
+ });
2646
+ } else if (error instanceof ZohoServerError) {
2647
+ console.log(`${zohoApiNamePrefix}Error(code:${error.code}): `, {
2648
+ error
2649
+ });
2650
+ } else {
2651
+ console.log(`${zohoApiNamePrefix}Error(name:${error.name}): `, {
2652
+ error
2653
+ });
2654
+ }
2655
+ };
2656
+ }
2657
+ /**
2658
+ * Wraps a ConfiguredFetch to support handling errors returned by fetch.
2659
+ *
2660
+ * @param fetch
2661
+ * @returns
2662
+ */
2663
+ function handleZohoErrorFetchFactory(parseZohoError, defaultLogError) {
2664
+ return (fetch$1, logError = defaultLogError) => {
2665
+ return (x, y) => __awaiter(this, void 0, void 0, function* () {
2666
+ try {
2667
+ return yield fetch$1(x, y); // await to catch thrown errors
2668
+ } catch (e) {
2669
+ if (e instanceof fetch.FetchResponseError) {
2670
+ const error = yield parseZohoError(e);
2671
+ if (error) {
2672
+ logError(error); // log before throwing.
2673
+ throw error;
2674
+ }
2675
+ }
2676
+ throw e;
2677
+ }
2678
+ });
2679
+ };
2680
+ }
2681
+ /**
2682
+ * FetchJsonInterceptJsonResponseFunction that intercepts ZohoServerError responses and throws a ZohoServerError.
2683
+ *
2684
+ * @returns
2685
+ */
2686
+ function interceptZohoErrorResponseFactory(parseZohoServerErrorResponseData) {
2687
+ return (json, response) => {
2688
+ const error = json === null || json === void 0 ? void 0 : json.error;
2689
+ if (error != null) {
2690
+ const responseError = new fetch.FetchResponseError(response);
2691
+ if (responseError) {
2692
+ const parsedError = parseZohoServerErrorResponseData(json, responseError);
2693
+ if (parsedError) {
2694
+ throw parsedError;
2695
+ }
2696
+ }
2697
+ }
2698
+ return json;
2699
+ };
2700
+ }
2701
+ // MARK: Parsed Errors
2702
+ /**
2703
+ * Error in the following (but not limited to) cases:
2704
+ * - An extra parameter is provided
2705
+ */
2706
+ const ZOHO_INTERNAL_ERROR_CODE = 'INTERNAL_ERROR';
2707
+ /**
2708
+ * Error when the Zoho API returns an internal error
2709
+ */
2710
+ class ZohoInternalError extends ZohoServerFetchResponseError {}
2711
+ /**
2712
+ * Error in the following cases:
2713
+ * - Authorization is not properly constructed ("Invalid Ticket Id")
2714
+ * - OAuth token is expired ("Invalid OAuthtoken")
2715
+ */
2716
+ const ZOHO_INVALID_AUTHORIZATION_ERROR_CODE = '4834';
2717
+ /**
2718
+ * Error when the Zoho API returns an invalid authorization error code.
2719
+ */
2720
+ class ZohoInvalidAuthorizationError extends ZohoServerFetchResponseError {}
2721
+ /**
2722
+ * Error in the following cases:
2723
+ * - Search query is invalid
2724
+ */
2725
+ const ZOHO_INVALID_QUERY_ERROR_CODE = 'INVALID_QUERY';
2726
+ class ZohoInvalidQueryError extends ZohoServerFetchResponseError {
2727
+ get details() {
2728
+ return this.error.details;
2729
+ }
2730
+ }
2731
+ /**
2732
+ * Error when a mandatory field is missing.
2733
+ */
2734
+ const ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE = 'MANDATORY_NOT_FOUND';
2735
+ /**
2736
+ * Error when a duplicate record is found with a matching unique field value.
2737
+ */
2738
+ const ZOHO_DUPLICATE_DATA_ERROR_CODE = 'DUPLICATE_DATA';
2739
+ /**
2740
+ * Error when some passed data is invalid.
2741
+ */
2742
+ const ZOHO_INVALID_DATA_ERROR_CODE = 'INVALID_DATA';
2743
+ /**
2744
+ * Function that parses/transforms a ZohoServerErrorResponseData into a general ZohoServerError or other known error type.
2745
+ *
2746
+ * @param errorResponseData
2747
+ * @param responseError
2748
+ * @returns
2749
+ */
2750
+ function parseZohoServerErrorResponseData(errorResponseData, responseError) {
2751
+ let result;
2752
+ const error = tryFindZohoServerErrorData(errorResponseData, responseError);
2753
+ if (error) {
2754
+ const errorData = zohoServerErrorData(error);
2755
+ switch (errorData.code) {
2756
+ case ZOHO_INTERNAL_ERROR_CODE:
2757
+ result = new ZohoInternalError(errorData, responseError);
2758
+ break;
2759
+ case ZOHO_INVALID_AUTHORIZATION_ERROR_CODE:
2760
+ result = new ZohoInvalidAuthorizationError(errorData, responseError);
2761
+ break;
2762
+ case ZOHO_INVALID_QUERY_ERROR_CODE:
2763
+ result = new ZohoInvalidQueryError(errorData, responseError);
2764
+ break;
2765
+ default:
2766
+ result = new ZohoServerFetchResponseError(errorData, responseError);
2767
+ break;
2768
+ }
2769
+ }
2770
+ return result;
2771
+ }
2772
+ /**
2773
+ * Attempts to retrieve an ZohoServerErrorResponseDataError from the input.
2774
+ *
2775
+ * Non-200 errors returned by the Zoho API are returned as the object directly instead of as an ZohoServerErrorResponseData directly.
2776
+ *
2777
+ * @param errorResponseData
2778
+ * @param responseError
2779
+ * @returns
2780
+ */
2781
+ function tryFindZohoServerErrorData(errorResponseData, responseError) {
2782
+ var _a;
2783
+ const error = (_a = errorResponseData.error) !== null && _a !== void 0 ? _a : !responseError.response.ok ? errorResponseData : undefined;
2784
+ return error;
2785
+ }
2786
+
2787
+ class ZohoRecruitRecordNoContentError extends makeError.BaseError {
2788
+ constructor(moduleName, recordId) {
2789
+ super(`There was no content or matching records for the content. It may not exist.`);
2790
+ this.moduleName = moduleName;
2791
+ this.recordId = recordId;
2792
+ }
2793
+ }
2794
+ class ZohoRecruitRecordCrudError extends ZohoServerError {}
2795
+ class ZohoRecruitRecordCrudMandatoryFieldNotFoundError extends ZohoRecruitRecordCrudError {}
2796
+ class ZohoRecruitRecordCrudDuplicateDataError extends ZohoRecruitRecordCrudError {}
2797
+ class ZohoRecruitRecordCrudInvalidDataError extends ZohoRecruitRecordCrudError {
2798
+ get invalidFieldDetails() {
2799
+ return this.error.details;
2800
+ }
2801
+ }
2802
+ class ZohoRecruitRecordCrudNoMatchingRecordError extends ZohoRecruitRecordCrudInvalidDataError {}
2803
+ function zohoRecruitRecordCrudError(error) {
2804
+ let result;
2805
+ switch (error.code) {
2806
+ case ZOHO_INVALID_DATA_ERROR_CODE:
2807
+ const invalidDataError = new ZohoRecruitRecordCrudInvalidDataError(error);
2808
+ if (invalidDataError.invalidFieldDetails['id']) {
2809
+ result = new ZohoRecruitRecordCrudNoMatchingRecordError(error);
2810
+ } else {
2811
+ result = invalidDataError;
2812
+ }
2813
+ break;
2814
+ case ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE:
2815
+ result = new ZohoRecruitRecordCrudMandatoryFieldNotFoundError(error);
2816
+ break;
2817
+ case ZOHO_DUPLICATE_DATA_ERROR_CODE:
2818
+ result = new ZohoRecruitRecordCrudDuplicateDataError(error);
2819
+ break;
2820
+ default:
2821
+ result = new ZohoRecruitRecordCrudError(error);
2822
+ break;
2823
+ }
2824
+ return result;
2825
+ }
2826
+ function assertRecordDataArrayResultHasContent(moduleName, recordId) {
2827
+ return x => {
2828
+ var _a;
2829
+ if (x == null || !((_a = x.data) === null || _a === void 0 ? void 0 : _a.length)) {
2830
+ throw new ZohoRecruitRecordNoContentError(moduleName, recordId);
2831
+ } else {
2832
+ return x;
2833
+ }
2834
+ };
2835
+ }
2836
+ const logZohoRecruitErrorToConsole = logZohoServerErrorFunction('ZohoRecruit');
2837
+ function parseZohoRecruitError(responseError) {
2838
+ return __awaiter(this, void 0, void 0, function* () {
2839
+ const data = yield responseError.response.json().catch(x => undefined);
2840
+ let result;
2841
+ if (data) {
2842
+ result = parseZohoRecruitServerErrorResponseData(data, responseError);
2843
+ }
2844
+ return result;
2845
+ });
2846
+ }
2847
+ function parseZohoRecruitServerErrorResponseData(errorResponseData, responseError) {
2848
+ let result;
2849
+ const error = tryFindZohoServerErrorData(errorResponseData, responseError);
2850
+ if (error) {
2851
+ const errorData = zohoServerErrorData(error);
2852
+ switch (errorData.code) {
2853
+ // TODO: Add recruit-specific error codes here.
2854
+ default:
2855
+ result = parseZohoServerErrorResponseData(errorResponseData, responseError);
2856
+ break;
2857
+ }
2858
+ }
2859
+ return result;
2860
+ }
2861
+ const interceptZohoRecruitErrorResponse = interceptZohoErrorResponseFactory(parseZohoRecruitServerErrorResponseData);
2862
+ const handleZohoRecruitErrorFetch = handleZohoErrorFetchFactory(parseZohoRecruitError, logZohoRecruitErrorToConsole);
2863
+
2864
+ /**
2865
+ * The APIs for Insert, Upsert, and Update have the same structure.
2866
+ *
2867
+ * @returns
2868
+ */
2869
+ function updateRecordLikeFunction(context, fetchUrlPrefix, fetchMethod) {
2870
+ return ({
2871
+ data,
2872
+ module
2873
+ }) => context.fetchJson(`/v2/${module}${fetchUrlPrefix}`, zohoRecruitApiFetchJsonInput(fetchMethod, {
2874
+ data: util.asArray(data)
2875
+ })).then(x => {
2876
+ const isInputMultipleItems = Array.isArray(data);
2877
+ const result = zohoRecruitMultiRecordResult(util.asArray(data), x.data);
2878
+ if (isInputMultipleItems) {
2879
+ return result;
2880
+ } else {
2881
+ const {
2882
+ successItems,
2883
+ errorItems
2884
+ } = result;
2885
+ if (errorItems[0] != null) {
2886
+ throw zohoRecruitRecordCrudError(errorItems[0].result);
2887
+ } else {
2888
+ return successItems[0].result.details;
2889
+ }
2890
+ }
2891
+ });
2892
+ }
2893
+ /**
2894
+ * Inserts one or more records into Recruit.
2895
+ *
2896
+ * https://www.zoho.com/recruit/developer-guide/apiv2/insert-records.html
2897
+ *
2898
+ * @param context
2899
+ * @returns
2900
+ */
2901
+ function insertRecord(context) {
2902
+ return updateRecordLikeFunction(context, '', 'POST');
2903
+ }
2904
+ /**
2905
+ * Updates or inserts one or more records in Recruit.
2906
+ *
2907
+ * https://www.zoho.com/recruit/developer-guide/apiv2/upsert-records.html
2908
+ *
2909
+ * @param context
2910
+ * @returns
2911
+ */
2912
+ function upsertRecord(context) {
2913
+ return updateRecordLikeFunction(context, '/upsert', 'POST');
2914
+ }
2915
+ /**
2916
+ * Updates one or more records in Recruit.
2917
+ *
2918
+ * https://www.zoho.com/recruit/developer-guide/apiv2/update-records.html
2919
+ *
2920
+ * @param context
2921
+ * @returns
2922
+ */
2923
+ function updateRecord(context) {
2924
+ return updateRecordLikeFunction(context, '', 'PUT');
2925
+ }
2926
+ /**
2927
+ * Retrieves a specific record from the given module.
2928
+ *
2929
+ * https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html
2930
+ *
2931
+ * @param context
2932
+ * @returns
2933
+ */
2934
+ function getRecordById(context) {
2935
+ return input => context.fetchJson(`/v2/${input.module}/${input.id}`, zohoRecruitApiFetchJsonInput('GET')).then(assertRecordDataArrayResultHasContent(input.module)).then(x => x.data[0]);
2936
+ }
2937
+ /**
2938
+ * Retrieves records from the given module. Used for paginating across all records.
2939
+ *
2940
+ * https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html
2941
+ *
2942
+ * @param context
2943
+ * @returns
2944
+ */
2945
+ function getRecords(context) {
2946
+ return input => context.fetchJson(`/v2/${input.module}?${zohoRecruitUrlSearchParamsMinusModule(input).toString()}`, zohoRecruitApiFetchJsonInput('GET'));
2947
+ }
2948
+ /**
2949
+ * Searches records from the given module.
2950
+ *
2951
+ * https://www.zoho.com/recruit/developer-guide/apiv2/search-records.html
2952
+ *
2953
+ * @param context
2954
+ * @returns
2955
+ */
2956
+ function searchRecords(context) {
2957
+ function searchRecordsUrlSearchParams(input) {
2958
+ const baseInput = Object.assign({}, input);
2959
+ delete baseInput.criteria;
2960
+ if (input.criteria != null) {
2961
+ const criteriaString = zohoRecruitSearchRecordsCriteriaString(input.criteria);
2962
+ baseInput.criteria = criteriaString;
2963
+ }
2964
+ const urlParams = zohoRecruitUrlSearchParamsMinusModule(baseInput);
2965
+ return urlParams;
2966
+ }
2967
+ return input => context.fetchJson(`/v2/${input.module}/search?${searchRecordsUrlSearchParams(input).toString()}`, zohoRecruitApiFetchJsonInput('GET')).then(x => x !== null && x !== void 0 ? x : {
2968
+ data: []
2969
+ });
2970
+ }
2971
+ // MARK: Util
2972
+ function zohoRecruitUrlSearchParamsMinusModule(input) {
2973
+ const searchParams = new URLSearchParams(input);
2974
+ if (searchParams) {
2975
+ searchParams.delete('module');
2976
+ }
2977
+ return searchParams;
2978
+ }
2979
+ function zohoRecruitApiFetchJsonInput(method, body) {
2980
+ const result = {
2981
+ method,
2982
+ body
2983
+ };
2984
+ return result;
2985
+ }
2986
+ function zohoRecruitMultiRecordResult(input, results) {
2987
+ const successItems = [];
2988
+ const errorItems = [];
2989
+ input.forEach((x, i) => {
2990
+ const result = results[i];
2991
+ if (result.status === 'success') {
2992
+ successItems.push({
2993
+ input: x,
2994
+ result: result
2995
+ });
2996
+ } else {
2997
+ errorItems.push({
2998
+ input: x,
2999
+ result: result
3000
+ });
3001
+ }
3002
+ });
3003
+ const result = {
3004
+ successItems,
3005
+ errorItems
3006
+ };
3007
+ return result;
3008
+ }
3009
+
3010
+ const ZOHO_RECRUIT_SERVICE_NAME = 'recruit';
3011
+ function zohoRecruitConfigApiUrl(input) {
3012
+ switch (input) {
3013
+ case 'sandbox':
3014
+ return 'https://recruitsandbox.zoho.com/recruit';
3015
+ case 'production':
3016
+ return 'https://recruit.zoho.com/recruit/';
3017
+ default:
3018
+ return input;
3019
+ }
3020
+ }
3021
+
3022
+ /**
3023
+ * Error in the following cases:
3024
+ * - the refresh token string is invalid
3025
+ */
3026
+ const ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE = 'invalid_code';
3027
+ const ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE = 'invalid_client';
3028
+ /**
3029
+ * Thrown if the call to the Zoho API creating an access token using a refresh token fails.
3030
+ */
3031
+ class ZohoAccountsAccessTokenError extends fetch.FetchRequestFactoryError {
3032
+ constructor(errorCode) {
3033
+ super(`ZohoAccountsAccessTokenError: ${errorCode}`);
3034
+ this.errorCode = errorCode;
3035
+ }
3036
+ }
3037
+ /**
3038
+ * Thrown if a valid ZohoAccessToken cannot be retrieved successfully.
3039
+ */
3040
+ class ZohoAccountsAuthFailureError extends fetch.FetchRequestFactoryError {
3041
+ constructor(reason) {
3042
+ super(`Failed to retrieve proper authentication for the API call. Reason: ${reason}`);
3043
+ this.reason = reason;
3044
+ }
3045
+ }
3046
+ const logZohoAccountsErrorToConsole = logZohoServerErrorFunction('ZohoAccounts');
3047
+ function parseZohoAccountsError(responseError) {
3048
+ return __awaiter(this, void 0, void 0, function* () {
3049
+ const data = yield responseError.response.json().catch(x => undefined);
3050
+ let result;
3051
+ if (data) {
3052
+ result = parseZohoAccountsServerErrorResponseData(data, responseError);
3053
+ }
3054
+ return result;
3055
+ });
3056
+ }
3057
+ function parseZohoAccountsServerErrorResponseData(errorResponseData, responseError) {
3058
+ let result;
3059
+ const error = errorResponseData.error;
3060
+ if (error) {
3061
+ const errorData = zohoServerErrorData(error);
3062
+ switch (errorData.code) {
3063
+ case ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE:
3064
+ case ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE:
3065
+ result = new ZohoAccountsAccessTokenError(errorData.code);
3066
+ break;
3067
+ default:
3068
+ result = parseZohoServerErrorResponseData(errorResponseData, responseError);
3069
+ break;
3070
+ }
3071
+ }
3072
+ return result;
3073
+ }
3074
+ const interceptZohoAccountsErrorResponse = interceptZohoErrorResponseFactory(parseZohoAccountsServerErrorResponseData);
3075
+ const handleZohoAccountsErrorFetch = handleZohoErrorFetchFactory(parseZohoAccountsError, logZohoAccountsErrorToConsole);
3076
+
3077
+ /**
3078
+ * Generates a new ZohoAccessTokenStringFactory.
3079
+ */
3080
+ function zohoAccessTokenStringFactory(zohoAccessTokenFactory) {
3081
+ return () => __awaiter(this, void 0, void 0, function* () {
3082
+ const token = yield zohoAccessTokenFactory();
3083
+ if (!(token === null || token === void 0 ? void 0 : token.accessToken)) {
3084
+ throw new ZohoAccountsAuthFailureError();
3085
+ }
3086
+ return token.accessToken;
3087
+ });
3088
+ }
3089
+
3090
+ function zohoRecruitFactory(factoryConfig) {
3091
+ const {
3092
+ accountsContext
3093
+ } = factoryConfig;
3094
+ const accessTokenStringFactory = zohoAccessTokenStringFactory(accountsContext.loadAccessToken);
3095
+ const {
3096
+ logZohoServerErrorFunction,
3097
+ fetchFactory = input => fetch.nodeFetchService.makeFetch({
3098
+ baseUrl: input.apiUrl,
3099
+ baseRequest: () => __awaiter(this, void 0, void 0, function* () {
3100
+ return {
3101
+ headers: {
3102
+ 'Content-Type': 'application/json',
3103
+ Authorization: `Bearer ${yield accessTokenStringFactory()}`
3104
+ }
3105
+ };
3106
+ }),
3107
+ timeout: 20 * 1000,
3108
+ requireOkResponse: true,
3109
+ useTimeout: true // use timeout
3110
+ })
3111
+ } = factoryConfig;
3112
+ return config => {
3113
+ if (!config.apiUrl) {
3114
+ throw new Error('ZohoConfig missing api url.');
3115
+ }
3116
+ const apiUrl = zohoRecruitConfigApiUrl(config.apiUrl);
3117
+ const baseFetch = fetchFactory({
3118
+ apiUrl
3119
+ });
3120
+ const fetch$1 = handleZohoRecruitErrorFetch(baseFetch, logZohoServerErrorFunction);
3121
+ const fetchJson = fetch.fetchJsonFunction(fetch$1, {
3122
+ interceptJsonResponse: interceptZohoRecruitErrorResponse,
3123
+ handleFetchJsonParseErrorFunction: fetch.returnNullHandleFetchJsonParseErrorFunction
3124
+ });
3125
+ const recruitContext = {
3126
+ fetch: fetch$1,
3127
+ fetchJson,
3128
+ config: Object.assign(Object.assign({}, config), {
3129
+ apiUrl
3130
+ })
3131
+ };
3132
+ const zohoRecruit = {
3133
+ recruitContext
3134
+ };
3135
+ return zohoRecruit;
3136
+ };
3137
+ }
3138
+
3139
+ /**
3140
+ * Trades a refresh token for a new AccessToken
3141
+ * @param context
3142
+ * @returns
3143
+ */
3144
+ function accessToken(context) {
3145
+ return input => {
3146
+ var _a, _b, _c, _d, _e;
3147
+ return context.fetchJson(`/oauth/v2/token?grant_type=refresh_token&client_id=${(_b = (_a = input === null || input === void 0 ? void 0 : input.client) === null || _a === void 0 ? void 0 : _a.clientId) !== null && _b !== void 0 ? _b : context.config.clientId}&client_secret=${(_d = (_c = input === null || input === void 0 ? void 0 : input.client) === null || _c === void 0 ? void 0 : _c.clientSecret) !== null && _d !== void 0 ? _d : context.config.clientSecret}&refresh_token=${(_e = input === null || input === void 0 ? void 0 : input.refreshToken) !== null && _e !== void 0 ? _e : context.config.refreshToken}`, zohoAccountsApiFetchJsonInput('POST'));
3148
+ };
3149
+ }
3150
+ function zohoAccountsApiFetchJsonInput(method, body) {
3151
+ const result = {
3152
+ method,
3153
+ body
3154
+ };
3155
+ return result;
3156
+ }
3157
+
3158
+ /**
3159
+ * The Zoho Accounts API URL for the US datacenter.
3160
+ */
3161
+ const ZOHO_ACCOUNTS_US_API_URL = 'https://accounts.zoho.com';
3162
+ function zohoAccountsConfigApiUrl(input) {
3163
+ switch (input) {
3164
+ case 'us':
3165
+ return ZOHO_ACCOUNTS_US_API_URL;
3166
+ default:
3167
+ return input;
3168
+ }
3169
+ }
3170
+
3171
+ function zohoAccountsFactory(factoryConfig) {
3172
+ const {
3173
+ logZohoServerErrorFunction,
3174
+ fetchFactory = input => fetch.nodeFetchService.makeFetch({
3175
+ baseUrl: input.apiUrl,
3176
+ baseRequest: {
3177
+ headers: {
3178
+ 'Content-Type': 'application/json'
3179
+ }
3180
+ },
3181
+ timeout: 20 * 1000,
3182
+ requireOkResponse: true,
3183
+ useTimeout: true // use timeout
3184
+ })
3185
+ } = factoryConfig;
3186
+ return config => {
3187
+ var _a;
3188
+ if (!config.refreshToken) {
3189
+ throw new Error('ZohoAccountsConfig missing refreshToken.');
3190
+ } else if (!config.clientId) {
3191
+ throw new Error('ZohoAccountsConfig missing clientId.');
3192
+ } else if (!config.clientSecret) {
3193
+ throw new Error('ZohoAccountsConfig missing clientSecret.');
3194
+ }
3195
+ const apiUrl = zohoAccountsConfigApiUrl((_a = config.apiUrl) !== null && _a !== void 0 ? _a : 'us');
3196
+ const baseFetch = fetchFactory({
3197
+ apiUrl
3198
+ });
3199
+ const fetch$1 = handleZohoAccountsErrorFetch(baseFetch, logZohoServerErrorFunction);
3200
+ const fetchJson = fetch.fetchJsonFunction(fetch$1, {
3201
+ interceptJsonResponse: interceptZohoAccountsErrorResponse,
3202
+ handleFetchJsonParseErrorFunction: fetch.returnNullHandleFetchJsonParseErrorFunction
3203
+ });
3204
+ const tokenRefresher = () => __awaiter(this, void 0, void 0, function* () {
3205
+ const createdAt = new Date().getTime();
3206
+ const {
3207
+ access_token,
3208
+ api_domain,
3209
+ scope,
3210
+ expires_in
3211
+ } = yield accessToken(accountsContext)();
3212
+ const result = {
3213
+ accessToken: access_token,
3214
+ apiDomain: api_domain,
3215
+ expiresIn: expires_in,
3216
+ expiresAt: new Date(createdAt + expires_in * util.MS_IN_SECOND),
3217
+ scope
3218
+ };
3219
+ return result;
3220
+ });
3221
+ const loadAccessToken = zohoAccountsZohoAccessTokenFactory({
3222
+ tokenRefresher,
3223
+ accessTokenCache: config.accessTokenCache
3224
+ });
3225
+ const accountsContext = {
3226
+ fetch: fetch$1,
3227
+ fetchJson,
3228
+ loadAccessToken,
3229
+ config: Object.assign(Object.assign({}, config), {
3230
+ apiUrl
3231
+ })
3232
+ };
3233
+ const zohoAccounts = {
3234
+ accountsContext
3235
+ };
3236
+ return zohoAccounts;
3237
+ };
3238
+ }
3239
+ /**
3240
+ * Creates a ZohoAccountsZohoAccessTokenFactoryConfig
3241
+ *
3242
+ * @param config
3243
+ * @returns
3244
+ */
3245
+ function zohoAccountsZohoAccessTokenFactory(config) {
3246
+ const {
3247
+ tokenRefresher,
3248
+ accessTokenCache,
3249
+ tokenExpirationBuffer: inputTokenExpirationBuffer
3250
+ } = config;
3251
+ const tokenExpirationBuffer = inputTokenExpirationBuffer !== null && inputTokenExpirationBuffer !== void 0 ? inputTokenExpirationBuffer : util.MS_IN_MINUTE;
3252
+ /**
3253
+ * Caches the token internally here until it expires.
3254
+ */
3255
+ let currentToken = null;
3256
+ return () => __awaiter(this, void 0, void 0, function* () {
3257
+ // load from cache
3258
+ if (!currentToken) {
3259
+ const cachedToken = yield accessTokenCache === null || accessTokenCache === void 0 ? void 0 : accessTokenCache.loadCachedToken();
3260
+ if (cachedToken) {
3261
+ currentToken = cachedToken;
3262
+ }
3263
+ }
3264
+ // check expiration
3265
+ if (currentToken != null) {
3266
+ const isExpired = new Date().getTime() + tokenExpirationBuffer >= currentToken.expiresAt.getTime();
3267
+ if (isExpired) {
3268
+ currentToken = null;
3269
+ }
3270
+ }
3271
+ // load from source
3272
+ if (!currentToken) {
3273
+ try {
3274
+ currentToken = yield tokenRefresher();
3275
+ } catch (e) {
3276
+ console.error(`zohoAccountsZohoAccessTokenFactory(): Failed retrieving new token from tokenRefresher: `, e);
3277
+ throw new ZohoAccountsAuthFailureError('Token Refresh Failed');
3278
+ }
3279
+ if (currentToken) {
3280
+ try {
3281
+ yield accessTokenCache === null || accessTokenCache === void 0 ? void 0 : accessTokenCache.updateCachedToken(currentToken);
3282
+ } catch (e) {
3283
+ // do nothing
3284
+ }
3285
+ }
3286
+ }
3287
+ return currentToken;
3288
+ });
3289
+ }
3290
+
3291
+ exports.ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE = ZOHO_ACCOUNTS_INVALID_CLIENT_ERROR_CODE;
3292
+ exports.ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE = ZOHO_ACCOUNTS_INVALID_CODE_ERROR_CODE;
3293
+ exports.ZOHO_ACCOUNTS_US_API_URL = ZOHO_ACCOUNTS_US_API_URL;
3294
+ exports.ZOHO_DUPLICATE_DATA_ERROR_CODE = ZOHO_DUPLICATE_DATA_ERROR_CODE;
3295
+ exports.ZOHO_INTERNAL_ERROR_CODE = ZOHO_INTERNAL_ERROR_CODE;
3296
+ exports.ZOHO_INVALID_AUTHORIZATION_ERROR_CODE = ZOHO_INVALID_AUTHORIZATION_ERROR_CODE;
3297
+ exports.ZOHO_INVALID_DATA_ERROR_CODE = ZOHO_INVALID_DATA_ERROR_CODE;
3298
+ exports.ZOHO_INVALID_QUERY_ERROR_CODE = ZOHO_INVALID_QUERY_ERROR_CODE;
3299
+ exports.ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE = ZOHO_MANDATORY_NOT_FOUND_ERROR_CODE;
3300
+ exports.ZOHO_RECRUIT_SERVICE_NAME = ZOHO_RECRUIT_SERVICE_NAME;
3301
+ exports.ZOHO_SUCCESS_CODE = ZOHO_SUCCESS_CODE;
3302
+ exports.ZohoAccountsAccessTokenError = ZohoAccountsAccessTokenError;
3303
+ exports.ZohoAccountsAuthFailureError = ZohoAccountsAuthFailureError;
3304
+ exports.ZohoInternalError = ZohoInternalError;
3305
+ exports.ZohoInvalidAuthorizationError = ZohoInvalidAuthorizationError;
3306
+ exports.ZohoInvalidQueryError = ZohoInvalidQueryError;
3307
+ exports.ZohoRecruitRecordCrudDuplicateDataError = ZohoRecruitRecordCrudDuplicateDataError;
3308
+ exports.ZohoRecruitRecordCrudError = ZohoRecruitRecordCrudError;
3309
+ exports.ZohoRecruitRecordCrudInvalidDataError = ZohoRecruitRecordCrudInvalidDataError;
3310
+ exports.ZohoRecruitRecordCrudMandatoryFieldNotFoundError = ZohoRecruitRecordCrudMandatoryFieldNotFoundError;
3311
+ exports.ZohoRecruitRecordCrudNoMatchingRecordError = ZohoRecruitRecordCrudNoMatchingRecordError;
3312
+ exports.ZohoRecruitRecordNoContentError = ZohoRecruitRecordNoContentError;
3313
+ exports.ZohoServerError = ZohoServerError;
3314
+ exports.ZohoServerFetchResponseError = ZohoServerFetchResponseError;
3315
+ exports.accessToken = accessToken;
3316
+ exports.assertRecordDataArrayResultHasContent = assertRecordDataArrayResultHasContent;
3317
+ exports.escapeZohoFieldValueForCriteriaString = escapeZohoFieldValueForCriteriaString;
3318
+ exports.getRecordById = getRecordById;
3319
+ exports.getRecords = getRecords;
3320
+ exports.handleZohoAccountsErrorFetch = handleZohoAccountsErrorFetch;
3321
+ exports.handleZohoErrorFetchFactory = handleZohoErrorFetchFactory;
3322
+ exports.handleZohoRecruitErrorFetch = handleZohoRecruitErrorFetch;
3323
+ exports.insertRecord = insertRecord;
3324
+ exports.interceptZohoAccountsErrorResponse = interceptZohoAccountsErrorResponse;
3325
+ exports.interceptZohoErrorResponseFactory = interceptZohoErrorResponseFactory;
3326
+ exports.interceptZohoRecruitErrorResponse = interceptZohoRecruitErrorResponse;
3327
+ exports.logZohoAccountsErrorToConsole = logZohoAccountsErrorToConsole;
3328
+ exports.logZohoRecruitErrorToConsole = logZohoRecruitErrorToConsole;
3329
+ exports.logZohoServerErrorFunction = logZohoServerErrorFunction;
3330
+ exports.parseZohoAccountsError = parseZohoAccountsError;
3331
+ exports.parseZohoAccountsServerErrorResponseData = parseZohoAccountsServerErrorResponseData;
3332
+ exports.parseZohoRecruitError = parseZohoRecruitError;
3333
+ exports.parseZohoRecruitServerErrorResponseData = parseZohoRecruitServerErrorResponseData;
3334
+ exports.parseZohoServerErrorResponseData = parseZohoServerErrorResponseData;
3335
+ exports.searchRecords = searchRecords;
3336
+ exports.tryFindZohoServerErrorData = tryFindZohoServerErrorData;
3337
+ exports.updateRecord = updateRecord;
3338
+ exports.upsertRecord = upsertRecord;
3339
+ exports.zohoAccessTokenStringFactory = zohoAccessTokenStringFactory;
3340
+ exports.zohoAccountsApiFetchJsonInput = zohoAccountsApiFetchJsonInput;
3341
+ exports.zohoAccountsConfigApiUrl = zohoAccountsConfigApiUrl;
3342
+ exports.zohoAccountsFactory = zohoAccountsFactory;
3343
+ exports.zohoAccountsZohoAccessTokenFactory = zohoAccountsZohoAccessTokenFactory;
3344
+ exports.zohoRecruitApiFetchJsonInput = zohoRecruitApiFetchJsonInput;
3345
+ exports.zohoRecruitConfigApiUrl = zohoRecruitConfigApiUrl;
3346
+ exports.zohoRecruitFactory = zohoRecruitFactory;
3347
+ exports.zohoRecruitMultiRecordResult = zohoRecruitMultiRecordResult;
3348
+ exports.zohoRecruitRecordCrudError = zohoRecruitRecordCrudError;
3349
+ exports.zohoRecruitSearchRecordsCriteriaEntryToCriteriaString = zohoRecruitSearchRecordsCriteriaEntryToCriteriaString;
3350
+ exports.zohoRecruitSearchRecordsCriteriaString = zohoRecruitSearchRecordsCriteriaString;
3351
+ exports.zohoRecruitSearchRecordsCriteriaStringForTree = zohoRecruitSearchRecordsCriteriaStringForTree;
3352
+ exports.zohoRecruitUrlSearchParamsMinusModule = zohoRecruitUrlSearchParamsMinusModule;
3353
+ exports.zohoServerErrorData = zohoServerErrorData;