vega 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,6 +100,11 @@
100
100
  const one$2 = accessor(() => 1, [], 'one');
101
101
  const truthy = accessor(() => true, [], 'true');
102
102
  const falsy = accessor(() => false, [], 'false');
103
+
104
+ /** Utilities common to vega-interpreter and vega-expression for evaluating expresions */
105
+
106
+ /** JSON authors are not allowed to set these properties, as these are built-in to the JS Object Prototype and should not be overridden. */
107
+ const DisallowedObjectProperties = new Set([...Object.getOwnPropertyNames(Object.prototype).filter(name => typeof Object.prototype[name] === 'function'), '__proto__']);
103
108
  function log$1$1(method, level, input) {
104
109
  const args = [level].concat([].slice.call(input));
105
110
  console[method].apply(console, args); // eslint-disable-line no-console
@@ -109,8 +114,7 @@
109
114
  const Warn = 2;
110
115
  const Info = 3;
111
116
  const Debug = 4;
112
- function logger(_, method) {
113
- let handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1$1;
117
+ function logger(_, method, handler = log$1$1) {
114
118
  let level = _ || None$2;
115
119
  return {
116
120
  level(_) {
@@ -144,10 +148,7 @@
144
148
  return _ === Object(_);
145
149
  }
146
150
  const isLegalKey = key => key !== '__proto__';
147
- function mergeConfig() {
148
- for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) {
149
- configs[_key] = arguments[_key];
150
- }
151
+ function mergeConfig(...configs) {
151
152
  return configs.reduce((out, source) => {
152
153
  for (const key in source) {
153
154
  if (key === 'signals') {
@@ -434,9 +435,8 @@
434
435
  }
435
436
  return [u, v];
436
437
  }
437
- const hop = Object.prototype.hasOwnProperty;
438
438
  function has$1(object, property) {
439
- return hop.call(object, property);
439
+ return Object.hasOwn(object, property);
440
440
  }
441
441
  const NULL = {};
442
442
  function fastmap(input) {
@@ -670,10 +670,10 @@
670
670
  return array && peek$1(array) - array[0] || 0;
671
671
  }
672
672
  function $(x) {
673
- return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ?
673
+ return isArray(x) ? `[${x.map(v => v === null ? 'null' : $(v))}]` : isObject(x) || isString(x) ?
674
674
  // Output valid JSON and JS source strings.
675
- // See http://timelessrepo.com/json-isnt-a-javascript-subset
676
- JSON.stringify(x).replace('\u2028', '\\u2028').replace('\u2029', '\\u2029') : x;
675
+ // See https://github.com/judofyr/timeless/blob/master/posts/json-isnt-a-javascript-subset.md
676
+ JSON.stringify(x).replaceAll('\u2028', '\\u2028').replaceAll('\u2029', '\\u2029') : x;
677
677
  }
678
678
  function toBoolean(_) {
679
679
  return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;
@@ -1146,9 +1146,7 @@
1146
1146
  compare2 = f;
1147
1147
  delta = f;
1148
1148
  }
1149
- function left(a, x) {
1150
- let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1151
- let hi = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : a.length;
1149
+ function left(a, x, lo = 0, hi = a.length) {
1152
1150
  if (lo < hi) {
1153
1151
  if (compare1(x, x) !== 0) return hi;
1154
1152
  do {
@@ -1158,9 +1156,7 @@
1158
1156
  }
1159
1157
  return lo;
1160
1158
  }
1161
- function right(a, x) {
1162
- let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1163
- let hi = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : a.length;
1159
+ function right(a, x, lo = 0, hi = a.length) {
1164
1160
  if (lo < hi) {
1165
1161
  if (compare1(x, x) !== 0) return hi;
1166
1162
  do {
@@ -1170,9 +1166,7 @@
1170
1166
  }
1171
1167
  return lo;
1172
1168
  }
1173
- function center(a, x) {
1174
- let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1175
- let hi = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : a.length;
1169
+ function center(a, x, lo = 0, hi = a.length) {
1176
1170
  const i = left(a, x, lo, hi - 1);
1177
1171
  return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
1178
1172
  }
@@ -1289,8 +1283,7 @@
1289
1283
  }
1290
1284
 
1291
1285
  class InternMap extends Map {
1292
- constructor(entries) {
1293
- let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : keyof;
1286
+ constructor(entries, key = keyof) {
1294
1287
  super();
1295
1288
  Object.defineProperties(this, {
1296
1289
  _intern: {
@@ -1316,8 +1309,7 @@
1316
1309
  }
1317
1310
  }
1318
1311
  class InternSet extends Set {
1319
- constructor(values) {
1320
- let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : keyof;
1312
+ constructor(values, key = keyof) {
1321
1313
  super();
1322
1314
  Object.defineProperties(this, {
1323
1315
  _intern: {
@@ -1339,29 +1331,26 @@
1339
1331
  return super.delete(intern_delete(this, value));
1340
1332
  }
1341
1333
  }
1342
- function intern_get(_ref, value) {
1343
- let {
1344
- _intern,
1345
- _key
1346
- } = _ref;
1334
+ function intern_get({
1335
+ _intern,
1336
+ _key
1337
+ }, value) {
1347
1338
  const key = _key(value);
1348
1339
  return _intern.has(key) ? _intern.get(key) : value;
1349
1340
  }
1350
- function intern_set(_ref2, value) {
1351
- let {
1352
- _intern,
1353
- _key
1354
- } = _ref2;
1341
+ function intern_set({
1342
+ _intern,
1343
+ _key
1344
+ }, value) {
1355
1345
  const key = _key(value);
1356
1346
  if (_intern.has(key)) return _intern.get(key);
1357
1347
  _intern.set(key, value);
1358
1348
  return value;
1359
1349
  }
1360
- function intern_delete(_ref3, value) {
1361
- let {
1362
- _intern,
1363
- _key
1364
- } = _ref3;
1350
+ function intern_delete({
1351
+ _intern,
1352
+ _key
1353
+ }, value) {
1365
1354
  const key = _key(value);
1366
1355
  if (_intern.has(key)) {
1367
1356
  value = _intern.get(key);
@@ -1377,8 +1366,7 @@
1377
1366
  return Array.from(keys, key => source[key]);
1378
1367
  }
1379
1368
 
1380
- function compareDefined() {
1381
- let compare = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ascending$1;
1369
+ function compareDefined(compare = ascending$1) {
1382
1370
  if (compare === ascending$1) return ascendingDefined;
1383
1371
  if (typeof compare !== "function") throw new TypeError("compare is not a function");
1384
1372
  return (a, b) => {
@@ -1484,10 +1472,7 @@
1484
1472
 
1485
1473
  // Based on https://github.com/mourner/quickselect
1486
1474
  // ISC license, Copyright 2018 Vladimir Agafonkin.
1487
- function quickselect(array, k) {
1488
- let left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1489
- let right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Infinity;
1490
- let compare = arguments.length > 4 ? arguments[4] : undefined;
1475
+ function quickselect(array, k, left = 0, right = Infinity, compare) {
1491
1476
  k = Math.floor(k);
1492
1477
  left = Math.floor(Math.max(0, left));
1493
1478
  right = Math.floor(Math.min(array.length - 1, right));
@@ -1538,8 +1523,7 @@
1538
1523
  value1 = min$2(values.subarray(i0 + 1));
1539
1524
  return value0 + (value1 - value0) * (i - i0);
1540
1525
  }
1541
- function quantileSorted(values, p) {
1542
- let valueof = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : number$6;
1526
+ function quantileSorted(values, p, valueof = number$6) {
1543
1527
  if (!(n = values.length) || isNaN(p = +p)) return;
1544
1528
  if (p <= 0 || n < 2) return +valueof(values[0], 0, values);
1545
1529
  if (p >= 1) return +valueof(values[n - 1], n - 1, values);
@@ -1607,10 +1591,7 @@
1607
1591
  return sum;
1608
1592
  }
1609
1593
 
1610
- function intersection(values) {
1611
- for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1612
- others[_key - 1] = arguments[_key];
1613
- }
1594
+ function intersection(values, ...others) {
1614
1595
  values = new InternSet(values);
1615
1596
  others = others.map(set$4);
1616
1597
  out: for (const value of values) {
@@ -1627,11 +1608,8 @@
1627
1608
  return values instanceof InternSet ? values : new InternSet(values);
1628
1609
  }
1629
1610
 
1630
- function union() {
1611
+ function union(...others) {
1631
1612
  const set = new InternSet();
1632
- for (var _len = arguments.length, others = new Array(_len), _key = 0; _key < _len; _key++) {
1633
- others[_key] = arguments[_key];
1634
- }
1635
1613
  for (const other of others) {
1636
1614
  for (const o of other) {
1637
1615
  set.add(o);
@@ -1984,7 +1962,7 @@
1984
1962
  if (step < 0) while (++step <= 0) {
1985
1963
  while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
1986
1964
  } else while (--step >= 0) {
1987
- while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
1965
+ while (offseti(date, 1), !test(date)) {} // eslint-disable-line no-empty
1988
1966
  }
1989
1967
  }
1990
1968
  });
@@ -2238,10 +2216,7 @@
2238
2216
  }
2239
2217
  function tickInterval(start, stop, count) {
2240
2218
  const target = Math.abs(stop - start) / count;
2241
- const i = bisector(_ref => {
2242
- let [,, step] = _ref;
2243
- return step;
2244
- }).right(tickIntervals, target);
2219
+ const i = bisector(([,, step]) => step).right(tickIntervals, target);
2245
2220
  if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop / durationYear$1, count));
2246
2221
  if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));
2247
2222
  const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
@@ -3362,22 +3337,20 @@
3362
3337
  /**
3363
3338
  * Factory for a loader constructor that provides methods for requesting
3364
3339
  * files from either the network or disk, and for sanitizing request URIs.
3365
- * @param {function} fetch - The Fetch API for HTTP network requests.
3366
- * If null or undefined, HTTP loading will be disabled.
3367
3340
  * @param {object} fs - The file system interface for file loading.
3368
3341
  * If null or undefined, local file loading will be disabled.
3369
3342
  * @return {function} A loader constructor with the following signature:
3370
3343
  * param {object} [options] - Optional default loading options to use.
3371
3344
  * return {object} - A new loader instance.
3372
3345
  */
3373
- function loaderFactory(fetch, fs) {
3346
+ function loaderFactory(fs) {
3374
3347
  return options => ({
3375
3348
  options: options || {},
3376
3349
  sanitize: sanitize,
3377
3350
  load: load$1,
3378
- fileAccess: !!fs,
3379
- file: fileLoader(fs),
3380
- http: httpLoader(fetch)
3351
+ fileAccess: false,
3352
+ file: fileLoader(),
3353
+ http: httpLoader
3381
3354
  });
3382
3355
  }
3383
3356
 
@@ -3394,7 +3367,7 @@
3394
3367
  async function load$1(uri, options) {
3395
3368
  const opt = await this.sanitize(uri, options),
3396
3369
  url = opt.href;
3397
- return opt.localFile ? this.file(url) : this.http(url, options);
3370
+ return opt.localFile ? this.file(url) : this.http(url, options?.http);
3398
3371
  }
3399
3372
 
3400
3373
  /**
@@ -3482,11 +3455,7 @@
3482
3455
  * return {Promise} A promise that resolves to the file contents.
3483
3456
  */
3484
3457
  function fileLoader(fs) {
3485
- return fs ? filename => new Promise((accept, reject) => {
3486
- fs.readFile(filename, (error, data) => {
3487
- if (error) reject(error);else accept(data);
3488
- });
3489
- }) : fileReject;
3458
+ return fileReject;
3490
3459
  }
3491
3460
 
3492
3461
  /**
@@ -3497,27 +3466,16 @@
3497
3466
  }
3498
3467
 
3499
3468
  /**
3500
- * HTTP request handler factory.
3501
- * @param {function} fetch - The Fetch API method.
3502
- * @return {function} - An http loader with the following signature:
3503
- * param {string} url - The url to request.
3504
- * param {object} options - An options hash.
3505
- * return {Promise} - A promise that resolves to the file contents.
3469
+ * An http loader.
3470
+ * @param {string} url - The url to request.
3471
+ * @param {Partial<RequestInit>} options - An options hash.
3472
+ * @return {Promise} - A promise that resolves to the file contents.
3506
3473
  */
3507
- function httpLoader(fetch) {
3508
- return fetch ? async function (url, options) {
3509
- const opt = extend$1({}, this.options.http, options),
3510
- type = options && options.response,
3511
- response = await fetch(url, opt);
3512
- return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();
3513
- } : httpReject;
3514
- }
3515
-
3516
- /**
3517
- * Default http request handler that simply rejects.
3518
- */
3519
- async function httpReject() {
3520
- error('No HTTP fetch method available.');
3474
+ async function httpLoader(url, options) {
3475
+ const opt = extend$1({}, this.options.http, options),
3476
+ type = options && options.response,
3477
+ response = await fetch(url, opt);
3478
+ return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();
3521
3479
  }
3522
3480
  const isValid = _ => _ != null && _ === _;
3523
3481
  const isBoolean = _ => _ === 'true' || _ === 'false' || _ === true || _ === false;
@@ -3677,10 +3635,7 @@
3677
3635
  }
3678
3636
  }
3679
3637
  }
3680
- const loader = loaderFactory(typeof fetch !== 'undefined' && fetch,
3681
- // use built-in fetch API
3682
- null // no file system access
3683
- );
3638
+ const loader = loaderFactory();
3684
3639
 
3685
3640
  function UniqueList(idFunc) {
3686
3641
  const $ = idFunc || identity$6,
@@ -5128,8 +5083,6 @@
5128
5083
  }
5129
5084
  });
5130
5085
 
5131
- /* eslint-disable require-atomic-updates */
5132
-
5133
5086
  /**
5134
5087
  * Evaluates the dataflow and returns a Promise that resolves when pulse
5135
5088
  * propagation completes. This method will increment the current timestamp
@@ -6062,67 +6015,67 @@
6062
6015
  p;
6063
6016
  if (w < 6.25) {
6064
6017
  w -= 3.125;
6065
- p = -3.6444120640178196996e-21;
6066
- p = -1.685059138182016589e-19 + p * w;
6018
+ p = -364441206401782e-35;
6019
+ p = -16850591381820166e-35 + p * w;
6067
6020
  p = 1.2858480715256400167e-18 + p * w;
6068
6021
  p = 1.115787767802518096e-17 + p * w;
6069
- p = -1.333171662854620906e-16 + p * w;
6022
+ p = -1333171662854621e-31 + p * w;
6070
6023
  p = 2.0972767875968561637e-17 + p * w;
6071
6024
  p = 6.6376381343583238325e-15 + p * w;
6072
- p = -4.0545662729752068639e-14 + p * w;
6073
- p = -8.1519341976054721522e-14 + p * w;
6025
+ p = -4054566272975207e-29 + p * w;
6026
+ p = -8151934197605472e-29 + p * w;
6074
6027
  p = 2.6335093153082322977e-12 + p * w;
6075
- p = -1.2975133253453532498e-11 + p * w;
6076
- p = -5.4154120542946279317e-11 + p * w;
6028
+ p = -12975133253453532e-27 + p * w;
6029
+ p = -5415412054294628e-26 + p * w;
6077
6030
  p = 1.051212273321532285e-09 + p * w;
6078
- p = -4.1126339803469836976e-09 + p * w;
6079
- p = -2.9070369957882005086e-08 + p * w;
6031
+ p = -4.112633980346984e-9 + p * w;
6032
+ p = -2.9070369957882005e-8 + p * w;
6080
6033
  p = 4.2347877827932403518e-07 + p * w;
6081
- p = -1.3654692000834678645e-06 + p * w;
6082
- p = -1.3882523362786468719e-05 + p * w;
6034
+ p = -13654692000834679e-22 + p * w;
6035
+ p = -13882523362786469e-21 + p * w;
6083
6036
  p = 0.0001867342080340571352 + p * w;
6084
- p = -0.00074070253416626697512 + p * w;
6085
- p = -0.0060336708714301490533 + p * w;
6037
+ p = -740702534166267e-18 + p * w;
6038
+ p = -0.006033670871430149 + p * w;
6086
6039
  p = 0.24015818242558961693 + p * w;
6087
6040
  p = 1.6536545626831027356 + p * w;
6088
6041
  } else if (w < 16.0) {
6089
6042
  w = Math.sqrt(w) - 3.25;
6090
6043
  p = 2.2137376921775787049e-09;
6091
6044
  p = 9.0756561938885390979e-08 + p * w;
6092
- p = -2.7517406297064545428e-07 + p * w;
6045
+ p = -2.7517406297064545e-7 + p * w;
6093
6046
  p = 1.8239629214389227755e-08 + p * w;
6094
6047
  p = 1.5027403968909827627e-06 + p * w;
6095
- p = -4.013867526981545969e-06 + p * w;
6048
+ p = -4013867526981546e-21 + p * w;
6096
6049
  p = 2.9234449089955446044e-06 + p * w;
6097
6050
  p = 1.2475304481671778723e-05 + p * w;
6098
- p = -4.7318229009055733981e-05 + p * w;
6051
+ p = -47318229009055734e-21 + p * w;
6099
6052
  p = 6.8284851459573175448e-05 + p * w;
6100
6053
  p = 2.4031110387097893999e-05 + p * w;
6101
- p = -0.0003550375203628474796 + p * w;
6054
+ p = -3550375203628475e-19 + p * w;
6102
6055
  p = 0.00095328937973738049703 + p * w;
6103
- p = -0.0016882755560235047313 + p * w;
6056
+ p = -0.0016882755560235047 + p * w;
6104
6057
  p = 0.0024914420961078508066 + p * w;
6105
- p = -0.0037512085075692412107 + p * w;
6058
+ p = -0.003751208507569241 + p * w;
6106
6059
  p = 0.005370914553590063617 + p * w;
6107
6060
  p = 1.0052589676941592334 + p * w;
6108
6061
  p = 3.0838856104922207635 + p * w;
6109
6062
  } else if (Number.isFinite(w)) {
6110
6063
  w = Math.sqrt(w) - 5.0;
6111
- p = -2.7109920616438573243e-11;
6112
- p = -2.5556418169965252055e-10 + p * w;
6064
+ p = -27109920616438573e-27;
6065
+ p = -2555641816996525e-25 + p * w;
6113
6066
  p = 1.5076572693500548083e-09 + p * w;
6114
- p = -3.7894654401267369937e-09 + p * w;
6067
+ p = -3.789465440126737e-9 + p * w;
6115
6068
  p = 7.6157012080783393804e-09 + p * w;
6116
- p = -1.4960026627149240478e-08 + p * w;
6069
+ p = -1.496002662714924e-8 + p * w;
6117
6070
  p = 2.9147953450901080826e-08 + p * w;
6118
- p = -6.7711997758452339498e-08 + p * w;
6071
+ p = -6.771199775845234e-8 + p * w;
6119
6072
  p = 2.2900482228026654717e-07 + p * w;
6120
- p = -9.9298272942317002539e-07 + p * w;
6073
+ p = -9.9298272942317e-7 + p * w;
6121
6074
  p = 4.5260625972231537039e-06 + p * w;
6122
- p = -1.9681778105531670567e-05 + p * w;
6075
+ p = -1968177810553167e-20 + p * w;
6123
6076
  p = 7.5995277030017761139e-05 + p * w;
6124
- p = -0.00021503011930044477347 + p * w;
6125
- p = -0.00013871931833623122026 + p * w;
6077
+ p = -21503011930044477e-20 + p * w;
6078
+ p = -13871931833623122e-20 + p * w;
6126
6079
  p = 1.0103004648645343977 + p * w;
6127
6080
  p = 4.8499064014085844221 + p * w;
6128
6081
  } else {
@@ -6509,7 +6462,6 @@
6509
6462
  };
6510
6463
  }
6511
6464
  function exp$1(data, x, y) {
6512
- // eslint-disable-next-line no-unused-vars
6513
6465
  const [xv, yv, ux, uy] = points(data, x, y);
6514
6466
  let YL = 0,
6515
6467
  XY = 0,
@@ -12689,10 +12641,10 @@
12689
12641
  }));
12690
12642
 
12691
12643
  var A = -0.14861,
12692
- B$1 = +1.78277,
12644
+ B$1 = 1.78277,
12693
12645
  C$1 = -0.29227,
12694
12646
  D$1 = -0.90649,
12695
- E = +1.97294,
12647
+ E = 1.97294,
12696
12648
  ED = E * D$1,
12697
12649
  EB = E * B$1,
12698
12650
  BC_DA = B$1 * C$1 - D$1 * A;
@@ -12767,7 +12719,7 @@
12767
12719
  };
12768
12720
  }
12769
12721
 
12770
- var constant$2 = (x => () => x);
12722
+ var constant$2 = x => () => x;
12771
12723
 
12772
12724
  function linear$1(a, d) {
12773
12725
  return function (t) {
@@ -17533,12 +17485,12 @@
17533
17485
  /**
17534
17486
  * Add an event handler. Subclasses should override this method.
17535
17487
  */
17536
- on( /*type, handler*/) {}
17488
+ on(/*type, handler*/) {}
17537
17489
 
17538
17490
  /**
17539
17491
  * Remove an event handler. Subclasses should override this method.
17540
17492
  */
17541
- off( /*type, handler*/) {}
17493
+ off(/*type, handler*/) {}
17542
17494
 
17543
17495
  /**
17544
17496
  * Utility method for finding the array index of an event handler.
@@ -17744,7 +17696,7 @@
17744
17696
  * incremental should implement this method.
17745
17697
  * @param {Item} item - The dirty item whose bounds should be redrawn.
17746
17698
  */
17747
- dirty( /*item*/) {}
17699
+ dirty(/*item*/) {}
17748
17700
 
17749
17701
  /**
17750
17702
  * Render an input scenegraph, potentially with a set of dirty items.
@@ -17783,7 +17735,7 @@
17783
17735
  * @param {Array} markTypes - Array of the mark types to render.
17784
17736
  * If undefined, render all mark types
17785
17737
  */
17786
- _render( /*scene, markTypes*/
17738
+ _render(/*scene, markTypes*/
17787
17739
  ) {
17788
17740
  // subclasses to override
17789
17741
  }
@@ -18383,12 +18335,9 @@
18383
18335
  return m;
18384
18336
  },
18385
18337
  m = {
18386
- open(tag) {
18338
+ open(tag, ...attrs) {
18387
18339
  push(tag);
18388
18340
  outer = '<' + tag;
18389
- for (var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
18390
- attrs[_key - 1] = arguments[_key];
18391
- }
18392
18341
  for (const set of attrs) {
18393
18342
  for (const key in set) attr(key, set[key]);
18394
18343
  }
@@ -22901,7 +22850,7 @@
22901
22850
 
22902
22851
  function clipCircle (radius) {
22903
22852
  var cr = cos$1(radius),
22904
- delta = 6 * radians,
22853
+ delta = 2 * radians,
22905
22854
  smallRadius = cr > 0,
22906
22855
  notHemisphere = abs$1(cr) > epsilon$3; // TODO optimise for this common case
22907
22856
 
@@ -23371,7 +23320,7 @@
23371
23320
  return graticule.extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]).extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]);
23372
23321
  }
23373
23322
 
23374
- var identity = (x => x);
23323
+ var identity = x => x;
23375
23324
 
23376
23325
  var areaSum = new Adder(),
23377
23326
  areaRingSum = new Adder(),
@@ -23645,7 +23594,7 @@
23645
23594
  const r = this._radius;
23646
23595
  const s = this._;
23647
23596
  this._ = ""; // stash the old string so we can cache the circle path fragment
23648
- this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;
23597
+ this._append`m0,${r}a${r},${r} 0 1,1 0,${ -2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;
23649
23598
  cacheRadius = r;
23650
23599
  cacheAppend = this._append;
23651
23600
  cacheCircle = this._;
@@ -30626,7 +30575,6 @@
30626
30575
  const detleft = (ay - cy) * (bx - cx);
30627
30576
  const detright = (ax - cx) * (by - cy);
30628
30577
  const det = detleft - detright;
30629
- if (detleft === 0 || detright === 0 || detleft > 0 !== detright > 0) return det;
30630
30578
  const detsum = Math.abs(detleft + detright);
30631
30579
  if (Math.abs(det) >= ccwerrboundA * detsum) return det;
30632
30580
  return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
@@ -30635,9 +30583,7 @@
30635
30583
  const EPSILON = Math.pow(2, -52);
30636
30584
  const EDGE_STACK = new Uint32Array(512);
30637
30585
  class Delaunator {
30638
- static from(points) {
30639
- let getX = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetX;
30640
- let getY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultGetY;
30586
+ static from(points, getX = defaultGetX, getY = defaultGetY) {
30641
30587
  const n = points.length;
30642
30588
  const coords = new Float64Array(n * 2);
30643
30589
  for (let i = 0; i < n; i++) {
@@ -30662,7 +30608,7 @@
30662
30608
  this._hullPrev = new Uint32Array(n); // edge to prev edge
30663
30609
  this._hullNext = new Uint32Array(n); // edge to next edge
30664
30610
  this._hullTri = new Uint32Array(n); // edge to adjacent triangle
30665
- this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash
30611
+ this._hullHash = new Int32Array(this._hashSize); // angular edge hash
30666
30612
 
30667
30613
  // temporary arrays for sorting points
30668
30614
  this._ids = new Uint32Array(n);
@@ -30695,11 +30641,10 @@
30695
30641
  }
30696
30642
  const cx = (minX + maxX) / 2;
30697
30643
  const cy = (minY + maxY) / 2;
30698
- let minDist = Infinity;
30699
30644
  let i0, i1, i2;
30700
30645
 
30701
30646
  // pick a seed point close to the center
30702
- for (let i = 0; i < n; i++) {
30647
+ for (let i = 0, minDist = Infinity; i < n; i++) {
30703
30648
  const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]);
30704
30649
  if (d < minDist) {
30705
30650
  i0 = i;
@@ -30708,10 +30653,9 @@
30708
30653
  }
30709
30654
  const i0x = coords[2 * i0];
30710
30655
  const i0y = coords[2 * i0 + 1];
30711
- minDist = Infinity;
30712
30656
 
30713
30657
  // find the point closest to the seed
30714
- for (let i = 0; i < n; i++) {
30658
+ for (let i = 0, minDist = Infinity; i < n; i++) {
30715
30659
  if (i === i0) continue;
30716
30660
  const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]);
30717
30661
  if (d < minDist && d > 0) {
@@ -30745,9 +30689,10 @@
30745
30689
  let j = 0;
30746
30690
  for (let i = 0, d0 = -Infinity; i < n; i++) {
30747
30691
  const id = this._ids[i];
30748
- if (this._dists[id] > d0) {
30692
+ const d = this._dists[id];
30693
+ if (d > d0) {
30749
30694
  hull[j++] = id;
30750
- d0 = this._dists[id];
30695
+ d0 = d;
30751
30696
  }
30752
30697
  }
30753
30698
  this.hull = hull.subarray(0, j);
@@ -31124,8 +31069,7 @@
31124
31069
  }
31125
31070
 
31126
31071
  let Voronoi$1 = class Voronoi {
31127
- constructor(delaunay) {
31128
- let [xmin, ymin, xmax, ymax] = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 960, 500];
31072
+ constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) {
31129
31073
  if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds");
31130
31074
  this.delaunay = delaunay;
31131
31075
  this._circumcenters = new Float64Array(delaunay.points.length * 2);
@@ -31533,10 +31477,7 @@
31533
31477
  return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r];
31534
31478
  }
31535
31479
  class Delaunay {
31536
- static from(points) {
31537
- let fx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : pointX;
31538
- let fy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : pointY;
31539
- let that = arguments.length > 3 ? arguments[3] : undefined;
31480
+ static from(points, fx = pointX, fy = pointY, that) {
31540
31481
  return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that)));
31541
31482
  }
31542
31483
  constructor(points) {
@@ -31639,8 +31580,7 @@
31639
31580
  }
31640
31581
  } while (e !== e0);
31641
31582
  }
31642
- find(x, y) {
31643
- let i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
31583
+ find(x, y, i = 0) {
31644
31584
  if ((x = +x, x !== x) || (y = +y, y !== y)) return -1;
31645
31585
  const i0 = i;
31646
31586
  let c;
@@ -32522,7 +32462,7 @@
32522
32462
  addv[i] = key(data[i]);
32523
32463
  addi[i] = i;
32524
32464
  }
32525
- addv = sort(addv, addi);
32465
+ addv = sort$1(addv, addi);
32526
32466
  if (n0) {
32527
32467
  oldv = value;
32528
32468
  oldi = index;
@@ -32584,7 +32524,7 @@
32584
32524
  size: () => size
32585
32525
  };
32586
32526
  }
32587
- function sort(values, index) {
32527
+ function sort$1(values, index) {
32588
32528
  values.sort.call(index, (a, b) => {
32589
32529
  const x = values[a],
32590
32530
  y = values[b];
@@ -33065,7 +33005,7 @@
33065
33005
  resolvefilter: ResolveFilter
33066
33006
  });
33067
33007
 
33068
- var version = "5.30.0";
33008
+ var version$1 = "6.2.0";
33069
33009
 
33070
33010
  const RawCode = 'RawCode';
33071
33011
  const Literal = 'Literal';
@@ -34543,6 +34483,9 @@
34543
34483
  substring: fn('substring', STRING),
34544
34484
  split: fn('split', STRING),
34545
34485
  trim: fn('trim', STRING, 0),
34486
+ // base64 encode/decode
34487
+ btoa: 'btoa',
34488
+ atob: 'atob',
34546
34489
  // REGEXP functions
34547
34490
  regexp: REGEXP,
34548
34491
  test: fn('test', REGEXP),
@@ -34568,6 +34511,8 @@
34568
34511
  globalvar = opt.globalvar,
34569
34512
  fieldvar = opt.fieldvar,
34570
34513
  outputGlobal = isFunction(globalvar) ? globalvar : id => `${globalvar}["${id}"]`;
34514
+ // JSON authors are not allowed to set properties with these names, as these are built-in to the JS Object Prototype.
34515
+ new Set([...Object.getOwnPropertyNames(Object.prototype).filter(name => typeof Object.prototype[name] === 'function'), '__proto__']);
34571
34516
  let globals = {},
34572
34517
  fields = {},
34573
34518
  memberDepth = 0;
@@ -34621,7 +34566,16 @@
34621
34566
  UnaryExpression: n => '(' + n.operator + visit(n.argument) + ')',
34622
34567
  ConditionalExpression: n => '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')',
34623
34568
  LogicalExpression: n => '(' + visit(n.left) + n.operator + visit(n.right) + ')',
34624
- ObjectExpression: n => '{' + n.properties.map(visit).join(',') + '}',
34569
+ ObjectExpression: n => {
34570
+ // If any keys would override Object prototype methods, throw error
34571
+ for (const prop of n.properties) {
34572
+ const keyName = prop.key.name;
34573
+ if (DisallowedObjectProperties.has(keyName)) {
34574
+ error('Illegal property: ' + keyName);
34575
+ }
34576
+ }
34577
+ return '{' + n.properties.map(visit).join(',') + '}';
34578
+ },
34625
34579
  Property: n => {
34626
34580
  memberDepth += 1;
34627
34581
  const k = visit(n.key);
@@ -34666,6 +34620,12 @@
34666
34620
  TYPE_RANGE_EXC = 'R-E',
34667
34621
  TYPE_RANGE_LE = 'R-LE',
34668
34622
  TYPE_RANGE_RE = 'R-RE',
34623
+ TYPE_PRED_LT = 'E-LT',
34624
+ TYPE_PRED_LTE = 'E-LTE',
34625
+ TYPE_PRED_GT = 'E-GT',
34626
+ TYPE_PRED_GTE = 'E-GTE',
34627
+ TYPE_PRED_VALID = 'E-VALID',
34628
+ TYPE_PRED_ONE_OF = 'E-ONE',
34669
34629
  UNIT_INDEX = 'index:unit';
34670
34630
 
34671
34631
  // TODO: revisit date coercion?
@@ -34699,6 +34659,18 @@
34699
34659
  if (!inrange(dval, values[i], false, false)) return false;
34700
34660
  } else if (f.type === TYPE_RANGE_LE) {
34701
34661
  if (!inrange(dval, values[i], false, true)) return false;
34662
+ } else if (f.type === TYPE_PRED_LT) {
34663
+ if (dval >= values[i]) return false;
34664
+ } else if (f.type === TYPE_PRED_LTE) {
34665
+ if (dval > values[i]) return false;
34666
+ } else if (f.type === TYPE_PRED_GT) {
34667
+ if (dval <= values[i]) return false;
34668
+ } else if (f.type === TYPE_PRED_GTE) {
34669
+ if (dval < values[i]) return false;
34670
+ } else if (f.type === TYPE_PRED_VALID) {
34671
+ if (dval === null || isNaN(dval)) return false;
34672
+ } else if (f.type === TYPE_PRED_ONE_OF) {
34673
+ if (values[i].indexOf(dval) === -1) return false;
34702
34674
  }
34703
34675
  }
34704
34676
  }
@@ -34945,13 +34917,9 @@
34945
34917
  field = 'unit',
34946
34918
  indexName = IndexPrefix$1 + field,
34947
34919
  dataName = DataPrefix$1 + data;
34948
-
34949
- // eslint-disable-next-line no-prototype-builtins
34950
34920
  if (op === Intersect && !has$1(params, indexName)) {
34951
34921
  params[indexName] = scope.getData(data).indataRef(scope, field);
34952
34922
  }
34953
-
34954
- // eslint-disable-next-line no-prototype-builtins
34955
34923
  if (!has$1(params, dataName)) {
34956
34924
  params[dataName] = scope.getData(data).tuplesRef();
34957
34925
  }
@@ -35059,13 +35027,17 @@
35059
35027
  }
35060
35028
  }
35061
35029
  }
35030
+
35031
+ /**
35032
+ * nameOrFunction must be a string or function that was registered.
35033
+ * Return undefined if scale is not recognized.
35034
+ */
35062
35035
  function getScale(nameOrFunction, ctx) {
35063
- if (isFunction(nameOrFunction)) {
35064
- return nameOrFunction;
35065
- }
35066
35036
  if (isString(nameOrFunction)) {
35067
35037
  const maybeScale = ctx.scales[nameOrFunction];
35068
35038
  return maybeScale && isRegisteredScale(maybeScale.value) ? maybeScale.value : undefined;
35039
+ } else if (isFunction(nameOrFunction)) {
35040
+ return isRegisteredScale(nameOrFunction) ? nameOrFunction : undefined;
35069
35041
  }
35070
35042
  return undefined;
35071
35043
  }
@@ -35250,37 +35222,29 @@
35250
35222
  function sequence(seq) {
35251
35223
  return array(seq) || (isString(seq) ? seq : null);
35252
35224
  }
35253
- function join(seq) {
35254
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
35255
- args[_key - 1] = arguments[_key];
35256
- }
35225
+ function join(seq, ...args) {
35257
35226
  return array(seq).join(...args);
35258
35227
  }
35259
- function indexof(seq) {
35260
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
35261
- args[_key2 - 1] = arguments[_key2];
35262
- }
35228
+ function indexof(seq, ...args) {
35263
35229
  return sequence(seq).indexOf(...args);
35264
35230
  }
35265
- function lastindexof(seq) {
35266
- for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
35267
- args[_key3 - 1] = arguments[_key3];
35268
- }
35231
+ function lastindexof(seq, ...args) {
35269
35232
  return sequence(seq).lastIndexOf(...args);
35270
35233
  }
35271
- function slice(seq) {
35272
- for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
35273
- args[_key4 - 1] = arguments[_key4];
35274
- }
35234
+ function slice(seq, ...args) {
35275
35235
  return sequence(seq).slice(...args);
35276
35236
  }
35277
35237
  function replace(str, pattern, repl) {
35278
35238
  if (isFunction(repl)) error('Function argument passed to replace.');
35239
+ if (!isString(pattern) && !isRegExp(pattern)) error('Please pass a string or RegExp argument to replace.');
35279
35240
  return String(str).replace(pattern, repl);
35280
35241
  }
35281
35242
  function reverse(seq) {
35282
35243
  return array(seq).slice().reverse();
35283
35244
  }
35245
+ function sort(seq) {
35246
+ return array(seq).slice().sort(ascending$2);
35247
+ }
35284
35248
  function bandspace(count, paddingInner, paddingOuter) {
35285
35249
  return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0);
35286
35250
  }
@@ -35396,8 +35360,7 @@
35396
35360
  * @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point
35397
35361
  * @returns a new array containing the lasso with the new point
35398
35362
  */
35399
- function lassoAppend(lasso, x, y) {
35400
- let minDist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5;
35363
+ function lassoAppend(lasso, x, y, minDist = 5) {
35401
35364
  lasso = array$5(lasso);
35402
35365
  const last = lasso[lasso.length - 1];
35403
35366
 
@@ -35412,8 +35375,7 @@
35412
35375
  * @returns the svg path command that draws the lasso
35413
35376
  */
35414
35377
  function lassoPath(lasso) {
35415
- return array$5(lasso).reduce((svg, _ref, i) => {
35416
- let [x, y] = _ref;
35378
+ return array$5(lasso).reduce((svg, [x, y], i) => {
35417
35379
  return svg += i == 0 ? `M ${x},${y} ` : i === lasso.length - 1 ? ' Z' : `L ${x},${y} `;
35418
35380
  }, '');
35419
35381
  }
@@ -35521,6 +35483,7 @@
35521
35483
  lastindexof,
35522
35484
  replace,
35523
35485
  reverse,
35486
+ sort,
35524
35487
  slice,
35525
35488
  flush,
35526
35489
  lerp,
@@ -38598,6 +38561,8 @@
38598
38561
  const GuideTitleStyle = 'guide-title';
38599
38562
  const GroupTitleStyle = 'group-title';
38600
38563
  const GroupSubtitleStyle = 'group-subtitle';
38564
+
38565
+ /** All values of LegendType */
38601
38566
  const Symbols = 'symbol';
38602
38567
  const Gradient = 'gradient';
38603
38568
  const Discrete = 'discrete';
@@ -41480,6 +41445,7 @@
41480
41445
  // -- Transforms -----
41481
41446
 
41482
41447
  extend$1(transforms, tx, vtx, encode$1, geo, force, label, tree, reg, voronoi, wordcloud, xf);
41448
+ const version = version$1;
41483
41449
 
41484
41450
  exports.Bounds = Bounds;
41485
41451
  exports.CanvasHandler = CanvasHandler;
@@ -41489,6 +41455,7 @@
41489
41455
  exports.DAYOFYEAR = DAYOFYEAR;
41490
41456
  exports.Dataflow = Dataflow;
41491
41457
  exports.Debug = Debug;
41458
+ exports.DisallowedObjectProperties = DisallowedObjectProperties;
41492
41459
  exports.Error = Error$1;
41493
41460
  exports.EventStream = EventStream;
41494
41461
  exports.Gradient = Gradient$1;
@@ -41654,7 +41621,6 @@
41654
41621
  exports.renderModule = renderModule;
41655
41622
  exports.repeat = repeat;
41656
41623
  exports.resetDefaultLocale = resetDefaultLocale;
41657
- exports.resetSVGClipId = resetSVGClipId;
41658
41624
  exports.resetSVGDefIds = resetSVGDefIds;
41659
41625
  exports.responseType = responseType;
41660
41626
  exports.runtimeContext = context;