vega 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,8 +27,8 @@
27
27
 
28
28
  /*!
29
29
  * https://github.com/Starcounter-Jack/JSON-Patch
30
- * (c) 2017 Joachim Wester
31
- * MIT license
30
+ * (c) 2017-2022 Joachim Wester
31
+ * MIT licensed
32
32
  */
33
33
  var __extends = undefined && undefined.__extends || function () {
34
34
  var extendStatics = function (d, b) {
@@ -60,13 +60,13 @@
60
60
  }
61
61
  function _objectKeys(obj) {
62
62
  if (Array.isArray(obj)) {
63
- var keys = new Array(obj.length);
63
+ var keys_1 = new Array(obj.length);
64
64
 
65
- for (var k = 0; k < keys.length; k++) {
66
- keys[k] = "" + k;
65
+ for (var k = 0; k < keys_1.length; k++) {
66
+ keys_1[k] = "" + k;
67
67
  }
68
68
 
69
- return keys;
69
+ return keys_1;
70
70
  }
71
71
 
72
72
  if (Object.keys) {
@@ -154,8 +154,8 @@
154
154
 
155
155
  if (obj) {
156
156
  if (Array.isArray(obj)) {
157
- for (var i = 0, len = obj.length; i < len; i++) {
158
- if (hasUndefined(obj[i])) {
157
+ for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {
158
+ if (hasUndefined(obj[i_1])) {
159
159
  return true;
160
160
  }
161
161
  }
@@ -483,8 +483,8 @@
483
483
  key = unescapePathComponent(key);
484
484
  }
485
485
 
486
- if (banPrototypeModifications && key == '__proto__') {
487
- throw new TypeError('JSON-Patch: modifying `__proto__` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');
486
+ if (banPrototypeModifications && (key == '__proto__' || key == 'prototype' && t > 0 && keys[t - 1] == 'constructor')) {
487
+ throw new TypeError('JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');
488
488
  }
489
489
 
490
490
  if (validateOperation) {
@@ -766,7 +766,7 @@
766
766
 
767
767
  /*!
768
768
  * https://github.com/Starcounter-Jack/JSON-Patch
769
- * (c) 2017 Joachim Wester
769
+ * (c) 2017-2021 Joachim Wester
770
770
  * MIT license
771
771
  */
772
772
  var beforeDict = new WeakMap();
@@ -1918,16 +1918,16 @@
1918
1918
 
1919
1919
  const opts = ['includePrerelease', 'loose', 'rtl'];
1920
1920
 
1921
- const parseOptions$3 = options => !options ? {} : typeof options !== 'object' ? {
1921
+ const parseOptions$1 = options => !options ? {} : typeof options !== 'object' ? {
1922
1922
  loose: true
1923
- } : opts.filter(k => options[k]).reduce((options, k) => {
1924
- options[k] = true;
1925
- return options;
1923
+ } : opts.filter(k => options[k]).reduce((o, k) => {
1924
+ o[k] = true;
1925
+ return o;
1926
1926
  }, {});
1927
1927
 
1928
- var parseOptions_1 = parseOptions$3;
1928
+ var parseOptions_1 = parseOptions$1;
1929
1929
 
1930
- var re$3 = {exports: {}};
1930
+ var re$1 = {exports: {}};
1931
1931
 
1932
1932
  // Not necessarily the package version of this code.
1933
1933
 
@@ -1945,14 +1945,14 @@
1945
1945
  MAX_SAFE_COMPONENT_LENGTH
1946
1946
  };
1947
1947
 
1948
- const debug$3 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? function () {
1948
+ const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? function () {
1949
1949
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1950
1950
  args[_key] = arguments[_key];
1951
1951
  }
1952
1952
 
1953
1953
  return console.error('SEMVER', ...args);
1954
1954
  } : () => {};
1955
- var debug_1 = debug$3;
1955
+ var debug_1 = debug$1;
1956
1956
 
1957
1957
  (function (module, exports) {
1958
1958
  const {
@@ -1968,7 +1968,7 @@
1968
1968
 
1969
1969
  const createToken = (name, value, isGlobal) => {
1970
1970
  const index = R++;
1971
- debug(index, value);
1971
+ debug(name, index, value);
1972
1972
  t[name] = index;
1973
1973
  src[index] = value;
1974
1974
  re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
@@ -2062,9 +2062,9 @@
2062
2062
 
2063
2063
  createToken('STAR', '(<|>)?=?\\s*\\*'); // >=0.0.0 is like a star
2064
2064
 
2065
- createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$');
2066
- createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$');
2067
- })(re$3, re$3.exports);
2065
+ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
2066
+ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
2067
+ })(re$1, re$1.exports);
2068
2068
 
2069
2069
  const numeric = /^[0-9]+$/;
2070
2070
 
@@ -2087,25 +2087,25 @@
2087
2087
  rcompareIdentifiers
2088
2088
  };
2089
2089
 
2090
- const debug$2 = debug_1;
2090
+ const debug = debug_1;
2091
2091
  const {
2092
2092
  MAX_LENGTH,
2093
2093
  MAX_SAFE_INTEGER
2094
2094
  } = constants;
2095
2095
  const {
2096
- re: re$2,
2097
- t: t$2
2098
- } = re$3.exports;
2099
- const parseOptions$2 = parseOptions_1;
2096
+ re,
2097
+ t
2098
+ } = re$1.exports;
2099
+ const parseOptions = parseOptions_1;
2100
2100
  const {
2101
2101
  compareIdentifiers
2102
2102
  } = identifiers;
2103
2103
 
2104
- class SemVer$3 {
2104
+ class SemVer$1 {
2105
2105
  constructor(version, options) {
2106
- options = parseOptions$2(options);
2106
+ options = parseOptions(options);
2107
2107
 
2108
- if (version instanceof SemVer$3) {
2108
+ if (version instanceof SemVer$1) {
2109
2109
  if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
2110
2110
  return version;
2111
2111
  } else {
@@ -2119,13 +2119,13 @@
2119
2119
  throw new TypeError("version is longer than ".concat(MAX_LENGTH, " characters"));
2120
2120
  }
2121
2121
 
2122
- debug$2('SemVer', version, options);
2122
+ debug('SemVer', version, options);
2123
2123
  this.options = options;
2124
2124
  this.loose = !!options.loose; // this isn't actually relevant for versions, but keep it so that we
2125
2125
  // don't run into trouble passing this.options around.
2126
2126
 
2127
2127
  this.includePrerelease = !!options.includePrerelease;
2128
- const m = version.trim().match(options.loose ? re$2[t$2.LOOSE] : re$2[t$2.FULL]);
2128
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
2129
2129
 
2130
2130
  if (!m) {
2131
2131
  throw new TypeError("Invalid Version: ".concat(version));
@@ -2185,14 +2185,14 @@
2185
2185
  }
2186
2186
 
2187
2187
  compare(other) {
2188
- debug$2('SemVer.compare', this.version, this.options, other);
2188
+ debug('SemVer.compare', this.version, this.options, other);
2189
2189
 
2190
- if (!(other instanceof SemVer$3)) {
2190
+ if (!(other instanceof SemVer$1)) {
2191
2191
  if (typeof other === 'string' && other === this.version) {
2192
2192
  return 0;
2193
2193
  }
2194
2194
 
2195
- other = new SemVer$3(other, this.options);
2195
+ other = new SemVer$1(other, this.options);
2196
2196
  }
2197
2197
 
2198
2198
  if (other.version === this.version) {
@@ -2203,16 +2203,16 @@
2203
2203
  }
2204
2204
 
2205
2205
  compareMain(other) {
2206
- if (!(other instanceof SemVer$3)) {
2207
- other = new SemVer$3(other, this.options);
2206
+ if (!(other instanceof SemVer$1)) {
2207
+ other = new SemVer$1(other, this.options);
2208
2208
  }
2209
2209
 
2210
2210
  return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
2211
2211
  }
2212
2212
 
2213
2213
  comparePre(other) {
2214
- if (!(other instanceof SemVer$3)) {
2215
- other = new SemVer$3(other, this.options);
2214
+ if (!(other instanceof SemVer$1)) {
2215
+ other = new SemVer$1(other, this.options);
2216
2216
  } // NOT having a prerelease is > having one
2217
2217
 
2218
2218
 
@@ -2229,7 +2229,7 @@
2229
2229
  do {
2230
2230
  const a = this.prerelease[i];
2231
2231
  const b = other.prerelease[i];
2232
- debug$2('prerelease compare', i, a, b);
2232
+ debug('prerelease compare', i, a, b);
2233
2233
 
2234
2234
  if (a === undefined && b === undefined) {
2235
2235
  return 0;
@@ -2246,8 +2246,8 @@
2246
2246
  }
2247
2247
 
2248
2248
  compareBuild(other) {
2249
- if (!(other instanceof SemVer$3)) {
2250
- other = new SemVer$3(other, this.options);
2249
+ if (!(other instanceof SemVer$1)) {
2250
+ other = new SemVer$1(other, this.options);
2251
2251
  }
2252
2252
 
2253
2253
  let i = 0;
@@ -2255,7 +2255,7 @@
2255
2255
  do {
2256
2256
  const a = this.build[i];
2257
2257
  const b = other.build[i];
2258
- debug$2('prerelease compare', i, a, b);
2258
+ debug('prerelease compare', i, a, b);
2259
2259
 
2260
2260
  if (a === undefined && b === undefined) {
2261
2261
  return 0;
@@ -2372,7 +2372,7 @@
2372
2372
  if (identifier) {
2373
2373
  // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
2374
2374
  // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
2375
- if (this.prerelease[0] === identifier) {
2375
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
2376
2376
  if (isNaN(this.prerelease[1])) {
2377
2377
  this.prerelease = [identifier, 0];
2378
2378
  }
@@ -2394,11 +2394,11 @@
2394
2394
 
2395
2395
  }
2396
2396
 
2397
- var semver = SemVer$3;
2397
+ var semver = SemVer$1;
2398
2398
 
2399
- const SemVer$2 = semver;
2399
+ const SemVer = semver;
2400
2400
 
2401
- const compare$6 = (a, b, loose) => new SemVer$2(a, loose).compare(new SemVer$2(b, loose));
2401
+ const compare$6 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
2402
2402
 
2403
2403
  var compare_1 = compare$6;
2404
2404
 
@@ -2445,16 +2445,28 @@
2445
2445
  const lt = lt_1;
2446
2446
  const lte = lte_1;
2447
2447
 
2448
- const cmp$1 = (a, op, b, loose) => {
2448
+ const cmp = (a, op, b, loose) => {
2449
2449
  switch (op) {
2450
2450
  case '===':
2451
- if (typeof a === 'object') a = a.version;
2452
- if (typeof b === 'object') b = b.version;
2451
+ if (typeof a === 'object') {
2452
+ a = a.version;
2453
+ }
2454
+
2455
+ if (typeof b === 'object') {
2456
+ b = b.version;
2457
+ }
2458
+
2453
2459
  return a === b;
2454
2460
 
2455
2461
  case '!==':
2456
- if (typeof a === 'object') a = a.version;
2457
- if (typeof b === 'object') b = b.version;
2462
+ if (typeof a === 'object') {
2463
+ a = a.version;
2464
+ }
2465
+
2466
+ if (typeof b === 'object') {
2467
+ b = b.version;
2468
+ }
2469
+
2458
2470
  return a !== b;
2459
2471
 
2460
2472
  case '':
@@ -2482,599 +2494,641 @@
2482
2494
  }
2483
2495
  };
2484
2496
 
2485
- var cmp_1 = cmp$1;
2497
+ var cmp_1 = cmp;
2486
2498
 
2487
- const ANY = Symbol('SemVer ANY'); // hoisted class for cyclic dependency
2499
+ var comparator;
2500
+ var hasRequiredComparator;
2488
2501
 
2489
- class Comparator$1 {
2490
- static get ANY() {
2491
- return ANY;
2492
- }
2502
+ function requireComparator() {
2503
+ if (hasRequiredComparator) return comparator;
2504
+ hasRequiredComparator = 1;
2505
+ const ANY = Symbol('SemVer ANY'); // hoisted class for cyclic dependency
2493
2506
 
2494
- constructor(comp, options) {
2495
- options = parseOptions$1(options);
2496
-
2497
- if (comp instanceof Comparator$1) {
2498
- if (comp.loose === !!options.loose) {
2499
- return comp;
2500
- } else {
2501
- comp = comp.value;
2502
- }
2507
+ class Comparator {
2508
+ static get ANY() {
2509
+ return ANY;
2503
2510
  }
2504
2511
 
2505
- debug$1('comparator', comp, options);
2506
- this.options = options;
2507
- this.loose = !!options.loose;
2508
- this.parse(comp);
2512
+ constructor(comp, options) {
2513
+ options = parseOptions(options);
2509
2514
 
2510
- if (this.semver === ANY) {
2511
- this.value = '';
2512
- } else {
2513
- this.value = this.operator + this.semver.version;
2514
- }
2515
+ if (comp instanceof Comparator) {
2516
+ if (comp.loose === !!options.loose) {
2517
+ return comp;
2518
+ } else {
2519
+ comp = comp.value;
2520
+ }
2521
+ }
2515
2522
 
2516
- debug$1('comp', this);
2517
- }
2523
+ debug('comparator', comp, options);
2524
+ this.options = options;
2525
+ this.loose = !!options.loose;
2526
+ this.parse(comp);
2518
2527
 
2519
- parse(comp) {
2520
- const r = this.options.loose ? re$1[t$1.COMPARATORLOOSE] : re$1[t$1.COMPARATOR];
2521
- const m = comp.match(r);
2528
+ if (this.semver === ANY) {
2529
+ this.value = '';
2530
+ } else {
2531
+ this.value = this.operator + this.semver.version;
2532
+ }
2522
2533
 
2523
- if (!m) {
2524
- throw new TypeError("Invalid comparator: ".concat(comp));
2534
+ debug('comp', this);
2525
2535
  }
2526
2536
 
2527
- this.operator = m[1] !== undefined ? m[1] : '';
2537
+ parse(comp) {
2538
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
2539
+ const m = comp.match(r);
2528
2540
 
2529
- if (this.operator === '=') {
2530
- this.operator = '';
2531
- } // if it literally is just '>' or '' then allow anything.
2541
+ if (!m) {
2542
+ throw new TypeError("Invalid comparator: ".concat(comp));
2543
+ }
2532
2544
 
2545
+ this.operator = m[1] !== undefined ? m[1] : '';
2533
2546
 
2534
- if (!m[2]) {
2535
- this.semver = ANY;
2536
- } else {
2537
- this.semver = new SemVer$1(m[2], this.options.loose);
2538
- }
2539
- }
2547
+ if (this.operator === '=') {
2548
+ this.operator = '';
2549
+ } // if it literally is just '>' or '' then allow anything.
2540
2550
 
2541
- toString() {
2542
- return this.value;
2543
- }
2544
2551
 
2545
- test(version) {
2546
- debug$1('Comparator.test', version, this.options.loose);
2552
+ if (!m[2]) {
2553
+ this.semver = ANY;
2554
+ } else {
2555
+ this.semver = new SemVer(m[2], this.options.loose);
2556
+ }
2557
+ }
2547
2558
 
2548
- if (this.semver === ANY || version === ANY) {
2549
- return true;
2559
+ toString() {
2560
+ return this.value;
2550
2561
  }
2551
2562
 
2552
- if (typeof version === 'string') {
2553
- try {
2554
- version = new SemVer$1(version, this.options);
2555
- } catch (er) {
2556
- return false;
2563
+ test(version) {
2564
+ debug('Comparator.test', version, this.options.loose);
2565
+
2566
+ if (this.semver === ANY || version === ANY) {
2567
+ return true;
2557
2568
  }
2558
- }
2559
2569
 
2560
- return cmp(version, this.operator, this.semver, this.options);
2561
- }
2570
+ if (typeof version === 'string') {
2571
+ try {
2572
+ version = new SemVer(version, this.options);
2573
+ } catch (er) {
2574
+ return false;
2575
+ }
2576
+ }
2562
2577
 
2563
- intersects(comp, options) {
2564
- if (!(comp instanceof Comparator$1)) {
2565
- throw new TypeError('a Comparator is required');
2578
+ return cmp(version, this.operator, this.semver, this.options);
2566
2579
  }
2567
2580
 
2568
- if (!options || typeof options !== 'object') {
2569
- options = {
2570
- loose: !!options,
2571
- includePrerelease: false
2572
- };
2573
- }
2581
+ intersects(comp, options) {
2582
+ if (!(comp instanceof Comparator)) {
2583
+ throw new TypeError('a Comparator is required');
2584
+ }
2574
2585
 
2575
- if (this.operator === '') {
2576
- if (this.value === '') {
2577
- return true;
2586
+ if (!options || typeof options !== 'object') {
2587
+ options = {
2588
+ loose: !!options,
2589
+ includePrerelease: false
2590
+ };
2578
2591
  }
2579
2592
 
2580
- return new Range$2(comp.value, options).test(this.value);
2581
- } else if (comp.operator === '') {
2582
- if (comp.value === '') {
2583
- return true;
2593
+ if (this.operator === '') {
2594
+ if (this.value === '') {
2595
+ return true;
2596
+ }
2597
+
2598
+ return new Range(comp.value, options).test(this.value);
2599
+ } else if (comp.operator === '') {
2600
+ if (comp.value === '') {
2601
+ return true;
2602
+ }
2603
+
2604
+ return new Range(this.value, options).test(comp.semver);
2584
2605
  }
2585
2606
 
2586
- return new Range$2(this.value, options).test(comp.semver);
2607
+ const sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>');
2608
+ const sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<');
2609
+ const sameSemVer = this.semver.version === comp.semver.version;
2610
+ const differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=');
2611
+ const oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<');
2612
+ const oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>');
2613
+ return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
2587
2614
  }
2588
2615
 
2589
- const sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>');
2590
- const sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<');
2591
- const sameSemVer = this.semver.version === comp.semver.version;
2592
- const differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=');
2593
- const oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<');
2594
- const oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>');
2595
- return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
2596
2616
  }
2597
2617
 
2618
+ comparator = Comparator;
2619
+ const parseOptions = parseOptions_1;
2620
+ const {
2621
+ re,
2622
+ t
2623
+ } = re$1.exports;
2624
+ const cmp = cmp_1;
2625
+ const debug = debug_1;
2626
+ const SemVer = semver;
2627
+ const Range = requireRange();
2628
+ return comparator;
2598
2629
  }
2599
2630
 
2600
- var comparator = Comparator$1;
2601
- const parseOptions$1 = parseOptions_1;
2602
- const {
2603
- re: re$1,
2604
- t: t$1
2605
- } = re$3.exports;
2606
- const cmp = cmp_1;
2607
- const debug$1 = debug_1;
2608
- const SemVer$1 = semver;
2609
- const Range$2 = range;
2610
-
2611
- class Range$1 {
2612
- constructor(range, options) {
2613
- options = parseOptions(options);
2631
+ var range;
2632
+ var hasRequiredRange;
2614
2633
 
2615
- if (range instanceof Range$1) {
2616
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
2617
- return range;
2618
- } else {
2619
- return new Range$1(range.raw, options);
2634
+ function requireRange() {
2635
+ if (hasRequiredRange) return range;
2636
+ hasRequiredRange = 1; // hoisted class for cyclic dependency
2637
+
2638
+ class Range {
2639
+ constructor(range, options) {
2640
+ options = parseOptions(options);
2641
+
2642
+ if (range instanceof Range) {
2643
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
2644
+ return range;
2645
+ } else {
2646
+ return new Range(range.raw, options);
2647
+ }
2620
2648
  }
2621
- }
2622
2649
 
2623
- if (range instanceof Comparator) {
2624
- // just put it in the set and return
2625
- this.raw = range.value;
2626
- this.set = [[range]];
2627
- this.format();
2628
- return this;
2629
- }
2650
+ if (range instanceof Comparator) {
2651
+ // just put it in the set and return
2652
+ this.raw = range.value;
2653
+ this.set = [[range]];
2654
+ this.format();
2655
+ return this;
2656
+ }
2630
2657
 
2631
- this.options = options;
2632
- this.loose = !!options.loose;
2633
- this.includePrerelease = !!options.includePrerelease; // First, split based on boolean or ||
2634
-
2635
- this.raw = range;
2636
- this.set = range.split(/\s*\|\|\s*/) // map the range to a 2d array of comparators
2637
- .map(range => this.parseRange(range.trim())) // throw out any comparator lists that are empty
2638
- // this generally means that it was not a valid range, which is allowed
2639
- // in loose mode, but will still throw if the WHOLE range is invalid.
2640
- .filter(c => c.length);
2641
-
2642
- if (!this.set.length) {
2643
- throw new TypeError("Invalid SemVer Range: ".concat(range));
2644
- } // if we have any that are not the null set, throw out null sets.
2645
-
2646
-
2647
- if (this.set.length > 1) {
2648
- // keep the first one, in case they're all null sets
2649
- const first = this.set[0];
2650
- this.set = this.set.filter(c => !isNullSet(c[0]));
2651
- if (this.set.length === 0) this.set = [first];else if (this.set.length > 1) {
2652
- // if we have any that are *, then the range is just *
2653
- for (const c of this.set) {
2654
- if (c.length === 1 && isAny(c[0])) {
2655
- this.set = [c];
2656
- break;
2658
+ this.options = options;
2659
+ this.loose = !!options.loose;
2660
+ this.includePrerelease = !!options.includePrerelease; // First, split based on boolean or ||
2661
+
2662
+ this.raw = range;
2663
+ this.set = range.split('||') // map the range to a 2d array of comparators
2664
+ .map(r => this.parseRange(r.trim())) // throw out any comparator lists that are empty
2665
+ // this generally means that it was not a valid range, which is allowed
2666
+ // in loose mode, but will still throw if the WHOLE range is invalid.
2667
+ .filter(c => c.length);
2668
+
2669
+ if (!this.set.length) {
2670
+ throw new TypeError("Invalid SemVer Range: ".concat(range));
2671
+ } // if we have any that are not the null set, throw out null sets.
2672
+
2673
+
2674
+ if (this.set.length > 1) {
2675
+ // keep the first one, in case they're all null sets
2676
+ const first = this.set[0];
2677
+ this.set = this.set.filter(c => !isNullSet(c[0]));
2678
+
2679
+ if (this.set.length === 0) {
2680
+ this.set = [first];
2681
+ } else if (this.set.length > 1) {
2682
+ // if we have any that are *, then the range is just *
2683
+ for (const c of this.set) {
2684
+ if (c.length === 1 && isAny(c[0])) {
2685
+ this.set = [c];
2686
+ break;
2687
+ }
2657
2688
  }
2658
2689
  }
2659
2690
  }
2691
+
2692
+ this.format();
2660
2693
  }
2661
2694
 
2662
- this.format();
2663
- }
2695
+ format() {
2696
+ this.range = this.set.map(comps => {
2697
+ return comps.join(' ').trim();
2698
+ }).join('||').trim();
2699
+ return this.range;
2700
+ }
2664
2701
 
2665
- format() {
2666
- this.range = this.set.map(comps => {
2667
- return comps.join(' ').trim();
2668
- }).join('||').trim();
2669
- return this.range;
2670
- }
2702
+ toString() {
2703
+ return this.range;
2704
+ }
2671
2705
 
2672
- toString() {
2673
- return this.range;
2674
- }
2706
+ parseRange(range) {
2707
+ range = range.trim(); // memoize range parsing for performance.
2708
+ // this is a very hot path, and fully deterministic.
2675
2709
 
2676
- parseRange(range) {
2677
- range = range.trim(); // memoize range parsing for performance.
2678
- // this is a very hot path, and fully deterministic.
2710
+ const memoOpts = Object.keys(this.options).join(',');
2711
+ const memoKey = "parseRange:".concat(memoOpts, ":").concat(range);
2712
+ const cached = cache.get(memoKey);
2679
2713
 
2680
- const memoOpts = Object.keys(this.options).join(',');
2681
- const memoKey = "parseRange:".concat(memoOpts, ":").concat(range);
2682
- const cached = cache.get(memoKey);
2683
- if (cached) return cached;
2684
- const loose = this.options.loose; // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
2714
+ if (cached) {
2715
+ return cached;
2716
+ }
2685
2717
 
2686
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
2687
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
2688
- debug('hyphen replace', range); // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
2718
+ const loose = this.options.loose; // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
2689
2719
 
2690
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
2691
- debug('comparator trim', range, re[t.COMPARATORTRIM]); // `~ 1.2.3` => `~1.2.3`
2720
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
2721
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
2722
+ debug('hyphen replace', range); // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
2692
2723
 
2693
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace); // `^ 1.2.3` => `^1.2.3`
2724
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
2725
+ debug('comparator trim', range); // `~ 1.2.3` => `~1.2.3`
2694
2726
 
2695
- range = range.replace(re[t.CARETTRIM], caretTrimReplace); // normalize spaces
2727
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace); // `^ 1.2.3` => `^1.2.3`
2696
2728
 
2697
- range = range.split(/\s+/).join(' '); // At this point, the range is completely trimmed and
2698
- // ready to be split into comparators.
2729
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace); // normalize spaces
2699
2730
 
2700
- const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
2701
- const rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\s+/) // >=0.0.0 is equivalent to *
2702
- .map(comp => replaceGTE0(comp, this.options)) // in loose mode, throw out any that are not valid comparators
2703
- .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true).map(comp => new Comparator(comp, this.options)); // if any comparators are the null set, then replace with JUST null set
2704
- // if more than one comparator, remove any * comparators
2705
- // also, don't include the same comparator more than once
2731
+ range = range.split(/\s+/).join(' '); // At this point, the range is completely trimmed and
2732
+ // ready to be split into comparators.
2706
2733
 
2707
- rangeList.length;
2708
- const rangeMap = new Map();
2734
+ let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\s+/) // >=0.0.0 is equivalent to *
2735
+ .map(comp => replaceGTE0(comp, this.options));
2709
2736
 
2710
- for (const comp of rangeList) {
2711
- if (isNullSet(comp)) return [comp];
2712
- rangeMap.set(comp.value, comp);
2713
- }
2737
+ if (loose) {
2738
+ // in loose mode, throw out any that are not valid comparators
2739
+ rangeList = rangeList.filter(comp => {
2740
+ debug('loose invalid filter', comp, this.options);
2741
+ return !!comp.match(re[t.COMPARATORLOOSE]);
2742
+ });
2743
+ }
2714
2744
 
2715
- if (rangeMap.size > 1 && rangeMap.has('')) rangeMap.delete('');
2716
- const result = [...rangeMap.values()];
2717
- cache.set(memoKey, result);
2718
- return result;
2719
- }
2745
+ debug('range list', rangeList); // if any comparators are the null set, then replace with JUST null set
2746
+ // if more than one comparator, remove any * comparators
2747
+ // also, don't include the same comparator more than once
2748
+
2749
+ const rangeMap = new Map();
2750
+ const comparators = rangeList.map(comp => new Comparator(comp, this.options));
2751
+
2752
+ for (const comp of comparators) {
2753
+ if (isNullSet(comp)) {
2754
+ return [comp];
2755
+ }
2756
+
2757
+ rangeMap.set(comp.value, comp);
2758
+ }
2720
2759
 
2721
- intersects(range, options) {
2722
- if (!(range instanceof Range$1)) {
2723
- throw new TypeError('a Range is required');
2760
+ if (rangeMap.size > 1 && rangeMap.has('')) {
2761
+ rangeMap.delete('');
2762
+ }
2763
+
2764
+ const result = [...rangeMap.values()];
2765
+ cache.set(memoKey, result);
2766
+ return result;
2724
2767
  }
2725
2768
 
2726
- return this.set.some(thisComparators => {
2727
- return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => {
2728
- return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => {
2729
- return rangeComparators.every(rangeComparator => {
2730
- return thisComparator.intersects(rangeComparator, options);
2769
+ intersects(range, options) {
2770
+ if (!(range instanceof Range)) {
2771
+ throw new TypeError('a Range is required');
2772
+ }
2773
+
2774
+ return this.set.some(thisComparators => {
2775
+ return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => {
2776
+ return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => {
2777
+ return rangeComparators.every(rangeComparator => {
2778
+ return thisComparator.intersects(rangeComparator, options);
2779
+ });
2731
2780
  });
2732
2781
  });
2733
2782
  });
2734
- });
2735
- } // if ANY of the sets match ALL of its comparators, then pass
2736
-
2783
+ } // if ANY of the sets match ALL of its comparators, then pass
2737
2784
 
2738
- test(version) {
2739
- if (!version) {
2740
- return false;
2741
- }
2742
2785
 
2743
- if (typeof version === 'string') {
2744
- try {
2745
- version = new SemVer(version, this.options);
2746
- } catch (er) {
2786
+ test(version) {
2787
+ if (!version) {
2747
2788
  return false;
2748
2789
  }
2749
- }
2750
2790
 
2751
- for (let i = 0; i < this.set.length; i++) {
2752
- if (testSet(this.set[i], version, this.options)) {
2753
- return true;
2791
+ if (typeof version === 'string') {
2792
+ try {
2793
+ version = new SemVer(version, this.options);
2794
+ } catch (er) {
2795
+ return false;
2796
+ }
2797
+ }
2798
+
2799
+ for (let i = 0; i < this.set.length; i++) {
2800
+ if (testSet(this.set[i], version, this.options)) {
2801
+ return true;
2802
+ }
2754
2803
  }
2804
+
2805
+ return false;
2755
2806
  }
2756
2807
 
2757
- return false;
2758
2808
  }
2759
2809
 
2760
- }
2810
+ range = Range;
2811
+ const LRU = lruCache;
2812
+ const cache = new LRU({
2813
+ max: 1000
2814
+ });
2815
+ const parseOptions = parseOptions_1;
2816
+ const Comparator = requireComparator();
2817
+ const debug = debug_1;
2818
+ const SemVer = semver;
2819
+ const {
2820
+ re,
2821
+ t,
2822
+ comparatorTrimReplace,
2823
+ tildeTrimReplace,
2824
+ caretTrimReplace
2825
+ } = re$1.exports;
2761
2826
 
2762
- var range = Range$1;
2763
- const LRU = lruCache;
2764
- const cache = new LRU({
2765
- max: 1000
2766
- });
2767
- const parseOptions = parseOptions_1;
2768
- const Comparator = comparator;
2769
- const debug = debug_1;
2770
- const SemVer = semver;
2771
- const {
2772
- re,
2773
- t,
2774
- comparatorTrimReplace,
2775
- tildeTrimReplace,
2776
- caretTrimReplace
2777
- } = re$3.exports;
2827
+ const isNullSet = c => c.value === '<0.0.0-0';
2778
2828
 
2779
- const isNullSet = c => c.value === '<0.0.0-0';
2829
+ const isAny = c => c.value === ''; // take a set of comparators and determine whether there
2830
+ // exists a version which can satisfy it
2780
2831
 
2781
- const isAny = c => c.value === ''; // take a set of comparators and determine whether there
2782
- // exists a version which can satisfy it
2783
2832
 
2833
+ const isSatisfiable = (comparators, options) => {
2834
+ let result = true;
2835
+ const remainingComparators = comparators.slice();
2836
+ let testComparator = remainingComparators.pop();
2784
2837
 
2785
- const isSatisfiable = (comparators, options) => {
2786
- let result = true;
2787
- const remainingComparators = comparators.slice();
2788
- let testComparator = remainingComparators.pop();
2838
+ while (result && remainingComparators.length) {
2839
+ result = remainingComparators.every(otherComparator => {
2840
+ return testComparator.intersects(otherComparator, options);
2841
+ });
2842
+ testComparator = remainingComparators.pop();
2843
+ }
2789
2844
 
2790
- while (result && remainingComparators.length) {
2791
- result = remainingComparators.every(otherComparator => {
2792
- return testComparator.intersects(otherComparator, options);
2793
- });
2794
- testComparator = remainingComparators.pop();
2795
- }
2796
-
2797
- return result;
2798
- }; // comprised of xranges, tildes, stars, and gtlt's at this point.
2799
- // already replaced the hyphen ranges
2800
- // turn into a set of JUST comparators.
2801
-
2802
-
2803
- const parseComparator = (comp, options) => {
2804
- debug('comp', comp, options);
2805
- comp = replaceCarets(comp, options);
2806
- debug('caret', comp);
2807
- comp = replaceTildes(comp, options);
2808
- debug('tildes', comp);
2809
- comp = replaceXRanges(comp, options);
2810
- debug('xrange', comp);
2811
- comp = replaceStars(comp, options);
2812
- debug('stars', comp);
2813
- return comp;
2814
- };
2845
+ return result;
2846
+ }; // comprised of xranges, tildes, stars, and gtlt's at this point.
2847
+ // already replaced the hyphen ranges
2848
+ // turn into a set of JUST comparators.
2849
+
2850
+
2851
+ const parseComparator = (comp, options) => {
2852
+ debug('comp', comp, options);
2853
+ comp = replaceCarets(comp, options);
2854
+ debug('caret', comp);
2855
+ comp = replaceTildes(comp, options);
2856
+ debug('tildes', comp);
2857
+ comp = replaceXRanges(comp, options);
2858
+ debug('xrange', comp);
2859
+ comp = replaceStars(comp, options);
2860
+ debug('stars', comp);
2861
+ return comp;
2862
+ };
2815
2863
 
2816
- const isX = id => !id || id.toLowerCase() === 'x' || id === '*'; // ~, ~> --> * (any, kinda silly)
2817
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
2818
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
2819
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
2820
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
2821
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
2822
-
2823
-
2824
- const replaceTildes = (comp, options) => comp.trim().split(/\s+/).map(comp => {
2825
- return replaceTilde(comp, options);
2826
- }).join(' ');
2827
-
2828
- const replaceTilde = (comp, options) => {
2829
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
2830
- return comp.replace(r, (_, M, m, p, pr) => {
2831
- debug('tilde', comp, _, M, m, p, pr);
2832
- let ret;
2833
-
2834
- if (isX(M)) {
2835
- ret = '';
2836
- } else if (isX(m)) {
2837
- ret = ">=".concat(M, ".0.0 <").concat(+M + 1, ".0.0-0");
2838
- } else if (isX(p)) {
2839
- // ~1.2 == >=1.2.0 <1.3.0-0
2840
- ret = ">=".concat(M, ".").concat(m, ".0 <").concat(M, ".").concat(+m + 1, ".0-0");
2841
- } else if (pr) {
2842
- debug('replaceTilde pr', pr);
2843
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
2844
- } else {
2845
- // ~1.2.3 == >=1.2.3 <1.3.0-0
2846
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(M, ".").concat(+m + 1, ".0-0");
2847
- }
2864
+ const isX = id => !id || id.toLowerCase() === 'x' || id === '*'; // ~, ~> --> * (any, kinda silly)
2865
+ // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
2866
+ // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
2867
+ // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
2868
+ // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
2869
+ // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
2848
2870
 
2849
- debug('tilde return', ret);
2850
- return ret;
2851
- });
2852
- }; // ^ --> * (any, kinda silly)
2853
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
2854
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
2855
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
2856
- // ^1.2.3 --> >=1.2.3 <2.0.0-0
2857
- // ^1.2.0 --> >=1.2.0 <2.0.0-0
2858
-
2859
-
2860
- const replaceCarets = (comp, options) => comp.trim().split(/\s+/).map(comp => {
2861
- return replaceCaret(comp, options);
2862
- }).join(' ');
2863
-
2864
- const replaceCaret = (comp, options) => {
2865
- debug('caret', comp, options);
2866
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
2867
- const z = options.includePrerelease ? '-0' : '';
2868
- return comp.replace(r, (_, M, m, p, pr) => {
2869
- debug('caret', comp, _, M, m, p, pr);
2870
- let ret;
2871
-
2872
- if (isX(M)) {
2873
- ret = '';
2874
- } else if (isX(m)) {
2875
- ret = ">=".concat(M, ".0.0").concat(z, " <").concat(+M + 1, ".0.0-0");
2876
- } else if (isX(p)) {
2877
- if (M === '0') {
2878
- ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
2871
+
2872
+ const replaceTildes = (comp, options) => comp.trim().split(/\s+/).map(c => {
2873
+ return replaceTilde(c, options);
2874
+ }).join(' ');
2875
+
2876
+ const replaceTilde = (comp, options) => {
2877
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
2878
+ return comp.replace(r, (_, M, m, p, pr) => {
2879
+ debug('tilde', comp, _, M, m, p, pr);
2880
+ let ret;
2881
+
2882
+ if (isX(M)) {
2883
+ ret = '';
2884
+ } else if (isX(m)) {
2885
+ ret = ">=".concat(M, ".0.0 <").concat(+M + 1, ".0.0-0");
2886
+ } else if (isX(p)) {
2887
+ // ~1.2 == >=1.2.0 <1.3.0-0
2888
+ ret = ">=".concat(M, ".").concat(m, ".0 <").concat(M, ".").concat(+m + 1, ".0-0");
2889
+ } else if (pr) {
2890
+ debug('replaceTilde pr', pr);
2891
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
2879
2892
  } else {
2880
- ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(+M + 1, ".0.0-0");
2893
+ // ~1.2.3 == >=1.2.3 <1.3.0-0
2894
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(M, ".").concat(+m + 1, ".0-0");
2881
2895
  }
2882
- } else if (pr) {
2883
- debug('replaceCaret pr', pr);
2884
2896
 
2885
- if (M === '0') {
2886
- if (m === '0') {
2887
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
2897
+ debug('tilde return', ret);
2898
+ return ret;
2899
+ });
2900
+ }; // ^ --> * (any, kinda silly)
2901
+ // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
2902
+ // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
2903
+ // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
2904
+ // ^1.2.3 --> >=1.2.3 <2.0.0-0
2905
+ // ^1.2.0 --> >=1.2.0 <2.0.0-0
2906
+
2907
+
2908
+ const replaceCarets = (comp, options) => comp.trim().split(/\s+/).map(c => {
2909
+ return replaceCaret(c, options);
2910
+ }).join(' ');
2911
+
2912
+ const replaceCaret = (comp, options) => {
2913
+ debug('caret', comp, options);
2914
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
2915
+ const z = options.includePrerelease ? '-0' : '';
2916
+ return comp.replace(r, (_, M, m, p, pr) => {
2917
+ debug('caret', comp, _, M, m, p, pr);
2918
+ let ret;
2919
+
2920
+ if (isX(M)) {
2921
+ ret = '';
2922
+ } else if (isX(m)) {
2923
+ ret = ">=".concat(M, ".0.0").concat(z, " <").concat(+M + 1, ".0.0-0");
2924
+ } else if (isX(p)) {
2925
+ if (M === '0') {
2926
+ ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
2888
2927
  } else {
2889
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
2928
+ ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(+M + 1, ".0.0-0");
2890
2929
  }
2891
- } else {
2892
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(+M + 1, ".0.0-0");
2893
- }
2894
- } else {
2895
- debug('no pr');
2930
+ } else if (pr) {
2931
+ debug('replaceCaret pr', pr);
2896
2932
 
2897
- if (M === '0') {
2898
- if (m === '0') {
2899
- ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
2933
+ if (M === '0') {
2934
+ if (m === '0') {
2935
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
2936
+ } else {
2937
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
2938
+ }
2900
2939
  } else {
2901
- ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
2940
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(+M + 1, ".0.0-0");
2902
2941
  }
2903
2942
  } else {
2904
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(+M + 1, ".0.0-0");
2943
+ debug('no pr');
2944
+
2945
+ if (M === '0') {
2946
+ if (m === '0') {
2947
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
2948
+ } else {
2949
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
2950
+ }
2951
+ } else {
2952
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(+M + 1, ".0.0-0");
2953
+ }
2905
2954
  }
2906
- }
2907
2955
 
2908
- debug('caret return', ret);
2909
- return ret;
2910
- });
2911
- };
2956
+ debug('caret return', ret);
2957
+ return ret;
2958
+ });
2959
+ };
2912
2960
 
2913
- const replaceXRanges = (comp, options) => {
2914
- debug('replaceXRanges', comp, options);
2915
- return comp.split(/\s+/).map(comp => {
2916
- return replaceXRange(comp, options);
2917
- }).join(' ');
2918
- };
2961
+ const replaceXRanges = (comp, options) => {
2962
+ debug('replaceXRanges', comp, options);
2963
+ return comp.split(/\s+/).map(c => {
2964
+ return replaceXRange(c, options);
2965
+ }).join(' ');
2966
+ };
2919
2967
 
2920
- const replaceXRange = (comp, options) => {
2921
- comp = comp.trim();
2922
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
2923
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
2924
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
2925
- const xM = isX(M);
2926
- const xm = xM || isX(m);
2927
- const xp = xm || isX(p);
2928
- const anyX = xp;
2968
+ const replaceXRange = (comp, options) => {
2969
+ comp = comp.trim();
2970
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
2971
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
2972
+ debug('xRange', comp, ret, gtlt, M, m, p, pr);
2973
+ const xM = isX(M);
2974
+ const xm = xM || isX(m);
2975
+ const xp = xm || isX(p);
2976
+ const anyX = xp;
2929
2977
 
2930
- if (gtlt === '=' && anyX) {
2931
- gtlt = '';
2932
- } // if we're including prereleases in the match, then we need
2933
- // to fix this to -0, the lowest possible prerelease value
2978
+ if (gtlt === '=' && anyX) {
2979
+ gtlt = '';
2980
+ } // if we're including prereleases in the match, then we need
2981
+ // to fix this to -0, the lowest possible prerelease value
2934
2982
 
2935
2983
 
2936
- pr = options.includePrerelease ? '-0' : '';
2984
+ pr = options.includePrerelease ? '-0' : '';
2937
2985
 
2938
- if (xM) {
2939
- if (gtlt === '>' || gtlt === '<') {
2940
- // nothing is allowed
2941
- ret = '<0.0.0-0';
2942
- } else {
2943
- // nothing is forbidden
2944
- ret = '*';
2945
- }
2946
- } else if (gtlt && anyX) {
2947
- // we know patch is an x, because we have any x at all.
2948
- // replace X with 0
2949
- if (xm) {
2950
- m = 0;
2951
- }
2986
+ if (xM) {
2987
+ if (gtlt === '>' || gtlt === '<') {
2988
+ // nothing is allowed
2989
+ ret = '<0.0.0-0';
2990
+ } else {
2991
+ // nothing is forbidden
2992
+ ret = '*';
2993
+ }
2994
+ } else if (gtlt && anyX) {
2995
+ // we know patch is an x, because we have any x at all.
2996
+ // replace X with 0
2997
+ if (xm) {
2998
+ m = 0;
2999
+ }
2952
3000
 
2953
- p = 0;
3001
+ p = 0;
2954
3002
 
2955
- if (gtlt === '>') {
2956
- // >1 => >=2.0.0
2957
- // >1.2 => >=1.3.0
2958
- gtlt = '>=';
3003
+ if (gtlt === '>') {
3004
+ // >1 => >=2.0.0
3005
+ // >1.2 => >=1.3.0
3006
+ gtlt = '>=';
2959
3007
 
2960
- if (xm) {
2961
- M = +M + 1;
2962
- m = 0;
2963
- p = 0;
2964
- } else {
2965
- m = +m + 1;
2966
- p = 0;
3008
+ if (xm) {
3009
+ M = +M + 1;
3010
+ m = 0;
3011
+ p = 0;
3012
+ } else {
3013
+ m = +m + 1;
3014
+ p = 0;
3015
+ }
3016
+ } else if (gtlt === '<=') {
3017
+ // <=0.7.x is actually <0.8.0, since any 0.7.x should
3018
+ // pass. Similarly, <=7.x is actually <8.0.0, etc.
3019
+ gtlt = '<';
3020
+
3021
+ if (xm) {
3022
+ M = +M + 1;
3023
+ } else {
3024
+ m = +m + 1;
3025
+ }
2967
3026
  }
2968
- } else if (gtlt === '<=') {
2969
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
2970
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
2971
- gtlt = '<';
2972
3027
 
2973
- if (xm) {
2974
- M = +M + 1;
2975
- } else {
2976
- m = +m + 1;
3028
+ if (gtlt === '<') {
3029
+ pr = '-0';
2977
3030
  }
3031
+
3032
+ ret = "".concat(gtlt + M, ".").concat(m, ".").concat(p).concat(pr);
3033
+ } else if (xm) {
3034
+ ret = ">=".concat(M, ".0.0").concat(pr, " <").concat(+M + 1, ".0.0-0");
3035
+ } else if (xp) {
3036
+ ret = ">=".concat(M, ".").concat(m, ".0").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
2978
3037
  }
2979
3038
 
2980
- if (gtlt === '<') pr = '-0';
2981
- ret = "".concat(gtlt + M, ".").concat(m, ".").concat(p).concat(pr);
2982
- } else if (xm) {
2983
- ret = ">=".concat(M, ".0.0").concat(pr, " <").concat(+M + 1, ".0.0-0");
2984
- } else if (xp) {
2985
- ret = ">=".concat(M, ".").concat(m, ".0").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
2986
- }
3039
+ debug('xRange return', ret);
3040
+ return ret;
3041
+ });
3042
+ }; // Because * is AND-ed with everything else in the comparator,
3043
+ // and '' means "any version", just remove the *s entirely.
2987
3044
 
2988
- debug('xRange return', ret);
2989
- return ret;
2990
- });
2991
- }; // Because * is AND-ed with everything else in the comparator,
2992
- // and '' means "any version", just remove the *s entirely.
2993
3045
 
3046
+ const replaceStars = (comp, options) => {
3047
+ debug('replaceStars', comp, options); // Looseness is ignored here. star is always as loose as it gets!
2994
3048
 
2995
- const replaceStars = (comp, options) => {
2996
- debug('replaceStars', comp, options); // Looseness is ignored here. star is always as loose as it gets!
3049
+ return comp.trim().replace(re[t.STAR], '');
3050
+ };
2997
3051
 
2998
- return comp.trim().replace(re[t.STAR], '');
2999
- };
3052
+ const replaceGTE0 = (comp, options) => {
3053
+ debug('replaceGTE0', comp, options);
3054
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '');
3055
+ }; // This function is passed to string.replace(re[t.HYPHENRANGE])
3056
+ // M, m, patch, prerelease, build
3057
+ // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
3058
+ // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
3059
+ // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
3060
+
3061
+
3062
+ const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
3063
+ if (isX(fM)) {
3064
+ from = '';
3065
+ } else if (isX(fm)) {
3066
+ from = ">=".concat(fM, ".0.0").concat(incPr ? '-0' : '');
3067
+ } else if (isX(fp)) {
3068
+ from = ">=".concat(fM, ".").concat(fm, ".0").concat(incPr ? '-0' : '');
3069
+ } else if (fpr) {
3070
+ from = ">=".concat(from);
3071
+ } else {
3072
+ from = ">=".concat(from).concat(incPr ? '-0' : '');
3073
+ }
3000
3074
 
3001
- const replaceGTE0 = (comp, options) => {
3002
- debug('replaceGTE0', comp, options);
3003
- return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '');
3004
- }; // This function is passed to string.replace(re[t.HYPHENRANGE])
3005
- // M, m, patch, prerelease, build
3006
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
3007
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
3008
- // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
3009
-
3010
-
3011
- const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
3012
- if (isX(fM)) {
3013
- from = '';
3014
- } else if (isX(fm)) {
3015
- from = ">=".concat(fM, ".0.0").concat(incPr ? '-0' : '');
3016
- } else if (isX(fp)) {
3017
- from = ">=".concat(fM, ".").concat(fm, ".0").concat(incPr ? '-0' : '');
3018
- } else if (fpr) {
3019
- from = ">=".concat(from);
3020
- } else {
3021
- from = ">=".concat(from).concat(incPr ? '-0' : '');
3022
- }
3023
-
3024
- if (isX(tM)) {
3025
- to = '';
3026
- } else if (isX(tm)) {
3027
- to = "<".concat(+tM + 1, ".0.0-0");
3028
- } else if (isX(tp)) {
3029
- to = "<".concat(tM, ".").concat(+tm + 1, ".0-0");
3030
- } else if (tpr) {
3031
- to = "<=".concat(tM, ".").concat(tm, ".").concat(tp, "-").concat(tpr);
3032
- } else if (incPr) {
3033
- to = "<".concat(tM, ".").concat(tm, ".").concat(+tp + 1, "-0");
3034
- } else {
3035
- to = "<=".concat(to);
3036
- }
3075
+ if (isX(tM)) {
3076
+ to = '';
3077
+ } else if (isX(tm)) {
3078
+ to = "<".concat(+tM + 1, ".0.0-0");
3079
+ } else if (isX(tp)) {
3080
+ to = "<".concat(tM, ".").concat(+tm + 1, ".0-0");
3081
+ } else if (tpr) {
3082
+ to = "<=".concat(tM, ".").concat(tm, ".").concat(tp, "-").concat(tpr);
3083
+ } else if (incPr) {
3084
+ to = "<".concat(tM, ".").concat(tm, ".").concat(+tp + 1, "-0");
3085
+ } else {
3086
+ to = "<=".concat(to);
3087
+ }
3037
3088
 
3038
- return "".concat(from, " ").concat(to).trim();
3039
- };
3089
+ return "".concat(from, " ").concat(to).trim();
3090
+ };
3040
3091
 
3041
- const testSet = (set, version, options) => {
3042
- for (let i = 0; i < set.length; i++) {
3043
- if (!set[i].test(version)) {
3044
- return false;
3092
+ const testSet = (set, version, options) => {
3093
+ for (let i = 0; i < set.length; i++) {
3094
+ if (!set[i].test(version)) {
3095
+ return false;
3096
+ }
3045
3097
  }
3046
- }
3047
3098
 
3048
- if (version.prerelease.length && !options.includePrerelease) {
3049
- // Find the set of versions that are allowed to have prereleases
3050
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
3051
- // That should allow `1.2.3-pr.2` to pass.
3052
- // However, `1.2.4-alpha.notready` should NOT be allowed,
3053
- // even though it's within the range set by the comparators.
3054
- for (let i = 0; i < set.length; i++) {
3055
- debug(set[i].semver);
3099
+ if (version.prerelease.length && !options.includePrerelease) {
3100
+ // Find the set of versions that are allowed to have prereleases
3101
+ // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
3102
+ // That should allow `1.2.3-pr.2` to pass.
3103
+ // However, `1.2.4-alpha.notready` should NOT be allowed,
3104
+ // even though it's within the range set by the comparators.
3105
+ for (let i = 0; i < set.length; i++) {
3106
+ debug(set[i].semver);
3056
3107
 
3057
- if (set[i].semver === Comparator.ANY) {
3058
- continue;
3059
- }
3108
+ if (set[i].semver === Comparator.ANY) {
3109
+ continue;
3110
+ }
3060
3111
 
3061
- if (set[i].semver.prerelease.length > 0) {
3062
- const allowed = set[i].semver;
3112
+ if (set[i].semver.prerelease.length > 0) {
3113
+ const allowed = set[i].semver;
3063
3114
 
3064
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
3065
- return true;
3115
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
3116
+ return true;
3117
+ }
3066
3118
  }
3067
- }
3068
- } // Version has a -pre, but it's not one of the ones we like.
3119
+ } // Version has a -pre, but it's not one of the ones we like.
3069
3120
 
3070
3121
 
3071
- return false;
3072
- }
3122
+ return false;
3123
+ }
3073
3124
 
3074
- return true;
3075
- };
3125
+ return true;
3126
+ };
3127
+
3128
+ return range;
3129
+ }
3076
3130
 
3077
- const Range = range;
3131
+ const Range = requireRange();
3078
3132
 
3079
3133
  const satisfies = (version, range, options) => {
3080
3134
  try {
@@ -4340,7 +4394,7 @@
4340
4394
  } // generated with build-style.sh
4341
4395
 
4342
4396
 
4343
- var defaultStyle = "#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black; }\n #vg-tooltip-element.visible {\n visibility: visible; }\n #vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px; }\n #vg-tooltip-element img {\n max-width: 200px;\n max-height: 200px; }\n #vg-tooltip-element table {\n border-spacing: 0; }\n #vg-tooltip-element table tr {\n border: none; }\n #vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px; }\n #vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px; }\n #vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left; }\n #vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white; }\n #vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf; }\n";
4397
+ var defaultStyle = "#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element img {\n max-width: 200px;\n max-height: 200px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n";
4344
4398
  const EL_ID = 'vg-tooltip-element';
4345
4399
  const DEFAULT_OPTIONS = {
4346
4400
  /**
@@ -4488,11 +4542,10 @@
4488
4542
  this.el = document.createElement('div');
4489
4543
  this.el.setAttribute('id', this.options.id);
4490
4544
  this.el.classList.add('vg-tooltip');
4491
- document.body.appendChild(this.el);
4492
- }
4545
+ const tooltipContainer = (_a = document.fullscreenElement) !== null && _a !== void 0 ? _a : document.body;
4546
+ tooltipContainer.appendChild(this.el);
4547
+ } // hide tooltip for null, undefined, or empty string values
4493
4548
 
4494
- const tooltipContainer = (_a = document.fullscreenElement) !== null && _a !== void 0 ? _a : document.body;
4495
- tooltipContainer.appendChild(this.el); // hide tooltip for null, undefined, or empty string values
4496
4549
 
4497
4550
  if (value == null || value === '') {
4498
4551
  this.el.classList.remove('visible', "".concat(this.options.theme, "-theme"));
@@ -4550,7 +4603,7 @@
4550
4603
  }
4551
4604
 
4552
4605
  // generated with build-style.sh
4553
- var embedStyle = ".vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n outline: none;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: \"\";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid #0000;\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid #0000;\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n";
4606
+ var embedStyle = ".vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: \"\";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n";
4554
4607
 
4555
4608
  if (!String.prototype.startsWith) {
4556
4609
  // eslint-disable-next-line no-extend-native,func-names
@@ -4581,7 +4634,7 @@
4581
4634
  }
4582
4635
 
4583
4636
  var name = "vega-embed";
4584
- var version$1 = "6.20.5";
4637
+ var version$1 = "6.21.0";
4585
4638
  var description = "Publish Vega visualizations as embedded web components.";
4586
4639
  var keywords = ["vega", "data", "visualization", "component", "embed"];
4587
4640
  var repository = {
@@ -4608,28 +4661,28 @@
4608
4661
  var types = "build/vega-embed.module.d.ts";
4609
4662
  var files = ["src", "build", "build-es5", "patches"];
4610
4663
  var devDependencies = {
4611
- "@auto-it/conventional-commits": "^10.32.3",
4612
- "@auto-it/first-time-contributor": "^10.32.3",
4613
- "@babel/plugin-transform-runtime": "^7.16.4",
4614
- "@rollup/plugin-commonjs": "21.0.1",
4664
+ "@auto-it/conventional-commits": "^10.37.1",
4665
+ "@auto-it/first-time-contributor": "^10.37.1",
4666
+ "@babel/plugin-transform-runtime": "^7.18.2",
4667
+ "@rollup/plugin-commonjs": "22.0.0",
4615
4668
  "@rollup/plugin-json": "^4.1.0",
4616
- "@rollup/plugin-node-resolve": "^13.0.6",
4669
+ "@rollup/plugin-node-resolve": "^13.3.0",
4617
4670
  "@types/semver": "^7.3.9",
4618
- auto: "^10.32.3",
4619
- "browser-sync": "^2.27.7",
4620
- concurrently: "^6.4.0",
4671
+ auto: "^10.37.1",
4672
+ "browser-sync": "^2.27.10",
4673
+ concurrently: "^7.2.1",
4621
4674
  "del-cli": "^4.0.1",
4622
- "jest-canvas-mock": "^2.3.1",
4675
+ "jest-canvas-mock": "^2.4.0",
4623
4676
  "patch-package": "^6.4.7",
4624
4677
  "postinstall-postinstall": "^2.1.0",
4625
- rollup: "2.60.1",
4678
+ rollup: "2.75.6",
4626
4679
  "rollup-plugin-bundle-size": "^1.0.3",
4627
4680
  "rollup-plugin-terser": "^7.0.2",
4628
- "rollup-plugin-ts": "^2.0.4",
4629
- sass: "^1.43.5",
4630
- typescript: "^4.5.2",
4631
- vega: "^5.21.0",
4632
- "vega-lite": "^5.0.0",
4681
+ "rollup-plugin-ts": "^3.0.0",
4682
+ sass: "^1.52.1",
4683
+ typescript: "^4.7.2",
4684
+ vega: "^5.22.1",
4685
+ "vega-lite": "^5.2.0",
4633
4686
  "vega-lite-dev-config": "^0.20.0"
4634
4687
  };
4635
4688
  var peerDependencies = {
@@ -4637,14 +4690,14 @@
4637
4690
  "vega-lite": "*"
4638
4691
  };
4639
4692
  var dependencies = {
4640
- "fast-json-patch": "^3.1.0",
4693
+ "fast-json-patch": "^3.1.1",
4641
4694
  "json-stringify-pretty-compact": "^3.0.0",
4642
- semver: "^7.3.5",
4643
- tslib: "^2.3.1",
4695
+ semver: "^7.3.7",
4696
+ tslib: "^2.4.0",
4644
4697
  "vega-interpreter": "^1.0.4",
4645
4698
  "vega-schema-url-parser": "^2.2.0",
4646
4699
  "vega-themes": "^2.10.0",
4647
- "vega-tooltip": "^0.27.0"
4700
+ "vega-tooltip": "^0.28.0"
4648
4701
  };
4649
4702
  var bundledDependencies = ["yallist"];
4650
4703
  var scripts = {
@@ -4795,9 +4848,16 @@
4795
4848
  }
4796
4849
 
4797
4850
  function embedOptionsFromUsermeta(parsedSpec) {
4798
- var _ref;
4851
+ var _embedOptions, _parsedSpec$usermeta;
4852
+
4853
+ const opts = (_embedOptions = (_parsedSpec$usermeta = parsedSpec.usermeta) === null || _parsedSpec$usermeta === void 0 ? void 0 : _parsedSpec$usermeta.embedOptions) !== null && _embedOptions !== void 0 ? _embedOptions : {};
4799
4854
 
4800
- return (_ref = parsedSpec.usermeta && parsedSpec.usermeta.embedOptions) !== null && _ref !== void 0 ? _ref : {};
4855
+ if (vegaImport.isString(opts.defaultStyle)) {
4856
+ // we don't allow styles set via usermeta since it would allow injection of logic (we set the style via innerHTML)
4857
+ opts.defaultStyle = false;
4858
+ }
4859
+
4860
+ return opts;
4801
4861
  }
4802
4862
  /**
4803
4863
  * Embed a Vega visualization component in a web page. This function returns a promise.
@@ -4823,7 +4883,8 @@
4823
4883
  parsedSpec = spec;
4824
4884
  }
4825
4885
 
4826
- const usermetaLoader = embedOptionsFromUsermeta(parsedSpec).loader; // either create the loader for the first time or create a new loader if the spec has new loader options
4886
+ const loadedEmbedOptions = embedOptionsFromUsermeta(parsedSpec);
4887
+ const usermetaLoader = loadedEmbedOptions.loader; // either create the loader for the first time or create a new loader if the spec has new loader options
4827
4888
 
4828
4889
  if (!loader || usermetaLoader) {
4829
4890
  var _opts$loader;
@@ -4831,7 +4892,7 @@
4831
4892
  loader = createLoader((_opts$loader = opts.loader) !== null && _opts$loader !== void 0 ? _opts$loader : usermetaLoader);
4832
4893
  }
4833
4894
 
4834
- const usermetaOpts = await loadOpts(embedOptionsFromUsermeta(parsedSpec), loader);
4895
+ const usermetaOpts = await loadOpts(loadedEmbedOptions, loader);
4835
4896
  const parsedOpts = await loadOpts(opts, loader);
4836
4897
  const mergedOpts = { ...mergeDeep(parsedOpts, usermetaOpts),
4837
4898
  config: vegaImport.mergeConfig((_parsedOpts$config = parsedOpts.config) !== null && _parsedOpts$config !== void 0 ? _parsedOpts$config : {}, (_usermetaOpts$config = usermetaOpts.config) !== null && _usermetaOpts$config !== void 0 ? _usermetaOpts$config : {})
@@ -4868,7 +4929,7 @@
4868
4929
  }
4869
4930
 
4870
4931
  async function _embed(el, spec) {
4871
- var _opts$config, _opts$actions, _opts$renderer, _opts$logLevel, _opts$downloadFileNam, _ref2, _vega$expressionInter;
4932
+ var _opts$config, _opts$actions, _opts$renderer, _opts$logLevel, _opts$downloadFileNam, _ref, _expressionInterprete;
4872
4933
 
4873
4934
  let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4874
4935
  let loader = arguments.length > 3 ? arguments[3] : undefined;
@@ -4887,7 +4948,6 @@
4887
4948
  }
4888
4949
 
4889
4950
  if (opts.defaultStyle !== false) {
4890
- // Add a default stylesheet to the head of the document.
4891
4951
  const ID = 'vega-embed-style';
4892
4952
  const {
4893
4953
  root,
@@ -4897,7 +4957,7 @@
4897
4957
  if (!root.getElementById(ID)) {
4898
4958
  const style = document.createElement('style');
4899
4959
  style.id = ID;
4900
- style.innerText = opts.defaultStyle === undefined || opts.defaultStyle === true ? (embedStyle ).toString() : opts.defaultStyle;
4960
+ style.innerHTML = opts.defaultStyle === undefined || opts.defaultStyle === true ? (embedStyle ).toString() : opts.defaultStyle;
4901
4961
  rootContainer.appendChild(style);
4902
4962
  }
4903
4963
  }
@@ -4945,6 +5005,19 @@
4945
5005
 
4946
5006
  if (opts.timeFormatLocale) {
4947
5007
  vega.timeFormatLocale(opts.timeFormatLocale);
5008
+ } // Set custom expression functions
5009
+
5010
+
5011
+ if (opts.expressionFunctions) {
5012
+ for (const name in opts.expressionFunctions) {
5013
+ const expressionFunction = opts.expressionFunctions[name];
5014
+
5015
+ if ('fn' in expressionFunction) {
5016
+ vega.expressionFunction(name, expressionFunction.fn, expressionFunction['visitor']);
5017
+ } else if (expressionFunction instanceof Function) {
5018
+ vega.expressionFunction(name, expressionFunction);
5019
+ }
5020
+ }
4948
5021
  }
4949
5022
 
4950
5023
  const {
@@ -4960,7 +5033,7 @@
4960
5033
  logLevel,
4961
5034
  renderer,
4962
5035
  ...(ast ? {
4963
- expr: (_ref2 = (_vega$expressionInter = vega.expressionInterpreter) !== null && _vega$expressionInter !== void 0 ? _vega$expressionInter : opts.expr) !== null && _ref2 !== void 0 ? _ref2 : expression
5036
+ expr: (_ref = (_expressionInterprete = vega.expressionInterpreter) !== null && _expressionInterprete !== void 0 ? _expressionInterprete : opts.expr) !== null && _ref !== void 0 ? _ref : expression
4964
5037
  } : {})
4965
5038
  });
4966
5039
  view.addSignalListener('autosize', (_, autosize) => {
@@ -5126,7 +5199,8 @@
5126
5199
  view,
5127
5200
  spec,
5128
5201
  vgSpec,
5129
- finalize
5202
+ finalize,
5203
+ embedOptions: opts
5130
5204
  };
5131
5205
  }
5132
5206