@bigbinary/neeto-commons-frontend 2.0.8 → 2.0.10

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.
package/utils.cjs.js CHANGED
@@ -4,7 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var axios = require('axios');
6
6
  var ramda = require('ramda');
7
+ var neetoui = require('@bigbinary/neetoui');
7
8
  var i18next = require('i18next');
9
+ var require$$0 = require('util');
8
10
  var dayjs = require('dayjs');
9
11
  var relativeTime = require('dayjs/plugin/relativeTime');
10
12
  var updateLocale = require('dayjs/plugin/updateLocale');
@@ -13,6 +15,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
13
15
 
14
16
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
15
17
  var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
18
+ var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
16
19
  var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
17
20
  var relativeTime__default = /*#__PURE__*/_interopDefaultLegacy(relativeTime);
18
21
  var updateLocale__default = /*#__PURE__*/_interopDefaultLegacy(updateLocale);
@@ -143,7 +146,7 @@ function _defineProperty(obj, key, value) {
143
146
 
144
147
  var regeneratorRuntime$1 = {exports: {}};
145
148
 
146
- var _typeof = {exports: {}};
149
+ var _typeof$1 = {exports: {}};
147
150
 
148
151
  (function (module) {
149
152
  function _typeof(obj) {
@@ -157,10 +160,10 @@ var _typeof = {exports: {}};
157
160
  }
158
161
 
159
162
  module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
160
- } (_typeof));
163
+ } (_typeof$1));
161
164
 
162
165
  (function (module) {
163
- var _typeof$1 = _typeof.exports["default"];
166
+ var _typeof = _typeof$1.exports["default"];
164
167
 
165
168
  function _regeneratorRuntime() {
166
169
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -287,7 +290,7 @@ var _typeof = {exports: {}};
287
290
  if ("throw" !== record.type) {
288
291
  var result = record.arg,
289
292
  value = result.value;
290
- return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
293
+ return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
291
294
  invoke("next", value, resolve, reject);
292
295
  }, function (err) {
293
296
  invoke("throw", err, resolve, reject);
@@ -546,625 +549,2059 @@ var getRandomInt = function getRandomInt() {
546
549
  return Math.floor(Math.random() * (b - a) + a);
547
550
  };
548
551
 
549
- var queryString = {};
552
+ function _typeof(obj) {
553
+ "@babel/helpers - typeof";
550
554
 
551
- var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
555
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
556
+ return typeof obj;
557
+ } : function (obj) {
558
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
559
+ }, _typeof(obj);
560
+ }
552
561
 
553
- var token = '%[a-f0-9]{2}';
554
- var singleMatcher = new RegExp(token, 'gi');
555
- var multiMatcher = new RegExp('(' + token + ')+', 'gi');
562
+ var transformObjectDeep = function transformObjectDeep(object, keyValueTransformer) {
563
+ var objectPreProcessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
556
564
 
557
- function decodeComponents(components, split) {
558
- try {
559
- // Try to decode the entire string first
560
- return decodeURIComponent(components.join(''));
561
- } catch (err) {
562
- // Do nothing
563
- }
565
+ if (objectPreProcessor && typeof objectPreProcessor === "function") {
566
+ object = objectPreProcessor(object);
567
+ }
564
568
 
565
- if (components.length === 1) {
566
- return components;
567
- }
569
+ if (Array.isArray(object)) {
570
+ return object.map(function (obj) {
571
+ return transformObjectDeep(obj, keyValueTransformer, objectPreProcessor);
572
+ });
573
+ } else if (object === null || _typeof(object) !== "object") {
574
+ return object;
575
+ }
568
576
 
569
- split = split || 1;
577
+ return Object.fromEntries(Object.entries(object).map(function (_ref3) {
578
+ var _ref4 = _slicedToArray(_ref3, 2),
579
+ key = _ref4[0],
580
+ value = _ref4[1];
570
581
 
571
- // Split the array in 2 parts
572
- var left = components.slice(0, split);
573
- var right = components.slice(split);
582
+ return keyValueTransformer(key, transformObjectDeep(value, keyValueTransformer, objectPreProcessor));
583
+ }));
584
+ };
585
+ var preprocessForSerialization = function preprocessForSerialization(object) {
586
+ return transformObjectDeep(object, function (key, value) {
587
+ return [key, value];
588
+ }, function (object) {
589
+ return typeof (object === null || object === void 0 ? void 0 : object.toJSON) === "function" ? object.toJSON() : object;
590
+ });
591
+ };
574
592
 
575
- return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
576
- }
593
+ /* eslint complexity: [2, 18], max-statements: [2, 33] */
594
+ var shams = function hasSymbols() {
595
+ if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
596
+ if (typeof Symbol.iterator === 'symbol') { return true; }
577
597
 
578
- function decode(input) {
579
- try {
580
- return decodeURIComponent(input);
581
- } catch (err) {
582
- var tokens = input.match(singleMatcher);
598
+ var obj = {};
599
+ var sym = Symbol('test');
600
+ var symObj = Object(sym);
601
+ if (typeof sym === 'string') { return false; }
583
602
 
584
- for (var i = 1; i < tokens.length; i++) {
585
- input = decodeComponents(tokens, i).join('');
603
+ if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
604
+ if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
586
605
 
587
- tokens = input.match(singleMatcher);
588
- }
606
+ // temp disabled per https://github.com/ljharb/object.assign/issues/17
607
+ // if (sym instanceof Symbol) { return false; }
608
+ // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
609
+ // if (!(symObj instanceof Symbol)) { return false; }
589
610
 
590
- return input;
591
- }
592
- }
611
+ // if (typeof Symbol.prototype.toString !== 'function') { return false; }
612
+ // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
593
613
 
594
- function customDecodeURIComponent(input) {
595
- // Keep track of all the replacements and prefill the map with the `BOM`
596
- var replaceMap = {
597
- '%FE%FF': '\uFFFD\uFFFD',
598
- '%FF%FE': '\uFFFD\uFFFD'
599
- };
614
+ var symVal = 42;
615
+ obj[sym] = symVal;
616
+ for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
617
+ if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
600
618
 
601
- var match = multiMatcher.exec(input);
602
- while (match) {
603
- try {
604
- // Decode as big chunks as possible
605
- replaceMap[match[0]] = decodeURIComponent(match[0]);
606
- } catch (err) {
607
- var result = decode(match[0]);
619
+ if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
608
620
 
609
- if (result !== match[0]) {
610
- replaceMap[match[0]] = result;
611
- }
612
- }
621
+ var syms = Object.getOwnPropertySymbols(obj);
622
+ if (syms.length !== 1 || syms[0] !== sym) { return false; }
623
+
624
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
613
625
 
614
- match = multiMatcher.exec(input);
626
+ if (typeof Object.getOwnPropertyDescriptor === 'function') {
627
+ var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
628
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
615
629
  }
616
630
 
617
- // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
618
- replaceMap['%C2'] = '\uFFFD';
631
+ return true;
632
+ };
619
633
 
620
- var entries = Object.keys(replaceMap);
634
+ var origSymbol = typeof Symbol !== 'undefined' && Symbol;
635
+ var hasSymbolSham = shams;
621
636
 
622
- for (var i = 0; i < entries.length; i++) {
623
- // Replace all decoded components
624
- var key = entries[i];
625
- input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
626
- }
637
+ var hasSymbols$1 = function hasNativeSymbols() {
638
+ if (typeof origSymbol !== 'function') { return false; }
639
+ if (typeof Symbol !== 'function') { return false; }
640
+ if (typeof origSymbol('foo') !== 'symbol') { return false; }
641
+ if (typeof Symbol('bar') !== 'symbol') { return false; }
627
642
 
628
- return input;
629
- }
643
+ return hasSymbolSham();
644
+ };
630
645
 
631
- var decodeUriComponent = function (encodedURI) {
632
- if (typeof encodedURI !== 'string') {
633
- throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
634
- }
646
+ /* eslint no-invalid-this: 1 */
635
647
 
636
- try {
637
- encodedURI = encodedURI.replace(/\+/g, ' ');
648
+ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
649
+ var slice = Array.prototype.slice;
650
+ var toStr$1 = Object.prototype.toString;
651
+ var funcType = '[object Function]';
638
652
 
639
- // Try the built in decoder first
640
- return decodeURIComponent(encodedURI);
641
- } catch (err) {
642
- // Fallback to a more advanced decoder
643
- return customDecodeURIComponent(encodedURI);
644
- }
653
+ var implementation$1 = function bind(that) {
654
+ var target = this;
655
+ if (typeof target !== 'function' || toStr$1.call(target) !== funcType) {
656
+ throw new TypeError(ERROR_MESSAGE + target);
657
+ }
658
+ var args = slice.call(arguments, 1);
659
+
660
+ var bound;
661
+ var binder = function () {
662
+ if (this instanceof bound) {
663
+ var result = target.apply(
664
+ this,
665
+ args.concat(slice.call(arguments))
666
+ );
667
+ if (Object(result) === result) {
668
+ return result;
669
+ }
670
+ return this;
671
+ } else {
672
+ return target.apply(
673
+ that,
674
+ args.concat(slice.call(arguments))
675
+ );
676
+ }
677
+ };
678
+
679
+ var boundLength = Math.max(0, target.length - args.length);
680
+ var boundArgs = [];
681
+ for (var i = 0; i < boundLength; i++) {
682
+ boundArgs.push('$' + i);
683
+ }
684
+
685
+ bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
686
+
687
+ if (target.prototype) {
688
+ var Empty = function Empty() {};
689
+ Empty.prototype = target.prototype;
690
+ bound.prototype = new Empty();
691
+ Empty.prototype = null;
692
+ }
693
+
694
+ return bound;
645
695
  };
646
696
 
647
- var splitOnFirst = (string, separator) => {
648
- if (!(typeof string === 'string' && typeof separator === 'string')) {
649
- throw new TypeError('Expected the arguments to be of type `string`');
650
- }
697
+ var implementation = implementation$1;
651
698
 
652
- if (separator === '') {
653
- return [string];
654
- }
699
+ var functionBind = Function.prototype.bind || implementation;
655
700
 
656
- const separatorIndex = string.indexOf(separator);
701
+ var bind$1 = functionBind;
657
702
 
658
- if (separatorIndex === -1) {
659
- return [string];
660
- }
703
+ var src = bind$1.call(Function.call, Object.prototype.hasOwnProperty);
661
704
 
662
- return [
663
- string.slice(0, separatorIndex),
664
- string.slice(separatorIndex + separator.length)
665
- ];
666
- };
705
+ var undefined$1;
667
706
 
668
- var filterObj = function (obj, predicate) {
669
- var ret = {};
670
- var keys = Object.keys(obj);
671
- var isArr = Array.isArray(predicate);
707
+ var $SyntaxError = SyntaxError;
708
+ var $Function = Function;
709
+ var $TypeError$1 = TypeError;
672
710
 
673
- for (var i = 0; i < keys.length; i++) {
674
- var key = keys[i];
675
- var val = obj[key];
711
+ // eslint-disable-next-line consistent-return
712
+ var getEvalledConstructor = function (expressionSyntax) {
713
+ try {
714
+ return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
715
+ } catch (e) {}
716
+ };
676
717
 
677
- if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) {
678
- ret[key] = val;
679
- }
718
+ var $gOPD = Object.getOwnPropertyDescriptor;
719
+ if ($gOPD) {
720
+ try {
721
+ $gOPD({}, '');
722
+ } catch (e) {
723
+ $gOPD = null; // this is IE 8, which has a broken gOPD
680
724
  }
725
+ }
681
726
 
682
- return ret;
727
+ var throwTypeError = function () {
728
+ throw new $TypeError$1();
683
729
  };
684
-
685
- (function (exports) {
686
- const strictUriEncode$1 = strictUriEncode;
687
- const decodeComponent = decodeUriComponent;
688
- const splitOnFirst$1 = splitOnFirst;
689
- const filterObject = filterObj;
690
-
691
- const isNullOrUndefined = value => value === null || value === undefined;
692
-
693
- const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier');
694
-
695
- function encoderForArrayFormat(options) {
696
- switch (options.arrayFormat) {
697
- case 'index':
698
- return key => (result, value) => {
699
- const index = result.length;
700
-
701
- if (
702
- value === undefined ||
703
- (options.skipNull && value === null) ||
704
- (options.skipEmptyString && value === '')
705
- ) {
706
- return result;
707
- }
708
-
709
- if (value === null) {
710
- return [...result, [encode(key, options), '[', index, ']'].join('')];
711
- }
712
-
713
- return [
714
- ...result,
715
- [encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
716
- ];
717
- };
718
-
719
- case 'bracket':
720
- return key => (result, value) => {
721
- if (
722
- value === undefined ||
723
- (options.skipNull && value === null) ||
724
- (options.skipEmptyString && value === '')
725
- ) {
726
- return result;
727
- }
728
-
729
- if (value === null) {
730
- return [...result, [encode(key, options), '[]'].join('')];
731
- }
732
-
733
- return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
734
- };
735
-
736
- case 'colon-list-separator':
737
- return key => (result, value) => {
738
- if (
739
- value === undefined ||
740
- (options.skipNull && value === null) ||
741
- (options.skipEmptyString && value === '')
742
- ) {
743
- return result;
744
- }
745
-
746
- if (value === null) {
747
- return [...result, [encode(key, options), ':list='].join('')];
748
- }
749
-
750
- return [...result, [encode(key, options), ':list=', encode(value, options)].join('')];
751
- };
752
-
753
- case 'comma':
754
- case 'separator':
755
- case 'bracket-separator': {
756
- const keyValueSep = options.arrayFormat === 'bracket-separator' ?
757
- '[]=' :
758
- '=';
759
-
760
- return key => (result, value) => {
761
- if (
762
- value === undefined ||
763
- (options.skipNull && value === null) ||
764
- (options.skipEmptyString && value === '')
765
- ) {
766
- return result;
767
- }
768
-
769
- // Translate null to an empty string so that it doesn't serialize as 'null'
770
- value = value === null ? '' : value;
771
-
772
- if (result.length === 0) {
773
- return [[encode(key, options), keyValueSep, encode(value, options)].join('')];
774
- }
775
-
776
- return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
777
- };
730
+ var ThrowTypeError = $gOPD
731
+ ? (function () {
732
+ try {
733
+ // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
734
+ arguments.callee; // IE 8 does not throw here
735
+ return throwTypeError;
736
+ } catch (calleeThrows) {
737
+ try {
738
+ // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
739
+ return $gOPD(arguments, 'callee').get;
740
+ } catch (gOPDthrows) {
741
+ return throwTypeError;
778
742
  }
779
-
780
- default:
781
- return key => (result, value) => {
782
- if (
783
- value === undefined ||
784
- (options.skipNull && value === null) ||
785
- (options.skipEmptyString && value === '')
786
- ) {
787
- return result;
788
- }
789
-
790
- if (value === null) {
791
- return [...result, encode(key, options)];
792
- }
793
-
794
- return [...result, [encode(key, options), '=', encode(value, options)].join('')];
795
- };
796
743
  }
797
- }
744
+ }())
745
+ : throwTypeError;
746
+
747
+ var hasSymbols = hasSymbols$1();
748
+
749
+ var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
750
+
751
+ var needsEval = {};
752
+
753
+ var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
754
+
755
+ var INTRINSICS = {
756
+ '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
757
+ '%Array%': Array,
758
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
759
+ '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
760
+ '%AsyncFromSyncIteratorPrototype%': undefined$1,
761
+ '%AsyncFunction%': needsEval,
762
+ '%AsyncGenerator%': needsEval,
763
+ '%AsyncGeneratorFunction%': needsEval,
764
+ '%AsyncIteratorPrototype%': needsEval,
765
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
766
+ '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
767
+ '%Boolean%': Boolean,
768
+ '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
769
+ '%Date%': Date,
770
+ '%decodeURI%': decodeURI,
771
+ '%decodeURIComponent%': decodeURIComponent,
772
+ '%encodeURI%': encodeURI,
773
+ '%encodeURIComponent%': encodeURIComponent,
774
+ '%Error%': Error,
775
+ '%eval%': eval, // eslint-disable-line no-eval
776
+ '%EvalError%': EvalError,
777
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
778
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
779
+ '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
780
+ '%Function%': $Function,
781
+ '%GeneratorFunction%': needsEval,
782
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
783
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
784
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
785
+ '%isFinite%': isFinite,
786
+ '%isNaN%': isNaN,
787
+ '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
788
+ '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
789
+ '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
790
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
791
+ '%Math%': Math,
792
+ '%Number%': Number,
793
+ '%Object%': Object,
794
+ '%parseFloat%': parseFloat,
795
+ '%parseInt%': parseInt,
796
+ '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
797
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
798
+ '%RangeError%': RangeError,
799
+ '%ReferenceError%': ReferenceError,
800
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
801
+ '%RegExp%': RegExp,
802
+ '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
803
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
804
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
805
+ '%String%': String,
806
+ '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
807
+ '%Symbol%': hasSymbols ? Symbol : undefined$1,
808
+ '%SyntaxError%': $SyntaxError,
809
+ '%ThrowTypeError%': ThrowTypeError,
810
+ '%TypedArray%': TypedArray,
811
+ '%TypeError%': $TypeError$1,
812
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
813
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
814
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
815
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
816
+ '%URIError%': URIError,
817
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
818
+ '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
819
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
820
+ };
798
821
 
799
- function parserForArrayFormat(options) {
800
- let result;
801
-
802
- switch (options.arrayFormat) {
803
- case 'index':
804
- return (key, value, accumulator) => {
805
- result = /\[(\d*)\]$/.exec(key);
806
-
807
- key = key.replace(/\[\d*\]$/, '');
808
-
809
- if (!result) {
810
- accumulator[key] = value;
811
- return;
812
- }
813
-
814
- if (accumulator[key] === undefined) {
815
- accumulator[key] = {};
816
- }
817
-
818
- accumulator[key][result[1]] = value;
819
- };
820
-
821
- case 'bracket':
822
- return (key, value, accumulator) => {
823
- result = /(\[\])$/.exec(key);
824
- key = key.replace(/\[\]$/, '');
825
-
826
- if (!result) {
827
- accumulator[key] = value;
828
- return;
829
- }
830
-
831
- if (accumulator[key] === undefined) {
832
- accumulator[key] = [value];
833
- return;
834
- }
835
-
836
- accumulator[key] = [].concat(accumulator[key], value);
837
- };
838
-
839
- case 'colon-list-separator':
840
- return (key, value, accumulator) => {
841
- result = /(:list)$/.exec(key);
842
- key = key.replace(/:list$/, '');
843
-
844
- if (!result) {
845
- accumulator[key] = value;
846
- return;
847
- }
848
-
849
- if (accumulator[key] === undefined) {
850
- accumulator[key] = [value];
851
- return;
852
- }
853
-
854
- accumulator[key] = [].concat(accumulator[key], value);
855
- };
856
-
857
- case 'comma':
858
- case 'separator':
859
- return (key, value, accumulator) => {
860
- const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);
861
- const isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));
862
- value = isEncodedArray ? decode(value, options) : value;
863
- const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
864
- accumulator[key] = newValue;
865
- };
866
-
867
- case 'bracket-separator':
868
- return (key, value, accumulator) => {
869
- const isArray = /(\[\])$/.test(key);
870
- key = key.replace(/\[\]$/, '');
871
-
872
- if (!isArray) {
873
- accumulator[key] = value ? decode(value, options) : value;
874
- return;
875
- }
876
-
877
- const arrayValue = value === null ?
878
- [] :
879
- value.split(options.arrayFormatSeparator).map(item => decode(item, options));
880
-
881
- if (accumulator[key] === undefined) {
882
- accumulator[key] = arrayValue;
883
- return;
884
- }
885
-
886
- accumulator[key] = [].concat(accumulator[key], arrayValue);
887
- };
888
-
889
- default:
890
- return (key, value, accumulator) => {
891
- if (accumulator[key] === undefined) {
892
- accumulator[key] = value;
893
- return;
894
- }
895
-
896
- accumulator[key] = [].concat(accumulator[key], value);
897
- };
822
+ var doEval = function doEval(name) {
823
+ var value;
824
+ if (name === '%AsyncFunction%') {
825
+ value = getEvalledConstructor('async function () {}');
826
+ } else if (name === '%GeneratorFunction%') {
827
+ value = getEvalledConstructor('function* () {}');
828
+ } else if (name === '%AsyncGeneratorFunction%') {
829
+ value = getEvalledConstructor('async function* () {}');
830
+ } else if (name === '%AsyncGenerator%') {
831
+ var fn = doEval('%AsyncGeneratorFunction%');
832
+ if (fn) {
833
+ value = fn.prototype;
834
+ }
835
+ } else if (name === '%AsyncIteratorPrototype%') {
836
+ var gen = doEval('%AsyncGenerator%');
837
+ if (gen) {
838
+ value = getProto(gen.prototype);
898
839
  }
899
840
  }
900
841
 
901
- function validateArrayFormatSeparator(value) {
902
- if (typeof value !== 'string' || value.length !== 1) {
903
- throw new TypeError('arrayFormatSeparator must be single character string');
904
- }
842
+ INTRINSICS[name] = value;
843
+
844
+ return value;
845
+ };
846
+
847
+ var LEGACY_ALIASES = {
848
+ '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
849
+ '%ArrayPrototype%': ['Array', 'prototype'],
850
+ '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
851
+ '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
852
+ '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
853
+ '%ArrayProto_values%': ['Array', 'prototype', 'values'],
854
+ '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
855
+ '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
856
+ '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
857
+ '%BooleanPrototype%': ['Boolean', 'prototype'],
858
+ '%DataViewPrototype%': ['DataView', 'prototype'],
859
+ '%DatePrototype%': ['Date', 'prototype'],
860
+ '%ErrorPrototype%': ['Error', 'prototype'],
861
+ '%EvalErrorPrototype%': ['EvalError', 'prototype'],
862
+ '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
863
+ '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
864
+ '%FunctionPrototype%': ['Function', 'prototype'],
865
+ '%Generator%': ['GeneratorFunction', 'prototype'],
866
+ '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
867
+ '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
868
+ '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
869
+ '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
870
+ '%JSONParse%': ['JSON', 'parse'],
871
+ '%JSONStringify%': ['JSON', 'stringify'],
872
+ '%MapPrototype%': ['Map', 'prototype'],
873
+ '%NumberPrototype%': ['Number', 'prototype'],
874
+ '%ObjectPrototype%': ['Object', 'prototype'],
875
+ '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
876
+ '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
877
+ '%PromisePrototype%': ['Promise', 'prototype'],
878
+ '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
879
+ '%Promise_all%': ['Promise', 'all'],
880
+ '%Promise_reject%': ['Promise', 'reject'],
881
+ '%Promise_resolve%': ['Promise', 'resolve'],
882
+ '%RangeErrorPrototype%': ['RangeError', 'prototype'],
883
+ '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
884
+ '%RegExpPrototype%': ['RegExp', 'prototype'],
885
+ '%SetPrototype%': ['Set', 'prototype'],
886
+ '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
887
+ '%StringPrototype%': ['String', 'prototype'],
888
+ '%SymbolPrototype%': ['Symbol', 'prototype'],
889
+ '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
890
+ '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
891
+ '%TypeErrorPrototype%': ['TypeError', 'prototype'],
892
+ '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
893
+ '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
894
+ '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
895
+ '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
896
+ '%URIErrorPrototype%': ['URIError', 'prototype'],
897
+ '%WeakMapPrototype%': ['WeakMap', 'prototype'],
898
+ '%WeakSetPrototype%': ['WeakSet', 'prototype']
899
+ };
900
+
901
+ var bind = functionBind;
902
+ var hasOwn$1 = src;
903
+ var $concat$1 = bind.call(Function.call, Array.prototype.concat);
904
+ var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
905
+ var $replace$1 = bind.call(Function.call, String.prototype.replace);
906
+ var $strSlice = bind.call(Function.call, String.prototype.slice);
907
+
908
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
909
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
910
+ var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
911
+ var stringToPath = function stringToPath(string) {
912
+ var first = $strSlice(string, 0, 1);
913
+ var last = $strSlice(string, -1);
914
+ if (first === '%' && last !== '%') {
915
+ throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
916
+ } else if (last === '%' && first !== '%') {
917
+ throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
918
+ }
919
+ var result = [];
920
+ $replace$1(string, rePropName, function (match, number, quote, subString) {
921
+ result[result.length] = quote ? $replace$1(subString, reEscapeChar, '$1') : number || match;
922
+ });
923
+ return result;
924
+ };
925
+ /* end adaptation */
926
+
927
+ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
928
+ var intrinsicName = name;
929
+ var alias;
930
+ if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) {
931
+ alias = LEGACY_ALIASES[intrinsicName];
932
+ intrinsicName = '%' + alias[0] + '%';
905
933
  }
906
934
 
907
- function encode(value, options) {
908
- if (options.encode) {
909
- return options.strict ? strictUriEncode$1(value) : encodeURIComponent(value);
935
+ if (hasOwn$1(INTRINSICS, intrinsicName)) {
936
+ var value = INTRINSICS[intrinsicName];
937
+ if (value === needsEval) {
938
+ value = doEval(intrinsicName);
939
+ }
940
+ if (typeof value === 'undefined' && !allowMissing) {
941
+ throw new $TypeError$1('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
910
942
  }
911
943
 
912
- return value;
944
+ return {
945
+ alias: alias,
946
+ name: intrinsicName,
947
+ value: value
948
+ };
913
949
  }
914
950
 
915
- function decode(value, options) {
916
- if (options.decode) {
917
- return decodeComponent(value);
918
- }
951
+ throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
952
+ };
919
953
 
920
- return value;
954
+ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
955
+ if (typeof name !== 'string' || name.length === 0) {
956
+ throw new $TypeError$1('intrinsic name must be a non-empty string');
957
+ }
958
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
959
+ throw new $TypeError$1('"allowMissing" argument must be a boolean');
921
960
  }
922
961
 
923
- function keysSorter(input) {
924
- if (Array.isArray(input)) {
925
- return input.sort();
926
- }
962
+ var parts = stringToPath(name);
963
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
927
964
 
928
- if (typeof input === 'object') {
929
- return keysSorter(Object.keys(input))
930
- .sort((a, b) => Number(a) - Number(b))
931
- .map(key => input[key]);
932
- }
965
+ var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
966
+ var intrinsicRealName = intrinsic.name;
967
+ var value = intrinsic.value;
968
+ var skipFurtherCaching = false;
933
969
 
934
- return input;
970
+ var alias = intrinsic.alias;
971
+ if (alias) {
972
+ intrinsicBaseName = alias[0];
973
+ $spliceApply(parts, $concat$1([0, 1], alias));
935
974
  }
936
975
 
937
- function removeHash(input) {
938
- const hashStart = input.indexOf('#');
939
- if (hashStart !== -1) {
940
- input = input.slice(0, hashStart);
976
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
977
+ var part = parts[i];
978
+ var first = $strSlice(part, 0, 1);
979
+ var last = $strSlice(part, -1);
980
+ if (
981
+ (
982
+ (first === '"' || first === "'" || first === '`')
983
+ || (last === '"' || last === "'" || last === '`')
984
+ )
985
+ && first !== last
986
+ ) {
987
+ throw new $SyntaxError('property names with quotes must have matching quotes');
988
+ }
989
+ if (part === 'constructor' || !isOwn) {
990
+ skipFurtherCaching = true;
941
991
  }
942
992
 
943
- return input;
944
- }
993
+ intrinsicBaseName += '.' + part;
994
+ intrinsicRealName = '%' + intrinsicBaseName + '%';
995
+
996
+ if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
997
+ value = INTRINSICS[intrinsicRealName];
998
+ } else if (value != null) {
999
+ if (!(part in value)) {
1000
+ if (!allowMissing) {
1001
+ throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
1002
+ }
1003
+ return void undefined$1;
1004
+ }
1005
+ if ($gOPD && (i + 1) >= parts.length) {
1006
+ var desc = $gOPD(value, part);
1007
+ isOwn = !!desc;
1008
+
1009
+ // By convention, when a data property is converted to an accessor
1010
+ // property to emulate a data property that does not suffer from
1011
+ // the override mistake, that accessor's getter is marked with
1012
+ // an `originalValue` property. Here, when we detect this, we
1013
+ // uphold the illusion by pretending to see that original data
1014
+ // property, i.e., returning the value rather than the getter
1015
+ // itself.
1016
+ if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
1017
+ value = desc.get;
1018
+ } else {
1019
+ value = value[part];
1020
+ }
1021
+ } else {
1022
+ isOwn = hasOwn$1(value, part);
1023
+ value = value[part];
1024
+ }
945
1025
 
946
- function getHash(url) {
947
- let hash = '';
948
- const hashStart = url.indexOf('#');
949
- if (hashStart !== -1) {
950
- hash = url.slice(hashStart);
1026
+ if (isOwn && !skipFurtherCaching) {
1027
+ INTRINSICS[intrinsicRealName] = value;
1028
+ }
951
1029
  }
1030
+ }
1031
+ return value;
1032
+ };
1033
+
1034
+ var callBind$1 = {exports: {}};
1035
+
1036
+ (function (module) {
1037
+
1038
+ var bind = functionBind;
1039
+ var GetIntrinsic = getIntrinsic;
952
1040
 
953
- return hash;
1041
+ var $apply = GetIntrinsic('%Function.prototype.apply%');
1042
+ var $call = GetIntrinsic('%Function.prototype.call%');
1043
+ var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
1044
+
1045
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
1046
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
1047
+ var $max = GetIntrinsic('%Math.max%');
1048
+
1049
+ if ($defineProperty) {
1050
+ try {
1051
+ $defineProperty({}, 'a', { value: 1 });
1052
+ } catch (e) {
1053
+ // IE 8 has a broken defineProperty
1054
+ $defineProperty = null;
1055
+ }
954
1056
  }
955
1057
 
956
- function extract(input) {
957
- input = removeHash(input);
958
- const queryStart = input.indexOf('?');
959
- if (queryStart === -1) {
960
- return '';
1058
+ module.exports = function callBind(originalFunction) {
1059
+ var func = $reflectApply(bind, $call, arguments);
1060
+ if ($gOPD && $defineProperty) {
1061
+ var desc = $gOPD(func, 'length');
1062
+ if (desc.configurable) {
1063
+ // original length, plus the receiver, minus any additional arguments (after the receiver)
1064
+ $defineProperty(
1065
+ func,
1066
+ 'length',
1067
+ { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
1068
+ );
1069
+ }
961
1070
  }
1071
+ return func;
1072
+ };
1073
+
1074
+ var applyBind = function applyBind() {
1075
+ return $reflectApply(bind, $apply, arguments);
1076
+ };
962
1077
 
963
- return input.slice(queryStart + 1);
1078
+ if ($defineProperty) {
1079
+ $defineProperty(module.exports, 'apply', { value: applyBind });
1080
+ } else {
1081
+ module.exports.apply = applyBind;
964
1082
  }
1083
+ } (callBind$1));
965
1084
 
966
- function parseValue(value, options) {
967
- if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
968
- value = Number(value);
969
- } else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
970
- value = value.toLowerCase() === 'true';
971
- }
1085
+ var GetIntrinsic$1 = getIntrinsic;
1086
+
1087
+ var callBind = callBind$1.exports;
1088
+
1089
+ var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
972
1090
 
973
- return value;
1091
+ var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
1092
+ var intrinsic = GetIntrinsic$1(name, !!allowMissing);
1093
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
1094
+ return callBind(intrinsic);
974
1095
  }
1096
+ return intrinsic;
1097
+ };
975
1098
 
976
- function parse(query, options) {
977
- options = Object.assign({
978
- decode: true,
979
- sort: true,
980
- arrayFormat: 'none',
981
- arrayFormatSeparator: ',',
982
- parseNumbers: false,
983
- parseBooleans: false
984
- }, options);
1099
+ var util_inspect = require$$0__default["default"].inspect;
1100
+
1101
+ var hasMap = typeof Map === 'function' && Map.prototype;
1102
+ var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
1103
+ var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
1104
+ var mapForEach = hasMap && Map.prototype.forEach;
1105
+ var hasSet = typeof Set === 'function' && Set.prototype;
1106
+ var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
1107
+ var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
1108
+ var setForEach = hasSet && Set.prototype.forEach;
1109
+ var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
1110
+ var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
1111
+ var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
1112
+ var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
1113
+ var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
1114
+ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
1115
+ var booleanValueOf = Boolean.prototype.valueOf;
1116
+ var objectToString = Object.prototype.toString;
1117
+ var functionToString = Function.prototype.toString;
1118
+ var $match = String.prototype.match;
1119
+ var $slice = String.prototype.slice;
1120
+ var $replace = String.prototype.replace;
1121
+ var $toUpperCase = String.prototype.toUpperCase;
1122
+ var $toLowerCase = String.prototype.toLowerCase;
1123
+ var $test = RegExp.prototype.test;
1124
+ var $concat = Array.prototype.concat;
1125
+ var $join = Array.prototype.join;
1126
+ var $arrSlice = Array.prototype.slice;
1127
+ var $floor = Math.floor;
1128
+ var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
1129
+ var gOPS = Object.getOwnPropertySymbols;
1130
+ var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
1131
+ var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
1132
+ // ie, `has-tostringtag/shams
1133
+ var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
1134
+ ? Symbol.toStringTag
1135
+ : null;
1136
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
1137
+
1138
+ var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
1139
+ [].__proto__ === Array.prototype // eslint-disable-line no-proto
1140
+ ? function (O) {
1141
+ return O.__proto__; // eslint-disable-line no-proto
1142
+ }
1143
+ : null
1144
+ );
1145
+
1146
+ function addNumericSeparator(num, str) {
1147
+ if (
1148
+ num === Infinity
1149
+ || num === -Infinity
1150
+ || num !== num
1151
+ || (num && num > -1000 && num < 1000)
1152
+ || $test.call(/e/, str)
1153
+ ) {
1154
+ return str;
1155
+ }
1156
+ var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
1157
+ if (typeof num === 'number') {
1158
+ var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
1159
+ if (int !== num) {
1160
+ var intStr = String(int);
1161
+ var dec = $slice.call(str, intStr.length + 1);
1162
+ return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
1163
+ }
1164
+ }
1165
+ return $replace.call(str, sepRegex, '$&_');
1166
+ }
985
1167
 
986
- validateArrayFormatSeparator(options.arrayFormatSeparator);
1168
+ var inspectCustom = util_inspect.custom;
1169
+ var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
987
1170
 
988
- const formatter = parserForArrayFormat(options);
1171
+ var objectInspect = function inspect_(obj, options, depth, seen) {
1172
+ var opts = options || {};
989
1173
 
990
- // Create an object with no prototype
991
- const ret = Object.create(null);
1174
+ if (has$3(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
1175
+ throw new TypeError('option "quoteStyle" must be "single" or "double"');
1176
+ }
1177
+ if (
1178
+ has$3(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
1179
+ ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
1180
+ : opts.maxStringLength !== null
1181
+ )
1182
+ ) {
1183
+ throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
1184
+ }
1185
+ var customInspect = has$3(opts, 'customInspect') ? opts.customInspect : true;
1186
+ if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
1187
+ throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
1188
+ }
992
1189
 
993
- if (typeof query !== 'string') {
994
- return ret;
995
- }
1190
+ if (
1191
+ has$3(opts, 'indent')
1192
+ && opts.indent !== null
1193
+ && opts.indent !== '\t'
1194
+ && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
1195
+ ) {
1196
+ throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
1197
+ }
1198
+ if (has$3(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
1199
+ throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
1200
+ }
1201
+ var numericSeparator = opts.numericSeparator;
996
1202
 
997
- query = query.trim().replace(/^[?#&]/, '');
1203
+ if (typeof obj === 'undefined') {
1204
+ return 'undefined';
1205
+ }
1206
+ if (obj === null) {
1207
+ return 'null';
1208
+ }
1209
+ if (typeof obj === 'boolean') {
1210
+ return obj ? 'true' : 'false';
1211
+ }
998
1212
 
999
- if (!query) {
1000
- return ret;
1001
- }
1213
+ if (typeof obj === 'string') {
1214
+ return inspectString(obj, opts);
1215
+ }
1216
+ if (typeof obj === 'number') {
1217
+ if (obj === 0) {
1218
+ return Infinity / obj > 0 ? '0' : '-0';
1219
+ }
1220
+ var str = String(obj);
1221
+ return numericSeparator ? addNumericSeparator(obj, str) : str;
1222
+ }
1223
+ if (typeof obj === 'bigint') {
1224
+ var bigIntStr = String(obj) + 'n';
1225
+ return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
1226
+ }
1002
1227
 
1003
- for (const param of query.split('&')) {
1004
- if (param === '') {
1005
- continue;
1006
- }
1228
+ var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
1229
+ if (typeof depth === 'undefined') { depth = 0; }
1230
+ if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
1231
+ return isArray$3(obj) ? '[Array]' : '[Object]';
1232
+ }
1233
+
1234
+ var indent = getIndent(opts, depth);
1235
+
1236
+ if (typeof seen === 'undefined') {
1237
+ seen = [];
1238
+ } else if (indexOf(seen, obj) >= 0) {
1239
+ return '[Circular]';
1240
+ }
1241
+
1242
+ function inspect(value, from, noIndent) {
1243
+ if (from) {
1244
+ seen = $arrSlice.call(seen);
1245
+ seen.push(from);
1246
+ }
1247
+ if (noIndent) {
1248
+ var newOpts = {
1249
+ depth: opts.depth
1250
+ };
1251
+ if (has$3(opts, 'quoteStyle')) {
1252
+ newOpts.quoteStyle = opts.quoteStyle;
1253
+ }
1254
+ return inspect_(value, newOpts, depth + 1, seen);
1255
+ }
1256
+ return inspect_(value, opts, depth + 1, seen);
1257
+ }
1007
1258
 
1008
- let [key, value] = splitOnFirst$1(options.decode ? param.replace(/\+/g, ' ') : param, '=');
1259
+ if (typeof obj === 'function') {
1260
+ var name = nameOf(obj);
1261
+ var keys = arrObjKeys(obj, inspect);
1262
+ return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
1263
+ }
1264
+ if (isSymbol(obj)) {
1265
+ var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
1266
+ return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
1267
+ }
1268
+ if (isElement(obj)) {
1269
+ var s = '<' + $toLowerCase.call(String(obj.nodeName));
1270
+ var attrs = obj.attributes || [];
1271
+ for (var i = 0; i < attrs.length; i++) {
1272
+ s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
1273
+ }
1274
+ s += '>';
1275
+ if (obj.childNodes && obj.childNodes.length) { s += '...'; }
1276
+ s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
1277
+ return s;
1278
+ }
1279
+ if (isArray$3(obj)) {
1280
+ if (obj.length === 0) { return '[]'; }
1281
+ var xs = arrObjKeys(obj, inspect);
1282
+ if (indent && !singleLineValues(xs)) {
1283
+ return '[' + indentedJoin(xs, indent) + ']';
1284
+ }
1285
+ return '[ ' + $join.call(xs, ', ') + ' ]';
1286
+ }
1287
+ if (isError(obj)) {
1288
+ var parts = arrObjKeys(obj, inspect);
1289
+ if ('cause' in obj && !isEnumerable.call(obj, 'cause')) {
1290
+ return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
1291
+ }
1292
+ if (parts.length === 0) { return '[' + String(obj) + ']'; }
1293
+ return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
1294
+ }
1295
+ if (typeof obj === 'object' && customInspect) {
1296
+ if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
1297
+ return obj[inspectSymbol]();
1298
+ } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
1299
+ return obj.inspect();
1300
+ }
1301
+ }
1302
+ if (isMap(obj)) {
1303
+ var mapParts = [];
1304
+ mapForEach.call(obj, function (value, key) {
1305
+ mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
1306
+ });
1307
+ return collectionOf('Map', mapSize.call(obj), mapParts, indent);
1308
+ }
1309
+ if (isSet(obj)) {
1310
+ var setParts = [];
1311
+ setForEach.call(obj, function (value) {
1312
+ setParts.push(inspect(value, obj));
1313
+ });
1314
+ return collectionOf('Set', setSize.call(obj), setParts, indent);
1315
+ }
1316
+ if (isWeakMap(obj)) {
1317
+ return weakCollectionOf('WeakMap');
1318
+ }
1319
+ if (isWeakSet(obj)) {
1320
+ return weakCollectionOf('WeakSet');
1321
+ }
1322
+ if (isWeakRef(obj)) {
1323
+ return weakCollectionOf('WeakRef');
1324
+ }
1325
+ if (isNumber(obj)) {
1326
+ return markBoxed(inspect(Number(obj)));
1327
+ }
1328
+ if (isBigInt(obj)) {
1329
+ return markBoxed(inspect(bigIntValueOf.call(obj)));
1330
+ }
1331
+ if (isBoolean(obj)) {
1332
+ return markBoxed(booleanValueOf.call(obj));
1333
+ }
1334
+ if (isString(obj)) {
1335
+ return markBoxed(inspect(String(obj)));
1336
+ }
1337
+ if (!isDate(obj) && !isRegExp$1(obj)) {
1338
+ var ys = arrObjKeys(obj, inspect);
1339
+ var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
1340
+ var protoTag = obj instanceof Object ? '' : 'null prototype';
1341
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
1342
+ var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
1343
+ var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
1344
+ if (ys.length === 0) { return tag + '{}'; }
1345
+ if (indent) {
1346
+ return tag + '{' + indentedJoin(ys, indent) + '}';
1347
+ }
1348
+ return tag + '{ ' + $join.call(ys, ', ') + ' }';
1349
+ }
1350
+ return String(obj);
1351
+ };
1352
+
1353
+ function wrapQuotes(s, defaultStyle, opts) {
1354
+ var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
1355
+ return quoteChar + s + quoteChar;
1356
+ }
1009
1357
 
1010
- // Missing `=` should be `null`:
1011
- // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
1012
- value = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options);
1013
- formatter(decode(key, options), value, ret);
1358
+ function quote(s) {
1359
+ return $replace.call(String(s), /"/g, '&quot;');
1360
+ }
1361
+
1362
+ function isArray$3(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1363
+ function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1364
+ function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1365
+ function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1366
+ function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1367
+ function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1368
+ function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1369
+
1370
+ // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
1371
+ function isSymbol(obj) {
1372
+ if (hasShammedSymbols) {
1373
+ return obj && typeof obj === 'object' && obj instanceof Symbol;
1374
+ }
1375
+ if (typeof obj === 'symbol') {
1376
+ return true;
1377
+ }
1378
+ if (!obj || typeof obj !== 'object' || !symToString) {
1379
+ return false;
1380
+ }
1381
+ try {
1382
+ symToString.call(obj);
1383
+ return true;
1384
+ } catch (e) {}
1385
+ return false;
1386
+ }
1387
+
1388
+ function isBigInt(obj) {
1389
+ if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
1390
+ return false;
1391
+ }
1392
+ try {
1393
+ bigIntValueOf.call(obj);
1394
+ return true;
1395
+ } catch (e) {}
1396
+ return false;
1397
+ }
1398
+
1399
+ var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
1400
+ function has$3(obj, key) {
1401
+ return hasOwn.call(obj, key);
1402
+ }
1403
+
1404
+ function toStr(obj) {
1405
+ return objectToString.call(obj);
1406
+ }
1407
+
1408
+ function nameOf(f) {
1409
+ if (f.name) { return f.name; }
1410
+ var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
1411
+ if (m) { return m[1]; }
1412
+ return null;
1413
+ }
1414
+
1415
+ function indexOf(xs, x) {
1416
+ if (xs.indexOf) { return xs.indexOf(x); }
1417
+ for (var i = 0, l = xs.length; i < l; i++) {
1418
+ if (xs[i] === x) { return i; }
1419
+ }
1420
+ return -1;
1421
+ }
1422
+
1423
+ function isMap(x) {
1424
+ if (!mapSize || !x || typeof x !== 'object') {
1425
+ return false;
1426
+ }
1427
+ try {
1428
+ mapSize.call(x);
1429
+ try {
1430
+ setSize.call(x);
1431
+ } catch (s) {
1432
+ return true;
1433
+ }
1434
+ return x instanceof Map; // core-js workaround, pre-v2.5.0
1435
+ } catch (e) {}
1436
+ return false;
1437
+ }
1438
+
1439
+ function isWeakMap(x) {
1440
+ if (!weakMapHas || !x || typeof x !== 'object') {
1441
+ return false;
1442
+ }
1443
+ try {
1444
+ weakMapHas.call(x, weakMapHas);
1445
+ try {
1446
+ weakSetHas.call(x, weakSetHas);
1447
+ } catch (s) {
1448
+ return true;
1449
+ }
1450
+ return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
1451
+ } catch (e) {}
1452
+ return false;
1453
+ }
1454
+
1455
+ function isWeakRef(x) {
1456
+ if (!weakRefDeref || !x || typeof x !== 'object') {
1457
+ return false;
1458
+ }
1459
+ try {
1460
+ weakRefDeref.call(x);
1461
+ return true;
1462
+ } catch (e) {}
1463
+ return false;
1464
+ }
1465
+
1466
+ function isSet(x) {
1467
+ if (!setSize || !x || typeof x !== 'object') {
1468
+ return false;
1469
+ }
1470
+ try {
1471
+ setSize.call(x);
1472
+ try {
1473
+ mapSize.call(x);
1474
+ } catch (m) {
1475
+ return true;
1476
+ }
1477
+ return x instanceof Set; // core-js workaround, pre-v2.5.0
1478
+ } catch (e) {}
1479
+ return false;
1480
+ }
1481
+
1482
+ function isWeakSet(x) {
1483
+ if (!weakSetHas || !x || typeof x !== 'object') {
1484
+ return false;
1485
+ }
1486
+ try {
1487
+ weakSetHas.call(x, weakSetHas);
1488
+ try {
1489
+ weakMapHas.call(x, weakMapHas);
1490
+ } catch (s) {
1491
+ return true;
1492
+ }
1493
+ return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
1494
+ } catch (e) {}
1495
+ return false;
1496
+ }
1497
+
1498
+ function isElement(x) {
1499
+ if (!x || typeof x !== 'object') { return false; }
1500
+ if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
1501
+ return true;
1502
+ }
1503
+ return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
1504
+ }
1505
+
1506
+ function inspectString(str, opts) {
1507
+ if (str.length > opts.maxStringLength) {
1508
+ var remaining = str.length - opts.maxStringLength;
1509
+ var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
1510
+ return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
1511
+ }
1512
+ // eslint-disable-next-line no-control-regex
1513
+ var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
1514
+ return wrapQuotes(s, 'single', opts);
1515
+ }
1516
+
1517
+ function lowbyte(c) {
1518
+ var n = c.charCodeAt(0);
1519
+ var x = {
1520
+ 8: 'b',
1521
+ 9: 't',
1522
+ 10: 'n',
1523
+ 12: 'f',
1524
+ 13: 'r'
1525
+ }[n];
1526
+ if (x) { return '\\' + x; }
1527
+ return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
1528
+ }
1529
+
1530
+ function markBoxed(str) {
1531
+ return 'Object(' + str + ')';
1532
+ }
1533
+
1534
+ function weakCollectionOf(type) {
1535
+ return type + ' { ? }';
1536
+ }
1537
+
1538
+ function collectionOf(type, size, entries, indent) {
1539
+ var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
1540
+ return type + ' (' + size + ') {' + joinedEntries + '}';
1541
+ }
1542
+
1543
+ function singleLineValues(xs) {
1544
+ for (var i = 0; i < xs.length; i++) {
1545
+ if (indexOf(xs[i], '\n') >= 0) {
1546
+ return false;
1547
+ }
1548
+ }
1549
+ return true;
1550
+ }
1551
+
1552
+ function getIndent(opts, depth) {
1553
+ var baseIndent;
1554
+ if (opts.indent === '\t') {
1555
+ baseIndent = '\t';
1556
+ } else if (typeof opts.indent === 'number' && opts.indent > 0) {
1557
+ baseIndent = $join.call(Array(opts.indent + 1), ' ');
1558
+ } else {
1559
+ return null;
1560
+ }
1561
+ return {
1562
+ base: baseIndent,
1563
+ prev: $join.call(Array(depth + 1), baseIndent)
1564
+ };
1565
+ }
1566
+
1567
+ function indentedJoin(xs, indent) {
1568
+ if (xs.length === 0) { return ''; }
1569
+ var lineJoiner = '\n' + indent.prev + indent.base;
1570
+ return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
1571
+ }
1572
+
1573
+ function arrObjKeys(obj, inspect) {
1574
+ var isArr = isArray$3(obj);
1575
+ var xs = [];
1576
+ if (isArr) {
1577
+ xs.length = obj.length;
1578
+ for (var i = 0; i < obj.length; i++) {
1579
+ xs[i] = has$3(obj, i) ? inspect(obj[i], obj) : '';
1580
+ }
1581
+ }
1582
+ var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
1583
+ var symMap;
1584
+ if (hasShammedSymbols) {
1585
+ symMap = {};
1586
+ for (var k = 0; k < syms.length; k++) {
1587
+ symMap['$' + syms[k]] = syms[k];
1588
+ }
1589
+ }
1590
+
1591
+ for (var key in obj) { // eslint-disable-line no-restricted-syntax
1592
+ if (!has$3(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1593
+ if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1594
+ if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1595
+ // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
1596
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
1597
+ } else if ($test.call(/[^\w$]/, key)) {
1598
+ xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
1599
+ } else {
1600
+ xs.push(key + ': ' + inspect(obj[key], obj));
1601
+ }
1602
+ }
1603
+ if (typeof gOPS === 'function') {
1604
+ for (var j = 0; j < syms.length; j++) {
1605
+ if (isEnumerable.call(obj, syms[j])) {
1606
+ xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
1607
+ }
1608
+ }
1609
+ }
1610
+ return xs;
1611
+ }
1612
+
1613
+ var GetIntrinsic = getIntrinsic;
1614
+ var callBound = callBound$1;
1615
+ var inspect = objectInspect;
1616
+
1617
+ var $TypeError = GetIntrinsic('%TypeError%');
1618
+ var $WeakMap = GetIntrinsic('%WeakMap%', true);
1619
+ var $Map = GetIntrinsic('%Map%', true);
1620
+
1621
+ var $weakMapGet = callBound('WeakMap.prototype.get', true);
1622
+ var $weakMapSet = callBound('WeakMap.prototype.set', true);
1623
+ var $weakMapHas = callBound('WeakMap.prototype.has', true);
1624
+ var $mapGet = callBound('Map.prototype.get', true);
1625
+ var $mapSet = callBound('Map.prototype.set', true);
1626
+ var $mapHas = callBound('Map.prototype.has', true);
1627
+
1628
+ /*
1629
+ * This function traverses the list returning the node corresponding to the
1630
+ * given key.
1631
+ *
1632
+ * That node is also moved to the head of the list, so that if it's accessed
1633
+ * again we don't need to traverse the whole list. By doing so, all the recently
1634
+ * used nodes can be accessed relatively quickly.
1635
+ */
1636
+ var listGetNode = function (list, key) { // eslint-disable-line consistent-return
1637
+ for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
1638
+ if (curr.key === key) {
1639
+ prev.next = curr.next;
1640
+ curr.next = list.next;
1641
+ list.next = curr; // eslint-disable-line no-param-reassign
1642
+ return curr;
1014
1643
  }
1644
+ }
1645
+ };
1015
1646
 
1016
- for (const key of Object.keys(ret)) {
1017
- const value = ret[key];
1018
- if (typeof value === 'object' && value !== null) {
1019
- for (const k of Object.keys(value)) {
1020
- value[k] = parseValue(value[k], options);
1647
+ var listGet = function (objects, key) {
1648
+ var node = listGetNode(objects, key);
1649
+ return node && node.value;
1650
+ };
1651
+ var listSet = function (objects, key, value) {
1652
+ var node = listGetNode(objects, key);
1653
+ if (node) {
1654
+ node.value = value;
1655
+ } else {
1656
+ // Prepend the new node to the beginning of the list
1657
+ objects.next = { // eslint-disable-line no-param-reassign
1658
+ key: key,
1659
+ next: objects.next,
1660
+ value: value
1661
+ };
1662
+ }
1663
+ };
1664
+ var listHas = function (objects, key) {
1665
+ return !!listGetNode(objects, key);
1666
+ };
1667
+
1668
+ var sideChannel = function getSideChannel() {
1669
+ var $wm;
1670
+ var $m;
1671
+ var $o;
1672
+ var channel = {
1673
+ assert: function (key) {
1674
+ if (!channel.has(key)) {
1675
+ throw new $TypeError('Side channel does not contain ' + inspect(key));
1676
+ }
1677
+ },
1678
+ get: function (key) { // eslint-disable-line consistent-return
1679
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1680
+ if ($wm) {
1681
+ return $weakMapGet($wm, key);
1682
+ }
1683
+ } else if ($Map) {
1684
+ if ($m) {
1685
+ return $mapGet($m, key);
1021
1686
  }
1022
1687
  } else {
1023
- ret[key] = parseValue(value, options);
1688
+ if ($o) { // eslint-disable-line no-lonely-if
1689
+ return listGet($o, key);
1690
+ }
1691
+ }
1692
+ },
1693
+ has: function (key) {
1694
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1695
+ if ($wm) {
1696
+ return $weakMapHas($wm, key);
1697
+ }
1698
+ } else if ($Map) {
1699
+ if ($m) {
1700
+ return $mapHas($m, key);
1701
+ }
1702
+ } else {
1703
+ if ($o) { // eslint-disable-line no-lonely-if
1704
+ return listHas($o, key);
1705
+ }
1706
+ }
1707
+ return false;
1708
+ },
1709
+ set: function (key, value) {
1710
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1711
+ if (!$wm) {
1712
+ $wm = new $WeakMap();
1713
+ }
1714
+ $weakMapSet($wm, key, value);
1715
+ } else if ($Map) {
1716
+ if (!$m) {
1717
+ $m = new $Map();
1718
+ }
1719
+ $mapSet($m, key, value);
1720
+ } else {
1721
+ if (!$o) {
1722
+ /*
1723
+ * Initialize the linked list as an empty node, so that we don't have
1724
+ * to special-case handling of the first node: we can always refer to
1725
+ * it as (previous node).next, instead of something like (list).head
1726
+ */
1727
+ $o = { key: {}, next: null };
1728
+ }
1729
+ listSet($o, key, value);
1024
1730
  }
1025
1731
  }
1732
+ };
1733
+ return channel;
1734
+ };
1026
1735
 
1027
- if (options.sort === false) {
1028
- return ret;
1029
- }
1736
+ var replace = String.prototype.replace;
1737
+ var percentTwenties = /%20/g;
1030
1738
 
1031
- return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
1032
- const value = ret[key];
1033
- if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
1034
- // Sort object keys, not values
1035
- result[key] = keysSorter(value);
1036
- } else {
1037
- result[key] = value;
1038
- }
1739
+ var Format = {
1740
+ RFC1738: 'RFC1738',
1741
+ RFC3986: 'RFC3986'
1742
+ };
1039
1743
 
1040
- return result;
1041
- }, Object.create(null));
1042
- }
1744
+ var formats$3 = {
1745
+ 'default': Format.RFC3986,
1746
+ formatters: {
1747
+ RFC1738: function (value) {
1748
+ return replace.call(value, percentTwenties, '+');
1749
+ },
1750
+ RFC3986: function (value) {
1751
+ return String(value);
1752
+ }
1753
+ },
1754
+ RFC1738: Format.RFC1738,
1755
+ RFC3986: Format.RFC3986
1756
+ };
1043
1757
 
1044
- exports.extract = extract;
1045
- exports.parse = parse;
1758
+ var formats$2 = formats$3;
1046
1759
 
1047
- exports.stringify = (object, options) => {
1048
- if (!object) {
1049
- return '';
1050
- }
1760
+ var has$2 = Object.prototype.hasOwnProperty;
1761
+ var isArray$2 = Array.isArray;
1051
1762
 
1052
- options = Object.assign({
1053
- encode: true,
1054
- strict: true,
1055
- arrayFormat: 'none',
1056
- arrayFormatSeparator: ','
1057
- }, options);
1763
+ var hexTable = (function () {
1764
+ var array = [];
1765
+ for (var i = 0; i < 256; ++i) {
1766
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
1767
+ }
1058
1768
 
1059
- validateArrayFormatSeparator(options.arrayFormatSeparator);
1769
+ return array;
1770
+ }());
1060
1771
 
1061
- const shouldFilter = key => (
1062
- (options.skipNull && isNullOrUndefined(object[key])) ||
1063
- (options.skipEmptyString && object[key] === '')
1064
- );
1772
+ var compactQueue = function compactQueue(queue) {
1773
+ while (queue.length > 1) {
1774
+ var item = queue.pop();
1775
+ var obj = item.obj[item.prop];
1065
1776
 
1066
- const formatter = encoderForArrayFormat(options);
1777
+ if (isArray$2(obj)) {
1778
+ var compacted = [];
1067
1779
 
1068
- const objectCopy = {};
1780
+ for (var j = 0; j < obj.length; ++j) {
1781
+ if (typeof obj[j] !== 'undefined') {
1782
+ compacted.push(obj[j]);
1783
+ }
1784
+ }
1069
1785
 
1070
- for (const key of Object.keys(object)) {
1071
- if (!shouldFilter(key)) {
1072
- objectCopy[key] = object[key];
1073
- }
1074
- }
1786
+ item.obj[item.prop] = compacted;
1787
+ }
1788
+ }
1789
+ };
1075
1790
 
1076
- const keys = Object.keys(objectCopy);
1791
+ var arrayToObject = function arrayToObject(source, options) {
1792
+ var obj = options && options.plainObjects ? Object.create(null) : {};
1793
+ for (var i = 0; i < source.length; ++i) {
1794
+ if (typeof source[i] !== 'undefined') {
1795
+ obj[i] = source[i];
1796
+ }
1797
+ }
1077
1798
 
1078
- if (options.sort !== false) {
1079
- keys.sort(options.sort);
1080
- }
1799
+ return obj;
1800
+ };
1081
1801
 
1082
- return keys.map(key => {
1083
- const value = object[key];
1802
+ var merge = function merge(target, source, options) {
1803
+ /* eslint no-param-reassign: 0 */
1804
+ if (!source) {
1805
+ return target;
1806
+ }
1084
1807
 
1085
- if (value === undefined) {
1086
- return '';
1087
- }
1808
+ if (typeof source !== 'object') {
1809
+ if (isArray$2(target)) {
1810
+ target.push(source);
1811
+ } else if (target && typeof target === 'object') {
1812
+ if ((options && (options.plainObjects || options.allowPrototypes)) || !has$2.call(Object.prototype, source)) {
1813
+ target[source] = true;
1814
+ }
1815
+ } else {
1816
+ return [target, source];
1817
+ }
1088
1818
 
1089
- if (value === null) {
1090
- return encode(key, options);
1091
- }
1819
+ return target;
1820
+ }
1092
1821
 
1093
- if (Array.isArray(value)) {
1094
- if (value.length === 0 && options.arrayFormat === 'bracket-separator') {
1095
- return encode(key, options) + '[]';
1096
- }
1822
+ if (!target || typeof target !== 'object') {
1823
+ return [target].concat(source);
1824
+ }
1097
1825
 
1098
- return value
1099
- .reduce(formatter(key), [])
1100
- .join('&');
1101
- }
1826
+ var mergeTarget = target;
1827
+ if (isArray$2(target) && !isArray$2(source)) {
1828
+ mergeTarget = arrayToObject(target, options);
1829
+ }
1102
1830
 
1103
- return encode(key, options) + '=' + encode(value, options);
1104
- }).filter(x => x.length > 0).join('&');
1105
- };
1831
+ if (isArray$2(target) && isArray$2(source)) {
1832
+ source.forEach(function (item, i) {
1833
+ if (has$2.call(target, i)) {
1834
+ var targetItem = target[i];
1835
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
1836
+ target[i] = merge(targetItem, item, options);
1837
+ } else {
1838
+ target.push(item);
1839
+ }
1840
+ } else {
1841
+ target[i] = item;
1842
+ }
1843
+ });
1844
+ return target;
1845
+ }
1106
1846
 
1107
- exports.parseUrl = (url, options) => {
1108
- options = Object.assign({
1109
- decode: true
1110
- }, options);
1847
+ return Object.keys(source).reduce(function (acc, key) {
1848
+ var value = source[key];
1111
1849
 
1112
- const [url_, hash] = splitOnFirst$1(url, '#');
1850
+ if (has$2.call(acc, key)) {
1851
+ acc[key] = merge(acc[key], value, options);
1852
+ } else {
1853
+ acc[key] = value;
1854
+ }
1855
+ return acc;
1856
+ }, mergeTarget);
1857
+ };
1113
1858
 
1114
- return Object.assign(
1115
- {
1116
- url: url_.split('?')[0] || '',
1117
- query: parse(extract(url), options)
1118
- },
1119
- options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
1120
- );
1121
- };
1859
+ var assign = function assignSingleSource(target, source) {
1860
+ return Object.keys(source).reduce(function (acc, key) {
1861
+ acc[key] = source[key];
1862
+ return acc;
1863
+ }, target);
1864
+ };
1122
1865
 
1123
- exports.stringifyUrl = (object, options) => {
1124
- options = Object.assign({
1125
- encode: true,
1126
- strict: true,
1127
- [encodeFragmentIdentifier]: true
1128
- }, options);
1129
-
1130
- const url = removeHash(object.url).split('?')[0] || '';
1131
- const queryFromUrl = exports.extract(object.url);
1132
- const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
1133
-
1134
- const query = Object.assign(parsedQueryFromUrl, object.query);
1135
- let queryString = exports.stringify(query, options);
1136
- if (queryString) {
1137
- queryString = `?${queryString}`;
1138
- }
1866
+ var decode = function (str, decoder, charset) {
1867
+ var strWithoutPlus = str.replace(/\+/g, ' ');
1868
+ if (charset === 'iso-8859-1') {
1869
+ // unescape never throws, no try...catch needed:
1870
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1871
+ }
1872
+ // utf-8
1873
+ try {
1874
+ return decodeURIComponent(strWithoutPlus);
1875
+ } catch (e) {
1876
+ return strWithoutPlus;
1877
+ }
1878
+ };
1139
1879
 
1140
- let hash = getHash(object.url);
1141
- if (object.fragmentIdentifier) {
1142
- hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`;
1143
- }
1880
+ var encode = function encode(str, defaultEncoder, charset, kind, format) {
1881
+ // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
1882
+ // It has been adapted here for stricter adherence to RFC 3986
1883
+ if (str.length === 0) {
1884
+ return str;
1885
+ }
1144
1886
 
1145
- return `${url}${queryString}${hash}`;
1146
- };
1887
+ var string = str;
1888
+ if (typeof str === 'symbol') {
1889
+ string = Symbol.prototype.toString.call(str);
1890
+ } else if (typeof str !== 'string') {
1891
+ string = String(str);
1892
+ }
1147
1893
 
1148
- exports.pick = (input, filter, options) => {
1149
- options = Object.assign({
1150
- parseFragmentIdentifier: true,
1151
- [encodeFragmentIdentifier]: false
1152
- }, options);
1153
-
1154
- const {url, query, fragmentIdentifier} = exports.parseUrl(input, options);
1155
- return exports.stringifyUrl({
1156
- url,
1157
- query: filterObject(query, filter),
1158
- fragmentIdentifier
1159
- }, options);
1160
- };
1894
+ if (charset === 'iso-8859-1') {
1895
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
1896
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
1897
+ });
1898
+ }
1161
1899
 
1162
- exports.exclude = (input, filter, options) => {
1163
- const exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value);
1900
+ var out = '';
1901
+ for (var i = 0; i < string.length; ++i) {
1902
+ var c = string.charCodeAt(i);
1903
+
1904
+ if (
1905
+ c === 0x2D // -
1906
+ || c === 0x2E // .
1907
+ || c === 0x5F // _
1908
+ || c === 0x7E // ~
1909
+ || (c >= 0x30 && c <= 0x39) // 0-9
1910
+ || (c >= 0x41 && c <= 0x5A) // a-z
1911
+ || (c >= 0x61 && c <= 0x7A) // A-Z
1912
+ || (format === formats$2.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
1913
+ ) {
1914
+ out += string.charAt(i);
1915
+ continue;
1916
+ }
1164
1917
 
1165
- return exports.pick(input, exclusionFilter, options);
1166
- };
1167
- } (queryString));
1918
+ if (c < 0x80) {
1919
+ out = out + hexTable[c];
1920
+ continue;
1921
+ }
1922
+
1923
+ if (c < 0x800) {
1924
+ out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
1925
+ continue;
1926
+ }
1927
+
1928
+ if (c < 0xD800 || c >= 0xE000) {
1929
+ out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
1930
+ continue;
1931
+ }
1932
+
1933
+ i += 1;
1934
+ c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
1935
+ /* eslint operator-linebreak: [2, "before"] */
1936
+ out += hexTable[0xF0 | (c >> 18)]
1937
+ + hexTable[0x80 | ((c >> 12) & 0x3F)]
1938
+ + hexTable[0x80 | ((c >> 6) & 0x3F)]
1939
+ + hexTable[0x80 | (c & 0x3F)];
1940
+ }
1941
+
1942
+ return out;
1943
+ };
1944
+
1945
+ var compact = function compact(value) {
1946
+ var queue = [{ obj: { o: value }, prop: 'o' }];
1947
+ var refs = [];
1948
+
1949
+ for (var i = 0; i < queue.length; ++i) {
1950
+ var item = queue[i];
1951
+ var obj = item.obj[item.prop];
1952
+
1953
+ var keys = Object.keys(obj);
1954
+ for (var j = 0; j < keys.length; ++j) {
1955
+ var key = keys[j];
1956
+ var val = obj[key];
1957
+ if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
1958
+ queue.push({ obj: obj, prop: key });
1959
+ refs.push(val);
1960
+ }
1961
+ }
1962
+ }
1963
+
1964
+ compactQueue(queue);
1965
+
1966
+ return value;
1967
+ };
1968
+
1969
+ var isRegExp = function isRegExp(obj) {
1970
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
1971
+ };
1972
+
1973
+ var isBuffer = function isBuffer(obj) {
1974
+ if (!obj || typeof obj !== 'object') {
1975
+ return false;
1976
+ }
1977
+
1978
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
1979
+ };
1980
+
1981
+ var combine = function combine(a, b) {
1982
+ return [].concat(a, b);
1983
+ };
1984
+
1985
+ var maybeMap = function maybeMap(val, fn) {
1986
+ if (isArray$2(val)) {
1987
+ var mapped = [];
1988
+ for (var i = 0; i < val.length; i += 1) {
1989
+ mapped.push(fn(val[i]));
1990
+ }
1991
+ return mapped;
1992
+ }
1993
+ return fn(val);
1994
+ };
1995
+
1996
+ var utils$2 = {
1997
+ arrayToObject: arrayToObject,
1998
+ assign: assign,
1999
+ combine: combine,
2000
+ compact: compact,
2001
+ decode: decode,
2002
+ encode: encode,
2003
+ isBuffer: isBuffer,
2004
+ isRegExp: isRegExp,
2005
+ maybeMap: maybeMap,
2006
+ merge: merge
2007
+ };
2008
+
2009
+ var getSideChannel = sideChannel;
2010
+ var utils$1 = utils$2;
2011
+ var formats$1 = formats$3;
2012
+ var has$1 = Object.prototype.hasOwnProperty;
2013
+
2014
+ var arrayPrefixGenerators = {
2015
+ brackets: function brackets(prefix) {
2016
+ return prefix + '[]';
2017
+ },
2018
+ comma: 'comma',
2019
+ indices: function indices(prefix, key) {
2020
+ return prefix + '[' + key + ']';
2021
+ },
2022
+ repeat: function repeat(prefix) {
2023
+ return prefix;
2024
+ }
2025
+ };
2026
+
2027
+ var isArray$1 = Array.isArray;
2028
+ var split = String.prototype.split;
2029
+ var push = Array.prototype.push;
2030
+ var pushToArray = function (arr, valueOrArray) {
2031
+ push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
2032
+ };
2033
+
2034
+ var toISO = Date.prototype.toISOString;
2035
+
2036
+ var defaultFormat = formats$1['default'];
2037
+ var defaults$1 = {
2038
+ addQueryPrefix: false,
2039
+ allowDots: false,
2040
+ charset: 'utf-8',
2041
+ charsetSentinel: false,
2042
+ delimiter: '&',
2043
+ encode: true,
2044
+ encoder: utils$1.encode,
2045
+ encodeValuesOnly: false,
2046
+ format: defaultFormat,
2047
+ formatter: formats$1.formatters[defaultFormat],
2048
+ // deprecated
2049
+ indices: false,
2050
+ serializeDate: function serializeDate(date) {
2051
+ return toISO.call(date);
2052
+ },
2053
+ skipNulls: false,
2054
+ strictNullHandling: false
2055
+ };
2056
+
2057
+ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
2058
+ return typeof v === 'string'
2059
+ || typeof v === 'number'
2060
+ || typeof v === 'boolean'
2061
+ || typeof v === 'symbol'
2062
+ || typeof v === 'bigint';
2063
+ };
2064
+
2065
+ var sentinel = {};
2066
+
2067
+ var stringify$1 = function stringify(
2068
+ object,
2069
+ prefix,
2070
+ generateArrayPrefix,
2071
+ commaRoundTrip,
2072
+ strictNullHandling,
2073
+ skipNulls,
2074
+ encoder,
2075
+ filter,
2076
+ sort,
2077
+ allowDots,
2078
+ serializeDate,
2079
+ format,
2080
+ formatter,
2081
+ encodeValuesOnly,
2082
+ charset,
2083
+ sideChannel
2084
+ ) {
2085
+ var obj = object;
2086
+
2087
+ var tmpSc = sideChannel;
2088
+ var step = 0;
2089
+ var findFlag = false;
2090
+ while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
2091
+ // Where object last appeared in the ref tree
2092
+ var pos = tmpSc.get(object);
2093
+ step += 1;
2094
+ if (typeof pos !== 'undefined') {
2095
+ if (pos === step) {
2096
+ throw new RangeError('Cyclic object value');
2097
+ } else {
2098
+ findFlag = true; // Break while
2099
+ }
2100
+ }
2101
+ if (typeof tmpSc.get(sentinel) === 'undefined') {
2102
+ step = 0;
2103
+ }
2104
+ }
2105
+
2106
+ if (typeof filter === 'function') {
2107
+ obj = filter(prefix, obj);
2108
+ } else if (obj instanceof Date) {
2109
+ obj = serializeDate(obj);
2110
+ } else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
2111
+ obj = utils$1.maybeMap(obj, function (value) {
2112
+ if (value instanceof Date) {
2113
+ return serializeDate(value);
2114
+ }
2115
+ return value;
2116
+ });
2117
+ }
2118
+
2119
+ if (obj === null) {
2120
+ if (strictNullHandling) {
2121
+ return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
2122
+ }
2123
+
2124
+ obj = '';
2125
+ }
2126
+
2127
+ if (isNonNullishPrimitive(obj) || utils$1.isBuffer(obj)) {
2128
+ if (encoder) {
2129
+ var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, 'key', format);
2130
+ if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
2131
+ var valuesArray = split.call(String(obj), ',');
2132
+ var valuesJoined = '';
2133
+ for (var i = 0; i < valuesArray.length; ++i) {
2134
+ valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults$1.encoder, charset, 'value', format));
2135
+ }
2136
+ return [formatter(keyValue) + (commaRoundTrip && isArray$1(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
2137
+ }
2138
+ return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder, charset, 'value', format))];
2139
+ }
2140
+ return [formatter(prefix) + '=' + formatter(String(obj))];
2141
+ }
2142
+
2143
+ var values = [];
2144
+
2145
+ if (typeof obj === 'undefined') {
2146
+ return values;
2147
+ }
2148
+
2149
+ var objKeys;
2150
+ if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
2151
+ // we need to join elements in
2152
+ objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
2153
+ } else if (isArray$1(filter)) {
2154
+ objKeys = filter;
2155
+ } else {
2156
+ var keys = Object.keys(obj);
2157
+ objKeys = sort ? keys.sort(sort) : keys;
2158
+ }
2159
+
2160
+ var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix + '[]' : prefix;
2161
+
2162
+ for (var j = 0; j < objKeys.length; ++j) {
2163
+ var key = objKeys[j];
2164
+ var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
2165
+
2166
+ if (skipNulls && value === null) {
2167
+ continue;
2168
+ }
2169
+
2170
+ var keyPrefix = isArray$1(obj)
2171
+ ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
2172
+ : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
2173
+
2174
+ sideChannel.set(object, step);
2175
+ var valueSideChannel = getSideChannel();
2176
+ valueSideChannel.set(sentinel, sideChannel);
2177
+ pushToArray(values, stringify(
2178
+ value,
2179
+ keyPrefix,
2180
+ generateArrayPrefix,
2181
+ commaRoundTrip,
2182
+ strictNullHandling,
2183
+ skipNulls,
2184
+ encoder,
2185
+ filter,
2186
+ sort,
2187
+ allowDots,
2188
+ serializeDate,
2189
+ format,
2190
+ formatter,
2191
+ encodeValuesOnly,
2192
+ charset,
2193
+ valueSideChannel
2194
+ ));
2195
+ }
2196
+
2197
+ return values;
2198
+ };
2199
+
2200
+ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
2201
+ if (!opts) {
2202
+ return defaults$1;
2203
+ }
2204
+
2205
+ if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
2206
+ throw new TypeError('Encoder has to be a function.');
2207
+ }
2208
+
2209
+ var charset = opts.charset || defaults$1.charset;
2210
+ if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2211
+ throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2212
+ }
2213
+
2214
+ var format = formats$1['default'];
2215
+ if (typeof opts.format !== 'undefined') {
2216
+ if (!has$1.call(formats$1.formatters, opts.format)) {
2217
+ throw new TypeError('Unknown format option provided.');
2218
+ }
2219
+ format = opts.format;
2220
+ }
2221
+ var formatter = formats$1.formatters[format];
2222
+
2223
+ var filter = defaults$1.filter;
2224
+ if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
2225
+ filter = opts.filter;
2226
+ }
2227
+
2228
+ return {
2229
+ addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$1.addQueryPrefix,
2230
+ allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
2231
+ charset: charset,
2232
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
2233
+ delimiter: typeof opts.delimiter === 'undefined' ? defaults$1.delimiter : opts.delimiter,
2234
+ encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$1.encode,
2235
+ encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$1.encoder,
2236
+ encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly,
2237
+ filter: filter,
2238
+ format: format,
2239
+ formatter: formatter,
2240
+ serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$1.serializeDate,
2241
+ skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$1.skipNulls,
2242
+ sort: typeof opts.sort === 'function' ? opts.sort : null,
2243
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
2244
+ };
2245
+ };
2246
+
2247
+ var stringify_1 = function (object, opts) {
2248
+ var obj = object;
2249
+ var options = normalizeStringifyOptions(opts);
2250
+
2251
+ var objKeys;
2252
+ var filter;
2253
+
2254
+ if (typeof options.filter === 'function') {
2255
+ filter = options.filter;
2256
+ obj = filter('', obj);
2257
+ } else if (isArray$1(options.filter)) {
2258
+ filter = options.filter;
2259
+ objKeys = filter;
2260
+ }
2261
+
2262
+ var keys = [];
2263
+
2264
+ if (typeof obj !== 'object' || obj === null) {
2265
+ return '';
2266
+ }
2267
+
2268
+ var arrayFormat;
2269
+ if (opts && opts.arrayFormat in arrayPrefixGenerators) {
2270
+ arrayFormat = opts.arrayFormat;
2271
+ } else if (opts && 'indices' in opts) {
2272
+ arrayFormat = opts.indices ? 'indices' : 'repeat';
2273
+ } else {
2274
+ arrayFormat = 'indices';
2275
+ }
2276
+
2277
+ var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
2278
+ if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
2279
+ throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
2280
+ }
2281
+ var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
2282
+
2283
+ if (!objKeys) {
2284
+ objKeys = Object.keys(obj);
2285
+ }
2286
+
2287
+ if (options.sort) {
2288
+ objKeys.sort(options.sort);
2289
+ }
2290
+
2291
+ var sideChannel = getSideChannel();
2292
+ for (var i = 0; i < objKeys.length; ++i) {
2293
+ var key = objKeys[i];
2294
+
2295
+ if (options.skipNulls && obj[key] === null) {
2296
+ continue;
2297
+ }
2298
+ pushToArray(keys, stringify$1(
2299
+ obj[key],
2300
+ key,
2301
+ generateArrayPrefix,
2302
+ commaRoundTrip,
2303
+ options.strictNullHandling,
2304
+ options.skipNulls,
2305
+ options.encode ? options.encoder : null,
2306
+ options.filter,
2307
+ options.sort,
2308
+ options.allowDots,
2309
+ options.serializeDate,
2310
+ options.format,
2311
+ options.formatter,
2312
+ options.encodeValuesOnly,
2313
+ options.charset,
2314
+ sideChannel
2315
+ ));
2316
+ }
2317
+
2318
+ var joined = keys.join(options.delimiter);
2319
+ var prefix = options.addQueryPrefix === true ? '?' : '';
2320
+
2321
+ if (options.charsetSentinel) {
2322
+ if (options.charset === 'iso-8859-1') {
2323
+ // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
2324
+ prefix += 'utf8=%26%2310003%3B&';
2325
+ } else {
2326
+ // encodeURIComponent('✓')
2327
+ prefix += 'utf8=%E2%9C%93&';
2328
+ }
2329
+ }
2330
+
2331
+ return joined.length > 0 ? prefix + joined : '';
2332
+ };
2333
+
2334
+ var utils = utils$2;
2335
+
2336
+ var has = Object.prototype.hasOwnProperty;
2337
+ var isArray = Array.isArray;
2338
+
2339
+ var defaults = {
2340
+ allowDots: false,
2341
+ allowPrototypes: false,
2342
+ allowSparse: false,
2343
+ arrayLimit: 20,
2344
+ charset: 'utf-8',
2345
+ charsetSentinel: false,
2346
+ comma: false,
2347
+ decoder: utils.decode,
2348
+ delimiter: '&',
2349
+ depth: 5,
2350
+ ignoreQueryPrefix: false,
2351
+ interpretNumericEntities: false,
2352
+ parameterLimit: 1000,
2353
+ parseArrays: true,
2354
+ plainObjects: false,
2355
+ strictNullHandling: false
2356
+ };
2357
+
2358
+ var interpretNumericEntities = function (str) {
2359
+ return str.replace(/&#(\d+);/g, function ($0, numberStr) {
2360
+ return String.fromCharCode(parseInt(numberStr, 10));
2361
+ });
2362
+ };
2363
+
2364
+ var parseArrayValue = function (val, options) {
2365
+ if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
2366
+ return val.split(',');
2367
+ }
2368
+
2369
+ return val;
2370
+ };
2371
+
2372
+ // This is what browsers will submit when the ✓ character occurs in an
2373
+ // application/x-www-form-urlencoded body and the encoding of the page containing
2374
+ // the form is iso-8859-1, or when the submitted form has an accept-charset
2375
+ // attribute of iso-8859-1. Presumably also with other charsets that do not contain
2376
+ // the ✓ character, such as us-ascii.
2377
+ var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
2378
+
2379
+ // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
2380
+ var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
2381
+
2382
+ var parseValues = function parseQueryStringValues(str, options) {
2383
+ var obj = {};
2384
+ var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
2385
+ var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
2386
+ var parts = cleanStr.split(options.delimiter, limit);
2387
+ var skipIndex = -1; // Keep track of where the utf8 sentinel was found
2388
+ var i;
2389
+
2390
+ var charset = options.charset;
2391
+ if (options.charsetSentinel) {
2392
+ for (i = 0; i < parts.length; ++i) {
2393
+ if (parts[i].indexOf('utf8=') === 0) {
2394
+ if (parts[i] === charsetSentinel) {
2395
+ charset = 'utf-8';
2396
+ } else if (parts[i] === isoSentinel) {
2397
+ charset = 'iso-8859-1';
2398
+ }
2399
+ skipIndex = i;
2400
+ i = parts.length; // The eslint settings do not allow break;
2401
+ }
2402
+ }
2403
+ }
2404
+
2405
+ for (i = 0; i < parts.length; ++i) {
2406
+ if (i === skipIndex) {
2407
+ continue;
2408
+ }
2409
+ var part = parts[i];
2410
+
2411
+ var bracketEqualsPos = part.indexOf(']=');
2412
+ var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
2413
+
2414
+ var key, val;
2415
+ if (pos === -1) {
2416
+ key = options.decoder(part, defaults.decoder, charset, 'key');
2417
+ val = options.strictNullHandling ? null : '';
2418
+ } else {
2419
+ key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
2420
+ val = utils.maybeMap(
2421
+ parseArrayValue(part.slice(pos + 1), options),
2422
+ function (encodedVal) {
2423
+ return options.decoder(encodedVal, defaults.decoder, charset, 'value');
2424
+ }
2425
+ );
2426
+ }
2427
+
2428
+ if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
2429
+ val = interpretNumericEntities(val);
2430
+ }
2431
+
2432
+ if (part.indexOf('[]=') > -1) {
2433
+ val = isArray(val) ? [val] : val;
2434
+ }
2435
+
2436
+ if (has.call(obj, key)) {
2437
+ obj[key] = utils.combine(obj[key], val);
2438
+ } else {
2439
+ obj[key] = val;
2440
+ }
2441
+ }
2442
+
2443
+ return obj;
2444
+ };
2445
+
2446
+ var parseObject = function (chain, val, options, valuesParsed) {
2447
+ var leaf = valuesParsed ? val : parseArrayValue(val, options);
2448
+
2449
+ for (var i = chain.length - 1; i >= 0; --i) {
2450
+ var obj;
2451
+ var root = chain[i];
2452
+
2453
+ if (root === '[]' && options.parseArrays) {
2454
+ obj = [].concat(leaf);
2455
+ } else {
2456
+ obj = options.plainObjects ? Object.create(null) : {};
2457
+ var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
2458
+ var index = parseInt(cleanRoot, 10);
2459
+ if (!options.parseArrays && cleanRoot === '') {
2460
+ obj = { 0: leaf };
2461
+ } else if (
2462
+ !isNaN(index)
2463
+ && root !== cleanRoot
2464
+ && String(index) === cleanRoot
2465
+ && index >= 0
2466
+ && (options.parseArrays && index <= options.arrayLimit)
2467
+ ) {
2468
+ obj = [];
2469
+ obj[index] = leaf;
2470
+ } else if (cleanRoot !== '__proto__') {
2471
+ obj[cleanRoot] = leaf;
2472
+ }
2473
+ }
2474
+
2475
+ leaf = obj;
2476
+ }
2477
+
2478
+ return leaf;
2479
+ };
2480
+
2481
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
2482
+ if (!givenKey) {
2483
+ return;
2484
+ }
2485
+
2486
+ // Transform dot notation to bracket notation
2487
+ var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
2488
+
2489
+ // The regex chunks
2490
+
2491
+ var brackets = /(\[[^[\]]*])/;
2492
+ var child = /(\[[^[\]]*])/g;
2493
+
2494
+ // Get the parent
2495
+
2496
+ var segment = options.depth > 0 && brackets.exec(key);
2497
+ var parent = segment ? key.slice(0, segment.index) : key;
2498
+
2499
+ // Stash the parent if it exists
2500
+
2501
+ var keys = [];
2502
+ if (parent) {
2503
+ // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
2504
+ if (!options.plainObjects && has.call(Object.prototype, parent)) {
2505
+ if (!options.allowPrototypes) {
2506
+ return;
2507
+ }
2508
+ }
2509
+
2510
+ keys.push(parent);
2511
+ }
2512
+
2513
+ // Loop through children appending to the array until we hit depth
2514
+
2515
+ var i = 0;
2516
+ while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
2517
+ i += 1;
2518
+ if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
2519
+ if (!options.allowPrototypes) {
2520
+ return;
2521
+ }
2522
+ }
2523
+ keys.push(segment[1]);
2524
+ }
2525
+
2526
+ // If there's a remainder, just add whatever is left
2527
+
2528
+ if (segment) {
2529
+ keys.push('[' + key.slice(segment.index) + ']');
2530
+ }
2531
+
2532
+ return parseObject(keys, val, options, valuesParsed);
2533
+ };
2534
+
2535
+ var normalizeParseOptions = function normalizeParseOptions(opts) {
2536
+ if (!opts) {
2537
+ return defaults;
2538
+ }
2539
+
2540
+ if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
2541
+ throw new TypeError('Decoder has to be a function.');
2542
+ }
2543
+
2544
+ if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2545
+ throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2546
+ }
2547
+ var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
2548
+
2549
+ return {
2550
+ allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
2551
+ allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
2552
+ allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
2553
+ arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
2554
+ charset: charset,
2555
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
2556
+ comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
2557
+ decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
2558
+ delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
2559
+ // eslint-disable-next-line no-implicit-coercion, no-extra-parens
2560
+ depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
2561
+ ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
2562
+ interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
2563
+ parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
2564
+ parseArrays: opts.parseArrays !== false,
2565
+ plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
2566
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
2567
+ };
2568
+ };
2569
+
2570
+ var parse$1 = function (str, opts) {
2571
+ var options = normalizeParseOptions(opts);
2572
+
2573
+ if (str === '' || str === null || typeof str === 'undefined') {
2574
+ return options.plainObjects ? Object.create(null) : {};
2575
+ }
2576
+
2577
+ var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
2578
+ var obj = options.plainObjects ? Object.create(null) : {};
2579
+
2580
+ // Iterate over the keys and setup the new object
2581
+
2582
+ var keys = Object.keys(tempObj);
2583
+ for (var i = 0; i < keys.length; ++i) {
2584
+ var key = keys[i];
2585
+ var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
2586
+ obj = utils.merge(obj, newObj, options);
2587
+ }
2588
+
2589
+ if (options.allowSparse === true) {
2590
+ return obj;
2591
+ }
2592
+
2593
+ return utils.compact(obj);
2594
+ };
2595
+
2596
+ var stringify = stringify_1;
2597
+ var parse = parse$1;
2598
+ var formats = formats$3;
2599
+
2600
+ var lib = {
2601
+ formats: formats,
2602
+ parse: parse,
2603
+ stringify: stringify
2604
+ };
1168
2605
 
1169
2606
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1170
2607
 
@@ -1197,8 +2634,6 @@ var copyToClipboard = /*#__PURE__*/function () {
1197
2634
  showToastr,
1198
2635
  _ref2$message,
1199
2636
  message,
1200
- _require,
1201
- Toastr,
1202
2637
  textArea,
1203
2638
  _args = arguments;
1204
2639
 
@@ -1207,27 +2642,21 @@ var copyToClipboard = /*#__PURE__*/function () {
1207
2642
  switch (_context.prev = _context.next) {
1208
2643
  case 0:
1209
2644
  _ref2 = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}, _ref2$showToastr = _ref2.showToastr, showToastr = _ref2$showToastr === void 0 ? true : _ref2$showToastr, _ref2$message = _ref2.message, message = _ref2$message === void 0 ? i18next__default["default"].t("neetoCommons.toastr.success.copiedToClipboard") : _ref2$message;
1210
-
1211
- /*
1212
- This is a workaround to prevent the jest tests from failing. Once the issue in neetoUI
1213
- https://github.com/bigbinary/neeto-ui/issues/1175 is resolved, this import can be moved to the top of the file.
1214
- */
1215
- _require = require("@bigbinary/neetoui"), Toastr = _require.Toastr;
1216
- _context.prev = 2;
2645
+ _context.prev = 1;
1217
2646
 
1218
2647
  if (!(navigator.clipboard && window.isSecureContext)) {
1219
- _context.next = 8;
2648
+ _context.next = 7;
1220
2649
  break;
1221
2650
  }
1222
2651
 
1223
- _context.next = 6;
2652
+ _context.next = 5;
1224
2653
  return navigator.clipboard.writeText(text);
1225
2654
 
1226
- case 6:
1227
- _context.next = 18;
2655
+ case 5:
2656
+ _context.next = 17;
1228
2657
  break;
1229
2658
 
1230
- case 8:
2659
+ case 7:
1231
2660
  textArea = document.createElement("textarea");
1232
2661
  textArea.value = text;
1233
2662
  textArea.style.top = "0";
@@ -1239,22 +2668,22 @@ var copyToClipboard = /*#__PURE__*/function () {
1239
2668
  document.execCommand("copy");
1240
2669
  document.body.removeChild(textArea);
1241
2670
 
1242
- case 18:
1243
- showToastr && Toastr.success(message);
1244
- _context.next = 24;
2671
+ case 17:
2672
+ showToastr && neetoui.Toastr.success(message);
2673
+ _context.next = 23;
1245
2674
  break;
1246
2675
 
1247
- case 21:
1248
- _context.prev = 21;
1249
- _context.t0 = _context["catch"](2);
1250
- Toastr.error(_context.t0);
2676
+ case 20:
2677
+ _context.prev = 20;
2678
+ _context.t0 = _context["catch"](1);
2679
+ neetoui.Toastr.error(_context.t0);
1251
2680
 
1252
- case 24:
2681
+ case 23:
1253
2682
  case "end":
1254
2683
  return _context.stop();
1255
2684
  }
1256
2685
  }
1257
- }, _callee, null, [[2, 21]]);
2686
+ }, _callee, null, [[1, 20]]);
1258
2687
  }));
1259
2688
 
1260
2689
  return function copyToClipboard(_x) {
@@ -1273,8 +2702,8 @@ var buildUrl = function buildUrl(route, params) {
1273
2702
  route = route.replace(":".concat(key), encodeURIComponent(value));
1274
2703
  }
1275
2704
  });
1276
- var queryParams = ramda.omit(placeHolders, params);
1277
- return ramda.isEmpty(queryParams) ? route : "".concat(route, "?").concat(queryString.stringify(queryParams));
2705
+ var queryParams = ramda.pipe(ramda.omit(placeHolders), preprocessForSerialization, lib.stringify)(params);
2706
+ return ramda.isEmpty(queryParams) ? route : "".concat(route, "?").concat(queryParams);
1278
2707
  };
1279
2708
 
1280
2709
  dayjs__default["default"].extend(relativeTime__default["default"]);