mapshaper 0.5.118 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/www/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.5.118";
3
+ var VERSION = "0.6.3";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -28,7 +28,7 @@
28
28
  get regexEscape () { return regexEscape; },
29
29
  get htmlEscape () { return htmlEscape; },
30
30
  get defaults () { return defaults; },
31
- get extend () { return extend; },
31
+ get extend () { return extend$1; },
32
32
  get inherit () { return inherit; },
33
33
  get reduceAsync () { return reduceAsync; },
34
34
  get merge () { return merge; },
@@ -81,6 +81,7 @@
81
81
  get findValueByPct () { return findValueByPct; },
82
82
  get findValueByRank () { return findValueByRank; },
83
83
  get findMedian () { return findMedian; },
84
+ get findQuantile () { return findQuantile; },
84
85
  get mean () { return mean; },
85
86
  get format () { return format; },
86
87
  get formatter () { return formatter; },
@@ -132,7 +133,8 @@
132
133
  clearStash: clearStash
133
134
  });
134
135
 
135
- var Buffer = require('buffer').Buffer; // works with browserify
136
+ // Fall back to browserify's Buffer polyfill
137
+ var B$3 = typeof Buffer != 'undefined' ? Buffer : require('buffer').Buffer;
136
138
 
137
139
  var uniqCount = 0;
138
140
  function getUniqueName(prefix) {
@@ -257,7 +259,7 @@
257
259
  '/': '/'
258
260
  };
259
261
  function htmlEscape(s) {
260
- return String(s).replace(/[&<>"'\/]/g, function(s) {
262
+ return String(s).replace(/[&<>"'/]/g, function(s) {
261
263
  return entityMap[s];
262
264
  });
263
265
  }
@@ -274,7 +276,7 @@
274
276
  return dest;
275
277
  }
276
278
 
277
- function extend(o) {
279
+ function extend$1(o) {
278
280
  var dest = o || {},
279
281
  n = arguments.length,
280
282
  key, i, src;
@@ -311,7 +313,7 @@
311
313
  f.prototype = src.prototype || src; // added || src to allow inheriting from objects as well as functions
312
314
  // Extend targ prototype instead of wiping it out --
313
315
  // in case inherit() is called after targ.prototype = {stuff}; statement
314
- targ.prototype = extend(new f(), targ.prototype); //
316
+ targ.prototype = extend$1(new f(), targ.prototype); //
315
317
  targ.prototype.constructor = targ;
316
318
  targ.prototype.__super__ = f;
317
319
  }
@@ -831,18 +833,24 @@
831
833
  return arr[k];
832
834
  }
833
835
 
834
- //
835
- //
836
836
  function findMedian(arr) {
837
- var n = arr.length,
838
- rank = Math.floor(n / 2) + 1,
839
- median = findValueByRank(arr, rank);
840
- if ((n & 1) == 0) {
841
- median = (median + findValueByRank(arr, rank - 1)) / 2;
842
- }
843
- return median;
837
+ return findQuantile(arr, 0.5);
844
838
  }
845
839
 
840
+ function findQuantile(arr, k) {
841
+ var n = arr.length,
842
+ i1 = Math.floor((n - 1) * k),
843
+ i2 = Math.ceil((n - 1) * k);
844
+ if (i1 < 0 || i2 >= n) return NaN;
845
+ var v1 = findValueByRank(arr, i1 + 1);
846
+ if (i1 == i2) return v1;
847
+ var v2 = findValueByRank(arr, i2 + 1);
848
+ // use linear interpolation
849
+ var w1 = i2 / (n - 1) - k;
850
+ var w2 = k - i1 / (n - 1);
851
+ var v = (v1 * w1 + v2 * w2) * (n - 1);
852
+ return v;
853
+ }
846
854
 
847
855
  function mean(arr) {
848
856
  var count = 0,
@@ -900,8 +908,8 @@
900
908
  var type = matches[4];
901
909
  var isString = type == 's',
902
910
  isHex = type == 'x' || type == 'X',
903
- isInt = type == 'd' || type == 'i',
904
- isFloat = type == 'f',
911
+ // isInt = type == 'd' || type == 'i',
912
+ // isFloat = type == 'f',
905
913
  isNumber = !isString;
906
914
 
907
915
  var sign = "",
@@ -960,7 +968,7 @@
960
968
 
961
969
  // Get a function for interpolating formatted values into a string.
962
970
  function formatter(fmt) {
963
- var codeRxp = /%([\',+0]*)([1-9]?)((?:\.[1-9])?)([sdifxX%])/g;
971
+ var codeRxp = /%([',+0]*)([1-9]?)((?:\.[1-9])?)([sdifxX%])/g;
964
972
  var literals = [],
965
973
  formatCodes = [],
966
974
  startIdx = 0,
@@ -1004,10 +1012,10 @@
1004
1012
 
1005
1013
  function createBuffer(arg, arg2) {
1006
1014
  if (isInteger(arg)) {
1007
- return Buffer.allocUnsafe ? Buffer.allocUnsafe(arg) : new Buffer(arg);
1015
+ return B$3.allocUnsafe ? B$3.allocUnsafe(arg) : new B$3(arg);
1008
1016
  } else {
1009
1017
  // check allocUnsafe to make sure Buffer.from() will accept strings (it didn't before Node v5.10)
1010
- return Buffer.from && Buffer.allocUnsafe ? Buffer.from(arg, arg2) : new Buffer(arg, arg2);
1018
+ return B$3.from && B$3.allocUnsafe ? B$3.from(arg, arg2) : new B$3(arg, arg2);
1011
1019
  }
1012
1020
  }
1013
1021
 
@@ -3513,10 +3521,31 @@
3513
3521
  findMaxPartCount: findMaxPartCount
3514
3522
  });
3515
3523
 
3524
+ // Several dependencies are loaded via require() ... this module returns a
3525
+ // stub function when require() does not exist as a global function,
3526
+ // to avoid runtime errors (this should only happen in some tests when single
3527
+ // modules are imported)
3528
+ var f;
3529
+ if (typeof require == 'function') {
3530
+ f = require;
3531
+ } else {
3532
+ f = function() {
3533
+ // console.error('Unable to load module', name);
3534
+ };
3535
+ }
3536
+ var require$1 = f;
3537
+
3538
+ // import { createRequire } from "module";
3539
+
3540
+ var iconv = require$1('iconv-lite');
3541
+
3542
+ // import iconv from 'iconv-lite';
3543
+ // import * as iconv from 'iconv-lite';
3544
+ // import * as iconv from '../../node_modules/iconv-lite/lib/index.js';
3545
+
3516
3546
  // List of encodings supported by iconv-lite:
3517
3547
  // https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings
3518
3548
 
3519
- var iconv = require('iconv-lite');
3520
3549
  var toUtf8 = getNativeEncoder('utf8');
3521
3550
  var fromUtf8 = getNativeDecoder('utf8');
3522
3551
 
@@ -3587,7 +3616,7 @@
3587
3616
  }
3588
3617
  return function(str) {
3589
3618
  // Convert Uint8Array from encoder to Buffer (fix for issue #216)
3590
- return encoder ? Buffer.from(encoder.encode(str).buffer) : utils.createBuffer(str, enc);
3619
+ return encoder ? B$3.from(encoder.encode(str).buffer) : utils.createBuffer(str, enc);
3591
3620
  };
3592
3621
  }
3593
3622
 
@@ -4332,17 +4361,18 @@
4332
4361
  this.ty -= cy * (sy - 1);
4333
4362
  };
4334
4363
 
4364
+ var mproj$1 = require$1('mproj');
4365
+
4335
4366
  // A compound projection, consisting of a default projection and one or more rectangular frames
4336
4367
  // that are projected separately and affine transformed.
4337
4368
  // @mainParams: parameters for main projection, including:
4338
4369
  // proj: Proj string
4339
4370
  // bbox: lat-lon bounding box
4340
4371
  function MixedProjection(mainParams, options) {
4341
- var mproj = require('mproj');
4342
4372
  var mainFrame = initFrame(mainParams);
4343
4373
  var mainP = mainFrame.crs;
4344
4374
  var frames = [mainFrame];
4345
- var mixedP = initMixedProjection(mproj);
4375
+ var mixedP = initMixedProjection(mproj$1);
4346
4376
 
4347
4377
  // This CRS masquerades as the main projection... the version with
4348
4378
  // custom insets is exposed to savvy users
@@ -4386,7 +4416,7 @@
4386
4416
  function initFrame(params) {
4387
4417
  return {
4388
4418
  bounds: new Bounds(bboxToRadians(params.bbox)),
4389
- crs: mproj.pj_init(params.proj)
4419
+ crs: mproj$1.pj_init(params.proj)
4390
4420
  };
4391
4421
  }
4392
4422
 
@@ -4398,7 +4428,7 @@
4398
4428
  }
4399
4429
 
4400
4430
  function projectFrameOrigin(origin, P) {
4401
- var xy = mproj.pj_fwd_deg({lam: origin[0], phi: origin[1]}, P);
4431
+ var xy = mproj$1.pj_fwd_deg({lam: origin[0], phi: origin[1]}, P);
4402
4432
  return [xy.x, xy.y];
4403
4433
  }
4404
4434
 
@@ -4407,7 +4437,7 @@
4407
4437
  for (var i=0, n=frames.length; i<n; i++) {
4408
4438
  frame = frames[i];
4409
4439
  if (frame.bounds.containsPoint(lp.lam, lp.phi)) {
4410
- xy2 = mproj.pj_fwd(lp, frame.crs);
4440
+ xy2 = mproj$1.pj_fwd(lp, frame.crs);
4411
4441
  if (frame.matrix) {
4412
4442
  frame.matrix.transformXY(xy2.x, xy2.y, xy2);
4413
4443
  }
@@ -4610,13 +4640,15 @@
4610
4640
  getAntimeridian: getAntimeridian
4611
4641
  });
4612
4642
 
4643
+ var mproj = require$1('mproj');
4644
+
4613
4645
  var asyncLoader = null;
4614
4646
 
4615
4647
  var projectionAliases = {
4616
4648
  robinson: '+proj=robin +datum=WGS84',
4617
4649
  webmercator: '+proj=merc +a=6378137 +b=6378137',
4618
4650
  wgs84: '+proj=longlat +datum=WGS84',
4619
- albersusa: new AlbersUSA() // with default parameters
4651
+ albersusa: AlbersUSA
4620
4652
  };
4621
4653
 
4622
4654
  // This stub is replaced when loaded in GUI, which may need to load some files
@@ -4640,7 +4672,6 @@
4640
4672
  // if the transformation fails
4641
4673
  // src, dest: proj4 objects
4642
4674
  function getProjTransform(src, dest) {
4643
- var mproj = require('mproj');
4644
4675
  var clampSrc = isLatLngCRS(src);
4645
4676
  dest = dest.__mixed_crs || dest;
4646
4677
  return function(x, y) {
@@ -4659,8 +4690,7 @@
4659
4690
  // Same as getProjTransform(), but return null if projection fails
4660
4691
  // (also faster)
4661
4692
  function getProjTransform2(src, dest) {
4662
- var mproj = require('mproj'),
4663
- xx = [0],
4693
+ var xx = [0],
4664
4694
  yy = [0],
4665
4695
  preK = src.is_latlong ? mproj.internal.DEG_TO_RAD : 1,
4666
4696
  postK = dest.is_latlong ? mproj.internal.RAD_TO_DEG : 1,
@@ -4707,13 +4737,13 @@
4707
4737
  }
4708
4738
 
4709
4739
  function crsToProj4(P) {
4710
- return require('mproj').internal.get_proj_defn(P);
4740
+ return mproj.internal.get_proj_defn(P);
4711
4741
  }
4712
4742
 
4713
4743
  function crsToPrj(P) {
4714
4744
  var wkt;
4715
4745
  try {
4716
- wkt = require('mproj').internal.wkt_from_proj4(P);
4746
+ wkt = mproj.internal.wkt_from_proj4(P);
4717
4747
  } catch(e) {
4718
4748
  // console.log(e)
4719
4749
  }
@@ -4725,8 +4755,11 @@
4725
4755
  return !!str && str == crsToProj4(b);
4726
4756
  }
4727
4757
 
4758
+ function isProjAlias(str) {
4759
+ return str in projectionAliases;
4760
+ }
4761
+
4728
4762
  function getProjDefn(str) {
4729
- var mproj = require('mproj');
4730
4763
  var defn;
4731
4764
  // prepend '+proj=' to bare proj names
4732
4765
  str = str.replace(/(^| )([\w]+)($| )/, function(a, b, c, d) {
@@ -4737,8 +4770,11 @@
4737
4770
  });
4738
4771
  if (looksLikeProj4String(str)) {
4739
4772
  defn = str;
4740
- } else if (str in projectionAliases) {
4741
- defn = projectionAliases[str]; // defn is a function
4773
+ } else if (isProjAlias(str)) {
4774
+ defn = projectionAliases[str];
4775
+ if (utils.isFunction(defn)) {
4776
+ defn = defn();
4777
+ }
4742
4778
  } else if (looksLikeInitString(str)) {
4743
4779
  defn = '+init=' + str.toLowerCase();
4744
4780
  } else if (str in (getStashedVar('defs') || {})) {
@@ -4768,7 +4804,7 @@
4768
4804
  P = defn;
4769
4805
  } else {
4770
4806
  try {
4771
- P = require('mproj').pj_init(defn);
4807
+ P = mproj.pj_init(defn);
4772
4808
  } catch(e) {
4773
4809
  stop('Unable to use projection', defn, '(' + e.message + ')');
4774
4810
  }
@@ -4822,10 +4858,9 @@
4822
4858
  // x, y: a point location in projected coordinates
4823
4859
  // Returns k, the ratio of coordinate distance to distance on the ground
4824
4860
  function getScaleFactorAtXY(x, y, crs) {
4825
- var proj = require('mproj');
4826
4861
  var dist = 1;
4827
- var lp = proj.pj_inv_deg({x: x, y: y}, crs);
4828
- var lp2 = proj.pj_inv_deg({x: x + dist, y: y}, crs);
4862
+ var lp = mproj.pj_inv_deg({x: x, y: y}, crs);
4863
+ var lp2 = mproj.pj_inv_deg({x: x + dist, y: y}, crs);
4829
4864
  var k = dist / geom.greatCircleDistance(lp.lam, lp.phi, lp2.lam, lp2.phi);
4830
4865
  return k;
4831
4866
  }
@@ -4863,7 +4898,7 @@
4863
4898
  }
4864
4899
 
4865
4900
  function printProjections() {
4866
- var index = require('mproj').internal.pj_list;
4901
+ var index = mproj.internal.pj_list;
4867
4902
  var msg = 'Proj4 projections\n';
4868
4903
  Object.keys(index).sort().forEach(function(id) {
4869
4904
  msg += ' ' + utils.rpad(id, 7, ' ') + ' ' + index[id].name + '\n';
@@ -4878,7 +4913,7 @@
4878
4913
  function translatePrj(str) {
4879
4914
  var proj4;
4880
4915
  try {
4881
- proj4 = require('mproj').internal.wkt_to_proj4(str);
4916
+ proj4 = mproj.internal.wkt_to_proj4(str);
4882
4917
  } catch(e) {
4883
4918
  stop('Unusable .prj file (' + e.message + ')');
4884
4919
  }
@@ -4902,6 +4937,7 @@
4902
4937
  crsToProj4: crsToProj4,
4903
4938
  crsToPrj: crsToPrj,
4904
4939
  crsAreEqual: crsAreEqual,
4940
+ isProjAlias: isProjAlias,
4905
4941
  getProjDefn: getProjDefn,
4906
4942
  looksLikeProj4String: looksLikeProj4String,
4907
4943
  getCRS: getCRS,
@@ -6450,12 +6486,12 @@
6450
6486
  // Accessor function for arcs
6451
6487
  Object.defineProperty(this, 'arcs', {value: arcs});
6452
6488
 
6453
- var toArray = this.toArray = function() {
6489
+ this.toArray = function() {
6454
6490
  var chains = getNodeChains(),
6455
6491
  flags = new Uint8Array(chains.length),
6456
6492
  arr = [];
6457
6493
  utils.forEach(chains, function(nextIdx, thisIdx) {
6458
- var node, x, y, p;
6494
+ var node, p;
6459
6495
  if (flags[thisIdx] == 1) return;
6460
6496
  p = getEndpoint(thisIdx);
6461
6497
  if (!p) return; // endpoints of an excluded arc
@@ -7034,7 +7070,7 @@
7034
7070
  return typeof window !== 'undefined' && typeof window.document !== 'undefined';
7035
7071
  }
7036
7072
 
7037
- var State = /*#__PURE__*/Object.freeze({
7073
+ var Env = /*#__PURE__*/Object.freeze({
7038
7074
  __proto__: null,
7039
7075
  runningInBrowser: runningInBrowser
7040
7076
  });
@@ -7145,13 +7181,13 @@
7145
7181
  content = cache[fname];
7146
7182
  delete cache[fname];
7147
7183
  } else if (fname == '/dev/stdin') {
7148
- content = require('rw').readFileSync(fname);
7184
+ content = require$1('rw').readFileSync(fname);
7149
7185
  } else {
7150
7186
  // kludge to prevent overwriting of input files
7151
7187
  (getStashedVar('input_files') || []).push(fname);
7152
- content = require('fs').readFileSync(fname);
7188
+ content = require$1('fs').readFileSync(fname);
7153
7189
  }
7154
- if (encoding && Buffer.isBuffer(content)) {
7190
+ if (encoding && B$3.isBuffer(content)) {
7155
7191
  content = trimBOM(decodeString(content, encoding));
7156
7192
  }
7157
7193
  return content;
@@ -7161,7 +7197,7 @@
7161
7197
  var odir = parseLocalPath(fname).directory;
7162
7198
  if (!odir || cli.isDirectory(odir) || fname == '/dev/stdout') return;
7163
7199
  try {
7164
- require('fs').mkdirSync(odir, {recursive: true});
7200
+ require$1('fs').mkdirSync(odir, {recursive: true});
7165
7201
  message('Created output directory:', odir);
7166
7202
  } catch(e) {
7167
7203
  stop('Unable to create output directory:', odir);
@@ -7170,7 +7206,7 @@
7170
7206
 
7171
7207
  // content: Buffer or string
7172
7208
  cli.writeFile = function(fname, content, cb) {
7173
- var fs = require('rw');
7209
+ var fs = require$1('rw');
7174
7210
  cli.createDirIfNeeded(fname);
7175
7211
  if (cb) {
7176
7212
  fs.writeFile(fname, content, cb);
@@ -7198,8 +7234,8 @@
7198
7234
  files = [];
7199
7235
 
7200
7236
  try {
7201
- require('fs').readdirSync(dir).forEach(function(item) {
7202
- var path = require('path').join(dir, item);
7237
+ require$1('fs').readdirSync(dir).forEach(function(item) {
7238
+ var path = require$1('path').join(dir, item);
7203
7239
  if (rxp.test(item) && cli.isFile(path)) {
7204
7240
  files.push(path);
7205
7241
  }
@@ -7241,7 +7277,7 @@
7241
7277
  cli.statSync = function(fpath) {
7242
7278
  var obj = null;
7243
7279
  try {
7244
- obj = require('fs').statSync(fpath);
7280
+ obj = require$1('fs').statSync(fpath);
7245
7281
  } catch(e) {}
7246
7282
  return obj;
7247
7283
  };
@@ -7293,7 +7329,7 @@
7293
7329
  var odir = opts.directory;
7294
7330
  if (odir) {
7295
7331
  files = files.map(function(file) {
7296
- return require('path').join(odir, file);
7332
+ return require$1('path').join(odir, file);
7297
7333
  });
7298
7334
  }
7299
7335
  return files;
@@ -7315,7 +7351,7 @@
7315
7351
  // Unlike rbush, flatbush doesn't allow size 0 indexes; workaround
7316
7352
  return function() {return [];};
7317
7353
  }
7318
- Flatbush = require('flatbush');
7354
+ Flatbush = require$1('flatbush');
7319
7355
  index = new Flatbush(boxes.length);
7320
7356
  boxes.forEach(function(ring) {
7321
7357
  var b = ring.bounds;
@@ -8791,10 +8827,10 @@
8791
8827
 
8792
8828
  // Returns undefined if not found
8793
8829
  function lookupColorName(str) {
8794
- return colors[str.toLowerCase().replace(/[ -]+/g, '')];
8830
+ return colors$1[str.toLowerCase().replace(/[ -]+/g, '')];
8795
8831
  }
8796
8832
 
8797
- var colors = {
8833
+ var colors$1 = {
8798
8834
  aliceblue: '#f0f8ff',
8799
8835
  antiquewhite: '#faebd7',
8800
8836
  aqua: '#00ffff',
@@ -10314,6 +10350,7 @@
10314
10350
  sums: capture,
10315
10351
  average: captureNum,
10316
10352
  median: captureNum,
10353
+ quantile: captureNum,
10317
10354
  min: captureNum,
10318
10355
  max: captureNum,
10319
10356
  mode: capture,
@@ -10328,6 +10365,7 @@
10328
10365
  sum: wrap(utils.sum, 0),
10329
10366
  sums: wrap(sums),
10330
10367
  median: wrap(utils.findMedian),
10368
+ quantile: wrap2(utils.findQuantile),
10331
10369
  min: wrap(min),
10332
10370
  max: wrap(max),
10333
10371
  average: wrap(utils.mean),
@@ -10400,6 +10438,13 @@
10400
10438
  };
10401
10439
  }
10402
10440
 
10441
+ function wrap2(proc) {
10442
+ return function(arg1, arg2) {
10443
+ var c = colNo++;
10444
+ return rowNo > 0 ? proc(cols[c], arg2) : null;
10445
+ };
10446
+ }
10447
+
10403
10448
  function procAll() {
10404
10449
  for (var i=0; i<len; i++) {
10405
10450
  procRecord(i);
@@ -12030,10 +12075,6 @@
12030
12075
  // if point x,y falls on an endpoint
12031
12076
  // Assumes: i <= j
12032
12077
  function getCutPoint(x, y, i, j, xx, yy) {
12033
- var ix = xx[i],
12034
- iy = yy[i],
12035
- jx = xx[j],
12036
- jy = yy[j];
12037
12078
  if (j < i || j > i + 1) {
12038
12079
  error("Out-of-sequence arc ids:", i, j);
12039
12080
  }
@@ -13376,7 +13417,7 @@
13376
13417
  memo.push(buf);
13377
13418
  return memo;
13378
13419
  }, []);
13379
- return Buffer.concat(parts);
13420
+ return B$3.concat(parts);
13380
13421
  };
13381
13422
 
13382
13423
  // collection: an array of individual GeoJSON Features or geometries as strings or buffers
@@ -13398,7 +13439,7 @@
13398
13439
  return memo;
13399
13440
  }, [utils.createBuffer(head, 'utf8')]);
13400
13441
  parts.push(utils.createBuffer(tail, 'utf8'));
13401
- return Buffer.concat(parts);
13442
+ return B$3.concat(parts);
13402
13443
  };
13403
13444
 
13404
13445
  // export GeoJSON or TopoJSON point geometry
@@ -14019,18 +14060,18 @@
14019
14060
  // accept variations on type names (dot, dots, square, squares, hatch, hatches, hatched)
14020
14061
  if (first.startsWith('dot')) {
14021
14062
  parts[0] = 'dots';
14022
- obj = parseDots(parts, str);
14063
+ obj = parseDots(parts);
14023
14064
  } else if (first.startsWith('square')) {
14024
14065
  parts[0] = 'squares';
14025
- obj = parseDots(parts, str);
14066
+ obj = parseDots(parts);
14026
14067
  } else if (first.startsWith('hatch')) {
14027
14068
  parts[0] = 'hatches';
14028
- obj = parseHatches(parts, str);
14069
+ obj = parseHatches(parts);
14029
14070
  } else if (first.startsWith('dash')) {
14030
- obj = parseDashes(parts, str);
14071
+ obj = parseDashes(parts);
14031
14072
  } else if (!isNaN(parseFloat(first))) {
14032
14073
  parts.unshift('hatches');
14033
- obj = parseHatches(parts, str); // hatches is the default, name can be omitted
14074
+ obj = parseHatches(parts); // hatches is the default, name can be omitted
14034
14075
  }
14035
14076
  if (!obj) {
14036
14077
  // consider
@@ -14039,7 +14080,7 @@
14039
14080
  return obj;
14040
14081
  }
14041
14082
 
14042
- function parseDashes(parts, str) {
14083
+ function parseDashes(parts) {
14043
14084
  // format:
14044
14085
  // "dashes" dash-len dash-space width color1 [color2...] space bg-color
14045
14086
  // examples:
@@ -14080,7 +14121,7 @@
14080
14121
  };
14081
14122
  }
14082
14123
 
14083
- function parseHatches(parts, str) {
14124
+ function parseHatches(parts) {
14084
14125
  // format:
14085
14126
  // [hatches] [rotation] width1 color1 [width2 color2 ...]
14086
14127
  // examples:
@@ -14107,7 +14148,7 @@
14107
14148
  return parseInt(str) > 0;
14108
14149
  }
14109
14150
 
14110
- function parseDots(parts, str) {
14151
+ function parseDots(parts) {
14111
14152
  // format:
14112
14153
  // "dots"|"squares" [rotation] size color1 [color2 ...] spacing bg-color
14113
14154
  // examples:
@@ -14271,6 +14312,7 @@
14271
14312
  'stroke-opacity': 'number',
14272
14313
  'stroke-miterlimit': 'number',
14273
14314
  'fill-opacity': 'number',
14315
+ 'vector-effect': null,
14274
14316
  'text-anchor': null
14275
14317
  };
14276
14318
 
@@ -14300,7 +14342,7 @@
14300
14342
  effect: null // e.g. "fade"
14301
14343
  }, stylePropertyTypes);
14302
14344
 
14303
- var commonProperties = 'css,class,opacity,stroke,stroke-width,stroke-dasharray,stroke-opacity,fill-opacity'.split(',');
14345
+ var commonProperties = 'css,class,opacity,stroke,stroke-width,stroke-dasharray,stroke-opacity,fill-opacity,vector-effect'.split(',');
14304
14346
 
14305
14347
  var propertiesBySymbolType = {
14306
14348
  polygon: utils.arrayToIndex(commonProperties.concat('fill', 'fill-pattern')),
@@ -14380,7 +14422,7 @@
14380
14422
  function mightBeExpression(str, fields) {
14381
14423
  fields = fields || [];
14382
14424
  if (fields.indexOf(str.trim()) > -1) return true;
14383
- return /[(){}./*?:&|=\[+-]/.test(str);
14425
+ return /[(){}./*?:&|=[+-]/.test(str);
14384
14426
  }
14385
14427
 
14386
14428
  function getSymbolPropertyAccessor(val, svgName, lyr) {
@@ -14507,7 +14549,7 @@
14507
14549
 
14508
14550
  function importGeoJSONFeatures(features, opts) {
14509
14551
  opts = opts || {};
14510
- return features.map(function(obj, i) {
14552
+ return features.map(function(obj) {
14511
14553
  var geom = obj.type == 'Feature' ? obj.geometry : obj; // could be null
14512
14554
  var geomType = geom && geom.type;
14513
14555
  var msType = GeoJSON.translateGeoJSONType(geomType);
@@ -14823,7 +14865,7 @@
14823
14865
  }
14824
14866
 
14825
14867
  // polyline coords are like GeoJSON MultiLineString coords: an array of 0 or more paths
14826
- function polyline(d, x, y) {
14868
+ function polyline(d) {
14827
14869
  var coords = d.coordinates || [];
14828
14870
  var o = importMultiLineString(coords);
14829
14871
  applyStyleAttributes(o, 'polyline', d);
@@ -14831,7 +14873,7 @@
14831
14873
  }
14832
14874
 
14833
14875
  // polygon coords are an array of rings (and holes), like flattened MultiPolygon coords
14834
- function polygon(d, x, y) {
14876
+ function polygon(d) {
14835
14877
  var coords = d.coordinates || [];
14836
14878
  var o = importPolygon(coords);
14837
14879
  applyStyleAttributes(o, 'polygon', d);
@@ -15175,7 +15217,7 @@
15175
15217
  var cache = {};
15176
15218
  function fetchFileSync(url) {
15177
15219
  if (url in cache) return cache[url];
15178
- var res = require('sync-request')('GET', url, {timeout: 2000});
15220
+ var res = require$1('sync-request')('GET', url, {timeout: 2000});
15179
15221
  var content = res.getBody().toString();
15180
15222
  cache[url] = content;
15181
15223
  return content;
@@ -15246,8 +15288,8 @@
15246
15288
  var content;
15247
15289
  if (href.indexOf('http') === 0) {
15248
15290
  content = fetchFileSync(href);
15249
- } else if (require('fs').existsSync(href)) {
15250
- content = require('fs').readFileSync(href, 'utf8');
15291
+ } else if (require$1('fs').existsSync(href)) {
15292
+ content = require$1('fs').readFileSync(href, 'utf8');
15251
15293
  } else {
15252
15294
  stop("Invalid SVG location:", href);
15253
15295
  }
@@ -15378,7 +15420,6 @@ ${svg}
15378
15420
  var geojson = exportDatasetAsGeoJSON(d, opts);
15379
15421
  var features = geojson.features || geojson.geometries || (geojson.type ? [geojson] : []);
15380
15422
  var children = importGeoJSONFeatures(features, opts);
15381
- var data;
15382
15423
  if (opts.svg_data && lyr.data) {
15383
15424
  addDataAttributesToSVG(children, lyr.data, opts.svg_data);
15384
15425
  }
@@ -15558,12 +15599,13 @@ ${svg}
15558
15599
  function BinArray(buf, le) {
15559
15600
  if (utils.isNumber(buf)) {
15560
15601
  buf = new ArrayBuffer(buf);
15561
- } else if (typeof Buffer == 'function' && buf instanceof Buffer) {
15602
+ } else if (buf instanceof ArrayBuffer) {
15603
+ // we're good
15604
+ } else if (typeof B$3 == 'function' && buf instanceof B$3) {
15562
15605
  // Since node 0.10, DataView constructor doesn't accept Buffers,
15563
15606
  // so need to copy Buffer to ArrayBuffer
15564
15607
  buf = BinArray.toArrayBuffer(buf);
15565
- }
15566
- if (buf instanceof ArrayBuffer == false) {
15608
+ } else {
15567
15609
  error("BinArray constructor takes an integer, ArrayBuffer or Buffer argument");
15568
15610
  }
15569
15611
  this._buffer = buf;
@@ -16306,7 +16348,7 @@ ${svg}
16306
16348
  return readFixedWidthRecordsFromString(str, opts);
16307
16349
  }
16308
16350
 
16309
- function readFixedWidthRecordsFromString(str, ops) {
16351
+ function readFixedWidthRecordsFromString(str) {
16310
16352
  var fields = parseFixedWidthInfo(str.substring(0, 2000));
16311
16353
  if (!fields) return [];
16312
16354
  var lines = utils.splitLines(str);
@@ -16442,7 +16484,7 @@ ${svg}
16442
16484
  buffers.push(encodeString(str, encoding));
16443
16485
  }
16444
16486
  }
16445
- return Buffer.concat(buffers);
16487
+ return B$3.concat(buffers);
16446
16488
  }
16447
16489
 
16448
16490
  function formatHeader(fields, formatRow) {
@@ -16453,11 +16495,6 @@ ${svg}
16453
16495
  return formatRow(rec);
16454
16496
  }
16455
16497
 
16456
- function formatDelimHeader(fields, delim) {
16457
- var formatValue = getDelimValueFormatter(delim);
16458
- return fields.map(formatValue).join(delim);
16459
- }
16460
-
16461
16498
  function getDelimRowFormatter(fields, delim, opts) {
16462
16499
  var formatValue = getDelimValueFormatter(delim, opts);
16463
16500
  return function(rec) {
@@ -17659,7 +17696,7 @@ ${svg}
17659
17696
  }
17660
17697
 
17661
17698
  function FileReader(path, opts) {
17662
- var fs = require('fs'),
17699
+ var fs = require$1('fs'),
17663
17700
  fileLen = fs.statSync(path).size,
17664
17701
  DEFAULT_CACHE_LEN = opts && opts.cacheSize || 0x1000000, // 16MB
17665
17702
  DEFAULT_BUFFER_LEN = opts && opts.bufferSize || 0x40000, // 256K
@@ -18140,8 +18177,7 @@ ${svg}
18140
18177
  // @chars String of chars to look for in @str
18141
18178
  function getCharScore(str, chars) {
18142
18179
  var index = {},
18143
- count = 0,
18144
- score;
18180
+ count = 0;
18145
18181
  str = str.toLowerCase();
18146
18182
  for (var i=0, n=chars.length; i<n; i++) {
18147
18183
  index[chars[i]] = 1;
@@ -18162,7 +18198,7 @@ ${svg}
18162
18198
  // TODO: remove duplication with importJSON()
18163
18199
  var readFromFile = !data.content && data.content !== '',
18164
18200
  content = data.content,
18165
- filter, reader, records, delimiter, table, encoding;
18201
+ reader, records, delimiter, table, encoding;
18166
18202
  opts = opts || {};
18167
18203
 
18168
18204
  // // read content of all but very large files into a buffer
@@ -18173,7 +18209,7 @@ ${svg}
18173
18209
 
18174
18210
  if (readFromFile) {
18175
18211
  reader = new FileReader(data.filename);
18176
- } else if (content instanceof ArrayBuffer || content instanceof Buffer) {
18212
+ } else if (content instanceof ArrayBuffer || content instanceof B$3) {
18177
18213
  // Web API may import as ArrayBuffer, to support larger files
18178
18214
  reader = new BufferReader(content);
18179
18215
  content = null;
@@ -18404,43 +18440,19 @@ ${svg}
18404
18440
  }
18405
18441
  }
18406
18442
 
18407
- // var intervalStr = o.interval;
18408
- // if (intervalStr) {
18409
- // o.interval = Number(intervalStr);
18410
- // if (o.interval >= 0 === false) {
18411
- // error(utils.format("Out-of-range interval value: %s", intervalStr));
18412
- // }
18413
- // }
18414
-
18415
18443
  if (!o.interval && !o.percentage && !o.resolution) {
18416
18444
  error("Command requires an interval, percentage or resolution parameter");
18417
18445
  }
18418
18446
  }
18419
18447
 
18420
18448
  function validateProjOpts(cmd) {
18421
- var _ = cmd._,
18422
- proj4 = [];
18449
+ var _ = cmd._;
18423
18450
 
18424
18451
  if (_.length > 0 && !cmd.options.crs) {
18425
18452
  cmd.options.crs = _.join(' ');
18426
18453
  _ = [];
18427
18454
  }
18428
18455
 
18429
- // separate proj4 options
18430
- // _ = _.filter(function(arg) {
18431
- // if (/^\+[a-z]/i.test(arg)) {
18432
- // proj4.push(arg);
18433
- // return false;
18434
- // }
18435
- // return true;
18436
- // });
18437
-
18438
- // if (proj4.length > 0) {
18439
- // cmd.options.crs = proj4.join(' ');
18440
- // } else if (_.length > 0) {
18441
- // cmd.options.crs = _.shift();
18442
- // }
18443
-
18444
18456
  if (_.length > 0) {
18445
18457
  error("Received one or more unexpected parameters: " + _.join(', '));
18446
18458
  }
@@ -18535,7 +18547,7 @@ ${svg}
18535
18547
  }
18536
18548
  }
18537
18549
 
18538
- var assignmentRxp = /^([a-z0-9_+-]+)=(?!\=)(.*)$/i; // exclude ==
18550
+ var assignmentRxp = /^([a-z0-9_+-]+)=(?!=)(.*)$/i; // exclude ==
18539
18551
 
18540
18552
  function splitShellTokens(str) {
18541
18553
  var BAREWORD = '([^\'"\\s])+';
@@ -20923,6 +20935,10 @@ ${svg}
20923
20935
  // describe: (0-1) inset grid shapes by a percentage
20924
20936
  type: 'number'
20925
20937
  })
20938
+ .option('aligned', {
20939
+ // describe: all grids of a given cell size will be aligned
20940
+ type: 'flag'
20941
+ })
20926
20942
  .option('calc', calcOpt)
20927
20943
  .option('name', nameOpt)
20928
20944
  .option('target', targetOpt)
@@ -21069,6 +21085,9 @@ ${svg}
21069
21085
  })
21070
21086
  .option('target', targetOpt);
21071
21087
 
21088
+ parser.command('stop')
21089
+ .describe('stop processing (skip remaining commands)');
21090
+
21072
21091
  parser.section('Informational commands');
21073
21092
 
21074
21093
  parser.command('calc')
@@ -22730,7 +22749,6 @@ ${svg}
22730
22749
  shapes = [], // topological ids
22731
22750
  types = [],
22732
22751
  dataNulls = 0,
22733
- shapeNulls = 0,
22734
22752
  collectionType = null,
22735
22753
  shapeId;
22736
22754
 
@@ -22747,15 +22765,12 @@ ${svg}
22747
22765
  if (geom.type) {
22748
22766
  this.addShape(geom);
22749
22767
  }
22750
- if (shapes[shapeId] === null) {
22751
- shapeNulls++;
22752
- }
22753
22768
  };
22754
22769
 
22755
22770
  this.addShape = function(geom) {
22756
22771
  var curr = shapes[shapeId];
22757
22772
  var type = GeoJSON.translateGeoJSONType(geom.type);
22758
- var shape, importer;
22773
+ var shape;
22759
22774
  if (geom.type == "GeometryCollection") {
22760
22775
  geom.geometries.forEach(this.addShape, this);
22761
22776
  } else if (type) {
@@ -23515,8 +23530,8 @@ ${svg}
23515
23530
  });
23516
23531
 
23517
23532
  function importKML(str, opts) {
23518
- var togeojson = require("@tmcw/togeojson");
23519
- var Parser = typeof DOMParser == 'undefined' ? require("@xmldom/xmldom").DOMParser : DOMParser;
23533
+ var togeojson = require$1("@tmcw/togeojson");
23534
+ var Parser = typeof DOMParser == 'undefined' ? require$1("@xmldom/xmldom").DOMParser : DOMParser;
23520
23535
  var geojson = togeojson.kml(new Parser().parseFromString(str, "text/xml"));
23521
23536
  return importGeoJSON(geojson, opts || {});
23522
23537
  }
@@ -24035,12 +24050,12 @@ ${svg}
24035
24050
  function Job(catalog) {
24036
24051
  var currentCmd;
24037
24052
 
24038
- var job = {
24053
+ var job = {
24039
24054
  catalog: catalog || new Catalog(),
24040
24055
  defs: {},
24041
24056
  settings: {},
24042
24057
  input_files: []
24043
- };
24058
+ };
24044
24059
 
24045
24060
  job.initSettings = function(o) {
24046
24061
  job.settings = o;
@@ -24219,10 +24234,10 @@ ${svg}
24219
24234
  const ccwerrboundB = (2 + 12 * epsilon) * epsilon;
24220
24235
  const ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;
24221
24236
 
24222
- const B$1 = vec(4);
24237
+ const B$2 = vec(4);
24223
24238
  const C1 = vec(8);
24224
24239
  const C2 = vec(12);
24225
- const D = vec(16);
24240
+ const D$1 = vec(16);
24226
24241
  const u$2 = vec(4);
24227
24242
 
24228
24243
  function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
@@ -24252,19 +24267,19 @@ ${svg}
24252
24267
  t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
24253
24268
  _i = s0 - t0;
24254
24269
  bvirt = s0 - _i;
24255
- B$1[0] = s0 - (_i + bvirt) + (bvirt - t0);
24270
+ B$2[0] = s0 - (_i + bvirt) + (bvirt - t0);
24256
24271
  _j = s1 + _i;
24257
24272
  bvirt = _j - s1;
24258
24273
  _0 = s1 - (_j - bvirt) + (_i - bvirt);
24259
24274
  _i = _0 - t1;
24260
24275
  bvirt = _0 - _i;
24261
- B$1[1] = _0 - (_i + bvirt) + (bvirt - t1);
24276
+ B$2[1] = _0 - (_i + bvirt) + (bvirt - t1);
24262
24277
  u3 = _j + _i;
24263
24278
  bvirt = u3 - _j;
24264
- B$1[2] = _j - (u3 - bvirt) + (_i - bvirt);
24265
- B$1[3] = u3;
24279
+ B$2[2] = _j - (u3 - bvirt) + (_i - bvirt);
24280
+ B$2[3] = u3;
24266
24281
 
24267
- let det = estimate(4, B$1);
24282
+ let det = estimate(4, B$2);
24268
24283
  let errbound = ccwerrboundB * detsum;
24269
24284
  if (det >= errbound || -det >= errbound) {
24270
24285
  return det;
@@ -24316,7 +24331,7 @@ ${svg}
24316
24331
  bvirt = u3 - _j;
24317
24332
  u$2[2] = _j - (u3 - bvirt) + (_i - bvirt);
24318
24333
  u$2[3] = u3;
24319
- const C1len = sum(4, B$1, 4, u$2, C1);
24334
+ const C1len = sum(4, B$2, 4, u$2, C1);
24320
24335
 
24321
24336
  s1 = acx * bcytail;
24322
24337
  c = splitter * acx;
@@ -24378,9 +24393,9 @@ ${svg}
24378
24393
  bvirt = u3 - _j;
24379
24394
  u$2[2] = _j - (u3 - bvirt) + (_i - bvirt);
24380
24395
  u$2[3] = u3;
24381
- const Dlen = sum(C2len, C2, 4, u$2, D);
24396
+ const Dlen = sum(C2len, C2, 4, u$2, D$1);
24382
24397
 
24383
- return D[Dlen - 1];
24398
+ return D$1[Dlen - 1];
24384
24399
  }
24385
24400
 
24386
24401
  function orient2d(ax, ay, bx, by, cx, cy) {
@@ -27095,10 +27110,6 @@ ${svg}
27095
27110
  // polyline output could be used for debugging
27096
27111
  var outputGeom = opts.output_geometry == 'polyline' ? 'polyline' : 'polygon';
27097
27112
 
27098
- function polygonCoords(ring) {
27099
- return [ring];
27100
- }
27101
-
27102
27113
  function pathBufferCoords(pathArcs, dist) {
27103
27114
  var pathCoords = maker(pathArcs, dist);
27104
27115
  var revPathArcs;
@@ -27128,13 +27139,9 @@ ${svg}
27128
27139
  var backtrackSteps = opts.backtrack >= 0 ? opts.backtrack : 50;
27129
27140
  var pathIter = new ShapeIter(arcs);
27130
27141
  var capStyle = opts.cap_style || 'round'; // expect 'round' or 'flat'
27131
- var tolerance;
27142
+ // var tolerance;
27132
27143
  // TODO: implement other join styles than round
27133
27144
 
27134
- function updateTolerance(dist) {
27135
-
27136
- }
27137
-
27138
27145
  function addRoundJoin(arr, x, y, startDir, angle, dist) {
27139
27146
  var increment = 10;
27140
27147
  var endDir = startDir + angle;
@@ -27145,15 +27152,15 @@ ${svg}
27145
27152
  }
27146
27153
  }
27147
27154
 
27148
- function addRoundJoin2(arr, x, y, startDir, angle, dist) {
27149
- var increment = 10;
27150
- var endDir = startDir + angle;
27151
- var dir = startDir + increment;
27152
- while (dir < endDir) {
27153
- addBufferVertex(arr, geod(x, y, dir, dist), backtrackSteps);
27154
- dir += increment;
27155
- }
27156
- }
27155
+ // function addRoundJoin2(arr, x, y, startDir, angle, dist) {
27156
+ // var increment = 10;
27157
+ // var endDir = startDir + angle;
27158
+ // var dir = startDir + increment;
27159
+ // while (dir < endDir) {
27160
+ // addBufferVertex(arr, geod(x, y, dir, dist), backtrackSteps);
27161
+ // dir += increment;
27162
+ // }
27163
+ // }
27157
27164
 
27158
27165
  // Test if two points are within a snapping tolerance
27159
27166
  // TODO: calculate the tolerance more sensibly
@@ -27400,15 +27407,14 @@ ${svg}
27400
27407
  function getPathBufferMaker2(arcs, geod, getBearing, opts) {
27401
27408
  var backtrackSteps = opts.backtrack >= 0 ? opts.backtrack : 50;
27402
27409
  var pathIter = new ShapeIter(arcs);
27403
- var capStyle = opts.cap_style || 'round'; // expect 'round' or 'flat'
27404
- var tolerance;
27410
+ // var capStyle = opts.cap_style || 'round'; // expect 'round' or 'flat'
27405
27411
  var partials, left, center;
27406
27412
  var bounds;
27407
27413
  // TODO: implement other join styles than round
27408
27414
 
27409
- function updateTolerance(dist) {
27415
+ // function updateTolerance(dist) {
27410
27416
 
27411
- }
27417
+ // }
27412
27418
 
27413
27419
  function addRoundJoin(x, y, startDir, angle, dist) {
27414
27420
  var increment = 10;
@@ -27452,24 +27458,24 @@ ${svg}
27452
27458
  }
27453
27459
  }
27454
27460
 
27455
- function makeCap(x, y, direction, dist) {
27456
- if (capStyle == 'flat') {
27457
- return [[x, y]];
27458
- }
27459
- return makeRoundCap(x, y, direction, dist);
27460
- }
27461
+ // function makeCap(x, y, direction, dist) {
27462
+ // if (capStyle == 'flat') {
27463
+ // return [[x, y]];
27464
+ // }
27465
+ // return makeRoundCap(x, y, direction, dist);
27466
+ // }
27461
27467
 
27462
- function makeRoundCap(x, y, segmentDir, dist) {
27463
- var points = [];
27464
- var increment = 10;
27465
- var startDir = segmentDir - 90;
27466
- var angle = increment;
27467
- while (angle < 180) {
27468
- points.push(geod(x, y, startDir + angle, dist));
27469
- angle += increment;
27470
- }
27471
- return points;
27472
- }
27468
+ // function makeRoundCap(x, y, segmentDir, dist) {
27469
+ // var points = [];
27470
+ // var increment = 10;
27471
+ // var startDir = segmentDir - 90;
27472
+ // var angle = increment;
27473
+ // while (angle < 180) {
27474
+ // points.push(geod(x, y, startDir + angle, dist));
27475
+ // angle += increment;
27476
+ // }
27477
+ // return points;
27478
+ // }
27473
27479
 
27474
27480
  // get angle between two extruded segments in degrees
27475
27481
  // positive angle means join in convex (range: 0-180 degrees)
@@ -27566,18 +27572,20 @@ ${svg}
27566
27572
  }
27567
27573
 
27568
27574
  return function(path, dist) {
27569
- var x0, y0, x1, y1, x2, y2;
27575
+ // var x0, y0;
27576
+ var x1, y1, x2, y2;
27570
27577
  var p1, p2;
27571
- var bearing, prevBearing, firstBearing, joinAngle;
27578
+ // var firstBearing;
27579
+ var bearing, prevBearing, joinAngle;
27572
27580
  partials = [];
27573
27581
  left = [];
27574
27582
  center = [];
27575
27583
  pathIter.init(path);
27576
27584
 
27577
- if (pathIter.hasNext()) {
27578
- x0 = x2 = pathIter.x;
27579
- y0 = y2 = pathIter.y;
27580
- }
27585
+ // if (pathIter.hasNext()) {
27586
+ // x0 = x2 = pathIter.x;
27587
+ // y0 = y2 = pathIter.y;
27588
+ // }
27581
27589
  while (pathIter.hasNext()) {
27582
27590
  // TODO: use a tolerance
27583
27591
  if (pathIter.x === x2 && pathIter.y === y2) continue; // skip duplicate points
@@ -27594,9 +27602,9 @@ ${svg}
27594
27602
 
27595
27603
  if (center.length === 0) {
27596
27604
  // first loop, second point in this partial
27597
- if (partials.length === 0) {
27598
- firstBearing = bearing;
27599
- }
27605
+ // if (partials.length === 0) {
27606
+ // firstBearing = bearing;
27607
+ // }
27600
27608
  left.push(p1, p2);
27601
27609
  center.push([x1, y1], [x2, y2]);
27602
27610
  } else {
@@ -27643,7 +27651,7 @@ ${svg}
27643
27651
  function getGeodesic(P) {
27644
27652
  if (!isLatLngCRS(P)) error('Expected an unprojected CRS');
27645
27653
  var f = P.es / (1 + Math.sqrt(P.one_es));
27646
- var GeographicLib = require('mproj').internal.GeographicLib;
27654
+ var GeographicLib = require$1('mproj').internal.GeographicLib;
27647
27655
  return new GeographicLib.Geodesic.Geodesic(P.a, f);
27648
27656
  }
27649
27657
 
@@ -27772,7 +27780,7 @@ ${svg}
27772
27780
  var e = 1e-10;
27773
27781
  var T = 90 - e;
27774
27782
  var L = -180 + e;
27775
- var B = -90 + e;
27783
+ var B$1 = -90 + e;
27776
27784
  var R = 180 - e;
27777
27785
 
27778
27786
  function lastEl(arr) {
@@ -27800,12 +27808,12 @@ ${svg}
27800
27808
  function snapToEdge(p) {
27801
27809
  if (p[0] <= L) p[0] = -180;
27802
27810
  if (p[0] >= R) p[0] = 180;
27803
- if (p[1] <= B) p[1] = -90;
27811
+ if (p[1] <= B$1) p[1] = -90;
27804
27812
  if (p[1] >= T) p[1] = 90;
27805
27813
  }
27806
27814
 
27807
27815
  function onPole(p) {
27808
- return p[1] >= T || p[1] <= B;
27816
+ return p[1] >= T || p[1] <= B$1;
27809
27817
  }
27810
27818
 
27811
27819
  function isWholeWorld(coords) {
@@ -27831,7 +27839,7 @@ ${svg}
27831
27839
  }
27832
27840
 
27833
27841
  function isEdgePoint(p) {
27834
- return p[1] <= B || p[1] >= T || p[0] <= L || p[0] >= R;
27842
+ return p[1] <= B$1 || p[1] >= T || p[0] <= L || p[0] >= R;
27835
27843
  }
27836
27844
 
27837
27845
  // Remove segments that belong solely to cut points
@@ -28177,7 +28185,7 @@ ${svg}
28177
28185
  rings.push([
28178
28186
  [[180, 90], [180, -90], [0, -90], [-180, -90], [-180, 90], [0, 90], [180, 90]],
28179
28187
  coords
28180
- ]);
28188
+ ]);
28181
28189
  } else {
28182
28190
  rings.push([coords]);
28183
28191
  }
@@ -28372,6 +28380,1120 @@ ${svg}
28372
28380
  return s;
28373
28381
  }
28374
28382
 
28383
+ function define(constructor, factory, prototype) {
28384
+ constructor.prototype = factory.prototype = prototype;
28385
+ prototype.constructor = constructor;
28386
+ }
28387
+
28388
+ function extend(parent, definition) {
28389
+ var prototype = Object.create(parent.prototype);
28390
+ for (var key in definition) prototype[key] = definition[key];
28391
+ return prototype;
28392
+ }
28393
+
28394
+ function Color() {}
28395
+
28396
+ var darker = 0.7;
28397
+ var brighter = 1 / darker;
28398
+
28399
+ var reI = "\\s*([+-]?\\d+)\\s*",
28400
+ reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
28401
+ reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
28402
+ reHex = /^#([0-9a-f]{3,8})$/,
28403
+ reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
28404
+ reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
28405
+ reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
28406
+ reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
28407
+ reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
28408
+ reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
28409
+
28410
+ var named = {
28411
+ aliceblue: 0xf0f8ff,
28412
+ antiquewhite: 0xfaebd7,
28413
+ aqua: 0x00ffff,
28414
+ aquamarine: 0x7fffd4,
28415
+ azure: 0xf0ffff,
28416
+ beige: 0xf5f5dc,
28417
+ bisque: 0xffe4c4,
28418
+ black: 0x000000,
28419
+ blanchedalmond: 0xffebcd,
28420
+ blue: 0x0000ff,
28421
+ blueviolet: 0x8a2be2,
28422
+ brown: 0xa52a2a,
28423
+ burlywood: 0xdeb887,
28424
+ cadetblue: 0x5f9ea0,
28425
+ chartreuse: 0x7fff00,
28426
+ chocolate: 0xd2691e,
28427
+ coral: 0xff7f50,
28428
+ cornflowerblue: 0x6495ed,
28429
+ cornsilk: 0xfff8dc,
28430
+ crimson: 0xdc143c,
28431
+ cyan: 0x00ffff,
28432
+ darkblue: 0x00008b,
28433
+ darkcyan: 0x008b8b,
28434
+ darkgoldenrod: 0xb8860b,
28435
+ darkgray: 0xa9a9a9,
28436
+ darkgreen: 0x006400,
28437
+ darkgrey: 0xa9a9a9,
28438
+ darkkhaki: 0xbdb76b,
28439
+ darkmagenta: 0x8b008b,
28440
+ darkolivegreen: 0x556b2f,
28441
+ darkorange: 0xff8c00,
28442
+ darkorchid: 0x9932cc,
28443
+ darkred: 0x8b0000,
28444
+ darksalmon: 0xe9967a,
28445
+ darkseagreen: 0x8fbc8f,
28446
+ darkslateblue: 0x483d8b,
28447
+ darkslategray: 0x2f4f4f,
28448
+ darkslategrey: 0x2f4f4f,
28449
+ darkturquoise: 0x00ced1,
28450
+ darkviolet: 0x9400d3,
28451
+ deeppink: 0xff1493,
28452
+ deepskyblue: 0x00bfff,
28453
+ dimgray: 0x696969,
28454
+ dimgrey: 0x696969,
28455
+ dodgerblue: 0x1e90ff,
28456
+ firebrick: 0xb22222,
28457
+ floralwhite: 0xfffaf0,
28458
+ forestgreen: 0x228b22,
28459
+ fuchsia: 0xff00ff,
28460
+ gainsboro: 0xdcdcdc,
28461
+ ghostwhite: 0xf8f8ff,
28462
+ gold: 0xffd700,
28463
+ goldenrod: 0xdaa520,
28464
+ gray: 0x808080,
28465
+ green: 0x008000,
28466
+ greenyellow: 0xadff2f,
28467
+ grey: 0x808080,
28468
+ honeydew: 0xf0fff0,
28469
+ hotpink: 0xff69b4,
28470
+ indianred: 0xcd5c5c,
28471
+ indigo: 0x4b0082,
28472
+ ivory: 0xfffff0,
28473
+ khaki: 0xf0e68c,
28474
+ lavender: 0xe6e6fa,
28475
+ lavenderblush: 0xfff0f5,
28476
+ lawngreen: 0x7cfc00,
28477
+ lemonchiffon: 0xfffacd,
28478
+ lightblue: 0xadd8e6,
28479
+ lightcoral: 0xf08080,
28480
+ lightcyan: 0xe0ffff,
28481
+ lightgoldenrodyellow: 0xfafad2,
28482
+ lightgray: 0xd3d3d3,
28483
+ lightgreen: 0x90ee90,
28484
+ lightgrey: 0xd3d3d3,
28485
+ lightpink: 0xffb6c1,
28486
+ lightsalmon: 0xffa07a,
28487
+ lightseagreen: 0x20b2aa,
28488
+ lightskyblue: 0x87cefa,
28489
+ lightslategray: 0x778899,
28490
+ lightslategrey: 0x778899,
28491
+ lightsteelblue: 0xb0c4de,
28492
+ lightyellow: 0xffffe0,
28493
+ lime: 0x00ff00,
28494
+ limegreen: 0x32cd32,
28495
+ linen: 0xfaf0e6,
28496
+ magenta: 0xff00ff,
28497
+ maroon: 0x800000,
28498
+ mediumaquamarine: 0x66cdaa,
28499
+ mediumblue: 0x0000cd,
28500
+ mediumorchid: 0xba55d3,
28501
+ mediumpurple: 0x9370db,
28502
+ mediumseagreen: 0x3cb371,
28503
+ mediumslateblue: 0x7b68ee,
28504
+ mediumspringgreen: 0x00fa9a,
28505
+ mediumturquoise: 0x48d1cc,
28506
+ mediumvioletred: 0xc71585,
28507
+ midnightblue: 0x191970,
28508
+ mintcream: 0xf5fffa,
28509
+ mistyrose: 0xffe4e1,
28510
+ moccasin: 0xffe4b5,
28511
+ navajowhite: 0xffdead,
28512
+ navy: 0x000080,
28513
+ oldlace: 0xfdf5e6,
28514
+ olive: 0x808000,
28515
+ olivedrab: 0x6b8e23,
28516
+ orange: 0xffa500,
28517
+ orangered: 0xff4500,
28518
+ orchid: 0xda70d6,
28519
+ palegoldenrod: 0xeee8aa,
28520
+ palegreen: 0x98fb98,
28521
+ paleturquoise: 0xafeeee,
28522
+ palevioletred: 0xdb7093,
28523
+ papayawhip: 0xffefd5,
28524
+ peachpuff: 0xffdab9,
28525
+ peru: 0xcd853f,
28526
+ pink: 0xffc0cb,
28527
+ plum: 0xdda0dd,
28528
+ powderblue: 0xb0e0e6,
28529
+ purple: 0x800080,
28530
+ rebeccapurple: 0x663399,
28531
+ red: 0xff0000,
28532
+ rosybrown: 0xbc8f8f,
28533
+ royalblue: 0x4169e1,
28534
+ saddlebrown: 0x8b4513,
28535
+ salmon: 0xfa8072,
28536
+ sandybrown: 0xf4a460,
28537
+ seagreen: 0x2e8b57,
28538
+ seashell: 0xfff5ee,
28539
+ sienna: 0xa0522d,
28540
+ silver: 0xc0c0c0,
28541
+ skyblue: 0x87ceeb,
28542
+ slateblue: 0x6a5acd,
28543
+ slategray: 0x708090,
28544
+ slategrey: 0x708090,
28545
+ snow: 0xfffafa,
28546
+ springgreen: 0x00ff7f,
28547
+ steelblue: 0x4682b4,
28548
+ tan: 0xd2b48c,
28549
+ teal: 0x008080,
28550
+ thistle: 0xd8bfd8,
28551
+ tomato: 0xff6347,
28552
+ turquoise: 0x40e0d0,
28553
+ violet: 0xee82ee,
28554
+ wheat: 0xf5deb3,
28555
+ white: 0xffffff,
28556
+ whitesmoke: 0xf5f5f5,
28557
+ yellow: 0xffff00,
28558
+ yellowgreen: 0x9acd32
28559
+ };
28560
+
28561
+ define(Color, color, {
28562
+ copy: function(channels) {
28563
+ return Object.assign(new this.constructor, this, channels);
28564
+ },
28565
+ displayable: function() {
28566
+ return this.rgb().displayable();
28567
+ },
28568
+ hex: color_formatHex, // Deprecated! Use color.formatHex.
28569
+ formatHex: color_formatHex,
28570
+ formatHsl: color_formatHsl,
28571
+ formatRgb: color_formatRgb,
28572
+ toString: color_formatRgb
28573
+ });
28574
+
28575
+ function color_formatHex() {
28576
+ return this.rgb().formatHex();
28577
+ }
28578
+
28579
+ function color_formatHsl() {
28580
+ return hslConvert(this).formatHsl();
28581
+ }
28582
+
28583
+ function color_formatRgb() {
28584
+ return this.rgb().formatRgb();
28585
+ }
28586
+
28587
+ function color(format) {
28588
+ var m, l;
28589
+ format = (format + "").trim().toLowerCase();
28590
+ return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
28591
+ : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
28592
+ : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
28593
+ : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
28594
+ : null) // invalid hex
28595
+ : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
28596
+ : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
28597
+ : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
28598
+ : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
28599
+ : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
28600
+ : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
28601
+ : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
28602
+ : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
28603
+ : null;
28604
+ }
28605
+
28606
+ function rgbn(n) {
28607
+ return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
28608
+ }
28609
+
28610
+ function rgba(r, g, b, a) {
28611
+ if (a <= 0) r = g = b = NaN;
28612
+ return new Rgb(r, g, b, a);
28613
+ }
28614
+
28615
+ function rgbConvert(o) {
28616
+ if (!(o instanceof Color)) o = color(o);
28617
+ if (!o) return new Rgb;
28618
+ o = o.rgb();
28619
+ return new Rgb(o.r, o.g, o.b, o.opacity);
28620
+ }
28621
+
28622
+ function rgb$1(r, g, b, opacity) {
28623
+ return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
28624
+ }
28625
+
28626
+ function Rgb(r, g, b, opacity) {
28627
+ this.r = +r;
28628
+ this.g = +g;
28629
+ this.b = +b;
28630
+ this.opacity = +opacity;
28631
+ }
28632
+
28633
+ define(Rgb, rgb$1, extend(Color, {
28634
+ brighter: function(k) {
28635
+ k = k == null ? brighter : Math.pow(brighter, k);
28636
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
28637
+ },
28638
+ darker: function(k) {
28639
+ k = k == null ? darker : Math.pow(darker, k);
28640
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
28641
+ },
28642
+ rgb: function() {
28643
+ return this;
28644
+ },
28645
+ displayable: function() {
28646
+ return (-0.5 <= this.r && this.r < 255.5)
28647
+ && (-0.5 <= this.g && this.g < 255.5)
28648
+ && (-0.5 <= this.b && this.b < 255.5)
28649
+ && (0 <= this.opacity && this.opacity <= 1);
28650
+ },
28651
+ hex: rgb_formatHex, // Deprecated! Use color.formatHex.
28652
+ formatHex: rgb_formatHex,
28653
+ formatRgb: rgb_formatRgb,
28654
+ toString: rgb_formatRgb
28655
+ }));
28656
+
28657
+ function rgb_formatHex() {
28658
+ return "#" + hex(this.r) + hex(this.g) + hex(this.b);
28659
+ }
28660
+
28661
+ function rgb_formatRgb() {
28662
+ var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
28663
+ return (a === 1 ? "rgb(" : "rgba(")
28664
+ + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
28665
+ + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
28666
+ + Math.max(0, Math.min(255, Math.round(this.b) || 0))
28667
+ + (a === 1 ? ")" : ", " + a + ")");
28668
+ }
28669
+
28670
+ function hex(value) {
28671
+ value = Math.max(0, Math.min(255, Math.round(value) || 0));
28672
+ return (value < 16 ? "0" : "") + value.toString(16);
28673
+ }
28674
+
28675
+ function hsla(h, s, l, a) {
28676
+ if (a <= 0) h = s = l = NaN;
28677
+ else if (l <= 0 || l >= 1) h = s = NaN;
28678
+ else if (s <= 0) h = NaN;
28679
+ return new Hsl(h, s, l, a);
28680
+ }
28681
+
28682
+ function hslConvert(o) {
28683
+ if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
28684
+ if (!(o instanceof Color)) o = color(o);
28685
+ if (!o) return new Hsl;
28686
+ if (o instanceof Hsl) return o;
28687
+ o = o.rgb();
28688
+ var r = o.r / 255,
28689
+ g = o.g / 255,
28690
+ b = o.b / 255,
28691
+ min = Math.min(r, g, b),
28692
+ max = Math.max(r, g, b),
28693
+ h = NaN,
28694
+ s = max - min,
28695
+ l = (max + min) / 2;
28696
+ if (s) {
28697
+ if (r === max) h = (g - b) / s + (g < b) * 6;
28698
+ else if (g === max) h = (b - r) / s + 2;
28699
+ else h = (r - g) / s + 4;
28700
+ s /= l < 0.5 ? max + min : 2 - max - min;
28701
+ h *= 60;
28702
+ } else {
28703
+ s = l > 0 && l < 1 ? 0 : h;
28704
+ }
28705
+ return new Hsl(h, s, l, o.opacity);
28706
+ }
28707
+
28708
+ function hsl$2(h, s, l, opacity) {
28709
+ return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
28710
+ }
28711
+
28712
+ function Hsl(h, s, l, opacity) {
28713
+ this.h = +h;
28714
+ this.s = +s;
28715
+ this.l = +l;
28716
+ this.opacity = +opacity;
28717
+ }
28718
+
28719
+ define(Hsl, hsl$2, extend(Color, {
28720
+ brighter: function(k) {
28721
+ k = k == null ? brighter : Math.pow(brighter, k);
28722
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
28723
+ },
28724
+ darker: function(k) {
28725
+ k = k == null ? darker : Math.pow(darker, k);
28726
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
28727
+ },
28728
+ rgb: function() {
28729
+ var h = this.h % 360 + (this.h < 0) * 360,
28730
+ s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
28731
+ l = this.l,
28732
+ m2 = l + (l < 0.5 ? l : 1 - l) * s,
28733
+ m1 = 2 * l - m2;
28734
+ return new Rgb(
28735
+ hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
28736
+ hsl2rgb(h, m1, m2),
28737
+ hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
28738
+ this.opacity
28739
+ );
28740
+ },
28741
+ displayable: function() {
28742
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s))
28743
+ && (0 <= this.l && this.l <= 1)
28744
+ && (0 <= this.opacity && this.opacity <= 1);
28745
+ },
28746
+ formatHsl: function() {
28747
+ var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
28748
+ return (a === 1 ? "hsl(" : "hsla(")
28749
+ + (this.h || 0) + ", "
28750
+ + (this.s || 0) * 100 + "%, "
28751
+ + (this.l || 0) * 100 + "%"
28752
+ + (a === 1 ? ")" : ", " + a + ")");
28753
+ }
28754
+ }));
28755
+
28756
+ /* From FvD 13.37, CSS Color Module Level 3 */
28757
+ function hsl2rgb(h, m1, m2) {
28758
+ return (h < 60 ? m1 + (m2 - m1) * h / 60
28759
+ : h < 180 ? m2
28760
+ : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
28761
+ : m1) * 255;
28762
+ }
28763
+
28764
+ const radians = Math.PI / 180;
28765
+ const degrees$1 = 180 / Math.PI;
28766
+
28767
+ // https://observablehq.com/@mbostock/lab-and-rgb
28768
+ const K = 18,
28769
+ Xn = 0.96422,
28770
+ Yn = 1,
28771
+ Zn = 0.82521,
28772
+ t0 = 4 / 29,
28773
+ t1 = 6 / 29,
28774
+ t2 = 3 * t1 * t1,
28775
+ t3 = t1 * t1 * t1;
28776
+
28777
+ function labConvert(o) {
28778
+ if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
28779
+ if (o instanceof Hcl) return hcl2lab(o);
28780
+ if (!(o instanceof Rgb)) o = rgbConvert(o);
28781
+ var r = rgb2lrgb(o.r),
28782
+ g = rgb2lrgb(o.g),
28783
+ b = rgb2lrgb(o.b),
28784
+ y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
28785
+ if (r === g && g === b) x = z = y; else {
28786
+ x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
28787
+ z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
28788
+ }
28789
+ return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
28790
+ }
28791
+
28792
+ function gray(l, opacity) {
28793
+ return new Lab(l, 0, 0, opacity == null ? 1 : opacity);
28794
+ }
28795
+
28796
+ function lab$1(l, a, b, opacity) {
28797
+ return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
28798
+ }
28799
+
28800
+ function Lab(l, a, b, opacity) {
28801
+ this.l = +l;
28802
+ this.a = +a;
28803
+ this.b = +b;
28804
+ this.opacity = +opacity;
28805
+ }
28806
+
28807
+ define(Lab, lab$1, extend(Color, {
28808
+ brighter: function(k) {
28809
+ return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
28810
+ },
28811
+ darker: function(k) {
28812
+ return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
28813
+ },
28814
+ rgb: function() {
28815
+ var y = (this.l + 16) / 116,
28816
+ x = isNaN(this.a) ? y : y + this.a / 500,
28817
+ z = isNaN(this.b) ? y : y - this.b / 200;
28818
+ x = Xn * lab2xyz(x);
28819
+ y = Yn * lab2xyz(y);
28820
+ z = Zn * lab2xyz(z);
28821
+ return new Rgb(
28822
+ lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
28823
+ lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
28824
+ lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
28825
+ this.opacity
28826
+ );
28827
+ }
28828
+ }));
28829
+
28830
+ function xyz2lab(t) {
28831
+ return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
28832
+ }
28833
+
28834
+ function lab2xyz(t) {
28835
+ return t > t1 ? t * t * t : t2 * (t - t0);
28836
+ }
28837
+
28838
+ function lrgb2rgb(x) {
28839
+ return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
28840
+ }
28841
+
28842
+ function rgb2lrgb(x) {
28843
+ return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
28844
+ }
28845
+
28846
+ function hclConvert(o) {
28847
+ if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
28848
+ if (!(o instanceof Lab)) o = labConvert(o);
28849
+ if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
28850
+ var h = Math.atan2(o.b, o.a) * degrees$1;
28851
+ return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
28852
+ }
28853
+
28854
+ function lch(l, c, h, opacity) {
28855
+ return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
28856
+ }
28857
+
28858
+ function hcl$2(h, c, l, opacity) {
28859
+ return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
28860
+ }
28861
+
28862
+ function Hcl(h, c, l, opacity) {
28863
+ this.h = +h;
28864
+ this.c = +c;
28865
+ this.l = +l;
28866
+ this.opacity = +opacity;
28867
+ }
28868
+
28869
+ function hcl2lab(o) {
28870
+ if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
28871
+ var h = o.h * radians;
28872
+ return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
28873
+ }
28874
+
28875
+ define(Hcl, hcl$2, extend(Color, {
28876
+ brighter: function(k) {
28877
+ return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
28878
+ },
28879
+ darker: function(k) {
28880
+ return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
28881
+ },
28882
+ rgb: function() {
28883
+ return hcl2lab(this).rgb();
28884
+ }
28885
+ }));
28886
+
28887
+ var A = -0.14861,
28888
+ B = +1.78277,
28889
+ C = -0.29227,
28890
+ D = -0.90649,
28891
+ E = +1.97294,
28892
+ ED = E * D,
28893
+ EB = E * B,
28894
+ BC_DA = B * C - D * A;
28895
+
28896
+ function cubehelixConvert(o) {
28897
+ if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
28898
+ if (!(o instanceof Rgb)) o = rgbConvert(o);
28899
+ var r = o.r / 255,
28900
+ g = o.g / 255,
28901
+ b = o.b / 255,
28902
+ l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
28903
+ bl = b - l,
28904
+ k = (E * (g - l) - C * bl) / D,
28905
+ s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
28906
+ h = s ? Math.atan2(k, bl) * degrees$1 - 120 : NaN;
28907
+ return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
28908
+ }
28909
+
28910
+ function cubehelix$3(h, s, l, opacity) {
28911
+ return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
28912
+ }
28913
+
28914
+ function Cubehelix(h, s, l, opacity) {
28915
+ this.h = +h;
28916
+ this.s = +s;
28917
+ this.l = +l;
28918
+ this.opacity = +opacity;
28919
+ }
28920
+
28921
+ define(Cubehelix, cubehelix$3, extend(Color, {
28922
+ brighter: function(k) {
28923
+ k = k == null ? brighter : Math.pow(brighter, k);
28924
+ return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
28925
+ },
28926
+ darker: function(k) {
28927
+ k = k == null ? darker : Math.pow(darker, k);
28928
+ return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
28929
+ },
28930
+ rgb: function() {
28931
+ var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,
28932
+ l = +this.l,
28933
+ a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
28934
+ cosh = Math.cos(h),
28935
+ sinh = Math.sin(h);
28936
+ return new Rgb(
28937
+ 255 * (l + a * (A * cosh + B * sinh)),
28938
+ 255 * (l + a * (C * cosh + D * sinh)),
28939
+ 255 * (l + a * (E * cosh)),
28940
+ this.opacity
28941
+ );
28942
+ }
28943
+ }));
28944
+
28945
+ function basis(t1, v0, v1, v2, v3) {
28946
+ var t2 = t1 * t1, t3 = t2 * t1;
28947
+ return ((1 - 3 * t1 + 3 * t2 - t3) * v0
28948
+ + (4 - 6 * t2 + 3 * t3) * v1
28949
+ + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
28950
+ + t3 * v3) / 6;
28951
+ }
28952
+
28953
+ function basis$1(values) {
28954
+ var n = values.length - 1;
28955
+ return function(t) {
28956
+ var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
28957
+ v1 = values[i],
28958
+ v2 = values[i + 1],
28959
+ v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
28960
+ v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
28961
+ return basis((t - i / n) * n, v0, v1, v2, v3);
28962
+ };
28963
+ }
28964
+
28965
+ function basisClosed(values) {
28966
+ var n = values.length;
28967
+ return function(t) {
28968
+ var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
28969
+ v0 = values[(i + n - 1) % n],
28970
+ v1 = values[i % n],
28971
+ v2 = values[(i + 1) % n],
28972
+ v3 = values[(i + 2) % n];
28973
+ return basis((t - i / n) * n, v0, v1, v2, v3);
28974
+ };
28975
+ }
28976
+
28977
+ var constant = x => () => x;
28978
+
28979
+ function linear(a, d) {
28980
+ return function(t) {
28981
+ return a + t * d;
28982
+ };
28983
+ }
28984
+
28985
+ function exponential(a, b, y) {
28986
+ return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
28987
+ return Math.pow(a + t * b, y);
28988
+ };
28989
+ }
28990
+
28991
+ function hue$1(a, b) {
28992
+ var d = b - a;
28993
+ return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);
28994
+ }
28995
+
28996
+ function gamma(y) {
28997
+ return (y = +y) === 1 ? nogamma : function(a, b) {
28998
+ return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
28999
+ };
29000
+ }
29001
+
29002
+ function nogamma(a, b) {
29003
+ var d = b - a;
29004
+ return d ? linear(a, d) : constant(isNaN(a) ? b : a);
29005
+ }
29006
+
29007
+ var rgb = (function rgbGamma(y) {
29008
+ var color = gamma(y);
29009
+
29010
+ function rgb(start, end) {
29011
+ var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r),
29012
+ g = color(start.g, end.g),
29013
+ b = color(start.b, end.b),
29014
+ opacity = nogamma(start.opacity, end.opacity);
29015
+ return function(t) {
29016
+ start.r = r(t);
29017
+ start.g = g(t);
29018
+ start.b = b(t);
29019
+ start.opacity = opacity(t);
29020
+ return start + "";
29021
+ };
29022
+ }
29023
+
29024
+ rgb.gamma = rgbGamma;
29025
+
29026
+ return rgb;
29027
+ })(1);
29028
+
29029
+ function rgbSpline(spline) {
29030
+ return function(colors) {
29031
+ var n = colors.length,
29032
+ r = new Array(n),
29033
+ g = new Array(n),
29034
+ b = new Array(n),
29035
+ i, color;
29036
+ for (i = 0; i < n; ++i) {
29037
+ color = rgb$1(colors[i]);
29038
+ r[i] = color.r || 0;
29039
+ g[i] = color.g || 0;
29040
+ b[i] = color.b || 0;
29041
+ }
29042
+ r = spline(r);
29043
+ g = spline(g);
29044
+ b = spline(b);
29045
+ color.opacity = 1;
29046
+ return function(t) {
29047
+ color.r = r(t);
29048
+ color.g = g(t);
29049
+ color.b = b(t);
29050
+ return color + "";
29051
+ };
29052
+ };
29053
+ }
29054
+
29055
+ var rgbBasis = rgbSpline(basis$1);
29056
+ var rgbBasisClosed = rgbSpline(basisClosed);
29057
+
29058
+ function numberArray(a, b) {
29059
+ if (!b) b = [];
29060
+ var n = a ? Math.min(b.length, a.length) : 0,
29061
+ c = b.slice(),
29062
+ i;
29063
+ return function(t) {
29064
+ for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
29065
+ return c;
29066
+ };
29067
+ }
29068
+
29069
+ function isNumberArray(x) {
29070
+ return ArrayBuffer.isView(x) && !(x instanceof DataView);
29071
+ }
29072
+
29073
+ function array(a, b) {
29074
+ return (isNumberArray(b) ? numberArray : genericArray)(a, b);
29075
+ }
29076
+
29077
+ function genericArray(a, b) {
29078
+ var nb = b ? b.length : 0,
29079
+ na = a ? Math.min(nb, a.length) : 0,
29080
+ x = new Array(na),
29081
+ c = new Array(nb),
29082
+ i;
29083
+
29084
+ for (i = 0; i < na; ++i) x[i] = d3_interpolate(a[i], b[i]);
29085
+ for (; i < nb; ++i) c[i] = b[i];
29086
+
29087
+ return function(t) {
29088
+ for (i = 0; i < na; ++i) c[i] = x[i](t);
29089
+ return c;
29090
+ };
29091
+ }
29092
+
29093
+ function date(a, b) {
29094
+ var d = new Date;
29095
+ return a = +a, b = +b, function(t) {
29096
+ return d.setTime(a * (1 - t) + b * t), d;
29097
+ };
29098
+ }
29099
+
29100
+ function number(a, b) {
29101
+ return a = +a, b = +b, function(t) {
29102
+ return a * (1 - t) + b * t;
29103
+ };
29104
+ }
29105
+
29106
+ function object(a, b) {
29107
+ var i = {},
29108
+ c = {},
29109
+ k;
29110
+
29111
+ if (a === null || typeof a !== "object") a = {};
29112
+ if (b === null || typeof b !== "object") b = {};
29113
+
29114
+ for (k in b) {
29115
+ if (k in a) {
29116
+ i[k] = d3_interpolate(a[k], b[k]);
29117
+ } else {
29118
+ c[k] = b[k];
29119
+ }
29120
+ }
29121
+
29122
+ return function(t) {
29123
+ for (k in i) c[k] = i[k](t);
29124
+ return c;
29125
+ };
29126
+ }
29127
+
29128
+ var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
29129
+ reB = new RegExp(reA.source, "g");
29130
+
29131
+ function zero(b) {
29132
+ return function() {
29133
+ return b;
29134
+ };
29135
+ }
29136
+
29137
+ function one(b) {
29138
+ return function(t) {
29139
+ return b(t) + "";
29140
+ };
29141
+ }
29142
+
29143
+ function string(a, b) {
29144
+ var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
29145
+ am, // current match in a
29146
+ bm, // current match in b
29147
+ bs, // string preceding current number in b, if any
29148
+ i = -1, // index in s
29149
+ s = [], // string constants and placeholders
29150
+ q = []; // number interpolators
29151
+
29152
+ // Coerce inputs to strings.
29153
+ a = a + "", b = b + "";
29154
+
29155
+ // Interpolate pairs of numbers in a & b.
29156
+ while ((am = reA.exec(a))
29157
+ && (bm = reB.exec(b))) {
29158
+ if ((bs = bm.index) > bi) { // a string precedes the next number in b
29159
+ bs = b.slice(bi, bs);
29160
+ if (s[i]) s[i] += bs; // coalesce with previous string
29161
+ else s[++i] = bs;
29162
+ }
29163
+ if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
29164
+ if (s[i]) s[i] += bm; // coalesce with previous string
29165
+ else s[++i] = bm;
29166
+ } else { // interpolate non-matching numbers
29167
+ s[++i] = null;
29168
+ q.push({i: i, x: number(am, bm)});
29169
+ }
29170
+ bi = reB.lastIndex;
29171
+ }
29172
+
29173
+ // Add remains of b.
29174
+ if (bi < b.length) {
29175
+ bs = b.slice(bi);
29176
+ if (s[i]) s[i] += bs; // coalesce with previous string
29177
+ else s[++i] = bs;
29178
+ }
29179
+
29180
+ // Special optimization for only a single match.
29181
+ // Otherwise, interpolate each of the numbers and rejoin the string.
29182
+ return s.length < 2 ? (q[0]
29183
+ ? one(q[0].x)
29184
+ : zero(b))
29185
+ : (b = q.length, function(t) {
29186
+ for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
29187
+ return s.join("");
29188
+ });
29189
+ }
29190
+
29191
+ function d3_interpolate(a, b) {
29192
+ var t = typeof b, c;
29193
+ return b == null || t === "boolean" ? constant(b)
29194
+ : (t === "number" ? number
29195
+ : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string)
29196
+ : b instanceof color ? rgb
29197
+ : b instanceof Date ? date
29198
+ : isNumberArray(b) ? numberArray
29199
+ : Array.isArray(b) ? genericArray
29200
+ : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
29201
+ : number)(a, b);
29202
+ }
29203
+
29204
+ function discrete(range) {
29205
+ var n = range.length;
29206
+ return function(t) {
29207
+ return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
29208
+ };
29209
+ }
29210
+
29211
+ function hue(a, b) {
29212
+ var i = hue$1(+a, +b);
29213
+ return function(t) {
29214
+ var x = i(t);
29215
+ return x - 360 * Math.floor(x / 360);
29216
+ };
29217
+ }
29218
+
29219
+ function round(a, b) {
29220
+ return a = +a, b = +b, function(t) {
29221
+ return Math.round(a * (1 - t) + b * t);
29222
+ };
29223
+ }
29224
+
29225
+ var degrees = 180 / Math.PI;
29226
+
29227
+ var identity = {
29228
+ translateX: 0,
29229
+ translateY: 0,
29230
+ rotate: 0,
29231
+ skewX: 0,
29232
+ scaleX: 1,
29233
+ scaleY: 1
29234
+ };
29235
+
29236
+ function decompose(a, b, c, d, e, f) {
29237
+ var scaleX, scaleY, skewX;
29238
+ if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
29239
+ if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
29240
+ if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
29241
+ if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
29242
+ return {
29243
+ translateX: e,
29244
+ translateY: f,
29245
+ rotate: Math.atan2(b, a) * degrees,
29246
+ skewX: Math.atan(skewX) * degrees,
29247
+ scaleX: scaleX,
29248
+ scaleY: scaleY
29249
+ };
29250
+ }
29251
+
29252
+ var svgNode;
29253
+
29254
+ /* eslint-disable no-undef */
29255
+ function parseCss(value) {
29256
+ const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
29257
+ return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
29258
+ }
29259
+
29260
+ function parseSvg(value) {
29261
+ if (value == null) return identity;
29262
+ if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
29263
+ svgNode.setAttribute("transform", value);
29264
+ if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
29265
+ value = value.matrix;
29266
+ return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
29267
+ }
29268
+
29269
+ function interpolateTransform(parse, pxComma, pxParen, degParen) {
29270
+
29271
+ function pop(s) {
29272
+ return s.length ? s.pop() + " " : "";
29273
+ }
29274
+
29275
+ function translate(xa, ya, xb, yb, s, q) {
29276
+ if (xa !== xb || ya !== yb) {
29277
+ var i = s.push("translate(", null, pxComma, null, pxParen);
29278
+ q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
29279
+ } else if (xb || yb) {
29280
+ s.push("translate(" + xb + pxComma + yb + pxParen);
29281
+ }
29282
+ }
29283
+
29284
+ function rotate(a, b, s, q) {
29285
+ if (a !== b) {
29286
+ if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
29287
+ q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)});
29288
+ } else if (b) {
29289
+ s.push(pop(s) + "rotate(" + b + degParen);
29290
+ }
29291
+ }
29292
+
29293
+ function skewX(a, b, s, q) {
29294
+ if (a !== b) {
29295
+ q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)});
29296
+ } else if (b) {
29297
+ s.push(pop(s) + "skewX(" + b + degParen);
29298
+ }
29299
+ }
29300
+
29301
+ function scale(xa, ya, xb, yb, s, q) {
29302
+ if (xa !== xb || ya !== yb) {
29303
+ var i = s.push(pop(s) + "scale(", null, ",", null, ")");
29304
+ q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
29305
+ } else if (xb !== 1 || yb !== 1) {
29306
+ s.push(pop(s) + "scale(" + xb + "," + yb + ")");
29307
+ }
29308
+ }
29309
+
29310
+ return function(a, b) {
29311
+ var s = [], // string constants and placeholders
29312
+ q = []; // number interpolators
29313
+ a = parse(a), b = parse(b);
29314
+ translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
29315
+ rotate(a.rotate, b.rotate, s, q);
29316
+ skewX(a.skewX, b.skewX, s, q);
29317
+ scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
29318
+ a = b = null; // gc
29319
+ return function(t) {
29320
+ var i = -1, n = q.length, o;
29321
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
29322
+ return s.join("");
29323
+ };
29324
+ };
29325
+ }
29326
+
29327
+ var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
29328
+ var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
29329
+
29330
+ var epsilon2 = 1e-12;
29331
+
29332
+ function cosh(x) {
29333
+ return ((x = Math.exp(x)) + 1 / x) / 2;
29334
+ }
29335
+
29336
+ function sinh(x) {
29337
+ return ((x = Math.exp(x)) - 1 / x) / 2;
29338
+ }
29339
+
29340
+ function tanh(x) {
29341
+ return ((x = Math.exp(2 * x)) - 1) / (x + 1);
29342
+ }
29343
+
29344
+ var zoom = (function zoomRho(rho, rho2, rho4) {
29345
+
29346
+ // p0 = [ux0, uy0, w0]
29347
+ // p1 = [ux1, uy1, w1]
29348
+ function zoom(p0, p1) {
29349
+ var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
29350
+ ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
29351
+ dx = ux1 - ux0,
29352
+ dy = uy1 - uy0,
29353
+ d2 = dx * dx + dy * dy,
29354
+ i,
29355
+ S;
29356
+
29357
+ // Special case for u0 ≅ u1.
29358
+ if (d2 < epsilon2) {
29359
+ S = Math.log(w1 / w0) / rho;
29360
+ i = function(t) {
29361
+ return [
29362
+ ux0 + t * dx,
29363
+ uy0 + t * dy,
29364
+ w0 * Math.exp(rho * t * S)
29365
+ ];
29366
+ };
29367
+ }
29368
+
29369
+ // General case.
29370
+ else {
29371
+ var d1 = Math.sqrt(d2),
29372
+ b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
29373
+ b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
29374
+ r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
29375
+ r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
29376
+ S = (r1 - r0) / rho;
29377
+ i = function(t) {
29378
+ var s = t * S,
29379
+ coshr0 = cosh(r0),
29380
+ u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
29381
+ return [
29382
+ ux0 + u * dx,
29383
+ uy0 + u * dy,
29384
+ w0 * coshr0 / cosh(rho * s + r0)
29385
+ ];
29386
+ };
29387
+ }
29388
+
29389
+ i.duration = S * 1000 * rho / Math.SQRT2;
29390
+
29391
+ return i;
29392
+ }
29393
+
29394
+ zoom.rho = function(_) {
29395
+ var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
29396
+ return zoomRho(_1, _2, _4);
29397
+ };
29398
+
29399
+ return zoom;
29400
+ })(Math.SQRT2, 2, 4);
29401
+
29402
+ function hsl(hue) {
29403
+ return function(start, end) {
29404
+ var h = hue((start = hsl$2(start)).h, (end = hsl$2(end)).h),
29405
+ s = nogamma(start.s, end.s),
29406
+ l = nogamma(start.l, end.l),
29407
+ opacity = nogamma(start.opacity, end.opacity);
29408
+ return function(t) {
29409
+ start.h = h(t);
29410
+ start.s = s(t);
29411
+ start.l = l(t);
29412
+ start.opacity = opacity(t);
29413
+ return start + "";
29414
+ };
29415
+ }
29416
+ }
29417
+
29418
+ var hsl$1 = hsl(hue$1);
29419
+ var hslLong = hsl(nogamma);
29420
+
29421
+ function lab(start, end) {
29422
+ var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l),
29423
+ a = nogamma(start.a, end.a),
29424
+ b = nogamma(start.b, end.b),
29425
+ opacity = nogamma(start.opacity, end.opacity);
29426
+ return function(t) {
29427
+ start.l = l(t);
29428
+ start.a = a(t);
29429
+ start.b = b(t);
29430
+ start.opacity = opacity(t);
29431
+ return start + "";
29432
+ };
29433
+ }
29434
+
29435
+ function hcl(hue) {
29436
+ return function(start, end) {
29437
+ var h = hue((start = hcl$2(start)).h, (end = hcl$2(end)).h),
29438
+ c = nogamma(start.c, end.c),
29439
+ l = nogamma(start.l, end.l),
29440
+ opacity = nogamma(start.opacity, end.opacity);
29441
+ return function(t) {
29442
+ start.h = h(t);
29443
+ start.c = c(t);
29444
+ start.l = l(t);
29445
+ start.opacity = opacity(t);
29446
+ return start + "";
29447
+ };
29448
+ }
29449
+ }
29450
+
29451
+ var hcl$1 = hcl(hue$1);
29452
+ var hclLong = hcl(nogamma);
29453
+
29454
+ function cubehelix$1(hue) {
29455
+ return (function cubehelixGamma(y) {
29456
+ y = +y;
29457
+
29458
+ function cubehelix(start, end) {
29459
+ var h = hue((start = cubehelix$3(start)).h, (end = cubehelix$3(end)).h),
29460
+ s = nogamma(start.s, end.s),
29461
+ l = nogamma(start.l, end.l),
29462
+ opacity = nogamma(start.opacity, end.opacity);
29463
+ return function(t) {
29464
+ start.h = h(t);
29465
+ start.s = s(t);
29466
+ start.l = l(Math.pow(t, y));
29467
+ start.opacity = opacity(t);
29468
+ return start + "";
29469
+ };
29470
+ }
29471
+
29472
+ cubehelix.gamma = cubehelixGamma;
29473
+
29474
+ return cubehelix;
29475
+ })(1);
29476
+ }
29477
+
29478
+ var cubehelix$2 = cubehelix$1(hue$1);
29479
+ var cubehelixLong = cubehelix$1(nogamma);
29480
+
29481
+ function piecewise(interpolate, values) {
29482
+ if (values === undefined) values = interpolate, interpolate = d3_interpolate;
29483
+ var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);
29484
+ while (i < n) I[i] = interpolate(v, v = values[++i]);
29485
+ return function(t) {
29486
+ var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
29487
+ return I[i](t - i);
29488
+ };
29489
+ }
29490
+
29491
+ function quantize(interpolator, n) {
29492
+ var samples = new Array(n);
29493
+ for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
29494
+ return samples;
29495
+ }
29496
+
28375
29497
  // TODO: support three or more stops
28376
29498
  function getGradientFunction(stops) {
28377
29499
  var min = stops[0] / 100,
@@ -28403,11 +29525,10 @@ ${svg}
28403
29525
 
28404
29526
  // convert a continuous index ([0, n-1], -1) to a corresponding interpolated value
28405
29527
  function getInterpolatedValueGetter(values, nullValue) {
28406
- var d3 = require('d3-interpolate');
28407
29528
  var interpolators = [];
28408
29529
  var tmax = values.length - 1;
28409
29530
  for (var i=1; i<values.length; i++) {
28410
- interpolators.push(d3.interpolate(values[i-1], values[i]));
29531
+ interpolators.push(d3_interpolate(values[i-1], values[i]));
28411
29532
  }
28412
29533
  return function(t) {
28413
29534
  if (t == -1) return nullValue;
@@ -28425,7 +29546,6 @@ ${svg}
28425
29546
  // (colors and numbers should work)
28426
29547
  function interpolateValuesToClasses(values, n, stops) {
28427
29548
  if (values.length == n && !stops) return values;
28428
- var d3 = require('d3-interpolate');
28429
29549
  var numPairs = values.length - 1;
28430
29550
  var output = [values[0]];
28431
29551
  var k, j, t, intVal;
@@ -28434,7 +29554,7 @@ ${svg}
28434
29554
  j = Math.floor(k);
28435
29555
  t = k - j;
28436
29556
  // if (convert) t = convert(t);
28437
- intVal = d3.interpolate(values[j], values[j+1])(t);
29557
+ intVal = d3_interpolate(values[j], values[j+1])(t);
28438
29558
  output.push(intVal);
28439
29559
  }
28440
29560
  output.push(values[values.length - 1]);
@@ -29375,6 +30495,518 @@ ${svg}
29375
30495
  return maxId + 1;
29376
30496
  }
29377
30497
 
30498
+ function colors(specifier) {
30499
+ var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
30500
+ while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
30501
+ return colors;
30502
+ }
30503
+
30504
+ var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
30505
+
30506
+ var Accent = colors("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");
30507
+
30508
+ var Dark2 = colors("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");
30509
+
30510
+ var Paired = colors("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");
30511
+
30512
+ var Pastel1 = colors("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");
30513
+
30514
+ var Pastel2 = colors("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");
30515
+
30516
+ var Set1 = colors("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");
30517
+
30518
+ var Set2 = colors("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");
30519
+
30520
+ var Set3 = colors("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");
30521
+
30522
+ var Tableau10 = colors("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
30523
+
30524
+ var ramp$1 = scheme => rgbBasis(scheme[scheme.length - 1]);
30525
+
30526
+ var scheme$q = new Array(3).concat(
30527
+ "d8b365f5f5f55ab4ac",
30528
+ "a6611adfc27d80cdc1018571",
30529
+ "a6611adfc27df5f5f580cdc1018571",
30530
+ "8c510ad8b365f6e8c3c7eae55ab4ac01665e",
30531
+ "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e",
30532
+ "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e",
30533
+ "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e",
30534
+ "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30",
30535
+ "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30"
30536
+ ).map(colors);
30537
+
30538
+ var BrBG = ramp$1(scheme$q);
30539
+
30540
+ var scheme$p = new Array(3).concat(
30541
+ "af8dc3f7f7f77fbf7b",
30542
+ "7b3294c2a5cfa6dba0008837",
30543
+ "7b3294c2a5cff7f7f7a6dba0008837",
30544
+ "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837",
30545
+ "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837",
30546
+ "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837",
30547
+ "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837",
30548
+ "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b",
30549
+ "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b"
30550
+ ).map(colors);
30551
+
30552
+ var PRGn = ramp$1(scheme$p);
30553
+
30554
+ var scheme$o = new Array(3).concat(
30555
+ "e9a3c9f7f7f7a1d76a",
30556
+ "d01c8bf1b6dab8e1864dac26",
30557
+ "d01c8bf1b6daf7f7f7b8e1864dac26",
30558
+ "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221",
30559
+ "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221",
30560
+ "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221",
30561
+ "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221",
30562
+ "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419",
30563
+ "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419"
30564
+ ).map(colors);
30565
+
30566
+ var PiYG = ramp$1(scheme$o);
30567
+
30568
+ var scheme$n = new Array(3).concat(
30569
+ "998ec3f7f7f7f1a340",
30570
+ "5e3c99b2abd2fdb863e66101",
30571
+ "5e3c99b2abd2f7f7f7fdb863e66101",
30572
+ "542788998ec3d8daebfee0b6f1a340b35806",
30573
+ "542788998ec3d8daebf7f7f7fee0b6f1a340b35806",
30574
+ "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806",
30575
+ "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806",
30576
+ "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08",
30577
+ "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08"
30578
+ ).map(colors);
30579
+
30580
+ var PuOr = ramp$1(scheme$n);
30581
+
30582
+ var scheme$m = new Array(3).concat(
30583
+ "ef8a62f7f7f767a9cf",
30584
+ "ca0020f4a58292c5de0571b0",
30585
+ "ca0020f4a582f7f7f792c5de0571b0",
30586
+ "b2182bef8a62fddbc7d1e5f067a9cf2166ac",
30587
+ "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac",
30588
+ "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac",
30589
+ "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac",
30590
+ "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061",
30591
+ "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061"
30592
+ ).map(colors);
30593
+
30594
+ var RdBu = ramp$1(scheme$m);
30595
+
30596
+ var scheme$l = new Array(3).concat(
30597
+ "ef8a62ffffff999999",
30598
+ "ca0020f4a582bababa404040",
30599
+ "ca0020f4a582ffffffbababa404040",
30600
+ "b2182bef8a62fddbc7e0e0e09999994d4d4d",
30601
+ "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d",
30602
+ "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d",
30603
+ "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d",
30604
+ "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a",
30605
+ "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a"
30606
+ ).map(colors);
30607
+
30608
+ var RdGy = ramp$1(scheme$l);
30609
+
30610
+ var scheme$k = new Array(3).concat(
30611
+ "fc8d59ffffbf91bfdb",
30612
+ "d7191cfdae61abd9e92c7bb6",
30613
+ "d7191cfdae61ffffbfabd9e92c7bb6",
30614
+ "d73027fc8d59fee090e0f3f891bfdb4575b4",
30615
+ "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4",
30616
+ "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4",
30617
+ "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4",
30618
+ "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695",
30619
+ "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695"
30620
+ ).map(colors);
30621
+
30622
+ var RdYlBu = ramp$1(scheme$k);
30623
+
30624
+ var scheme$j = new Array(3).concat(
30625
+ "fc8d59ffffbf91cf60",
30626
+ "d7191cfdae61a6d96a1a9641",
30627
+ "d7191cfdae61ffffbfa6d96a1a9641",
30628
+ "d73027fc8d59fee08bd9ef8b91cf601a9850",
30629
+ "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850",
30630
+ "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850",
30631
+ "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850",
30632
+ "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837",
30633
+ "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837"
30634
+ ).map(colors);
30635
+
30636
+ var RdYlGn = ramp$1(scheme$j);
30637
+
30638
+ var scheme$i = new Array(3).concat(
30639
+ "fc8d59ffffbf99d594",
30640
+ "d7191cfdae61abdda42b83ba",
30641
+ "d7191cfdae61ffffbfabdda42b83ba",
30642
+ "d53e4ffc8d59fee08be6f59899d5943288bd",
30643
+ "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd",
30644
+ "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd",
30645
+ "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd",
30646
+ "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2",
30647
+ "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2"
30648
+ ).map(colors);
30649
+
30650
+ var Spectral = ramp$1(scheme$i);
30651
+
30652
+ var scheme$h = new Array(3).concat(
30653
+ "e5f5f999d8c92ca25f",
30654
+ "edf8fbb2e2e266c2a4238b45",
30655
+ "edf8fbb2e2e266c2a42ca25f006d2c",
30656
+ "edf8fbccece699d8c966c2a42ca25f006d2c",
30657
+ "edf8fbccece699d8c966c2a441ae76238b45005824",
30658
+ "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824",
30659
+ "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b"
30660
+ ).map(colors);
30661
+
30662
+ var BuGn = ramp$1(scheme$h);
30663
+
30664
+ var scheme$g = new Array(3).concat(
30665
+ "e0ecf49ebcda8856a7",
30666
+ "edf8fbb3cde38c96c688419d",
30667
+ "edf8fbb3cde38c96c68856a7810f7c",
30668
+ "edf8fbbfd3e69ebcda8c96c68856a7810f7c",
30669
+ "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b",
30670
+ "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b",
30671
+ "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b"
30672
+ ).map(colors);
30673
+
30674
+ var BuPu = ramp$1(scheme$g);
30675
+
30676
+ var scheme$f = new Array(3).concat(
30677
+ "e0f3dba8ddb543a2ca",
30678
+ "f0f9e8bae4bc7bccc42b8cbe",
30679
+ "f0f9e8bae4bc7bccc443a2ca0868ac",
30680
+ "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac",
30681
+ "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e",
30682
+ "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e",
30683
+ "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081"
30684
+ ).map(colors);
30685
+
30686
+ var GnBu = ramp$1(scheme$f);
30687
+
30688
+ var scheme$e = new Array(3).concat(
30689
+ "fee8c8fdbb84e34a33",
30690
+ "fef0d9fdcc8afc8d59d7301f",
30691
+ "fef0d9fdcc8afc8d59e34a33b30000",
30692
+ "fef0d9fdd49efdbb84fc8d59e34a33b30000",
30693
+ "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000",
30694
+ "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000",
30695
+ "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000"
30696
+ ).map(colors);
30697
+
30698
+ var OrRd = ramp$1(scheme$e);
30699
+
30700
+ var scheme$d = new Array(3).concat(
30701
+ "ece2f0a6bddb1c9099",
30702
+ "f6eff7bdc9e167a9cf02818a",
30703
+ "f6eff7bdc9e167a9cf1c9099016c59",
30704
+ "f6eff7d0d1e6a6bddb67a9cf1c9099016c59",
30705
+ "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450",
30706
+ "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450",
30707
+ "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636"
30708
+ ).map(colors);
30709
+
30710
+ var PuBuGn = ramp$1(scheme$d);
30711
+
30712
+ var scheme$c = new Array(3).concat(
30713
+ "ece7f2a6bddb2b8cbe",
30714
+ "f1eef6bdc9e174a9cf0570b0",
30715
+ "f1eef6bdc9e174a9cf2b8cbe045a8d",
30716
+ "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d",
30717
+ "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b",
30718
+ "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b",
30719
+ "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858"
30720
+ ).map(colors);
30721
+
30722
+ var PuBu = ramp$1(scheme$c);
30723
+
30724
+ var scheme$b = new Array(3).concat(
30725
+ "e7e1efc994c7dd1c77",
30726
+ "f1eef6d7b5d8df65b0ce1256",
30727
+ "f1eef6d7b5d8df65b0dd1c77980043",
30728
+ "f1eef6d4b9dac994c7df65b0dd1c77980043",
30729
+ "f1eef6d4b9dac994c7df65b0e7298ace125691003f",
30730
+ "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f",
30731
+ "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f"
30732
+ ).map(colors);
30733
+
30734
+ var PuRd = ramp$1(scheme$b);
30735
+
30736
+ var scheme$a = new Array(3).concat(
30737
+ "fde0ddfa9fb5c51b8a",
30738
+ "feebe2fbb4b9f768a1ae017e",
30739
+ "feebe2fbb4b9f768a1c51b8a7a0177",
30740
+ "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177",
30741
+ "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177",
30742
+ "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177",
30743
+ "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a"
30744
+ ).map(colors);
30745
+
30746
+ var RdPu = ramp$1(scheme$a);
30747
+
30748
+ var scheme$9 = new Array(3).concat(
30749
+ "edf8b17fcdbb2c7fb8",
30750
+ "ffffcca1dab441b6c4225ea8",
30751
+ "ffffcca1dab441b6c42c7fb8253494",
30752
+ "ffffccc7e9b47fcdbb41b6c42c7fb8253494",
30753
+ "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84",
30754
+ "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84",
30755
+ "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58"
30756
+ ).map(colors);
30757
+
30758
+ var YlGnBu = ramp$1(scheme$9);
30759
+
30760
+ var scheme$8 = new Array(3).concat(
30761
+ "f7fcb9addd8e31a354",
30762
+ "ffffccc2e69978c679238443",
30763
+ "ffffccc2e69978c67931a354006837",
30764
+ "ffffccd9f0a3addd8e78c67931a354006837",
30765
+ "ffffccd9f0a3addd8e78c67941ab5d238443005a32",
30766
+ "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32",
30767
+ "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529"
30768
+ ).map(colors);
30769
+
30770
+ var YlGn = ramp$1(scheme$8);
30771
+
30772
+ var scheme$7 = new Array(3).concat(
30773
+ "fff7bcfec44fd95f0e",
30774
+ "ffffd4fed98efe9929cc4c02",
30775
+ "ffffd4fed98efe9929d95f0e993404",
30776
+ "ffffd4fee391fec44ffe9929d95f0e993404",
30777
+ "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04",
30778
+ "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04",
30779
+ "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506"
30780
+ ).map(colors);
30781
+
30782
+ var YlOrBr = ramp$1(scheme$7);
30783
+
30784
+ var scheme$6 = new Array(3).concat(
30785
+ "ffeda0feb24cf03b20",
30786
+ "ffffb2fecc5cfd8d3ce31a1c",
30787
+ "ffffb2fecc5cfd8d3cf03b20bd0026",
30788
+ "ffffb2fed976feb24cfd8d3cf03b20bd0026",
30789
+ "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026",
30790
+ "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026",
30791
+ "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026"
30792
+ ).map(colors);
30793
+
30794
+ var YlOrRd = ramp$1(scheme$6);
30795
+
30796
+ var scheme$5 = new Array(3).concat(
30797
+ "deebf79ecae13182bd",
30798
+ "eff3ffbdd7e76baed62171b5",
30799
+ "eff3ffbdd7e76baed63182bd08519c",
30800
+ "eff3ffc6dbef9ecae16baed63182bd08519c",
30801
+ "eff3ffc6dbef9ecae16baed64292c62171b5084594",
30802
+ "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594",
30803
+ "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b"
30804
+ ).map(colors);
30805
+
30806
+ var Blues = ramp$1(scheme$5);
30807
+
30808
+ var scheme$4 = new Array(3).concat(
30809
+ "e5f5e0a1d99b31a354",
30810
+ "edf8e9bae4b374c476238b45",
30811
+ "edf8e9bae4b374c47631a354006d2c",
30812
+ "edf8e9c7e9c0a1d99b74c47631a354006d2c",
30813
+ "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32",
30814
+ "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32",
30815
+ "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b"
30816
+ ).map(colors);
30817
+
30818
+ var Greens = ramp$1(scheme$4);
30819
+
30820
+ var scheme$3 = new Array(3).concat(
30821
+ "f0f0f0bdbdbd636363",
30822
+ "f7f7f7cccccc969696525252",
30823
+ "f7f7f7cccccc969696636363252525",
30824
+ "f7f7f7d9d9d9bdbdbd969696636363252525",
30825
+ "f7f7f7d9d9d9bdbdbd969696737373525252252525",
30826
+ "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525",
30827
+ "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000"
30828
+ ).map(colors);
30829
+
30830
+ var Greys = ramp$1(scheme$3);
30831
+
30832
+ var scheme$2 = new Array(3).concat(
30833
+ "efedf5bcbddc756bb1",
30834
+ "f2f0f7cbc9e29e9ac86a51a3",
30835
+ "f2f0f7cbc9e29e9ac8756bb154278f",
30836
+ "f2f0f7dadaebbcbddc9e9ac8756bb154278f",
30837
+ "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486",
30838
+ "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486",
30839
+ "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d"
30840
+ ).map(colors);
30841
+
30842
+ var Purples = ramp$1(scheme$2);
30843
+
30844
+ var scheme$1 = new Array(3).concat(
30845
+ "fee0d2fc9272de2d26",
30846
+ "fee5d9fcae91fb6a4acb181d",
30847
+ "fee5d9fcae91fb6a4ade2d26a50f15",
30848
+ "fee5d9fcbba1fc9272fb6a4ade2d26a50f15",
30849
+ "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d",
30850
+ "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d",
30851
+ "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d"
30852
+ ).map(colors);
30853
+
30854
+ var Reds = ramp$1(scheme$1);
30855
+
30856
+ var scheme = new Array(3).concat(
30857
+ "fee6cefdae6be6550d",
30858
+ "feeddefdbe85fd8d3cd94701",
30859
+ "feeddefdbe85fd8d3ce6550da63603",
30860
+ "feeddefdd0a2fdae6bfd8d3ce6550da63603",
30861
+ "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04",
30862
+ "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04",
30863
+ "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704"
30864
+ ).map(colors);
30865
+
30866
+ var Oranges = ramp$1(scheme);
30867
+
30868
+ function cividis(t) {
30869
+ t = Math.max(0, Math.min(1, t));
30870
+ return "rgb("
30871
+ + Math.max(0, Math.min(255, Math.round(-4.54 - t * (35.34 - t * (2381.73 - t * (6402.7 - t * (7024.72 - t * 2710.57))))))) + ", "
30872
+ + Math.max(0, Math.min(255, Math.round(32.49 + t * (170.73 + t * (52.82 - t * (131.46 - t * (176.58 - t * 67.37))))))) + ", "
30873
+ + Math.max(0, Math.min(255, Math.round(81.24 + t * (442.36 - t * (2482.43 - t * (6167.24 - t * (6614.94 - t * 2475.67)))))))
30874
+ + ")";
30875
+ }
30876
+
30877
+ var cubehelix = cubehelixLong(cubehelix$3(300, 0.5, 0.0), cubehelix$3(-240, 0.5, 1.0));
30878
+
30879
+ var warm = cubehelixLong(cubehelix$3(-100, 0.75, 0.35), cubehelix$3(80, 1.50, 0.8));
30880
+
30881
+ var cool = cubehelixLong(cubehelix$3(260, 0.75, 0.35), cubehelix$3(80, 1.50, 0.8));
30882
+
30883
+ var c$1 = cubehelix$3();
30884
+
30885
+ function rainbow(t) {
30886
+ if (t < 0 || t > 1) t -= Math.floor(t);
30887
+ var ts = Math.abs(t - 0.5);
30888
+ c$1.h = 360 * t - 100;
30889
+ c$1.s = 1.5 - 1.5 * ts;
30890
+ c$1.l = 0.8 - 0.9 * ts;
30891
+ return c$1 + "";
30892
+ }
30893
+
30894
+ var c = rgb$1(),
30895
+ pi_1_3 = Math.PI / 3,
30896
+ pi_2_3 = Math.PI * 2 / 3;
30897
+
30898
+ function sinebow(t) {
30899
+ var x;
30900
+ t = (0.5 - t) * Math.PI;
30901
+ c.r = 255 * (x = Math.sin(t)) * x;
30902
+ c.g = 255 * (x = Math.sin(t + pi_1_3)) * x;
30903
+ c.b = 255 * (x = Math.sin(t + pi_2_3)) * x;
30904
+ return c + "";
30905
+ }
30906
+
30907
+ function turbo(t) {
30908
+ t = Math.max(0, Math.min(1, t));
30909
+ return "rgb("
30910
+ + Math.max(0, Math.min(255, Math.round(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))))))) + ", "
30911
+ + Math.max(0, Math.min(255, Math.round(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))))))) + ", "
30912
+ + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66)))))))
30913
+ + ")";
30914
+ }
30915
+
30916
+ function ramp(range) {
30917
+ var n = range.length;
30918
+ return function(t) {
30919
+ return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
30920
+ };
30921
+ }
30922
+
30923
+ var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
30924
+
30925
+ var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
30926
+
30927
+ var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
30928
+
30929
+ var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
30930
+
30931
+ var lib = /*#__PURE__*/Object.freeze({
30932
+ __proto__: null,
30933
+ schemeCategory10: category10,
30934
+ schemeAccent: Accent,
30935
+ schemeDark2: Dark2,
30936
+ schemePaired: Paired,
30937
+ schemePastel1: Pastel1,
30938
+ schemePastel2: Pastel2,
30939
+ schemeSet1: Set1,
30940
+ schemeSet2: Set2,
30941
+ schemeSet3: Set3,
30942
+ schemeTableau10: Tableau10,
30943
+ interpolateBrBG: BrBG,
30944
+ schemeBrBG: scheme$q,
30945
+ interpolatePRGn: PRGn,
30946
+ schemePRGn: scheme$p,
30947
+ interpolatePiYG: PiYG,
30948
+ schemePiYG: scheme$o,
30949
+ interpolatePuOr: PuOr,
30950
+ schemePuOr: scheme$n,
30951
+ interpolateRdBu: RdBu,
30952
+ schemeRdBu: scheme$m,
30953
+ interpolateRdGy: RdGy,
30954
+ schemeRdGy: scheme$l,
30955
+ interpolateRdYlBu: RdYlBu,
30956
+ schemeRdYlBu: scheme$k,
30957
+ interpolateRdYlGn: RdYlGn,
30958
+ schemeRdYlGn: scheme$j,
30959
+ interpolateSpectral: Spectral,
30960
+ schemeSpectral: scheme$i,
30961
+ interpolateBuGn: BuGn,
30962
+ schemeBuGn: scheme$h,
30963
+ interpolateBuPu: BuPu,
30964
+ schemeBuPu: scheme$g,
30965
+ interpolateGnBu: GnBu,
30966
+ schemeGnBu: scheme$f,
30967
+ interpolateOrRd: OrRd,
30968
+ schemeOrRd: scheme$e,
30969
+ interpolatePuBuGn: PuBuGn,
30970
+ schemePuBuGn: scheme$d,
30971
+ interpolatePuBu: PuBu,
30972
+ schemePuBu: scheme$c,
30973
+ interpolatePuRd: PuRd,
30974
+ schemePuRd: scheme$b,
30975
+ interpolateRdPu: RdPu,
30976
+ schemeRdPu: scheme$a,
30977
+ interpolateYlGnBu: YlGnBu,
30978
+ schemeYlGnBu: scheme$9,
30979
+ interpolateYlGn: YlGn,
30980
+ schemeYlGn: scheme$8,
30981
+ interpolateYlOrBr: YlOrBr,
30982
+ schemeYlOrBr: scheme$7,
30983
+ interpolateYlOrRd: YlOrRd,
30984
+ schemeYlOrRd: scheme$6,
30985
+ interpolateBlues: Blues,
30986
+ schemeBlues: scheme$5,
30987
+ interpolateGreens: Greens,
30988
+ schemeGreens: scheme$4,
30989
+ interpolateGreys: Greys,
30990
+ schemeGreys: scheme$3,
30991
+ interpolatePurples: Purples,
30992
+ schemePurples: scheme$2,
30993
+ interpolateReds: Reds,
30994
+ schemeReds: scheme$1,
30995
+ interpolateOranges: Oranges,
30996
+ schemeOranges: scheme,
30997
+ interpolateCividis: cividis,
30998
+ interpolateCubehelixDefault: cubehelix,
30999
+ interpolateRainbow: rainbow,
31000
+ interpolateWarm: warm,
31001
+ interpolateCool: cool,
31002
+ interpolateSinebow: sinebow,
31003
+ interpolateTurbo: turbo,
31004
+ interpolateViridis: viridis,
31005
+ interpolateMagma: magma,
31006
+ interpolateInferno: inferno,
31007
+ interpolatePlasma: plasma
31008
+ });
31009
+
29378
31010
  var index = {
29379
31011
  categorical: [],
29380
31012
  sequential: [],
@@ -29524,7 +31156,7 @@ ${svg}
29524
31156
  function getColorRamp(name, n, stops) {
29525
31157
  initSchemes();
29526
31158
  name = standardName(name);
29527
- var lib = require('d3-scale-chromatic');
31159
+ // var lib = require('d3-scale-chromatic');
29528
31160
  var ramps = lib['scheme' + name];
29529
31161
  var interpolate = lib['interpolate' + name];
29530
31162
  var ramp;
@@ -29833,9 +31465,8 @@ ${svg}
29833
31465
  }
29834
31466
 
29835
31467
  function formatColorsAsHex(colors) {
29836
- var d3 = require('d3-color');
29837
31468
  return colors.map(function(col) {
29838
- var o = d3.color(col);
31469
+ var o = color(col);
29839
31470
  if (!o) stop('Unable to parse color:', col);
29840
31471
  return o.formatHex();
29841
31472
  });
@@ -32649,10 +34280,10 @@ ${svg}
32649
34280
  moduleName = opts.module;
32650
34281
  }
32651
34282
  if (moduleFile) {
32652
- moduleFile = require('path').join(process.cwd(), moduleFile);
34283
+ moduleFile = require$1('path').join(process.cwd(), moduleFile);
32653
34284
  }
32654
34285
  try {
32655
- _module = require(moduleFile || moduleName);
34286
+ _module = require$1(moduleFile || moduleName);
32656
34287
  _module(coreAPI);
32657
34288
  } catch(e) {
32658
34289
  // stop(e);
@@ -33246,6 +34877,7 @@ ${svg}
33246
34877
  // }).join(",") + "}");
33247
34878
  // };
33248
34879
 
34880
+ // Removes points that are far from other points
33249
34881
  cmd.filterPoints = function(lyr, dataset, opts) {
33250
34882
  requireSinglePointLayer(lyr);
33251
34883
  if (opts.group_interval > 0 === false) {
@@ -33260,7 +34892,7 @@ ${svg}
33260
34892
  var index = new Uint8Array(points.length);
33261
34893
  var a, b, c, ai, bi, ci;
33262
34894
  for (var i=0, n=triangles.length; i<n; i+=3) {
33263
- // a, b, c: triangle verticies in CCW order
34895
+ // a, b, c: triangle vertices in CCW order
33264
34896
  ai = triangles[i];
33265
34897
  bi = triangles[i+1];
33266
34898
  ci = triangles[i+2];
@@ -34432,7 +36064,7 @@ ${svg}
34432
36064
  var arcId = o.arcId,
34433
36065
  key = classify(arcId),
34434
36066
  isContinuation, line;
34435
- if (!!key) {
36067
+ if (key) {
34436
36068
  line = key in index ? index[key] : null;
34437
36069
  isContinuation = key == prevKey && o.shapeId == prev.shapeId && o.partId == prev.partId;
34438
36070
  if (!line) {
@@ -34699,7 +36331,7 @@ ${svg}
34699
36331
  // TODO: add more projections
34700
36332
  //
34701
36333
  function expandProjDefn(str, dataset) {
34702
- var mproj = require('mproj');
36334
+ var mproj = require$1('mproj');
34703
36335
  var proj4, params, bbox, isConic2SP, isCentered, decimals;
34704
36336
  if (str in mproj.internal.pj_list === false) {
34705
36337
  // not a bare projection code -- assume valid projection string in other format
@@ -34741,6 +36373,13 @@ ${svg}
34741
36373
  return `+lon_0=${ cx.toFixed(decimals) } +lat_0=${ cy.toFixed(decimals) }`;
34742
36374
  }
34743
36375
 
36376
+ var ProjectionParams = /*#__PURE__*/Object.freeze({
36377
+ __proto__: null,
36378
+ expandProjDefn: expandProjDefn,
36379
+ getConicParams: getConicParams,
36380
+ getCenterParams: getCenterParams
36381
+ });
36382
+
34744
36383
  cmd.proj = function(dataset, catalog, opts) {
34745
36384
  var srcInfo, destInfo, destStr;
34746
36385
  if (opts.init) {
@@ -35105,6 +36744,14 @@ ${svg}
35105
36744
  job.control = null;
35106
36745
  }
35107
36746
 
36747
+ function stopJob(job) {
36748
+ getState(job).stopped = true;
36749
+ }
36750
+
36751
+ function jobIsStopped(job) {
36752
+ return getState(job).stopped === true;
36753
+ }
36754
+
35108
36755
  function inControlBlock(job) {
35109
36756
  return !!getState(job).inControlBlock;
35110
36757
  }
@@ -35173,6 +36820,7 @@ ${svg}
35173
36820
 
35174
36821
  function skipCommand(cmdName, job) {
35175
36822
  // allow all control commands to run
36823
+ if (jobIsStopped(job)) return true;
35176
36824
  if (isControlFlowCommand(cmdName)) return false;
35177
36825
  return inControlBlock(job) && !inActiveBranch(job);
35178
36826
  }
@@ -36575,7 +38223,7 @@ ${svg}
36575
38223
  requireSinglePointLayer(srcLyr);
36576
38224
  var points = getPointsInLayer(srcLyr);
36577
38225
  var maxDist = opts.max_distance ? convertDistanceParam(opts.max_distance, crs) : 1e-3;
36578
- var kdbush = require('kdbush');
38226
+ var kdbush = require$1('kdbush');
36579
38227
  var index = new kdbush(points);
36580
38228
  var lookup = getLookupFunction(index, crs, maxDist);
36581
38229
  var uniqIndex = new IdTestIndex(points.length);
@@ -37101,7 +38749,7 @@ ${svg}
37101
38749
  stop('Expected a non-negative interval parameter');
37102
38750
  }
37103
38751
  if (opts.radius > 0 === false) {
37104
- stop('Expected a non-negative radius parameter');
38752
+ // stop('Expected a non-negative radius parameter');
37105
38753
  }
37106
38754
  // var bbox = getLayerBounds(pointLyr).toArray();
37107
38755
  // Use target dataset, so grids are aligned between layers
@@ -37129,27 +38777,24 @@ ${svg}
37129
38777
  };
37130
38778
 
37131
38779
  function getPolygonDataset(pointLyr, gridBBox, opts) {
37132
- var interval = opts.interval;
37133
38780
  var points = getPointsInLayer(pointLyr);
37134
- var grid = getGridData(gridBBox, interval);
37135
- var lookup = getPointIndex(points, grid, opts.radius);
37136
- var n = grid.cells();
38781
+ var cellSize = opts.interval;
38782
+ var grid = getGridData(gridBBox, cellSize, opts);
38783
+ var pointCircleRadius = getPointCircleRadius(opts);
38784
+ var findPointIdsByCellId = getPointIndex(points, grid, pointCircleRadius);
37137
38785
  var geojson = {
37138
38786
  type: 'FeatureCollection',
37139
38787
  features: []
37140
38788
  };
37141
- var calc = null;
37142
- var cands, center, weight, d;
37143
- if (opts.calc) {
37144
- calc = getJoinCalc(pointLyr.data, opts.calc);
37145
- }
38789
+ var calc = opts.calc ? getJoinCalc(pointLyr.data, opts.calc) : null;
38790
+ var candidateIds, weights, center, weight, d;
37146
38791
 
37147
- for (var i=0; i<n; i++) {
37148
- cands = lookup(i);
37149
- if (!cands.length) continue;
38792
+ for (var i=0, n=grid.cells(); i<n; i++) {
38793
+ candidateIds = findPointIdsByCellId(i);
38794
+ if (!candidateIds.length) continue;
37150
38795
  center = grid.idxToPoint(i);
37151
- d = calcCellProperties(center, cands, points, calc, opts);
37152
- // weight = calcCellWeight(center, cands, points, opts);
38796
+ weights = calcWeights(center, cellSize, points, candidateIds, pointCircleRadius);
38797
+ d = calcCellProperties(candidateIds, weights, calc);
37153
38798
  if (d.weight > 0.05 === false) continue;
37154
38799
  d.id = i;
37155
38800
  geojson.features.push({
@@ -37158,44 +38803,43 @@ ${svg}
37158
38803
  geometry: makeCellPolygon(i, grid, opts)
37159
38804
  });
37160
38805
  }
37161
- var dataset = importGeoJSON(geojson, {});
37162
- return dataset;
38806
+ return importGeoJSON(geojson, {});
37163
38807
  }
37164
38808
 
37165
- function calcCellProperties(center, cands, points, calc, opts) {
37166
- // radius of circle with same area as the cell
37167
- var interval = opts.interval;
37168
- var radius = interval * Math.sqrt(1 / Math.PI);
37169
- var circleArea = Math.PI * opts.radius * opts.radius;
37170
- var cellArea = interval * interval;
37171
- var ids = [];
37172
- var totArea = 0;
37173
- var intersection;
37174
- for (var i=0; i<cands.length; i++) {
37175
- intersection = twoCircleIntersection(center, radius, points[cands[i]], opts.radius);
37176
- if (intersection > 0 === false) continue;
37177
- totArea += intersection;
37178
- ids.push(cands[i]);
37179
- }
37180
- var d = {weight: totArea / cellArea};
38809
+ function getPointCircleRadius(opts) {
38810
+ var cellRadius = opts.interval * Math.sqrt(1 / Math.PI);
38811
+ return opts.radius > 0 ? opts.radius : cellRadius;
38812
+ }
38813
+
38814
+ function calcCellProperties(pointIds, weights, calc) {
38815
+ var hitIds = [];
38816
+ var weight = 0;
38817
+ var partial;
38818
+ var d;
38819
+ for (var i=0; i<pointIds.length; i++) {
38820
+ partial = weights[i];
38821
+ if (partial > 0 === false) continue;
38822
+ weight += partial;
38823
+ hitIds.push(pointIds[i]);
38824
+ }
38825
+ d = {weight: weight};
37181
38826
  if (calc) {
37182
- calc(ids, d);
38827
+ calc(hitIds, d);
37183
38828
  }
37184
38829
  return d;
37185
38830
  }
37186
38831
 
37187
- // function calcCellWeight(center, ids, points, opts) {
37188
- // // radius of circle with same area as the cell
37189
- // var interval = opts.interval;
37190
- // var radius = interval * Math.sqrt(1 / Math.PI);
37191
- // var circleArea = Math.PI * opts.radius * opts.radius;
37192
- // var cellArea = interval * interval;
37193
- // var totArea = 0;
37194
- // for (var i=0; i<ids.length; i++) {
37195
- // totArea += twoCircleIntersection(center, radius, points[ids[i]], opts.radius);
37196
- // }
37197
- // return totArea / cellArea;
37198
- // }
38832
+ function calcWeights(cellCenter, cellSize, points, pointIds, pointRadius) {
38833
+ var weights = [];
38834
+ var cellRadius = cellSize * Math.sqrt(1 / Math.PI); // radius of circle with same area as cell
38835
+ var cellArea = cellSize * cellSize;
38836
+ var w;
38837
+ for (var i=0; i<pointIds.length; i++) {
38838
+ w = twoCircleIntersection(cellCenter, cellRadius, points[pointIds[i]], pointRadius) / cellArea;
38839
+ weights.push(w);
38840
+ }
38841
+ return weights;
38842
+ }
37199
38843
 
37200
38844
  // Source: https://diego.assencio.com/?index=8d6ca3d82151bad815f78addf9b5c1c6
37201
38845
  function twoCircleIntersection(c1, r1, c2, r2) {
@@ -37238,7 +38882,7 @@ ${svg}
37238
38882
  }
37239
38883
 
37240
38884
  function getPointIndex(points, grid, radius) {
37241
- var Flatbush = require('flatbush');
38885
+ var Flatbush = require$1('flatbush');
37242
38886
  var gridIndex = new IdTestIndex(grid.cells());
37243
38887
  var bboxIndex = new Flatbush(points.length);
37244
38888
  var empty = [];
@@ -37250,10 +38894,19 @@ ${svg}
37250
38894
  return function(i) {
37251
38895
  if (!gridIndex.hasId(i)) return empty;
37252
38896
  var bbox = grid.idxToBBox(i);
37253
- return bboxIndex.search.apply(bboxIndex, bbox);
38897
+ var indices = bboxIndex.search.apply(bboxIndex, bbox);
38898
+ return indices;
37254
38899
  };
37255
38900
  }
37256
38901
 
38902
+ function getPointsByIndex(points, indices) {
38903
+ var arr = [];
38904
+ for (var i=0; i<indices.length; i++) {
38905
+ arr.push(points[indices[i]]);
38906
+ }
38907
+ return arr;
38908
+ }
38909
+
37257
38910
  function addPointToGridIndex(p, index, grid) {
37258
38911
  var i = grid.pointToIdx(p);
37259
38912
  var c = grid.idxToCol(i);
@@ -37279,23 +38932,52 @@ ${svg}
37279
38932
  return [p[0] - radius, p[1] - radius, p[0] + radius, p[1] + radius];
37280
38933
  }
37281
38934
 
37282
- function getGridInterpolator(bbox, interval) {
37283
- var sparseArr = [];
37284
- var grid = getGridData(bbox, interval);
37285
-
37286
- }
37287
-
37288
- // TODO: put this in a separate file, use it for other grid-based commands
37289
- // like -dots
37290
- function getGridData(bbox, interval) {
37291
- var xmin = bbox[0] - interval;
37292
- var ymin = bbox[1] - interval;
37293
- var xmax = bbox[2] + interval;
37294
- var ymax = bbox[3] + interval;
37295
- var w = xmax - xmin;
37296
- var h = ymax - ymin;
37297
- var cols = Math.ceil(w / interval);
37298
- var rows = Math.ceil(h / interval);
38935
+ // grid boundaries includes the origin
38936
+ // (this way, grids calculated from different sets of points will all align)
38937
+ function getAlignedRange(minCoord, maxCoord, interval) {
38938
+ var idx = Math.floor(minCoord / interval) - 1;
38939
+ var idx2 = Math.ceil(maxCoord / interval) + 1;
38940
+ return [idx * interval, idx2 * interval];
38941
+ }
38942
+
38943
+ function getCenteredRange(minCoord, maxCoord, interval) {
38944
+ var w = maxCoord - minCoord;
38945
+ var w2 = Math.ceil(w / interval) * interval;
38946
+ var pad = (w2 - w) / 2 + interval;
38947
+ return [minCoord - pad, maxCoord + pad];
38948
+ }
38949
+
38950
+ function getAlignedGridBounds(bbox, interval) {
38951
+ var xx = getAlignedRange(bbox[0], bbox[2], interval);
38952
+ var yy = getAlignedRange(bbox[1], bbox[3], interval);
38953
+ return [xx[0], yy[0], xx[1], yy[1]];
38954
+ }
38955
+
38956
+ function getCenteredGridBounds(bbox, interval) {
38957
+ var xx = getCenteredRange(bbox[0], bbox[2], interval);
38958
+ var yy = getCenteredRange(bbox[1], bbox[3], interval);
38959
+ return [xx[0], yy[0], xx[1], yy[1]];
38960
+ }
38961
+
38962
+ // TODO: Use this function for other grid-based commands
38963
+ function getGridData(bbox, interval, opts) {
38964
+ var extent = opts && opts.aligned ?
38965
+ getAlignedGridBounds(bbox, interval) :
38966
+ getCenteredGridBounds(bbox, interval);
38967
+ var xmin = extent[0];
38968
+ var ymin = extent[1];
38969
+ var w = extent[2] - xmin;
38970
+ var h = extent[3] - ymin;
38971
+ var cols = Math.round(w / interval);
38972
+ var rows = Math.round(h / interval);
38973
+ // var xmin = bbox[0] - interval;
38974
+ // var ymin = bbox[1] - interval;
38975
+ // var xmax = bbox[2] + interval;
38976
+ // var ymax = bbox[3] + interval;
38977
+ // var w = xmax - xmin;
38978
+ // var h = ymax - ymin;
38979
+ // var cols = Math.ceil(w / interval);
38980
+ // var rows = Math.ceil(h / interval);
37299
38981
  function size() {
37300
38982
  return [cols, rows];
37301
38983
  }
@@ -37659,10 +39341,10 @@ ${svg}
37659
39341
  moduleName = opts.module;
37660
39342
  }
37661
39343
  if (moduleFile) {
37662
- moduleFile = require('path').join(process.cwd(), moduleFile);
39344
+ moduleFile = require$1('path').join(process.cwd(), moduleFile);
37663
39345
  }
37664
39346
  try {
37665
- mod = require(moduleFile || moduleName);
39347
+ mod = require$1(moduleFile || moduleName);
37666
39348
  } catch(e) {
37667
39349
  stop(e);
37668
39350
  }
@@ -38833,6 +40515,10 @@ ${svg}
38833
40515
  getSplitNameFunction: getSplitNameFunction
38834
40516
  });
38835
40517
 
40518
+ cmd.stop = function(job) {
40519
+ stopJob(job);
40520
+ };
40521
+
38836
40522
  cmd.svgStyle = function(lyr, dataset, opts) {
38837
40523
  var filter;
38838
40524
  if (!lyr.data) {
@@ -38978,10 +40664,10 @@ ${svg}
38978
40664
  dy = stemLen * Math.cos(theta / 2);
38979
40665
 
38980
40666
  if (stickArrow) {
38981
- stem = getCurvedStemCoords(-ax, -ay, dx, dy, theta);
40667
+ stem = getCurvedStemCoords(-ax, -ay, dx, dy);
38982
40668
  } else {
38983
- var leftStem = getCurvedStemCoords(-ax, -ay, -stemDx + dx, dy, theta);
38984
- var rightStem = getCurvedStemCoords(ax, ay, stemDx + dx, dy, theta);
40669
+ var leftStem = getCurvedStemCoords(-ax, -ay, -stemDx + dx, dy);
40670
+ var rightStem = getCurvedStemCoords(ax, ay, stemDx + dx, dy);
38985
40671
  stem = leftStem.concat(rightStem.reverse());
38986
40672
  }
38987
40673
 
@@ -39025,10 +40711,10 @@ ${svg}
39025
40711
  return coords;
39026
40712
  }
39027
40713
 
39028
- function calcStraightArrowCoords(stemLen, headLen, stemDx, headDx, baseDx) {
39029
- return [[baseDx, 0], [stemDx, stemLen], [headDx, stemLen], [0, stemLen + headLen],
39030
- [-headDx, stemLen], [-stemDx, stemLen], [-baseDx, 0], [baseDx, 0]];
39031
- }
40714
+ // function calcStraightArrowCoords(stemLen, headLen, stemDx, headDx, baseDx) {
40715
+ // return [[baseDx, 0], [stemDx, stemLen], [headDx, stemLen], [0, stemLen + headLen],
40716
+ // [-headDx, stemLen], [-stemDx, stemLen], [-baseDx, 0], [baseDx, 0]];
40717
+ // }
39032
40718
 
39033
40719
  function calcArrowSize(d, stickArrow) {
39034
40720
  // don't display arrows with negative length
@@ -39095,7 +40781,7 @@ ${svg}
39095
40781
 
39096
40782
  // ax, ay: point on the base
39097
40783
  // bx, by: point on the stem
39098
- function getCurvedStemCoords(ax, ay, bx, by, theta0) {
40784
+ function getCurvedStemCoords(ax, ay, bx, by) {
39099
40785
  // case: curved side intrudes into head (because stem is too short)
39100
40786
  if (ay > by) {
39101
40787
  return [[ax * by / ay, by]];
@@ -39818,7 +41504,7 @@ ${svg}
39818
41504
  return name == 'graticule' || name == 'i' || name == 'help' ||
39819
41505
  name == 'point-grid' || name == 'shape' || name == 'rectangle' ||
39820
41506
  name == 'include' || name == 'print' || name == 'comment' || name == 'if' || name == 'elif' ||
39821
- name == 'else' || name == 'endif';
41507
+ name == 'else' || name == 'endif' || name == 'stop';
39822
41508
  }
39823
41509
 
39824
41510
  function runCommand(command, job, cb) {
@@ -40148,6 +41834,9 @@ ${svg}
40148
41834
  } else if (name == 'split') {
40149
41835
  outputLayers = applyCommandToEachLayer(cmd.splitLayer, targetLayers, opts.expression, opts);
40150
41836
 
41837
+ } else if (name == 'stop') {
41838
+ cmd.stop(job);
41839
+
40151
41840
  } else if (name == 'split-on-grid') {
40152
41841
  outputLayers = applyCommandToEachLayer(cmd.splitLayerOnGrid, targetLayers, arcs, opts);
40153
41842
 
@@ -40306,7 +41995,7 @@ ${svg}
40306
41995
  //
40307
41996
  function runCommandsXL(argv) {
40308
41997
  var opts = importRunArgs.apply(null, arguments);
40309
- var mapshaperScript = require('path').join(__dirname, 'bin/mapshaper');
41998
+ var mapshaperScript = require$1('path').join(__dirname, 'bin/mapshaper');
40310
41999
  var gb = parseFloat(opts.options.xl) || 8;
40311
42000
  var err;
40312
42001
  if (gb < 1 || gb > 64) {
@@ -40318,7 +42007,7 @@ ${svg}
40318
42007
  if (!loggingEnabled()) argv += ' -quiet'; // kludge to pass logging setting to subprocess
40319
42008
  var mb = Math.round(gb * 1000);
40320
42009
  var command = [process.execPath, '--max-old-space-size=' + mb, mapshaperScript, argv].join(' ');
40321
- var child = require('child_process').exec(command, {}, function(err, stdout, stderr) {
42010
+ var child = require$1('child_process').exec(command, {}, function(err, stdout, stderr) {
40322
42011
  opts.callback(err);
40323
42012
  });
40324
42013
  child.stdout.pipe(process.stdout);
@@ -40913,7 +42602,6 @@ ${svg}
40913
42602
  // so they can be run by tests and by the GUI.
40914
42603
  // TODO: rewrite tests to import functions directly from modules,
40915
42604
  // export only functions called by the GUI.
40916
-
40917
42605
  var internal = {};
40918
42606
 
40919
42607
  internal.svg = Object.assign({}, SvgStringify, SvgPathUtils, GeojsonToSvg, SvgLabels, SvgSymbols);
@@ -41029,6 +42717,7 @@ ${svg}
41029
42717
  PostSimplifyRepair,
41030
42718
  Proj,
41031
42719
  Projections,
42720
+ ProjectionParams,
41032
42721
  Rectangle,
41033
42722
  Rounding,
41034
42723
  RunCommands,
@@ -41046,7 +42735,7 @@ ${svg}
41046
42735
  Snapping,
41047
42736
  SourceUtils,
41048
42737
  Split,
41049
- State,
42738
+ Env,
41050
42739
  Stash,
41051
42740
  Stringify,
41052
42741
  Svg,
@@ -41062,10 +42751,10 @@ ${svg}
41062
42751
  );
41063
42752
 
41064
42753
  // The entry point for the core mapshaper module
42754
+
41065
42755
  var moduleAPI = Object.assign({
41066
- cli, geom, utils, internal,
41067
- importFile // Adding importFile() for compatibility with old tests; todo: rewrite tests
41068
- }, cmd, coreAPI); // Adding command functions to the top-level module API, for test compatibility
42756
+ cli, cmd, geom, utils, internal,
42757
+ }, coreAPI);
41069
42758
 
41070
42759
  if (typeof module === "object" && module.exports) {
41071
42760
  module.exports = moduleAPI;