@wg-npm/survey-service-api 0.1.272 → 0.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.
@@ -1,2774 +0,0 @@
1
- 'use strict';
2
-
3
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
-
5
- var Axios = _interopDefault(require('axios'));
6
- var util = _interopDefault(require('util'));
7
-
8
- /*! *****************************************************************************
9
- Copyright (c) Microsoft Corporation.
10
-
11
- Permission to use, copy, modify, and/or distribute this software for any
12
- purpose with or without fee is hereby granted.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
- PERFORMANCE OF THIS SOFTWARE.
21
- ***************************************************************************** */
22
-
23
- var __assign = function() {
24
- __assign = Object.assign || function __assign(t) {
25
- for (var s, i = 1, n = arguments.length; i < n; i++) {
26
- s = arguments[i];
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
28
- }
29
- return t;
30
- };
31
- return __assign.apply(this, arguments);
32
- };
33
-
34
- var SurveyModel = function () {
35
- function SurveyModel() {}
36
-
37
- return SurveyModel;
38
- }();
39
-
40
- var QuestionModel = function () {
41
- function QuestionModel() {}
42
-
43
- return QuestionModel;
44
- }();
45
-
46
- /* eslint complexity: [2, 18], max-statements: [2, 33] */
47
-
48
- var shams = function hasSymbols() {
49
- if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') {
50
- return false;
51
- }
52
-
53
- if (typeof Symbol.iterator === 'symbol') {
54
- return true;
55
- }
56
-
57
- var obj = {};
58
- var sym = Symbol('test');
59
- var symObj = Object(sym);
60
-
61
- if (typeof sym === 'string') {
62
- return false;
63
- }
64
-
65
- if (Object.prototype.toString.call(sym) !== '[object Symbol]') {
66
- return false;
67
- }
68
-
69
- if (Object.prototype.toString.call(symObj) !== '[object Symbol]') {
70
- return false;
71
- } // temp disabled per https://github.com/ljharb/object.assign/issues/17
72
- // if (sym instanceof Symbol) { return false; }
73
- // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
74
- // if (!(symObj instanceof Symbol)) { return false; }
75
- // if (typeof Symbol.prototype.toString !== 'function') { return false; }
76
- // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
77
-
78
-
79
- var symVal = 42;
80
- obj[sym] = symVal;
81
-
82
- for (sym in obj) {
83
- return false;
84
- } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
85
-
86
-
87
- if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) {
88
- return false;
89
- }
90
-
91
- if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) {
92
- return false;
93
- }
94
-
95
- var syms = Object.getOwnPropertySymbols(obj);
96
-
97
- if (syms.length !== 1 || syms[0] !== sym) {
98
- return false;
99
- }
100
-
101
- if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
102
- return false;
103
- }
104
-
105
- if (typeof Object.getOwnPropertyDescriptor === 'function') {
106
- var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
107
-
108
- if (descriptor.value !== symVal || descriptor.enumerable !== true) {
109
- return false;
110
- }
111
- }
112
-
113
- return true;
114
- };
115
-
116
- var origSymbol = typeof Symbol !== 'undefined' && Symbol;
117
-
118
- var hasSymbols = function hasNativeSymbols() {
119
- if (typeof origSymbol !== 'function') {
120
- return false;
121
- }
122
-
123
- if (typeof Symbol !== 'function') {
124
- return false;
125
- }
126
-
127
- if (typeof origSymbol('foo') !== 'symbol') {
128
- return false;
129
- }
130
-
131
- if (typeof Symbol('bar') !== 'symbol') {
132
- return false;
133
- }
134
-
135
- return shams();
136
- };
137
-
138
- /* eslint no-invalid-this: 1 */
139
-
140
- var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
141
- var slice = Array.prototype.slice;
142
- var toStr = Object.prototype.toString;
143
- var funcType = '[object Function]';
144
-
145
- var implementation = function bind(that) {
146
- var target = this;
147
-
148
- if (typeof target !== 'function' || toStr.call(target) !== funcType) {
149
- throw new TypeError(ERROR_MESSAGE + target);
150
- }
151
-
152
- var args = slice.call(arguments, 1);
153
- var bound;
154
-
155
- var binder = function () {
156
- if (this instanceof bound) {
157
- var result = target.apply(this, args.concat(slice.call(arguments)));
158
-
159
- if (Object(result) === result) {
160
- return result;
161
- }
162
-
163
- return this;
164
- } else {
165
- return target.apply(that, args.concat(slice.call(arguments)));
166
- }
167
- };
168
-
169
- var boundLength = Math.max(0, target.length - args.length);
170
- var boundArgs = [];
171
-
172
- for (var i = 0; i < boundLength; i++) {
173
- boundArgs.push('$' + i);
174
- }
175
-
176
- bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
177
-
178
- if (target.prototype) {
179
- var Empty = function Empty() {};
180
-
181
- Empty.prototype = target.prototype;
182
- bound.prototype = new Empty();
183
- Empty.prototype = null;
184
- }
185
-
186
- return bound;
187
- };
188
-
189
- var functionBind = Function.prototype.bind || implementation;
190
-
191
- var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
192
-
193
- var undefined$1;
194
- var $SyntaxError = SyntaxError;
195
- var $Function = Function;
196
- var $TypeError = TypeError; // eslint-disable-next-line consistent-return
197
-
198
- var getEvalledConstructor = function (expressionSyntax) {
199
- try {
200
- return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
201
- } catch (e) {}
202
- };
203
-
204
- var $gOPD = Object.getOwnPropertyDescriptor;
205
-
206
- if ($gOPD) {
207
- try {
208
- $gOPD({}, '');
209
- } catch (e) {
210
- $gOPD = null; // this is IE 8, which has a broken gOPD
211
- }
212
- }
213
-
214
- var throwTypeError = function () {
215
- throw new $TypeError();
216
- };
217
-
218
- var ThrowTypeError = $gOPD ? function () {
219
- try {
220
- // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
221
- arguments.callee; // IE 8 does not throw here
222
-
223
- return throwTypeError;
224
- } catch (calleeThrows) {
225
- try {
226
- // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
227
- return $gOPD(arguments, 'callee').get;
228
- } catch (gOPDthrows) {
229
- return throwTypeError;
230
- }
231
- }
232
- }() : throwTypeError;
233
- var hasSymbols$1 = hasSymbols();
234
-
235
- var getProto = Object.getPrototypeOf || function (x) {
236
- return x.__proto__;
237
- }; // eslint-disable-line no-proto
238
-
239
-
240
- var needsEval = {};
241
- var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
242
- var INTRINSICS = {
243
- '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
244
- '%Array%': Array,
245
- '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
246
- '%ArrayIteratorPrototype%': hasSymbols$1 ? getProto([][Symbol.iterator]()) : undefined$1,
247
- '%AsyncFromSyncIteratorPrototype%': undefined$1,
248
- '%AsyncFunction%': needsEval,
249
- '%AsyncGenerator%': needsEval,
250
- '%AsyncGeneratorFunction%': needsEval,
251
- '%AsyncIteratorPrototype%': needsEval,
252
- '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
253
- '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
254
- '%Boolean%': Boolean,
255
- '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
256
- '%Date%': Date,
257
- '%decodeURI%': decodeURI,
258
- '%decodeURIComponent%': decodeURIComponent,
259
- '%encodeURI%': encodeURI,
260
- '%encodeURIComponent%': encodeURIComponent,
261
- '%Error%': Error,
262
- '%eval%': eval,
263
- // eslint-disable-line no-eval
264
- '%EvalError%': EvalError,
265
- '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
266
- '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
267
- '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
268
- '%Function%': $Function,
269
- '%GeneratorFunction%': needsEval,
270
- '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
271
- '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
272
- '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
273
- '%isFinite%': isFinite,
274
- '%isNaN%': isNaN,
275
- '%IteratorPrototype%': hasSymbols$1 ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
276
- '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
277
- '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
278
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$1 ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
279
- '%Math%': Math,
280
- '%Number%': Number,
281
- '%Object%': Object,
282
- '%parseFloat%': parseFloat,
283
- '%parseInt%': parseInt,
284
- '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
285
- '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
286
- '%RangeError%': RangeError,
287
- '%ReferenceError%': ReferenceError,
288
- '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
289
- '%RegExp%': RegExp,
290
- '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
291
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$1 ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
292
- '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
293
- '%String%': String,
294
- '%StringIteratorPrototype%': hasSymbols$1 ? getProto(''[Symbol.iterator]()) : undefined$1,
295
- '%Symbol%': hasSymbols$1 ? Symbol : undefined$1,
296
- '%SyntaxError%': $SyntaxError,
297
- '%ThrowTypeError%': ThrowTypeError,
298
- '%TypedArray%': TypedArray,
299
- '%TypeError%': $TypeError,
300
- '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
301
- '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
302
- '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
303
- '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
304
- '%URIError%': URIError,
305
- '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
306
- '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
307
- '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
308
- };
309
-
310
- var doEval = function doEval(name) {
311
- var value;
312
-
313
- if (name === '%AsyncFunction%') {
314
- value = getEvalledConstructor('async function () {}');
315
- } else if (name === '%GeneratorFunction%') {
316
- value = getEvalledConstructor('function* () {}');
317
- } else if (name === '%AsyncGeneratorFunction%') {
318
- value = getEvalledConstructor('async function* () {}');
319
- } else if (name === '%AsyncGenerator%') {
320
- var fn = doEval('%AsyncGeneratorFunction%');
321
-
322
- if (fn) {
323
- value = fn.prototype;
324
- }
325
- } else if (name === '%AsyncIteratorPrototype%') {
326
- var gen = doEval('%AsyncGenerator%');
327
-
328
- if (gen) {
329
- value = getProto(gen.prototype);
330
- }
331
- }
332
-
333
- INTRINSICS[name] = value;
334
- return value;
335
- };
336
-
337
- var LEGACY_ALIASES = {
338
- '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
339
- '%ArrayPrototype%': ['Array', 'prototype'],
340
- '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
341
- '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
342
- '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
343
- '%ArrayProto_values%': ['Array', 'prototype', 'values'],
344
- '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
345
- '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
346
- '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
347
- '%BooleanPrototype%': ['Boolean', 'prototype'],
348
- '%DataViewPrototype%': ['DataView', 'prototype'],
349
- '%DatePrototype%': ['Date', 'prototype'],
350
- '%ErrorPrototype%': ['Error', 'prototype'],
351
- '%EvalErrorPrototype%': ['EvalError', 'prototype'],
352
- '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
353
- '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
354
- '%FunctionPrototype%': ['Function', 'prototype'],
355
- '%Generator%': ['GeneratorFunction', 'prototype'],
356
- '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
357
- '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
358
- '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
359
- '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
360
- '%JSONParse%': ['JSON', 'parse'],
361
- '%JSONStringify%': ['JSON', 'stringify'],
362
- '%MapPrototype%': ['Map', 'prototype'],
363
- '%NumberPrototype%': ['Number', 'prototype'],
364
- '%ObjectPrototype%': ['Object', 'prototype'],
365
- '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
366
- '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
367
- '%PromisePrototype%': ['Promise', 'prototype'],
368
- '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
369
- '%Promise_all%': ['Promise', 'all'],
370
- '%Promise_reject%': ['Promise', 'reject'],
371
- '%Promise_resolve%': ['Promise', 'resolve'],
372
- '%RangeErrorPrototype%': ['RangeError', 'prototype'],
373
- '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
374
- '%RegExpPrototype%': ['RegExp', 'prototype'],
375
- '%SetPrototype%': ['Set', 'prototype'],
376
- '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
377
- '%StringPrototype%': ['String', 'prototype'],
378
- '%SymbolPrototype%': ['Symbol', 'prototype'],
379
- '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
380
- '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
381
- '%TypeErrorPrototype%': ['TypeError', 'prototype'],
382
- '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
383
- '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
384
- '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
385
- '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
386
- '%URIErrorPrototype%': ['URIError', 'prototype'],
387
- '%WeakMapPrototype%': ['WeakMap', 'prototype'],
388
- '%WeakSetPrototype%': ['WeakSet', 'prototype']
389
- };
390
- var $concat = functionBind.call(Function.call, Array.prototype.concat);
391
- var $spliceApply = functionBind.call(Function.apply, Array.prototype.splice);
392
- var $replace = functionBind.call(Function.call, String.prototype.replace);
393
- var $strSlice = functionBind.call(Function.call, String.prototype.slice);
394
- /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
395
-
396
- var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
397
- var reEscapeChar = /\\(\\)?/g;
398
- /** Used to match backslashes in property paths. */
399
-
400
- var stringToPath = function stringToPath(string) {
401
- var first = $strSlice(string, 0, 1);
402
- var last = $strSlice(string, -1);
403
-
404
- if (first === '%' && last !== '%') {
405
- throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
406
- } else if (last === '%' && first !== '%') {
407
- throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
408
- }
409
-
410
- var result = [];
411
- $replace(string, rePropName, function (match, number, quote, subString) {
412
- result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
413
- });
414
- return result;
415
- };
416
- /* end adaptation */
417
-
418
-
419
- var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
420
- var intrinsicName = name;
421
- var alias;
422
-
423
- if (src(LEGACY_ALIASES, intrinsicName)) {
424
- alias = LEGACY_ALIASES[intrinsicName];
425
- intrinsicName = '%' + alias[0] + '%';
426
- }
427
-
428
- if (src(INTRINSICS, intrinsicName)) {
429
- var value = INTRINSICS[intrinsicName];
430
-
431
- if (value === needsEval) {
432
- value = doEval(intrinsicName);
433
- }
434
-
435
- if (typeof value === 'undefined' && !allowMissing) {
436
- throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
437
- }
438
-
439
- return {
440
- alias: alias,
441
- name: intrinsicName,
442
- value: value
443
- };
444
- }
445
-
446
- throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
447
- };
448
-
449
- var getIntrinsic = function GetIntrinsic(name, allowMissing) {
450
- if (typeof name !== 'string' || name.length === 0) {
451
- throw new $TypeError('intrinsic name must be a non-empty string');
452
- }
453
-
454
- if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
455
- throw new $TypeError('"allowMissing" argument must be a boolean');
456
- }
457
-
458
- var parts = stringToPath(name);
459
- var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
460
- var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
461
- var intrinsicRealName = intrinsic.name;
462
- var value = intrinsic.value;
463
- var skipFurtherCaching = false;
464
- var alias = intrinsic.alias;
465
-
466
- if (alias) {
467
- intrinsicBaseName = alias[0];
468
- $spliceApply(parts, $concat([0, 1], alias));
469
- }
470
-
471
- for (var i = 1, isOwn = true; i < parts.length; i += 1) {
472
- var part = parts[i];
473
- var first = $strSlice(part, 0, 1);
474
- var last = $strSlice(part, -1);
475
-
476
- if ((first === '"' || first === "'" || first === '`' || last === '"' || last === "'" || last === '`') && first !== last) {
477
- throw new $SyntaxError('property names with quotes must have matching quotes');
478
- }
479
-
480
- if (part === 'constructor' || !isOwn) {
481
- skipFurtherCaching = true;
482
- }
483
-
484
- intrinsicBaseName += '.' + part;
485
- intrinsicRealName = '%' + intrinsicBaseName + '%';
486
-
487
- if (src(INTRINSICS, intrinsicRealName)) {
488
- value = INTRINSICS[intrinsicRealName];
489
- } else if (value != null) {
490
- if (!(part in value)) {
491
- if (!allowMissing) {
492
- throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
493
- }
494
-
495
- return void undefined$1;
496
- }
497
-
498
- if ($gOPD && i + 1 >= parts.length) {
499
- var desc = $gOPD(value, part);
500
- isOwn = !!desc; // By convention, when a data property is converted to an accessor
501
- // property to emulate a data property that does not suffer from
502
- // the override mistake, that accessor's getter is marked with
503
- // an `originalValue` property. Here, when we detect this, we
504
- // uphold the illusion by pretending to see that original data
505
- // property, i.e., returning the value rather than the getter
506
- // itself.
507
-
508
- if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
509
- value = desc.get;
510
- } else {
511
- value = value[part];
512
- }
513
- } else {
514
- isOwn = src(value, part);
515
- value = value[part];
516
- }
517
-
518
- if (isOwn && !skipFurtherCaching) {
519
- INTRINSICS[intrinsicRealName] = value;
520
- }
521
- }
522
- }
523
-
524
- return value;
525
- };
526
-
527
- function unwrapExports (x) {
528
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
529
- }
530
-
531
- function createCommonjsModule(fn, module) {
532
- return module = { exports: {} }, fn(module, module.exports), module.exports;
533
- }
534
-
535
- var callBind = createCommonjsModule(function (module) {
536
-
537
- var $apply = getIntrinsic('%Function.prototype.apply%');
538
- var $call = getIntrinsic('%Function.prototype.call%');
539
- var $reflectApply = getIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
540
- var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
541
- var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
542
- var $max = getIntrinsic('%Math.max%');
543
-
544
- if ($defineProperty) {
545
- try {
546
- $defineProperty({}, 'a', {
547
- value: 1
548
- });
549
- } catch (e) {
550
- // IE 8 has a broken defineProperty
551
- $defineProperty = null;
552
- }
553
- }
554
-
555
- module.exports = function callBind(originalFunction) {
556
- var func = $reflectApply(functionBind, $call, arguments);
557
-
558
- if ($gOPD && $defineProperty) {
559
- var desc = $gOPD(func, 'length');
560
-
561
- if (desc.configurable) {
562
- // original length, plus the receiver, minus any additional arguments (after the receiver)
563
- $defineProperty(func, 'length', {
564
- value: 1 + $max(0, originalFunction.length - (arguments.length - 1))
565
- });
566
- }
567
- }
568
-
569
- return func;
570
- };
571
-
572
- var applyBind = function applyBind() {
573
- return $reflectApply(functionBind, $apply, arguments);
574
- };
575
-
576
- if ($defineProperty) {
577
- $defineProperty(module.exports, 'apply', {
578
- value: applyBind
579
- });
580
- } else {
581
- module.exports.apply = applyBind;
582
- }
583
- });
584
- var callBind_1 = callBind.apply;
585
-
586
- var $indexOf = callBind(getIntrinsic('String.prototype.indexOf'));
587
-
588
- var callBound = function callBoundIntrinsic(name, allowMissing) {
589
- var intrinsic = getIntrinsic(name, !!allowMissing);
590
-
591
- if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
592
- return callBind(intrinsic);
593
- }
594
-
595
- return intrinsic;
596
- };
597
-
598
- var util_inspect = util.inspect;
599
-
600
- var hasMap = typeof Map === 'function' && Map.prototype;
601
- var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
602
- var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
603
- var mapForEach = hasMap && Map.prototype.forEach;
604
- var hasSet = typeof Set === 'function' && Set.prototype;
605
- var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
606
- var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
607
- var setForEach = hasSet && Set.prototype.forEach;
608
- var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
609
- var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
610
- var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
611
- var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
612
- var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
613
- var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
614
- var booleanValueOf = Boolean.prototype.valueOf;
615
- var objectToString = Object.prototype.toString;
616
- var functionToString = Function.prototype.toString;
617
- var match = String.prototype.match;
618
- var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
619
- var gOPS = Object.getOwnPropertySymbols;
620
- var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
621
- var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
622
- var isEnumerable = Object.prototype.propertyIsEnumerable;
623
- var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype // eslint-disable-line no-proto
624
- ? function (O) {
625
- return O.__proto__; // eslint-disable-line no-proto
626
- } : null);
627
- var inspectCustom = util_inspect.custom;
628
- var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
629
- var toStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag !== 'undefined' ? Symbol.toStringTag : null;
630
-
631
- var objectInspect = function inspect_(obj, options, depth, seen) {
632
- var opts = options || {};
633
-
634
- if (has(opts, 'quoteStyle') && opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double') {
635
- throw new TypeError('option "quoteStyle" must be "single" or "double"');
636
- }
637
-
638
- if (has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) {
639
- throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
640
- }
641
-
642
- var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
643
-
644
- if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
645
- throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
646
- }
647
-
648
- if (has(opts, 'indent') && opts.indent !== null && opts.indent !== '\t' && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) {
649
- throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');
650
- }
651
-
652
- if (typeof obj === 'undefined') {
653
- return 'undefined';
654
- }
655
-
656
- if (obj === null) {
657
- return 'null';
658
- }
659
-
660
- if (typeof obj === 'boolean') {
661
- return obj ? 'true' : 'false';
662
- }
663
-
664
- if (typeof obj === 'string') {
665
- return inspectString(obj, opts);
666
- }
667
-
668
- if (typeof obj === 'number') {
669
- if (obj === 0) {
670
- return Infinity / obj > 0 ? '0' : '-0';
671
- }
672
-
673
- return String(obj);
674
- }
675
-
676
- if (typeof obj === 'bigint') {
677
- return String(obj) + 'n';
678
- }
679
-
680
- var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
681
-
682
- if (typeof depth === 'undefined') {
683
- depth = 0;
684
- }
685
-
686
- if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
687
- return isArray(obj) ? '[Array]' : '[Object]';
688
- }
689
-
690
- var indent = getIndent(opts, depth);
691
-
692
- if (typeof seen === 'undefined') {
693
- seen = [];
694
- } else if (indexOf(seen, obj) >= 0) {
695
- return '[Circular]';
696
- }
697
-
698
- function inspect(value, from, noIndent) {
699
- if (from) {
700
- seen = seen.slice();
701
- seen.push(from);
702
- }
703
-
704
- if (noIndent) {
705
- var newOpts = {
706
- depth: opts.depth
707
- };
708
-
709
- if (has(opts, 'quoteStyle')) {
710
- newOpts.quoteStyle = opts.quoteStyle;
711
- }
712
-
713
- return inspect_(value, newOpts, depth + 1, seen);
714
- }
715
-
716
- return inspect_(value, opts, depth + 1, seen);
717
- }
718
-
719
- if (typeof obj === 'function') {
720
- var name = nameOf(obj);
721
- var keys = arrObjKeys(obj, inspect);
722
- return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + keys.join(', ') + ' }' : '');
723
- }
724
-
725
- if (isSymbol(obj)) {
726
- var symString = hasShammedSymbols ? String(obj).replace(/^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
727
- return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
728
- }
729
-
730
- if (isElement(obj)) {
731
- var s = '<' + String(obj.nodeName).toLowerCase();
732
- var attrs = obj.attributes || [];
733
-
734
- for (var i = 0; i < attrs.length; i++) {
735
- s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
736
- }
737
-
738
- s += '>';
739
-
740
- if (obj.childNodes && obj.childNodes.length) {
741
- s += '...';
742
- }
743
-
744
- s += '</' + String(obj.nodeName).toLowerCase() + '>';
745
- return s;
746
- }
747
-
748
- if (isArray(obj)) {
749
- if (obj.length === 0) {
750
- return '[]';
751
- }
752
-
753
- var xs = arrObjKeys(obj, inspect);
754
-
755
- if (indent && !singleLineValues(xs)) {
756
- return '[' + indentedJoin(xs, indent) + ']';
757
- }
758
-
759
- return '[ ' + xs.join(', ') + ' ]';
760
- }
761
-
762
- if (isError(obj)) {
763
- var parts = arrObjKeys(obj, inspect);
764
-
765
- if (parts.length === 0) {
766
- return '[' + String(obj) + ']';
767
- }
768
-
769
- return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';
770
- }
771
-
772
- if (typeof obj === 'object' && customInspect) {
773
- if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
774
- return obj[inspectSymbol]();
775
- } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
776
- return obj.inspect();
777
- }
778
- }
779
-
780
- if (isMap(obj)) {
781
- var mapParts = [];
782
- mapForEach.call(obj, function (value, key) {
783
- mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
784
- });
785
- return collectionOf('Map', mapSize.call(obj), mapParts, indent);
786
- }
787
-
788
- if (isSet(obj)) {
789
- var setParts = [];
790
- setForEach.call(obj, function (value) {
791
- setParts.push(inspect(value, obj));
792
- });
793
- return collectionOf('Set', setSize.call(obj), setParts, indent);
794
- }
795
-
796
- if (isWeakMap(obj)) {
797
- return weakCollectionOf('WeakMap');
798
- }
799
-
800
- if (isWeakSet(obj)) {
801
- return weakCollectionOf('WeakSet');
802
- }
803
-
804
- if (isWeakRef(obj)) {
805
- return weakCollectionOf('WeakRef');
806
- }
807
-
808
- if (isNumber(obj)) {
809
- return markBoxed(inspect(Number(obj)));
810
- }
811
-
812
- if (isBigInt(obj)) {
813
- return markBoxed(inspect(bigIntValueOf.call(obj)));
814
- }
815
-
816
- if (isBoolean(obj)) {
817
- return markBoxed(booleanValueOf.call(obj));
818
- }
819
-
820
- if (isString(obj)) {
821
- return markBoxed(inspect(String(obj)));
822
- }
823
-
824
- if (!isDate(obj) && !isRegExp(obj)) {
825
- var ys = arrObjKeys(obj, inspect);
826
- var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
827
- var protoTag = obj instanceof Object ? '' : 'null prototype';
828
- var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? toStr$1(obj).slice(8, -1) : protoTag ? 'Object' : '';
829
- var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
830
- var tag = constructorTag + (stringTag || protoTag ? '[' + [].concat(stringTag || [], protoTag || []).join(': ') + '] ' : '');
831
-
832
- if (ys.length === 0) {
833
- return tag + '{}';
834
- }
835
-
836
- if (indent) {
837
- return tag + '{' + indentedJoin(ys, indent) + '}';
838
- }
839
-
840
- return tag + '{ ' + ys.join(', ') + ' }';
841
- }
842
-
843
- return String(obj);
844
- };
845
-
846
- function wrapQuotes(s, defaultStyle, opts) {
847
- var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
848
- return quoteChar + s + quoteChar;
849
- }
850
-
851
- function quote(s) {
852
- return String(s).replace(/"/g, '&quot;');
853
- }
854
-
855
- function isArray(obj) {
856
- return toStr$1(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
857
- }
858
-
859
- function isDate(obj) {
860
- return toStr$1(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
861
- }
862
-
863
- function isRegExp(obj) {
864
- return toStr$1(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
865
- }
866
-
867
- function isError(obj) {
868
- return toStr$1(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
869
- }
870
-
871
- function isString(obj) {
872
- return toStr$1(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
873
- }
874
-
875
- function isNumber(obj) {
876
- return toStr$1(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
877
- }
878
-
879
- function isBoolean(obj) {
880
- return toStr$1(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj));
881
- } // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
882
-
883
-
884
- function isSymbol(obj) {
885
- if (hasShammedSymbols) {
886
- return obj && typeof obj === 'object' && obj instanceof Symbol;
887
- }
888
-
889
- if (typeof obj === 'symbol') {
890
- return true;
891
- }
892
-
893
- if (!obj || typeof obj !== 'object' || !symToString) {
894
- return false;
895
- }
896
-
897
- try {
898
- symToString.call(obj);
899
- return true;
900
- } catch (e) {}
901
-
902
- return false;
903
- }
904
-
905
- function isBigInt(obj) {
906
- if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
907
- return false;
908
- }
909
-
910
- try {
911
- bigIntValueOf.call(obj);
912
- return true;
913
- } catch (e) {}
914
-
915
- return false;
916
- }
917
-
918
- var hasOwn = Object.prototype.hasOwnProperty || function (key) {
919
- return key in this;
920
- };
921
-
922
- function has(obj, key) {
923
- return hasOwn.call(obj, key);
924
- }
925
-
926
- function toStr$1(obj) {
927
- return objectToString.call(obj);
928
- }
929
-
930
- function nameOf(f) {
931
- if (f.name) {
932
- return f.name;
933
- }
934
-
935
- var m = match.call(functionToString.call(f), /^function\s*([\w$]+)/);
936
-
937
- if (m) {
938
- return m[1];
939
- }
940
-
941
- return null;
942
- }
943
-
944
- function indexOf(xs, x) {
945
- if (xs.indexOf) {
946
- return xs.indexOf(x);
947
- }
948
-
949
- for (var i = 0, l = xs.length; i < l; i++) {
950
- if (xs[i] === x) {
951
- return i;
952
- }
953
- }
954
-
955
- return -1;
956
- }
957
-
958
- function isMap(x) {
959
- if (!mapSize || !x || typeof x !== 'object') {
960
- return false;
961
- }
962
-
963
- try {
964
- mapSize.call(x);
965
-
966
- try {
967
- setSize.call(x);
968
- } catch (s) {
969
- return true;
970
- }
971
-
972
- return x instanceof Map; // core-js workaround, pre-v2.5.0
973
- } catch (e) {}
974
-
975
- return false;
976
- }
977
-
978
- function isWeakMap(x) {
979
- if (!weakMapHas || !x || typeof x !== 'object') {
980
- return false;
981
- }
982
-
983
- try {
984
- weakMapHas.call(x, weakMapHas);
985
-
986
- try {
987
- weakSetHas.call(x, weakSetHas);
988
- } catch (s) {
989
- return true;
990
- }
991
-
992
- return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
993
- } catch (e) {}
994
-
995
- return false;
996
- }
997
-
998
- function isWeakRef(x) {
999
- if (!weakRefDeref || !x || typeof x !== 'object') {
1000
- return false;
1001
- }
1002
-
1003
- try {
1004
- weakRefDeref.call(x);
1005
- return true;
1006
- } catch (e) {}
1007
-
1008
- return false;
1009
- }
1010
-
1011
- function isSet(x) {
1012
- if (!setSize || !x || typeof x !== 'object') {
1013
- return false;
1014
- }
1015
-
1016
- try {
1017
- setSize.call(x);
1018
-
1019
- try {
1020
- mapSize.call(x);
1021
- } catch (m) {
1022
- return true;
1023
- }
1024
-
1025
- return x instanceof Set; // core-js workaround, pre-v2.5.0
1026
- } catch (e) {}
1027
-
1028
- return false;
1029
- }
1030
-
1031
- function isWeakSet(x) {
1032
- if (!weakSetHas || !x || typeof x !== 'object') {
1033
- return false;
1034
- }
1035
-
1036
- try {
1037
- weakSetHas.call(x, weakSetHas);
1038
-
1039
- try {
1040
- weakMapHas.call(x, weakMapHas);
1041
- } catch (s) {
1042
- return true;
1043
- }
1044
-
1045
- return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
1046
- } catch (e) {}
1047
-
1048
- return false;
1049
- }
1050
-
1051
- function isElement(x) {
1052
- if (!x || typeof x !== 'object') {
1053
- return false;
1054
- }
1055
-
1056
- if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
1057
- return true;
1058
- }
1059
-
1060
- return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
1061
- }
1062
-
1063
- function inspectString(str, opts) {
1064
- if (str.length > opts.maxStringLength) {
1065
- var remaining = str.length - opts.maxStringLength;
1066
- var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
1067
- return inspectString(str.slice(0, opts.maxStringLength), opts) + trailer;
1068
- } // eslint-disable-next-line no-control-regex
1069
-
1070
-
1071
- var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
1072
- return wrapQuotes(s, 'single', opts);
1073
- }
1074
-
1075
- function lowbyte(c) {
1076
- var n = c.charCodeAt(0);
1077
- var x = {
1078
- 8: 'b',
1079
- 9: 't',
1080
- 10: 'n',
1081
- 12: 'f',
1082
- 13: 'r'
1083
- }[n];
1084
-
1085
- if (x) {
1086
- return '\\' + x;
1087
- }
1088
-
1089
- return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16).toUpperCase();
1090
- }
1091
-
1092
- function markBoxed(str) {
1093
- return 'Object(' + str + ')';
1094
- }
1095
-
1096
- function weakCollectionOf(type) {
1097
- return type + ' { ? }';
1098
- }
1099
-
1100
- function collectionOf(type, size, entries, indent) {
1101
- var joinedEntries = indent ? indentedJoin(entries, indent) : entries.join(', ');
1102
- return type + ' (' + size + ') {' + joinedEntries + '}';
1103
- }
1104
-
1105
- function singleLineValues(xs) {
1106
- for (var i = 0; i < xs.length; i++) {
1107
- if (indexOf(xs[i], '\n') >= 0) {
1108
- return false;
1109
- }
1110
- }
1111
-
1112
- return true;
1113
- }
1114
-
1115
- function getIndent(opts, depth) {
1116
- var baseIndent;
1117
-
1118
- if (opts.indent === '\t') {
1119
- baseIndent = '\t';
1120
- } else if (typeof opts.indent === 'number' && opts.indent > 0) {
1121
- baseIndent = Array(opts.indent + 1).join(' ');
1122
- } else {
1123
- return null;
1124
- }
1125
-
1126
- return {
1127
- base: baseIndent,
1128
- prev: Array(depth + 1).join(baseIndent)
1129
- };
1130
- }
1131
-
1132
- function indentedJoin(xs, indent) {
1133
- if (xs.length === 0) {
1134
- return '';
1135
- }
1136
-
1137
- var lineJoiner = '\n' + indent.prev + indent.base;
1138
- return lineJoiner + xs.join(',' + lineJoiner) + '\n' + indent.prev;
1139
- }
1140
-
1141
- function arrObjKeys(obj, inspect) {
1142
- var isArr = isArray(obj);
1143
- var xs = [];
1144
-
1145
- if (isArr) {
1146
- xs.length = obj.length;
1147
-
1148
- for (var i = 0; i < obj.length; i++) {
1149
- xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
1150
- }
1151
- }
1152
-
1153
- var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
1154
- var symMap;
1155
-
1156
- if (hasShammedSymbols) {
1157
- symMap = {};
1158
-
1159
- for (var k = 0; k < syms.length; k++) {
1160
- symMap['$' + syms[k]] = syms[k];
1161
- }
1162
- }
1163
-
1164
- for (var key in obj) {
1165
- // eslint-disable-line no-restricted-syntax
1166
- if (!has(obj, key)) {
1167
- continue;
1168
- } // eslint-disable-line no-restricted-syntax, no-continue
1169
-
1170
-
1171
- if (isArr && String(Number(key)) === key && key < obj.length) {
1172
- continue;
1173
- } // eslint-disable-line no-restricted-syntax, no-continue
1174
-
1175
-
1176
- if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1177
- // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
1178
- continue; // eslint-disable-line no-restricted-syntax, no-continue
1179
- } else if (/[^\w$]/.test(key)) {
1180
- xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
1181
- } else {
1182
- xs.push(key + ': ' + inspect(obj[key], obj));
1183
- }
1184
- }
1185
-
1186
- if (typeof gOPS === 'function') {
1187
- for (var j = 0; j < syms.length; j++) {
1188
- if (isEnumerable.call(obj, syms[j])) {
1189
- xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
1190
- }
1191
- }
1192
- }
1193
-
1194
- return xs;
1195
- }
1196
-
1197
- var $TypeError$1 = getIntrinsic('%TypeError%');
1198
- var $WeakMap = getIntrinsic('%WeakMap%', true);
1199
- var $Map = getIntrinsic('%Map%', true);
1200
- var $weakMapGet = callBound('WeakMap.prototype.get', true);
1201
- var $weakMapSet = callBound('WeakMap.prototype.set', true);
1202
- var $weakMapHas = callBound('WeakMap.prototype.has', true);
1203
- var $mapGet = callBound('Map.prototype.get', true);
1204
- var $mapSet = callBound('Map.prototype.set', true);
1205
- var $mapHas = callBound('Map.prototype.has', true);
1206
- /*
1207
- * This function traverses the list returning the node corresponding to the
1208
- * given key.
1209
- *
1210
- * That node is also moved to the head of the list, so that if it's accessed
1211
- * again we don't need to traverse the whole list. By doing so, all the recently
1212
- * used nodes can be accessed relatively quickly.
1213
- */
1214
-
1215
- var listGetNode = function (list, key) {
1216
- // eslint-disable-line consistent-return
1217
- for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
1218
- if (curr.key === key) {
1219
- prev.next = curr.next;
1220
- curr.next = list.next;
1221
- list.next = curr; // eslint-disable-line no-param-reassign
1222
-
1223
- return curr;
1224
- }
1225
- }
1226
- };
1227
-
1228
- var listGet = function (objects, key) {
1229
- var node = listGetNode(objects, key);
1230
- return node && node.value;
1231
- };
1232
-
1233
- var listSet = function (objects, key, value) {
1234
- var node = listGetNode(objects, key);
1235
-
1236
- if (node) {
1237
- node.value = value;
1238
- } else {
1239
- // Prepend the new node to the beginning of the list
1240
- objects.next = {
1241
- // eslint-disable-line no-param-reassign
1242
- key: key,
1243
- next: objects.next,
1244
- value: value
1245
- };
1246
- }
1247
- };
1248
-
1249
- var listHas = function (objects, key) {
1250
- return !!listGetNode(objects, key);
1251
- };
1252
-
1253
- var sideChannel = function getSideChannel() {
1254
- var $wm;
1255
- var $m;
1256
- var $o;
1257
- var channel = {
1258
- assert: function (key) {
1259
- if (!channel.has(key)) {
1260
- throw new $TypeError$1('Side channel does not contain ' + objectInspect(key));
1261
- }
1262
- },
1263
- get: function (key) {
1264
- // eslint-disable-line consistent-return
1265
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1266
- if ($wm) {
1267
- return $weakMapGet($wm, key);
1268
- }
1269
- } else if ($Map) {
1270
- if ($m) {
1271
- return $mapGet($m, key);
1272
- }
1273
- } else {
1274
- if ($o) {
1275
- // eslint-disable-line no-lonely-if
1276
- return listGet($o, key);
1277
- }
1278
- }
1279
- },
1280
- has: function (key) {
1281
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1282
- if ($wm) {
1283
- return $weakMapHas($wm, key);
1284
- }
1285
- } else if ($Map) {
1286
- if ($m) {
1287
- return $mapHas($m, key);
1288
- }
1289
- } else {
1290
- if ($o) {
1291
- // eslint-disable-line no-lonely-if
1292
- return listHas($o, key);
1293
- }
1294
- }
1295
-
1296
- return false;
1297
- },
1298
- set: function (key, value) {
1299
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1300
- if (!$wm) {
1301
- $wm = new $WeakMap();
1302
- }
1303
-
1304
- $weakMapSet($wm, key, value);
1305
- } else if ($Map) {
1306
- if (!$m) {
1307
- $m = new $Map();
1308
- }
1309
-
1310
- $mapSet($m, key, value);
1311
- } else {
1312
- if (!$o) {
1313
- /*
1314
- * Initialize the linked list as an empty node, so that we don't have
1315
- * to special-case handling of the first node: we can always refer to
1316
- * it as (previous node).next, instead of something like (list).head
1317
- */
1318
- $o = {
1319
- key: {},
1320
- next: null
1321
- };
1322
- }
1323
-
1324
- listSet($o, key, value);
1325
- }
1326
- }
1327
- };
1328
- return channel;
1329
- };
1330
-
1331
- var replace = String.prototype.replace;
1332
- var percentTwenties = /%20/g;
1333
- var Format = {
1334
- RFC1738: 'RFC1738',
1335
- RFC3986: 'RFC3986'
1336
- };
1337
- var formats = {
1338
- 'default': Format.RFC3986,
1339
- formatters: {
1340
- RFC1738: function (value) {
1341
- return replace.call(value, percentTwenties, '+');
1342
- },
1343
- RFC3986: function (value) {
1344
- return String(value);
1345
- }
1346
- },
1347
- RFC1738: Format.RFC1738,
1348
- RFC3986: Format.RFC3986
1349
- };
1350
-
1351
- var has$1 = Object.prototype.hasOwnProperty;
1352
- var isArray$1 = Array.isArray;
1353
-
1354
- var hexTable = function () {
1355
- var array = [];
1356
-
1357
- for (var i = 0; i < 256; ++i) {
1358
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
1359
- }
1360
-
1361
- return array;
1362
- }();
1363
-
1364
- var compactQueue = function compactQueue(queue) {
1365
- while (queue.length > 1) {
1366
- var item = queue.pop();
1367
- var obj = item.obj[item.prop];
1368
-
1369
- if (isArray$1(obj)) {
1370
- var compacted = [];
1371
-
1372
- for (var j = 0; j < obj.length; ++j) {
1373
- if (typeof obj[j] !== 'undefined') {
1374
- compacted.push(obj[j]);
1375
- }
1376
- }
1377
-
1378
- item.obj[item.prop] = compacted;
1379
- }
1380
- }
1381
- };
1382
-
1383
- var arrayToObject = function arrayToObject(source, options) {
1384
- var obj = options && options.plainObjects ? Object.create(null) : {};
1385
-
1386
- for (var i = 0; i < source.length; ++i) {
1387
- if (typeof source[i] !== 'undefined') {
1388
- obj[i] = source[i];
1389
- }
1390
- }
1391
-
1392
- return obj;
1393
- };
1394
-
1395
- var merge = function merge(target, source, options) {
1396
- /* eslint no-param-reassign: 0 */
1397
- if (!source) {
1398
- return target;
1399
- }
1400
-
1401
- if (typeof source !== 'object') {
1402
- if (isArray$1(target)) {
1403
- target.push(source);
1404
- } else if (target && typeof target === 'object') {
1405
- if (options && (options.plainObjects || options.allowPrototypes) || !has$1.call(Object.prototype, source)) {
1406
- target[source] = true;
1407
- }
1408
- } else {
1409
- return [target, source];
1410
- }
1411
-
1412
- return target;
1413
- }
1414
-
1415
- if (!target || typeof target !== 'object') {
1416
- return [target].concat(source);
1417
- }
1418
-
1419
- var mergeTarget = target;
1420
-
1421
- if (isArray$1(target) && !isArray$1(source)) {
1422
- mergeTarget = arrayToObject(target, options);
1423
- }
1424
-
1425
- if (isArray$1(target) && isArray$1(source)) {
1426
- source.forEach(function (item, i) {
1427
- if (has$1.call(target, i)) {
1428
- var targetItem = target[i];
1429
-
1430
- if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
1431
- target[i] = merge(targetItem, item, options);
1432
- } else {
1433
- target.push(item);
1434
- }
1435
- } else {
1436
- target[i] = item;
1437
- }
1438
- });
1439
- return target;
1440
- }
1441
-
1442
- return Object.keys(source).reduce(function (acc, key) {
1443
- var value = source[key];
1444
-
1445
- if (has$1.call(acc, key)) {
1446
- acc[key] = merge(acc[key], value, options);
1447
- } else {
1448
- acc[key] = value;
1449
- }
1450
-
1451
- return acc;
1452
- }, mergeTarget);
1453
- };
1454
-
1455
- var assign = function assignSingleSource(target, source) {
1456
- return Object.keys(source).reduce(function (acc, key) {
1457
- acc[key] = source[key];
1458
- return acc;
1459
- }, target);
1460
- };
1461
-
1462
- var decode = function (str, decoder, charset) {
1463
- var strWithoutPlus = str.replace(/\+/g, ' ');
1464
-
1465
- if (charset === 'iso-8859-1') {
1466
- // unescape never throws, no try...catch needed:
1467
- return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1468
- } // utf-8
1469
-
1470
-
1471
- try {
1472
- return decodeURIComponent(strWithoutPlus);
1473
- } catch (e) {
1474
- return strWithoutPlus;
1475
- }
1476
- };
1477
-
1478
- var encode = function encode(str, defaultEncoder, charset, kind, format) {
1479
- // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
1480
- // It has been adapted here for stricter adherence to RFC 3986
1481
- if (str.length === 0) {
1482
- return str;
1483
- }
1484
-
1485
- var string = str;
1486
-
1487
- if (typeof str === 'symbol') {
1488
- string = Symbol.prototype.toString.call(str);
1489
- } else if (typeof str !== 'string') {
1490
- string = String(str);
1491
- }
1492
-
1493
- if (charset === 'iso-8859-1') {
1494
- return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
1495
- return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
1496
- });
1497
- }
1498
-
1499
- var out = '';
1500
-
1501
- for (var i = 0; i < string.length; ++i) {
1502
- var c = string.charCodeAt(i);
1503
-
1504
- if (c === 0x2D // -
1505
- || c === 0x2E // .
1506
- || c === 0x5F // _
1507
- || c === 0x7E // ~
1508
- || c >= 0x30 && c <= 0x39 // 0-9
1509
- || c >= 0x41 && c <= 0x5A // a-z
1510
- || c >= 0x61 && c <= 0x7A // A-Z
1511
- || format === formats.RFC1738 && (c === 0x28 || c === 0x29) // ( )
1512
- ) {
1513
- out += string.charAt(i);
1514
- continue;
1515
- }
1516
-
1517
- if (c < 0x80) {
1518
- out = out + hexTable[c];
1519
- continue;
1520
- }
1521
-
1522
- if (c < 0x800) {
1523
- out = out + (hexTable[0xC0 | c >> 6] + hexTable[0x80 | c & 0x3F]);
1524
- continue;
1525
- }
1526
-
1527
- if (c < 0xD800 || c >= 0xE000) {
1528
- out = out + (hexTable[0xE0 | c >> 12] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | c & 0x3F]);
1529
- continue;
1530
- }
1531
-
1532
- i += 1;
1533
- c = 0x10000 + ((c & 0x3FF) << 10 | string.charCodeAt(i) & 0x3FF);
1534
- out += hexTable[0xF0 | c >> 18] + hexTable[0x80 | c >> 12 & 0x3F] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | c & 0x3F];
1535
- }
1536
-
1537
- return out;
1538
- };
1539
-
1540
- var compact = function compact(value) {
1541
- var queue = [{
1542
- obj: {
1543
- o: value
1544
- },
1545
- prop: 'o'
1546
- }];
1547
- var refs = [];
1548
-
1549
- for (var i = 0; i < queue.length; ++i) {
1550
- var item = queue[i];
1551
- var obj = item.obj[item.prop];
1552
- var keys = Object.keys(obj);
1553
-
1554
- for (var j = 0; j < keys.length; ++j) {
1555
- var key = keys[j];
1556
- var val = obj[key];
1557
-
1558
- if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
1559
- queue.push({
1560
- obj: obj,
1561
- prop: key
1562
- });
1563
- refs.push(val);
1564
- }
1565
- }
1566
- }
1567
-
1568
- compactQueue(queue);
1569
- return value;
1570
- };
1571
-
1572
- var isRegExp$1 = function isRegExp(obj) {
1573
- return Object.prototype.toString.call(obj) === '[object RegExp]';
1574
- };
1575
-
1576
- var isBuffer = function isBuffer(obj) {
1577
- if (!obj || typeof obj !== 'object') {
1578
- return false;
1579
- }
1580
-
1581
- return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
1582
- };
1583
-
1584
- var combine = function combine(a, b) {
1585
- return [].concat(a, b);
1586
- };
1587
-
1588
- var maybeMap = function maybeMap(val, fn) {
1589
- if (isArray$1(val)) {
1590
- var mapped = [];
1591
-
1592
- for (var i = 0; i < val.length; i += 1) {
1593
- mapped.push(fn(val[i]));
1594
- }
1595
-
1596
- return mapped;
1597
- }
1598
-
1599
- return fn(val);
1600
- };
1601
-
1602
- var utils = {
1603
- arrayToObject: arrayToObject,
1604
- assign: assign,
1605
- combine: combine,
1606
- compact: compact,
1607
- decode: decode,
1608
- encode: encode,
1609
- isBuffer: isBuffer,
1610
- isRegExp: isRegExp$1,
1611
- maybeMap: maybeMap,
1612
- merge: merge
1613
- };
1614
-
1615
- var has$2 = Object.prototype.hasOwnProperty;
1616
- var arrayPrefixGenerators = {
1617
- brackets: function brackets(prefix) {
1618
- return prefix + '[]';
1619
- },
1620
- comma: 'comma',
1621
- indices: function indices(prefix, key) {
1622
- return prefix + '[' + key + ']';
1623
- },
1624
- repeat: function repeat(prefix) {
1625
- return prefix;
1626
- }
1627
- };
1628
- var isArray$2 = Array.isArray;
1629
- var push = Array.prototype.push;
1630
-
1631
- var pushToArray = function (arr, valueOrArray) {
1632
- push.apply(arr, isArray$2(valueOrArray) ? valueOrArray : [valueOrArray]);
1633
- };
1634
-
1635
- var toISO = Date.prototype.toISOString;
1636
- var defaultFormat = formats['default'];
1637
- var defaults = {
1638
- addQueryPrefix: false,
1639
- allowDots: false,
1640
- charset: 'utf-8',
1641
- charsetSentinel: false,
1642
- delimiter: '&',
1643
- encode: true,
1644
- encoder: utils.encode,
1645
- encodeValuesOnly: false,
1646
- format: defaultFormat,
1647
- formatter: formats.formatters[defaultFormat],
1648
- // deprecated
1649
- indices: false,
1650
- serializeDate: function serializeDate(date) {
1651
- return toISO.call(date);
1652
- },
1653
- skipNulls: false,
1654
- strictNullHandling: false
1655
- };
1656
-
1657
- var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
1658
- return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || typeof v === 'symbol' || typeof v === 'bigint';
1659
- };
1660
-
1661
- var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel$1) {
1662
- var obj = object;
1663
-
1664
- if (sideChannel$1.has(object)) {
1665
- throw new RangeError('Cyclic object value');
1666
- }
1667
-
1668
- if (typeof filter === 'function') {
1669
- obj = filter(prefix, obj);
1670
- } else if (obj instanceof Date) {
1671
- obj = serializeDate(obj);
1672
- } else if (generateArrayPrefix === 'comma' && isArray$2(obj)) {
1673
- obj = utils.maybeMap(obj, function (value) {
1674
- if (value instanceof Date) {
1675
- return serializeDate(value);
1676
- }
1677
-
1678
- return value;
1679
- });
1680
- }
1681
-
1682
- if (obj === null) {
1683
- if (strictNullHandling) {
1684
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
1685
- }
1686
-
1687
- obj = '';
1688
- }
1689
-
1690
- if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
1691
- if (encoder) {
1692
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
1693
- return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
1694
- }
1695
-
1696
- return [formatter(prefix) + '=' + formatter(String(obj))];
1697
- }
1698
-
1699
- var values = [];
1700
-
1701
- if (typeof obj === 'undefined') {
1702
- return values;
1703
- }
1704
-
1705
- var objKeys;
1706
-
1707
- if (generateArrayPrefix === 'comma' && isArray$2(obj)) {
1708
- // we need to join elements in
1709
- objKeys = [{
1710
- value: obj.length > 0 ? obj.join(',') || null : undefined
1711
- }];
1712
- } else if (isArray$2(filter)) {
1713
- objKeys = filter;
1714
- } else {
1715
- var keys = Object.keys(obj);
1716
- objKeys = sort ? keys.sort(sort) : keys;
1717
- }
1718
-
1719
- for (var i = 0; i < objKeys.length; ++i) {
1720
- var key = objKeys[i];
1721
- var value = typeof key === 'object' && key.value !== undefined ? key.value : obj[key];
1722
-
1723
- if (skipNulls && value === null) {
1724
- continue;
1725
- }
1726
-
1727
- var keyPrefix = isArray$2(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix : prefix + (allowDots ? '.' + key : '[' + key + ']');
1728
- sideChannel$1.set(object, true);
1729
- var valueSideChannel = sideChannel();
1730
- pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
1731
- }
1732
-
1733
- return values;
1734
- };
1735
-
1736
- var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
1737
- if (!opts) {
1738
- return defaults;
1739
- }
1740
-
1741
- if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
1742
- throw new TypeError('Encoder has to be a function.');
1743
- }
1744
-
1745
- var charset = opts.charset || defaults.charset;
1746
-
1747
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
1748
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
1749
- }
1750
-
1751
- var format = formats['default'];
1752
-
1753
- if (typeof opts.format !== 'undefined') {
1754
- if (!has$2.call(formats.formatters, opts.format)) {
1755
- throw new TypeError('Unknown format option provided.');
1756
- }
1757
-
1758
- format = opts.format;
1759
- }
1760
-
1761
- var formatter = formats.formatters[format];
1762
- var filter = defaults.filter;
1763
-
1764
- if (typeof opts.filter === 'function' || isArray$2(opts.filter)) {
1765
- filter = opts.filter;
1766
- }
1767
-
1768
- return {
1769
- addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
1770
- allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
1771
- charset: charset,
1772
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
1773
- delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
1774
- encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
1775
- encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
1776
- encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
1777
- filter: filter,
1778
- format: format,
1779
- formatter: formatter,
1780
- serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
1781
- skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
1782
- sort: typeof opts.sort === 'function' ? opts.sort : null,
1783
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
1784
- };
1785
- };
1786
-
1787
- var stringify_1 = function (object, opts) {
1788
- var obj = object;
1789
- var options = normalizeStringifyOptions(opts);
1790
- var objKeys;
1791
- var filter;
1792
-
1793
- if (typeof options.filter === 'function') {
1794
- filter = options.filter;
1795
- obj = filter('', obj);
1796
- } else if (isArray$2(options.filter)) {
1797
- filter = options.filter;
1798
- objKeys = filter;
1799
- }
1800
-
1801
- var keys = [];
1802
-
1803
- if (typeof obj !== 'object' || obj === null) {
1804
- return '';
1805
- }
1806
-
1807
- var arrayFormat;
1808
-
1809
- if (opts && opts.arrayFormat in arrayPrefixGenerators) {
1810
- arrayFormat = opts.arrayFormat;
1811
- } else if (opts && 'indices' in opts) {
1812
- arrayFormat = opts.indices ? 'indices' : 'repeat';
1813
- } else {
1814
- arrayFormat = 'indices';
1815
- }
1816
-
1817
- var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
1818
-
1819
- if (!objKeys) {
1820
- objKeys = Object.keys(obj);
1821
- }
1822
-
1823
- if (options.sort) {
1824
- objKeys.sort(options.sort);
1825
- }
1826
-
1827
- var sideChannel$1 = sideChannel();
1828
-
1829
- for (var i = 0; i < objKeys.length; ++i) {
1830
- var key = objKeys[i];
1831
-
1832
- if (options.skipNulls && obj[key] === null) {
1833
- continue;
1834
- }
1835
-
1836
- pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, options.strictNullHandling, options.skipNulls, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel$1));
1837
- }
1838
-
1839
- var joined = keys.join(options.delimiter);
1840
- var prefix = options.addQueryPrefix === true ? '?' : '';
1841
-
1842
- if (options.charsetSentinel) {
1843
- if (options.charset === 'iso-8859-1') {
1844
- // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
1845
- prefix += 'utf8=%26%2310003%3B&';
1846
- } else {
1847
- // encodeURIComponent('✓')
1848
- prefix += 'utf8=%E2%9C%93&';
1849
- }
1850
- }
1851
-
1852
- return joined.length > 0 ? prefix + joined : '';
1853
- };
1854
-
1855
- var has$3 = Object.prototype.hasOwnProperty;
1856
- var isArray$3 = Array.isArray;
1857
- var defaults$1 = {
1858
- allowDots: false,
1859
- allowPrototypes: false,
1860
- allowSparse: false,
1861
- arrayLimit: 20,
1862
- charset: 'utf-8',
1863
- charsetSentinel: false,
1864
- comma: false,
1865
- decoder: utils.decode,
1866
- delimiter: '&',
1867
- depth: 5,
1868
- ignoreQueryPrefix: false,
1869
- interpretNumericEntities: false,
1870
- parameterLimit: 1000,
1871
- parseArrays: true,
1872
- plainObjects: false,
1873
- strictNullHandling: false
1874
- };
1875
-
1876
- var interpretNumericEntities = function (str) {
1877
- return str.replace(/&#(\d+);/g, function ($0, numberStr) {
1878
- return String.fromCharCode(parseInt(numberStr, 10));
1879
- });
1880
- };
1881
-
1882
- var parseArrayValue = function (val, options) {
1883
- if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
1884
- return val.split(',');
1885
- }
1886
-
1887
- return val;
1888
- }; // This is what browsers will submit when the ✓ character occurs in an
1889
- // application/x-www-form-urlencoded body and the encoding of the page containing
1890
- // the form is iso-8859-1, or when the submitted form has an accept-charset
1891
- // attribute of iso-8859-1. Presumably also with other charsets that do not contain
1892
- // the ✓ character, such as us-ascii.
1893
-
1894
-
1895
- var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
1896
- // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
1897
-
1898
- var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
1899
-
1900
- var parseValues = function parseQueryStringValues(str, options) {
1901
- var obj = {};
1902
- var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
1903
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
1904
- var parts = cleanStr.split(options.delimiter, limit);
1905
- var skipIndex = -1; // Keep track of where the utf8 sentinel was found
1906
-
1907
- var i;
1908
- var charset = options.charset;
1909
-
1910
- if (options.charsetSentinel) {
1911
- for (i = 0; i < parts.length; ++i) {
1912
- if (parts[i].indexOf('utf8=') === 0) {
1913
- if (parts[i] === charsetSentinel) {
1914
- charset = 'utf-8';
1915
- } else if (parts[i] === isoSentinel) {
1916
- charset = 'iso-8859-1';
1917
- }
1918
-
1919
- skipIndex = i;
1920
- i = parts.length; // The eslint settings do not allow break;
1921
- }
1922
- }
1923
- }
1924
-
1925
- for (i = 0; i < parts.length; ++i) {
1926
- if (i === skipIndex) {
1927
- continue;
1928
- }
1929
-
1930
- var part = parts[i];
1931
- var bracketEqualsPos = part.indexOf(']=');
1932
- var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
1933
- var key, val;
1934
-
1935
- if (pos === -1) {
1936
- key = options.decoder(part, defaults$1.decoder, charset, 'key');
1937
- val = options.strictNullHandling ? null : '';
1938
- } else {
1939
- key = options.decoder(part.slice(0, pos), defaults$1.decoder, charset, 'key');
1940
- val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options), function (encodedVal) {
1941
- return options.decoder(encodedVal, defaults$1.decoder, charset, 'value');
1942
- });
1943
- }
1944
-
1945
- if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
1946
- val = interpretNumericEntities(val);
1947
- }
1948
-
1949
- if (part.indexOf('[]=') > -1) {
1950
- val = isArray$3(val) ? [val] : val;
1951
- }
1952
-
1953
- if (has$3.call(obj, key)) {
1954
- obj[key] = utils.combine(obj[key], val);
1955
- } else {
1956
- obj[key] = val;
1957
- }
1958
- }
1959
-
1960
- return obj;
1961
- };
1962
-
1963
- var parseObject = function (chain, val, options, valuesParsed) {
1964
- var leaf = valuesParsed ? val : parseArrayValue(val, options);
1965
-
1966
- for (var i = chain.length - 1; i >= 0; --i) {
1967
- var obj;
1968
- var root = chain[i];
1969
-
1970
- if (root === '[]' && options.parseArrays) {
1971
- obj = [].concat(leaf);
1972
- } else {
1973
- obj = options.plainObjects ? Object.create(null) : {};
1974
- var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
1975
- var index = parseInt(cleanRoot, 10);
1976
-
1977
- if (!options.parseArrays && cleanRoot === '') {
1978
- obj = {
1979
- 0: leaf
1980
- };
1981
- } else if (!isNaN(index) && root !== cleanRoot && String(index) === cleanRoot && index >= 0 && options.parseArrays && index <= options.arrayLimit) {
1982
- obj = [];
1983
- obj[index] = leaf;
1984
- } else {
1985
- obj[cleanRoot] = leaf;
1986
- }
1987
- }
1988
-
1989
- leaf = obj;
1990
- }
1991
-
1992
- return leaf;
1993
- };
1994
-
1995
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
1996
- if (!givenKey) {
1997
- return;
1998
- } // Transform dot notation to bracket notation
1999
-
2000
-
2001
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; // The regex chunks
2002
-
2003
- var brackets = /(\[[^[\]]*])/;
2004
- var child = /(\[[^[\]]*])/g; // Get the parent
2005
-
2006
- var segment = options.depth > 0 && brackets.exec(key);
2007
- var parent = segment ? key.slice(0, segment.index) : key; // Stash the parent if it exists
2008
-
2009
- var keys = [];
2010
-
2011
- if (parent) {
2012
- // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
2013
- if (!options.plainObjects && has$3.call(Object.prototype, parent)) {
2014
- if (!options.allowPrototypes) {
2015
- return;
2016
- }
2017
- }
2018
-
2019
- keys.push(parent);
2020
- } // Loop through children appending to the array until we hit depth
2021
-
2022
-
2023
- var i = 0;
2024
-
2025
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
2026
- i += 1;
2027
-
2028
- if (!options.plainObjects && has$3.call(Object.prototype, segment[1].slice(1, -1))) {
2029
- if (!options.allowPrototypes) {
2030
- return;
2031
- }
2032
- }
2033
-
2034
- keys.push(segment[1]);
2035
- } // If there's a remainder, just add whatever is left
2036
-
2037
-
2038
- if (segment) {
2039
- keys.push('[' + key.slice(segment.index) + ']');
2040
- }
2041
-
2042
- return parseObject(keys, val, options, valuesParsed);
2043
- };
2044
-
2045
- var normalizeParseOptions = function normalizeParseOptions(opts) {
2046
- if (!opts) {
2047
- return defaults$1;
2048
- }
2049
-
2050
- if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
2051
- throw new TypeError('Decoder has to be a function.');
2052
- }
2053
-
2054
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2055
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2056
- }
2057
-
2058
- var charset = typeof opts.charset === 'undefined' ? defaults$1.charset : opts.charset;
2059
- return {
2060
- allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
2061
- allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults$1.allowPrototypes,
2062
- allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults$1.allowSparse,
2063
- arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults$1.arrayLimit,
2064
- charset: charset,
2065
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
2066
- comma: typeof opts.comma === 'boolean' ? opts.comma : defaults$1.comma,
2067
- decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults$1.decoder,
2068
- delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults$1.delimiter,
2069
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
2070
- depth: typeof opts.depth === 'number' || opts.depth === false ? +opts.depth : defaults$1.depth,
2071
- ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
2072
- interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults$1.interpretNumericEntities,
2073
- parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults$1.parameterLimit,
2074
- parseArrays: opts.parseArrays !== false,
2075
- plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults$1.plainObjects,
2076
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
2077
- };
2078
- };
2079
-
2080
- var parse = function (str, opts) {
2081
- var options = normalizeParseOptions(opts);
2082
-
2083
- if (str === '' || str === null || typeof str === 'undefined') {
2084
- return options.plainObjects ? Object.create(null) : {};
2085
- }
2086
-
2087
- var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
2088
- var obj = options.plainObjects ? Object.create(null) : {}; // Iterate over the keys and setup the new object
2089
-
2090
- var keys = Object.keys(tempObj);
2091
-
2092
- for (var i = 0; i < keys.length; ++i) {
2093
- var key = keys[i];
2094
- var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
2095
- obj = utils.merge(obj, newObj, options);
2096
- }
2097
-
2098
- if (options.allowSparse === true) {
2099
- return obj;
2100
- }
2101
-
2102
- return utils.compact(obj);
2103
- };
2104
-
2105
- var lib = {
2106
- formats: formats,
2107
- parse: parse,
2108
- stringify: stringify_1
2109
- };
2110
-
2111
- function createHttpFunction(baseUrl, version) {
2112
- var baseURL = baseUrl + "/" + version;
2113
- return Axios.create({
2114
- baseURL: baseURL,
2115
- headers: { Pragma: 'no-cache' },
2116
- paramsSerializer: function (params) { return lib.stringify(params, { arrayFormat: 'repeat' }); }
2117
- });
2118
- }
2119
-
2120
- var arrayLikeToArray = createCommonjsModule(function (module) {
2121
- function _arrayLikeToArray(arr, len) {
2122
- if (len == null || len > arr.length) len = arr.length;
2123
-
2124
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
2125
- arr2[i] = arr[i];
2126
- }
2127
-
2128
- return arr2;
2129
- }
2130
-
2131
- module.exports = _arrayLikeToArray;
2132
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2133
- });
2134
- unwrapExports(arrayLikeToArray);
2135
-
2136
- var arrayWithoutHoles = createCommonjsModule(function (module) {
2137
- function _arrayWithoutHoles(arr) {
2138
- if (Array.isArray(arr)) return arrayLikeToArray(arr);
2139
- }
2140
-
2141
- module.exports = _arrayWithoutHoles;
2142
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2143
- });
2144
- unwrapExports(arrayWithoutHoles);
2145
-
2146
- var iterableToArray = createCommonjsModule(function (module) {
2147
- function _iterableToArray(iter) {
2148
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2149
- }
2150
-
2151
- module.exports = _iterableToArray;
2152
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2153
- });
2154
- unwrapExports(iterableToArray);
2155
-
2156
- var unsupportedIterableToArray = createCommonjsModule(function (module) {
2157
- function _unsupportedIterableToArray(o, minLen) {
2158
- if (!o) return;
2159
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
2160
- var n = Object.prototype.toString.call(o).slice(8, -1);
2161
- if (n === "Object" && o.constructor) n = o.constructor.name;
2162
- if (n === "Map" || n === "Set") return Array.from(o);
2163
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
2164
- }
2165
-
2166
- module.exports = _unsupportedIterableToArray;
2167
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2168
- });
2169
- unwrapExports(unsupportedIterableToArray);
2170
-
2171
- var nonIterableSpread = createCommonjsModule(function (module) {
2172
- function _nonIterableSpread() {
2173
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2174
- }
2175
-
2176
- module.exports = _nonIterableSpread;
2177
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2178
- });
2179
- unwrapExports(nonIterableSpread);
2180
-
2181
- var toConsumableArray = createCommonjsModule(function (module) {
2182
- function _toConsumableArray(arr) {
2183
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
2184
- }
2185
-
2186
- module.exports = _toConsumableArray;
2187
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2188
- });
2189
- var _toConsumableArray = unwrapExports(toConsumableArray);
2190
-
2191
- var arrayWithHoles = createCommonjsModule(function (module) {
2192
- function _arrayWithHoles(arr) {
2193
- if (Array.isArray(arr)) return arr;
2194
- }
2195
-
2196
- module.exports = _arrayWithHoles;
2197
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2198
- });
2199
- unwrapExports(arrayWithHoles);
2200
-
2201
- var iterableToArrayLimit = createCommonjsModule(function (module) {
2202
- function _iterableToArrayLimit(arr, i) {
2203
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2204
-
2205
- if (_i == null) return;
2206
- var _arr = [];
2207
- var _n = true;
2208
- var _d = false;
2209
-
2210
- var _s, _e;
2211
-
2212
- try {
2213
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
2214
- _arr.push(_s.value);
2215
-
2216
- if (i && _arr.length === i) break;
2217
- }
2218
- } catch (err) {
2219
- _d = true;
2220
- _e = err;
2221
- } finally {
2222
- try {
2223
- if (!_n && _i["return"] != null) _i["return"]();
2224
- } finally {
2225
- if (_d) throw _e;
2226
- }
2227
- }
2228
-
2229
- return _arr;
2230
- }
2231
-
2232
- module.exports = _iterableToArrayLimit;
2233
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2234
- });
2235
- unwrapExports(iterableToArrayLimit);
2236
-
2237
- var nonIterableRest = createCommonjsModule(function (module) {
2238
- function _nonIterableRest() {
2239
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2240
- }
2241
-
2242
- module.exports = _nonIterableRest;
2243
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2244
- });
2245
- unwrapExports(nonIterableRest);
2246
-
2247
- var slicedToArray = createCommonjsModule(function (module) {
2248
- function _slicedToArray(arr, i) {
2249
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
2250
- }
2251
-
2252
- module.exports = _slicedToArray;
2253
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2254
- });
2255
- var _slicedToArray = unwrapExports(slicedToArray);
2256
-
2257
- /**
2258
- * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
2259
- */
2260
- /**
2261
- * Lower case as a function.
2262
- */
2263
-
2264
- function lowerCase(str) {
2265
- return str.toLowerCase();
2266
- }
2267
-
2268
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters.
2269
-
2270
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
2271
- /**
2272
- * Normalize the string into something other libraries can manipulate easier.
2273
- */
2274
-
2275
- function noCase(input, options) {
2276
- if (options === void 0) {
2277
- options = {};
2278
- }
2279
-
2280
- var _a = options.splitRegexp,
2281
- splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a,
2282
- _b = options.stripRegexp,
2283
- stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b,
2284
- _c = options.transform,
2285
- transform = _c === void 0 ? lowerCase : _c,
2286
- _d = options.delimiter,
2287
- delimiter = _d === void 0 ? " " : _d;
2288
- var result = replace$1(replace$1(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
2289
- var start = 0;
2290
- var end = result.length; // Trim the delimiter from around the output string.
2291
-
2292
- while (result.charAt(start) === "\0") start++;
2293
-
2294
- while (result.charAt(end - 1) === "\0") end--; // Transform each token independently.
2295
-
2296
-
2297
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
2298
- }
2299
- /**
2300
- * Replace `re` in the input string with the replacement value.
2301
- */
2302
-
2303
- function replace$1(input, re, value) {
2304
- if (re instanceof RegExp) return input.replace(re, value);
2305
- return re.reduce(function (input, re) {
2306
- return input.replace(re, value);
2307
- }, input);
2308
- }
2309
-
2310
- /**
2311
- * Upper case the first character of an input string.
2312
- */
2313
- function upperCaseFirst(input) {
2314
- return input.charAt(0).toUpperCase() + input.substr(1);
2315
- }
2316
-
2317
- function capitalCaseTransform(input) {
2318
- return upperCaseFirst(input.toLowerCase());
2319
- }
2320
- function capitalCase(input, options) {
2321
- if (options === void 0) {
2322
- options = {};
2323
- }
2324
-
2325
- return noCase(input, __assign({
2326
- delimiter: " ",
2327
- transform: capitalCaseTransform
2328
- }, options));
2329
- }
2330
-
2331
- function headerCase(input, options) {
2332
- if (options === void 0) {
2333
- options = {};
2334
- }
2335
-
2336
- return capitalCase(input, __assign({
2337
- delimiter: "-"
2338
- }, options));
2339
- }
2340
-
2341
- function pascalCaseTransform(input, index) {
2342
- var firstChar = input.charAt(0);
2343
- var lowerChars = input.substr(1).toLowerCase();
2344
-
2345
- if (index > 0 && firstChar >= "0" && firstChar <= "9") {
2346
- return "_" + firstChar + lowerChars;
2347
- }
2348
-
2349
- return "" + firstChar.toUpperCase() + lowerChars;
2350
- }
2351
- function pascalCase(input, options) {
2352
- if (options === void 0) {
2353
- options = {};
2354
- }
2355
-
2356
- return noCase(input, __assign({
2357
- delimiter: "",
2358
- transform: pascalCaseTransform
2359
- }, options));
2360
- }
2361
-
2362
- function camelCaseTransform(input, index) {
2363
- if (index === 0) return input.toLowerCase();
2364
- return pascalCaseTransform(input, index);
2365
- }
2366
- function camelCase(input, options) {
2367
- if (options === void 0) {
2368
- options = {};
2369
- }
2370
-
2371
- return pascalCase(input, __assign({
2372
- transform: camelCaseTransform
2373
- }, options));
2374
- }
2375
-
2376
- function dotCase(input, options) {
2377
- if (options === void 0) {
2378
- options = {};
2379
- }
2380
-
2381
- return noCase(input, __assign({
2382
- delimiter: "."
2383
- }, options));
2384
- }
2385
-
2386
- function snakeCase(input, options) {
2387
- if (options === void 0) {
2388
- options = {};
2389
- }
2390
-
2391
- return dotCase(input, __assign({
2392
- delimiter: "_"
2393
- }, options));
2394
- }
2395
-
2396
- var _typeof_1 = createCommonjsModule(function (module) {
2397
- function _typeof(obj) {
2398
- "@babel/helpers - typeof";
2399
-
2400
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2401
- module.exports = _typeof = function _typeof(obj) {
2402
- return typeof obj;
2403
- };
2404
-
2405
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2406
- } else {
2407
- module.exports = _typeof = function _typeof(obj) {
2408
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2409
- };
2410
-
2411
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2412
- }
2413
-
2414
- return _typeof(obj);
2415
- }
2416
-
2417
- module.exports = _typeof;
2418
- module.exports["default"] = module.exports, module.exports.__esModule = true;
2419
- });
2420
-
2421
- var _typeof = unwrapExports(_typeof_1);
2422
-
2423
- var isURLSearchParams = function isURLSearchParams(value) {
2424
- return typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams;
2425
- };
2426
- var isFormData = function isFormData(value) {
2427
- return typeof FormData !== 'undefined' && value instanceof FormData;
2428
- };
2429
- var isPlainObject = function isPlainObject(value) {
2430
- return _typeof(value) === 'object' && value !== null && Object.prototype.toString.call(value) === '[object Object]';
2431
- };
2432
-
2433
- var transform = function transform(data, fn) {
2434
- var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2435
-
2436
- if (!Array.isArray(data) && !isPlainObject(data) && !isFormData(data) && !isURLSearchParams(data)) {
2437
- return data;
2438
- }
2439
- /* eslint-disable no-console */
2440
-
2441
-
2442
- if (isFormData(data) && !data.entries) {
2443
- if (navigator.product === 'ReactNative') {
2444
- console.warn('Be careful that FormData cannot be transformed on React Native. If you intentionally implemented, ignore this kind of warning: https://facebook.github.io/react-native/docs/debugging.html');
2445
- } else {
2446
- console.warn('You must use polyfill of FormData.prototype.entries() on Internet Explorer or Safari: https://github.com/jimmywarting/FormData');
2447
- }
2448
-
2449
- return data;
2450
- }
2451
- /* eslint-enable no-console */
2452
-
2453
-
2454
- var prototype = Object.getPrototypeOf(data);
2455
- var store = overwrite ? data : prototype ? new prototype.constructor() : Object.create(null);
2456
- var _iteratorNormalCompletion = true;
2457
- var _didIteratorError = false;
2458
- var _iteratorError = undefined;
2459
-
2460
- try {
2461
- for (var _iterator = (prototype && prototype.entries ? prototype.entries.call(data) : Object.entries(data))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2462
- var _step$value = _slicedToArray(_step.value, 2),
2463
- key = _step$value[0],
2464
- value = _step$value[1];
2465
-
2466
- if (prototype && prototype.append) {
2467
- prototype.append.call(store, key.replace(/[^[\]]+/g, function (k) {
2468
- return fn(k);
2469
- }), transform(value, fn));
2470
- } else if (key !== '__proto__') {
2471
- store[fn(typeof key === 'string' ? key : "".concat(key))] = transform(value, fn);
2472
- }
2473
- }
2474
- } catch (err) {
2475
- _didIteratorError = true;
2476
- _iteratorError = err;
2477
- } finally {
2478
- try {
2479
- if (!_iteratorNormalCompletion && _iterator["return"] != null) {
2480
- _iterator["return"]();
2481
- }
2482
- } finally {
2483
- if (_didIteratorError) {
2484
- throw _iteratorError;
2485
- }
2486
- }
2487
- }
2488
-
2489
- return store;
2490
- };
2491
-
2492
- var createTransform = function createTransform(fn) {
2493
- return function (data) {
2494
- var overwrite = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2495
- return transform(data, fn, overwrite);
2496
- };
2497
- };
2498
- var snake = createTransform(snakeCase);
2499
- var camel = createTransform(camelCase);
2500
- var header = createTransform(headerCase);
2501
-
2502
- var snakeParams = function snakeParams(config) {
2503
- if (config.params) {
2504
- config.params = snake(config.params);
2505
- }
2506
-
2507
- return config;
2508
- };
2509
- var snakeRequest = function snakeRequest(data, headers) {
2510
- for (var _i = 0, _Object$entries = Object.entries(headers); _i < _Object$entries.length; _i++) {
2511
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
2512
- key = _Object$entries$_i[0],
2513
- value = _Object$entries$_i[1];
2514
-
2515
- header(value, true);
2516
-
2517
- if (!['common', 'delete', 'get', 'head', 'post', 'put', 'patch'].includes(key)) {
2518
- delete headers[key];
2519
- headers[headerCase(key)] = value;
2520
- }
2521
- }
2522
-
2523
- return snake(data);
2524
- };
2525
- var camelResponse = function camelResponse(data, headers) {
2526
- camel(headers, true);
2527
- return camel(data);
2528
- };
2529
-
2530
- var applyConverters = function applyConverters(axios) {
2531
- axios.defaults.transformRequest = [snakeRequest].concat(_toConsumableArray(axios.defaults.transformRequest));
2532
- axios.defaults.transformResponse = [].concat(_toConsumableArray(axios.defaults.transformResponse), [camelResponse]);
2533
- axios.interceptors.request.use(snakeParams);
2534
- return axios;
2535
- };
2536
-
2537
- var AsyncSurveyServiceImpl = /** @class */ (function () {
2538
- function AsyncSurveyServiceImpl(options) {
2539
- this.http = applyConverters(createHttpFunction(options.baseUrl, options.version));
2540
- if (options.httpDecorator) {
2541
- this.http = options.httpDecorator(this.http);
2542
- }
2543
- this.exhttp = createHttpFunction("", "");
2544
- }
2545
- AsyncSurveyServiceImpl.prototype.loadTemplate = function (id) {
2546
- return this.http
2547
- .get("/templates/" + id)
2548
- .then(function (response) { return response.data; });
2549
- };
2550
- AsyncSurveyServiceImpl.prototype.loadTemplates = function (params) {
2551
- return this.http
2552
- .get("/templates", { params: params })
2553
- .then(function (response) { return response.data; });
2554
- };
2555
- AsyncSurveyServiceImpl.prototype.createTemplate = function (survey) {
2556
- return this.http
2557
- .post("/templates", survey)
2558
- .then(function (response) { return response.data; });
2559
- };
2560
- AsyncSurveyServiceImpl.prototype.updateTemplate = function (survey) {
2561
- return this.http
2562
- .put("/templates", survey)
2563
- .then(function (response) { return response.data; });
2564
- };
2565
- AsyncSurveyServiceImpl.prototype.deleteTemplate = function (id) {
2566
- return this.http.delete("/templates/" + id);
2567
- };
2568
- AsyncSurveyServiceImpl.prototype.loadSurvey = function (id) {
2569
- return this.http.get("/surveys/" + id).then(function (response) { return response.data; });
2570
- };
2571
- AsyncSurveyServiceImpl.prototype.loadSurveys = function (params) {
2572
- return this.http
2573
- .get("/surveys", { params: params })
2574
- .then(function (response) { return response.data; });
2575
- };
2576
- AsyncSurveyServiceImpl.prototype.createSurvey = function (survey) {
2577
- return this.http
2578
- .post("/surveys", survey)
2579
- .then(function (response) { return response.data; });
2580
- };
2581
- AsyncSurveyServiceImpl.prototype.updateSurvey = function (survey) {
2582
- return this.http
2583
- .put("/surveys", survey)
2584
- .then(function (response) { return response.data; });
2585
- };
2586
- AsyncSurveyServiceImpl.prototype.deleteSurvey = function (id) {
2587
- return this.http.delete("/surveys/" + id);
2588
- };
2589
- AsyncSurveyServiceImpl.prototype.createQuestion = function (surveyId, question) {
2590
- return this.http
2591
- .post("/templates/" + surveyId + "/question", question)
2592
- .then(function (response) { return response.data; });
2593
- };
2594
- AsyncSurveyServiceImpl.prototype.createQuestions = function (surveyId, questions) {
2595
- return this.http
2596
- .post("/templates/" + surveyId + "/questions", questions)
2597
- .then(function (response) { return response.data; });
2598
- };
2599
- AsyncSurveyServiceImpl.prototype.updateQuestion = function (surveyId, question) {
2600
- return this.http
2601
- .put("/templates/" + surveyId + "/questions/" + question.id, question)
2602
- .then(function (response) { return response.data; });
2603
- };
2604
- AsyncSurveyServiceImpl.prototype.updateQuestionsOptions = function (surveyId, questions) {
2605
- return this.http
2606
- .put("/surveys/" + surveyId + "/questions/options", questions)
2607
- .then(function (response) { return response.data; });
2608
- };
2609
- AsyncSurveyServiceImpl.prototype.moveQuestion = function (surveyId, questionId, index) {
2610
- return Promise.resolve(this.http.put("/templates/" + surveyId + "/questions/" + questionId + "/move", { index: index }));
2611
- };
2612
- AsyncSurveyServiceImpl.prototype.deleteQuestion = function (surveyId, questionId) {
2613
- return Promise.resolve(this.http.delete("/templates/" + surveyId + "/questions/" + questionId));
2614
- };
2615
- AsyncSurveyServiceImpl.prototype.loadResponse = function (id) {
2616
- return this.http
2617
- .get("/responses/" + id)
2618
- .then(function (response) { return response.data; });
2619
- };
2620
- AsyncSurveyServiceImpl.prototype.dispatchResponse = function (surveyId, response) {
2621
- return this.http
2622
- .post("/surveys/" + surveyId + "/responses", response)
2623
- .then(function (response) { return response.data; });
2624
- };
2625
- AsyncSurveyServiceImpl.prototype.updateResponse = function (response) {
2626
- return this.http
2627
- .put("/responses/" + response.id, response)
2628
- .then(function (response) { return response.data; });
2629
- };
2630
- AsyncSurveyServiceImpl.prototype.loadMyPlans = function (params) {
2631
- return this.http
2632
- .get("/plans/me", { params: params })
2633
- .then(function (response) { return response.data; });
2634
- };
2635
- AsyncSurveyServiceImpl.prototype.loadPlans = function (params) {
2636
- return this.http
2637
- .get("/plans", { params: params })
2638
- .then(function (response) { return response.data; });
2639
- };
2640
- AsyncSurveyServiceImpl.prototype.loadPlanById = function (planId, params) {
2641
- return this.http
2642
- .get("/plan/" + planId, { params: params })
2643
- .then(function (response) { return response.data; });
2644
- };
2645
- AsyncSurveyServiceImpl.prototype.loadPlanWithFiltersById = function (planId, PlanStatisticsModel) {
2646
- return this.http
2647
- .post("/plan/" + planId, __assign({}, PlanStatisticsModel))
2648
- .then(function (response) { return response.data; });
2649
- };
2650
- AsyncSurveyServiceImpl.prototype.loadPlanWithFiltersByIdAndTargetId = function (planId, targetId, PlanStatisticsModel) {
2651
- return this.http
2652
- .post("/plan/" + planId + "/targets/" + targetId, __assign({}, PlanStatisticsModel))
2653
- .then(function (response) { return response.data; });
2654
- };
2655
- AsyncSurveyServiceImpl.prototype.createPlan = function (plan) {
2656
- return this.http.post("/plans", plan).then(function (response) { return response.data; });
2657
- };
2658
- AsyncSurveyServiceImpl.prototype.updatePlan = function (plan) {
2659
- return this.http.put("/plans", plan).then(function (response) { return response.data; });
2660
- };
2661
- AsyncSurveyServiceImpl.prototype.deletePlan = function (id) {
2662
- return this.http.delete("/plans/" + id);
2663
- };
2664
- AsyncSurveyServiceImpl.prototype.dispatchResponses = function (surveyId, respondentId, targets) {
2665
- return this.http.post("/surveys/" + surveyId + "/respondents/" + respondentId + "/responses", { targets: targets });
2666
- };
2667
- AsyncSurveyServiceImpl.prototype.loadResponses = function (params) {
2668
- return this.http
2669
- .get("/responses", { params: params })
2670
- .then(function (response) { return response.data; });
2671
- };
2672
- AsyncSurveyServiceImpl.prototype.loadResponsesPost = function (data) {
2673
- return this.http
2674
- .post("/responses", __assign({}, data))
2675
- .then(function (response) { return response.data; });
2676
- };
2677
- AsyncSurveyServiceImpl.prototype.loadStatisticsByAll = function (surveyId, statistics) {
2678
- return this.http.get("/statistics/" + surveyId, { params: __assign(__assign({}, statistics), { statisticsBy: 'ALL' }) })
2679
- .then(function (response) { return response.data; });
2680
- };
2681
- AsyncSurveyServiceImpl.prototype.loadStatisticsBySurvey = function (surveyId, statistics) {
2682
- return this.http.get("/statistics/" + surveyId, { params: __assign(__assign({}, statistics), { statisticsBy: 'SURVEY' }) })
2683
- .then(function (response) { return response.data; });
2684
- };
2685
- AsyncSurveyServiceImpl.prototype.loadStatisticsByTargets = function (surveyId, statistics) {
2686
- return this.http.get("/statistics/" + surveyId, { params: __assign(__assign({}, statistics), { statisticsBy: 'TARGET' }) })
2687
- .then(function (response) { return response.data; });
2688
- };
2689
- AsyncSurveyServiceImpl.prototype.loadStatisticsWithFiltersByAll = function (surveyId, statistics) {
2690
- return this.http.post("/statistics/" + surveyId, __assign(__assign({}, statistics), { statisticsBy: 'ALL' }))
2691
- .then(function (response) { return response.data; });
2692
- };
2693
- AsyncSurveyServiceImpl.prototype.loadStatisticsWithFiltersBySurvey = function (surveyId, statistics) {
2694
- return this.http.post("/statistics/" + surveyId, __assign(__assign({}, statistics), { statisticsBy: 'SURVEY' }))
2695
- .then(function (response) { return response.data; });
2696
- };
2697
- AsyncSurveyServiceImpl.prototype.loadStatisticsWithFiltersByTargets = function (surveyId, statistics) {
2698
- return this.http.post("/statistics/" + surveyId, __assign(__assign({}, statistics), { statisticsBy: 'TARGET' }))
2699
- .then(function (response) { return response.data; });
2700
- };
2701
- AsyncSurveyServiceImpl.prototype.loadStatisticsBySurveyAndTarget = function (data) {
2702
- return this.http.post("/statistics/targets", data)
2703
- .then(function (response) { return response.data; });
2704
- };
2705
- AsyncSurveyServiceImpl.prototype.loadRespondents = function (params) {
2706
- return this.http
2707
- .get("/respondents", { params: params })
2708
- .then(function (response) { return response.data; });
2709
- };
2710
- AsyncSurveyServiceImpl.prototype.loadRespondentbyPlanAndTarget = function (params) {
2711
- return this.http
2712
- .get("/respondents/target", { params: params })
2713
- .then(function (response) { return response.data; });
2714
- };
2715
- AsyncSurveyServiceImpl.prototype.loadRespondentbyPlanAndTargetAndRespondentIds = function (planId, targetId, respondentIds) {
2716
- return this.http.post("/respondents/target", { planId: planId, targetId: targetId, respondentIds: respondentIds })
2717
- .then(function (response) { return response.data; });
2718
- };
2719
- AsyncSurveyServiceImpl.prototype.get = function (url, params) {
2720
- return this.exhttp.get(url, { params: params })
2721
- .then(function (response) { return response.data; });
2722
- };
2723
- AsyncSurveyServiceImpl.prototype.updatePlanStatistics = function (params) {
2724
- return this.http.put('/statistics', params)
2725
- .then(function (response) { return response.data; });
2726
- };
2727
- AsyncSurveyServiceImpl.prototype.exportPlanStatisticsRawData = function (params) {
2728
- return this.http.put('/statistics/exportRawData', params)
2729
- .then(function (response) { return response.data; });
2730
- };
2731
- return AsyncSurveyServiceImpl;
2732
- }());
2733
- var BlockingSurveyServiceImpl = /** @class */ (function () {
2734
- function BlockingSurveyServiceImpl(asyncSurveyService) {
2735
- this.asyncSurveyService = asyncSurveyService;
2736
- }
2737
- BlockingSurveyServiceImpl.prototype.loadSurvey = function (id) {
2738
- var survey = new SurveyModel();
2739
- survey.id = id;
2740
- return survey;
2741
- };
2742
- BlockingSurveyServiceImpl.prototype.createQuestion = function (surveyId, question) {
2743
- var q = new QuestionModel();
2744
- return q;
2745
- };
2746
- BlockingSurveyServiceImpl.prototype.updateQuestion = function (surveyId, question) {
2747
- var q = new QuestionModel();
2748
- return q;
2749
- };
2750
- BlockingSurveyServiceImpl.prototype.moveQuestion = function (surveyId, questionId, index) {
2751
- };
2752
- BlockingSurveyServiceImpl.prototype.deleteQuestion = function (surveyId, questionId) {
2753
- };
2754
- return BlockingSurveyServiceImpl;
2755
- }());
2756
-
2757
- //todo install options
2758
- // export class SurveyServiceApiOptions implements SurveyServiceOptions{
2759
- //
2760
- // }
2761
- var SurveyServiceApiPlugin = /** @class */ (function () {
2762
- function SurveyServiceApiPlugin() {
2763
- }
2764
- SurveyServiceApiPlugin.install = function (Vue, options) {
2765
- var asyncSurveyService = new AsyncSurveyServiceImpl(options);
2766
- var blockingSurveyService = new BlockingSurveyServiceImpl(asyncSurveyService);
2767
- Vue.prototype.$surveyService = asyncSurveyService;
2768
- Vue.prototype.$asyncSurveyService = asyncSurveyService;
2769
- Vue.prototype.$blockingSurveyService = blockingSurveyService;
2770
- };
2771
- return SurveyServiceApiPlugin;
2772
- }());
2773
-
2774
- module.exports = SurveyServiceApiPlugin;