@sanity/assist 1.2.0 → 1.2.2

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/dist/index.js CHANGED
@@ -13,9 +13,7 @@ var isEqual = require('react-fast-compare');
13
13
  var rxjs = require('rxjs');
14
14
  var rxjsExhaustmapWithTrailing = require('rxjs-exhaustmap-with-trailing');
15
15
  var desk = require('sanity/desk');
16
- var require$$1 = require('tty');
17
- var require$$1$1 = require('util');
18
- var require$$0 = require('os');
16
+ var mutator = require('@sanity/mutator');
19
17
  var styled = require('styled-components');
20
18
  var dateFns = require('date-fns');
21
19
  var formatDistanceToNow = require('date-fns/formatDistanceToNow');
@@ -25,9 +23,6 @@ function _interopDefaultCompat(e) {
25
23
  };
26
24
  }
27
25
  var isEqual__default = /*#__PURE__*/_interopDefaultCompat(isEqual);
28
- var require$$1__default = /*#__PURE__*/_interopDefaultCompat(require$$1);
29
- var require$$1__default$1 = /*#__PURE__*/_interopDefaultCompat(require$$1$1);
30
- var require$$0__default = /*#__PURE__*/_interopDefaultCompat(require$$0);
31
26
  var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
32
27
  var formatDistanceToNow__default = /*#__PURE__*/_interopDefaultCompat(formatDistanceToNow);
33
28
  const assistDocumentIdPrefix = "sanity.assist.schemaType.";
@@ -525,3485 +520,6 @@ function prepareRebaseEvent(event) {
525
520
  }
526
521
  const SelectedFieldContext = react.createContext(void 0);
527
522
  const SelectedFieldContextProvider = SelectedFieldContext.Provider;
528
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
529
- function getDefaultExportFromCjs(x) {
530
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
531
- }
532
-
533
- /**
534
- * Appends the elements of `values` to `array`.
535
- *
536
- * @private
537
- * @param {Array} array The array to modify.
538
- * @param {Array} values The values to append.
539
- * @returns {Array} Returns `array`.
540
- */
541
-
542
- function arrayPush$1(array, values) {
543
- var index = -1,
544
- length = values.length,
545
- offset = array.length;
546
- while (++index < length) {
547
- array[offset + index] = values[index];
548
- }
549
- return array;
550
- }
551
- var _arrayPush = arrayPush$1;
552
-
553
- /** Detect free variable `global` from Node.js. */
554
-
555
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
556
- var _freeGlobal = freeGlobal$1;
557
- var freeGlobal = _freeGlobal;
558
-
559
- /** Detect free variable `self`. */
560
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
561
-
562
- /** Used as a reference to the global object. */
563
- var root$7 = freeGlobal || freeSelf || Function('return this')();
564
- var _root = root$7;
565
- var root$6 = _root;
566
-
567
- /** Built-in value references. */
568
- var Symbol$4 = root$6.Symbol;
569
- var _Symbol = Symbol$4;
570
- var Symbol$3 = _Symbol;
571
-
572
- /** Used for built-in method references. */
573
- var objectProto$5 = Object.prototype;
574
-
575
- /** Used to check objects for own properties. */
576
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
577
-
578
- /**
579
- * Used to resolve the
580
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
581
- * of values.
582
- */
583
- var nativeObjectToString$1 = objectProto$5.toString;
584
-
585
- /** Built-in value references. */
586
- var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : undefined;
587
-
588
- /**
589
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
590
- *
591
- * @private
592
- * @param {*} value The value to query.
593
- * @returns {string} Returns the raw `toStringTag`.
594
- */
595
- function getRawTag$1(value) {
596
- var isOwn = hasOwnProperty$4.call(value, symToStringTag$1),
597
- tag = value[symToStringTag$1];
598
- try {
599
- value[symToStringTag$1] = undefined;
600
- var unmasked = true;
601
- } catch (e) {}
602
- var result = nativeObjectToString$1.call(value);
603
- if (unmasked) {
604
- if (isOwn) {
605
- value[symToStringTag$1] = tag;
606
- } else {
607
- delete value[symToStringTag$1];
608
- }
609
- }
610
- return result;
611
- }
612
- var _getRawTag = getRawTag$1;
613
-
614
- /** Used for built-in method references. */
615
-
616
- var objectProto$4 = Object.prototype;
617
-
618
- /**
619
- * Used to resolve the
620
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
621
- * of values.
622
- */
623
- var nativeObjectToString = objectProto$4.toString;
624
-
625
- /**
626
- * Converts `value` to a string using `Object.prototype.toString`.
627
- *
628
- * @private
629
- * @param {*} value The value to convert.
630
- * @returns {string} Returns the converted string.
631
- */
632
- function objectToString$1(value) {
633
- return nativeObjectToString.call(value);
634
- }
635
- var _objectToString = objectToString$1;
636
- var Symbol$2 = _Symbol,
637
- getRawTag = _getRawTag,
638
- objectToString = _objectToString;
639
-
640
- /** `Object#toString` result references. */
641
- var nullTag = '[object Null]',
642
- undefinedTag = '[object Undefined]';
643
-
644
- /** Built-in value references. */
645
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
646
-
647
- /**
648
- * The base implementation of `getTag` without fallbacks for buggy environments.
649
- *
650
- * @private
651
- * @param {*} value The value to query.
652
- * @returns {string} Returns the `toStringTag`.
653
- */
654
- function baseGetTag$3(value) {
655
- if (value == null) {
656
- return value === undefined ? undefinedTag : nullTag;
657
- }
658
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
659
- }
660
- var _baseGetTag = baseGetTag$3;
661
-
662
- /**
663
- * Checks if `value` is object-like. A value is object-like if it's not `null`
664
- * and has a `typeof` result of "object".
665
- *
666
- * @static
667
- * @memberOf _
668
- * @since 4.0.0
669
- * @category Lang
670
- * @param {*} value The value to check.
671
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
672
- * @example
673
- *
674
- * _.isObjectLike({});
675
- * // => true
676
- *
677
- * _.isObjectLike([1, 2, 3]);
678
- * // => true
679
- *
680
- * _.isObjectLike(_.noop);
681
- * // => false
682
- *
683
- * _.isObjectLike(null);
684
- * // => false
685
- */
686
-
687
- function isObjectLike$2(value) {
688
- return value != null && typeof value == 'object';
689
- }
690
- var isObjectLike_1 = isObjectLike$2;
691
- var baseGetTag$2 = _baseGetTag,
692
- isObjectLike$1 = isObjectLike_1;
693
-
694
- /** `Object#toString` result references. */
695
- var argsTag = '[object Arguments]';
696
-
697
- /**
698
- * The base implementation of `_.isArguments`.
699
- *
700
- * @private
701
- * @param {*} value The value to check.
702
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
703
- */
704
- function baseIsArguments$1(value) {
705
- return isObjectLike$1(value) && baseGetTag$2(value) == argsTag;
706
- }
707
- var _baseIsArguments = baseIsArguments$1;
708
- var baseIsArguments = _baseIsArguments,
709
- isObjectLike = isObjectLike_1;
710
-
711
- /** Used for built-in method references. */
712
- var objectProto$3 = Object.prototype;
713
-
714
- /** Used to check objects for own properties. */
715
- var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
716
-
717
- /** Built-in value references. */
718
- var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
719
-
720
- /**
721
- * Checks if `value` is likely an `arguments` object.
722
- *
723
- * @static
724
- * @memberOf _
725
- * @since 0.1.0
726
- * @category Lang
727
- * @param {*} value The value to check.
728
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
729
- * else `false`.
730
- * @example
731
- *
732
- * _.isArguments(function() { return arguments; }());
733
- * // => true
734
- *
735
- * _.isArguments([1, 2, 3]);
736
- * // => false
737
- */
738
- var isArguments$1 = baseIsArguments(function () {
739
- return arguments;
740
- }()) ? baseIsArguments : function (value) {
741
- return isObjectLike(value) && hasOwnProperty$3.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
742
- };
743
- var isArguments_1 = isArguments$1;
744
-
745
- /**
746
- * Checks if `value` is classified as an `Array` object.
747
- *
748
- * @static
749
- * @memberOf _
750
- * @since 0.1.0
751
- * @category Lang
752
- * @param {*} value The value to check.
753
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
754
- * @example
755
- *
756
- * _.isArray([1, 2, 3]);
757
- * // => true
758
- *
759
- * _.isArray(document.body.children);
760
- * // => false
761
- *
762
- * _.isArray('abc');
763
- * // => false
764
- *
765
- * _.isArray(_.noop);
766
- * // => false
767
- */
768
-
769
- var isArray$1 = Array.isArray;
770
- var isArray_1 = isArray$1;
771
- var Symbol$1 = _Symbol,
772
- isArguments = isArguments_1,
773
- isArray = isArray_1;
774
-
775
- /** Built-in value references. */
776
- var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : undefined;
777
-
778
- /**
779
- * Checks if `value` is a flattenable `arguments` object or array.
780
- *
781
- * @private
782
- * @param {*} value The value to check.
783
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
784
- */
785
- function isFlattenable$1(value) {
786
- return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
787
- }
788
- var _isFlattenable = isFlattenable$1;
789
- var arrayPush = _arrayPush,
790
- isFlattenable = _isFlattenable;
791
-
792
- /**
793
- * The base implementation of `_.flatten` with support for restricting flattening.
794
- *
795
- * @private
796
- * @param {Array} array The array to flatten.
797
- * @param {number} depth The maximum recursion depth.
798
- * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
799
- * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
800
- * @param {Array} [result=[]] The initial result value.
801
- * @returns {Array} Returns the new flattened array.
802
- */
803
- function baseFlatten$1(array, depth, predicate, isStrict, result) {
804
- var index = -1,
805
- length = array.length;
806
- predicate || (predicate = isFlattenable);
807
- result || (result = []);
808
- while (++index < length) {
809
- var value = array[index];
810
- if (depth > 0 && predicate(value)) {
811
- if (depth > 1) {
812
- // Recursively flatten arrays (susceptible to call stack limits).
813
- baseFlatten$1(value, depth - 1, predicate, isStrict, result);
814
- } else {
815
- arrayPush(result, value);
816
- }
817
- } else if (!isStrict) {
818
- result[result.length] = value;
819
- }
820
- }
821
- return result;
822
- }
823
- var _baseFlatten = baseFlatten$1;
824
- var baseFlatten = _baseFlatten;
825
-
826
- /**
827
- * Flattens `array` a single level deep.
828
- *
829
- * @static
830
- * @memberOf _
831
- * @since 0.1.0
832
- * @category Array
833
- * @param {Array} array The array to flatten.
834
- * @returns {Array} Returns the new flattened array.
835
- * @example
836
- *
837
- * _.flatten([1, [2, [3, [4]], 5]]);
838
- * // => [1, 2, [3, [4]], 5]
839
- */
840
- function flatten(array) {
841
- var length = array == null ? 0 : array.length;
842
- return length ? baseFlatten(array, 1) : [];
843
- }
844
- var flatten_1 = flatten;
845
- var flatten$1 = /*@__PURE__*/getDefaultExportFromCjs(flatten_1);
846
-
847
- /**
848
- * Creates an array with all falsey values removed. The values `false`, `null`,
849
- * `0`, `""`, `undefined`, and `NaN` are falsey.
850
- *
851
- * @static
852
- * @memberOf _
853
- * @since 0.1.0
854
- * @category Array
855
- * @param {Array} array The array to compact.
856
- * @returns {Array} Returns the new array of filtered values.
857
- * @example
858
- *
859
- * _.compact([0, 1, false, 2, '', 3]);
860
- * // => [1, 2, 3]
861
- */
862
-
863
- function compact(array) {
864
- var index = -1,
865
- length = array == null ? 0 : array.length,
866
- resIndex = 0,
867
- result = [];
868
- while (++index < length) {
869
- var value = array[index];
870
- if (value) {
871
- result[resIndex++] = value;
872
- }
873
- }
874
- return result;
875
- }
876
- var compact_1 = compact;
877
- var compact$1 = /*@__PURE__*/getDefaultExportFromCjs(compact_1);
878
-
879
- /**
880
- * Removes all key-value entries from the list cache.
881
- *
882
- * @private
883
- * @name clear
884
- * @memberOf ListCache
885
- */
886
-
887
- function listCacheClear$1() {
888
- this.__data__ = [];
889
- this.size = 0;
890
- }
891
- var _listCacheClear = listCacheClear$1;
892
-
893
- /**
894
- * Performs a
895
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
896
- * comparison between two values to determine if they are equivalent.
897
- *
898
- * @static
899
- * @memberOf _
900
- * @since 4.0.0
901
- * @category Lang
902
- * @param {*} value The value to compare.
903
- * @param {*} other The other value to compare.
904
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
905
- * @example
906
- *
907
- * var object = { 'a': 1 };
908
- * var other = { 'a': 1 };
909
- *
910
- * _.eq(object, object);
911
- * // => true
912
- *
913
- * _.eq(object, other);
914
- * // => false
915
- *
916
- * _.eq('a', 'a');
917
- * // => true
918
- *
919
- * _.eq('a', Object('a'));
920
- * // => false
921
- *
922
- * _.eq(NaN, NaN);
923
- * // => true
924
- */
925
-
926
- function eq$1(value, other) {
927
- return value === other || value !== value && other !== other;
928
- }
929
- var eq_1 = eq$1;
930
- var eq = eq_1;
931
-
932
- /**
933
- * Gets the index at which the `key` is found in `array` of key-value pairs.
934
- *
935
- * @private
936
- * @param {Array} array The array to inspect.
937
- * @param {*} key The key to search for.
938
- * @returns {number} Returns the index of the matched value, else `-1`.
939
- */
940
- function assocIndexOf$4(array, key) {
941
- var length = array.length;
942
- while (length--) {
943
- if (eq(array[length][0], key)) {
944
- return length;
945
- }
946
- }
947
- return -1;
948
- }
949
- var _assocIndexOf = assocIndexOf$4;
950
- var assocIndexOf$3 = _assocIndexOf;
951
-
952
- /** Used for built-in method references. */
953
- var arrayProto = Array.prototype;
954
-
955
- /** Built-in value references. */
956
- var splice = arrayProto.splice;
957
-
958
- /**
959
- * Removes `key` and its value from the list cache.
960
- *
961
- * @private
962
- * @name delete
963
- * @memberOf ListCache
964
- * @param {string} key The key of the value to remove.
965
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
966
- */
967
- function listCacheDelete$1(key) {
968
- var data = this.__data__,
969
- index = assocIndexOf$3(data, key);
970
- if (index < 0) {
971
- return false;
972
- }
973
- var lastIndex = data.length - 1;
974
- if (index == lastIndex) {
975
- data.pop();
976
- } else {
977
- splice.call(data, index, 1);
978
- }
979
- --this.size;
980
- return true;
981
- }
982
- var _listCacheDelete = listCacheDelete$1;
983
- var assocIndexOf$2 = _assocIndexOf;
984
-
985
- /**
986
- * Gets the list cache value for `key`.
987
- *
988
- * @private
989
- * @name get
990
- * @memberOf ListCache
991
- * @param {string} key The key of the value to get.
992
- * @returns {*} Returns the entry value.
993
- */
994
- function listCacheGet$1(key) {
995
- var data = this.__data__,
996
- index = assocIndexOf$2(data, key);
997
- return index < 0 ? undefined : data[index][1];
998
- }
999
- var _listCacheGet = listCacheGet$1;
1000
- var assocIndexOf$1 = _assocIndexOf;
1001
-
1002
- /**
1003
- * Checks if a list cache value for `key` exists.
1004
- *
1005
- * @private
1006
- * @name has
1007
- * @memberOf ListCache
1008
- * @param {string} key The key of the entry to check.
1009
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1010
- */
1011
- function listCacheHas$1(key) {
1012
- return assocIndexOf$1(this.__data__, key) > -1;
1013
- }
1014
- var _listCacheHas = listCacheHas$1;
1015
- var assocIndexOf = _assocIndexOf;
1016
-
1017
- /**
1018
- * Sets the list cache `key` to `value`.
1019
- *
1020
- * @private
1021
- * @name set
1022
- * @memberOf ListCache
1023
- * @param {string} key The key of the value to set.
1024
- * @param {*} value The value to set.
1025
- * @returns {Object} Returns the list cache instance.
1026
- */
1027
- function listCacheSet$1(key, value) {
1028
- var data = this.__data__,
1029
- index = assocIndexOf(data, key);
1030
- if (index < 0) {
1031
- ++this.size;
1032
- data.push([key, value]);
1033
- } else {
1034
- data[index][1] = value;
1035
- }
1036
- return this;
1037
- }
1038
- var _listCacheSet = listCacheSet$1;
1039
- var listCacheClear = _listCacheClear,
1040
- listCacheDelete = _listCacheDelete,
1041
- listCacheGet = _listCacheGet,
1042
- listCacheHas = _listCacheHas,
1043
- listCacheSet = _listCacheSet;
1044
-
1045
- /**
1046
- * Creates an list cache object.
1047
- *
1048
- * @private
1049
- * @constructor
1050
- * @param {Array} [entries] The key-value pairs to cache.
1051
- */
1052
- function ListCache$4(entries) {
1053
- var index = -1,
1054
- length = entries == null ? 0 : entries.length;
1055
- this.clear();
1056
- while (++index < length) {
1057
- var entry = entries[index];
1058
- this.set(entry[0], entry[1]);
1059
- }
1060
- }
1061
-
1062
- // Add methods to `ListCache`.
1063
- ListCache$4.prototype.clear = listCacheClear;
1064
- ListCache$4.prototype['delete'] = listCacheDelete;
1065
- ListCache$4.prototype.get = listCacheGet;
1066
- ListCache$4.prototype.has = listCacheHas;
1067
- ListCache$4.prototype.set = listCacheSet;
1068
- var _ListCache = ListCache$4;
1069
- var ListCache$3 = _ListCache;
1070
-
1071
- /**
1072
- * Removes all key-value entries from the stack.
1073
- *
1074
- * @private
1075
- * @name clear
1076
- * @memberOf Stack
1077
- */
1078
- function stackClear$1() {
1079
- this.__data__ = new ListCache$3();
1080
- this.size = 0;
1081
- }
1082
- var _stackClear = stackClear$1;
1083
-
1084
- /**
1085
- * Removes `key` and its value from the stack.
1086
- *
1087
- * @private
1088
- * @name delete
1089
- * @memberOf Stack
1090
- * @param {string} key The key of the value to remove.
1091
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1092
- */
1093
-
1094
- function stackDelete$1(key) {
1095
- var data = this.__data__,
1096
- result = data['delete'](key);
1097
- this.size = data.size;
1098
- return result;
1099
- }
1100
- var _stackDelete = stackDelete$1;
1101
-
1102
- /**
1103
- * Gets the stack value for `key`.
1104
- *
1105
- * @private
1106
- * @name get
1107
- * @memberOf Stack
1108
- * @param {string} key The key of the value to get.
1109
- * @returns {*} Returns the entry value.
1110
- */
1111
-
1112
- function stackGet$1(key) {
1113
- return this.__data__.get(key);
1114
- }
1115
- var _stackGet = stackGet$1;
1116
-
1117
- /**
1118
- * Checks if a stack value for `key` exists.
1119
- *
1120
- * @private
1121
- * @name has
1122
- * @memberOf Stack
1123
- * @param {string} key The key of the entry to check.
1124
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1125
- */
1126
-
1127
- function stackHas$1(key) {
1128
- return this.__data__.has(key);
1129
- }
1130
- var _stackHas = stackHas$1;
1131
-
1132
- /**
1133
- * Checks if `value` is the
1134
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1135
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1136
- *
1137
- * @static
1138
- * @memberOf _
1139
- * @since 0.1.0
1140
- * @category Lang
1141
- * @param {*} value The value to check.
1142
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1143
- * @example
1144
- *
1145
- * _.isObject({});
1146
- * // => true
1147
- *
1148
- * _.isObject([1, 2, 3]);
1149
- * // => true
1150
- *
1151
- * _.isObject(_.noop);
1152
- * // => true
1153
- *
1154
- * _.isObject(null);
1155
- * // => false
1156
- */
1157
-
1158
- function isObject$2(value) {
1159
- var type = typeof value;
1160
- return value != null && (type == 'object' || type == 'function');
1161
- }
1162
- var isObject_1 = isObject$2;
1163
- var baseGetTag$1 = _baseGetTag,
1164
- isObject$1 = isObject_1;
1165
-
1166
- /** `Object#toString` result references. */
1167
- var asyncTag = '[object AsyncFunction]',
1168
- funcTag = '[object Function]',
1169
- genTag = '[object GeneratorFunction]',
1170
- proxyTag = '[object Proxy]';
1171
-
1172
- /**
1173
- * Checks if `value` is classified as a `Function` object.
1174
- *
1175
- * @static
1176
- * @memberOf _
1177
- * @since 0.1.0
1178
- * @category Lang
1179
- * @param {*} value The value to check.
1180
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1181
- * @example
1182
- *
1183
- * _.isFunction(_);
1184
- * // => true
1185
- *
1186
- * _.isFunction(/abc/);
1187
- * // => false
1188
- */
1189
- function isFunction$1(value) {
1190
- if (!isObject$1(value)) {
1191
- return false;
1192
- }
1193
- // The use of `Object#toString` avoids issues with the `typeof` operator
1194
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
1195
- var tag = baseGetTag$1(value);
1196
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1197
- }
1198
- var isFunction_1 = isFunction$1;
1199
- var root$5 = _root;
1200
-
1201
- /** Used to detect overreaching core-js shims. */
1202
- var coreJsData$1 = root$5['__core-js_shared__'];
1203
- var _coreJsData = coreJsData$1;
1204
- var coreJsData = _coreJsData;
1205
-
1206
- /** Used to detect methods masquerading as native. */
1207
- var maskSrcKey = function () {
1208
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
1209
- return uid ? 'Symbol(src)_1.' + uid : '';
1210
- }();
1211
-
1212
- /**
1213
- * Checks if `func` has its source masked.
1214
- *
1215
- * @private
1216
- * @param {Function} func The function to check.
1217
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1218
- */
1219
- function isMasked$1(func) {
1220
- return !!maskSrcKey && maskSrcKey in func;
1221
- }
1222
- var _isMasked = isMasked$1;
1223
-
1224
- /** Used for built-in method references. */
1225
-
1226
- var funcProto$1 = Function.prototype;
1227
-
1228
- /** Used to resolve the decompiled source of functions. */
1229
- var funcToString$1 = funcProto$1.toString;
1230
-
1231
- /**
1232
- * Converts `func` to its source code.
1233
- *
1234
- * @private
1235
- * @param {Function} func The function to convert.
1236
- * @returns {string} Returns the source code.
1237
- */
1238
- function toSource$2(func) {
1239
- if (func != null) {
1240
- try {
1241
- return funcToString$1.call(func);
1242
- } catch (e) {}
1243
- try {
1244
- return func + '';
1245
- } catch (e) {}
1246
- }
1247
- return '';
1248
- }
1249
- var _toSource = toSource$2;
1250
- var isFunction = isFunction_1,
1251
- isMasked = _isMasked,
1252
- isObject = isObject_1,
1253
- toSource$1 = _toSource;
1254
-
1255
- /**
1256
- * Used to match `RegExp`
1257
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1258
- */
1259
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1260
-
1261
- /** Used to detect host constructors (Safari). */
1262
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
1263
-
1264
- /** Used for built-in method references. */
1265
- var funcProto = Function.prototype,
1266
- objectProto$2 = Object.prototype;
1267
-
1268
- /** Used to resolve the decompiled source of functions. */
1269
- var funcToString = funcProto.toString;
1270
-
1271
- /** Used to check objects for own properties. */
1272
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
1273
-
1274
- /** Used to detect if a method is native. */
1275
- var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
1276
-
1277
- /**
1278
- * The base implementation of `_.isNative` without bad shim checks.
1279
- *
1280
- * @private
1281
- * @param {*} value The value to check.
1282
- * @returns {boolean} Returns `true` if `value` is a native function,
1283
- * else `false`.
1284
- */
1285
- function baseIsNative$1(value) {
1286
- if (!isObject(value) || isMasked(value)) {
1287
- return false;
1288
- }
1289
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1290
- return pattern.test(toSource$1(value));
1291
- }
1292
- var _baseIsNative = baseIsNative$1;
1293
-
1294
- /**
1295
- * Gets the value at `key` of `object`.
1296
- *
1297
- * @private
1298
- * @param {Object} [object] The object to query.
1299
- * @param {string} key The key of the property to get.
1300
- * @returns {*} Returns the property value.
1301
- */
1302
-
1303
- function getValue$1(object, key) {
1304
- return object == null ? undefined : object[key];
1305
- }
1306
- var _getValue = getValue$1;
1307
- var baseIsNative = _baseIsNative,
1308
- getValue = _getValue;
1309
-
1310
- /**
1311
- * Gets the native function at `key` of `object`.
1312
- *
1313
- * @private
1314
- * @param {Object} object The object to query.
1315
- * @param {string} key The key of the method to get.
1316
- * @returns {*} Returns the function if it's native, else `undefined`.
1317
- */
1318
- function getNative$6(object, key) {
1319
- var value = getValue(object, key);
1320
- return baseIsNative(value) ? value : undefined;
1321
- }
1322
- var _getNative = getNative$6;
1323
- var getNative$5 = _getNative,
1324
- root$4 = _root;
1325
-
1326
- /* Built-in method references that are verified to be native. */
1327
- var Map$4 = getNative$5(root$4, 'Map');
1328
- var _Map = Map$4;
1329
- var getNative$4 = _getNative;
1330
-
1331
- /* Built-in method references that are verified to be native. */
1332
- var nativeCreate$4 = getNative$4(Object, 'create');
1333
- var _nativeCreate = nativeCreate$4;
1334
- var nativeCreate$3 = _nativeCreate;
1335
-
1336
- /**
1337
- * Removes all key-value entries from the hash.
1338
- *
1339
- * @private
1340
- * @name clear
1341
- * @memberOf Hash
1342
- */
1343
- function hashClear$1() {
1344
- this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
1345
- this.size = 0;
1346
- }
1347
- var _hashClear = hashClear$1;
1348
-
1349
- /**
1350
- * Removes `key` and its value from the hash.
1351
- *
1352
- * @private
1353
- * @name delete
1354
- * @memberOf Hash
1355
- * @param {Object} hash The hash to modify.
1356
- * @param {string} key The key of the value to remove.
1357
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1358
- */
1359
-
1360
- function hashDelete$1(key) {
1361
- var result = this.has(key) && delete this.__data__[key];
1362
- this.size -= result ? 1 : 0;
1363
- return result;
1364
- }
1365
- var _hashDelete = hashDelete$1;
1366
- var nativeCreate$2 = _nativeCreate;
1367
-
1368
- /** Used to stand-in for `undefined` hash values. */
1369
- var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
1370
-
1371
- /** Used for built-in method references. */
1372
- var objectProto$1 = Object.prototype;
1373
-
1374
- /** Used to check objects for own properties. */
1375
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
1376
-
1377
- /**
1378
- * Gets the hash value for `key`.
1379
- *
1380
- * @private
1381
- * @name get
1382
- * @memberOf Hash
1383
- * @param {string} key The key of the value to get.
1384
- * @returns {*} Returns the entry value.
1385
- */
1386
- function hashGet$1(key) {
1387
- var data = this.__data__;
1388
- if (nativeCreate$2) {
1389
- var result = data[key];
1390
- return result === HASH_UNDEFINED$2 ? undefined : result;
1391
- }
1392
- return hasOwnProperty$1.call(data, key) ? data[key] : undefined;
1393
- }
1394
- var _hashGet = hashGet$1;
1395
- var nativeCreate$1 = _nativeCreate;
1396
-
1397
- /** Used for built-in method references. */
1398
- var objectProto = Object.prototype;
1399
-
1400
- /** Used to check objects for own properties. */
1401
- var hasOwnProperty = objectProto.hasOwnProperty;
1402
-
1403
- /**
1404
- * Checks if a hash value for `key` exists.
1405
- *
1406
- * @private
1407
- * @name has
1408
- * @memberOf Hash
1409
- * @param {string} key The key of the entry to check.
1410
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1411
- */
1412
- function hashHas$1(key) {
1413
- var data = this.__data__;
1414
- return nativeCreate$1 ? data[key] !== undefined : hasOwnProperty.call(data, key);
1415
- }
1416
- var _hashHas = hashHas$1;
1417
- var nativeCreate = _nativeCreate;
1418
-
1419
- /** Used to stand-in for `undefined` hash values. */
1420
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
1421
-
1422
- /**
1423
- * Sets the hash `key` to `value`.
1424
- *
1425
- * @private
1426
- * @name set
1427
- * @memberOf Hash
1428
- * @param {string} key The key of the value to set.
1429
- * @param {*} value The value to set.
1430
- * @returns {Object} Returns the hash instance.
1431
- */
1432
- function hashSet$1(key, value) {
1433
- var data = this.__data__;
1434
- this.size += this.has(key) ? 0 : 1;
1435
- data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED$1 : value;
1436
- return this;
1437
- }
1438
- var _hashSet = hashSet$1;
1439
- var hashClear = _hashClear,
1440
- hashDelete = _hashDelete,
1441
- hashGet = _hashGet,
1442
- hashHas = _hashHas,
1443
- hashSet = _hashSet;
1444
-
1445
- /**
1446
- * Creates a hash object.
1447
- *
1448
- * @private
1449
- * @constructor
1450
- * @param {Array} [entries] The key-value pairs to cache.
1451
- */
1452
- function Hash$1(entries) {
1453
- var index = -1,
1454
- length = entries == null ? 0 : entries.length;
1455
- this.clear();
1456
- while (++index < length) {
1457
- var entry = entries[index];
1458
- this.set(entry[0], entry[1]);
1459
- }
1460
- }
1461
-
1462
- // Add methods to `Hash`.
1463
- Hash$1.prototype.clear = hashClear;
1464
- Hash$1.prototype['delete'] = hashDelete;
1465
- Hash$1.prototype.get = hashGet;
1466
- Hash$1.prototype.has = hashHas;
1467
- Hash$1.prototype.set = hashSet;
1468
- var _Hash = Hash$1;
1469
- var Hash = _Hash,
1470
- ListCache$2 = _ListCache,
1471
- Map$3 = _Map;
1472
-
1473
- /**
1474
- * Removes all key-value entries from the map.
1475
- *
1476
- * @private
1477
- * @name clear
1478
- * @memberOf MapCache
1479
- */
1480
- function mapCacheClear$1() {
1481
- this.size = 0;
1482
- this.__data__ = {
1483
- 'hash': new Hash(),
1484
- 'map': new (Map$3 || ListCache$2)(),
1485
- 'string': new Hash()
1486
- };
1487
- }
1488
- var _mapCacheClear = mapCacheClear$1;
1489
-
1490
- /**
1491
- * Checks if `value` is suitable for use as unique object key.
1492
- *
1493
- * @private
1494
- * @param {*} value The value to check.
1495
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1496
- */
1497
-
1498
- function isKeyable$1(value) {
1499
- var type = typeof value;
1500
- return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
1501
- }
1502
- var _isKeyable = isKeyable$1;
1503
- var isKeyable = _isKeyable;
1504
-
1505
- /**
1506
- * Gets the data for `map`.
1507
- *
1508
- * @private
1509
- * @param {Object} map The map to query.
1510
- * @param {string} key The reference key.
1511
- * @returns {*} Returns the map data.
1512
- */
1513
- function getMapData$4(map, key) {
1514
- var data = map.__data__;
1515
- return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
1516
- }
1517
- var _getMapData = getMapData$4;
1518
- var getMapData$3 = _getMapData;
1519
-
1520
- /**
1521
- * Removes `key` and its value from the map.
1522
- *
1523
- * @private
1524
- * @name delete
1525
- * @memberOf MapCache
1526
- * @param {string} key The key of the value to remove.
1527
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1528
- */
1529
- function mapCacheDelete$1(key) {
1530
- var result = getMapData$3(this, key)['delete'](key);
1531
- this.size -= result ? 1 : 0;
1532
- return result;
1533
- }
1534
- var _mapCacheDelete = mapCacheDelete$1;
1535
- var getMapData$2 = _getMapData;
1536
-
1537
- /**
1538
- * Gets the map value for `key`.
1539
- *
1540
- * @private
1541
- * @name get
1542
- * @memberOf MapCache
1543
- * @param {string} key The key of the value to get.
1544
- * @returns {*} Returns the entry value.
1545
- */
1546
- function mapCacheGet$1(key) {
1547
- return getMapData$2(this, key).get(key);
1548
- }
1549
- var _mapCacheGet = mapCacheGet$1;
1550
- var getMapData$1 = _getMapData;
1551
-
1552
- /**
1553
- * Checks if a map value for `key` exists.
1554
- *
1555
- * @private
1556
- * @name has
1557
- * @memberOf MapCache
1558
- * @param {string} key The key of the entry to check.
1559
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1560
- */
1561
- function mapCacheHas$1(key) {
1562
- return getMapData$1(this, key).has(key);
1563
- }
1564
- var _mapCacheHas = mapCacheHas$1;
1565
- var getMapData = _getMapData;
1566
-
1567
- /**
1568
- * Sets the map `key` to `value`.
1569
- *
1570
- * @private
1571
- * @name set
1572
- * @memberOf MapCache
1573
- * @param {string} key The key of the value to set.
1574
- * @param {*} value The value to set.
1575
- * @returns {Object} Returns the map cache instance.
1576
- */
1577
- function mapCacheSet$1(key, value) {
1578
- var data = getMapData(this, key),
1579
- size = data.size;
1580
- data.set(key, value);
1581
- this.size += data.size == size ? 0 : 1;
1582
- return this;
1583
- }
1584
- var _mapCacheSet = mapCacheSet$1;
1585
- var mapCacheClear = _mapCacheClear,
1586
- mapCacheDelete = _mapCacheDelete,
1587
- mapCacheGet = _mapCacheGet,
1588
- mapCacheHas = _mapCacheHas,
1589
- mapCacheSet = _mapCacheSet;
1590
-
1591
- /**
1592
- * Creates a map cache object to store key-value pairs.
1593
- *
1594
- * @private
1595
- * @constructor
1596
- * @param {Array} [entries] The key-value pairs to cache.
1597
- */
1598
- function MapCache$2(entries) {
1599
- var index = -1,
1600
- length = entries == null ? 0 : entries.length;
1601
- this.clear();
1602
- while (++index < length) {
1603
- var entry = entries[index];
1604
- this.set(entry[0], entry[1]);
1605
- }
1606
- }
1607
-
1608
- // Add methods to `MapCache`.
1609
- MapCache$2.prototype.clear = mapCacheClear;
1610
- MapCache$2.prototype['delete'] = mapCacheDelete;
1611
- MapCache$2.prototype.get = mapCacheGet;
1612
- MapCache$2.prototype.has = mapCacheHas;
1613
- MapCache$2.prototype.set = mapCacheSet;
1614
- var _MapCache = MapCache$2;
1615
- var ListCache$1 = _ListCache,
1616
- Map$2 = _Map,
1617
- MapCache$1 = _MapCache;
1618
-
1619
- /** Used as the size to enable large array optimizations. */
1620
- var LARGE_ARRAY_SIZE = 200;
1621
-
1622
- /**
1623
- * Sets the stack `key` to `value`.
1624
- *
1625
- * @private
1626
- * @name set
1627
- * @memberOf Stack
1628
- * @param {string} key The key of the value to set.
1629
- * @param {*} value The value to set.
1630
- * @returns {Object} Returns the stack cache instance.
1631
- */
1632
- function stackSet$1(key, value) {
1633
- var data = this.__data__;
1634
- if (data instanceof ListCache$1) {
1635
- var pairs = data.__data__;
1636
- if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
1637
- pairs.push([key, value]);
1638
- this.size = ++data.size;
1639
- return this;
1640
- }
1641
- data = this.__data__ = new MapCache$1(pairs);
1642
- }
1643
- data.set(key, value);
1644
- this.size = data.size;
1645
- return this;
1646
- }
1647
- var _stackSet = stackSet$1;
1648
- var ListCache = _ListCache,
1649
- stackClear = _stackClear,
1650
- stackDelete = _stackDelete,
1651
- stackGet = _stackGet,
1652
- stackHas = _stackHas,
1653
- stackSet = _stackSet;
1654
-
1655
- /**
1656
- * Creates a stack cache object to store key-value pairs.
1657
- *
1658
- * @private
1659
- * @constructor
1660
- * @param {Array} [entries] The key-value pairs to cache.
1661
- */
1662
- function Stack(entries) {
1663
- var data = this.__data__ = new ListCache(entries);
1664
- this.size = data.size;
1665
- }
1666
-
1667
- // Add methods to `Stack`.
1668
- Stack.prototype.clear = stackClear;
1669
- Stack.prototype['delete'] = stackDelete;
1670
- Stack.prototype.get = stackGet;
1671
- Stack.prototype.has = stackHas;
1672
- Stack.prototype.set = stackSet;
1673
-
1674
- /** Used to stand-in for `undefined` hash values. */
1675
-
1676
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
1677
-
1678
- /**
1679
- * Adds `value` to the array cache.
1680
- *
1681
- * @private
1682
- * @name add
1683
- * @memberOf SetCache
1684
- * @alias push
1685
- * @param {*} value The value to cache.
1686
- * @returns {Object} Returns the cache instance.
1687
- */
1688
- function setCacheAdd$1(value) {
1689
- this.__data__.set(value, HASH_UNDEFINED);
1690
- return this;
1691
- }
1692
- var _setCacheAdd = setCacheAdd$1;
1693
-
1694
- /**
1695
- * Checks if `value` is in the array cache.
1696
- *
1697
- * @private
1698
- * @name has
1699
- * @memberOf SetCache
1700
- * @param {*} value The value to search for.
1701
- * @returns {number} Returns `true` if `value` is found, else `false`.
1702
- */
1703
-
1704
- function setCacheHas$1(value) {
1705
- return this.__data__.has(value);
1706
- }
1707
- var _setCacheHas = setCacheHas$1;
1708
- var MapCache = _MapCache,
1709
- setCacheAdd = _setCacheAdd,
1710
- setCacheHas = _setCacheHas;
1711
-
1712
- /**
1713
- *
1714
- * Creates an array cache object to store unique values.
1715
- *
1716
- * @private
1717
- * @constructor
1718
- * @param {Array} [values] The values to cache.
1719
- */
1720
- function SetCache(values) {
1721
- var index = -1,
1722
- length = values == null ? 0 : values.length;
1723
- this.__data__ = new MapCache();
1724
- while (++index < length) {
1725
- this.add(values[index]);
1726
- }
1727
- }
1728
-
1729
- // Add methods to `SetCache`.
1730
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
1731
- SetCache.prototype.has = setCacheHas;
1732
- var isBuffer = {
1733
- exports: {}
1734
- };
1735
-
1736
- /**
1737
- * This method returns `false`.
1738
- *
1739
- * @static
1740
- * @memberOf _
1741
- * @since 4.13.0
1742
- * @category Util
1743
- * @returns {boolean} Returns `false`.
1744
- * @example
1745
- *
1746
- * _.times(2, _.stubFalse);
1747
- * // => [false, false]
1748
- */
1749
-
1750
- function stubFalse() {
1751
- return false;
1752
- }
1753
- var stubFalse_1 = stubFalse;
1754
- (function (module, exports) {
1755
- var root = _root,
1756
- stubFalse = stubFalse_1;
1757
-
1758
- /** Detect free variable `exports`. */
1759
- var freeExports = exports && !exports.nodeType && exports;
1760
-
1761
- /** Detect free variable `module`. */
1762
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1763
-
1764
- /** Detect the popular CommonJS extension `module.exports`. */
1765
- var moduleExports = freeModule && freeModule.exports === freeExports;
1766
-
1767
- /** Built-in value references. */
1768
- var Buffer = moduleExports ? root.Buffer : undefined;
1769
-
1770
- /* Built-in method references for those with the same name as other `lodash` methods. */
1771
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1772
-
1773
- /**
1774
- * Checks if `value` is a buffer.
1775
- *
1776
- * @static
1777
- * @memberOf _
1778
- * @since 4.3.0
1779
- * @category Lang
1780
- * @param {*} value The value to check.
1781
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1782
- * @example
1783
- *
1784
- * _.isBuffer(new Buffer(2));
1785
- * // => true
1786
- *
1787
- * _.isBuffer(new Uint8Array(2));
1788
- * // => false
1789
- */
1790
- var isBuffer = nativeIsBuffer || stubFalse;
1791
- module.exports = isBuffer;
1792
- })(isBuffer, isBuffer.exports);
1793
- var _nodeUtil = {
1794
- exports: {}
1795
- };
1796
- (function (module, exports) {
1797
- var freeGlobal = _freeGlobal;
1798
-
1799
- /** Detect free variable `exports`. */
1800
- var freeExports = exports && !exports.nodeType && exports;
1801
-
1802
- /** Detect free variable `module`. */
1803
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1804
-
1805
- /** Detect the popular CommonJS extension `module.exports`. */
1806
- var moduleExports = freeModule && freeModule.exports === freeExports;
1807
-
1808
- /** Detect free variable `process` from Node.js. */
1809
- var freeProcess = moduleExports && freeGlobal.process;
1810
-
1811
- /** Used to access faster Node.js helpers. */
1812
- var nodeUtil = function () {
1813
- try {
1814
- // Use `util.types` for Node.js 10+.
1815
- var types = freeModule && freeModule.require && freeModule.require('util').types;
1816
- if (types) {
1817
- return types;
1818
- }
1819
-
1820
- // Legacy `process.binding('util')` for Node.js < 10.
1821
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
1822
- } catch (e) {}
1823
- }();
1824
- module.exports = nodeUtil;
1825
- })(_nodeUtil, _nodeUtil.exports);
1826
- var getNative$3 = _getNative,
1827
- root$3 = _root;
1828
-
1829
- /* Built-in method references that are verified to be native. */
1830
- var DataView$1 = getNative$3(root$3, 'DataView');
1831
- var _DataView = DataView$1;
1832
- var getNative$2 = _getNative,
1833
- root$2 = _root;
1834
-
1835
- /* Built-in method references that are verified to be native. */
1836
- var Promise$2 = getNative$2(root$2, 'Promise');
1837
- var _Promise = Promise$2;
1838
- var getNative$1 = _getNative,
1839
- root$1 = _root;
1840
-
1841
- /* Built-in method references that are verified to be native. */
1842
- var Set$1 = getNative$1(root$1, 'Set');
1843
- var _Set = Set$1;
1844
- var getNative = _getNative,
1845
- root = _root;
1846
-
1847
- /* Built-in method references that are verified to be native. */
1848
- var WeakMap$1 = getNative(root, 'WeakMap');
1849
- var _WeakMap = WeakMap$1;
1850
- var DataView = _DataView,
1851
- Map$1 = _Map,
1852
- Promise$1 = _Promise,
1853
- Set = _Set,
1854
- WeakMap = _WeakMap,
1855
- baseGetTag = _baseGetTag,
1856
- toSource = _toSource;
1857
-
1858
- /** `Object#toString` result references. */
1859
- var mapTag = '[object Map]',
1860
- objectTag = '[object Object]',
1861
- promiseTag = '[object Promise]',
1862
- setTag = '[object Set]',
1863
- weakMapTag = '[object WeakMap]';
1864
- var dataViewTag = '[object DataView]';
1865
-
1866
- /** Used to detect maps, sets, and weakmaps. */
1867
- var dataViewCtorString = toSource(DataView),
1868
- mapCtorString = toSource(Map$1),
1869
- promiseCtorString = toSource(Promise$1),
1870
- setCtorString = toSource(Set),
1871
- weakMapCtorString = toSource(WeakMap);
1872
-
1873
- /**
1874
- * Gets the `toStringTag` of `value`.
1875
- *
1876
- * @private
1877
- * @param {*} value The value to query.
1878
- * @returns {string} Returns the `toStringTag`.
1879
- */
1880
- var getTag = baseGetTag;
1881
-
1882
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1883
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag(new Map$1()) != mapTag || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
1884
- getTag = function (value) {
1885
- var result = baseGetTag(value),
1886
- Ctor = result == objectTag ? value.constructor : undefined,
1887
- ctorString = Ctor ? toSource(Ctor) : '';
1888
- if (ctorString) {
1889
- switch (ctorString) {
1890
- case dataViewCtorString:
1891
- return dataViewTag;
1892
- case mapCtorString:
1893
- return mapTag;
1894
- case promiseCtorString:
1895
- return promiseTag;
1896
- case setCtorString:
1897
- return setTag;
1898
- case weakMapCtorString:
1899
- return weakMapTag;
1900
- }
1901
- }
1902
- return result;
1903
- };
1904
- }
1905
- var src = {
1906
- exports: {}
1907
- };
1908
- var browser = {
1909
- exports: {}
1910
- };
1911
-
1912
- /**
1913
- * Helpers.
1914
- */
1915
-
1916
- var ms;
1917
- var hasRequiredMs;
1918
- function requireMs() {
1919
- if (hasRequiredMs) return ms;
1920
- hasRequiredMs = 1;
1921
- var s = 1000;
1922
- var m = s * 60;
1923
- var h = m * 60;
1924
- var d = h * 24;
1925
- var w = d * 7;
1926
- var y = d * 365.25;
1927
-
1928
- /**
1929
- * Parse or format the given `val`.
1930
- *
1931
- * Options:
1932
- *
1933
- * - `long` verbose formatting [false]
1934
- *
1935
- * @param {String|Number} val
1936
- * @param {Object} [options]
1937
- * @throws {Error} throw an error if val is not a non-empty string or a number
1938
- * @return {String|Number}
1939
- * @api public
1940
- */
1941
-
1942
- ms = function (val, options) {
1943
- options = options || {};
1944
- var type = typeof val;
1945
- if (type === 'string' && val.length > 0) {
1946
- return parse(val);
1947
- } else if (type === 'number' && isFinite(val)) {
1948
- return options.long ? fmtLong(val) : fmtShort(val);
1949
- }
1950
- throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
1951
- };
1952
-
1953
- /**
1954
- * Parse the given `str` and return milliseconds.
1955
- *
1956
- * @param {String} str
1957
- * @return {Number}
1958
- * @api private
1959
- */
1960
-
1961
- function parse(str) {
1962
- str = String(str);
1963
- if (str.length > 100) {
1964
- return;
1965
- }
1966
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
1967
- if (!match) {
1968
- return;
1969
- }
1970
- var n = parseFloat(match[1]);
1971
- var type = (match[2] || 'ms').toLowerCase();
1972
- switch (type) {
1973
- case 'years':
1974
- case 'year':
1975
- case 'yrs':
1976
- case 'yr':
1977
- case 'y':
1978
- return n * y;
1979
- case 'weeks':
1980
- case 'week':
1981
- case 'w':
1982
- return n * w;
1983
- case 'days':
1984
- case 'day':
1985
- case 'd':
1986
- return n * d;
1987
- case 'hours':
1988
- case 'hour':
1989
- case 'hrs':
1990
- case 'hr':
1991
- case 'h':
1992
- return n * h;
1993
- case 'minutes':
1994
- case 'minute':
1995
- case 'mins':
1996
- case 'min':
1997
- case 'm':
1998
- return n * m;
1999
- case 'seconds':
2000
- case 'second':
2001
- case 'secs':
2002
- case 'sec':
2003
- case 's':
2004
- return n * s;
2005
- case 'milliseconds':
2006
- case 'millisecond':
2007
- case 'msecs':
2008
- case 'msec':
2009
- case 'ms':
2010
- return n;
2011
- default:
2012
- return undefined;
2013
- }
2014
- }
2015
-
2016
- /**
2017
- * Short format for `ms`.
2018
- *
2019
- * @param {Number} ms
2020
- * @return {String}
2021
- * @api private
2022
- */
2023
-
2024
- function fmtShort(ms) {
2025
- var msAbs = Math.abs(ms);
2026
- if (msAbs >= d) {
2027
- return Math.round(ms / d) + 'd';
2028
- }
2029
- if (msAbs >= h) {
2030
- return Math.round(ms / h) + 'h';
2031
- }
2032
- if (msAbs >= m) {
2033
- return Math.round(ms / m) + 'm';
2034
- }
2035
- if (msAbs >= s) {
2036
- return Math.round(ms / s) + 's';
2037
- }
2038
- return ms + 'ms';
2039
- }
2040
-
2041
- /**
2042
- * Long format for `ms`.
2043
- *
2044
- * @param {Number} ms
2045
- * @return {String}
2046
- * @api private
2047
- */
2048
-
2049
- function fmtLong(ms) {
2050
- var msAbs = Math.abs(ms);
2051
- if (msAbs >= d) {
2052
- return plural(ms, msAbs, d, 'day');
2053
- }
2054
- if (msAbs >= h) {
2055
- return plural(ms, msAbs, h, 'hour');
2056
- }
2057
- if (msAbs >= m) {
2058
- return plural(ms, msAbs, m, 'minute');
2059
- }
2060
- if (msAbs >= s) {
2061
- return plural(ms, msAbs, s, 'second');
2062
- }
2063
- return ms + ' ms';
2064
- }
2065
-
2066
- /**
2067
- * Pluralization helper.
2068
- */
2069
-
2070
- function plural(ms, msAbs, n, name) {
2071
- var isPlural = msAbs >= n * 1.5;
2072
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
2073
- }
2074
- return ms;
2075
- }
2076
- var common;
2077
- var hasRequiredCommon;
2078
- function requireCommon() {
2079
- if (hasRequiredCommon) return common;
2080
- hasRequiredCommon = 1;
2081
-
2082
- /**
2083
- * This is the common logic for both the Node.js and web browser
2084
- * implementations of `debug()`.
2085
- */
2086
- function setup(env) {
2087
- createDebug.debug = createDebug;
2088
- createDebug.default = createDebug;
2089
- createDebug.coerce = coerce;
2090
- createDebug.disable = disable;
2091
- createDebug.enable = enable;
2092
- createDebug.enabled = enabled;
2093
- createDebug.humanize = requireMs();
2094
- Object.keys(env).forEach(function (key) {
2095
- createDebug[key] = env[key];
2096
- });
2097
- /**
2098
- * Active `debug` instances.
2099
- */
2100
-
2101
- createDebug.instances = [];
2102
- /**
2103
- * The currently active debug mode names, and names to skip.
2104
- */
2105
-
2106
- createDebug.names = [];
2107
- createDebug.skips = [];
2108
- /**
2109
- * Map of special "%n" handling functions, for the debug "format" argument.
2110
- *
2111
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
2112
- */
2113
-
2114
- createDebug.formatters = {};
2115
- /**
2116
- * Selects a color for a debug namespace
2117
- * @param {String} namespace The namespace string for the for the debug instance to be colored
2118
- * @return {Number|String} An ANSI color code for the given namespace
2119
- * @api private
2120
- */
2121
-
2122
- function selectColor(namespace) {
2123
- var hash = 0;
2124
- for (var i = 0; i < namespace.length; i++) {
2125
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
2126
- hash |= 0; // Convert to 32bit integer
2127
- }
2128
-
2129
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
2130
- }
2131
- createDebug.selectColor = selectColor;
2132
- /**
2133
- * Create a debugger with the given `namespace`.
2134
- *
2135
- * @param {String} namespace
2136
- * @return {Function}
2137
- * @api public
2138
- */
2139
-
2140
- function createDebug(namespace) {
2141
- var prevTime;
2142
- function debug() {
2143
- // Disabled?
2144
- if (!debug.enabled) {
2145
- return;
2146
- }
2147
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2148
- args[_key] = arguments[_key];
2149
- }
2150
- var self = debug; // Set `diff` timestamp
2151
-
2152
- var curr = Number(new Date());
2153
- var ms = curr - (prevTime || curr);
2154
- self.diff = ms;
2155
- self.prev = prevTime;
2156
- self.curr = curr;
2157
- prevTime = curr;
2158
- args[0] = createDebug.coerce(args[0]);
2159
- if (typeof args[0] !== 'string') {
2160
- // Anything else let's inspect with %O
2161
- args.unshift('%O');
2162
- } // Apply any `formatters` transformations
2163
-
2164
- var index = 0;
2165
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
2166
- // If we encounter an escaped % then don't increase the array index
2167
- if (match === '%%') {
2168
- return match;
2169
- }
2170
- index++;
2171
- var formatter = createDebug.formatters[format];
2172
- if (typeof formatter === 'function') {
2173
- var val = args[index];
2174
- match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
2175
-
2176
- args.splice(index, 1);
2177
- index--;
2178
- }
2179
- return match;
2180
- }); // Apply env-specific formatting (colors, etc.)
2181
-
2182
- createDebug.formatArgs.call(self, args);
2183
- var logFn = self.log || createDebug.log;
2184
- logFn.apply(self, args);
2185
- }
2186
- debug.namespace = namespace;
2187
- debug.enabled = createDebug.enabled(namespace);
2188
- debug.useColors = createDebug.useColors();
2189
- debug.color = selectColor(namespace);
2190
- debug.destroy = destroy;
2191
- debug.extend = extend; // Debug.formatArgs = formatArgs;
2192
- // debug.rawLog = rawLog;
2193
- // env-specific initialization logic for debug instances
2194
-
2195
- if (typeof createDebug.init === 'function') {
2196
- createDebug.init(debug);
2197
- }
2198
- createDebug.instances.push(debug);
2199
- return debug;
2200
- }
2201
- function destroy() {
2202
- var index = createDebug.instances.indexOf(this);
2203
- if (index !== -1) {
2204
- createDebug.instances.splice(index, 1);
2205
- return true;
2206
- }
2207
- return false;
2208
- }
2209
- function extend(namespace, delimiter) {
2210
- return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
2211
- }
2212
- /**
2213
- * Enables a debug mode by namespaces. This can include modes
2214
- * separated by a colon and wildcards.
2215
- *
2216
- * @param {String} namespaces
2217
- * @api public
2218
- */
2219
-
2220
- function enable(namespaces) {
2221
- createDebug.save(namespaces);
2222
- createDebug.names = [];
2223
- createDebug.skips = [];
2224
- var i;
2225
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
2226
- var len = split.length;
2227
- for (i = 0; i < len; i++) {
2228
- if (!split[i]) {
2229
- // ignore empty strings
2230
- continue;
2231
- }
2232
- namespaces = split[i].replace(/\*/g, '.*?');
2233
- if (namespaces[0] === '-') {
2234
- createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
2235
- } else {
2236
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
2237
- }
2238
- }
2239
- for (i = 0; i < createDebug.instances.length; i++) {
2240
- var instance = createDebug.instances[i];
2241
- instance.enabled = createDebug.enabled(instance.namespace);
2242
- }
2243
- }
2244
- /**
2245
- * Disable debug output.
2246
- *
2247
- * @api public
2248
- */
2249
-
2250
- function disable() {
2251
- createDebug.enable('');
2252
- }
2253
- /**
2254
- * Returns true if the given mode name is enabled, false otherwise.
2255
- *
2256
- * @param {String} name
2257
- * @return {Boolean}
2258
- * @api public
2259
- */
2260
-
2261
- function enabled(name) {
2262
- if (name[name.length - 1] === '*') {
2263
- return true;
2264
- }
2265
- var i;
2266
- var len;
2267
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
2268
- if (createDebug.skips[i].test(name)) {
2269
- return false;
2270
- }
2271
- }
2272
- for (i = 0, len = createDebug.names.length; i < len; i++) {
2273
- if (createDebug.names[i].test(name)) {
2274
- return true;
2275
- }
2276
- }
2277
- return false;
2278
- }
2279
- /**
2280
- * Coerce `val`.
2281
- *
2282
- * @param {Mixed} val
2283
- * @return {Mixed}
2284
- * @api private
2285
- */
2286
-
2287
- function coerce(val) {
2288
- if (val instanceof Error) {
2289
- return val.stack || val.message;
2290
- }
2291
- return val;
2292
- }
2293
- createDebug.enable(createDebug.load());
2294
- return createDebug;
2295
- }
2296
- common = setup;
2297
- return common;
2298
- }
2299
- var hasRequiredBrowser;
2300
- function requireBrowser() {
2301
- if (hasRequiredBrowser) return browser.exports;
2302
- hasRequiredBrowser = 1;
2303
- (function (module, exports) {
2304
- function _typeof(obj) {
2305
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2306
- _typeof = function _typeof(obj) {
2307
- return typeof obj;
2308
- };
2309
- } else {
2310
- _typeof = function _typeof(obj) {
2311
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2312
- };
2313
- }
2314
- return _typeof(obj);
2315
- }
2316
-
2317
- /* eslint-env browser */
2318
-
2319
- /**
2320
- * This is the web browser implementation of `debug()`.
2321
- */
2322
- exports.log = log;
2323
- exports.formatArgs = formatArgs;
2324
- exports.save = save;
2325
- exports.load = load;
2326
- exports.useColors = useColors;
2327
- exports.storage = localstorage();
2328
- /**
2329
- * Colors.
2330
- */
2331
-
2332
- exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
2333
- /**
2334
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2335
- * and the Firebug extension (any Firefox version) are known
2336
- * to support "%c" CSS customizations.
2337
- *
2338
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
2339
- */
2340
- // eslint-disable-next-line complexity
2341
-
2342
- function useColors() {
2343
- // NB: In an Electron preload script, document will be defined but not fully
2344
- // initialized. Since we know we're in Chrome, we'll just detect this case
2345
- // explicitly
2346
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2347
- return true;
2348
- } // Internet Explorer and Edge do not support colors.
2349
-
2350
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2351
- return false;
2352
- } // Is webkit? http://stackoverflow.com/a/16459606/376773
2353
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2354
-
2355
- return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
2356
- // Is firebug? http://stackoverflow.com/a/398120/376773
2357
- typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
2358
- // Is firefox >= v31?
2359
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2360
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
2361
- // Double check webkit in userAgent just in case we are in a worker
2362
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2363
- }
2364
- /**
2365
- * Colorize log arguments if enabled.
2366
- *
2367
- * @api public
2368
- */
2369
-
2370
- function formatArgs(args) {
2371
- args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2372
- if (!this.useColors) {
2373
- return;
2374
- }
2375
- var c = 'color: ' + this.color;
2376
- args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2377
- // arguments passed either before or after the %c, so we need to
2378
- // figure out the correct index to insert the CSS into
2379
-
2380
- var index = 0;
2381
- var lastC = 0;
2382
- args[0].replace(/%[a-zA-Z%]/g, function (match) {
2383
- if (match === '%%') {
2384
- return;
2385
- }
2386
- index++;
2387
- if (match === '%c') {
2388
- // We only are interested in the *last* %c
2389
- // (the user may have provided their own)
2390
- lastC = index;
2391
- }
2392
- });
2393
- args.splice(lastC, 0, c);
2394
- }
2395
- /**
2396
- * Invokes `console.log()` when available.
2397
- * No-op when `console.log` is not a "function".
2398
- *
2399
- * @api public
2400
- */
2401
-
2402
- function log() {
2403
- var _console;
2404
-
2405
- // This hackery is required for IE8/9, where
2406
- // the `console.log` function doesn't have 'apply'
2407
- return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2408
- }
2409
- /**
2410
- * Save `namespaces`.
2411
- *
2412
- * @param {String} namespaces
2413
- * @api private
2414
- */
2415
-
2416
- function save(namespaces) {
2417
- try {
2418
- if (namespaces) {
2419
- exports.storage.setItem('debug', namespaces);
2420
- } else {
2421
- exports.storage.removeItem('debug');
2422
- }
2423
- } catch (error) {// Swallow
2424
- // XXX (@Qix-) should we be logging these?
2425
- }
2426
- }
2427
- /**
2428
- * Load `namespaces`.
2429
- *
2430
- * @return {String} returns the previously persisted debug modes
2431
- * @api private
2432
- */
2433
-
2434
- function load() {
2435
- var r;
2436
- try {
2437
- r = exports.storage.getItem('debug');
2438
- } catch (error) {} // Swallow
2439
- // XXX (@Qix-) should we be logging these?
2440
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2441
-
2442
- if (!r && typeof process !== 'undefined' && 'env' in process) {
2443
- r = process.env.DEBUG;
2444
- }
2445
- return r;
2446
- }
2447
- /**
2448
- * Localstorage attempts to return the localstorage.
2449
- *
2450
- * This is necessary because safari throws
2451
- * when a user disables cookies/localstorage
2452
- * and you attempt to access it.
2453
- *
2454
- * @return {LocalStorage}
2455
- * @api private
2456
- */
2457
-
2458
- function localstorage() {
2459
- try {
2460
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2461
- // The Browser also has localStorage in the global context.
2462
- return localStorage;
2463
- } catch (error) {// Swallow
2464
- // XXX (@Qix-) should we be logging these?
2465
- }
2466
- }
2467
- module.exports = requireCommon()(exports);
2468
- var formatters = module.exports.formatters;
2469
- /**
2470
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2471
- */
2472
-
2473
- formatters.j = function (v) {
2474
- try {
2475
- return JSON.stringify(v);
2476
- } catch (error) {
2477
- return '[UnexpectedJSONParseError]: ' + error.message;
2478
- }
2479
- };
2480
- })(browser, browser.exports);
2481
- return browser.exports;
2482
- }
2483
- var node$2 = {
2484
- exports: {}
2485
- };
2486
- var hasFlag;
2487
- var hasRequiredHasFlag;
2488
- function requireHasFlag() {
2489
- if (hasRequiredHasFlag) return hasFlag;
2490
- hasRequiredHasFlag = 1;
2491
- hasFlag = function (flag) {
2492
- let argv = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.argv;
2493
- const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
2494
- const position = argv.indexOf(prefix + flag);
2495
- const terminatorPosition = argv.indexOf('--');
2496
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
2497
- };
2498
- return hasFlag;
2499
- }
2500
- var supportsColor_1;
2501
- var hasRequiredSupportsColor;
2502
- function requireSupportsColor() {
2503
- if (hasRequiredSupportsColor) return supportsColor_1;
2504
- hasRequiredSupportsColor = 1;
2505
- const os = require$$0__default.default;
2506
- const tty = require$$1__default.default;
2507
- const hasFlag = requireHasFlag();
2508
- const {
2509
- env
2510
- } = process;
2511
- let forceColor;
2512
- if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
2513
- forceColor = 0;
2514
- } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
2515
- forceColor = 1;
2516
- }
2517
- if ('FORCE_COLOR' in env) {
2518
- if (env.FORCE_COLOR === 'true') {
2519
- forceColor = 1;
2520
- } else if (env.FORCE_COLOR === 'false') {
2521
- forceColor = 0;
2522
- } else {
2523
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
2524
- }
2525
- }
2526
- function translateLevel(level) {
2527
- if (level === 0) {
2528
- return false;
2529
- }
2530
- return {
2531
- level,
2532
- hasBasic: true,
2533
- has256: level >= 2,
2534
- has16m: level >= 3
2535
- };
2536
- }
2537
- function supportsColor(haveStream, streamIsTTY) {
2538
- if (forceColor === 0) {
2539
- return 0;
2540
- }
2541
- if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
2542
- return 3;
2543
- }
2544
- if (hasFlag('color=256')) {
2545
- return 2;
2546
- }
2547
- if (haveStream && !streamIsTTY && forceColor === undefined) {
2548
- return 0;
2549
- }
2550
- const min = forceColor || 0;
2551
- if (env.TERM === 'dumb') {
2552
- return min;
2553
- }
2554
- if (process.platform === 'win32') {
2555
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
2556
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
2557
- const osRelease = os.release().split('.');
2558
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
2559
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
2560
- }
2561
- return 1;
2562
- }
2563
- if ('CI' in env) {
2564
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
2565
- return 1;
2566
- }
2567
- return min;
2568
- }
2569
- if ('TEAMCITY_VERSION' in env) {
2570
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2571
- }
2572
- if (env.COLORTERM === 'truecolor') {
2573
- return 3;
2574
- }
2575
- if ('TERM_PROGRAM' in env) {
2576
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2577
- switch (env.TERM_PROGRAM) {
2578
- case 'iTerm.app':
2579
- return version >= 3 ? 3 : 2;
2580
- case 'Apple_Terminal':
2581
- return 2;
2582
- // No default
2583
- }
2584
- }
2585
-
2586
- if (/-256(color)?$/i.test(env.TERM)) {
2587
- return 2;
2588
- }
2589
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
2590
- return 1;
2591
- }
2592
- if ('COLORTERM' in env) {
2593
- return 1;
2594
- }
2595
- return min;
2596
- }
2597
- function getSupportLevel(stream) {
2598
- const level = supportsColor(stream, stream && stream.isTTY);
2599
- return translateLevel(level);
2600
- }
2601
- supportsColor_1 = {
2602
- supportsColor: getSupportLevel,
2603
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
2604
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
2605
- };
2606
- return supportsColor_1;
2607
- }
2608
- var hasRequiredNode;
2609
- function requireNode() {
2610
- if (hasRequiredNode) return node$2.exports;
2611
- hasRequiredNode = 1;
2612
- (function (module, exports) {
2613
- /**
2614
- * Module dependencies.
2615
- */
2616
- var tty = require$$1__default.default;
2617
- var util = require$$1__default$1.default;
2618
- /**
2619
- * This is the Node.js implementation of `debug()`.
2620
- */
2621
-
2622
- exports.init = init;
2623
- exports.log = log;
2624
- exports.formatArgs = formatArgs;
2625
- exports.save = save;
2626
- exports.load = load;
2627
- exports.useColors = useColors;
2628
- /**
2629
- * Colors.
2630
- */
2631
-
2632
- exports.colors = [6, 2, 3, 4, 5, 1];
2633
- try {
2634
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
2635
- // eslint-disable-next-line import/no-extraneous-dependencies
2636
- var supportsColor = requireSupportsColor();
2637
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
2638
- exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
2639
- }
2640
- } catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
2641
-
2642
- /**
2643
- * Build up the default `inspectOpts` object from the environment variables.
2644
- *
2645
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
2646
- */
2647
-
2648
- exports.inspectOpts = Object.keys(process.env).filter(function (key) {
2649
- return /^debug_/i.test(key);
2650
- }).reduce(function (obj, key) {
2651
- // Camel-case
2652
- var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
2653
- return k.toUpperCase();
2654
- }); // Coerce string value into JS value
2655
-
2656
- var val = process.env[key];
2657
- if (/^(yes|on|true|enabled)$/i.test(val)) {
2658
- val = true;
2659
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
2660
- val = false;
2661
- } else if (val === 'null') {
2662
- val = null;
2663
- } else {
2664
- val = Number(val);
2665
- }
2666
- obj[prop] = val;
2667
- return obj;
2668
- }, {});
2669
- /**
2670
- * Is stdout a TTY? Colored output is enabled when `true`.
2671
- */
2672
-
2673
- function useColors() {
2674
- return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
2675
- }
2676
- /**
2677
- * Adds ANSI color escape codes if enabled.
2678
- *
2679
- * @api public
2680
- */
2681
-
2682
- function formatArgs(args) {
2683
- var name = this.namespace,
2684
- useColors = this.useColors;
2685
- if (useColors) {
2686
- var c = this.color;
2687
- var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c);
2688
- var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
2689
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
2690
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m");
2691
- } else {
2692
- args[0] = getDate() + name + ' ' + args[0];
2693
- }
2694
- }
2695
- function getDate() {
2696
- if (exports.inspectOpts.hideDate) {
2697
- return '';
2698
- }
2699
- return new Date().toISOString() + ' ';
2700
- }
2701
- /**
2702
- * Invokes `util.format()` with the specified arguments and writes to stderr.
2703
- */
2704
-
2705
- function log() {
2706
- return process.stderr.write(util.format.apply(util, arguments) + '\n');
2707
- }
2708
- /**
2709
- * Save `namespaces`.
2710
- *
2711
- * @param {String} namespaces
2712
- * @api private
2713
- */
2714
-
2715
- function save(namespaces) {
2716
- if (namespaces) {
2717
- process.env.DEBUG = namespaces;
2718
- } else {
2719
- // If you set a process.env field to null or undefined, it gets cast to the
2720
- // string 'null' or 'undefined'. Just delete instead.
2721
- delete process.env.DEBUG;
2722
- }
2723
- }
2724
- /**
2725
- * Load `namespaces`.
2726
- *
2727
- * @return {String} returns the previously persisted debug modes
2728
- * @api private
2729
- */
2730
-
2731
- function load() {
2732
- return process.env.DEBUG;
2733
- }
2734
- /**
2735
- * Init logic for `debug` instances.
2736
- *
2737
- * Create a new `inspectOpts` object in case `useColors` is set
2738
- * differently for a particular `debug` instance.
2739
- */
2740
-
2741
- function init(debug) {
2742
- debug.inspectOpts = {};
2743
- var keys = Object.keys(exports.inspectOpts);
2744
- for (var i = 0; i < keys.length; i++) {
2745
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
2746
- }
2747
- }
2748
- module.exports = requireCommon()(exports);
2749
- var formatters = module.exports.formatters;
2750
- /**
2751
- * Map %o to `util.inspect()`, all on a single line.
2752
- */
2753
-
2754
- formatters.o = function (v) {
2755
- this.inspectOpts.colors = this.useColors;
2756
- return util.inspect(v, this.inspectOpts).split('\n').map(function (str) {
2757
- return str.trim();
2758
- }).join(' ');
2759
- };
2760
- /**
2761
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
2762
- */
2763
-
2764
- formatters.O = function (v) {
2765
- this.inspectOpts.colors = this.useColors;
2766
- return util.inspect(v, this.inspectOpts);
2767
- };
2768
- })(node$2, node$2.exports);
2769
- return node$2.exports;
2770
- }
2771
-
2772
- /**
2773
- * Detect Electron renderer / nwjs process, which is node, but we should
2774
- * treat as a browser.
2775
- */
2776
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
2777
- src.exports = requireBrowser();
2778
- } else {
2779
- src.exports = requireNode();
2780
- }
2781
- var srcExports = src.exports;
2782
- var debugIt = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
2783
- var __defProp$h = Object.defineProperty;
2784
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, {
2785
- enumerable: true,
2786
- configurable: true,
2787
- writable: true,
2788
- value
2789
- }) : obj[key] = value;
2790
- var __publicField$h = (obj, key, value) => {
2791
- __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
2792
- return value;
2793
- };
2794
- const digitChar = /[0-9]/;
2795
- const attributeCharMatcher = /^[a-zA-Z0-9_]$/;
2796
- const attributeFirstCharMatcher = /^[a-zA-Z_]$/;
2797
- const symbols = {
2798
- operator: ["..", ".", ",", ":", "?"],
2799
- comparator: [">", ">=", "<", "<=", "==", "!="],
2800
- keyword: ["$", "@"],
2801
- boolean: ["true", "false"],
2802
- paren: ["[", "]"]
2803
- };
2804
- const symbolClasses = Object.keys(symbols);
2805
- class Tokenizer {
2806
- constructor(path) {
2807
- __publicField$h(this, "source");
2808
- __publicField$h(this, "i");
2809
- __publicField$h(this, "length");
2810
- __publicField$h(this, "tokenizers");
2811
- this.source = path;
2812
- this.length = path.length;
2813
- this.i = 0;
2814
- this.tokenizers = [this.tokenizeSymbol, this.tokenizeIdentifier, this.tokenizeNumber, this.tokenizeQuoted].map(fn => fn.bind(this));
2815
- }
2816
- tokenize() {
2817
- const result = [];
2818
- while (!this.EOF()) {
2819
- this.chompWhitespace();
2820
- let token = null;
2821
- const found = this.tokenizers.some(tokenizer => {
2822
- token = tokenizer();
2823
- return Boolean(token);
2824
- });
2825
- if (!found || !token) {
2826
- throw new Error("Invalid tokens in jsonpath '".concat(this.source, "' @ ").concat(this.i));
2827
- }
2828
- result.push(token);
2829
- }
2830
- return result;
2831
- }
2832
- takeWhile(fn) {
2833
- const start = this.i;
2834
- let result = "";
2835
- while (!this.EOF()) {
2836
- const nextChar = fn(this.source[this.i]);
2837
- if (nextChar === null) {
2838
- break;
2839
- }
2840
- result += nextChar;
2841
- this.i++;
2842
- }
2843
- if (this.i === start) {
2844
- return null;
2845
- }
2846
- return result;
2847
- }
2848
- EOF() {
2849
- return this.i >= this.length;
2850
- }
2851
- peek() {
2852
- if (this.EOF()) {
2853
- return null;
2854
- }
2855
- return this.source[this.i];
2856
- }
2857
- consume(str) {
2858
- if (this.i + str.length > this.length) {
2859
- throw new Error("Expected ".concat(str, " at end of jsonpath"));
2860
- }
2861
- if (str === this.source.slice(this.i, this.i + str.length)) {
2862
- this.i += str.length;
2863
- } else {
2864
- throw new Error('Expected "'.concat(str, '", but source contained "').concat(this.source.slice()));
2865
- }
2866
- }
2867
- // Tries to match the upcoming bit of string with the provided string. If it matches, returns
2868
- // the string, then advances the read pointer to the next bit. If not, returns null and nothing
2869
- // happens.
2870
- tryConsume(str) {
2871
- if (this.i + str.length > this.length) {
2872
- return null;
2873
- }
2874
- if (str === this.source.slice(this.i, this.i + str.length)) {
2875
- this.i += str.length;
2876
- return str;
2877
- }
2878
- return null;
2879
- }
2880
- chompWhitespace() {
2881
- this.takeWhile(char => {
2882
- return char === " " ? "" : null;
2883
- });
2884
- }
2885
- tokenizeQuoted() {
2886
- const quote = this.peek();
2887
- if (quote === "'" || quote === '"') {
2888
- this.consume(quote);
2889
- let escape = false;
2890
- const inner = this.takeWhile(char => {
2891
- if (escape) {
2892
- escape = false;
2893
- return char;
2894
- }
2895
- if (char === "\\") {
2896
- escape = true;
2897
- return "";
2898
- }
2899
- if (char != quote) {
2900
- return char;
2901
- }
2902
- return null;
2903
- });
2904
- this.consume(quote);
2905
- return {
2906
- type: "quoted",
2907
- value: inner,
2908
- quote: quote === '"' ? "double" : "single"
2909
- };
2910
- }
2911
- return null;
2912
- }
2913
- tokenizeIdentifier() {
2914
- let first = true;
2915
- const identifier = this.takeWhile(char => {
2916
- if (first) {
2917
- first = false;
2918
- return char.match(attributeFirstCharMatcher) ? char : null;
2919
- }
2920
- return char.match(attributeCharMatcher) ? char : null;
2921
- });
2922
- if (identifier !== null) {
2923
- return {
2924
- type: "identifier",
2925
- name: identifier
2926
- };
2927
- }
2928
- return null;
2929
- }
2930
- tokenizeNumber() {
2931
- const start = this.i;
2932
- let dotSeen = false;
2933
- let digitSeen = false;
2934
- let negative = false;
2935
- if (this.peek() === "-") {
2936
- negative = true;
2937
- this.consume("-");
2938
- }
2939
- const number = this.takeWhile(char => {
2940
- if (char === "." && !dotSeen && digitSeen) {
2941
- dotSeen = true;
2942
- return char;
2943
- }
2944
- digitSeen = true;
2945
- return char.match(digitChar) ? char : null;
2946
- });
2947
- if (number !== null) {
2948
- return {
2949
- type: "number",
2950
- value: negative ? -number : +number,
2951
- raw: negative ? "-".concat(number) : number
2952
- };
2953
- }
2954
- this.i = start;
2955
- return null;
2956
- }
2957
- tokenizeSymbol() {
2958
- for (const symbolClass of symbolClasses) {
2959
- const patterns = symbols[symbolClass];
2960
- const symbol = patterns.find(pattern => this.tryConsume(pattern));
2961
- if (symbol) {
2962
- return {
2963
- type: symbolClass,
2964
- symbol
2965
- };
2966
- }
2967
- }
2968
- return null;
2969
- }
2970
- }
2971
- function tokenize(jsonpath) {
2972
- return new Tokenizer(jsonpath).tokenize();
2973
- }
2974
- var __defProp$g = Object.defineProperty;
2975
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, {
2976
- enumerable: true,
2977
- configurable: true,
2978
- writable: true,
2979
- value
2980
- }) : obj[key] = value;
2981
- var __publicField$g = (obj, key, value) => {
2982
- __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
2983
- return value;
2984
- };
2985
- class Parser {
2986
- constructor(path) {
2987
- __publicField$g(this, "tokens");
2988
- __publicField$g(this, "length");
2989
- __publicField$g(this, "i");
2990
- this.tokens = tokenize(path);
2991
- this.length = this.tokens.length;
2992
- this.i = 0;
2993
- }
2994
- parse() {
2995
- return this.parsePath();
2996
- }
2997
- EOF() {
2998
- return this.i >= this.length;
2999
- }
3000
- // Look at upcoming token
3001
- peek() {
3002
- if (this.EOF()) {
3003
- return null;
3004
- }
3005
- return this.tokens[this.i];
3006
- }
3007
- consume() {
3008
- const result = this.peek();
3009
- this.i += 1;
3010
- return result;
3011
- }
3012
- // Return next token if it matches the pattern
3013
- probe(pattern) {
3014
- const token = this.peek();
3015
- if (!token) {
3016
- return null;
3017
- }
3018
- const record = token;
3019
- const match = Object.keys(pattern).every(key => {
3020
- return key in token && pattern[key] === record[key];
3021
- });
3022
- return match ? token : null;
3023
- }
3024
- // Return and consume next token if it matches the pattern
3025
- match(pattern) {
3026
- return this.probe(pattern) ? this.consume() : null;
3027
- }
3028
- parseAttribute() {
3029
- const token = this.match({
3030
- type: "identifier"
3031
- });
3032
- if (token && token.type === "identifier") {
3033
- return {
3034
- type: "attribute",
3035
- name: token.name
3036
- };
3037
- }
3038
- const quoted = this.match({
3039
- type: "quoted",
3040
- quote: "single"
3041
- });
3042
- if (quoted && quoted.type === "quoted") {
3043
- return {
3044
- type: "attribute",
3045
- name: quoted.value || ""
3046
- };
3047
- }
3048
- return null;
3049
- }
3050
- parseAlias() {
3051
- if (this.match({
3052
- type: "keyword",
3053
- symbol: "@"
3054
- }) || this.match({
3055
- type: "keyword",
3056
- symbol: "$"
3057
- })) {
3058
- return {
3059
- type: "alias",
3060
- target: "self"
3061
- };
3062
- }
3063
- return null;
3064
- }
3065
- parseNumber() {
3066
- const token = this.match({
3067
- type: "number"
3068
- });
3069
- if (token && token.type === "number") {
3070
- return {
3071
- type: "number",
3072
- value: token.value
3073
- };
3074
- }
3075
- return null;
3076
- }
3077
- parseNumberValue() {
3078
- const expr = this.parseNumber();
3079
- if (expr) {
3080
- return expr.value;
3081
- }
3082
- return null;
3083
- }
3084
- parseSliceSelector() {
3085
- const start = this.i;
3086
- const rangeStart = this.parseNumberValue();
3087
- const colon1 = this.match({
3088
- type: "operator",
3089
- symbol: ":"
3090
- });
3091
- if (!colon1) {
3092
- if (rangeStart === null) {
3093
- this.i = start;
3094
- return null;
3095
- }
3096
- return {
3097
- type: "index",
3098
- value: rangeStart
3099
- };
3100
- }
3101
- const result = {
3102
- type: "range",
3103
- start: rangeStart,
3104
- end: this.parseNumberValue()
3105
- };
3106
- const colon2 = this.match({
3107
- type: "operator",
3108
- symbol: ":"
3109
- });
3110
- if (colon2) {
3111
- result.step = this.parseNumberValue();
3112
- }
3113
- if (result.start === null && result.end === null) {
3114
- this.i = start;
3115
- return null;
3116
- }
3117
- return result;
3118
- }
3119
- parseValueReference() {
3120
- return this.parseAttribute() || this.parseSliceSelector();
3121
- }
3122
- parseLiteralValue() {
3123
- const literalString = this.match({
3124
- type: "quoted",
3125
- quote: "double"
3126
- });
3127
- if (literalString && literalString.type === "quoted") {
3128
- return {
3129
- type: "string",
3130
- value: literalString.value || ""
3131
- };
3132
- }
3133
- const literalBoolean = this.match({
3134
- type: "boolean"
3135
- });
3136
- if (literalBoolean && literalBoolean.type === "boolean") {
3137
- return {
3138
- type: "boolean",
3139
- value: literalBoolean.symbol === "true"
3140
- };
3141
- }
3142
- return this.parseNumber();
3143
- }
3144
- // TODO: Reorder constraints so that literal value is always on rhs, and variable is always
3145
- // on lhs.
3146
- parseFilterExpression() {
3147
- const start = this.i;
3148
- const expr = this.parseAttribute() || this.parseAlias();
3149
- if (!expr) {
3150
- return null;
3151
- }
3152
- if (this.match({
3153
- type: "operator",
3154
- symbol: "?"
3155
- })) {
3156
- return {
3157
- type: "constraint",
3158
- operator: "?",
3159
- lhs: expr
3160
- };
3161
- }
3162
- const binOp = this.match({
3163
- type: "comparator"
3164
- });
3165
- if (!binOp || binOp.type !== "comparator") {
3166
- this.i = start;
3167
- return null;
3168
- }
3169
- const lhs = expr;
3170
- const rhs = this.parseLiteralValue();
3171
- if (!rhs) {
3172
- throw new Error("Operator ".concat(binOp.symbol, " needs a literal value at the right hand side"));
3173
- }
3174
- return {
3175
- type: "constraint",
3176
- operator: binOp.symbol,
3177
- lhs,
3178
- rhs
3179
- };
3180
- }
3181
- parseExpression() {
3182
- return this.parseFilterExpression() || this.parseValueReference();
3183
- }
3184
- parseUnion() {
3185
- if (!this.match({
3186
- type: "paren",
3187
- symbol: "["
3188
- })) {
3189
- return null;
3190
- }
3191
- const terms = [];
3192
- let expr = this.parseFilterExpression() || this.parsePath() || this.parseValueReference();
3193
- while (expr) {
3194
- terms.push(expr);
3195
- if (this.match({
3196
- type: "paren",
3197
- symbol: "]"
3198
- })) {
3199
- break;
3200
- }
3201
- if (!this.match({
3202
- type: "operator",
3203
- symbol: ","
3204
- })) {
3205
- throw new Error("Expected ]");
3206
- }
3207
- expr = this.parseFilterExpression() || this.parsePath() || this.parseValueReference();
3208
- if (!expr) {
3209
- throw new Error("Expected expression following ','");
3210
- }
3211
- }
3212
- return {
3213
- type: "union",
3214
- nodes: terms
3215
- };
3216
- }
3217
- parseRecursive() {
3218
- if (!this.match({
3219
- type: "operator",
3220
- symbol: ".."
3221
- })) {
3222
- return null;
3223
- }
3224
- const subpath = this.parsePath();
3225
- if (!subpath) {
3226
- throw new Error("Expected path following '..' operator");
3227
- }
3228
- return {
3229
- type: "recursive",
3230
- term: subpath
3231
- };
3232
- }
3233
- parsePath() {
3234
- const nodes = [];
3235
- const expr = this.parseAttribute() || this.parseUnion() || this.parseRecursive();
3236
- if (!expr) {
3237
- return null;
3238
- }
3239
- nodes.push(expr);
3240
- while (!this.EOF()) {
3241
- if (this.match({
3242
- type: "operator",
3243
- symbol: "."
3244
- })) {
3245
- const attr = this.parseAttribute();
3246
- if (!attr) {
3247
- throw new Error("Expected attribute name following '.");
3248
- }
3249
- nodes.push(attr);
3250
- continue;
3251
- } else if (this.probe({
3252
- type: "paren",
3253
- symbol: "["
3254
- })) {
3255
- const union = this.parseUnion();
3256
- if (!union) {
3257
- throw new Error("Expected union following '['");
3258
- }
3259
- nodes.push(union);
3260
- } else {
3261
- const recursive = this.parseRecursive();
3262
- if (recursive) {
3263
- nodes.push(recursive);
3264
- }
3265
- break;
3266
- }
3267
- }
3268
- if (nodes.length === 1) {
3269
- return nodes[0];
3270
- }
3271
- return {
3272
- type: "path",
3273
- nodes
3274
- };
3275
- }
3276
- }
3277
- function parseJsonPath(path) {
3278
- const parsed = new Parser(path).parse();
3279
- if (!parsed) {
3280
- throw new Error('Failed to parse JSON path "'.concat(path, '"'));
3281
- }
3282
- return parsed;
3283
- }
3284
- function descend$1(tail) {
3285
- const [head, newTail] = splitIfPath(tail);
3286
- if (!head) {
3287
- throw new Error("Head cannot be null");
3288
- }
3289
- return spreadIfUnionHead(head, newTail);
3290
- }
3291
- function splitIfPath(tail) {
3292
- if (tail.type !== "path") {
3293
- return [tail, null];
3294
- }
3295
- const nodes = tail.nodes;
3296
- if (nodes.length === 0) {
3297
- return [null, null];
3298
- }
3299
- if (nodes.length === 1) {
3300
- return [nodes[0], null];
3301
- }
3302
- return [nodes[0], {
3303
- type: "path",
3304
- nodes: nodes.slice(1)
3305
- }];
3306
- }
3307
- function concatPaths(path1, path2) {
3308
- if (!path1 && !path2) {
3309
- return null;
3310
- }
3311
- const nodes1 = path1 ? path1.nodes : [];
3312
- const nodes2 = path2 ? path2.nodes : [];
3313
- return {
3314
- type: "path",
3315
- nodes: nodes1.concat(nodes2)
3316
- };
3317
- }
3318
- function spreadIfUnionHead(head, tail) {
3319
- if (head.type !== "union") {
3320
- return [[head, tail]];
3321
- }
3322
- return head.nodes.map(node => {
3323
- if (node.type === "path") {
3324
- const [subHead, subTail] = splitIfPath(node);
3325
- return [subHead, concatPaths(subTail, tail)];
3326
- }
3327
- return [node, tail];
3328
- });
3329
- }
3330
- function toPath(expr) {
3331
- return toPathInner(expr, false);
3332
- }
3333
- function toPathInner(expr, inUnion) {
3334
- switch (expr.type) {
3335
- case "attribute":
3336
- return expr.name;
3337
- case "alias":
3338
- return expr.target === "self" ? "@" : "$";
3339
- case "number":
3340
- return "".concat(expr.value);
3341
- case "range":
3342
- {
3343
- const result = [];
3344
- if (!inUnion) {
3345
- result.push("[");
3346
- }
3347
- if (expr.start) {
3348
- result.push("".concat(expr.start));
3349
- }
3350
- result.push(":");
3351
- if (expr.end) {
3352
- result.push("".concat(expr.end));
3353
- }
3354
- if (expr.step) {
3355
- result.push(":".concat(expr.step));
3356
- }
3357
- if (!inUnion) {
3358
- result.push("]");
3359
- }
3360
- return result.join("");
3361
- }
3362
- case "index":
3363
- if (inUnion) {
3364
- return "".concat(expr.value);
3365
- }
3366
- return "[".concat(expr.value, "]");
3367
- case "constraint":
3368
- {
3369
- const rhs = expr.rhs ? " ".concat(toPathInner(expr.rhs, false)) : "";
3370
- const inner = "".concat(toPathInner(expr.lhs, false), " ").concat(expr.operator).concat(rhs);
3371
- if (inUnion) {
3372
- return inner;
3373
- }
3374
- return "[".concat(inner, "]");
3375
- }
3376
- case "string":
3377
- return JSON.stringify(expr.value);
3378
- case "path":
3379
- {
3380
- const result = [];
3381
- const nodes = expr.nodes.slice();
3382
- while (nodes.length > 0) {
3383
- const node = nodes.shift();
3384
- if (node) {
3385
- result.push(toPath(node));
3386
- }
3387
- const upcoming = nodes[0];
3388
- if (upcoming && toPathInner(upcoming, false)[0] !== "[") {
3389
- result.push(".");
3390
- }
3391
- }
3392
- return result.join("");
3393
- }
3394
- case "union":
3395
- return "[".concat(expr.nodes.map(e => toPathInner(e, true)).join(","), "]");
3396
- default:
3397
- throw new Error("Unknown node type ".concat(expr.type));
3398
- case "recursive":
3399
- return "..".concat(toPathInner(expr.term, false));
3400
- }
3401
- }
3402
- var __defProp$f = Object.defineProperty;
3403
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, {
3404
- enumerable: true,
3405
- configurable: true,
3406
- writable: true,
3407
- value
3408
- }) : obj[key] = value;
3409
- var __publicField$f = (obj, key, value) => {
3410
- __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
3411
- return value;
3412
- };
3413
- class Expression {
3414
- constructor(expr) {
3415
- __publicField$f(this, "expr");
3416
- if (!expr) {
3417
- throw new Error("Attempted to create Expression from null-value");
3418
- }
3419
- if ("expr" in expr) {
3420
- this.expr = expr.expr;
3421
- } else {
3422
- this.expr = expr;
3423
- }
3424
- if (!("type" in this.expr)) {
3425
- throw new Error("Attempt to create Expression for expression with no type");
3426
- }
3427
- }
3428
- isPath() {
3429
- return this.expr.type === "path";
3430
- }
3431
- isUnion() {
3432
- return this.expr.type === "union";
3433
- }
3434
- isCollection() {
3435
- return this.isPath() || this.isUnion();
3436
- }
3437
- isConstraint() {
3438
- return this.expr.type === "constraint";
3439
- }
3440
- isRecursive() {
3441
- return this.expr.type === "recursive";
3442
- }
3443
- isExistenceConstraint() {
3444
- return this.expr.type === "constraint" && this.expr.operator === "?";
3445
- }
3446
- isIndex() {
3447
- return this.expr.type === "index";
3448
- }
3449
- isRange() {
3450
- return this.expr.type === "range";
3451
- }
3452
- expandRange(probe) {
3453
- const probeLength = () => {
3454
- if (!probe) {
3455
- throw new Error("expandRange() required a probe that was not passed");
3456
- }
3457
- return probe.length();
3458
- };
3459
- let start = "start" in this.expr ? this.expr.start || 0 : 0;
3460
- start = interpretNegativeIndex(start, probe);
3461
- let end = "end" in this.expr ? this.expr.end || probeLength() : probeLength();
3462
- end = interpretNegativeIndex(end, probe);
3463
- const step = "step" in this.expr ? this.expr.step || 1 : 1;
3464
- return {
3465
- start,
3466
- end,
3467
- step
3468
- };
3469
- }
3470
- isAttributeReference() {
3471
- return this.expr.type === "attribute";
3472
- }
3473
- // Is a range or index -> something referencing indexes
3474
- isIndexReference() {
3475
- return this.isIndex() || this.isRange();
3476
- }
3477
- name() {
3478
- return "name" in this.expr ? this.expr.name : "";
3479
- }
3480
- isSelfReference() {
3481
- return this.expr.type === "alias" && this.expr.target === "self";
3482
- }
3483
- constraintTargetIsSelf() {
3484
- return this.expr.type === "constraint" && this.expr.lhs.type === "alias" && this.expr.lhs.target === "self";
3485
- }
3486
- constraintTargetIsAttribute() {
3487
- return this.expr.type === "constraint" && this.expr.lhs.type === "attribute";
3488
- }
3489
- testConstraint(probe) {
3490
- const expr = this.expr;
3491
- if (expr.type === "constraint" && expr.lhs.type === "alias" && expr.lhs.target === "self") {
3492
- if (probe.containerType() !== "primitive") {
3493
- return false;
3494
- }
3495
- if (expr.type === "constraint" && expr.operator === "?") {
3496
- return true;
3497
- }
3498
- const lhs2 = probe.get();
3499
- const rhs2 = expr.rhs && "value" in expr.rhs ? expr.rhs.value : void 0;
3500
- return testBinaryOperator(lhs2, expr.operator, rhs2);
3501
- }
3502
- if (expr.type !== "constraint") {
3503
- return false;
3504
- }
3505
- const lhs = expr.lhs;
3506
- if (!lhs) {
3507
- throw new Error("No LHS of expression");
3508
- }
3509
- if (lhs.type !== "attribute") {
3510
- throw new Error("Constraint target ".concat(lhs.type, " not supported"));
3511
- }
3512
- if (probe.containerType() !== "object") {
3513
- return false;
3514
- }
3515
- const lhsValue = probe.getAttribute(lhs.name);
3516
- if (lhsValue === void 0 || lhsValue === null || lhsValue.containerType() !== "primitive") {
3517
- return false;
3518
- }
3519
- if (this.isExistenceConstraint()) {
3520
- return true;
3521
- }
3522
- const rhs = expr.rhs && "value" in expr.rhs ? expr.rhs.value : void 0;
3523
- return testBinaryOperator(lhsValue.get(), expr.operator, rhs);
3524
- }
3525
- pathNodes() {
3526
- return this.expr.type === "path" ? this.expr.nodes : [this.expr];
3527
- }
3528
- prepend(node) {
3529
- if (!node) {
3530
- return this;
3531
- }
3532
- return new Expression({
3533
- type: "path",
3534
- nodes: node.pathNodes().concat(this.pathNodes())
3535
- });
3536
- }
3537
- concat(other) {
3538
- return other ? other.prepend(this) : this;
3539
- }
3540
- descend() {
3541
- return descend$1(this.expr).map(headTail => {
3542
- const [head, tail] = headTail;
3543
- return {
3544
- head: head ? new Expression(head) : null,
3545
- tail: tail ? new Expression(tail) : null
3546
- };
3547
- });
3548
- }
3549
- unwrapRecursive() {
3550
- if (this.expr.type !== "recursive") {
3551
- throw new Error("Attempt to unwrap recursive on type ".concat(this.expr.type));
3552
- }
3553
- return new Expression(this.expr.term);
3554
- }
3555
- toIndicies(probe) {
3556
- if (this.expr.type !== "index" && this.expr.type !== "range") {
3557
- throw new Error("Node cannot be converted to indexes");
3558
- }
3559
- if (this.expr.type === "index") {
3560
- return [interpretNegativeIndex(this.expr.value, probe)];
3561
- }
3562
- const result = [];
3563
- const range = this.expandRange(probe);
3564
- let {
3565
- start,
3566
- end
3567
- } = range;
3568
- if (range.step < 0) {
3569
- [start, end] = [end, start];
3570
- }
3571
- for (let i = start; i < end; i++) {
3572
- result.push(i);
3573
- }
3574
- return result;
3575
- }
3576
- toFieldReferences() {
3577
- if (this.isIndexReference()) {
3578
- return this.toIndicies();
3579
- }
3580
- if (this.expr.type === "attribute") {
3581
- return [this.expr.name];
3582
- }
3583
- throw new Error("Can't convert ".concat(this.expr.type, " to field references"));
3584
- }
3585
- toString() {
3586
- return toPath(this.expr);
3587
- }
3588
- static fromPath(path) {
3589
- const parsed = parseJsonPath(path);
3590
- if (!parsed) {
3591
- throw new Error('Failed to parse path "'.concat(path, '"'));
3592
- }
3593
- return new Expression(parsed);
3594
- }
3595
- static attributeReference(name) {
3596
- return new Expression({
3597
- type: "attribute",
3598
- name
3599
- });
3600
- }
3601
- static indexReference(i) {
3602
- return new Expression({
3603
- type: "index",
3604
- value: i
3605
- });
3606
- }
3607
- }
3608
- function testBinaryOperator(lhsValue, operator, rhsValue) {
3609
- switch (operator) {
3610
- case ">":
3611
- return lhsValue > rhsValue;
3612
- case ">=":
3613
- return lhsValue >= rhsValue;
3614
- case "<":
3615
- return lhsValue < rhsValue;
3616
- case "<=":
3617
- return lhsValue <= rhsValue;
3618
- case "==":
3619
- return lhsValue === rhsValue;
3620
- case "!=":
3621
- return lhsValue !== rhsValue;
3622
- default:
3623
- throw new Error("Unsupported binary operator ".concat(operator));
3624
- }
3625
- }
3626
- function interpretNegativeIndex(index, probe) {
3627
- if (index >= 0) {
3628
- return index;
3629
- }
3630
- if (!probe) {
3631
- throw new Error("interpretNegativeIndex() must have a probe when < 0");
3632
- }
3633
- return index + probe.length();
3634
- }
3635
- var __defProp$e = Object.defineProperty;
3636
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, {
3637
- enumerable: true,
3638
- configurable: true,
3639
- writable: true,
3640
- value
3641
- }) : obj[key] = value;
3642
- var __publicField$e = (obj, key, value) => {
3643
- __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
3644
- return value;
3645
- };
3646
- class Descender {
3647
- constructor(head, tail) {
3648
- __publicField$e(this, "head");
3649
- __publicField$e(this, "tail");
3650
- this.head = head;
3651
- this.tail = tail;
3652
- }
3653
- // Iterate this descender once processing any constraints that are
3654
- // resolvable on the current value. Returns an array of new descenders
3655
- // that are guaranteed to be without constraints in the head
3656
- iterate(probe) {
3657
- let result = [this];
3658
- if (this.head && this.head.isConstraint()) {
3659
- let anyConstraints = true;
3660
- while (anyConstraints) {
3661
- result = flatten$1(result.map(descender => {
3662
- return descender.iterateConstraints(probe);
3663
- }));
3664
- anyConstraints = result.some(descender => {
3665
- return descender.head && descender.head.isConstraint();
3666
- });
3667
- }
3668
- }
3669
- return result;
3670
- }
3671
- isRecursive() {
3672
- return Boolean(this.head && this.head.isRecursive());
3673
- }
3674
- hasArrived() {
3675
- return this.head === null && this.tail === null;
3676
- }
3677
- extractRecursives() {
3678
- if (this.head && this.head.isRecursive()) {
3679
- const term = this.head.unwrapRecursive();
3680
- return new Descender(null, term.concat(this.tail)).descend();
3681
- }
3682
- return [];
3683
- }
3684
- iterateConstraints(probe) {
3685
- const head = this.head;
3686
- if (head === null || !head.isConstraint()) {
3687
- return [this];
3688
- }
3689
- const result = [];
3690
- if (probe.containerType() === "primitive" && head.constraintTargetIsSelf()) {
3691
- if (head.testConstraint(probe)) {
3692
- result.push(...this.descend());
3693
- }
3694
- return result;
3695
- }
3696
- if (probe.containerType() === "array") {
3697
- const length = probe.length();
3698
- for (let i = 0; i < length; i++) {
3699
- const constraint = probe.getIndex(i);
3700
- if (constraint && head.testConstraint(constraint)) {
3701
- result.push(new Descender(new Expression({
3702
- type: "index",
3703
- value: i
3704
- }), this.tail));
3705
- }
3706
- }
3707
- return result;
3708
- }
3709
- if (probe.containerType() === "object") {
3710
- if (head.constraintTargetIsSelf()) {
3711
- return [];
3712
- }
3713
- if (head.testConstraint(probe)) {
3714
- return this.descend();
3715
- }
3716
- return result;
3717
- }
3718
- return result;
3719
- }
3720
- descend() {
3721
- if (!this.tail) {
3722
- return [new Descender(null, null)];
3723
- }
3724
- return this.tail.descend().map(ht => {
3725
- return new Descender(ht.head, ht.tail);
3726
- });
3727
- }
3728
- toString() {
3729
- const result = ["<"];
3730
- if (this.head) {
3731
- result.push(this.head.toString());
3732
- }
3733
- result.push("|");
3734
- if (this.tail) {
3735
- result.push(this.tail.toString());
3736
- }
3737
- result.push(">");
3738
- return result.join("");
3739
- }
3740
- }
3741
- var __defProp$d = Object.defineProperty;
3742
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, {
3743
- enumerable: true,
3744
- configurable: true,
3745
- writable: true,
3746
- value
3747
- }) : obj[key] = value;
3748
- var __publicField$d = (obj, key, value) => {
3749
- __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
3750
- return value;
3751
- };
3752
- class Matcher {
3753
- constructor(active, parent) {
3754
- __publicField$d(this, "active");
3755
- __publicField$d(this, "recursives");
3756
- __publicField$d(this, "payload");
3757
- this.active = active || [];
3758
- if (parent) {
3759
- this.recursives = parent.recursives;
3760
- this.payload = parent.payload;
3761
- } else {
3762
- this.recursives = [];
3763
- }
3764
- this.extractRecursives();
3765
- }
3766
- setPayload(payload) {
3767
- this.payload = payload;
3768
- return this;
3769
- }
3770
- // Moves any recursive descenders onto the recursive track, removing them from
3771
- // the active set
3772
- extractRecursives() {
3773
- this.active = this.active.filter(descender => {
3774
- if (descender.isRecursive()) {
3775
- this.recursives.push(...descender.extractRecursives());
3776
- return false;
3777
- }
3778
- return true;
3779
- });
3780
- }
3781
- // Find recursives that are relevant now and should be considered part of the active set
3782
- activeRecursives(probe) {
3783
- return this.recursives.filter(descender => {
3784
- const head = descender.head;
3785
- if (!head) {
3786
- return false;
3787
- }
3788
- if (head.isConstraint()) {
3789
- return true;
3790
- }
3791
- if (probe.containerType() === "array" && head.isIndexReference()) {
3792
- return true;
3793
- }
3794
- if (probe.containerType() === "object") {
3795
- return head.isAttributeReference() && probe.hasAttribute(head.name());
3796
- }
3797
- return false;
3798
- });
3799
- }
3800
- match(probe) {
3801
- return this.iterate(probe).extractMatches(probe);
3802
- }
3803
- iterate(probe) {
3804
- const newActiveSet = [];
3805
- this.active.concat(this.activeRecursives(probe)).forEach(descender => {
3806
- newActiveSet.push(...descender.iterate(probe));
3807
- });
3808
- return new Matcher(newActiveSet, this);
3809
- }
3810
- // Returns true if any of the descenders in the active or recursive set
3811
- // consider the current state a final destination
3812
- isDestination() {
3813
- return this.active.some(descender => descender.hasArrived());
3814
- }
3815
- hasRecursives() {
3816
- return this.recursives.length > 0;
3817
- }
3818
- // Returns any payload delivieries and leads that needs to be followed to complete
3819
- // the process.
3820
- extractMatches(probe) {
3821
- const leads = [];
3822
- const targets = [];
3823
- this.active.forEach(descender => {
3824
- if (descender.hasArrived()) {
3825
- targets.push(new Expression({
3826
- type: "alias",
3827
- target: "self"
3828
- }));
3829
- return;
3830
- }
3831
- const descenderHead = descender.head;
3832
- if (!descenderHead) {
3833
- return;
3834
- }
3835
- if (probe.containerType() === "array" && !descenderHead.isIndexReference()) {
3836
- return;
3837
- }
3838
- if (probe.containerType() === "object" && !descenderHead.isAttributeReference()) {
3839
- return;
3840
- }
3841
- if (descender.tail) {
3842
- const matcher = new Matcher(descender.descend(), this);
3843
- descenderHead.toFieldReferences().forEach(() => {
3844
- leads.push({
3845
- target: descenderHead,
3846
- matcher
3847
- });
3848
- });
3849
- } else {
3850
- targets.push(descenderHead);
3851
- }
3852
- });
3853
- if (this.hasRecursives()) {
3854
- const recursivesMatcher = new Matcher([], this);
3855
- if (probe.containerType() === "array") {
3856
- const length = probe.length();
3857
- for (let i = 0; i < length; i++) {
3858
- leads.push({
3859
- target: Expression.indexReference(i),
3860
- matcher: recursivesMatcher
3861
- });
3862
- }
3863
- } else if (probe.containerType() === "object") {
3864
- probe.attributeKeys().forEach(name => {
3865
- leads.push({
3866
- target: Expression.attributeReference(name),
3867
- matcher: recursivesMatcher
3868
- });
3869
- });
3870
- }
3871
- }
3872
- return targets.length > 0 ? {
3873
- leads,
3874
- delivery: {
3875
- targets,
3876
- payload: this.payload
3877
- }
3878
- } : {
3879
- leads
3880
- };
3881
- }
3882
- static fromPath(jsonpath) {
3883
- const path = parseJsonPath(jsonpath);
3884
- if (!path) {
3885
- throw new Error('Failed to parse path from "'.concat(jsonpath, '"'));
3886
- }
3887
- const descender = new Descender(null, new Expression(path));
3888
- return new Matcher(descender.descend());
3889
- }
3890
- }
3891
- function isRecord$1(value) {
3892
- return value !== null && typeof value === "object";
3893
- }
3894
- var __defProp$c = Object.defineProperty;
3895
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, {
3896
- enumerable: true,
3897
- configurable: true,
3898
- writable: true,
3899
- value
3900
- }) : obj[key] = value;
3901
- var __publicField$c = (obj, key, value) => {
3902
- __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
3903
- return value;
3904
- };
3905
- class PlainProbe {
3906
- constructor(value, path) {
3907
- __publicField$c(this, "_value");
3908
- __publicField$c(this, "path");
3909
- this._value = value;
3910
- this.path = path || [];
3911
- }
3912
- containerType() {
3913
- if (Array.isArray(this._value)) {
3914
- return "array";
3915
- } else if (this._value !== null && typeof this._value === "object") {
3916
- return "object";
3917
- }
3918
- return "primitive";
3919
- }
3920
- length() {
3921
- if (!Array.isArray(this._value)) {
3922
- throw new Error("Won't return length of non-indexable _value");
3923
- }
3924
- return this._value.length;
3925
- }
3926
- getIndex(i) {
3927
- if (!Array.isArray(this._value)) {
3928
- return false;
3929
- }
3930
- if (i >= this.length()) {
3931
- return null;
3932
- }
3933
- return new PlainProbe(this._value[i], this.path.concat(i));
3934
- }
3935
- hasAttribute(key) {
3936
- if (!isRecord$1(this._value)) {
3937
- return false;
3938
- }
3939
- return this._value.hasOwnProperty(key);
3940
- }
3941
- attributeKeys() {
3942
- return isRecord$1(this._value) ? Object.keys(this._value) : [];
3943
- }
3944
- getAttribute(key) {
3945
- if (!isRecord$1(this._value)) {
3946
- throw new Error("getAttribute only applies to plain objects");
3947
- }
3948
- if (!this.hasAttribute(key)) {
3949
- return null;
3950
- }
3951
- return new PlainProbe(this._value[key], this.path.concat(key));
3952
- }
3953
- get() {
3954
- return this._value;
3955
- }
3956
- }
3957
- function extractAccessors(path, value) {
3958
- const result = [];
3959
- const matcher = Matcher.fromPath(path).setPayload(function appendResult(values) {
3960
- result.push(...values);
3961
- });
3962
- const accessor = new PlainProbe(value);
3963
- descend(matcher, accessor);
3964
- return result;
3965
- }
3966
- function descend(matcher, accessor) {
3967
- const {
3968
- leads,
3969
- delivery
3970
- } = matcher.match(accessor);
3971
- leads.forEach(lead => {
3972
- accessorsFromTarget(lead.target, accessor).forEach(childAccessor => {
3973
- descend(lead.matcher, childAccessor);
3974
- });
3975
- });
3976
- if (delivery) {
3977
- delivery.targets.forEach(target => {
3978
- if (typeof delivery.payload === "function") {
3979
- delivery.payload(accessorsFromTarget(target, accessor));
3980
- }
3981
- });
3982
- }
3983
- }
3984
- function accessorsFromTarget(target, accessor) {
3985
- const result = [];
3986
- if (target.isIndexReference()) {
3987
- target.toIndicies(accessor).forEach(i => {
3988
- result.push(accessor.getIndex(i));
3989
- });
3990
- } else if (target.isAttributeReference()) {
3991
- result.push(accessor.getAttribute(target.name()));
3992
- } else if (target.isSelfReference()) {
3993
- result.push(accessor);
3994
- } else {
3995
- throw new Error("Unable to derive accessor for target ".concat(target.toString()));
3996
- }
3997
- return compact$1(result);
3998
- }
3999
- function extractWithPath(path, value) {
4000
- const accessors = extractAccessors(path, value);
4001
- return accessors.map(acc => ({
4002
- path: acc.path,
4003
- value: acc.get()
4004
- }));
4005
- }
4006
- debugIt("mutator-document");
4007
523
  const maxDepth = 6;
4008
524
  function getTypeIcon(schemaType) {
4009
525
  let t = schemaType;
@@ -4091,7 +607,7 @@ function getTypePath(doc, pathString) {
4091
607
  const syntheticPath = path.map(segment => {
4092
608
  currentPath.push(segment);
4093
609
  if (sanity.isKeySegment(segment)) {
4094
- const match = extractWithPath(sanity.pathToString(currentPath), doc)[0];
610
+ const match = mutator.extractWithPath(sanity.pathToString(currentPath), doc)[0];
4095
611
  const value = match == null ? void 0 : match.value;
4096
612
  if (match && value && typeof value === "object" && "_type" in value) {
4097
613
  return {
@@ -7626,7 +4142,7 @@ const fieldInstructions = sanity.defineType({
7626
4142
  });
7627
4143
  const assistDocumentSchema = sanity.defineType({
7628
4144
  //NOTE: this is a document type. Using object here ensures it does not appear in structure menus
7629
- type: "document",
4145
+ type: "object",
7630
4146
  //workaround for using object and not document
7631
4147
  ...{
7632
4148
  liveEdit: true