(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define([], factory);
	else if(typeof exports === 'object')
		exports["VueVegaEmbed"] = factory();
	else
		root["VueVegaEmbed"] = factory();
})((typeof self !== 'undefined' ? self : this), function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "fb15");
/******/ })
/************************************************************************/
/******/ ({

/***/ "00ee":
/***/ (function(module, exports, __webpack_require__) {

var wellKnownSymbol = __webpack_require__("b622");

var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var test = {};

test[TO_STRING_TAG] = 'z';

module.exports = String(test) === '[object z]';


/***/ }),

/***/ "00fb":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony default export */ __webpack_exports__["a"] = (function(a, b) {
  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
});


/***/ }),

/***/ "0366":
/***/ (function(module, exports, __webpack_require__) {

var aCallable = __webpack_require__("59ed");

// optional / simple context binding
module.exports = function (fn, that, length) {
  aCallable(fn);
  if (that === undefined) return fn;
  switch (length) {
    case 0: return function () {
      return fn.call(that);
    };
    case 1: return function (a) {
      return fn.call(that, a);
    };
    case 2: return function (a, b) {
      return fn.call(that, a, b);
    };
    case 3: return function (a, b, c) {
      return fn.call(that, a, b, c);
    };
  }
  return function (/* ...args */) {
    return fn.apply(that, arguments);
  };
};


/***/ }),

/***/ "0481":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var flattenIntoArray = __webpack_require__("a2bf");
var toObject = __webpack_require__("7b0b");
var lengthOfArrayLike = __webpack_require__("07fa");
var toIntegerOrInfinity = __webpack_require__("5926");
var arraySpeciesCreate = __webpack_require__("65f0");

// `Array.prototype.flat` method
// https://tc39.es/ecma262/#sec-array.prototype.flat
$({ target: 'Array', proto: true }, {
  flat: function flat(/* depthArg = 1 */) {
    var depthArg = arguments.length ? arguments[0] : undefined;
    var O = toObject(this);
    var sourceLen = lengthOfArrayLike(O);
    var A = arraySpeciesCreate(O, 0);
    A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));
    return A;
  }
});


/***/ }),

/***/ "04d1":
/***/ (function(module, exports, __webpack_require__) {

var userAgent = __webpack_require__("342f");

var firefox = userAgent.match(/firefox\/(\d+)/i);

module.exports = !!firefox && +firefox[1];


/***/ }),

/***/ "0538":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var aCallable = __webpack_require__("59ed");
var isObject = __webpack_require__("861d");

var slice = [].slice;
var factories = {};

var construct = function (C, argsLength, args) {
  if (!(argsLength in factories)) {
    for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
    // eslint-disable-next-line no-new-func -- we have no proper alternatives, IE8- only
    factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')');
  } return factories[argsLength](C, args);
};

// `Function.prototype.bind` method implementation
// https://tc39.es/ecma262/#sec-function.prototype.bind
module.exports = Function.bind || function bind(that /* , ...args */) {
  var fn = aCallable(this);
  var partArgs = slice.call(arguments, 1);
  var boundFunction = function bound(/* args... */) {
    var args = partArgs.concat(slice.call(arguments));
    return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args);
  };
  if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype;
  return boundFunction;
};


/***/ }),

/***/ "057f":
/***/ (function(module, exports, __webpack_require__) {

/* eslint-disable es/no-object-getownpropertynames -- safe */
var toIndexedObject = __webpack_require__("fc6a");
var $getOwnPropertyNames = __webpack_require__("241c").f;

var toString = {}.toString;

var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  ? Object.getOwnPropertyNames(window) : [];

var getWindowNames = function (it) {
  try {
    return $getOwnPropertyNames(it);
  } catch (error) {
    return windowNames.slice();
  }
};

// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
module.exports.f = function getOwnPropertyNames(it) {
  return windowNames && toString.call(it) == '[object Window]'
    ? getWindowNames(it)
    : $getOwnPropertyNames(toIndexedObject(it));
};


/***/ }),

/***/ "06be":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const major = (a, loose) => new SemVer(a, loose).major
module.exports = major


/***/ }),

/***/ "06cf":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var propertyIsEnumerableModule = __webpack_require__("d1e7");
var createPropertyDescriptor = __webpack_require__("5c6c");
var toIndexedObject = __webpack_require__("fc6a");
var toPropertyKey = __webpack_require__("a04b");
var hasOwn = __webpack_require__("1a2d");
var IE8_DOM_DEFINE = __webpack_require__("0cfb");

// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  O = toIndexedObject(O);
  P = toPropertyKey(P);
  if (IE8_DOM_DEFINE) try {
    return $getOwnPropertyDescriptor(O, P);
  } catch (error) { /* empty */ }
  if (hasOwn(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
};


/***/ }),

/***/ "07ac":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var $values = __webpack_require__("6f53").values;

// `Object.values` method
// https://tc39.es/ecma262/#sec-object.values
$({ target: 'Object', stat: true }, {
  values: function values(O) {
    return $values(O);
  }
});


/***/ }),

/***/ "07fa":
/***/ (function(module, exports, __webpack_require__) {

var toLength = __webpack_require__("50c4");

// `LengthOfArrayLike` abstract operation
// https://tc39.es/ecma262/#sec-lengthofarraylike
module.exports = function (obj) {
  return toLength(obj.length);
};


/***/ }),

/***/ "09b8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return formatSpecifier; });
/* unused harmony export FormatSpecifier */
// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;

function formatSpecifier(specifier) {
  if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
  var match;
  return new FormatSpecifier({
    fill: match[1],
    align: match[2],
    sign: match[3],
    symbol: match[4],
    zero: match[5],
    width: match[6],
    comma: match[7],
    precision: match[8] && match[8].slice(1),
    trim: match[9],
    type: match[10]
  });
}

formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof

function FormatSpecifier(specifier) {
  this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
  this.align = specifier.align === undefined ? ">" : specifier.align + "";
  this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
  this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
  this.zero = !!specifier.zero;
  this.width = specifier.width === undefined ? undefined : +specifier.width;
  this.comma = !!specifier.comma;
  this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
  this.trim = !!specifier.trim;
  this.type = specifier.type === undefined ? "" : specifier.type + "";
}

FormatSpecifier.prototype.toString = function() {
  return this.fill
      + this.align
      + this.sign
      + this.symbol
      + (this.zero ? "0" : "")
      + (this.width === undefined ? "" : Math.max(1, this.width | 0))
      + (this.comma ? "," : "")
      + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
      + (this.trim ? "~" : "")
      + this.type;
};


/***/ }),

/***/ "0ac8":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var expm1 = __webpack_require__("8eb5");

// `Math.expm1` method
// https://tc39.es/ecma262/#sec-math.expm1
// eslint-disable-next-line es/no-math-expm1 -- required for testing
$({ target: 'Math', stat: true, forced: expm1 != Math.expm1 }, { expm1: expm1 });


/***/ }),

/***/ "0b25":
/***/ (function(module, exports, __webpack_require__) {

var toIntegerOrInfinity = __webpack_require__("5926");
var toLength = __webpack_require__("50c4");

// `ToIndex` abstract operation
// https://tc39.es/ecma262/#sec-toindex
module.exports = function (it) {
  if (it === undefined) return 0;
  var number = toIntegerOrInfinity(it);
  var length = toLength(number);
  if (number !== length) throw RangeError('Wrong length or index');
  return length;
};


/***/ }),

/***/ "0b42":
/***/ (function(module, exports, __webpack_require__) {

var isArray = __webpack_require__("e8b5");
var isConstructor = __webpack_require__("68ee");
var isObject = __webpack_require__("861d");
var wellKnownSymbol = __webpack_require__("b622");

var SPECIES = wellKnownSymbol('species');

// a part of `ArraySpeciesCreate` abstract operation
// https://tc39.es/ecma262/#sec-arrayspeciescreate
module.exports = function (originalArray) {
  var C;
  if (isArray(originalArray)) {
    C = originalArray.constructor;
    // cross-realm fallback
    if (isConstructor(C) && (C === Array || isArray(C.prototype))) C = undefined;
    else if (isObject(C)) {
      C = C[SPECIES];
      if (C === null) C = undefined;
    }
  } return C === undefined ? Array : C;
};


/***/ }),

/***/ "0cb2":
/***/ (function(module, exports, __webpack_require__) {

var toObject = __webpack_require__("7b0b");

var floor = Math.floor;
var replace = ''.replace;
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;

// `GetSubstitution` abstract operation
// https://tc39.es/ecma262/#sec-getsubstitution
module.exports = function (matched, str, position, captures, namedCaptures, replacement) {
  var tailPos = position + matched.length;
  var m = captures.length;
  var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  if (namedCaptures !== undefined) {
    namedCaptures = toObject(namedCaptures);
    symbols = SUBSTITUTION_SYMBOLS;
  }
  return replace.call(replacement, symbols, function (match, ch) {
    var capture;
    switch (ch.charAt(0)) {
      case '$': return '$';
      case '&': return matched;
      case '`': return str.slice(0, position);
      case "'": return str.slice(tailPos);
      case '<':
        capture = namedCaptures[ch.slice(1, -1)];
        break;
      default: // \d\d?
        var n = +ch;
        if (n === 0) return match;
        if (n > m) {
          var f = floor(n / 10);
          if (f === 0) return match;
          if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
          return match;
        }
        capture = captures[n - 1];
    }
    return capture === undefined ? '' : capture;
  });
};


/***/ }),

/***/ "0cfb":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var fails = __webpack_require__("d039");
var createElement = __webpack_require__("cc12");

// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
  // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
  return Object.defineProperty(createElement('div'), 'a', {
    get: function () { return 7; }
  }).a != 7;
});


/***/ }),

/***/ "0d03":
/***/ (function(module, exports, __webpack_require__) {

var redefine = __webpack_require__("6eeb");

var DatePrototype = Date.prototype;
var INVALID_DATE = 'Invalid Date';
var TO_STRING = 'toString';
var nativeDateToString = DatePrototype[TO_STRING];
var getTime = DatePrototype.getTime;

// `Date.prototype.toString` method
// https://tc39.es/ecma262/#sec-date.prototype.tostring
if (String(new Date(NaN)) != INVALID_DATE) {
  redefine(DatePrototype, TO_STRING, function toString() {
    var value = getTime.call(this);
    // eslint-disable-next-line no-self-compare -- NaN check
    return value === value ? nativeDateToString.call(this) : INVALID_DATE;
  });
}


/***/ }),

/***/ "0d51":
/***/ (function(module, exports) {

module.exports = function (argument) {
  try {
    return String(argument);
  } catch (error) {
    return 'Object';
  }
};


/***/ }),

/***/ "0d7c":
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(process) {const debug = (
  typeof process === 'object' &&
  Object({"NODE_ENV":"production","BASE_URL":"/"}) &&
  Object({"NODE_ENV":"production","BASE_URL":"/"}).NODE_DEBUG &&
  /\bsemver\b/i.test(Object({"NODE_ENV":"production","BASE_URL":"/"}).NODE_DEBUG)
) ? (...args) => console.error('SEMVER', ...args)
  : () => {}

module.exports = debug

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("4362")))

/***/ }),

/***/ "0e49":
/***/ (function(module, exports, __webpack_require__) {

const compare = __webpack_require__("f06c")
const gte = (a, b, loose) => compare(a, b, loose) >= 0
module.exports = gte


/***/ }),

/***/ "107c":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var global = __webpack_require__("da84");

// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
var $RegExp = global.RegExp;

module.exports = fails(function () {
  var re = $RegExp('(?<a>b)', 'g');
  return re.exec('b').groups.a !== 'b' ||
    'b'.replace(re, '$<a>c') !== 'bc';
});


/***/ }),

/***/ "1148":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var toIntegerOrInfinity = __webpack_require__("5926");
var toString = __webpack_require__("577e");
var requireObjectCoercible = __webpack_require__("1d80");

// `String.prototype.repeat` method implementation
// https://tc39.es/ecma262/#sec-string.prototype.repeat
module.exports = function repeat(count) {
  var str = toString(requireObjectCoercible(this));
  var result = '';
  var n = toIntegerOrInfinity(count);
  if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');
  for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
  return result;
};


/***/ }),

/***/ "1231":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return format; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return formatPrefix; });
/* unused harmony export default */
/* harmony import */ var _locale_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("b170");


var locale;
var format;
var formatPrefix;

defaultLocale({
  thousands: ",",
  grouping: [3],
  currency: ["$", ""]
});

function defaultLocale(definition) {
  locale = Object(_locale_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(definition);
  format = locale.format;
  formatPrefix = locale.formatPrefix;
  return locale;
}


/***/ }),

/***/ "1276":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var fixRegExpWellKnownSymbolLogic = __webpack_require__("d784");
var isRegExp = __webpack_require__("44e7");
var anObject = __webpack_require__("825a");
var requireObjectCoercible = __webpack_require__("1d80");
var speciesConstructor = __webpack_require__("4840");
var advanceStringIndex = __webpack_require__("8aa5");
var toLength = __webpack_require__("50c4");
var toString = __webpack_require__("577e");
var getMethod = __webpack_require__("dc4a");
var callRegExpExec = __webpack_require__("14c3");
var regexpExec = __webpack_require__("9263");
var stickyHelpers = __webpack_require__("9f7f");
var fails = __webpack_require__("d039");

var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
var arrayPush = [].push;
var min = Math.min;
var MAX_UINT32 = 0xFFFFFFFF;

// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
// Weex JS has frozen built-in prototypes, so use try / catch wrapper
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  // eslint-disable-next-line regexp/no-empty-group -- required for testing
  var re = /(?:)/;
  var originalExec = re.exec;
  re.exec = function () { return originalExec.apply(this, arguments); };
  var result = 'ab'.split(re);
  return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
});

// @@split logic
fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
  var internalSplit;
  if (
    'abbc'.split(/(b)*/)[1] == 'c' ||
    // eslint-disable-next-line regexp/no-empty-group -- required for testing
    'test'.split(/(?:)/, -1).length != 4 ||
    'ab'.split(/(?:ab)*/).length != 2 ||
    '.'.split(/(.?)(.?)/).length != 4 ||
    // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
    '.'.split(/()()/).length > 1 ||
    ''.split(/.?/).length
  ) {
    // based on es5-shim implementation, need to rework it
    internalSplit = function (separator, limit) {
      var string = toString(requireObjectCoercible(this));
      var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
      if (lim === 0) return [];
      if (separator === undefined) return [string];
      // If `separator` is not a regex, use native split
      if (!isRegExp(separator)) {
        return nativeSplit.call(string, separator, lim);
      }
      var output = [];
      var flags = (separator.ignoreCase ? 'i' : '') +
                  (separator.multiline ? 'm' : '') +
                  (separator.unicode ? 'u' : '') +
                  (separator.sticky ? 'y' : '');
      var lastLastIndex = 0;
      // Make `global` and avoid `lastIndex` issues by working with a copy
      var separatorCopy = new RegExp(separator.source, flags + 'g');
      var match, lastIndex, lastLength;
      while (match = regexpExec.call(separatorCopy, string)) {
        lastIndex = separatorCopy.lastIndex;
        if (lastIndex > lastLastIndex) {
          output.push(string.slice(lastLastIndex, match.index));
          if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
          lastLength = match[0].length;
          lastLastIndex = lastIndex;
          if (output.length >= lim) break;
        }
        if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
      }
      if (lastLastIndex === string.length) {
        if (lastLength || !separatorCopy.test('')) output.push('');
      } else output.push(string.slice(lastLastIndex));
      return output.length > lim ? output.slice(0, lim) : output;
    };
  // Chakra, V8
  } else if ('0'.split(undefined, 0).length) {
    internalSplit = function (separator, limit) {
      return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
    };
  } else internalSplit = nativeSplit;

  return [
    // `String.prototype.split` method
    // https://tc39.es/ecma262/#sec-string.prototype.split
    function split(separator, limit) {
      var O = requireObjectCoercible(this);
      var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT);
      return splitter
        ? splitter.call(separator, O, limit)
        : internalSplit.call(toString(O), separator, limit);
    },
    // `RegExp.prototype[@@split]` method
    // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
    //
    // NOTE: This cannot be properly polyfilled in engines that don't support
    // the 'y' flag.
    function (string, limit) {
      var rx = anObject(this);
      var S = toString(string);
      var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);

      if (res.done) return res.value;

      var C = speciesConstructor(rx, RegExp);

      var unicodeMatching = rx.unicode;
      var flags = (rx.ignoreCase ? 'i' : '') +
                  (rx.multiline ? 'm' : '') +
                  (rx.unicode ? 'u' : '') +
                  (UNSUPPORTED_Y ? 'g' : 'y');

      // ^(? + rx + ) is needed, in combination with some S slicing, to
      // simulate the 'y' flag.
      var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags);
      var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
      if (lim === 0) return [];
      if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
      var p = 0;
      var q = 0;
      var A = [];
      while (q < S.length) {
        splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
        var z = callRegExpExec(splitter, UNSUPPORTED_Y ? S.slice(q) : S);
        var e;
        if (
          z === null ||
          (e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
        ) {
          q = advanceStringIndex(S, q, unicodeMatching);
        } else {
          A.push(S.slice(p, q));
          if (A.length === lim) return A;
          for (var i = 1; i <= z.length - 1; i++) {
            A.push(z[i]);
            if (A.length === lim) return A;
          }
          q = p = e;
        }
      }
      A.push(S.slice(p));
      return A;
    }
  ];
}, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);


/***/ }),

/***/ "129f":
/***/ (function(module, exports) {

// `SameValue` abstract operation
// https://tc39.es/ecma262/#sec-samevalue
// eslint-disable-next-line es/no-object-is -- safe
module.exports = Object.is || function is(x, y) {
  // eslint-disable-next-line no-self-compare -- NaN check
  return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
};


/***/ }),

/***/ "131a":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var setPrototypeOf = __webpack_require__("d2bb");

// `Object.setPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.setprototypeof
$({ target: 'Object', stat: true }, {
  setPrototypeOf: setPrototypeOf
});


/***/ }),

/***/ "13d5":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var $reduce = __webpack_require__("d58f").left;
var arrayMethodIsStrict = __webpack_require__("a640");
var CHROME_VERSION = __webpack_require__("2d00");
var IS_NODE = __webpack_require__("605d");

var STRICT_METHOD = arrayMethodIsStrict('reduce');
// Chrome 80-82 has a critical bug
// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;

// `Array.prototype.reduce` method
// https://tc39.es/ecma262/#sec-array.prototype.reduce
$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
  reduce: function reduce(callbackfn /* , initialValue */) {
    return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
  }
});


/***/ }),

/***/ "14c3":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var isCallable = __webpack_require__("1626");
var classof = __webpack_require__("c6b6");
var regexpExec = __webpack_require__("9263");

// `RegExpExec` abstract operation
// https://tc39.es/ecma262/#sec-regexpexec
module.exports = function (R, S) {
  var exec = R.exec;
  if (isCallable(exec)) {
    var result = exec.call(R, S);
    if (result !== null) anObject(result);
    return result;
  }
  if (classof(R) === 'RegExp') return regexpExec.call(R, S);
  throw TypeError('RegExp#exec called on incompatible receiver');
};


/***/ }),

/***/ "159b":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var DOMIterables = __webpack_require__("fdbc");
var DOMTokenListPrototype = __webpack_require__("785a");
var forEach = __webpack_require__("17c2");
var createNonEnumerableProperty = __webpack_require__("9112");

var handlePrototype = function (CollectionPrototype) {
  // some Chrome versions have non-configurable methods on DOMTokenList
  if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
    createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
  } catch (error) {
    CollectionPrototype.forEach = forEach;
  }
};

for (var COLLECTION_NAME in DOMIterables) {
  if (DOMIterables[COLLECTION_NAME]) {
    handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype);
  }
}

handlePrototype(DOMTokenListPrototype);


/***/ }),

/***/ "1626":
/***/ (function(module, exports) {

// `IsCallable` abstract operation
// https://tc39.es/ecma262/#sec-iscallable
module.exports = function (argument) {
  return typeof argument === 'function';
};


/***/ }),

/***/ "1738":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return durationSecond; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return durationMinute; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return durationHour; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return durationDay; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return durationWeek; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return durationMonth; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return durationYear; });
const durationSecond = 1000;
const durationMinute = durationSecond * 60;
const durationHour = durationMinute * 60;
const durationDay = durationHour * 24;
const durationWeek = durationDay * 7;
const durationMonth = durationDay * 30;
const durationYear = durationDay * 365;


/***/ }),

/***/ "17c2":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $forEach = __webpack_require__("b727").forEach;
var arrayMethodIsStrict = __webpack_require__("a640");

var STRICT_METHOD = arrayMethodIsStrict('forEach');

// `Array.prototype.forEach` method implementation
// https://tc39.es/ecma262/#sec-array.prototype.foreach
module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
  return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
} : [].forEach;


/***/ }),

/***/ "1809":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export milliseconds */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");


var millisecond = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function() {
  // noop
}, function(date, step) {
  date.setTime(+date + step);
}, function(start, end) {
  return end - start;
});

// An optimized implementation for this simple case.
millisecond.every = function(k) {
  k = Math.floor(k);
  if (!isFinite(k) || !(k > 0)) return null;
  if (!(k > 1)) return millisecond;
  return Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
    date.setTime(Math.floor(date / k) * k);
  }, function(date, step) {
    date.setTime(+date + step * k);
  }, function(start, end) {
    return (end - start) / k;
  });
};

/* harmony default export */ __webpack_exports__["a"] = (millisecond);
var milliseconds = millisecond.range;


/***/ }),

/***/ "18a5":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var createHTML = __webpack_require__("857a");
var forcedStringHTMLMethod = __webpack_require__("af03");

// `String.prototype.anchor` method
// https://tc39.es/ecma262/#sec-string.prototype.anchor
$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('anchor') }, {
  anchor: function anchor(name) {
    return createHTML(this, 'a', 'name', name);
  }
});


/***/ }),

/***/ "18e2":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return newInterval; });
var t0 = new Date,
    t1 = new Date;

function newInterval(floori, offseti, count, field) {

  function interval(date) {
    return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;
  }

  interval.floor = function(date) {
    return floori(date = new Date(+date)), date;
  };

  interval.ceil = function(date) {
    return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
  };

  interval.round = function(date) {
    var d0 = interval(date),
        d1 = interval.ceil(date);
    return date - d0 < d1 - date ? d0 : d1;
  };

  interval.offset = function(date, step) {
    return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
  };

  interval.range = function(start, stop, step) {
    var range = [], previous;
    start = interval.ceil(start);
    step = step == null ? 1 : Math.floor(step);
    if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
    do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
    while (previous < start && start < stop);
    return range;
  };

  interval.filter = function(test) {
    return newInterval(function(date) {
      if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
    }, function(date, step) {
      if (date >= date) {
        if (step < 0) while (++step <= 0) {
          while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
        } else while (--step >= 0) {
          while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
        }
      }
    });
  };

  if (count) {
    interval.count = function(start, end) {
      t0.setTime(+start), t1.setTime(+end);
      floori(t0), floori(t1);
      return Math.floor(count(t0, t1));
    };

    interval.every = function(step) {
      step = Math.floor(step);
      return !isFinite(step) || !(step > 0) ? null
          : !(step > 1) ? interval
          : interval.filter(field
              ? function(d) { return field(d) % step === 0; }
              : function(d) { return interval.count(0, d) % step === 0; });
    };
  }

  return interval;
}


/***/ }),

/***/ "19aa":
/***/ (function(module, exports) {

module.exports = function (it, Constructor, name) {
  if (it instanceof Constructor) return it;
  throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
};


/***/ }),

/***/ "1a2d":
/***/ (function(module, exports, __webpack_require__) {

var toObject = __webpack_require__("7b0b");

var hasOwnProperty = {}.hasOwnProperty;

// `HasOwnProperty` abstract operation
// https://tc39.es/ecma262/#sec-hasownproperty
module.exports = Object.hasOwn || function hasOwn(it, key) {
  return hasOwnProperty.call(toObject(it), key);
};


/***/ }),

/***/ "1be4":
/***/ (function(module, exports, __webpack_require__) {

var getBuiltIn = __webpack_require__("d066");

module.exports = getBuiltIn('document', 'documentElement');


/***/ }),

/***/ "1c7e":
/***/ (function(module, exports, __webpack_require__) {

var wellKnownSymbol = __webpack_require__("b622");

var ITERATOR = wellKnownSymbol('iterator');
var SAFE_CLOSING = false;

try {
  var called = 0;
  var iteratorWithReturn = {
    next: function () {
      return { done: !!called++ };
    },
    'return': function () {
      SAFE_CLOSING = true;
    }
  };
  iteratorWithReturn[ITERATOR] = function () {
    return this;
  };
  // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
  Array.from(iteratorWithReturn, function () { throw 2; });
} catch (error) { /* empty */ }

module.exports = function (exec, SKIP_CLOSING) {
  if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
  var ITERATION_SUPPORT = false;
  try {
    var object = {};
    object[ITERATOR] = function () {
      return {
        next: function () {
          return { done: ITERATION_SUPPORT = true };
        }
      };
    };
    exec(object);
  } catch (error) { /* empty */ }
  return ITERATION_SUPPORT;
};


/***/ }),

/***/ "1cdc":
/***/ (function(module, exports, __webpack_require__) {

var userAgent = __webpack_require__("342f");

module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);


/***/ }),

/***/ "1d80":
/***/ (function(module, exports) {

// `RequireObjectCoercible` abstract operation
// https://tc39.es/ecma262/#sec-requireobjectcoercible
module.exports = function (it) {
  if (it == undefined) throw TypeError("Can't call method on " + it);
  return it;
};


/***/ }),

/***/ "1dde":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var wellKnownSymbol = __webpack_require__("b622");
var V8_VERSION = __webpack_require__("2d00");

var SPECIES = wellKnownSymbol('species');

module.exports = function (METHOD_NAME) {
  // We can't use this feature detection in V8 since it causes
  // deoptimization and serious performance degradation
  // https://github.com/zloirock/core-js/issues/677
  return V8_VERSION >= 51 || !fails(function () {
    var array = [];
    var constructor = array.constructor = {};
    constructor[SPECIES] = function () {
      return { foo: 1 };
    };
    return array[METHOD_NAME](Boolean).foo !== 1;
  });
};


/***/ }),

/***/ "1ec1":
/***/ (function(module, exports) {

var log = Math.log;

// `Math.log1p` method implementation
// https://tc39.es/ecma262/#sec-math.log1p
// eslint-disable-next-line es/no-math-log1p -- safe
module.exports = Math.log1p || function log1p(x) {
  return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
};


/***/ }),

/***/ "1f03":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

module.exports = function (Yallist) {
  Yallist.prototype[Symbol.iterator] = function* () {
    for (let walker = this.head; walker; walker = walker.next) {
      yield walker.value
    }
  }
}


/***/ }),

/***/ "1f25":
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// A linked list to keep track of recently-used-ness
const Yallist = __webpack_require__("5cf7")

const MAX = Symbol('max')
const LENGTH = Symbol('length')
const LENGTH_CALCULATOR = Symbol('lengthCalculator')
const ALLOW_STALE = Symbol('allowStale')
const MAX_AGE = Symbol('maxAge')
const DISPOSE = Symbol('dispose')
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
const LRU_LIST = Symbol('lruList')
const CACHE = Symbol('cache')
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')

const naiveLength = () => 1

// lruList is a yallist where the head is the youngest
// item, and the tail is the oldest.  the list contains the Hit
// objects as the entries.
// Each Hit object has a reference to its Yallist.Node.  This
// never changes.
//
// cache is a Map (or PseudoMap) that matches the keys to
// the Yallist.Node object.
class LRUCache {
  constructor (options) {
    if (typeof options === 'number')
      options = { max: options }

    if (!options)
      options = {}

    if (options.max && (typeof options.max !== 'number' || options.max < 0))
      throw new TypeError('max must be a non-negative number')
    // Kind of weird to have a default max of Infinity, but oh well.
    const max = this[MAX] = options.max || Infinity

    const lc = options.length || naiveLength
    this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
    this[ALLOW_STALE] = options.stale || false
    if (options.maxAge && typeof options.maxAge !== 'number')
      throw new TypeError('maxAge must be a number')
    this[MAX_AGE] = options.maxAge || 0
    this[DISPOSE] = options.dispose
    this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
    this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
    this.reset()
  }

  // resize the cache when the max changes.
  set max (mL) {
    if (typeof mL !== 'number' || mL < 0)
      throw new TypeError('max must be a non-negative number')

    this[MAX] = mL || Infinity
    trim(this)
  }
  get max () {
    return this[MAX]
  }

  set allowStale (allowStale) {
    this[ALLOW_STALE] = !!allowStale
  }
  get allowStale () {
    return this[ALLOW_STALE]
  }

  set maxAge (mA) {
    if (typeof mA !== 'number')
      throw new TypeError('maxAge must be a non-negative number')

    this[MAX_AGE] = mA
    trim(this)
  }
  get maxAge () {
    return this[MAX_AGE]
  }

  // resize the cache when the lengthCalculator changes.
  set lengthCalculator (lC) {
    if (typeof lC !== 'function')
      lC = naiveLength

    if (lC !== this[LENGTH_CALCULATOR]) {
      this[LENGTH_CALCULATOR] = lC
      this[LENGTH] = 0
      this[LRU_LIST].forEach(hit => {
        hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
        this[LENGTH] += hit.length
      })
    }
    trim(this)
  }
  get lengthCalculator () { return this[LENGTH_CALCULATOR] }

  get length () { return this[LENGTH] }
  get itemCount () { return this[LRU_LIST].length }

  rforEach (fn, thisp) {
    thisp = thisp || this
    for (let walker = this[LRU_LIST].tail; walker !== null;) {
      const prev = walker.prev
      forEachStep(this, fn, walker, thisp)
      walker = prev
    }
  }

  forEach (fn, thisp) {
    thisp = thisp || this
    for (let walker = this[LRU_LIST].head; walker !== null;) {
      const next = walker.next
      forEachStep(this, fn, walker, thisp)
      walker = next
    }
  }

  keys () {
    return this[LRU_LIST].toArray().map(k => k.key)
  }

  values () {
    return this[LRU_LIST].toArray().map(k => k.value)
  }

  reset () {
    if (this[DISPOSE] &&
        this[LRU_LIST] &&
        this[LRU_LIST].length) {
      this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
    }

    this[CACHE] = new Map() // hash of items by key
    this[LRU_LIST] = new Yallist() // list of items in order of use recency
    this[LENGTH] = 0 // length of items in the list
  }

  dump () {
    return this[LRU_LIST].map(hit =>
      isStale(this, hit) ? false : {
        k: hit.key,
        v: hit.value,
        e: hit.now + (hit.maxAge || 0)
      }).toArray().filter(h => h)
  }

  dumpLru () {
    return this[LRU_LIST]
  }

  set (key, value, maxAge) {
    maxAge = maxAge || this[MAX_AGE]

    if (maxAge && typeof maxAge !== 'number')
      throw new TypeError('maxAge must be a number')

    const now = maxAge ? Date.now() : 0
    const len = this[LENGTH_CALCULATOR](value, key)

    if (this[CACHE].has(key)) {
      if (len > this[MAX]) {
        del(this, this[CACHE].get(key))
        return false
      }

      const node = this[CACHE].get(key)
      const item = node.value

      // dispose of the old one before overwriting
      // split out into 2 ifs for better coverage tracking
      if (this[DISPOSE]) {
        if (!this[NO_DISPOSE_ON_SET])
          this[DISPOSE](key, item.value)
      }

      item.now = now
      item.maxAge = maxAge
      item.value = value
      this[LENGTH] += len - item.length
      item.length = len
      this.get(key)
      trim(this)
      return true
    }

    const hit = new Entry(key, value, len, now, maxAge)

    // oversized objects fall out of cache automatically.
    if (hit.length > this[MAX]) {
      if (this[DISPOSE])
        this[DISPOSE](key, value)

      return false
    }

    this[LENGTH] += hit.length
    this[LRU_LIST].unshift(hit)
    this[CACHE].set(key, this[LRU_LIST].head)
    trim(this)
    return true
  }

  has (key) {
    if (!this[CACHE].has(key)) return false
    const hit = this[CACHE].get(key).value
    return !isStale(this, hit)
  }

  get (key) {
    return get(this, key, true)
  }

  peek (key) {
    return get(this, key, false)
  }

  pop () {
    const node = this[LRU_LIST].tail
    if (!node)
      return null

    del(this, node)
    return node.value
  }

  del (key) {
    del(this, this[CACHE].get(key))
  }

  load (arr) {
    // reset the cache
    this.reset()

    const now = Date.now()
    // A previous serialized cache has the most recent items first
    for (let l = arr.length - 1; l >= 0; l--) {
      const hit = arr[l]
      const expiresAt = hit.e || 0
      if (expiresAt === 0)
        // the item was created without expiration in a non aged cache
        this.set(hit.k, hit.v)
      else {
        const maxAge = expiresAt - now
        // dont add already expired items
        if (maxAge > 0) {
          this.set(hit.k, hit.v, maxAge)
        }
      }
    }
  }

  prune () {
    this[CACHE].forEach((value, key) => get(this, key, false))
  }
}

const get = (self, key, doUse) => {
  const node = self[CACHE].get(key)
  if (node) {
    const hit = node.value
    if (isStale(self, hit)) {
      del(self, node)
      if (!self[ALLOW_STALE])
        return undefined
    } else {
      if (doUse) {
        if (self[UPDATE_AGE_ON_GET])
          node.value.now = Date.now()
        self[LRU_LIST].unshiftNode(node)
      }
    }
    return hit.value
  }
}

const isStale = (self, hit) => {
  if (!hit || (!hit.maxAge && !self[MAX_AGE]))
    return false

  const diff = Date.now() - hit.now
  return hit.maxAge ? diff > hit.maxAge
    : self[MAX_AGE] && (diff > self[MAX_AGE])
}

const trim = self => {
  if (self[LENGTH] > self[MAX]) {
    for (let walker = self[LRU_LIST].tail;
      self[LENGTH] > self[MAX] && walker !== null;) {
      // We know that we're about to delete this one, and also
      // what the next least recently used key will be, so just
      // go ahead and set it now.
      const prev = walker.prev
      del(self, walker)
      walker = prev
    }
  }
}

const del = (self, node) => {
  if (node) {
    const hit = node.value
    if (self[DISPOSE])
      self[DISPOSE](hit.key, hit.value)

    self[LENGTH] -= hit.length
    self[CACHE].delete(hit.key)
    self[LRU_LIST].removeNode(node)
  }
}

class Entry {
  constructor (key, value, length, now, maxAge) {
    this.key = key
    this.value = value
    this.length = length
    this.now = now
    this.maxAge = maxAge || 0
  }
}

const forEachStep = (self, fn, node, thisp) => {
  let hit = node.value
  if (isStale(self, hit)) {
    del(self, node)
    if (!self[ALLOW_STALE])
      hit = undefined
  }
  if (hit)
    fn.call(thisp, hit.value, hit.key, self)
}

module.exports = LRUCache


/***/ }),

/***/ "1fb5":
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.byteLength = byteLength
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray

var lookup = []
var revLookup = []
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array

var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
for (var i = 0, len = code.length; i < len; ++i) {
  lookup[i] = code[i]
  revLookup[code.charCodeAt(i)] = i
}

// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63

function getLens (b64) {
  var len = b64.length

  if (len % 4 > 0) {
    throw new Error('Invalid string. Length must be a multiple of 4')
  }

  // Trim off extra bytes after placeholder bytes are found
  // See: https://github.com/beatgammit/base64-js/issues/42
  var validLen = b64.indexOf('=')
  if (validLen === -1) validLen = len

  var placeHoldersLen = validLen === len
    ? 0
    : 4 - (validLen % 4)

  return [validLen, placeHoldersLen]
}

// base64 is 4/3 + up to two characters of the original data
function byteLength (b64) {
  var lens = getLens(b64)
  var validLen = lens[0]
  var placeHoldersLen = lens[1]
  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}

function _byteLength (b64, validLen, placeHoldersLen) {
  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}

function toByteArray (b64) {
  var tmp
  var lens = getLens(b64)
  var validLen = lens[0]
  var placeHoldersLen = lens[1]

  var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))

  var curByte = 0

  // if there are placeholders, only get up to the last complete 4 chars
  var len = placeHoldersLen > 0
    ? validLen - 4
    : validLen

  var i
  for (i = 0; i < len; i += 4) {
    tmp =
      (revLookup[b64.charCodeAt(i)] << 18) |
      (revLookup[b64.charCodeAt(i + 1)] << 12) |
      (revLookup[b64.charCodeAt(i + 2)] << 6) |
      revLookup[b64.charCodeAt(i + 3)]
    arr[curByte++] = (tmp >> 16) & 0xFF
    arr[curByte++] = (tmp >> 8) & 0xFF
    arr[curByte++] = tmp & 0xFF
  }

  if (placeHoldersLen === 2) {
    tmp =
      (revLookup[b64.charCodeAt(i)] << 2) |
      (revLookup[b64.charCodeAt(i + 1)] >> 4)
    arr[curByte++] = tmp & 0xFF
  }

  if (placeHoldersLen === 1) {
    tmp =
      (revLookup[b64.charCodeAt(i)] << 10) |
      (revLookup[b64.charCodeAt(i + 1)] << 4) |
      (revLookup[b64.charCodeAt(i + 2)] >> 2)
    arr[curByte++] = (tmp >> 8) & 0xFF
    arr[curByte++] = tmp & 0xFF
  }

  return arr
}

function tripletToBase64 (num) {
  return lookup[num >> 18 & 0x3F] +
    lookup[num >> 12 & 0x3F] +
    lookup[num >> 6 & 0x3F] +
    lookup[num & 0x3F]
}

function encodeChunk (uint8, start, end) {
  var tmp
  var output = []
  for (var i = start; i < end; i += 3) {
    tmp =
      ((uint8[i] << 16) & 0xFF0000) +
      ((uint8[i + 1] << 8) & 0xFF00) +
      (uint8[i + 2] & 0xFF)
    output.push(tripletToBase64(tmp))
  }
  return output.join('')
}

function fromByteArray (uint8) {
  var tmp
  var len = uint8.length
  var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  var parts = []
  var maxChunkLength = 16383 // must be multiple of 3

  // go through the array every three bytes, we'll deal with trailing stuff later
  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
    parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  }

  // pad the end with zeros, but make sure to not forget the extra bytes
  if (extraBytes === 1) {
    tmp = uint8[len - 1]
    parts.push(
      lookup[tmp >> 2] +
      lookup[(tmp << 4) & 0x3F] +
      '=='
    )
  } else if (extraBytes === 2) {
    tmp = (uint8[len - 2] << 8) + uint8[len - 1]
    parts.push(
      lookup[tmp >> 10] +
      lookup[(tmp >> 4) & 0x3F] +
      lookup[(tmp << 2) & 0x3F] +
      '='
    )
  }

  return parts.join('')
}


/***/ }),

/***/ "2266":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var isArrayIteratorMethod = __webpack_require__("e95a");
var lengthOfArrayLike = __webpack_require__("07fa");
var bind = __webpack_require__("0366");
var getIterator = __webpack_require__("9a1f");
var getIteratorMethod = __webpack_require__("35a1");
var iteratorClose = __webpack_require__("2a62");

var Result = function (stopped, result) {
  this.stopped = stopped;
  this.result = result;
};

module.exports = function (iterable, unboundFunction, options) {
  var that = options && options.that;
  var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  var INTERRUPTED = !!(options && options.INTERRUPTED);
  var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
  var iterator, iterFn, index, length, result, next, step;

  var stop = function (condition) {
    if (iterator) iteratorClose(iterator, 'normal', condition);
    return new Result(true, condition);
  };

  var callFn = function (value) {
    if (AS_ENTRIES) {
      anObject(value);
      return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
    } return INTERRUPTED ? fn(value, stop) : fn(value);
  };

  if (IS_ITERATOR) {
    iterator = iterable;
  } else {
    iterFn = getIteratorMethod(iterable);
    if (!iterFn) throw TypeError(String(iterable) + ' is not iterable');
    // optimisation for array iterators
    if (isArrayIteratorMethod(iterFn)) {
      for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
        result = callFn(iterable[index]);
        if (result && result instanceof Result) return result;
      } return new Result(false);
    }
    iterator = getIterator(iterable, iterFn);
  }

  next = iterator.next;
  while (!(step = next.call(iterator)).done) {
    try {
      result = callFn(step.value);
    } catch (error) {
      iteratorClose(iterator, 'throw', error);
    }
    if (typeof result == 'object' && result && result instanceof Result) return result;
  } return new Result(false);
};


/***/ }),

/***/ "22c0":
/***/ (function(module, exports, __webpack_require__) {

const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__("fe45")
const debug = __webpack_require__("0d7c")
exports = module.exports = {}

// The actual regexps go on exports.re
const re = exports.re = []
const src = exports.src = []
const t = exports.t = {}
let R = 0

const createToken = (name, value, isGlobal) => {
  const index = R++
  debug(index, value)
  t[name] = index
  src[index] = value
  re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
}

// The following Regular Expressions can be used for tokenizing,
// validating, and parsing SemVer version strings.

// ## Numeric Identifier
// A single `0`, or a non-zero digit followed by zero or more digits.

createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')

// ## Non-numeric Identifier
// Zero or more digits, followed by a letter or hyphen, and then zero or
// more letters, digits, or hyphens.

createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')

// ## Main Version
// Three dot-separated numeric identifiers.

createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
                   `(${src[t.NUMERICIDENTIFIER]})\\.` +
                   `(${src[t.NUMERICIDENTIFIER]})`)

createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
                        `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
                        `(${src[t.NUMERICIDENTIFIERLOOSE]})`)

// ## Pre-release Version Identifier
// A numeric identifier, or a non-numeric identifier.

createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
}|${src[t.NONNUMERICIDENTIFIER]})`)

createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
}|${src[t.NONNUMERICIDENTIFIER]})`)

// ## Pre-release Version
// Hyphen, followed by one or more dot-separated pre-release version
// identifiers.

createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)

createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)

// ## Build Metadata Identifier
// Any combination of digits, letters, or hyphens.

createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')

// ## Build Metadata
// Plus sign, followed by one or more period-separated build metadata
// identifiers.

createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)

// ## Full Version String
// A main version, followed optionally by a pre-release version and
// build metadata.

// Note that the only major, minor, patch, and pre-release sections of
// the version string are capturing groups.  The build metadata is not a
// capturing group, because it should not ever be used in version
// comparison.

createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
}${src[t.PRERELEASE]}?${
  src[t.BUILD]}?`)

createToken('FULL', `^${src[t.FULLPLAIN]}$`)

// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
// common in the npm registry.
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
}${src[t.PRERELEASELOOSE]}?${
  src[t.BUILD]}?`)

createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)

createToken('GTLT', '((?:<|>)?=?)')

// Something like "2.*" or "1.2.x".
// Note that "x.x" is a valid xRange identifer, meaning "any version"
// Only the first item is strictly required.
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)

createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
                   `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
                   `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
                   `(?:${src[t.PRERELEASE]})?${
                     src[t.BUILD]}?` +
                   `)?)?`)

createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
                        `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
                        `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
                        `(?:${src[t.PRERELEASELOOSE]})?${
                          src[t.BUILD]}?` +
                        `)?)?`)

createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)

// Coercion.
// Extract anything that could conceivably be a part of a valid semver
createToken('COERCE', `${'(^|[^\\d])' +
              '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
              `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
              `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
              `(?:$|[^\\d])`)
createToken('COERCERTL', src[t.COERCE], true)

// Tilde ranges.
// Meaning is "reasonably at or greater than"
createToken('LONETILDE', '(?:~>?)')

createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
exports.tildeTrimReplace = '$1~'

createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)

// Caret ranges.
// Meaning is "at least and backwards compatible with"
createToken('LONECARET', '(?:\\^)')

createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
exports.caretTrimReplace = '$1^'

createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)

// A simple gt/lt/eq thing, or just "" to indicate "any version"
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)

// An expression to strip any whitespace between the gtlt and the thing
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
exports.comparatorTrimReplace = '$1$2$3'

// Something like `1.2.3 - 1.2.4`
// Note that these all use the loose form, because they'll be
// checked against either the strict or loose comparator form
// later.
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
                   `\\s+-\\s+` +
                   `(${src[t.XRANGEPLAIN]})` +
                   `\\s*$`)

createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
                        `\\s+-\\s+` +
                        `(${src[t.XRANGEPLAINLOOSE]})` +
                        `\\s*$`)

// Star ranges basically just allow anything at all.
createToken('STAR', '(<|>)?=?\\s*\\*')
// >=0.0.0 is like a star
createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')


/***/ }),

/***/ "23cb":
/***/ (function(module, exports, __webpack_require__) {

var toIntegerOrInfinity = __webpack_require__("5926");

var max = Math.max;
var min = Math.min;

// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
module.exports = function (index, length) {
  var integer = toIntegerOrInfinity(index);
  return integer < 0 ? max(integer + length, 0) : min(integer, length);
};


/***/ }),

/***/ "23d7":
/***/ (function(module, exports, __webpack_require__) {

const Range = __webpack_require__("7b1f")
const Comparator = __webpack_require__("bf00")
const { ANY } = Comparator
const satisfies = __webpack_require__("329c")
const compare = __webpack_require__("f06c")

// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
// - Every simple range `r1, r2, ...` is a null set, OR
// - Every simple range `r1, r2, ...` which is not a null set is a subset of
//   some `R1, R2, ...`
//
// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
// - If c is only the ANY comparator
//   - If C is only the ANY comparator, return true
//   - Else if in prerelease mode, return false
//   - else replace c with `[>=0.0.0]`
// - If C is only the ANY comparator
//   - if in prerelease mode, return true
//   - else replace C with `[>=0.0.0]`
// - Let EQ be the set of = comparators in c
// - If EQ is more than one, return true (null set)
// - Let GT be the highest > or >= comparator in c
// - Let LT be the lowest < or <= comparator in c
// - If GT and LT, and GT.semver > LT.semver, return true (null set)
// - If any C is a = range, and GT or LT are set, return false
// - If EQ
//   - If GT, and EQ does not satisfy GT, return true (null set)
//   - If LT, and EQ does not satisfy LT, return true (null set)
//   - If EQ satisfies every C, return true
//   - Else return false
// - If GT
//   - If GT.semver is lower than any > or >= comp in C, return false
//   - If GT is >=, and GT.semver does not satisfy every C, return false
//   - If GT.semver has a prerelease, and not in prerelease mode
//     - If no C has a prerelease and the GT.semver tuple, return false
// - If LT
//   - If LT.semver is greater than any < or <= comp in C, return false
//   - If LT is <=, and LT.semver does not satisfy every C, return false
//   - If GT.semver has a prerelease, and not in prerelease mode
//     - If no C has a prerelease and the LT.semver tuple, return false
// - Else return true

const subset = (sub, dom, options = {}) => {
  if (sub === dom)
    return true

  sub = new Range(sub, options)
  dom = new Range(dom, options)
  let sawNonNull = false

  OUTER: for (const simpleSub of sub.set) {
    for (const simpleDom of dom.set) {
      const isSub = simpleSubset(simpleSub, simpleDom, options)
      sawNonNull = sawNonNull || isSub !== null
      if (isSub)
        continue OUTER
    }
    // the null set is a subset of everything, but null simple ranges in
    // a complex range should be ignored.  so if we saw a non-null range,
    // then we know this isn't a subset, but if EVERY simple range was null,
    // then it is a subset.
    if (sawNonNull)
      return false
  }
  return true
}

const simpleSubset = (sub, dom, options) => {
  if (sub === dom)
    return true

  if (sub.length === 1 && sub[0].semver === ANY) {
    if (dom.length === 1 && dom[0].semver === ANY)
      return true
    else if (options.includePrerelease)
      sub = [ new Comparator('>=0.0.0-0') ]
    else
      sub = [ new Comparator('>=0.0.0') ]
  }

  if (dom.length === 1 && dom[0].semver === ANY) {
    if (options.includePrerelease)
      return true
    else
      dom = [ new Comparator('>=0.0.0') ]
  }

  const eqSet = new Set()
  let gt, lt
  for (const c of sub) {
    if (c.operator === '>' || c.operator === '>=')
      gt = higherGT(gt, c, options)
    else if (c.operator === '<' || c.operator === '<=')
      lt = lowerLT(lt, c, options)
    else
      eqSet.add(c.semver)
  }

  if (eqSet.size > 1)
    return null

  let gtltComp
  if (gt && lt) {
    gtltComp = compare(gt.semver, lt.semver, options)
    if (gtltComp > 0)
      return null
    else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
      return null
  }

  // will iterate one or zero times
  for (const eq of eqSet) {
    if (gt && !satisfies(eq, String(gt), options))
      return null

    if (lt && !satisfies(eq, String(lt), options))
      return null

    for (const c of dom) {
      if (!satisfies(eq, String(c), options))
        return false
    }

    return true
  }

  let higher, lower
  let hasDomLT, hasDomGT
  // if the subset has a prerelease, we need a comparator in the superset
  // with the same tuple and a prerelease, or it's not a subset
  let needDomLTPre = lt &&
    !options.includePrerelease &&
    lt.semver.prerelease.length ? lt.semver : false
  let needDomGTPre = gt &&
    !options.includePrerelease &&
    gt.semver.prerelease.length ? gt.semver : false
  // exception: <1.2.3-0 is the same as <1.2.3
  if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
      lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
    needDomLTPre = false
  }

  for (const c of dom) {
    hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
    hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
    if (gt) {
      if (needDomGTPre) {
        if (c.semver.prerelease && c.semver.prerelease.length &&
            c.semver.major === needDomGTPre.major &&
            c.semver.minor === needDomGTPre.minor &&
            c.semver.patch === needDomGTPre.patch) {
          needDomGTPre = false
        }
      }
      if (c.operator === '>' || c.operator === '>=') {
        higher = higherGT(gt, c, options)
        if (higher === c && higher !== gt)
          return false
      } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
        return false
    }
    if (lt) {
      if (needDomLTPre) {
        if (c.semver.prerelease && c.semver.prerelease.length &&
            c.semver.major === needDomLTPre.major &&
            c.semver.minor === needDomLTPre.minor &&
            c.semver.patch === needDomLTPre.patch) {
          needDomLTPre = false
        }
      }
      if (c.operator === '<' || c.operator === '<=') {
        lower = lowerLT(lt, c, options)
        if (lower === c && lower !== lt)
          return false
      } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
        return false
    }
    if (!c.operator && (lt || gt) && gtltComp !== 0)
      return false
  }

  // if there was a < or >, and nothing in the dom, then must be false
  // UNLESS it was limited by another range in the other direction.
  // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
  if (gt && hasDomLT && !lt && gtltComp !== 0)
    return false

  if (lt && hasDomGT && !gt && gtltComp !== 0)
    return false

  // we needed a prerelease range in a specific tuple, but didn't get one
  // then this isn't a subset.  eg >=1.2.3-pre is not a subset of >=1.0.0,
  // because it includes prereleases in the 1.2.3 tuple
  if (needDomGTPre || needDomLTPre)
    return false

  return true
}

// >=1.2.3 is lower than >1.2.3
const higherGT = (a, b, options) => {
  if (!a)
    return b
  const comp = compare(a.semver, b.semver, options)
  return comp > 0 ? a
    : comp < 0 ? b
    : b.operator === '>' && a.operator === '>=' ? b
    : a
}

// <=1.2.3 is higher than <1.2.3
const lowerLT = (a, b, options) => {
  if (!a)
    return b
  const comp = compare(a.semver, b.semver, options)
  return comp < 0 ? a
    : comp > 0 ? b
    : b.operator === '<' && a.operator === '<=' ? b
    : a
}

module.exports = subset


/***/ }),

/***/ "23e7":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var getOwnPropertyDescriptor = __webpack_require__("06cf").f;
var createNonEnumerableProperty = __webpack_require__("9112");
var redefine = __webpack_require__("6eeb");
var setGlobal = __webpack_require__("ce4e");
var copyConstructorProperties = __webpack_require__("e893");
var isForced = __webpack_require__("94ca");

/*
  options.target      - name of the target object
  options.global      - target is the global object
  options.stat        - export as static methods of target
  options.proto       - export as prototype methods of target
  options.real        - real prototype method for the `pure` version
  options.forced      - export even if the native feature is available
  options.bind        - bind methods to the target, required for the `pure` version
  options.wrap        - wrap constructors to preventing global pollution, required for the `pure` version
  options.unsafe      - use the simple assignment of property instead of delete + defineProperty
  options.sham        - add a flag to not completely full polyfills
  options.enumerable  - export as enumerable property
  options.noTargetGet - prevent calling a getter on target
  options.name        - the .name of the function if it does not match the key
*/
module.exports = function (options, source) {
  var TARGET = options.target;
  var GLOBAL = options.global;
  var STATIC = options.stat;
  var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  if (GLOBAL) {
    target = global;
  } else if (STATIC) {
    target = global[TARGET] || setGlobal(TARGET, {});
  } else {
    target = (global[TARGET] || {}).prototype;
  }
  if (target) for (key in source) {
    sourceProperty = source[key];
    if (options.noTargetGet) {
      descriptor = getOwnPropertyDescriptor(target, key);
      targetProperty = descriptor && descriptor.value;
    } else targetProperty = target[key];
    FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
    // contained in target
    if (!FORCED && targetProperty !== undefined) {
      if (typeof sourceProperty === typeof targetProperty) continue;
      copyConstructorProperties(sourceProperty, targetProperty);
    }
    // add a flag to not completely full polyfills
    if (options.sham || (targetProperty && targetProperty.sham)) {
      createNonEnumerableProperty(sourceProperty, 'sham', true);
    }
    // extend global
    redefine(target, key, sourceProperty, options);
  }
};


/***/ }),

/***/ "2410":
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(Buffer) {var clone = (function() {
'use strict';

function _instanceof(obj, type) {
  return type != null && obj instanceof type;
}

var nativeMap;
try {
  nativeMap = Map;
} catch(_) {
  // maybe a reference error because no `Map`. Give it a dummy value that no
  // value will ever be an instanceof.
  nativeMap = function() {};
}

var nativeSet;
try {
  nativeSet = Set;
} catch(_) {
  nativeSet = function() {};
}

var nativePromise;
try {
  nativePromise = Promise;
} catch(_) {
  nativePromise = function() {};
}

/**
 * Clones (copies) an Object using deep copying.
 *
 * This function supports circular references by default, but if you are certain
 * there are no circular references in your object, you can save some CPU time
 * by calling clone(obj, false).
 *
 * Caution: if `circular` is false and `parent` contains circular references,
 * your program may enter an infinite loop and crash.
 *
 * @param `parent` - the object to be cloned
 * @param `circular` - set to true if the object to be cloned may contain
 *    circular references. (optional - true by default)
 * @param `depth` - set to a number if the object is only to be cloned to
 *    a particular depth. (optional - defaults to Infinity)
 * @param `prototype` - sets the prototype to be used when cloning an object.
 *    (optional - defaults to parent prototype).
 * @param `includeNonEnumerable` - set to true if the non-enumerable properties
 *    should be cloned as well. Non-enumerable properties on the prototype
 *    chain will be ignored. (optional - false by default)
*/
function clone(parent, circular, depth, prototype, includeNonEnumerable) {
  if (typeof circular === 'object') {
    depth = circular.depth;
    prototype = circular.prototype;
    includeNonEnumerable = circular.includeNonEnumerable;
    circular = circular.circular;
  }
  // maintain two arrays for circular references, where corresponding parents
  // and children have the same index
  var allParents = [];
  var allChildren = [];

  var useBuffer = typeof Buffer != 'undefined';

  if (typeof circular == 'undefined')
    circular = true;

  if (typeof depth == 'undefined')
    depth = Infinity;

  // recurse this function so we don't reset allParents and allChildren
  function _clone(parent, depth) {
    // cloning null always returns null
    if (parent === null)
      return null;

    if (depth === 0)
      return parent;

    var child;
    var proto;
    if (typeof parent != 'object') {
      return parent;
    }

    if (_instanceof(parent, nativeMap)) {
      child = new nativeMap();
    } else if (_instanceof(parent, nativeSet)) {
      child = new nativeSet();
    } else if (_instanceof(parent, nativePromise)) {
      child = new nativePromise(function (resolve, reject) {
        parent.then(function(value) {
          resolve(_clone(value, depth - 1));
        }, function(err) {
          reject(_clone(err, depth - 1));
        });
      });
    } else if (clone.__isArray(parent)) {
      child = [];
    } else if (clone.__isRegExp(parent)) {
      child = new RegExp(parent.source, __getRegExpFlags(parent));
      if (parent.lastIndex) child.lastIndex = parent.lastIndex;
    } else if (clone.__isDate(parent)) {
      child = new Date(parent.getTime());
    } else if (useBuffer && Buffer.isBuffer(parent)) {
      if (Buffer.allocUnsafe) {
        // Node.js >= 4.5.0
        child = Buffer.allocUnsafe(parent.length);
      } else {
        // Older Node.js versions
        child = new Buffer(parent.length);
      }
      parent.copy(child);
      return child;
    } else if (_instanceof(parent, Error)) {
      child = Object.create(parent);
    } else {
      if (typeof prototype == 'undefined') {
        proto = Object.getPrototypeOf(parent);
        child = Object.create(proto);
      }
      else {
        child = Object.create(prototype);
        proto = prototype;
      }
    }

    if (circular) {
      var index = allParents.indexOf(parent);

      if (index != -1) {
        return allChildren[index];
      }
      allParents.push(parent);
      allChildren.push(child);
    }

    if (_instanceof(parent, nativeMap)) {
      parent.forEach(function(value, key) {
        var keyChild = _clone(key, depth - 1);
        var valueChild = _clone(value, depth - 1);
        child.set(keyChild, valueChild);
      });
    }
    if (_instanceof(parent, nativeSet)) {
      parent.forEach(function(value) {
        var entryChild = _clone(value, depth - 1);
        child.add(entryChild);
      });
    }

    for (var i in parent) {
      var attrs;
      if (proto) {
        attrs = Object.getOwnPropertyDescriptor(proto, i);
      }

      if (attrs && attrs.set == null) {
        continue;
      }
      child[i] = _clone(parent[i], depth - 1);
    }

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(parent);
      for (var i = 0; i < symbols.length; i++) {
        // Don't need to worry about cloning a symbol because it is a primitive,
        // like a number or string.
        var symbol = symbols[i];
        var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
        if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
          continue;
        }
        child[symbol] = _clone(parent[symbol], depth - 1);
        if (!descriptor.enumerable) {
          Object.defineProperty(child, symbol, {
            enumerable: false
          });
        }
      }
    }

    if (includeNonEnumerable) {
      var allPropertyNames = Object.getOwnPropertyNames(parent);
      for (var i = 0; i < allPropertyNames.length; i++) {
        var propertyName = allPropertyNames[i];
        var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
        if (descriptor && descriptor.enumerable) {
          continue;
        }
        child[propertyName] = _clone(parent[propertyName], depth - 1);
        Object.defineProperty(child, propertyName, {
          enumerable: false
        });
      }
    }

    return child;
  }

  return _clone(parent, depth);
}

/**
 * Simple flat clone using prototype, accepts only objects, usefull for property
 * override on FLAT configuration object (no nested props).
 *
 * USE WITH CAUTION! This may not behave as you wish if you do not know how this
 * works.
 */
clone.clonePrototype = function clonePrototype(parent) {
  if (parent === null)
    return null;

  var c = function () {};
  c.prototype = parent;
  return new c();
};

// private utility functions

function __objToStr(o) {
  return Object.prototype.toString.call(o);
}
clone.__objToStr = __objToStr;

function __isDate(o) {
  return typeof o === 'object' && __objToStr(o) === '[object Date]';
}
clone.__isDate = __isDate;

function __isArray(o) {
  return typeof o === 'object' && __objToStr(o) === '[object Array]';
}
clone.__isArray = __isArray;

function __isRegExp(o) {
  return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
}
clone.__isRegExp = __isRegExp;

function __getRegExpFlags(re) {
  var flags = '';
  if (re.global) flags += 'g';
  if (re.ignoreCase) flags += 'i';
  if (re.multiline) flags += 'm';
  return flags;
}
clone.__getRegExpFlags = __getRegExpFlags;

return clone;
})();

if ( true && module.exports) {
  module.exports = clone;
}

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("b639").Buffer))

/***/ }),

/***/ "241c":
/***/ (function(module, exports, __webpack_require__) {

var internalObjectKeys = __webpack_require__("ca84");
var enumBugKeys = __webpack_require__("7839");

var hiddenKeys = enumBugKeys.concat('length', 'prototype');

// `Object.getOwnPropertyNames` method
// https://tc39.es/ecma262/#sec-object.getownpropertynames
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  return internalObjectKeys(O, hiddenKeys);
};


/***/ }),

/***/ "2426":
/***/ (function(module, exports, __webpack_require__) {

const compare = __webpack_require__("f06c")
const lt = (a, b, loose) => compare(a, b, loose) < 0
module.exports = lt


/***/ }),

/***/ "25f0":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var PROPER_FUNCTION_NAME = __webpack_require__("5e77").PROPER;
var redefine = __webpack_require__("6eeb");
var anObject = __webpack_require__("825a");
var $toString = __webpack_require__("577e");
var fails = __webpack_require__("d039");
var flags = __webpack_require__("ad6d");

var TO_STRING = 'toString';
var RegExpPrototype = RegExp.prototype;
var nativeToString = RegExpPrototype[TO_STRING];

var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
// FF44- RegExp#toString has a wrong name
var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name != TO_STRING;

// `RegExp.prototype.toString` method
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
if (NOT_GENERIC || INCORRECT_NAME) {
  redefine(RegExp.prototype, TO_STRING, function toString() {
    var R = anObject(this);
    var p = $toString(R.source);
    var rf = R.flags;
    var f = $toString(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
    return '/' + p + '/' + f;
  }, { unsafe: true });
}


/***/ }),

/***/ "2626":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var getBuiltIn = __webpack_require__("d066");
var definePropertyModule = __webpack_require__("9bf2");
var wellKnownSymbol = __webpack_require__("b622");
var DESCRIPTORS = __webpack_require__("83ab");

var SPECIES = wellKnownSymbol('species');

module.exports = function (CONSTRUCTOR_NAME) {
  var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  var defineProperty = definePropertyModule.f;

  if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
    defineProperty(Constructor, SPECIES, {
      configurable: true,
      get: function () { return this; }
    });
  }
};


/***/ }),

/***/ "26e9":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var isArray = __webpack_require__("e8b5");

var nativeReverse = [].reverse;
var test = [1, 2];

// `Array.prototype.reverse` method
// https://tc39.es/ecma262/#sec-array.prototype.reverse
// fix for Safari 12.0 bug
// https://bugs.webkit.org/show_bug.cgi?id=188794
$({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
  reverse: function reverse() {
    // eslint-disable-next-line no-self-assign -- dirty hack
    if (isArray(this)) this.length = this.length;
    return nativeReverse.call(this);
  }
});


/***/ }),

/***/ "2739":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return utcSunday; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return utcMonday; });
/* unused harmony export utcTuesday */
/* unused harmony export utcWednesday */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return utcThursday; });
/* unused harmony export utcFriday */
/* unused harmony export utcSaturday */
/* unused harmony export utcSundays */
/* unused harmony export utcMondays */
/* unused harmony export utcTuesdays */
/* unused harmony export utcWednesdays */
/* unused harmony export utcThursdays */
/* unused harmony export utcFridays */
/* unused harmony export utcSaturdays */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");
/* harmony import */ var _duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1738");



function utcWeekday(i) {
  return Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
    date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
    date.setUTCHours(0, 0, 0, 0);
  }, function(date, step) {
    date.setUTCDate(date.getUTCDate() + step * 7);
  }, function(start, end) {
    return (end - start) / _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationWeek */ "f"];
  });
}

var utcSunday = utcWeekday(0);
var utcMonday = utcWeekday(1);
var utcTuesday = utcWeekday(2);
var utcWednesday = utcWeekday(3);
var utcThursday = utcWeekday(4);
var utcFriday = utcWeekday(5);
var utcSaturday = utcWeekday(6);

var utcSundays = utcSunday.range;
var utcMondays = utcMonday.range;
var utcTuesdays = utcTuesday.range;
var utcWednesdays = utcWednesday.range;
var utcThursdays = utcThursday.range;
var utcFridays = utcFriday.range;
var utcSaturdays = utcSaturday.range;


/***/ }),

/***/ "277d":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var isArray = __webpack_require__("e8b5");

// `Array.isArray` method
// https://tc39.es/ecma262/#sec-array.isarray
$({ target: 'Array', stat: true }, {
  isArray: isArray
});


/***/ }),

/***/ "2874":
/***/ (function(module, exports) {

const numeric = /^[0-9]+$/
const compareIdentifiers = (a, b) => {
  const anum = numeric.test(a)
  const bnum = numeric.test(b)

  if (anum && bnum) {
    a = +a
    b = +b
  }

  return a === b ? 0
    : (anum && !bnum) ? -1
    : (bnum && !anum) ? 1
    : a < b ? -1
    : 1
}

const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)

module.exports = {
  compareIdentifiers,
  rcompareIdentifiers
}


/***/ }),

/***/ "2a2d":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var _ascending_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("00fb");


/* harmony default export */ __webpack_exports__["a"] = (function(f) {
  let delta = f;
  let compare = f;

  if (f.length === 1) {
    delta = (d, x) => f(d) - x;
    compare = ascendingComparator(f);
  }

  function left(a, x, lo, hi) {
    if (lo == null) lo = 0;
    if (hi == null) hi = a.length;
    while (lo < hi) {
      const mid = (lo + hi) >>> 1;
      if (compare(a[mid], x) < 0) lo = mid + 1;
      else hi = mid;
    }
    return lo;
  }

  function right(a, x, lo, hi) {
    if (lo == null) lo = 0;
    if (hi == null) hi = a.length;
    while (lo < hi) {
      const mid = (lo + hi) >>> 1;
      if (compare(a[mid], x) > 0) hi = mid;
      else lo = mid + 1;
    }
    return lo;
  }

  function center(a, x, lo, hi) {
    if (lo == null) lo = 0;
    if (hi == null) hi = a.length;
    const i = left(a, x, lo, hi - 1);
    return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
  }

  return {left, center, right};
});

function ascendingComparator(f) {
  return (d, x) => Object(_ascending_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(f(d), x);
}


/***/ }),

/***/ "2a62":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var getMethod = __webpack_require__("dc4a");

module.exports = function (iterator, kind, value) {
  var innerResult, innerError;
  anObject(iterator);
  try {
    innerResult = getMethod(iterator, 'return');
    if (!innerResult) {
      if (kind === 'throw') throw value;
      return value;
    }
    innerResult = innerResult.call(iterator);
  } catch (error) {
    innerError = true;
    innerResult = error;
  }
  if (kind === 'throw') throw value;
  if (innerError) throw innerResult;
  anObject(innerResult);
  return value;
};


/***/ }),

/***/ "2af1":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var sign = __webpack_require__("f748");

// `Math.sign` method
// https://tc39.es/ecma262/#sec-math.sign
$({ target: 'Math', stat: true }, {
  sign: sign
});


/***/ }),

/***/ "2c38":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export minutes */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");
/* harmony import */ var _duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1738");



var minute = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setTime(date - date.getMilliseconds() - date.getSeconds() * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationSecond */ "e"]);
}, function(date, step) {
  date.setTime(+date + step * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationMinute */ "c"]);
}, function(start, end) {
  return (end - start) / _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationMinute */ "c"];
}, function(date) {
  return date.getMinutes();
});

/* harmony default export */ __webpack_exports__["a"] = (minute);
var minutes = minute.range;


/***/ }),

/***/ "2c9f":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const patch = (a, loose) => new SemVer(a, loose).patch
module.exports = patch


/***/ }),

/***/ "2cf4":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");
var fails = __webpack_require__("d039");
var bind = __webpack_require__("0366");
var html = __webpack_require__("1be4");
var createElement = __webpack_require__("cc12");
var IS_IOS = __webpack_require__("1cdc");
var IS_NODE = __webpack_require__("605d");

var set = global.setImmediate;
var clear = global.clearImmediate;
var process = global.process;
var MessageChannel = global.MessageChannel;
var Dispatch = global.Dispatch;
var counter = 0;
var queue = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var location, defer, channel, port;

try {
  // Deno throws a ReferenceError on `location` access without `--location` flag
  location = global.location;
} catch (error) { /* empty */ }

var run = function (id) {
  // eslint-disable-next-line no-prototype-builtins -- safe
  if (queue.hasOwnProperty(id)) {
    var fn = queue[id];
    delete queue[id];
    fn();
  }
};

var runner = function (id) {
  return function () {
    run(id);
  };
};

var listener = function (event) {
  run(event.data);
};

var post = function (id) {
  // old engines have not location.origin
  global.postMessage(String(id), location.protocol + '//' + location.host);
};

// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!set || !clear) {
  set = function setImmediate(fn) {
    var args = [];
    var argumentsLength = arguments.length;
    var i = 1;
    while (argumentsLength > i) args.push(arguments[i++]);
    queue[++counter] = function () {
      // eslint-disable-next-line no-new-func -- spec requirement
      (isCallable(fn) ? fn : Function(fn)).apply(undefined, args);
    };
    defer(counter);
    return counter;
  };
  clear = function clearImmediate(id) {
    delete queue[id];
  };
  // Node.js 0.8-
  if (IS_NODE) {
    defer = function (id) {
      process.nextTick(runner(id));
    };
  // Sphere (JS game engine) Dispatch API
  } else if (Dispatch && Dispatch.now) {
    defer = function (id) {
      Dispatch.now(runner(id));
    };
  // Browsers with MessageChannel, includes WebWorkers
  // except iOS - https://github.com/zloirock/core-js/issues/624
  } else if (MessageChannel && !IS_IOS) {
    channel = new MessageChannel();
    port = channel.port2;
    channel.port1.onmessage = listener;
    defer = bind(port.postMessage, port, 1);
  // Browsers with postMessage, skip WebWorkers
  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  } else if (
    global.addEventListener &&
    isCallable(global.postMessage) &&
    !global.importScripts &&
    location && location.protocol !== 'file:' &&
    !fails(post)
  ) {
    defer = post;
    global.addEventListener('message', listener, false);
  // IE8-
  } else if (ONREADYSTATECHANGE in createElement('script')) {
    defer = function (id) {
      html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
        html.removeChild(this);
        run(id);
      };
    };
  // Rest old browsers
  } else {
    defer = function (id) {
      setTimeout(runner(id), 0);
    };
  }
}

module.exports = {
  set: set,
  clear: clear
};


/***/ }),

/***/ "2d00":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var userAgent = __webpack_require__("342f");

var process = global.process;
var Deno = global.Deno;
var versions = process && process.versions || Deno && Deno.version;
var v8 = versions && versions.v8;
var match, version;

if (v8) {
  match = v8.split('.');
  version = match[0] < 4 ? 1 : match[0] + match[1];
} else if (userAgent) {
  match = userAgent.match(/Edge\/(\d+)/);
  if (!match || match[1] >= 74) {
    match = userAgent.match(/Chrome\/(\d+)/);
    if (match) version = match[1];
  }
}

module.exports = version && +version;


/***/ }),

/***/ "329c":
/***/ (function(module, exports, __webpack_require__) {

const Range = __webpack_require__("7b1f")
const satisfies = (version, range, options) => {
  try {
    range = new Range(range, options)
  } catch (er) {
    return false
  }
  return range.test(version)
}
module.exports = satisfies


/***/ }),

/***/ "3410":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var fails = __webpack_require__("d039");
var toObject = __webpack_require__("7b0b");
var nativeGetPrototypeOf = __webpack_require__("e163");
var CORRECT_PROTOTYPE_GETTER = __webpack_require__("e177");

var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });

// `Object.getPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.getprototypeof
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
  getPrototypeOf: function getPrototypeOf(it) {
    return nativeGetPrototypeOf(toObject(it));
  }
});



/***/ }),

/***/ "342f":
/***/ (function(module, exports, __webpack_require__) {

var getBuiltIn = __webpack_require__("d066");

module.exports = getBuiltIn('navigator', 'userAgent') || '';


/***/ }),

/***/ "3512":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
var EOL = {},
    EOF = {},
    QUOTE = 34,
    NEWLINE = 10,
    RETURN = 13;

function objectConverter(columns) {
  return new Function("d", "return {" + columns.map(function(name, i) {
    return JSON.stringify(name) + ": d[" + i + "] || \"\"";
  }).join(",") + "}");
}

function customConverter(columns, f) {
  var object = objectConverter(columns);
  return function(row, i) {
    return f(object(row), i, columns);
  };
}

// Compute unique columns in order of discovery.
function inferColumns(rows) {
  var columnSet = Object.create(null),
      columns = [];

  rows.forEach(function(row) {
    for (var column in row) {
      if (!(column in columnSet)) {
        columns.push(columnSet[column] = column);
      }
    }
  });

  return columns;
}

function pad(value, width) {
  var s = value + "", length = s.length;
  return length < width ? new Array(width - length + 1).join(0) + s : s;
}

function formatYear(year) {
  return year < 0 ? "-" + pad(-year, 6)
    : year > 9999 ? "+" + pad(year, 6)
    : pad(year, 4);
}

function formatDate(date) {
  var hours = date.getUTCHours(),
      minutes = date.getUTCMinutes(),
      seconds = date.getUTCSeconds(),
      milliseconds = date.getUTCMilliseconds();
  return isNaN(date) ? "Invalid Date"
      : formatYear(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2)
      + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z"
      : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z"
      : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z"
      : "");
}

/* harmony default export */ __webpack_exports__["a"] = (function(delimiter) {
  var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
      DELIMITER = delimiter.charCodeAt(0);

  function parse(text, f) {
    var convert, columns, rows = parseRows(text, function(row, i) {
      if (convert) return convert(row, i - 1);
      columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
    });
    rows.columns = columns || [];
    return rows;
  }

  function parseRows(text, f) {
    var rows = [], // output rows
        N = text.length,
        I = 0, // current character index
        n = 0, // current line number
        t, // current token
        eof = N <= 0, // current token followed by EOF?
        eol = false; // current token followed by EOL?

    // Strip the trailing newline.
    if (text.charCodeAt(N - 1) === NEWLINE) --N;
    if (text.charCodeAt(N - 1) === RETURN) --N;

    function token() {
      if (eof) return EOF;
      if (eol) return eol = false, EOL;

      // Unescape quotes.
      var i, j = I, c;
      if (text.charCodeAt(j) === QUOTE) {
        while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);
        if ((i = I) >= N) eof = true;
        else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;
        else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
        return text.slice(j + 1, i - 1).replace(/""/g, "\"");
      }

      // Find next delimiter or newline.
      while (I < N) {
        if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;
        else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
        else if (c !== DELIMITER) continue;
        return text.slice(j, i);
      }

      // Return last token before EOF.
      return eof = true, text.slice(j, N);
    }

    while ((t = token()) !== EOF) {
      var row = [];
      while (t !== EOL && t !== EOF) row.push(t), t = token();
      if (f && (row = f(row, n++)) == null) continue;
      rows.push(row);
    }

    return rows;
  }

  function preformatBody(rows, columns) {
    return rows.map(function(row) {
      return columns.map(function(column) {
        return formatValue(row[column]);
      }).join(delimiter);
    });
  }

  function format(rows, columns) {
    if (columns == null) columns = inferColumns(rows);
    return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n");
  }

  function formatBody(rows, columns) {
    if (columns == null) columns = inferColumns(rows);
    return preformatBody(rows, columns).join("\n");
  }

  function formatRows(rows) {
    return rows.map(formatRow).join("\n");
  }

  function formatRow(row) {
    return row.map(formatValue).join(delimiter);
  }

  function formatValue(value) {
    return value == null ? ""
        : value instanceof Date ? formatDate(value)
        : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\""
        : value;
  }

  return {
    parse: parse,
    parseRows: parseRows,
    format: format,
    formatBody: formatBody,
    formatRows: formatRows,
    formatRow: formatRow,
    formatValue: formatValue
  };
});


/***/ }),

/***/ "35a1":
/***/ (function(module, exports, __webpack_require__) {

var classof = __webpack_require__("f5df");
var getMethod = __webpack_require__("dc4a");
var Iterators = __webpack_require__("3f8c");
var wellKnownSymbol = __webpack_require__("b622");

var ITERATOR = wellKnownSymbol('iterator');

module.exports = function (it) {
  if (it != undefined) return getMethod(it, ITERATOR)
    || getMethod(it, '@@iterator')
    || Iterators[classof(it)];
};


/***/ }),

/***/ "37e8":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var definePropertyModule = __webpack_require__("9bf2");
var anObject = __webpack_require__("825a");
var objectKeys = __webpack_require__("df75");

// `Object.defineProperties` method
// https://tc39.es/ecma262/#sec-object.defineproperties
// eslint-disable-next-line es/no-object-defineproperties -- safe
module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
  anObject(O);
  var keys = objectKeys(Properties);
  var length = keys.length;
  var index = 0;
  var key;
  while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
  return O;
};


/***/ }),

/***/ "38cf":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var repeat = __webpack_require__("1148");

// `String.prototype.repeat` method
// https://tc39.es/ecma262/#sec-string.prototype.repeat
$({ target: 'String', proto: true }, {
  repeat: repeat
});


/***/ }),

/***/ "3bbe":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");

module.exports = function (argument) {
  if (typeof argument === 'object' || isCallable(argument)) return argument;
  throw TypeError("Can't set " + String(argument) + ' as a prototype');
};


/***/ }),

/***/ "3bd4":
/***/ (function(module, exports, __webpack_require__) {

const parse = __webpack_require__("61bb")
const prerelease = (version, options) => {
  const parsed = parse(version, options)
  return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
}
module.exports = prerelease


/***/ }),

/***/ "3ca3":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var charAt = __webpack_require__("6547").charAt;
var toString = __webpack_require__("577e");
var InternalStateModule = __webpack_require__("69f3");
var defineIterator = __webpack_require__("7dd0");

var STRING_ITERATOR = 'String Iterator';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);

// `String.prototype[@@iterator]` method
// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
defineIterator(String, 'String', function (iterated) {
  setInternalState(this, {
    type: STRING_ITERATOR,
    string: toString(iterated),
    index: 0
  });
// `%StringIteratorPrototype%.next` method
// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
}, function next() {
  var state = getInternalState(this);
  var string = state.string;
  var index = state.index;
  var point;
  if (index >= string.length) return { value: undefined, done: true };
  point = charAt(string, index);
  state.index += point.length;
  return { value: point, done: false };
});


/***/ }),

/***/ "3f8c":
/***/ (function(module, exports) {

module.exports = {};


/***/ }),

/***/ "408a":
/***/ (function(module, exports) {

var valueOf = 1.0.valueOf;

// `thisNumberValue` abstract operation
// https://tc39.es/ecma262/#sec-thisnumbervalue
module.exports = function (value) {
  return valueOf.call(value);
};


/***/ }),

/***/ "4160":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var forEach = __webpack_require__("17c2");

// `Array.prototype.forEach` method
// https://tc39.es/ecma262/#sec-array.prototype.foreach
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
$({ target: 'Array', proto: true, forced: [].forEach != forEach }, {
  forEach: forEach
});


/***/ }),

/***/ "428f":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");

module.exports = global;


/***/ }),

/***/ "4362":
/***/ (function(module, exports, __webpack_require__) {

exports.nextTick = function nextTick(fn) {
    var args = Array.prototype.slice.call(arguments);
    args.shift();
    setTimeout(function () {
        fn.apply(null, args);
    }, 0);
};

exports.platform = exports.arch = 
exports.execPath = exports.title = 'browser';
exports.pid = 1;
exports.browser = true;
exports.env = {};
exports.argv = [];

exports.binding = function (name) {
	throw new Error('No such module. (Possibly not yet loaded)')
};

(function () {
    var cwd = '/';
    var path;
    exports.cwd = function () { return cwd };
    exports.chdir = function (dir) {
        if (!path) path = __webpack_require__("df7c");
        cwd = path.resolve(dir, cwd);
    };
})();

exports.exit = exports.kill = 
exports.umask = exports.dlopen = 
exports.uptime = exports.memoryUsage = 
exports.uvCounters = function() {};
exports.features = {};


/***/ }),

/***/ "44ad":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var classof = __webpack_require__("c6b6");

var split = ''.split;

// fallback for non-array-like ES3 and non-enumerable old V8 strings
module.exports = fails(function () {
  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  // eslint-disable-next-line no-prototype-builtins -- safe
  return !Object('z').propertyIsEnumerable(0);
}) ? function (it) {
  return classof(it) == 'String' ? split.call(it, '') : Object(it);
} : Object;


/***/ }),

/***/ "44d2":
/***/ (function(module, exports, __webpack_require__) {

var wellKnownSymbol = __webpack_require__("b622");
var create = __webpack_require__("7c73");
var definePropertyModule = __webpack_require__("9bf2");

var UNSCOPABLES = wellKnownSymbol('unscopables');
var ArrayPrototype = Array.prototype;

// Array.prototype[@@unscopables]
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
if (ArrayPrototype[UNSCOPABLES] == undefined) {
  definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
    configurable: true,
    value: create(null)
  });
}

// add a key to Array.prototype[@@unscopables]
module.exports = function (key) {
  ArrayPrototype[UNSCOPABLES][key] = true;
};


/***/ }),

/***/ "44de":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");

module.exports = function (a, b) {
  var console = global.console;
  if (console && console.error) {
    arguments.length === 1 ? console.error(a) : console.error(a, b);
  }
};


/***/ }),

/***/ "44e7":
/***/ (function(module, exports, __webpack_require__) {

var isObject = __webpack_require__("861d");
var classof = __webpack_require__("c6b6");
var wellKnownSymbol = __webpack_require__("b622");

var MATCH = wellKnownSymbol('match');

// `IsRegExp` abstract operation
// https://tc39.es/ecma262/#sec-isregexp
module.exports = function (it) {
  var isRegExp;
  return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
};


/***/ }),

/***/ "45fc":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var $some = __webpack_require__("b727").some;
var arrayMethodIsStrict = __webpack_require__("a640");

var STRICT_METHOD = arrayMethodIsStrict('some');

// `Array.prototype.some` method
// https://tc39.es/ecma262/#sec-array.prototype.some
$({ target: 'Array', proto: true, forced: !STRICT_METHOD }, {
  some: function some(callbackfn /* , thisArg */) {
    return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});


/***/ }),

/***/ "466d":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var fixRegExpWellKnownSymbolLogic = __webpack_require__("d784");
var anObject = __webpack_require__("825a");
var toLength = __webpack_require__("50c4");
var toString = __webpack_require__("577e");
var requireObjectCoercible = __webpack_require__("1d80");
var getMethod = __webpack_require__("dc4a");
var advanceStringIndex = __webpack_require__("8aa5");
var regExpExec = __webpack_require__("14c3");

// @@match logic
fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
  return [
    // `String.prototype.match` method
    // https://tc39.es/ecma262/#sec-string.prototype.match
    function match(regexp) {
      var O = requireObjectCoercible(this);
      var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH);
      return matcher ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O));
    },
    // `RegExp.prototype[@@match]` method
    // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
    function (string) {
      var rx = anObject(this);
      var S = toString(string);
      var res = maybeCallNative(nativeMatch, rx, S);

      if (res.done) return res.value;

      if (!rx.global) return regExpExec(rx, S);

      var fullUnicode = rx.unicode;
      rx.lastIndex = 0;
      var A = [];
      var n = 0;
      var result;
      while ((result = regExpExec(rx, S)) !== null) {
        var matchStr = toString(result[0]);
        A[n] = matchStr;
        if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
        n++;
      }
      return n === 0 ? null : A;
    }
  ];
});


/***/ }),

/***/ "4795":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");
var userAgent = __webpack_require__("342f");

var slice = [].slice;
var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check

var wrap = function (scheduler) {
  return function (handler, timeout /* , ...arguments */) {
    var boundArgs = arguments.length > 2;
    var args = boundArgs ? slice.call(arguments, 2) : undefined;
    return scheduler(boundArgs ? function () {
      // eslint-disable-next-line no-new-func -- spec requirement
      (isCallable(handler) ? handler : Function(handler)).apply(this, args);
    } : handler, timeout);
  };
};

// ie9- setTimeout & setInterval additional parameters fix
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
$({ global: true, bind: true, forced: MSIE }, {
  // `setTimeout` method
  // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
  setTimeout: wrap(global.setTimeout),
  // `setInterval` method
  // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
  setInterval: wrap(global.setInterval)
});


/***/ }),

/***/ "4840":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var aConstructor = __webpack_require__("5087");
var wellKnownSymbol = __webpack_require__("b622");

var SPECIES = wellKnownSymbol('species');

// `SpeciesConstructor` abstract operation
// https://tc39.es/ecma262/#sec-speciesconstructor
module.exports = function (O, defaultConstructor) {
  var C = anObject(O).constructor;
  var S;
  return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
};


/***/ }),

/***/ "485a":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");
var isObject = __webpack_require__("861d");

// `OrdinaryToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
module.exports = function (input, pref) {
  var fn, val;
  if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val;
  if (isCallable(fn = input.valueOf) && !isObject(val = fn.call(input))) return val;
  if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val;
  throw TypeError("Can't convert object to primitive value");
};


/***/ }),

/***/ "4930":
/***/ (function(module, exports, __webpack_require__) {

/* eslint-disable es/no-symbol -- required for testing */
var V8_VERSION = __webpack_require__("2d00");
var fails = __webpack_require__("d039");

// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  var symbol = Symbol();
  // Chrome 38 Symbol has incorrect toString conversion
  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
    // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
    !Symbol.sham && V8_VERSION && V8_VERSION < 41;
});


/***/ }),

/***/ "498a":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var $trim = __webpack_require__("58a8").trim;
var forcedStringTrimMethod = __webpack_require__("c8d2");

// `String.prototype.trim` method
// https://tc39.es/ecma262/#sec-string.prototype.trim
$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
  trim: function trim() {
    return $trim(this);
  }
});


/***/ }),

/***/ "4ae1":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var getBuiltIn = __webpack_require__("d066");
var aConstructor = __webpack_require__("5087");
var anObject = __webpack_require__("825a");
var isObject = __webpack_require__("861d");
var create = __webpack_require__("7c73");
var bind = __webpack_require__("0538");
var fails = __webpack_require__("d039");

var nativeConstruct = getBuiltIn('Reflect', 'construct');

// `Reflect.construct` method
// https://tc39.es/ecma262/#sec-reflect.construct
// MS Edge supports only 2 arguments and argumentsList argument is optional
// FF Nightly sets third argument as `new.target`, but does not create `this` from it
var NEW_TARGET_BUG = fails(function () {
  function F() { /* empty */ }
  return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
});
var ARGS_BUG = !fails(function () {
  nativeConstruct(function () { /* empty */ });
});
var FORCED = NEW_TARGET_BUG || ARGS_BUG;

$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
  construct: function construct(Target, args /* , newTarget */) {
    aConstructor(Target);
    anObject(args);
    var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
    if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
    if (Target == newTarget) {
      // w/o altered newTarget, optimization for 0-4 arguments
      switch (args.length) {
        case 0: return new Target();
        case 1: return new Target(args[0]);
        case 2: return new Target(args[0], args[1]);
        case 3: return new Target(args[0], args[1], args[2]);
        case 4: return new Target(args[0], args[1], args[2], args[3]);
      }
      // w/o altered newTarget, lot of arguments case
      var $args = [null];
      $args.push.apply($args, args);
      return new (bind.apply(Target, $args))();
    }
    // with altered newTarget, not support built-in constructors
    var proto = newTarget.prototype;
    var instance = create(isObject(proto) ? proto : Object.prototype);
    var result = Function.apply.call(Target, instance, args);
    return isObject(result) ? result : instance;
  }
});


/***/ }),

/***/ "4c23":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return timeFormat; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return timeParse; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return utcFormat; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return utcParse; });
/* unused harmony export default */
/* harmony import */ var _locale_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a591");


var locale;
var timeFormat;
var timeParse;
var utcFormat;
var utcParse;

defaultLocale({
  dateTime: "%x, %X",
  date: "%-m/%-d/%Y",
  time: "%-I:%M:%S %p",
  periods: ["AM", "PM"],
  days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
});

function defaultLocale(definition) {
  locale = Object(_locale_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(definition);
  timeFormat = locale.format;
  timeParse = locale.parse;
  utcFormat = locale.utcFormat;
  utcParse = locale.utcParse;
  return locale;
}


/***/ }),

/***/ "4d63":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var global = __webpack_require__("da84");
var isForced = __webpack_require__("94ca");
var inheritIfRequired = __webpack_require__("7156");
var createNonEnumerableProperty = __webpack_require__("9112");
var defineProperty = __webpack_require__("9bf2").f;
var getOwnPropertyNames = __webpack_require__("241c").f;
var isRegExp = __webpack_require__("44e7");
var toString = __webpack_require__("577e");
var getFlags = __webpack_require__("ad6d");
var stickyHelpers = __webpack_require__("9f7f");
var redefine = __webpack_require__("6eeb");
var fails = __webpack_require__("d039");
var hasOwn = __webpack_require__("1a2d");
var enforceInternalState = __webpack_require__("69f3").enforce;
var setSpecies = __webpack_require__("2626");
var wellKnownSymbol = __webpack_require__("b622");
var UNSUPPORTED_DOT_ALL = __webpack_require__("fce3");
var UNSUPPORTED_NCG = __webpack_require__("107c");

var MATCH = wellKnownSymbol('match');
var NativeRegExp = global.RegExp;
var RegExpPrototype = NativeRegExp.prototype;
// TODO: Use only propper RegExpIdentifierName
var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
var re1 = /a/g;
var re2 = /a/g;

// "new" should create a new object, old webkit bug
var CORRECT_NEW = new NativeRegExp(re1) !== re1;

var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;

var BASE_FORCED = DESCRIPTORS &&
  (!CORRECT_NEW || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () {
    re2[MATCH] = false;
    // RegExp constructor can alter flags and IsRegExp works correct with @@match
    return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
  }));

var handleDotAll = function (string) {
  var length = string.length;
  var index = 0;
  var result = '';
  var brackets = false;
  var chr;
  for (; index <= length; index++) {
    chr = string.charAt(index);
    if (chr === '\\') {
      result += chr + string.charAt(++index);
      continue;
    }
    if (!brackets && chr === '.') {
      result += '[\\s\\S]';
    } else {
      if (chr === '[') {
        brackets = true;
      } else if (chr === ']') {
        brackets = false;
      } result += chr;
    }
  } return result;
};

var handleNCG = function (string) {
  var length = string.length;
  var index = 0;
  var result = '';
  var named = [];
  var names = {};
  var brackets = false;
  var ncg = false;
  var groupid = 0;
  var groupname = '';
  var chr;
  for (; index <= length; index++) {
    chr = string.charAt(index);
    if (chr === '\\') {
      chr = chr + string.charAt(++index);
    } else if (chr === ']') {
      brackets = false;
    } else if (!brackets) switch (true) {
      case chr === '[':
        brackets = true;
        break;
      case chr === '(':
        if (IS_NCG.test(string.slice(index + 1))) {
          index += 2;
          ncg = true;
        }
        result += chr;
        groupid++;
        continue;
      case chr === '>' && ncg:
        if (groupname === '' || hasOwn(names, groupname)) {
          throw new SyntaxError('Invalid capture group name');
        }
        names[groupname] = true;
        named.push([groupname, groupid]);
        ncg = false;
        groupname = '';
        continue;
    }
    if (ncg) groupname += chr;
    else result += chr;
  } return [result, named];
};

// `RegExp` constructor
// https://tc39.es/ecma262/#sec-regexp-constructor
if (isForced('RegExp', BASE_FORCED)) {
  var RegExpWrapper = function RegExp(pattern, flags) {
    var thisIsRegExp = this instanceof RegExpWrapper;
    var patternIsRegExp = isRegExp(pattern);
    var flagsAreUndefined = flags === undefined;
    var groups = [];
    var rawPattern = pattern;
    var rawFlags, dotAll, sticky, handled, result, state;

    if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
      return pattern;
    }

    if (patternIsRegExp || pattern instanceof RegExpWrapper) {
      pattern = pattern.source;
      if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags.call(rawPattern);
    }

    pattern = pattern === undefined ? '' : toString(pattern);
    flags = flags === undefined ? '' : toString(flags);
    rawPattern = pattern;

    if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) {
      dotAll = !!flags && flags.indexOf('s') > -1;
      if (dotAll) flags = flags.replace(/s/g, '');
    }

    rawFlags = flags;

    if (UNSUPPORTED_Y && 'sticky' in re1) {
      sticky = !!flags && flags.indexOf('y') > -1;
      if (sticky) flags = flags.replace(/y/g, '');
    }

    if (UNSUPPORTED_NCG) {
      handled = handleNCG(pattern);
      pattern = handled[0];
      groups = handled[1];
    }

    result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);

    if (dotAll || sticky || groups.length) {
      state = enforceInternalState(result);
      if (dotAll) {
        state.dotAll = true;
        state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
      }
      if (sticky) state.sticky = true;
      if (groups.length) state.groups = groups;
    }

    if (pattern !== rawPattern) try {
      // fails in old engines, but we have no alternatives for unsupported regex syntax
      createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
    } catch (error) { /* empty */ }

    return result;
  };

  var proxy = function (key) {
    key in RegExpWrapper || defineProperty(RegExpWrapper, key, {
      configurable: true,
      get: function () { return NativeRegExp[key]; },
      set: function (it) { NativeRegExp[key] = it; }
    });
  };

  for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) {
    proxy(keys[index++]);
  }

  RegExpPrototype.constructor = RegExpWrapper;
  RegExpWrapper.prototype = RegExpPrototype;
  redefine(global, 'RegExp', RegExpWrapper);
}

// https://tc39.es/ecma262/#sec-get-regexp-@@species
setSpecies('RegExp');


/***/ }),

/***/ "4d64":
/***/ (function(module, exports, __webpack_require__) {

var toIndexedObject = __webpack_require__("fc6a");
var toAbsoluteIndex = __webpack_require__("23cb");
var lengthOfArrayLike = __webpack_require__("07fa");

// `Array.prototype.{ indexOf, includes }` methods implementation
var createMethod = function (IS_INCLUDES) {
  return function ($this, el, fromIndex) {
    var O = toIndexedObject($this);
    var length = lengthOfArrayLike(O);
    var index = toAbsoluteIndex(fromIndex, length);
    var value;
    // Array#includes uses SameValueZero equality algorithm
    // eslint-disable-next-line no-self-compare -- NaN check
    if (IS_INCLUDES && el != el) while (length > index) {
      value = O[index++];
      // eslint-disable-next-line no-self-compare -- NaN check
      if (value != value) return true;
    // Array#indexOf ignores holes, Array#includes - not
    } else for (;length > index; index++) {
      if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
    } return !IS_INCLUDES && -1;
  };
};

module.exports = {
  // `Array.prototype.includes` method
  // https://tc39.es/ecma262/#sec-array.prototype.includes
  includes: createMethod(true),
  // `Array.prototype.indexOf` method
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
  indexOf: createMethod(false)
};


/***/ }),

/***/ "4de4":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var $filter = __webpack_require__("b727").filter;
var arrayMethodHasSpeciesSupport = __webpack_require__("1dde");

var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');

// `Array.prototype.filter` method
// https://tc39.es/ecma262/#sec-array.prototype.filter
// with adding support of @@species
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  filter: function filter(callbackfn /* , thisArg */) {
    return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});


/***/ }),

/***/ "4df4":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var bind = __webpack_require__("0366");
var toObject = __webpack_require__("7b0b");
var callWithSafeIterationClosing = __webpack_require__("9bdd");
var isArrayIteratorMethod = __webpack_require__("e95a");
var isConstructor = __webpack_require__("68ee");
var lengthOfArrayLike = __webpack_require__("07fa");
var createProperty = __webpack_require__("8418");
var getIterator = __webpack_require__("9a1f");
var getIteratorMethod = __webpack_require__("35a1");

// `Array.from` method implementation
// https://tc39.es/ecma262/#sec-array.from
module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  var O = toObject(arrayLike);
  var IS_CONSTRUCTOR = isConstructor(this);
  var argumentsLength = arguments.length;
  var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  var mapping = mapfn !== undefined;
  if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
  var iteratorMethod = getIteratorMethod(O);
  var index = 0;
  var length, result, step, iterator, next, value;
  // if the target is not iterable or it's an array with the default iterator - use a simple case
  if (iteratorMethod && !(this == Array && isArrayIteratorMethod(iteratorMethod))) {
    iterator = getIterator(O, iteratorMethod);
    next = iterator.next;
    result = IS_CONSTRUCTOR ? new this() : [];
    for (;!(step = next.call(iterator)).done; index++) {
      value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
      createProperty(result, index, value);
    }
  } else {
    length = lengthOfArrayLike(O);
    result = IS_CONSTRUCTOR ? new this(length) : Array(length);
    for (;length > index; index++) {
      value = mapping ? mapfn(O[index], index) : O[index];
      createProperty(result, index, value);
    }
  }
  result.length = index;
  return result;
};


/***/ }),

/***/ "4e82":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var aCallable = __webpack_require__("59ed");
var toObject = __webpack_require__("7b0b");
var lengthOfArrayLike = __webpack_require__("07fa");
var toString = __webpack_require__("577e");
var fails = __webpack_require__("d039");
var internalSort = __webpack_require__("addb");
var arrayMethodIsStrict = __webpack_require__("a640");
var FF = __webpack_require__("04d1");
var IE_OR_EDGE = __webpack_require__("d998");
var V8 = __webpack_require__("2d00");
var WEBKIT = __webpack_require__("512c");

var test = [];
var nativeSort = test.sort;

// IE8-
var FAILS_ON_UNDEFINED = fails(function () {
  test.sort(undefined);
});
// V8 bug
var FAILS_ON_NULL = fails(function () {
  test.sort(null);
});
// Old WebKit
var STRICT_METHOD = arrayMethodIsStrict('sort');

var STABLE_SORT = !fails(function () {
  // feature detection can be too slow, so check engines versions
  if (V8) return V8 < 70;
  if (FF && FF > 3) return;
  if (IE_OR_EDGE) return true;
  if (WEBKIT) return WEBKIT < 603;

  var result = '';
  var code, chr, value, index;

  // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
  for (code = 65; code < 76; code++) {
    chr = String.fromCharCode(code);

    switch (code) {
      case 66: case 69: case 70: case 72: value = 3; break;
      case 68: case 71: value = 4; break;
      default: value = 2;
    }

    for (index = 0; index < 47; index++) {
      test.push({ k: chr + index, v: value });
    }
  }

  test.sort(function (a, b) { return b.v - a.v; });

  for (index = 0; index < test.length; index++) {
    chr = test[index].k.charAt(0);
    if (result.charAt(result.length - 1) !== chr) result += chr;
  }

  return result !== 'DGBEFHACIJK';
});

var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;

var getSortCompare = function (comparefn) {
  return function (x, y) {
    if (y === undefined) return -1;
    if (x === undefined) return 1;
    if (comparefn !== undefined) return +comparefn(x, y) || 0;
    return toString(x) > toString(y) ? 1 : -1;
  };
};

// `Array.prototype.sort` method
// https://tc39.es/ecma262/#sec-array.prototype.sort
$({ target: 'Array', proto: true, forced: FORCED }, {
  sort: function sort(comparefn) {
    if (comparefn !== undefined) aCallable(comparefn);

    var array = toObject(this);

    if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn);

    var items = [];
    var arrayLength = lengthOfArrayLike(array);
    var itemsLength, index;

    for (index = 0; index < arrayLength; index++) {
      if (index in array) items.push(array[index]);
    }

    items = internalSort(items, getSortCompare(comparefn));
    itemsLength = items.length;
    index = 0;

    while (index < itemsLength) array[index] = items[index++];
    while (index < arrayLength) delete array[index++];

    return array;
  }
});


/***/ }),

/***/ "4fad":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var $entries = __webpack_require__("6f53").entries;

// `Object.entries` method
// https://tc39.es/ecma262/#sec-object.entries
$({ target: 'Object', stat: true }, {
  entries: function entries(O) {
    return $entries(O);
  }
});


/***/ }),

/***/ "5087":
/***/ (function(module, exports, __webpack_require__) {

var isConstructor = __webpack_require__("68ee");
var tryToString = __webpack_require__("0d51");

// `Assert: IsConstructor(argument) is true`
module.exports = function (argument) {
  if (isConstructor(argument)) return argument;
  throw TypeError(tryToString(argument) + ' is not a constructor');
};


/***/ }),

/***/ "50c4":
/***/ (function(module, exports, __webpack_require__) {

var toIntegerOrInfinity = __webpack_require__("5926");

var min = Math.min;

// `ToLength` abstract operation
// https://tc39.es/ecma262/#sec-tolength
module.exports = function (argument) {
  return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};


/***/ }),

/***/ "512c":
/***/ (function(module, exports, __webpack_require__) {

var userAgent = __webpack_require__("342f");

var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);

module.exports = !!webkit && +webkit[1];


/***/ }),

/***/ "5319":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var fixRegExpWellKnownSymbolLogic = __webpack_require__("d784");
var fails = __webpack_require__("d039");
var anObject = __webpack_require__("825a");
var isCallable = __webpack_require__("1626");
var toIntegerOrInfinity = __webpack_require__("5926");
var toLength = __webpack_require__("50c4");
var toString = __webpack_require__("577e");
var requireObjectCoercible = __webpack_require__("1d80");
var advanceStringIndex = __webpack_require__("8aa5");
var getMethod = __webpack_require__("dc4a");
var getSubstitution = __webpack_require__("0cb2");
var regExpExec = __webpack_require__("14c3");
var wellKnownSymbol = __webpack_require__("b622");

var REPLACE = wellKnownSymbol('replace');
var max = Math.max;
var min = Math.min;

var maybeToString = function (it) {
  return it === undefined ? it : String(it);
};

// IE <= 11 replaces $0 with the whole match, as if it was $&
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
var REPLACE_KEEPS_$0 = (function () {
  // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
  return 'a'.replace(/./, '$0') === '$0';
})();

// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  if (/./[REPLACE]) {
    return /./[REPLACE]('a', '$0') === '';
  }
  return false;
})();

var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  var re = /./;
  re.exec = function () {
    var result = [];
    result.groups = { a: '7' };
    return result;
  };
  // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
  return ''.replace(re, '$<a>') !== '7';
});

// @@replace logic
fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
  var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';

  return [
    // `String.prototype.replace` method
    // https://tc39.es/ecma262/#sec-string.prototype.replace
    function replace(searchValue, replaceValue) {
      var O = requireObjectCoercible(this);
      var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
      return replacer
        ? replacer.call(searchValue, O, replaceValue)
        : nativeReplace.call(toString(O), searchValue, replaceValue);
    },
    // `RegExp.prototype[@@replace]` method
    // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
    function (string, replaceValue) {
      var rx = anObject(this);
      var S = toString(string);

      if (
        typeof replaceValue === 'string' &&
        replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 &&
        replaceValue.indexOf('$<') === -1
      ) {
        var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
        if (res.done) return res.value;
      }

      var functionalReplace = isCallable(replaceValue);
      if (!functionalReplace) replaceValue = toString(replaceValue);

      var global = rx.global;
      if (global) {
        var fullUnicode = rx.unicode;
        rx.lastIndex = 0;
      }
      var results = [];
      while (true) {
        var result = regExpExec(rx, S);
        if (result === null) break;

        results.push(result);
        if (!global) break;

        var matchStr = toString(result[0]);
        if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
      }

      var accumulatedResult = '';
      var nextSourcePosition = 0;
      for (var i = 0; i < results.length; i++) {
        result = results[i];

        var matched = toString(result[0]);
        var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
        var captures = [];
        // NOTE: This is equivalent to
        //   captures = result.slice(1).map(maybeToString)
        // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
        // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
        // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
        for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
        var namedCaptures = result.groups;
        if (functionalReplace) {
          var replacerArgs = [matched].concat(captures, position, S);
          if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
          var replacement = toString(replaceValue.apply(undefined, replacerArgs));
        } else {
          replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
        }
        if (position >= nextSourcePosition) {
          accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
          nextSourcePosition = position + matched.length;
        }
      }
      return accumulatedResult + S.slice(nextSourcePosition);
    }
  ];
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);


/***/ }),

/***/ "5377":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var objectDefinePropertyModule = __webpack_require__("9bf2");
var regExpFlags = __webpack_require__("ad6d");
var fails = __webpack_require__("d039");

var FORCED = DESCRIPTORS && fails(function () {
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  return Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call({ dotAll: true, sticky: true }) !== 'sy';
});

// `RegExp.prototype.flags` getter
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
if (FORCED) objectDefinePropertyModule.f(RegExp.prototype, 'flags', {
  configurable: true,
  get: regExpFlags
});


/***/ }),

/***/ "542d":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var fails = __webpack_require__("d039");
var thisNumberValue = __webpack_require__("408a");

var nativeToPrecision = 1.0.toPrecision;

var FORCED = fails(function () {
  // IE7-
  return nativeToPrecision.call(1, undefined) !== '1';
}) || !fails(function () {
  // V8 ~ Android 4.3-
  nativeToPrecision.call({});
});

// `Number.prototype.toPrecision` method
// https://tc39.es/ecma262/#sec-number.prototype.toprecision
$({ target: 'Number', proto: true, forced: FORCED }, {
  toPrecision: function toPrecision(precision) {
    return precision === undefined
      ? nativeToPrecision.call(thisNumberValue(this))
      : nativeToPrecision.call(thisNumberValue(this), precision);
  }
});


/***/ }),

/***/ "54c2":
/***/ (function(module, exports, __webpack_require__) {

const eq = __webpack_require__("c5fb")
const neq = __webpack_require__("76db")
const gt = __webpack_require__("eec3")
const gte = __webpack_require__("0e49")
const lt = __webpack_require__("2426")
const lte = __webpack_require__("6ddc")

const cmp = (a, op, b, loose) => {
  switch (op) {
    case '===':
      if (typeof a === 'object')
        a = a.version
      if (typeof b === 'object')
        b = b.version
      return a === b

    case '!==':
      if (typeof a === 'object')
        a = a.version
      if (typeof b === 'object')
        b = b.version
      return a !== b

    case '':
    case '=':
    case '==':
      return eq(a, b, loose)

    case '!=':
      return neq(a, b, loose)

    case '>':
      return gt(a, b, loose)

    case '>=':
      return gte(a, b, loose)

    case '<':
      return lt(a, b, loose)

    case '<=':
      return lte(a, b, loose)

    default:
      throw new TypeError(`Invalid operator: ${op}`)
  }
}
module.exports = cmp


/***/ }),

/***/ "55f8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export utcMonths */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");


var utcMonth = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setUTCDate(1);
  date.setUTCHours(0, 0, 0, 0);
}, function(date, step) {
  date.setUTCMonth(date.getUTCMonth() + step);
}, function(start, end) {
  return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
}, function(date) {
  return date.getUTCMonth();
});

/* harmony default export */ __webpack_exports__["a"] = (utcMonth);
var utcMonths = utcMonth.range;


/***/ }),

/***/ "566a":
/***/ (function(module, exports, __webpack_require__) {

// Determine if version is greater than all the versions possible in the range.
const outside = __webpack_require__("d1e2")
const gtr = (version, range, options) => outside(version, range, '>', options)
module.exports = gtr


/***/ }),

/***/ "5692":
/***/ (function(module, exports, __webpack_require__) {

var IS_PURE = __webpack_require__("c430");
var store = __webpack_require__("c6cd");

(module.exports = function (key, value) {
  return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
  version: '3.18.3',
  mode: IS_PURE ? 'pure' : 'global',
  copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
});


/***/ }),

/***/ "56ef":
/***/ (function(module, exports, __webpack_require__) {

var getBuiltIn = __webpack_require__("d066");
var getOwnPropertyNamesModule = __webpack_require__("241c");
var getOwnPropertySymbolsModule = __webpack_require__("7418");
var anObject = __webpack_require__("825a");

// all object keys, includes non-enumerable and symbols
module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  var keys = getOwnPropertyNamesModule.f(anObject(it));
  var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
};


/***/ }),

/***/ "577e":
/***/ (function(module, exports, __webpack_require__) {

var classof = __webpack_require__("f5df");

module.exports = function (argument) {
  if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
  return String(argument);
};


/***/ }),

/***/ "5899":
/***/ (function(module, exports) {

// a string of all valid unicode whitespaces
module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';


/***/ }),

/***/ "58a8":
/***/ (function(module, exports, __webpack_require__) {

var requireObjectCoercible = __webpack_require__("1d80");
var toString = __webpack_require__("577e");
var whitespaces = __webpack_require__("5899");

var whitespace = '[' + whitespaces + ']';
var ltrim = RegExp('^' + whitespace + whitespace + '*');
var rtrim = RegExp(whitespace + whitespace + '*$');

// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
var createMethod = function (TYPE) {
  return function ($this) {
    var string = toString(requireObjectCoercible($this));
    if (TYPE & 1) string = string.replace(ltrim, '');
    if (TYPE & 2) string = string.replace(rtrim, '');
    return string;
  };
};

module.exports = {
  // `String.prototype.{ trimLeft, trimStart }` methods
  // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  start: createMethod(1),
  // `String.prototype.{ trimRight, trimEnd }` methods
  // https://tc39.es/ecma262/#sec-string.prototype.trimend
  end: createMethod(2),
  // `String.prototype.trim` method
  // https://tc39.es/ecma262/#sec-string.prototype.trim
  trim: createMethod(3)
};


/***/ }),

/***/ "5926":
/***/ (function(module, exports) {

var ceil = Math.ceil;
var floor = Math.floor;

// `ToIntegerOrInfinity` abstract operation
// https://tc39.es/ecma262/#sec-tointegerorinfinity
module.exports = function (argument) {
  var number = +argument;
  // eslint-disable-next-line no-self-compare -- safe
  return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
};


/***/ }),

/***/ "59ed":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");
var tryToString = __webpack_require__("0d51");

// `Assert: IsCallable(argument) is true`
module.exports = function (argument) {
  if (isCallable(argument)) return argument;
  throw TypeError(tryToString(argument) + ' is not a function');
};


/***/ }),

/***/ "5a34":
/***/ (function(module, exports, __webpack_require__) {

var isRegExp = __webpack_require__("44e7");

module.exports = function (it) {
  if (isRegExp(it)) {
    throw TypeError("The method doesn't accept regular expressions");
  } return it;
};


/***/ }),

/***/ "5c6c":
/***/ (function(module, exports) {

module.exports = function (bitmap, value) {
  return {
    enumerable: !(bitmap & 1),
    configurable: !(bitmap & 2),
    writable: !(bitmap & 4),
    value: value
  };
};


/***/ }),

/***/ "5cf7":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

module.exports = Yallist

Yallist.Node = Node
Yallist.create = Yallist

function Yallist (list) {
  var self = this
  if (!(self instanceof Yallist)) {
    self = new Yallist()
  }

  self.tail = null
  self.head = null
  self.length = 0

  if (list && typeof list.forEach === 'function') {
    list.forEach(function (item) {
      self.push(item)
    })
  } else if (arguments.length > 0) {
    for (var i = 0, l = arguments.length; i < l; i++) {
      self.push(arguments[i])
    }
  }

  return self
}

Yallist.prototype.removeNode = function (node) {
  if (node.list !== this) {
    throw new Error('removing node which does not belong to this list')
  }

  var next = node.next
  var prev = node.prev

  if (next) {
    next.prev = prev
  }

  if (prev) {
    prev.next = next
  }

  if (node === this.head) {
    this.head = next
  }
  if (node === this.tail) {
    this.tail = prev
  }

  node.list.length--
  node.next = null
  node.prev = null
  node.list = null

  return next
}

Yallist.prototype.unshiftNode = function (node) {
  if (node === this.head) {
    return
  }

  if (node.list) {
    node.list.removeNode(node)
  }

  var head = this.head
  node.list = this
  node.next = head
  if (head) {
    head.prev = node
  }

  this.head = node
  if (!this.tail) {
    this.tail = node
  }
  this.length++
}

Yallist.prototype.pushNode = function (node) {
  if (node === this.tail) {
    return
  }

  if (node.list) {
    node.list.removeNode(node)
  }

  var tail = this.tail
  node.list = this
  node.prev = tail
  if (tail) {
    tail.next = node
  }

  this.tail = node
  if (!this.head) {
    this.head = node
  }
  this.length++
}

Yallist.prototype.push = function () {
  for (var i = 0, l = arguments.length; i < l; i++) {
    push(this, arguments[i])
  }
  return this.length
}

Yallist.prototype.unshift = function () {
  for (var i = 0, l = arguments.length; i < l; i++) {
    unshift(this, arguments[i])
  }
  return this.length
}

Yallist.prototype.pop = function () {
  if (!this.tail) {
    return undefined
  }

  var res = this.tail.value
  this.tail = this.tail.prev
  if (this.tail) {
    this.tail.next = null
  } else {
    this.head = null
  }
  this.length--
  return res
}

Yallist.prototype.shift = function () {
  if (!this.head) {
    return undefined
  }

  var res = this.head.value
  this.head = this.head.next
  if (this.head) {
    this.head.prev = null
  } else {
    this.tail = null
  }
  this.length--
  return res
}

Yallist.prototype.forEach = function (fn, thisp) {
  thisp = thisp || this
  for (var walker = this.head, i = 0; walker !== null; i++) {
    fn.call(thisp, walker.value, i, this)
    walker = walker.next
  }
}

Yallist.prototype.forEachReverse = function (fn, thisp) {
  thisp = thisp || this
  for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
    fn.call(thisp, walker.value, i, this)
    walker = walker.prev
  }
}

Yallist.prototype.get = function (n) {
  for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
    // abort out of the list early if we hit a cycle
    walker = walker.next
  }
  if (i === n && walker !== null) {
    return walker.value
  }
}

Yallist.prototype.getReverse = function (n) {
  for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
    // abort out of the list early if we hit a cycle
    walker = walker.prev
  }
  if (i === n && walker !== null) {
    return walker.value
  }
}

Yallist.prototype.map = function (fn, thisp) {
  thisp = thisp || this
  var res = new Yallist()
  for (var walker = this.head; walker !== null;) {
    res.push(fn.call(thisp, walker.value, this))
    walker = walker.next
  }
  return res
}

Yallist.prototype.mapReverse = function (fn, thisp) {
  thisp = thisp || this
  var res = new Yallist()
  for (var walker = this.tail; walker !== null;) {
    res.push(fn.call(thisp, walker.value, this))
    walker = walker.prev
  }
  return res
}

Yallist.prototype.reduce = function (fn, initial) {
  var acc
  var walker = this.head
  if (arguments.length > 1) {
    acc = initial
  } else if (this.head) {
    walker = this.head.next
    acc = this.head.value
  } else {
    throw new TypeError('Reduce of empty list with no initial value')
  }

  for (var i = 0; walker !== null; i++) {
    acc = fn(acc, walker.value, i)
    walker = walker.next
  }

  return acc
}

Yallist.prototype.reduceReverse = function (fn, initial) {
  var acc
  var walker = this.tail
  if (arguments.length > 1) {
    acc = initial
  } else if (this.tail) {
    walker = this.tail.prev
    acc = this.tail.value
  } else {
    throw new TypeError('Reduce of empty list with no initial value')
  }

  for (var i = this.length - 1; walker !== null; i--) {
    acc = fn(acc, walker.value, i)
    walker = walker.prev
  }

  return acc
}

Yallist.prototype.toArray = function () {
  var arr = new Array(this.length)
  for (var i = 0, walker = this.head; walker !== null; i++) {
    arr[i] = walker.value
    walker = walker.next
  }
  return arr
}

Yallist.prototype.toArrayReverse = function () {
  var arr = new Array(this.length)
  for (var i = 0, walker = this.tail; walker !== null; i++) {
    arr[i] = walker.value
    walker = walker.prev
  }
  return arr
}

Yallist.prototype.slice = function (from, to) {
  to = to || this.length
  if (to < 0) {
    to += this.length
  }
  from = from || 0
  if (from < 0) {
    from += this.length
  }
  var ret = new Yallist()
  if (to < from || to < 0) {
    return ret
  }
  if (from < 0) {
    from = 0
  }
  if (to > this.length) {
    to = this.length
  }
  for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
    walker = walker.next
  }
  for (; walker !== null && i < to; i++, walker = walker.next) {
    ret.push(walker.value)
  }
  return ret
}

Yallist.prototype.sliceReverse = function (from, to) {
  to = to || this.length
  if (to < 0) {
    to += this.length
  }
  from = from || 0
  if (from < 0) {
    from += this.length
  }
  var ret = new Yallist()
  if (to < from || to < 0) {
    return ret
  }
  if (from < 0) {
    from = 0
  }
  if (to > this.length) {
    to = this.length
  }
  for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
    walker = walker.prev
  }
  for (; walker !== null && i > from; i--, walker = walker.prev) {
    ret.push(walker.value)
  }
  return ret
}

Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
  if (start > this.length) {
    start = this.length - 1
  }
  if (start < 0) {
    start = this.length + start;
  }

  for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
    walker = walker.next
  }

  var ret = []
  for (var i = 0; walker && i < deleteCount; i++) {
    ret.push(walker.value)
    walker = this.removeNode(walker)
  }
  if (walker === null) {
    walker = this.tail
  }

  if (walker !== this.head && walker !== this.tail) {
    walker = walker.prev
  }

  for (var i = 0; i < nodes.length; i++) {
    walker = insert(this, walker, nodes[i])
  }
  return ret;
}

Yallist.prototype.reverse = function () {
  var head = this.head
  var tail = this.tail
  for (var walker = head; walker !== null; walker = walker.prev) {
    var p = walker.prev
    walker.prev = walker.next
    walker.next = p
  }
  this.head = tail
  this.tail = head
  return this
}

function insert (self, node, value) {
  var inserted = node === self.head ?
    new Node(value, null, node, self) :
    new Node(value, node, node.next, self)

  if (inserted.next === null) {
    self.tail = inserted
  }
  if (inserted.prev === null) {
    self.head = inserted
  }

  self.length++

  return inserted
}

function push (self, item) {
  self.tail = new Node(item, self.tail, null, self)
  if (!self.head) {
    self.head = self.tail
  }
  self.length++
}

function unshift (self, item) {
  self.head = new Node(item, null, self.head, self)
  if (!self.tail) {
    self.tail = self.head
  }
  self.length++
}

function Node (value, prev, next, list) {
  if (!(this instanceof Node)) {
    return new Node(value, prev, next, list)
  }

  this.list = list
  this.value = value

  if (prev) {
    prev.next = this
    this.prev = prev
  } else {
    this.prev = null
  }

  if (next) {
    next.prev = this
    this.next = next
  } else {
    this.next = null
  }
}

try {
  // add if support for Symbol.iterator is present
  __webpack_require__("1f03")(Yallist)
} catch (er) {}


/***/ }),

/***/ "5d41":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var isObject = __webpack_require__("861d");
var anObject = __webpack_require__("825a");
var isDataDescriptor = __webpack_require__("c60d");
var getOwnPropertyDescriptorModule = __webpack_require__("06cf");
var getPrototypeOf = __webpack_require__("e163");

// `Reflect.get` method
// https://tc39.es/ecma262/#sec-reflect.get
function get(target, propertyKey /* , receiver */) {
  var receiver = arguments.length < 3 ? target : arguments[2];
  var descriptor, prototype;
  if (anObject(target) === receiver) return target[propertyKey];
  descriptor = getOwnPropertyDescriptorModule.f(target, propertyKey);
  if (descriptor) return isDataDescriptor(descriptor)
    ? descriptor.value
    : descriptor.get === undefined ? undefined : descriptor.get.call(receiver);
  if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver);
}

$({ target: 'Reflect', stat: true }, {
  get: get
});


/***/ }),

/***/ "5db7":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var flattenIntoArray = __webpack_require__("a2bf");
var aCallable = __webpack_require__("59ed");
var toObject = __webpack_require__("7b0b");
var lengthOfArrayLike = __webpack_require__("07fa");
var arraySpeciesCreate = __webpack_require__("65f0");

// `Array.prototype.flatMap` method
// https://tc39.es/ecma262/#sec-array.prototype.flatmap
$({ target: 'Array', proto: true }, {
  flatMap: function flatMap(callbackfn /* , thisArg */) {
    var O = toObject(this);
    var sourceLen = lengthOfArrayLike(O);
    var A;
    aCallable(callbackfn);
    A = arraySpeciesCreate(O, 0);
    A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
    return A;
  }
});


/***/ }),

/***/ "5e77":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var hasOwn = __webpack_require__("1a2d");

var FunctionPrototype = Function.prototype;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;

var EXISTS = hasOwn(FunctionPrototype, 'name');
// additional protection from minified / mangled / dropped function names
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));

module.exports = {
  EXISTS: EXISTS,
  PROPER: PROPER,
  CONFIGURABLE: CONFIGURABLE
};


/***/ }),

/***/ "5edf":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export seconds */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");
/* harmony import */ var _duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1738");



var second = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setTime(date - date.getMilliseconds());
}, function(date, step) {
  date.setTime(+date + step * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationSecond */ "e"]);
}, function(start, end) {
  return (end - start) / _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationSecond */ "e"];
}, function(date) {
  return date.getUTCSeconds();
});

/* harmony default export */ __webpack_exports__["a"] = (second);
var seconds = second.range;


/***/ }),

/***/ "605d":
/***/ (function(module, exports, __webpack_require__) {

var classof = __webpack_require__("c6b6");
var global = __webpack_require__("da84");

module.exports = classof(global.process) == 'process';


/***/ }),

/***/ "6062":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var collection = __webpack_require__("6d61");
var collectionStrong = __webpack_require__("6566");

// `Set` constructor
// https://tc39.es/ecma262/#sec-set-objects
module.exports = collection('Set', function (init) {
  return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
}, collectionStrong);


/***/ }),

/***/ "6069":
/***/ (function(module, exports) {

module.exports = typeof window == 'object';


/***/ }),

/***/ "609d":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const minor = (a, loose) => new SemVer(a, loose).minor
module.exports = minor


/***/ }),

/***/ "60da":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var DESCRIPTORS = __webpack_require__("83ab");
var fails = __webpack_require__("d039");
var objectKeys = __webpack_require__("df75");
var getOwnPropertySymbolsModule = __webpack_require__("7418");
var propertyIsEnumerableModule = __webpack_require__("d1e7");
var toObject = __webpack_require__("7b0b");
var IndexedObject = __webpack_require__("44ad");

// eslint-disable-next-line es/no-object-assign -- safe
var $assign = Object.assign;
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
var defineProperty = Object.defineProperty;

// `Object.assign` method
// https://tc39.es/ecma262/#sec-object.assign
module.exports = !$assign || fails(function () {
  // should have correct order of operations (Edge bug)
  if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
    enumerable: true,
    get: function () {
      defineProperty(this, 'b', {
        value: 3,
        enumerable: false
      });
    }
  }), { b: 2 })).b !== 1) return true;
  // should work with symbols and should have deterministic property order (V8 bug)
  var A = {};
  var B = {};
  // eslint-disable-next-line es/no-symbol -- safe
  var symbol = Symbol();
  var alphabet = 'abcdefghijklmnopqrst';
  A[symbol] = 7;
  alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  var T = toObject(target);
  var argumentsLength = arguments.length;
  var index = 1;
  var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  var propertyIsEnumerable = propertyIsEnumerableModule.f;
  while (argumentsLength > index) {
    var S = IndexedObject(arguments[index++]);
    var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
    var length = keys.length;
    var j = 0;
    var key;
    while (length > j) {
      key = keys[j++];
      if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];
    }
  } return T;
} : $assign;


/***/ }),

/***/ "61bb":
/***/ (function(module, exports, __webpack_require__) {

const {MAX_LENGTH} = __webpack_require__("fe45")
const { re, t } = __webpack_require__("22c0")
const SemVer = __webpack_require__("df02")

const parseOptions = __webpack_require__("e12f")
const parse = (version, options) => {
  options = parseOptions(options)

  if (version instanceof SemVer) {
    return version
  }

  if (typeof version !== 'string') {
    return null
  }

  if (version.length > MAX_LENGTH) {
    return null
  }

  const r = options.loose ? re[t.LOOSE] : re[t.FULL]
  if (!r.test(version)) {
    return null
  }

  try {
    return new SemVer(version, options)
  } catch (er) {
    return null
  }
}

module.exports = parse


/***/ }),

/***/ "621a":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var global = __webpack_require__("da84");
var DESCRIPTORS = __webpack_require__("83ab");
var NATIVE_ARRAY_BUFFER = __webpack_require__("a981");
var FunctionName = __webpack_require__("5e77");
var createNonEnumerableProperty = __webpack_require__("9112");
var redefineAll = __webpack_require__("e2cc");
var fails = __webpack_require__("d039");
var anInstance = __webpack_require__("19aa");
var toIntegerOrInfinity = __webpack_require__("5926");
var toLength = __webpack_require__("50c4");
var toIndex = __webpack_require__("0b25");
var IEEE754 = __webpack_require__("77a7");
var getPrototypeOf = __webpack_require__("e163");
var setPrototypeOf = __webpack_require__("d2bb");
var getOwnPropertyNames = __webpack_require__("241c").f;
var defineProperty = __webpack_require__("9bf2").f;
var arrayFill = __webpack_require__("81d5");
var setToStringTag = __webpack_require__("d44e");
var InternalStateModule = __webpack_require__("69f3");

var PROPER_FUNCTION_NAME = FunctionName.PROPER;
var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
var getInternalState = InternalStateModule.get;
var setInternalState = InternalStateModule.set;
var ARRAY_BUFFER = 'ArrayBuffer';
var DATA_VIEW = 'DataView';
var PROTOTYPE = 'prototype';
var WRONG_LENGTH = 'Wrong length';
var WRONG_INDEX = 'Wrong index';
var NativeArrayBuffer = global[ARRAY_BUFFER];
var $ArrayBuffer = NativeArrayBuffer;
var $DataView = global[DATA_VIEW];
var $DataViewPrototype = $DataView && $DataView[PROTOTYPE];
var ObjectPrototype = Object.prototype;
var RangeError = global.RangeError;

var packIEEE754 = IEEE754.pack;
var unpackIEEE754 = IEEE754.unpack;

var packInt8 = function (number) {
  return [number & 0xFF];
};

var packInt16 = function (number) {
  return [number & 0xFF, number >> 8 & 0xFF];
};

var packInt32 = function (number) {
  return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF];
};

var unpackInt32 = function (buffer) {
  return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0];
};

var packFloat32 = function (number) {
  return packIEEE754(number, 23, 4);
};

var packFloat64 = function (number) {
  return packIEEE754(number, 52, 8);
};

var addGetter = function (Constructor, key) {
  defineProperty(Constructor[PROTOTYPE], key, { get: function () { return getInternalState(this)[key]; } });
};

var get = function (view, count, index, isLittleEndian) {
  var intIndex = toIndex(index);
  var store = getInternalState(view);
  if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
  var bytes = getInternalState(store.buffer).bytes;
  var start = intIndex + store.byteOffset;
  var pack = bytes.slice(start, start + count);
  return isLittleEndian ? pack : pack.reverse();
};

var set = function (view, count, index, conversion, value, isLittleEndian) {
  var intIndex = toIndex(index);
  var store = getInternalState(view);
  if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
  var bytes = getInternalState(store.buffer).bytes;
  var start = intIndex + store.byteOffset;
  var pack = conversion(+value);
  for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
};

if (!NATIVE_ARRAY_BUFFER) {
  $ArrayBuffer = function ArrayBuffer(length) {
    anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
    var byteLength = toIndex(length);
    setInternalState(this, {
      bytes: arrayFill.call(new Array(byteLength), 0),
      byteLength: byteLength
    });
    if (!DESCRIPTORS) this.byteLength = byteLength;
  };

  $DataView = function DataView(buffer, byteOffset, byteLength) {
    anInstance(this, $DataView, DATA_VIEW);
    anInstance(buffer, $ArrayBuffer, DATA_VIEW);
    var bufferLength = getInternalState(buffer).byteLength;
    var offset = toIntegerOrInfinity(byteOffset);
    if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset');
    byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
    if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
    setInternalState(this, {
      buffer: buffer,
      byteLength: byteLength,
      byteOffset: offset
    });
    if (!DESCRIPTORS) {
      this.buffer = buffer;
      this.byteLength = byteLength;
      this.byteOffset = offset;
    }
  };

  if (DESCRIPTORS) {
    addGetter($ArrayBuffer, 'byteLength');
    addGetter($DataView, 'buffer');
    addGetter($DataView, 'byteLength');
    addGetter($DataView, 'byteOffset');
  }

  redefineAll($DataView[PROTOTYPE], {
    getInt8: function getInt8(byteOffset) {
      return get(this, 1, byteOffset)[0] << 24 >> 24;
    },
    getUint8: function getUint8(byteOffset) {
      return get(this, 1, byteOffset)[0];
    },
    getInt16: function getInt16(byteOffset /* , littleEndian */) {
      var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
      return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
    },
    getUint16: function getUint16(byteOffset /* , littleEndian */) {
      var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
      return bytes[1] << 8 | bytes[0];
    },
    getInt32: function getInt32(byteOffset /* , littleEndian */) {
      return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined));
    },
    getUint32: function getUint32(byteOffset /* , littleEndian */) {
      return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0;
    },
    getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
      return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23);
    },
    getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
      return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52);
    },
    setInt8: function setInt8(byteOffset, value) {
      set(this, 1, byteOffset, packInt8, value);
    },
    setUint8: function setUint8(byteOffset, value) {
      set(this, 1, byteOffset, packInt8, value);
    },
    setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
      set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
    },
    setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
      set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
    },
    setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
      set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
    },
    setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
      set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
    },
    setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
      set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined);
    },
    setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
      set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined);
    }
  });
} else {
  var INCORRECT_ARRAY_BUFFER_NAME = PROPER_FUNCTION_NAME && NativeArrayBuffer.name !== ARRAY_BUFFER;
  /* eslint-disable no-new -- required for testing */
  if (!fails(function () {
    NativeArrayBuffer(1);
  }) || !fails(function () {
    new NativeArrayBuffer(-1);
  }) || fails(function () {
    new NativeArrayBuffer();
    new NativeArrayBuffer(1.5);
    new NativeArrayBuffer(NaN);
    return INCORRECT_ARRAY_BUFFER_NAME && !CONFIGURABLE_FUNCTION_NAME;
  })) {
  /* eslint-enable no-new -- required for testing */
    $ArrayBuffer = function ArrayBuffer(length) {
      anInstance(this, $ArrayBuffer);
      return new NativeArrayBuffer(toIndex(length));
    };
    var ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE] = NativeArrayBuffer[PROTOTYPE];
    for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) {
      if (!((key = keys[j++]) in $ArrayBuffer)) {
        createNonEnumerableProperty($ArrayBuffer, key, NativeArrayBuffer[key]);
      }
    }
    ArrayBufferPrototype.constructor = $ArrayBuffer;
  } else if (INCORRECT_ARRAY_BUFFER_NAME && CONFIGURABLE_FUNCTION_NAME) {
    createNonEnumerableProperty(NativeArrayBuffer, 'name', ARRAY_BUFFER);
  }

  // WebKit bug - the same parent prototype for typed arrays and data view
  if (setPrototypeOf && getPrototypeOf($DataViewPrototype) !== ObjectPrototype) {
    setPrototypeOf($DataViewPrototype, ObjectPrototype);
  }

  // iOS Safari 7.x bug
  var testView = new $DataView(new $ArrayBuffer(2));
  var $setInt8 = $DataViewPrototype.setInt8;
  testView.setInt8(0, 2147483648);
  testView.setInt8(1, 2147483649);
  if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataViewPrototype, {
    setInt8: function setInt8(byteOffset, value) {
      $setInt8.call(this, byteOffset, value << 24 >> 24);
    },
    setUint8: function setUint8(byteOffset, value) {
      $setInt8.call(this, byteOffset, value << 24 >> 24);
    }
  }, { unsafe: true });
}

setToStringTag($ArrayBuffer, ARRAY_BUFFER);
setToStringTag($DataView, DATA_VIEW);

module.exports = {
  ArrayBuffer: $ArrayBuffer,
  DataView: $DataView
};


/***/ }),

/***/ "627e":
/***/ (function(module, exports, __webpack_require__) {

const parse = __webpack_require__("61bb")
const eq = __webpack_require__("c5fb")

const diff = (version1, version2) => {
  if (eq(version1, version2)) {
    return null
  } else {
    const v1 = parse(version1)
    const v2 = parse(version2)
    const hasPre = v1.prerelease.length || v2.prerelease.length
    const prefix = hasPre ? 'pre' : ''
    const defaultResult = hasPre ? 'prerelease' : ''
    for (const key in v1) {
      if (key === 'major' || key === 'minor' || key === 'patch') {
        if (v1[key] !== v2[key]) {
          return prefix + key
        }
      }
    }
    return defaultResult // may be undefined
  }
}
module.exports = diff


/***/ }),

/***/ "6547":
/***/ (function(module, exports, __webpack_require__) {

var toIntegerOrInfinity = __webpack_require__("5926");
var toString = __webpack_require__("577e");
var requireObjectCoercible = __webpack_require__("1d80");

var createMethod = function (CONVERT_TO_STRING) {
  return function ($this, pos) {
    var S = toString(requireObjectCoercible($this));
    var position = toIntegerOrInfinity(pos);
    var size = S.length;
    var first, second;
    if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
    first = S.charCodeAt(position);
    return first < 0xD800 || first > 0xDBFF || position + 1 === size
      || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
        ? CONVERT_TO_STRING ? S.charAt(position) : first
        : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  };
};

module.exports = {
  // `String.prototype.codePointAt` method
  // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  codeAt: createMethod(false),
  // `String.prototype.at` method
  // https://github.com/mathiasbynens/String.prototype.at
  charAt: createMethod(true)
};


/***/ }),

/***/ "6566":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var defineProperty = __webpack_require__("9bf2").f;
var create = __webpack_require__("7c73");
var redefineAll = __webpack_require__("e2cc");
var bind = __webpack_require__("0366");
var anInstance = __webpack_require__("19aa");
var iterate = __webpack_require__("2266");
var defineIterator = __webpack_require__("7dd0");
var setSpecies = __webpack_require__("2626");
var DESCRIPTORS = __webpack_require__("83ab");
var fastKey = __webpack_require__("f183").fastKey;
var InternalStateModule = __webpack_require__("69f3");

var setInternalState = InternalStateModule.set;
var internalStateGetterFor = InternalStateModule.getterFor;

module.exports = {
  getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
    var C = wrapper(function (that, iterable) {
      anInstance(that, C, CONSTRUCTOR_NAME);
      setInternalState(that, {
        type: CONSTRUCTOR_NAME,
        index: create(null),
        first: undefined,
        last: undefined,
        size: 0
      });
      if (!DESCRIPTORS) that.size = 0;
      if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
    });

    var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);

    var define = function (that, key, value) {
      var state = getInternalState(that);
      var entry = getEntry(that, key);
      var previous, index;
      // change existing entry
      if (entry) {
        entry.value = value;
      // create new entry
      } else {
        state.last = entry = {
          index: index = fastKey(key, true),
          key: key,
          value: value,
          previous: previous = state.last,
          next: undefined,
          removed: false
        };
        if (!state.first) state.first = entry;
        if (previous) previous.next = entry;
        if (DESCRIPTORS) state.size++;
        else that.size++;
        // add to index
        if (index !== 'F') state.index[index] = entry;
      } return that;
    };

    var getEntry = function (that, key) {
      var state = getInternalState(that);
      // fast case
      var index = fastKey(key);
      var entry;
      if (index !== 'F') return state.index[index];
      // frozen object case
      for (entry = state.first; entry; entry = entry.next) {
        if (entry.key == key) return entry;
      }
    };

    redefineAll(C.prototype, {
      // `{ Map, Set }.prototype.clear()` methods
      // https://tc39.es/ecma262/#sec-map.prototype.clear
      // https://tc39.es/ecma262/#sec-set.prototype.clear
      clear: function clear() {
        var that = this;
        var state = getInternalState(that);
        var data = state.index;
        var entry = state.first;
        while (entry) {
          entry.removed = true;
          if (entry.previous) entry.previous = entry.previous.next = undefined;
          delete data[entry.index];
          entry = entry.next;
        }
        state.first = state.last = undefined;
        if (DESCRIPTORS) state.size = 0;
        else that.size = 0;
      },
      // `{ Map, Set }.prototype.delete(key)` methods
      // https://tc39.es/ecma262/#sec-map.prototype.delete
      // https://tc39.es/ecma262/#sec-set.prototype.delete
      'delete': function (key) {
        var that = this;
        var state = getInternalState(that);
        var entry = getEntry(that, key);
        if (entry) {
          var next = entry.next;
          var prev = entry.previous;
          delete state.index[entry.index];
          entry.removed = true;
          if (prev) prev.next = next;
          if (next) next.previous = prev;
          if (state.first == entry) state.first = next;
          if (state.last == entry) state.last = prev;
          if (DESCRIPTORS) state.size--;
          else that.size--;
        } return !!entry;
      },
      // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
      // https://tc39.es/ecma262/#sec-map.prototype.foreach
      // https://tc39.es/ecma262/#sec-set.prototype.foreach
      forEach: function forEach(callbackfn /* , that = undefined */) {
        var state = getInternalState(this);
        var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
        var entry;
        while (entry = entry ? entry.next : state.first) {
          boundFunction(entry.value, entry.key, this);
          // revert to the last existing entry
          while (entry && entry.removed) entry = entry.previous;
        }
      },
      // `{ Map, Set}.prototype.has(key)` methods
      // https://tc39.es/ecma262/#sec-map.prototype.has
      // https://tc39.es/ecma262/#sec-set.prototype.has
      has: function has(key) {
        return !!getEntry(this, key);
      }
    });

    redefineAll(C.prototype, IS_MAP ? {
      // `Map.prototype.get(key)` method
      // https://tc39.es/ecma262/#sec-map.prototype.get
      get: function get(key) {
        var entry = getEntry(this, key);
        return entry && entry.value;
      },
      // `Map.prototype.set(key, value)` method
      // https://tc39.es/ecma262/#sec-map.prototype.set
      set: function set(key, value) {
        return define(this, key === 0 ? 0 : key, value);
      }
    } : {
      // `Set.prototype.add(value)` method
      // https://tc39.es/ecma262/#sec-set.prototype.add
      add: function add(value) {
        return define(this, value = value === 0 ? 0 : value, value);
      }
    });
    if (DESCRIPTORS) defineProperty(C.prototype, 'size', {
      get: function () {
        return getInternalState(this).size;
      }
    });
    return C;
  },
  setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
    var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
    var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
    var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
    // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
    // https://tc39.es/ecma262/#sec-map.prototype.entries
    // https://tc39.es/ecma262/#sec-map.prototype.keys
    // https://tc39.es/ecma262/#sec-map.prototype.values
    // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
    // https://tc39.es/ecma262/#sec-set.prototype.entries
    // https://tc39.es/ecma262/#sec-set.prototype.keys
    // https://tc39.es/ecma262/#sec-set.prototype.values
    // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
    defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
      setInternalState(this, {
        type: ITERATOR_NAME,
        target: iterated,
        state: getInternalCollectionState(iterated),
        kind: kind,
        last: undefined
      });
    }, function () {
      var state = getInternalIteratorState(this);
      var kind = state.kind;
      var entry = state.last;
      // revert to the last existing entry
      while (entry && entry.removed) entry = entry.previous;
      // get next entry
      if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
        // or finish the iteration
        state.target = undefined;
        return { value: undefined, done: true };
      }
      // return step by kind
      if (kind == 'keys') return { value: entry.key, done: false };
      if (kind == 'values') return { value: entry.value, done: false };
      return { value: [entry.key, entry.value], done: false };
    }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);

    // `{ Map, Set }.prototype[@@species]` accessors
    // https://tc39.es/ecma262/#sec-get-map-@@species
    // https://tc39.es/ecma262/#sec-get-set-@@species
    setSpecies(CONSTRUCTOR_NAME);
  }
};


/***/ }),

/***/ "6582":
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// Note: This regex matches even invalid JSON strings, but since we’re
// working on the output of `JSON.stringify` we know that only valid strings
// are present (unless the user supplied a weird `options.indent` but in
// that case we don’t care since the output would be invalid anyway).
var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,]/g;

module.exports = function stringify(passedObj, options) {
  var indent, maxLength, replacer;

  options = options || {};
  indent = JSON.stringify(
    [1],
    undefined,
    options.indent === undefined ? 2 : options.indent
  ).slice(2, -3);
  maxLength =
    indent === ""
      ? Infinity
      : options.maxLength === undefined
      ? 80
      : options.maxLength;
  replacer = options.replacer;

  return (function _stringify(obj, currentIndent, reserved) {
    // prettier-ignore
    var end, index, items, key, keyPart, keys, length, nextIndent, prettified, start, string, value;

    if (obj && typeof obj.toJSON === "function") {
      obj = obj.toJSON();
    }

    string = JSON.stringify(obj, replacer);

    if (string === undefined) {
      return string;
    }

    length = maxLength - currentIndent.length - reserved;

    if (string.length <= length) {
      prettified = string.replace(
        stringOrChar,
        function (match, stringLiteral) {
          return stringLiteral || match + " ";
        }
      );
      if (prettified.length <= length) {
        return prettified;
      }
    }

    if (replacer != null) {
      obj = JSON.parse(string);
      replacer = undefined;
    }

    if (typeof obj === "object" && obj !== null) {
      nextIndent = currentIndent + indent;
      items = [];
      index = 0;

      if (Array.isArray(obj)) {
        start = "[";
        end = "]";
        length = obj.length;
        for (; index < length; index++) {
          items.push(
            _stringify(obj[index], nextIndent, index === length - 1 ? 0 : 1) ||
              "null"
          );
        }
      } else {
        start = "{";
        end = "}";
        keys = Object.keys(obj);
        length = keys.length;
        for (; index < length; index++) {
          key = keys[index];
          keyPart = JSON.stringify(key) + ": ";
          value = _stringify(
            obj[key],
            nextIndent,
            keyPart.length + (index === length - 1 ? 0 : 1)
          );
          if (value !== undefined) {
            items.push(keyPart + value);
          }
        }
      }

      if (items.length > 0) {
        return [start, indent + items.join(",\n" + nextIndent), end].join(
          "\n" + currentIndent
        );
      }
    }

    return string;
  })(passedObj, "", 0);
};


/***/ }),

/***/ "65f0":
/***/ (function(module, exports, __webpack_require__) {

var arraySpeciesConstructor = __webpack_require__("0b42");

// `ArraySpeciesCreate` abstract operation
// https://tc39.es/ecma262/#sec-arrayspeciescreate
module.exports = function (originalArray, length) {
  return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
};


/***/ }),

/***/ "68ee":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var isCallable = __webpack_require__("1626");
var classof = __webpack_require__("f5df");
var getBuiltIn = __webpack_require__("d066");
var inspectSource = __webpack_require__("8925");

var empty = [];
var construct = getBuiltIn('Reflect', 'construct');
var constructorRegExp = /^\s*(?:class|function)\b/;
var exec = constructorRegExp.exec;
var INCORRECT_TO_STRING = !constructorRegExp.exec(function () { /* empty */ });

var isConstructorModern = function (argument) {
  if (!isCallable(argument)) return false;
  try {
    construct(Object, empty, argument);
    return true;
  } catch (error) {
    return false;
  }
};

var isConstructorLegacy = function (argument) {
  if (!isCallable(argument)) return false;
  switch (classof(argument)) {
    case 'AsyncFunction':
    case 'GeneratorFunction':
    case 'AsyncGeneratorFunction': return false;
    // we can't check .prototype since constructors produced by .bind haven't it
  } return INCORRECT_TO_STRING || !!exec.call(constructorRegExp, inspectSource(argument));
};

// `IsConstructor` abstract operation
// https://tc39.es/ecma262/#sec-isconstructor
module.exports = !construct || fails(function () {
  var called;
  return isConstructorModern(isConstructorModern.call)
    || !isConstructorModern(Object)
    || !isConstructorModern(function () { called = true; })
    || called;
}) ? isConstructorLegacy : isConstructorModern;


/***/ }),

/***/ "694b":
/***/ (function(module, exports, __webpack_require__) {

"use strict";


// do not edit .js files directly - edit src/index.jst



module.exports = function equal(a, b) {
  if (a === b) return true;

  if (a && b && typeof a == 'object' && typeof b == 'object') {
    if (a.constructor !== b.constructor) return false;

    var length, i, keys;
    if (Array.isArray(a)) {
      length = a.length;
      if (length != b.length) return false;
      for (i = length; i-- !== 0;)
        if (!equal(a[i], b[i])) return false;
      return true;
    }



    if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
    if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
    if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();

    keys = Object.keys(a);
    length = keys.length;
    if (length !== Object.keys(b).length) return false;

    for (i = length; i-- !== 0;)
      if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;

    for (i = length; i-- !== 0;) {
      var key = keys[i];

      if (!equal(a[key], b[key])) return false;
    }

    return true;
  }

  // true if both NaN, false otherwise
  return a!==a && b!==b;
};


/***/ }),

/***/ "69f3":
/***/ (function(module, exports, __webpack_require__) {

var NATIVE_WEAK_MAP = __webpack_require__("7f9a");
var global = __webpack_require__("da84");
var isObject = __webpack_require__("861d");
var createNonEnumerableProperty = __webpack_require__("9112");
var hasOwn = __webpack_require__("1a2d");
var shared = __webpack_require__("c6cd");
var sharedKey = __webpack_require__("f772");
var hiddenKeys = __webpack_require__("d012");

var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
var WeakMap = global.WeakMap;
var set, get, has;

var enforce = function (it) {
  return has(it) ? get(it) : set(it, {});
};

var getterFor = function (TYPE) {
  return function (it) {
    var state;
    if (!isObject(it) || (state = get(it)).type !== TYPE) {
      throw TypeError('Incompatible receiver, ' + TYPE + ' required');
    } return state;
  };
};

if (NATIVE_WEAK_MAP || shared.state) {
  var store = shared.state || (shared.state = new WeakMap());
  var wmget = store.get;
  var wmhas = store.has;
  var wmset = store.set;
  set = function (it, metadata) {
    if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
    metadata.facade = it;
    wmset.call(store, it, metadata);
    return metadata;
  };
  get = function (it) {
    return wmget.call(store, it) || {};
  };
  has = function (it) {
    return wmhas.call(store, it);
  };
} else {
  var STATE = sharedKey('state');
  hiddenKeys[STATE] = true;
  set = function (it, metadata) {
    if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
    metadata.facade = it;
    createNonEnumerableProperty(it, STATE, metadata);
    return metadata;
  };
  get = function (it) {
    return hasOwn(it, STATE) ? it[STATE] : {};
  };
  has = function (it) {
    return hasOwn(it, STATE);
  };
}

module.exports = {
  set: set,
  get: get,
  has: has,
  enforce: enforce,
  getterFor: getterFor
};


/***/ }),

/***/ "6d61":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var global = __webpack_require__("da84");
var isForced = __webpack_require__("94ca");
var redefine = __webpack_require__("6eeb");
var InternalMetadataModule = __webpack_require__("f183");
var iterate = __webpack_require__("2266");
var anInstance = __webpack_require__("19aa");
var isCallable = __webpack_require__("1626");
var isObject = __webpack_require__("861d");
var fails = __webpack_require__("d039");
var checkCorrectnessOfIteration = __webpack_require__("1c7e");
var setToStringTag = __webpack_require__("d44e");
var inheritIfRequired = __webpack_require__("7156");

module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  var ADDER = IS_MAP ? 'set' : 'add';
  var NativeConstructor = global[CONSTRUCTOR_NAME];
  var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  var Constructor = NativeConstructor;
  var exported = {};

  var fixMethod = function (KEY) {
    var nativeMethod = NativePrototype[KEY];
    redefine(NativePrototype, KEY,
      KEY == 'add' ? function add(value) {
        nativeMethod.call(this, value === 0 ? 0 : value);
        return this;
      } : KEY == 'delete' ? function (key) {
        return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
      } : KEY == 'get' ? function get(key) {
        return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);
      } : KEY == 'has' ? function has(key) {
        return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
      } : function set(key, value) {
        nativeMethod.call(this, key === 0 ? 0 : key, value);
        return this;
      }
    );
  };

  var REPLACE = isForced(
    CONSTRUCTOR_NAME,
    !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
      new NativeConstructor().entries().next();
    }))
  );

  if (REPLACE) {
    // create collection constructor
    Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
    InternalMetadataModule.enable();
  } else if (isForced(CONSTRUCTOR_NAME, true)) {
    var instance = new Constructor();
    // early implementations not supports chaining
    var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
    // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
    var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });
    // most early implementations doesn't supports iterables, most modern - not close it correctly
    // eslint-disable-next-line no-new -- required for testing
    var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });
    // for early implementations -0 and +0 not the same
    var BUGGY_ZERO = !IS_WEAK && fails(function () {
      // V8 ~ Chromium 42- fails only with 5+ elements
      var $instance = new NativeConstructor();
      var index = 5;
      while (index--) $instance[ADDER](index, index);
      return !$instance.has(-0);
    });

    if (!ACCEPT_ITERABLES) {
      Constructor = wrapper(function (dummy, iterable) {
        anInstance(dummy, Constructor, CONSTRUCTOR_NAME);
        var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
        if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
        return that;
      });
      Constructor.prototype = NativePrototype;
      NativePrototype.constructor = Constructor;
    }

    if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
      fixMethod('delete');
      fixMethod('has');
      IS_MAP && fixMethod('get');
    }

    if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);

    // weak collections should not contains .clear method
    if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
  }

  exported[CONSTRUCTOR_NAME] = Constructor;
  $({ global: true, forced: Constructor != NativeConstructor }, exported);

  setToStringTag(Constructor, CONSTRUCTOR_NAME);

  if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);

  return Constructor;
};


/***/ }),

/***/ "6ddc":
/***/ (function(module, exports, __webpack_require__) {

const compare = __webpack_require__("f06c")
const lte = (a, b, loose) => compare(a, b, loose) <= 0
module.exports = lte


/***/ }),

/***/ "6eb2":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export utcDays */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");
/* harmony import */ var _duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1738");



var utcDay = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setUTCHours(0, 0, 0, 0);
}, function(date, step) {
  date.setUTCDate(date.getUTCDate() + step);
}, function(start, end) {
  return (end - start) / _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationDay */ "a"];
}, function(date) {
  return date.getUTCDate() - 1;
});

/* harmony default export */ __webpack_exports__["a"] = (utcDay);
var utcDays = utcDay.range;


/***/ }),

/***/ "6eeb":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");
var hasOwn = __webpack_require__("1a2d");
var createNonEnumerableProperty = __webpack_require__("9112");
var setGlobal = __webpack_require__("ce4e");
var inspectSource = __webpack_require__("8925");
var InternalStateModule = __webpack_require__("69f3");
var CONFIGURABLE_FUNCTION_NAME = __webpack_require__("5e77").CONFIGURABLE;

var getInternalState = InternalStateModule.get;
var enforceInternalState = InternalStateModule.enforce;
var TEMPLATE = String(String).split('String');

(module.exports = function (O, key, value, options) {
  var unsafe = options ? !!options.unsafe : false;
  var simple = options ? !!options.enumerable : false;
  var noTargetGet = options ? !!options.noTargetGet : false;
  var name = options && options.name !== undefined ? options.name : key;
  var state;
  if (isCallable(value)) {
    if (String(name).slice(0, 7) === 'Symbol(') {
      name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
    }
    if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
      createNonEnumerableProperty(value, 'name', name);
    }
    state = enforceInternalState(value);
    if (!state.source) {
      state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
    }
  }
  if (O === global) {
    if (simple) O[key] = value;
    else setGlobal(key, value);
    return;
  } else if (!unsafe) {
    delete O[key];
  } else if (!noTargetGet && O[key]) {
    simple = true;
  }
  if (simple) O[key] = value;
  else createNonEnumerableProperty(O, key, value);
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, 'toString', function toString() {
  return isCallable(this) && getInternalState(this).source || inspectSource(this);
});


/***/ }),

/***/ "6f53":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var objectKeys = __webpack_require__("df75");
var toIndexedObject = __webpack_require__("fc6a");
var propertyIsEnumerable = __webpack_require__("d1e7").f;

// `Object.{ entries, values }` methods implementation
var createMethod = function (TO_ENTRIES) {
  return function (it) {
    var O = toIndexedObject(it);
    var keys = objectKeys(O);
    var length = keys.length;
    var i = 0;
    var result = [];
    var key;
    while (length > i) {
      key = keys[i++];
      if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) {
        result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
      }
    }
    return result;
  };
};

module.exports = {
  // `Object.entries` method
  // https://tc39.es/ecma262/#sec-object.entries
  entries: createMethod(true),
  // `Object.values` method
  // https://tc39.es/ecma262/#sec-object.values
  values: createMethod(false)
};


/***/ }),

/***/ "7037":
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__("a4d3");

__webpack_require__("e01a");

__webpack_require__("d3b7");

__webpack_require__("d28b");

__webpack_require__("e260");

__webpack_require__("3ca3");

__webpack_require__("ddb0");

function _typeof(obj) {
  "@babel/helpers - typeof";

  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    module.exports = _typeof = function _typeof(obj) {
      return typeof obj;
    };

    module.exports["default"] = module.exports, module.exports.__esModule = true;
  } else {
    module.exports = _typeof = function _typeof(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };

    module.exports["default"] = module.exports, module.exports.__esModule = true;
  }

  return _typeof(obj);
}

module.exports = _typeof;
module.exports["default"] = module.exports, module.exports.__esModule = true;

/***/ }),

/***/ "7156":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");
var isObject = __webpack_require__("861d");
var setPrototypeOf = __webpack_require__("d2bb");

// makes subclassing work correct for wrapped built-ins
module.exports = function ($this, dummy, Wrapper) {
  var NewTarget, NewTargetPrototype;
  if (
    // it can work only with native `setPrototypeOf`
    setPrototypeOf &&
    // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
    isCallable(NewTarget = dummy.constructor) &&
    NewTarget !== Wrapper &&
    isObject(NewTargetPrototype = NewTarget.prototype) &&
    NewTargetPrototype !== Wrapper.prototype
  ) setPrototypeOf($this, NewTargetPrototype);
  return $this;
};


/***/ }),

/***/ "73d9":
/***/ (function(module, exports, __webpack_require__) {

// this method was added to unscopables after implementation
// in popular engines, so it's moved to a separate module
var addToUnscopables = __webpack_require__("44d2");

// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('flatMap');


/***/ }),

/***/ "7418":
/***/ (function(module, exports) {

// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
exports.f = Object.getOwnPropertySymbols;


/***/ }),

/***/ "742c":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export days */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");
/* harmony import */ var _duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1738");



var day = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(
  date => date.setHours(0, 0, 0, 0),
  (date, step) => date.setDate(date.getDate() + step),
  (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationMinute */ "c"]) / _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationDay */ "a"],
  date => date.getDate() - 1
);

/* harmony default export */ __webpack_exports__["a"] = (day);
var days = day.range;


/***/ }),

/***/ "746f":
/***/ (function(module, exports, __webpack_require__) {

var path = __webpack_require__("428f");
var hasOwn = __webpack_require__("1a2d");
var wrappedWellKnownSymbolModule = __webpack_require__("e538");
var defineProperty = __webpack_require__("9bf2").f;

module.exports = function (NAME) {
  var Symbol = path.Symbol || (path.Symbol = {});
  if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {
    value: wrappedWellKnownSymbolModule.f(NAME)
  });
};


/***/ }),

/***/ "76db":
/***/ (function(module, exports, __webpack_require__) {

const compare = __webpack_require__("f06c")
const neq = (a, b, loose) => compare(a, b, loose) !== 0
module.exports = neq


/***/ }),

/***/ "778d":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const Range = __webpack_require__("7b1f")

const maxSatisfying = (versions, range, options) => {
  let max = null
  let maxSV = null
  let rangeObj = null
  try {
    rangeObj = new Range(range, options)
  } catch (er) {
    return null
  }
  versions.forEach((v) => {
    if (rangeObj.test(v)) {
      // satisfies(v, range, options)
      if (!max || maxSV.compare(v) === -1) {
        // compare(max, v, true)
        max = v
        maxSV = new SemVer(max, options)
      }
    }
  })
  return max
}
module.exports = maxSatisfying


/***/ }),

/***/ "77a7":
/***/ (function(module, exports) {

// IEEE754 conversions based on https://github.com/feross/ieee754
var abs = Math.abs;
var pow = Math.pow;
var floor = Math.floor;
var log = Math.log;
var LN2 = Math.LN2;

var pack = function (number, mantissaLength, bytes) {
  var buffer = new Array(bytes);
  var exponentLength = bytes * 8 - mantissaLength - 1;
  var eMax = (1 << exponentLength) - 1;
  var eBias = eMax >> 1;
  var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
  var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
  var index = 0;
  var exponent, mantissa, c;
  number = abs(number);
  // eslint-disable-next-line no-self-compare -- NaN check
  if (number != number || number === Infinity) {
    // eslint-disable-next-line no-self-compare -- NaN check
    mantissa = number != number ? 1 : 0;
    exponent = eMax;
  } else {
    exponent = floor(log(number) / LN2);
    if (number * (c = pow(2, -exponent)) < 1) {
      exponent--;
      c *= 2;
    }
    if (exponent + eBias >= 1) {
      number += rt / c;
    } else {
      number += rt * pow(2, 1 - eBias);
    }
    if (number * c >= 2) {
      exponent++;
      c /= 2;
    }
    if (exponent + eBias >= eMax) {
      mantissa = 0;
      exponent = eMax;
    } else if (exponent + eBias >= 1) {
      mantissa = (number * c - 1) * pow(2, mantissaLength);
      exponent = exponent + eBias;
    } else {
      mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
      exponent = 0;
    }
  }
  for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8);
  exponent = exponent << mantissaLength | mantissa;
  exponentLength += mantissaLength;
  for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8);
  buffer[--index] |= sign * 128;
  return buffer;
};

var unpack = function (buffer, mantissaLength) {
  var bytes = buffer.length;
  var exponentLength = bytes * 8 - mantissaLength - 1;
  var eMax = (1 << exponentLength) - 1;
  var eBias = eMax >> 1;
  var nBits = exponentLength - 7;
  var index = bytes - 1;
  var sign = buffer[index--];
  var exponent = sign & 127;
  var mantissa;
  sign >>= 7;
  for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8);
  mantissa = exponent & (1 << -nBits) - 1;
  exponent >>= -nBits;
  nBits += mantissaLength;
  for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8);
  if (exponent === 0) {
    exponent = 1 - eBias;
  } else if (exponent === eMax) {
    return mantissa ? NaN : sign ? -Infinity : Infinity;
  } else {
    mantissa = mantissa + pow(2, mantissaLength);
    exponent = exponent - eBias;
  } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
};

module.exports = {
  pack: pack,
  unpack: unpack
};


/***/ }),

/***/ "77ae":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export utcYears */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");


var utcYear = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setUTCMonth(0, 1);
  date.setUTCHours(0, 0, 0, 0);
}, function(date, step) {
  date.setUTCFullYear(date.getUTCFullYear() + step);
}, function(start, end) {
  return end.getUTCFullYear() - start.getUTCFullYear();
}, function(date) {
  return date.getUTCFullYear();
});

// An optimized implementation for this simple case.
utcYear.every = function(k) {
  return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
    date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
    date.setUTCMonth(0, 1);
    date.setUTCHours(0, 0, 0, 0);
  }, function(date, step) {
    date.setUTCFullYear(date.getUTCFullYear() + step * k);
  });
};

/* harmony default export */ __webpack_exports__["a"] = (utcYear);
var utcYears = utcYear.range;


/***/ }),

/***/ "7839":
/***/ (function(module, exports) {

// IE8- don't enum bug keys
module.exports = [
  'constructor',
  'hasOwnProperty',
  'isPrototypeOf',
  'propertyIsEnumerable',
  'toLocaleString',
  'toString',
  'valueOf'
];


/***/ }),

/***/ "785a":
/***/ (function(module, exports, __webpack_require__) {

// in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
var documentCreateElement = __webpack_require__("cc12");

var classList = documentCreateElement('span').classList;
var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;

module.exports = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;


/***/ }),

/***/ "7907":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")

const inc = (version, release, options, identifier) => {
  if (typeof (options) === 'string') {
    identifier = options
    options = undefined
  }

  try {
    return new SemVer(version, options).inc(release, identifier).version
  } catch (er) {
    return null
  }
}
module.exports = inc


/***/ }),

/***/ "7973":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const parse = __webpack_require__("61bb")
const {re, t} = __webpack_require__("22c0")

const coerce = (version, options) => {
  if (version instanceof SemVer) {
    return version
  }

  if (typeof version === 'number') {
    version = String(version)
  }

  if (typeof version !== 'string') {
    return null
  }

  options = options || {}

  let match = null
  if (!options.rtl) {
    match = version.match(re[t.COERCE])
  } else {
    // Find the right-most coercible string that does not share
    // a terminus with a more left-ward coercible string.
    // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
    //
    // Walk through the string checking with a /g regexp
    // Manually set the index so as to pick up overlapping matches.
    // Stop when we get a match that ends at the string end, since no
    // coercible string can be more right-ward without the same terminus.
    let next
    while ((next = re[t.COERCERTL].exec(version)) &&
        (!match || match.index + match[0].length !== version.length)
    ) {
      if (!match ||
            next.index + next[0].length !== match.index + match[0].length) {
        match = next
      }
      re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
    }
    // leave it in a clean state
    re[t.COERCERTL].lastIndex = -1
  }

  if (match === null)
    return null

  return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
}
module.exports = coerce


/***/ }),

/***/ "7a82":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var DESCRIPTORS = __webpack_require__("83ab");
var objectDefinePropertyModile = __webpack_require__("9bf2");

// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
$({ target: 'Object', stat: true, forced: !DESCRIPTORS, sham: !DESCRIPTORS }, {
  defineProperty: objectDefinePropertyModile.f
});


/***/ }),

/***/ "7b0b":
/***/ (function(module, exports, __webpack_require__) {

var requireObjectCoercible = __webpack_require__("1d80");

// `ToObject` abstract operation
// https://tc39.es/ecma262/#sec-toobject
module.exports = function (argument) {
  return Object(requireObjectCoercible(argument));
};


/***/ }),

/***/ "7b1f":
/***/ (function(module, exports, __webpack_require__) {

// hoisted class for cyclic dependency
class Range {
  constructor (range, options) {
    options = parseOptions(options)

    if (range instanceof Range) {
      if (
        range.loose === !!options.loose &&
        range.includePrerelease === !!options.includePrerelease
      ) {
        return range
      } else {
        return new Range(range.raw, options)
      }
    }

    if (range instanceof Comparator) {
      // just put it in the set and return
      this.raw = range.value
      this.set = [[range]]
      this.format()
      return this
    }

    this.options = options
    this.loose = !!options.loose
    this.includePrerelease = !!options.includePrerelease

    // First, split based on boolean or ||
    this.raw = range
    this.set = range
      .split(/\s*\|\|\s*/)
      // map the range to a 2d array of comparators
      .map(range => this.parseRange(range.trim()))
      // throw out any comparator lists that are empty
      // this generally means that it was not a valid range, which is allowed
      // in loose mode, but will still throw if the WHOLE range is invalid.
      .filter(c => c.length)

    if (!this.set.length) {
      throw new TypeError(`Invalid SemVer Range: ${range}`)
    }

    // if we have any that are not the null set, throw out null sets.
    if (this.set.length > 1) {
      // keep the first one, in case they're all null sets
      const first = this.set[0]
      this.set = this.set.filter(c => !isNullSet(c[0]))
      if (this.set.length === 0)
        this.set = [first]
      else if (this.set.length > 1) {
        // if we have any that are *, then the range is just *
        for (const c of this.set) {
          if (c.length === 1 && isAny(c[0])) {
            this.set = [c]
            break
          }
        }
      }
    }

    this.format()
  }

  format () {
    this.range = this.set
      .map((comps) => {
        return comps.join(' ').trim()
      })
      .join('||')
      .trim()
    return this.range
  }

  toString () {
    return this.range
  }

  parseRange (range) {
    range = range.trim()

    // memoize range parsing for performance.
    // this is a very hot path, and fully deterministic.
    const memoOpts = Object.keys(this.options).join(',')
    const memoKey = `parseRange:${memoOpts}:${range}`
    const cached = cache.get(memoKey)
    if (cached)
      return cached

    const loose = this.options.loose
    // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
    const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
    range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
    debug('hyphen replace', range)
    // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
    range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
    debug('comparator trim', range, re[t.COMPARATORTRIM])

    // `~ 1.2.3` => `~1.2.3`
    range = range.replace(re[t.TILDETRIM], tildeTrimReplace)

    // `^ 1.2.3` => `^1.2.3`
    range = range.replace(re[t.CARETTRIM], caretTrimReplace)

    // normalize spaces
    range = range.split(/\s+/).join(' ')

    // At this point, the range is completely trimmed and
    // ready to be split into comparators.

    const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
    const rangeList = range
      .split(' ')
      .map(comp => parseComparator(comp, this.options))
      .join(' ')
      .split(/\s+/)
      // >=0.0.0 is equivalent to *
      .map(comp => replaceGTE0(comp, this.options))
      // in loose mode, throw out any that are not valid comparators
      .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
      .map(comp => new Comparator(comp, this.options))

    // if any comparators are the null set, then replace with JUST null set
    // if more than one comparator, remove any * comparators
    // also, don't include the same comparator more than once
    const l = rangeList.length
    const rangeMap = new Map()
    for (const comp of rangeList) {
      if (isNullSet(comp))
        return [comp]
      rangeMap.set(comp.value, comp)
    }
    if (rangeMap.size > 1 && rangeMap.has(''))
      rangeMap.delete('')

    const result = [...rangeMap.values()]
    cache.set(memoKey, result)
    return result
  }

  intersects (range, options) {
    if (!(range instanceof Range)) {
      throw new TypeError('a Range is required')
    }

    return this.set.some((thisComparators) => {
      return (
        isSatisfiable(thisComparators, options) &&
        range.set.some((rangeComparators) => {
          return (
            isSatisfiable(rangeComparators, options) &&
            thisComparators.every((thisComparator) => {
              return rangeComparators.every((rangeComparator) => {
                return thisComparator.intersects(rangeComparator, options)
              })
            })
          )
        })
      )
    })
  }

  // if ANY of the sets match ALL of its comparators, then pass
  test (version) {
    if (!version) {
      return false
    }

    if (typeof version === 'string') {
      try {
        version = new SemVer(version, this.options)
      } catch (er) {
        return false
      }
    }

    for (let i = 0; i < this.set.length; i++) {
      if (testSet(this.set[i], version, this.options)) {
        return true
      }
    }
    return false
  }
}
module.exports = Range

const LRU = __webpack_require__("1f25")
const cache = new LRU({ max: 1000 })

const parseOptions = __webpack_require__("e12f")
const Comparator = __webpack_require__("bf00")
const debug = __webpack_require__("0d7c")
const SemVer = __webpack_require__("df02")
const {
  re,
  t,
  comparatorTrimReplace,
  tildeTrimReplace,
  caretTrimReplace
} = __webpack_require__("22c0")

const isNullSet = c => c.value === '<0.0.0-0'
const isAny = c => c.value === ''

// take a set of comparators and determine whether there
// exists a version which can satisfy it
const isSatisfiable = (comparators, options) => {
  let result = true
  const remainingComparators = comparators.slice()
  let testComparator = remainingComparators.pop()

  while (result && remainingComparators.length) {
    result = remainingComparators.every((otherComparator) => {
      return testComparator.intersects(otherComparator, options)
    })

    testComparator = remainingComparators.pop()
  }

  return result
}

// comprised of xranges, tildes, stars, and gtlt's at this point.
// already replaced the hyphen ranges
// turn into a set of JUST comparators.
const parseComparator = (comp, options) => {
  debug('comp', comp, options)
  comp = replaceCarets(comp, options)
  debug('caret', comp)
  comp = replaceTildes(comp, options)
  debug('tildes', comp)
  comp = replaceXRanges(comp, options)
  debug('xrange', comp)
  comp = replaceStars(comp, options)
  debug('stars', comp)
  return comp
}

const isX = id => !id || id.toLowerCase() === 'x' || id === '*'

// ~, ~> --> * (any, kinda silly)
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
const replaceTildes = (comp, options) =>
  comp.trim().split(/\s+/).map((comp) => {
    return replaceTilde(comp, options)
  }).join(' ')

const replaceTilde = (comp, options) => {
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
  return comp.replace(r, (_, M, m, p, pr) => {
    debug('tilde', comp, _, M, m, p, pr)
    let ret

    if (isX(M)) {
      ret = ''
    } else if (isX(m)) {
      ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
    } else if (isX(p)) {
      // ~1.2 == >=1.2.0 <1.3.0-0
      ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
    } else if (pr) {
      debug('replaceTilde pr', pr)
      ret = `>=${M}.${m}.${p}-${pr
      } <${M}.${+m + 1}.0-0`
    } else {
      // ~1.2.3 == >=1.2.3 <1.3.0-0
      ret = `>=${M}.${m}.${p
      } <${M}.${+m + 1}.0-0`
    }

    debug('tilde return', ret)
    return ret
  })
}

// ^ --> * (any, kinda silly)
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
// ^1.2.3 --> >=1.2.3 <2.0.0-0
// ^1.2.0 --> >=1.2.0 <2.0.0-0
const replaceCarets = (comp, options) =>
  comp.trim().split(/\s+/).map((comp) => {
    return replaceCaret(comp, options)
  }).join(' ')

const replaceCaret = (comp, options) => {
  debug('caret', comp, options)
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
  const z = options.includePrerelease ? '-0' : ''
  return comp.replace(r, (_, M, m, p, pr) => {
    debug('caret', comp, _, M, m, p, pr)
    let ret

    if (isX(M)) {
      ret = ''
    } else if (isX(m)) {
      ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
    } else if (isX(p)) {
      if (M === '0') {
        ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
      } else {
        ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
      }
    } else if (pr) {
      debug('replaceCaret pr', pr)
      if (M === '0') {
        if (m === '0') {
          ret = `>=${M}.${m}.${p}-${pr
          } <${M}.${m}.${+p + 1}-0`
        } else {
          ret = `>=${M}.${m}.${p}-${pr
          } <${M}.${+m + 1}.0-0`
        }
      } else {
        ret = `>=${M}.${m}.${p}-${pr
        } <${+M + 1}.0.0-0`
      }
    } else {
      debug('no pr')
      if (M === '0') {
        if (m === '0') {
          ret = `>=${M}.${m}.${p
          }${z} <${M}.${m}.${+p + 1}-0`
        } else {
          ret = `>=${M}.${m}.${p
          }${z} <${M}.${+m + 1}.0-0`
        }
      } else {
        ret = `>=${M}.${m}.${p
        } <${+M + 1}.0.0-0`
      }
    }

    debug('caret return', ret)
    return ret
  })
}

const replaceXRanges = (comp, options) => {
  debug('replaceXRanges', comp, options)
  return comp.split(/\s+/).map((comp) => {
    return replaceXRange(comp, options)
  }).join(' ')
}

const replaceXRange = (comp, options) => {
  comp = comp.trim()
  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
    debug('xRange', comp, ret, gtlt, M, m, p, pr)
    const xM = isX(M)
    const xm = xM || isX(m)
    const xp = xm || isX(p)
    const anyX = xp

    if (gtlt === '=' && anyX) {
      gtlt = ''
    }

    // if we're including prereleases in the match, then we need
    // to fix this to -0, the lowest possible prerelease value
    pr = options.includePrerelease ? '-0' : ''

    if (xM) {
      if (gtlt === '>' || gtlt === '<') {
        // nothing is allowed
        ret = '<0.0.0-0'
      } else {
        // nothing is forbidden
        ret = '*'
      }
    } else if (gtlt && anyX) {
      // we know patch is an x, because we have any x at all.
      // replace X with 0
      if (xm) {
        m = 0
      }
      p = 0

      if (gtlt === '>') {
        // >1 => >=2.0.0
        // >1.2 => >=1.3.0
        gtlt = '>='
        if (xm) {
          M = +M + 1
          m = 0
          p = 0
        } else {
          m = +m + 1
          p = 0
        }
      } else if (gtlt === '<=') {
        // <=0.7.x is actually <0.8.0, since any 0.7.x should
        // pass.  Similarly, <=7.x is actually <8.0.0, etc.
        gtlt = '<'
        if (xm) {
          M = +M + 1
        } else {
          m = +m + 1
        }
      }

      if (gtlt === '<')
        pr = '-0'

      ret = `${gtlt + M}.${m}.${p}${pr}`
    } else if (xm) {
      ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
    } else if (xp) {
      ret = `>=${M}.${m}.0${pr
      } <${M}.${+m + 1}.0-0`
    }

    debug('xRange return', ret)

    return ret
  })
}

// Because * is AND-ed with everything else in the comparator,
// and '' means "any version", just remove the *s entirely.
const replaceStars = (comp, options) => {
  debug('replaceStars', comp, options)
  // Looseness is ignored here.  star is always as loose as it gets!
  return comp.trim().replace(re[t.STAR], '')
}

const replaceGTE0 = (comp, options) => {
  debug('replaceGTE0', comp, options)
  return comp.trim()
    .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
}

// This function is passed to string.replace(re[t.HYPHENRANGE])
// M, m, patch, prerelease, build
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
const hyphenReplace = incPr => ($0,
  from, fM, fm, fp, fpr, fb,
  to, tM, tm, tp, tpr, tb) => {
  if (isX(fM)) {
    from = ''
  } else if (isX(fm)) {
    from = `>=${fM}.0.0${incPr ? '-0' : ''}`
  } else if (isX(fp)) {
    from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
  } else if (fpr) {
    from = `>=${from}`
  } else {
    from = `>=${from}${incPr ? '-0' : ''}`
  }

  if (isX(tM)) {
    to = ''
  } else if (isX(tm)) {
    to = `<${+tM + 1}.0.0-0`
  } else if (isX(tp)) {
    to = `<${tM}.${+tm + 1}.0-0`
  } else if (tpr) {
    to = `<=${tM}.${tm}.${tp}-${tpr}`
  } else if (incPr) {
    to = `<${tM}.${tm}.${+tp + 1}-0`
  } else {
    to = `<=${to}`
  }

  return (`${from} ${to}`).trim()
}

const testSet = (set, version, options) => {
  for (let i = 0; i < set.length; i++) {
    if (!set[i].test(version)) {
      return false
    }
  }

  if (version.prerelease.length && !options.includePrerelease) {
    // Find the set of versions that are allowed to have prereleases
    // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
    // That should allow `1.2.3-pr.2` to pass.
    // However, `1.2.4-alpha.notready` should NOT be allowed,
    // even though it's within the range set by the comparators.
    for (let i = 0; i < set.length; i++) {
      debug(set[i].semver)
      if (set[i].semver === Comparator.ANY) {
        continue
      }

      if (set[i].semver.prerelease.length > 0) {
        const allowed = set[i].semver
        if (allowed.major === version.major &&
            allowed.minor === version.minor &&
            allowed.patch === version.patch) {
          return true
        }
      }
    }

    // Version has a -pre, but it's not one of the ones we like.
    return false
  }

  return true
}


/***/ }),

/***/ "7ba4":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return format; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return formats; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return inferType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return inferTypes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return loader; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return read; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return responseType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return typeParsers; });
/* harmony import */ var vega_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fc17");
/* harmony import */ var d3_dsv__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("3512");
/* harmony import */ var topojson_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("d217");
/* harmony import */ var vega_format__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("c092");





//   https://...    file://...    //...

const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file://

const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape

const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex
// Special treatment in node.js for the file: protocol

const fileProtocol = 'file://';
/**
 * Factory for a loader constructor that provides methods for requesting
 * files from either the network or disk, and for sanitizing request URIs.
 * @param {function} fetch - The Fetch API for HTTP network requests.
 *   If null or undefined, HTTP loading will be disabled.
 * @param {object} fs - The file system interface for file loading.
 *   If null or undefined, local file loading will be disabled.
 * @return {function} A loader constructor with the following signature:
 *   param {object} [options] - Optional default loading options to use.
 *   return {object} - A new loader instance.
 */

function loaderFactory (fetch, fs) {
  return options => ({
    options: options || {},
    sanitize: sanitize,
    load: load,
    fileAccess: !!fs,
    file: fileLoader(fs),
    http: httpLoader(fetch)
  });
}
/**
 * Load an external resource, typically either from the web or from the local
 * filesystem. This function uses {@link sanitize} to first sanitize the uri,
 * then calls either {@link http} (for web requests) or {@link file} (for
 * filesystem loading).
 * @param {string} uri - The resource indicator (e.g., URL or filename).
 * @param {object} [options] - Optional loading options. These options will
 *   override any existing default options.
 * @return {Promise} - A promise that resolves to the loaded content.
 */

async function load(uri, options) {
  const opt = await this.sanitize(uri, options),
        url = opt.href;
  return opt.localFile ? this.file(url) : this.http(url, options);
}
/**
 * URI sanitizer function.
 * @param {string} uri - The uri (url or filename) to check.
 * @param {object} options - An options hash.
 * @return {Promise} - A promise that resolves to an object containing
 *  sanitized uri data, or rejects it the input uri is deemed invalid.
 *  The properties of the resolved object are assumed to be
 *  valid attributes for an HTML 'a' tag. The sanitized uri *must* be
 *  provided by the 'href' property of the returned object.
 */


async function sanitize(uri, options) {
  options = Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* extend */ "p"])({}, this.options, options);
  const fileAccess = this.fileAccess,
        result = {
    href: null
  };
  let isFile, loadFile, base;
  const isAllowed = allowed_re.test(uri.replace(whitespace_re, ''));

  if (uri == null || typeof uri !== 'string' || !isAllowed) {
    Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])('Sanitize failure, invalid URI: ' + Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* stringValue */ "bb"])(uri));
  }

  const hasProtocol = protocol_re.test(uri); // if relative url (no protocol/host), prepend baseURL

  if ((base = options.baseURL) && !hasProtocol) {
    // Ensure that there is a slash between the baseURL (e.g. hostname) and url
    if (!uri.startsWith('/') && !base.endsWith('/')) {
      uri = '/' + uri;
    }

    uri = base + uri;
  } // should we load from file system?


  loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess;

  if (isFile) {
    // strip file protocol
    uri = uri.slice(fileProtocol.length);
  } else if (uri.startsWith('//')) {
    if (options.defaultProtocol === 'file') {
      // if is file, strip protocol and set loadFile flag
      uri = uri.slice(2);
      loadFile = true;
    } else {
      // if relative protocol (starts with '//'), prepend default protocol
      uri = (options.defaultProtocol || 'http') + ':' + uri;
    }
  } // set non-enumerable mode flag to indicate local file load


  Object.defineProperty(result, 'localFile', {
    value: !!loadFile
  }); // set uri

  result.href = uri; // set default result target, if specified

  if (options.target) {
    result.target = options.target + '';
  } // set default result rel, if specified (#1542)


  if (options.rel) {
    result.rel = options.rel + '';
  } // provide control over cross-origin image handling (#2238)
  // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image


  if (options.context === 'image' && options.crossOrigin) {
    result.crossOrigin = options.crossOrigin + '';
  } // return


  return result;
}
/**
 * File system loader factory.
 * @param {object} fs - The file system interface.
 * @return {function} - A file loader with the following signature:
 *   param {string} filename - The file system path to load.
 *   param {string} filename - The file system path to load.
 *   return {Promise} A promise that resolves to the file contents.
 */


function fileLoader(fs) {
  return fs ? filename => new Promise((accept, reject) => {
    fs.readFile(filename, (error, data) => {
      if (error) reject(error);else accept(data);
    });
  }) : fileReject;
}
/**
 * Default file system loader that simply rejects.
 */


async function fileReject() {
  Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])('No file system access.');
}
/**
 * HTTP request handler factory.
 * @param {function} fetch - The Fetch API method.
 * @return {function} - An http loader with the following signature:
 *   param {string} url - The url to request.
 *   param {object} options - An options hash.
 *   return {Promise} - A promise that resolves to the file contents.
 */


function httpLoader(fetch) {
  return fetch ? async function (url, options) {
    const opt = Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* extend */ "p"])({}, this.options.http, options),
          type = options && options.response,
          response = await fetch(url, opt);
    return !response.ok ? Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])(response.status + '' + response.statusText) : Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* isFunction */ "E"])(response[type]) ? response[type]() : response.text();
  } : httpReject;
}
/**
 * Default http request handler that simply rejects.
 */


async function httpReject() {
  Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])('No HTTP fetch method available.');
}

const isValid = _ => _ != null && _ === _;

const isBoolean = _ => _ === 'true' || _ === 'false' || _ === true || _ === false;

const isDate = _ => !Number.isNaN(Date.parse(_));

const isNumber = _ => !Number.isNaN(+_) && !(_ instanceof Date);

const isInteger = _ => isNumber(_) && Number.isInteger(+_);

const typeParsers = {
  boolean: vega_util__WEBPACK_IMPORTED_MODULE_0__[/* toBoolean */ "cb"],
  integer: vega_util__WEBPACK_IMPORTED_MODULE_0__[/* toNumber */ "eb"],
  number: vega_util__WEBPACK_IMPORTED_MODULE_0__[/* toNumber */ "eb"],
  date: vega_util__WEBPACK_IMPORTED_MODULE_0__[/* toDate */ "db"],
  string: vega_util__WEBPACK_IMPORTED_MODULE_0__[/* toString */ "gb"],
  unknown: vega_util__WEBPACK_IMPORTED_MODULE_0__[/* identity */ "y"]
};
const typeTests = [isBoolean, isInteger, isNumber, isDate];
const typeList = ['boolean', 'integer', 'number', 'date'];
function inferType(values, field) {
  if (!values || !values.length) return 'unknown';
  const n = values.length,
        m = typeTests.length,
        a = typeTests.map((_, i) => i + 1);

  for (let i = 0, t = 0, j, value; i < n; ++i) {
    value = field ? values[i][field] : values[i];

    for (j = 0; j < m; ++j) {
      if (a[j] && isValid(value) && !typeTests[j](value)) {
        a[j] = 0;
        ++t;
        if (t === typeTests.length) return 'string';
      }
    }
  }

  return typeList[a.reduce((u, v) => u === 0 ? v : u, 0) - 1];
}
function inferTypes(data, fields) {
  return fields.reduce((types, field) => {
    types[field] = inferType(data, field);
    return types;
  }, {});
}

function delimitedFormat(delimiter) {
  const parse = function (data, format) {
    const delim = {
      delimiter: delimiter
    };
    return dsv(data, format ? Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* extend */ "p"])(format, delim) : delim);
  };

  parse.responseType = 'text';
  return parse;
}
function dsv(data, format) {
  if (format.header) {
    data = format.header.map(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* stringValue */ "bb"]).join(format.delimiter) + '\n' + data;
  }

  return Object(d3_dsv__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(format.delimiter).parse(data + '');
}
dsv.responseType = 'text';

function isBuffer(_) {
  return typeof Buffer === 'function' && Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* isFunction */ "E"])(Buffer.isBuffer) ? Buffer.isBuffer(_) : false;
}

function json(data, format) {
  const prop = format && format.property ? Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* field */ "u"])(format.property) : vega_util__WEBPACK_IMPORTED_MODULE_0__[/* identity */ "y"];
  return Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* isObject */ "H"])(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data));
}
json.responseType = 'json';

function parseJSON(data, format) {
  if (!Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* isArray */ "B"])(data) && Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* isIterable */ "F"])(data)) {
    data = [...data];
  }

  return format && format.copy ? JSON.parse(JSON.stringify(data)) : data;
}

const filters = {
  interior: (a, b) => a !== b,
  exterior: (a, b) => a === b
};
function topojson(data, format) {
  let method, object, property, filter;
  data = json(data, format);

  if (format && format.feature) {
    method = topojson_client__WEBPACK_IMPORTED_MODULE_2__[/* feature */ "a"];
    property = format.feature;
  } else if (format && format.mesh) {
    method = topojson_client__WEBPACK_IMPORTED_MODULE_2__[/* mesh */ "b"];
    property = format.mesh;
    filter = filters[format.filter];
  } else {
    Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])('Missing TopoJSON feature or mesh parameter.');
  }

  object = (object = data.objects[property]) ? method(data, object, filter) : Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])('Invalid TopoJSON object: ' + property);
  return object && object.features || [object];
}
topojson.responseType = 'json';

const format = {
  dsv: dsv,
  csv: delimitedFormat(','),
  tsv: delimitedFormat('\t'),
  json: json,
  topojson: topojson
};
function formats(name, reader) {
  if (arguments.length > 1) {
    format[name] = reader;
    return this;
  } else {
    return Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* hasOwnProperty */ "w"])(format, name) ? format[name] : null;
  }
}
function responseType(type) {
  const f = formats(type);
  return f && f.responseType || 'text';
}

function read (data, schema, timeParser, utcParser) {
  schema = schema || {};
  const reader = formats(schema.type || 'json');
  if (!reader) Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])('Unknown data format type: ' + schema.type);
  data = reader(data, schema);
  if (schema.parse) parse(data, schema.parse, timeParser, utcParser);
  if (Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* hasOwnProperty */ "w"])(data, 'columns')) delete data.columns;
  return data;
}

function parse(data, types, timeParser, utcParser) {
  if (!data.length) return; // early exit for empty data

  const locale = Object(vega_format__WEBPACK_IMPORTED_MODULE_3__[/* timeFormatDefaultLocale */ "e"])();
  timeParser = timeParser || locale.timeParse;
  utcParser = utcParser || locale.utcParse;
  let fields = data.columns || Object.keys(data[0]),
      datum,
      field,
      i,
      j,
      n,
      m;
  if (types === 'auto') types = inferTypes(data, fields);
  fields = Object.keys(types);
  const parsers = fields.map(field => {
    const type = types[field];
    let parts, pattern;

    if (type && (type.startsWith('date:') || type.startsWith('utc:'))) {
      parts = type.split(/:(.+)?/, 2); // split on first :

      pattern = parts[1];

      if (pattern[0] === '\'' && pattern[pattern.length - 1] === '\'' || pattern[0] === '"' && pattern[pattern.length - 1] === '"') {
        pattern = pattern.slice(1, -1);
      }

      const parse = parts[0] === 'utc' ? utcParser : timeParser;
      return parse(pattern);
    }

    if (!typeParsers[type]) {
      throw Error('Illegal format pattern: ' + field + ':' + type);
    }

    return typeParsers[type];
  });

  for (i = 0, n = data.length, m = fields.length; i < n; ++i) {
    datum = data[i];

    for (j = 0; j < m; ++j) {
      field = fields[j];
      datum[field] = parsers[j](datum[field]);
    }
  }
}

const loader = loaderFactory(typeof fetch !== 'undefined' && fetch, // use built-in fetch API
null // no file system access
);



/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("b639").Buffer))

/***/ }),

/***/ "7c73":
/***/ (function(module, exports, __webpack_require__) {

/* global ActiveXObject -- old IE, WSH */
var anObject = __webpack_require__("825a");
var defineProperties = __webpack_require__("37e8");
var enumBugKeys = __webpack_require__("7839");
var hiddenKeys = __webpack_require__("d012");
var html = __webpack_require__("1be4");
var documentCreateElement = __webpack_require__("cc12");
var sharedKey = __webpack_require__("f772");

var GT = '>';
var LT = '<';
var PROTOTYPE = 'prototype';
var SCRIPT = 'script';
var IE_PROTO = sharedKey('IE_PROTO');

var EmptyConstructor = function () { /* empty */ };

var scriptTag = function (content) {
  return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
};

// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
var NullProtoObjectViaActiveX = function (activeXDocument) {
  activeXDocument.write(scriptTag(''));
  activeXDocument.close();
  var temp = activeXDocument.parentWindow.Object;
  activeXDocument = null; // avoid memory leak
  return temp;
};

// Create object with fake `null` prototype: use iframe Object with cleared prototype
var NullProtoObjectViaIFrame = function () {
  // Thrash, waste and sodomy: IE GC bug
  var iframe = documentCreateElement('iframe');
  var JS = 'java' + SCRIPT + ':';
  var iframeDocument;
  iframe.style.display = 'none';
  html.appendChild(iframe);
  // https://github.com/zloirock/core-js/issues/475
  iframe.src = String(JS);
  iframeDocument = iframe.contentWindow.document;
  iframeDocument.open();
  iframeDocument.write(scriptTag('document.F=Object'));
  iframeDocument.close();
  return iframeDocument.F;
};

// Check for document.domain and active x support
// No need to use active x approach when document.domain is not set
// see https://github.com/es-shims/es5-shim/issues/150
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
// avoid IE GC bug
var activeXDocument;
var NullProtoObject = function () {
  try {
    activeXDocument = new ActiveXObject('htmlfile');
  } catch (error) { /* ignore */ }
  NullProtoObject = typeof document != 'undefined'
    ? document.domain && activeXDocument
      ? NullProtoObjectViaActiveX(activeXDocument) // old IE
      : NullProtoObjectViaIFrame()
    : NullProtoObjectViaActiveX(activeXDocument); // WSH
  var length = enumBugKeys.length;
  while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  return NullProtoObject();
};

hiddenKeys[IE_PROTO] = true;

// `Object.create` method
// https://tc39.es/ecma262/#sec-object.create
module.exports = Object.create || function create(O, Properties) {
  var result;
  if (O !== null) {
    EmptyConstructor[PROTOTYPE] = anObject(O);
    result = new EmptyConstructor();
    EmptyConstructor[PROTOTYPE] = null;
    // add "__proto__" for Object.getPrototypeOf polyfill
    result[IE_PROTO] = O;
  } else result = NullProtoObject();
  return Properties === undefined ? result : defineProperties(result, Properties);
};


/***/ }),

/***/ "7db0":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var $find = __webpack_require__("b727").find;
var addToUnscopables = __webpack_require__("44d2");

var FIND = 'find';
var SKIPS_HOLES = true;

// Shouldn't skip holes
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });

// `Array.prototype.find` method
// https://tc39.es/ecma262/#sec-array.prototype.find
$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  find: function find(callbackfn /* , that = undefined */) {
    return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});

// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables(FIND);


/***/ }),

/***/ "7dd0":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var IS_PURE = __webpack_require__("c430");
var FunctionName = __webpack_require__("5e77");
var isCallable = __webpack_require__("1626");
var createIteratorConstructor = __webpack_require__("9ed3");
var getPrototypeOf = __webpack_require__("e163");
var setPrototypeOf = __webpack_require__("d2bb");
var setToStringTag = __webpack_require__("d44e");
var createNonEnumerableProperty = __webpack_require__("9112");
var redefine = __webpack_require__("6eeb");
var wellKnownSymbol = __webpack_require__("b622");
var Iterators = __webpack_require__("3f8c");
var IteratorsCore = __webpack_require__("ae93");

var PROPER_FUNCTION_NAME = FunctionName.PROPER;
var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
var IteratorPrototype = IteratorsCore.IteratorPrototype;
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
var ITERATOR = wellKnownSymbol('iterator');
var KEYS = 'keys';
var VALUES = 'values';
var ENTRIES = 'entries';

var returnThis = function () { return this; };

module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  createIteratorConstructor(IteratorConstructor, NAME, next);

  var getIterationMethod = function (KIND) {
    if (KIND === DEFAULT && defaultIterator) return defaultIterator;
    if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
    switch (KIND) {
      case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
      case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
      case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
    } return function () { return new IteratorConstructor(this); };
  };

  var TO_STRING_TAG = NAME + ' Iterator';
  var INCORRECT_VALUES_NAME = false;
  var IterablePrototype = Iterable.prototype;
  var nativeIterator = IterablePrototype[ITERATOR]
    || IterablePrototype['@@iterator']
    || DEFAULT && IterablePrototype[DEFAULT];
  var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  var CurrentIteratorPrototype, methods, KEY;

  // fix native
  if (anyNativeIterator) {
    CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
    if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
      if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
        if (setPrototypeOf) {
          setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
        } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
          redefine(CurrentIteratorPrototype, ITERATOR, returnThis);
        }
      }
      // Set @@toStringTag to native iterators
      setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
      if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
    }
  }

  // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
  if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
    if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
      createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
    } else {
      INCORRECT_VALUES_NAME = true;
      defaultIterator = function values() { return nativeIterator.call(this); };
    }
  }

  // export additional methods
  if (DEFAULT) {
    methods = {
      values: getIterationMethod(VALUES),
      keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
      entries: getIterationMethod(ENTRIES)
    };
    if (FORCED) for (KEY in methods) {
      if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
        redefine(IterablePrototype, KEY, methods[KEY]);
      }
    } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
  }

  // define iterator
  if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
    redefine(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  }
  Iterators[NAME] = defaultIterator;

  return methods;
};


/***/ }),

/***/ "7e12":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var fails = __webpack_require__("d039");
var toString = __webpack_require__("577e");
var trim = __webpack_require__("58a8").trim;
var whitespaces = __webpack_require__("5899");

var $parseFloat = global.parseFloat;
var Symbol = global.Symbol;
var ITERATOR = Symbol && Symbol.iterator;
var FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity
  // MS Edge 18- broken with boxed symbols
  || (ITERATOR && !fails(function () { $parseFloat(Object(ITERATOR)); }));

// `parseFloat` method
// https://tc39.es/ecma262/#sec-parsefloat-string
module.exports = FORCED ? function parseFloat(string) {
  var trimmedString = trim(toString(string));
  var result = $parseFloat(trimmedString);
  return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
} : $parseFloat;


/***/ }),

/***/ "7f9a":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");
var inspectSource = __webpack_require__("8925");

var WeakMap = global.WeakMap;

module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));


/***/ }),

/***/ "81d5":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var toObject = __webpack_require__("7b0b");
var toAbsoluteIndex = __webpack_require__("23cb");
var lengthOfArrayLike = __webpack_require__("07fa");

// `Array.prototype.fill` method implementation
// https://tc39.es/ecma262/#sec-array.prototype.fill
module.exports = function fill(value /* , start = 0, end = @length */) {
  var O = toObject(this);
  var length = lengthOfArrayLike(O);
  var argumentsLength = arguments.length;
  var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
  var end = argumentsLength > 2 ? arguments[2] : undefined;
  var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
  while (endPos > index) O[index++] = value;
  return O;
};


/***/ }),

/***/ "825a":
/***/ (function(module, exports, __webpack_require__) {

var isObject = __webpack_require__("861d");

// `Assert: Type(argument) is Object`
module.exports = function (argument) {
  if (isObject(argument)) return argument;
  throw TypeError(String(argument) + ' is not an object');
};


/***/ }),

/***/ "82ac":
/***/ (function(module, exports, __webpack_require__) {

const parse = __webpack_require__("61bb")
const valid = (version, options) => {
  const v = parse(version, options)
  return v ? v.version : null
}
module.exports = valid


/***/ }),

/***/ "82da":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var ArrayBufferViewCore = __webpack_require__("ebb5");

var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;

// `ArrayBuffer.isView` method
// https://tc39.es/ecma262/#sec-arraybuffer.isview
$({ target: 'ArrayBuffer', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, {
  isView: ArrayBufferViewCore.isView
});


/***/ }),

/***/ "83ab":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");

// Detect IE8's incomplete defineProperty implementation
module.exports = !fails(function () {
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});


/***/ }),

/***/ "8418":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var toPropertyKey = __webpack_require__("a04b");
var definePropertyModule = __webpack_require__("9bf2");
var createPropertyDescriptor = __webpack_require__("5c6c");

module.exports = function (object, key, value) {
  var propertyKey = toPropertyKey(key);
  if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  else object[propertyKey] = value;
};


/***/ }),

/***/ "841c":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var fixRegExpWellKnownSymbolLogic = __webpack_require__("d784");
var anObject = __webpack_require__("825a");
var requireObjectCoercible = __webpack_require__("1d80");
var sameValue = __webpack_require__("129f");
var toString = __webpack_require__("577e");
var getMethod = __webpack_require__("dc4a");
var regExpExec = __webpack_require__("14c3");

// @@search logic
fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) {
  return [
    // `String.prototype.search` method
    // https://tc39.es/ecma262/#sec-string.prototype.search
    function search(regexp) {
      var O = requireObjectCoercible(this);
      var searcher = regexp == undefined ? undefined : getMethod(regexp, SEARCH);
      return searcher ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](toString(O));
    },
    // `RegExp.prototype[@@search]` method
    // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
    function (string) {
      var rx = anObject(this);
      var S = toString(string);
      var res = maybeCallNative(nativeSearch, rx, S);

      if (res.done) return res.value;

      var previousLastIndex = rx.lastIndex;
      if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
      var result = regExpExec(rx, S);
      if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
      return result === null ? -1 : result.index;
    }
  ];
});


/***/ }),

/***/ "857a":
/***/ (function(module, exports, __webpack_require__) {

var requireObjectCoercible = __webpack_require__("1d80");
var toString = __webpack_require__("577e");

var quot = /"/g;

// `CreateHTML` abstract operation
// https://tc39.es/ecma262/#sec-createhtml
module.exports = function (string, tag, attribute, value) {
  var S = toString(requireObjectCoercible(string));
  var p1 = '<' + tag;
  if (attribute !== '') p1 += ' ' + attribute + '="' + toString(value).replace(quot, '&quot;') + '"';
  return p1 + '>' + S + '</' + tag + '>';
};


/***/ }),

/***/ "861d":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");

module.exports = function (it) {
  return typeof it === 'object' ? it !== null : isCallable(it);
};


/***/ }),

/***/ "8840":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const compareBuild = (a, b, loose) => {
  const versionA = new SemVer(a, loose)
  const versionB = new SemVer(b, loose)
  return versionA.compare(versionB) || versionA.compareBuild(versionB)
}
module.exports = compareBuild


/***/ }),

/***/ "8875":
/***/ (function(module, exports, __webpack_require__) {

var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
// MIT license
// source: https://github.com/amiller-gh/currentScript-polyfill

// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505

(function (root, factory) {
  if (true) {
    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
				__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
				(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  } else {}
}(typeof self !== 'undefined' ? self : this, function () {
  function getCurrentScript () {
    var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
    // for chrome
    if (!descriptor && 'currentScript' in document && document.currentScript) {
      return document.currentScript
    }

    // for other browsers with native support for currentScript
    if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
      return document.currentScript
    }
  
    // IE 8-10 support script readyState
    // IE 11+ & Firefox support stack trace
    try {
      throw new Error();
    }
    catch (err) {
      // Find the second match for the "at" string to get file src url from stack.
      var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
        ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
        stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
        scriptLocation = (stackDetails && stackDetails[1]) || false,
        line = (stackDetails && stackDetails[2]) || false,
        currentLocation = document.location.href.replace(document.location.hash, ''),
        pageSource,
        inlineScriptSourceRegExp,
        inlineScriptSource,
        scripts = document.getElementsByTagName('script'); // Live NodeList collection
  
      if (scriptLocation === currentLocation) {
        pageSource = document.documentElement.outerHTML;
        inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
        inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
      }
  
      for (var i = 0; i < scripts.length; i++) {
        // If ready state is interactive, return the script tag
        if (scripts[i].readyState === 'interactive') {
          return scripts[i];
        }
  
        // If src matches, return the script tag
        if (scripts[i].src === scriptLocation) {
          return scripts[i];
        }
  
        // If inline source matches, return the script tag
        if (
          scriptLocation === currentLocation &&
          scripts[i].innerHTML &&
          scripts[i].innerHTML.trim() === inlineScriptSource
        ) {
          return scripts[i];
        }
      }
  
      // If no match, return null
      return null;
    }
  };

  return getCurrentScript
}));


/***/ }),

/***/ "8925":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");
var store = __webpack_require__("c6cd");

var functionToString = Function.toString;

// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
if (!isCallable(store.inspectSource)) {
  store.inspectSource = function (it) {
    return functionToString.call(it);
  };
}

module.exports = store.inspectSource;


/***/ }),

/***/ "8a79":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var getOwnPropertyDescriptor = __webpack_require__("06cf").f;
var toLength = __webpack_require__("50c4");
var toString = __webpack_require__("577e");
var notARegExp = __webpack_require__("5a34");
var requireObjectCoercible = __webpack_require__("1d80");
var correctIsRegExpLogic = __webpack_require__("ab13");
var IS_PURE = __webpack_require__("c430");

// eslint-disable-next-line es/no-string-prototype-endswith -- safe
var $endsWith = ''.endsWith;
var min = Math.min;

var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('endsWith');
// https://github.com/zloirock/core-js/pull/702
var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
  var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith');
  return descriptor && !descriptor.writable;
}();

// `String.prototype.endsWith` method
// https://tc39.es/ecma262/#sec-string.prototype.endswith
$({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
  endsWith: function endsWith(searchString /* , endPosition = @length */) {
    var that = toString(requireObjectCoercible(this));
    notARegExp(searchString);
    var endPosition = arguments.length > 1 ? arguments[1] : undefined;
    var len = that.length;
    var end = endPosition === undefined ? len : min(toLength(endPosition), len);
    var search = toString(searchString);
    return $endsWith
      ? $endsWith.call(that, search, end)
      : that.slice(end - search.length, end) === search;
  }
});


/***/ }),

/***/ "8aa5":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var charAt = __webpack_require__("6547").charAt;

// `AdvanceStringIndex` abstract operation
// https://tc39.es/ecma262/#sec-advancestringindex
module.exports = function (S, index, unicode) {
  return index + (unicode ? charAt(S, index).length : 1);
};


/***/ }),

/***/ "8eb5":
/***/ (function(module, exports) {

// eslint-disable-next-line es/no-math-expm1 -- safe
var $expm1 = Math.expm1;
var exp = Math.exp;

// `Math.expm1` method implementation
// https://tc39.es/ecma262/#sec-math.expm1
module.exports = (!$expm1
  // Old FF bug
  || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
  // Tor Browser bug
  || $expm1(-2e-17) != -2e-17
) ? function expm1(x) {
  return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
} : $expm1;


/***/ }),

/***/ "8f4a":
/***/ (function(module, exports, __webpack_require__) {

const Range = __webpack_require__("7b1f")

// Mostly just for testing and legacy API reasons
const toComparators = (range, options) =>
  new Range(range, options).set
    .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))

module.exports = toComparators


/***/ }),

/***/ "90e3":
/***/ (function(module, exports) {

var id = 0;
var postfix = Math.random();

module.exports = function (key) {
  return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
};


/***/ }),

/***/ "9112":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var definePropertyModule = __webpack_require__("9bf2");
var createPropertyDescriptor = __webpack_require__("5c6c");

module.exports = DESCRIPTORS ? function (object, key, value) {
  return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
  object[key] = value;
  return object;
};


/***/ }),

/***/ "9152":
/***/ (function(module, exports) {

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  var e, m
  var eLen = (nBytes * 8) - mLen - 1
  var eMax = (1 << eLen) - 1
  var eBias = eMax >> 1
  var nBits = -7
  var i = isLE ? (nBytes - 1) : 0
  var d = isLE ? -1 : 1
  var s = buffer[offset + i]

  i += d

  e = s & ((1 << (-nBits)) - 1)
  s >>= (-nBits)
  nBits += eLen
  for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}

  m = e & ((1 << (-nBits)) - 1)
  e >>= (-nBits)
  nBits += mLen
  for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}

  if (e === 0) {
    e = 1 - eBias
  } else if (e === eMax) {
    return m ? NaN : ((s ? -1 : 1) * Infinity)
  } else {
    m = m + Math.pow(2, mLen)
    e = e - eBias
  }
  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}

exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  var e, m, c
  var eLen = (nBytes * 8) - mLen - 1
  var eMax = (1 << eLen) - 1
  var eBias = eMax >> 1
  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  var i = isLE ? 0 : (nBytes - 1)
  var d = isLE ? 1 : -1
  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0

  value = Math.abs(value)

  if (isNaN(value) || value === Infinity) {
    m = isNaN(value) ? 1 : 0
    e = eMax
  } else {
    e = Math.floor(Math.log(value) / Math.LN2)
    if (value * (c = Math.pow(2, -e)) < 1) {
      e--
      c *= 2
    }
    if (e + eBias >= 1) {
      value += rt / c
    } else {
      value += rt * Math.pow(2, 1 - eBias)
    }
    if (value * c >= 2) {
      e++
      c /= 2
    }

    if (e + eBias >= eMax) {
      m = 0
      e = eMax
    } else if (e + eBias >= 1) {
      m = ((value * c) - 1) * Math.pow(2, mLen)
      e = e + eBias
    } else {
      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
      e = 0
    }
  }

  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}

  e = (e << mLen) | m
  eLen += mLen
  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}

  buffer[offset + i - d] |= s * 128
}


/***/ }),

/***/ "9263":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
/* eslint-disable regexp/no-useless-quantifier -- testing */
var toString = __webpack_require__("577e");
var regexpFlags = __webpack_require__("ad6d");
var stickyHelpers = __webpack_require__("9f7f");
var shared = __webpack_require__("5692");
var create = __webpack_require__("7c73");
var getInternalState = __webpack_require__("69f3").get;
var UNSUPPORTED_DOT_ALL = __webpack_require__("fce3");
var UNSUPPORTED_NCG = __webpack_require__("107c");

var nativeExec = RegExp.prototype.exec;
var nativeReplace = shared('native-string-replace', String.prototype.replace);

var patchedExec = nativeExec;

var UPDATES_LAST_INDEX_WRONG = (function () {
  var re1 = /a/;
  var re2 = /b*/g;
  nativeExec.call(re1, 'a');
  nativeExec.call(re2, 'a');
  return re1.lastIndex !== 0 || re2.lastIndex !== 0;
})();

var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;

// nonparticipating capturing group, copied from es5-shim's String#split patch.
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;

var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;

if (PATCH) {
  // eslint-disable-next-line max-statements -- TODO
  patchedExec = function exec(string) {
    var re = this;
    var state = getInternalState(re);
    var str = toString(string);
    var raw = state.raw;
    var result, reCopy, lastIndex, match, i, object, group;

    if (raw) {
      raw.lastIndex = re.lastIndex;
      result = patchedExec.call(raw, str);
      re.lastIndex = raw.lastIndex;
      return result;
    }

    var groups = state.groups;
    var sticky = UNSUPPORTED_Y && re.sticky;
    var flags = regexpFlags.call(re);
    var source = re.source;
    var charsAdded = 0;
    var strCopy = str;

    if (sticky) {
      flags = flags.replace('y', '');
      if (flags.indexOf('g') === -1) {
        flags += 'g';
      }

      strCopy = str.slice(re.lastIndex);
      // Support anchored sticky behavior.
      if (re.lastIndex > 0 && (!re.multiline || re.multiline && str.charAt(re.lastIndex - 1) !== '\n')) {
        source = '(?: ' + source + ')';
        strCopy = ' ' + strCopy;
        charsAdded++;
      }
      // ^(? + rx + ) is needed, in combination with some str slicing, to
      // simulate the 'y' flag.
      reCopy = new RegExp('^(?:' + source + ')', flags);
    }

    if (NPCG_INCLUDED) {
      reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
    }
    if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;

    match = nativeExec.call(sticky ? reCopy : re, strCopy);

    if (sticky) {
      if (match) {
        match.input = match.input.slice(charsAdded);
        match[0] = match[0].slice(charsAdded);
        match.index = re.lastIndex;
        re.lastIndex += match[0].length;
      } else re.lastIndex = 0;
    } else if (UPDATES_LAST_INDEX_WRONG && match) {
      re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
    }
    if (NPCG_INCLUDED && match && match.length > 1) {
      // Fix browsers whose `exec` methods don't consistently return `undefined`
      // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
      nativeReplace.call(match[0], reCopy, function () {
        for (i = 1; i < arguments.length - 2; i++) {
          if (arguments[i] === undefined) match[i] = undefined;
        }
      });
    }

    if (match && groups) {
      match.groups = object = create(null);
      for (i = 0; i < groups.length; i++) {
        group = groups[i];
        object[group[0]] = match[group[1]];
      }
    }

    return match;
  };
}

module.exports = patchedExec;


/***/ }),

/***/ "94ca":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var isCallable = __webpack_require__("1626");

var replacement = /#|\.prototype\./;

var isForced = function (feature, detection) {
  var value = data[normalize(feature)];
  return value == POLYFILL ? true
    : value == NATIVE ? false
    : isCallable(detection) ? fails(detection)
    : !!detection;
};

var normalize = isForced.normalize = function (string) {
  return String(string).replace(replacement, '.').toLowerCase();
};

var data = isForced.data = {};
var NATIVE = isForced.NATIVE = 'N';
var POLYFILL = isForced.POLYFILL = 'P';

module.exports = isForced;


/***/ }),

/***/ "9588":
/***/ (function(module, exports, __webpack_require__) {

const compareBuild = __webpack_require__("8840")
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
module.exports = sort


/***/ }),

/***/ "9603":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export months */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");


var month = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setDate(1);
  date.setHours(0, 0, 0, 0);
}, function(date, step) {
  date.setMonth(date.getMonth() + step);
}, function(start, end) {
  return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
}, function(date) {
  return date.getMonth();
});

/* harmony default export */ __webpack_exports__["a"] = (month);
var months = month.range;


/***/ }),

/***/ "9647":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const Range = __webpack_require__("7b1f")
const gt = __webpack_require__("eec3")

const minVersion = (range, loose) => {
  range = new Range(range, loose)

  let minver = new SemVer('0.0.0')
  if (range.test(minver)) {
    return minver
  }

  minver = new SemVer('0.0.0-0')
  if (range.test(minver)) {
    return minver
  }

  minver = null
  for (let i = 0; i < range.set.length; ++i) {
    const comparators = range.set[i]

    let setMin = null
    comparators.forEach((comparator) => {
      // Clone to avoid manipulating the comparator's semver object.
      const compver = new SemVer(comparator.semver.version)
      switch (comparator.operator) {
        case '>':
          if (compver.prerelease.length === 0) {
            compver.patch++
          } else {
            compver.prerelease.push(0)
          }
          compver.raw = compver.format()
          /* fallthrough */
        case '':
        case '>=':
          if (!setMin || gt(compver, setMin)) {
            setMin = compver
          }
          break
        case '<':
        case '<=':
          /* Ignore maximum versions */
          break
        /* istanbul ignore next */
        default:
          throw new Error(`Unexpected operation: ${comparator.operator}`)
      }
    })
    if (setMin && (!minver || gt(minver, setMin)))
      minver = setMin
  }

  if (minver && range.test(minver)) {
    return minver
  }

  return null
}
module.exports = minVersion


/***/ }),

/***/ "96cf":
/***/ (function(module, exports, __webpack_require__) {

/**
 * Copyright (c) 2014-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

var runtime = (function (exports) {
  "use strict";

  var Op = Object.prototype;
  var hasOwn = Op.hasOwnProperty;
  var undefined; // More compressible than void 0.
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";

  function define(obj, key, value) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
    return obj[key];
  }
  try {
    // IE 8 has a broken Object.defineProperty that only works on DOM objects.
    define({}, "");
  } catch (err) {
    define = function(obj, key, value) {
      return obj[key] = value;
    };
  }

  function wrap(innerFn, outerFn, self, tryLocsList) {
    // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
    var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
    var generator = Object.create(protoGenerator.prototype);
    var context = new Context(tryLocsList || []);

    // The ._invoke method unifies the implementations of the .next,
    // .throw, and .return methods.
    generator._invoke = makeInvokeMethod(innerFn, self, context);

    return generator;
  }
  exports.wrap = wrap;

  // Try/catch helper to minimize deoptimizations. Returns a completion
  // record like context.tryEntries[i].completion. This interface could
  // have been (and was previously) designed to take a closure to be
  // invoked without arguments, but in all the cases we care about we
  // already have an existing method we want to call, so there's no need
  // to create a new function object. We can even get away with assuming
  // the method takes exactly one argument, since that happens to be true
  // in every case, so we don't have to touch the arguments object. The
  // only additional allocation required is the completion record, which
  // has a stable shape and so hopefully should be cheap to allocate.
  function tryCatch(fn, obj, arg) {
    try {
      return { type: "normal", arg: fn.call(obj, arg) };
    } catch (err) {
      return { type: "throw", arg: err };
    }
  }

  var GenStateSuspendedStart = "suspendedStart";
  var GenStateSuspendedYield = "suspendedYield";
  var GenStateExecuting = "executing";
  var GenStateCompleted = "completed";

  // Returning this object from the innerFn has the same effect as
  // breaking out of the dispatch switch statement.
  var ContinueSentinel = {};

  // Dummy constructor functions that we use as the .constructor and
  // .constructor.prototype properties for functions that return Generator
  // objects. For full spec compliance, you may wish to configure your
  // minifier not to mangle the names of these two functions.
  function Generator() {}
  function GeneratorFunction() {}
  function GeneratorFunctionPrototype() {}

  // This is a polyfill for %IteratorPrototype% for environments that
  // don't natively support it.
  var IteratorPrototype = {};
  define(IteratorPrototype, iteratorSymbol, function () {
    return this;
  });

  var getProto = Object.getPrototypeOf;
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  if (NativeIteratorPrototype &&
      NativeIteratorPrototype !== Op &&
      hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
    // This environment has a native %IteratorPrototype%; use it instead
    // of the polyfill.
    IteratorPrototype = NativeIteratorPrototype;
  }

  var Gp = GeneratorFunctionPrototype.prototype =
    Generator.prototype = Object.create(IteratorPrototype);
  GeneratorFunction.prototype = GeneratorFunctionPrototype;
  define(Gp, "constructor", GeneratorFunctionPrototype);
  define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
  GeneratorFunction.displayName = define(
    GeneratorFunctionPrototype,
    toStringTagSymbol,
    "GeneratorFunction"
  );

  // Helper for defining the .next, .throw, and .return methods of the
  // Iterator interface in terms of a single ._invoke method.
  function defineIteratorMethods(prototype) {
    ["next", "throw", "return"].forEach(function(method) {
      define(prototype, method, function(arg) {
        return this._invoke(method, arg);
      });
    });
  }

  exports.isGeneratorFunction = function(genFun) {
    var ctor = typeof genFun === "function" && genFun.constructor;
    return ctor
      ? ctor === GeneratorFunction ||
        // For the native GeneratorFunction constructor, the best we can
        // do is to check its .name property.
        (ctor.displayName || ctor.name) === "GeneratorFunction"
      : false;
  };

  exports.mark = function(genFun) {
    if (Object.setPrototypeOf) {
      Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
    } else {
      genFun.__proto__ = GeneratorFunctionPrototype;
      define(genFun, toStringTagSymbol, "GeneratorFunction");
    }
    genFun.prototype = Object.create(Gp);
    return genFun;
  };

  // Within the body of any async function, `await x` is transformed to
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  // `hasOwn.call(value, "__await")` to determine if the yielded value is
  // meant to be awaited.
  exports.awrap = function(arg) {
    return { __await: arg };
  };

  function AsyncIterator(generator, PromiseImpl) {
    function invoke(method, arg, resolve, reject) {
      var record = tryCatch(generator[method], generator, arg);
      if (record.type === "throw") {
        reject(record.arg);
      } else {
        var result = record.arg;
        var value = result.value;
        if (value &&
            typeof value === "object" &&
            hasOwn.call(value, "__await")) {
          return PromiseImpl.resolve(value.__await).then(function(value) {
            invoke("next", value, resolve, reject);
          }, function(err) {
            invoke("throw", err, resolve, reject);
          });
        }

        return PromiseImpl.resolve(value).then(function(unwrapped) {
          // When a yielded Promise is resolved, its final value becomes
          // the .value of the Promise<{value,done}> result for the
          // current iteration.
          result.value = unwrapped;
          resolve(result);
        }, function(error) {
          // If a rejected Promise was yielded, throw the rejection back
          // into the async generator function so it can be handled there.
          return invoke("throw", error, resolve, reject);
        });
      }
    }

    var previousPromise;

    function enqueue(method, arg) {
      function callInvokeWithMethodAndArg() {
        return new PromiseImpl(function(resolve, reject) {
          invoke(method, arg, resolve, reject);
        });
      }

      return previousPromise =
        // If enqueue has been called before, then we want to wait until
        // all previous Promises have been resolved before calling invoke,
        // so that results are always delivered in the correct order. If
        // enqueue has not been called before, then it is important to
        // call invoke immediately, without waiting on a callback to fire,
        // so that the async generator function has the opportunity to do
        // any necessary setup in a predictable way. This predictability
        // is why the Promise constructor synchronously invokes its
        // executor callback, and why async functions synchronously
        // execute code before the first await. Since we implement simple
        // async functions in terms of async generators, it is especially
        // important to get this right, even though it requires care.
        previousPromise ? previousPromise.then(
          callInvokeWithMethodAndArg,
          // Avoid propagating failures to Promises returned by later
          // invocations of the iterator.
          callInvokeWithMethodAndArg
        ) : callInvokeWithMethodAndArg();
    }

    // Define the unified helper method that is used to implement .next,
    // .throw, and .return (see defineIteratorMethods).
    this._invoke = enqueue;
  }

  defineIteratorMethods(AsyncIterator.prototype);
  define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
    return this;
  });
  exports.AsyncIterator = AsyncIterator;

  // Note that simple async functions are implemented on top of
  // AsyncIterator objects; they just return a Promise for the value of
  // the final result produced by the iterator.
  exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
    if (PromiseImpl === void 0) PromiseImpl = Promise;

    var iter = new AsyncIterator(
      wrap(innerFn, outerFn, self, tryLocsList),
      PromiseImpl
    );

    return exports.isGeneratorFunction(outerFn)
      ? iter // If outerFn is a generator, return the full iterator.
      : iter.next().then(function(result) {
          return result.done ? result.value : iter.next();
        });
  };

  function makeInvokeMethod(innerFn, self, context) {
    var state = GenStateSuspendedStart;

    return function invoke(method, arg) {
      if (state === GenStateExecuting) {
        throw new Error("Generator is already running");
      }

      if (state === GenStateCompleted) {
        if (method === "throw") {
          throw arg;
        }

        // Be forgiving, per 25.3.3.3.3 of the spec:
        // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
        return doneResult();
      }

      context.method = method;
      context.arg = arg;

      while (true) {
        var delegate = context.delegate;
        if (delegate) {
          var delegateResult = maybeInvokeDelegate(delegate, context);
          if (delegateResult) {
            if (delegateResult === ContinueSentinel) continue;
            return delegateResult;
          }
        }

        if (context.method === "next") {
          // Setting context._sent for legacy support of Babel's
          // function.sent implementation.
          context.sent = context._sent = context.arg;

        } else if (context.method === "throw") {
          if (state === GenStateSuspendedStart) {
            state = GenStateCompleted;
            throw context.arg;
          }

          context.dispatchException(context.arg);

        } else if (context.method === "return") {
          context.abrupt("return", context.arg);
        }

        state = GenStateExecuting;

        var record = tryCatch(innerFn, self, context);
        if (record.type === "normal") {
          // If an exception is thrown from innerFn, we leave state ===
          // GenStateExecuting and loop back for another invocation.
          state = context.done
            ? GenStateCompleted
            : GenStateSuspendedYield;

          if (record.arg === ContinueSentinel) {
            continue;
          }

          return {
            value: record.arg,
            done: context.done
          };

        } else if (record.type === "throw") {
          state = GenStateCompleted;
          // Dispatch the exception by looping back around to the
          // context.dispatchException(context.arg) call above.
          context.method = "throw";
          context.arg = record.arg;
        }
      }
    };
  }

  // Call delegate.iterator[context.method](context.arg) and handle the
  // result, either by returning a { value, done } result from the
  // delegate iterator, or by modifying context.method and context.arg,
  // setting context.delegate to null, and returning the ContinueSentinel.
  function maybeInvokeDelegate(delegate, context) {
    var method = delegate.iterator[context.method];
    if (method === undefined) {
      // A .throw or .return when the delegate iterator has no .throw
      // method always terminates the yield* loop.
      context.delegate = null;

      if (context.method === "throw") {
        // Note: ["return"] must be used for ES3 parsing compatibility.
        if (delegate.iterator["return"]) {
          // If the delegate iterator has a return method, give it a
          // chance to clean up.
          context.method = "return";
          context.arg = undefined;
          maybeInvokeDelegate(delegate, context);

          if (context.method === "throw") {
            // If maybeInvokeDelegate(context) changed context.method from
            // "return" to "throw", let that override the TypeError below.
            return ContinueSentinel;
          }
        }

        context.method = "throw";
        context.arg = new TypeError(
          "The iterator does not provide a 'throw' method");
      }

      return ContinueSentinel;
    }

    var record = tryCatch(method, delegate.iterator, context.arg);

    if (record.type === "throw") {
      context.method = "throw";
      context.arg = record.arg;
      context.delegate = null;
      return ContinueSentinel;
    }

    var info = record.arg;

    if (! info) {
      context.method = "throw";
      context.arg = new TypeError("iterator result is not an object");
      context.delegate = null;
      return ContinueSentinel;
    }

    if (info.done) {
      // Assign the result of the finished delegate to the temporary
      // variable specified by delegate.resultName (see delegateYield).
      context[delegate.resultName] = info.value;

      // Resume execution at the desired location (see delegateYield).
      context.next = delegate.nextLoc;

      // If context.method was "throw" but the delegate handled the
      // exception, let the outer generator proceed normally. If
      // context.method was "next", forget context.arg since it has been
      // "consumed" by the delegate iterator. If context.method was
      // "return", allow the original .return call to continue in the
      // outer generator.
      if (context.method !== "return") {
        context.method = "next";
        context.arg = undefined;
      }

    } else {
      // Re-yield the result returned by the delegate method.
      return info;
    }

    // The delegate iterator is finished, so forget it and continue with
    // the outer generator.
    context.delegate = null;
    return ContinueSentinel;
  }

  // Define Generator.prototype.{next,throw,return} in terms of the
  // unified ._invoke helper method.
  defineIteratorMethods(Gp);

  define(Gp, toStringTagSymbol, "Generator");

  // A Generator should always return itself as the iterator object when the
  // @@iterator function is called on it. Some browsers' implementations of the
  // iterator prototype chain incorrectly implement this, causing the Generator
  // object to not be returned from this call. This ensures that doesn't happen.
  // See https://github.com/facebook/regenerator/issues/274 for more details.
  define(Gp, iteratorSymbol, function() {
    return this;
  });

  define(Gp, "toString", function() {
    return "[object Generator]";
  });

  function pushTryEntry(locs) {
    var entry = { tryLoc: locs[0] };

    if (1 in locs) {
      entry.catchLoc = locs[1];
    }

    if (2 in locs) {
      entry.finallyLoc = locs[2];
      entry.afterLoc = locs[3];
    }

    this.tryEntries.push(entry);
  }

  function resetTryEntry(entry) {
    var record = entry.completion || {};
    record.type = "normal";
    delete record.arg;
    entry.completion = record;
  }

  function Context(tryLocsList) {
    // The root entry object (effectively a try statement without a catch
    // or a finally block) gives us a place to store values thrown from
    // locations where there is no enclosing try statement.
    this.tryEntries = [{ tryLoc: "root" }];
    tryLocsList.forEach(pushTryEntry, this);
    this.reset(true);
  }

  exports.keys = function(object) {
    var keys = [];
    for (var key in object) {
      keys.push(key);
    }
    keys.reverse();

    // Rather than returning an object with a next method, we keep
    // things simple and return the next function itself.
    return function next() {
      while (keys.length) {
        var key = keys.pop();
        if (key in object) {
          next.value = key;
          next.done = false;
          return next;
        }
      }

      // To avoid creating an additional object, we just hang the .value
      // and .done properties off the next function object itself. This
      // also ensures that the minifier will not anonymize the function.
      next.done = true;
      return next;
    };
  };

  function values(iterable) {
    if (iterable) {
      var iteratorMethod = iterable[iteratorSymbol];
      if (iteratorMethod) {
        return iteratorMethod.call(iterable);
      }

      if (typeof iterable.next === "function") {
        return iterable;
      }

      if (!isNaN(iterable.length)) {
        var i = -1, next = function next() {
          while (++i < iterable.length) {
            if (hasOwn.call(iterable, i)) {
              next.value = iterable[i];
              next.done = false;
              return next;
            }
          }

          next.value = undefined;
          next.done = true;

          return next;
        };

        return next.next = next;
      }
    }

    // Return an iterator with no values.
    return { next: doneResult };
  }
  exports.values = values;

  function doneResult() {
    return { value: undefined, done: true };
  }

  Context.prototype = {
    constructor: Context,

    reset: function(skipTempReset) {
      this.prev = 0;
      this.next = 0;
      // Resetting context._sent for legacy support of Babel's
      // function.sent implementation.
      this.sent = this._sent = undefined;
      this.done = false;
      this.delegate = null;

      this.method = "next";
      this.arg = undefined;

      this.tryEntries.forEach(resetTryEntry);

      if (!skipTempReset) {
        for (var name in this) {
          // Not sure about the optimal order of these conditions:
          if (name.charAt(0) === "t" &&
              hasOwn.call(this, name) &&
              !isNaN(+name.slice(1))) {
            this[name] = undefined;
          }
        }
      }
    },

    stop: function() {
      this.done = true;

      var rootEntry = this.tryEntries[0];
      var rootRecord = rootEntry.completion;
      if (rootRecord.type === "throw") {
        throw rootRecord.arg;
      }

      return this.rval;
    },

    dispatchException: function(exception) {
      if (this.done) {
        throw exception;
      }

      var context = this;
      function handle(loc, caught) {
        record.type = "throw";
        record.arg = exception;
        context.next = loc;

        if (caught) {
          // If the dispatched exception was caught by a catch block,
          // then let that catch block handle the exception normally.
          context.method = "next";
          context.arg = undefined;
        }

        return !! caught;
      }

      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        var record = entry.completion;

        if (entry.tryLoc === "root") {
          // Exception thrown outside of any try block that could handle
          // it, so set the completion value of the entire function to
          // throw the exception.
          return handle("end");
        }

        if (entry.tryLoc <= this.prev) {
          var hasCatch = hasOwn.call(entry, "catchLoc");
          var hasFinally = hasOwn.call(entry, "finallyLoc");

          if (hasCatch && hasFinally) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            } else if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }

          } else if (hasCatch) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            }

          } else if (hasFinally) {
            if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }

          } else {
            throw new Error("try statement without catch or finally");
          }
        }
      }
    },

    abrupt: function(type, arg) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc <= this.prev &&
            hasOwn.call(entry, "finallyLoc") &&
            this.prev < entry.finallyLoc) {
          var finallyEntry = entry;
          break;
        }
      }

      if (finallyEntry &&
          (type === "break" ||
           type === "continue") &&
          finallyEntry.tryLoc <= arg &&
          arg <= finallyEntry.finallyLoc) {
        // Ignore the finally entry if control is not jumping to a
        // location outside the try/catch block.
        finallyEntry = null;
      }

      var record = finallyEntry ? finallyEntry.completion : {};
      record.type = type;
      record.arg = arg;

      if (finallyEntry) {
        this.method = "next";
        this.next = finallyEntry.finallyLoc;
        return ContinueSentinel;
      }

      return this.complete(record);
    },

    complete: function(record, afterLoc) {
      if (record.type === "throw") {
        throw record.arg;
      }

      if (record.type === "break" ||
          record.type === "continue") {
        this.next = record.arg;
      } else if (record.type === "return") {
        this.rval = this.arg = record.arg;
        this.method = "return";
        this.next = "end";
      } else if (record.type === "normal" && afterLoc) {
        this.next = afterLoc;
      }

      return ContinueSentinel;
    },

    finish: function(finallyLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.finallyLoc === finallyLoc) {
          this.complete(entry.completion, entry.afterLoc);
          resetTryEntry(entry);
          return ContinueSentinel;
        }
      }
    },

    "catch": function(tryLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc === tryLoc) {
          var record = entry.completion;
          if (record.type === "throw") {
            var thrown = record.arg;
            resetTryEntry(entry);
          }
          return thrown;
        }
      }

      // The context.catch method must only be called with a location
      // argument that corresponds to a known catch block.
      throw new Error("illegal catch attempt");
    },

    delegateYield: function(iterable, resultName, nextLoc) {
      this.delegate = {
        iterator: values(iterable),
        resultName: resultName,
        nextLoc: nextLoc
      };

      if (this.method === "next") {
        // Deliberately forget the last sent value so that we don't
        // accidentally pass it on to the delegate.
        this.arg = undefined;
      }

      return ContinueSentinel;
    }
  };

  // Regardless of whether this script is executing as a CommonJS module
  // or not, return the runtime object so that we can declare the variable
  // regeneratorRuntime in the outer scope, which allows this module to be
  // injected easily by `bin/regenerator --include-runtime script.js`.
  return exports;

}(
  // If this script is executing as a CommonJS module, use module.exports
  // as the regeneratorRuntime namespace. Otherwise create a new empty
  // object. Either way, the resulting object will be used to initialize
  // the regeneratorRuntime variable at the top of this file.
   true ? module.exports : undefined
));

try {
  regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
  // This module should not be running in strict mode, so the above
  // assignment should always work unless something is misconfigured. Just
  // in case runtime.js accidentally runs in strict mode, in modern engines
  // we can explicitly access globalThis. In older engines we can escape
  // strict mode using a global Function call. This could conceivably fail
  // if a Content Security Policy forbids using Function, but in that case
  // the proper solution is to fix the accidental strict mode problem. If
  // you've misconfigured your bundler to force strict mode and applied a
  // CSP to forbid Function, and you're not willing to fix either of those
  // problems, please detail your unique predicament in a GitHub issue.
  if (typeof globalThis === "object") {
    globalThis.regeneratorRuntime = runtime;
  } else {
    Function("r", "regeneratorRuntime = r")(runtime);
  }
}


/***/ }),

/***/ "99af":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var fails = __webpack_require__("d039");
var isArray = __webpack_require__("e8b5");
var isObject = __webpack_require__("861d");
var toObject = __webpack_require__("7b0b");
var lengthOfArrayLike = __webpack_require__("07fa");
var createProperty = __webpack_require__("8418");
var arraySpeciesCreate = __webpack_require__("65f0");
var arrayMethodHasSpeciesSupport = __webpack_require__("1dde");
var wellKnownSymbol = __webpack_require__("b622");
var V8_VERSION = __webpack_require__("2d00");

var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';

// We can't use this feature detection in V8 since it causes
// deoptimization and serious performance degradation
// https://github.com/zloirock/core-js/issues/679
var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
  var array = [];
  array[IS_CONCAT_SPREADABLE] = false;
  return array.concat()[0] !== array;
});

var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');

var isConcatSpreadable = function (O) {
  if (!isObject(O)) return false;
  var spreadable = O[IS_CONCAT_SPREADABLE];
  return spreadable !== undefined ? !!spreadable : isArray(O);
};

var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;

// `Array.prototype.concat` method
// https://tc39.es/ecma262/#sec-array.prototype.concat
// with adding support of @@isConcatSpreadable and @@species
$({ target: 'Array', proto: true, forced: FORCED }, {
  // eslint-disable-next-line no-unused-vars -- required for `.length`
  concat: function concat(arg) {
    var O = toObject(this);
    var A = arraySpeciesCreate(O, 0);
    var n = 0;
    var i, k, length, len, E;
    for (i = -1, length = arguments.length; i < length; i++) {
      E = i === -1 ? O : arguments[i];
      if (isConcatSpreadable(E)) {
        len = lengthOfArrayLike(E);
        if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
        for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
      } else {
        if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
        createProperty(A, n++, E);
      }
    }
    A.length = n;
    return A;
  }
});


/***/ }),

/***/ "9a1f":
/***/ (function(module, exports, __webpack_require__) {

var aCallable = __webpack_require__("59ed");
var anObject = __webpack_require__("825a");
var getIteratorMethod = __webpack_require__("35a1");

module.exports = function (argument, usingIterator) {
  var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  if (aCallable(iteratorMethod)) return anObject(iteratorMethod.call(argument));
  throw TypeError(String(argument) + ' is not iterable');
};


/***/ }),

/***/ "9bdd":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var iteratorClose = __webpack_require__("2a62");

// call something on iterator step with safe closing on error
module.exports = function (iterator, fn, value, ENTRIES) {
  try {
    return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
  } catch (error) {
    iteratorClose(iterator, 'throw', error);
  }
};


/***/ }),

/***/ "9bf2":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var IE8_DOM_DEFINE = __webpack_require__("0cfb");
var anObject = __webpack_require__("825a");
var toPropertyKey = __webpack_require__("a04b");

// eslint-disable-next-line es/no-object-defineproperty -- safe
var $defineProperty = Object.defineProperty;

// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
exports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attributes) {
  anObject(O);
  P = toPropertyKey(P);
  anObject(Attributes);
  if (IE8_DOM_DEFINE) try {
    return $defineProperty(O, P, Attributes);
  } catch (error) { /* empty */ }
  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  if ('value' in Attributes) O[P] = Attributes.value;
  return O;
};


/***/ }),

/***/ "9ed3":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var IteratorPrototype = __webpack_require__("ae93").IteratorPrototype;
var create = __webpack_require__("7c73");
var createPropertyDescriptor = __webpack_require__("5c6c");
var setToStringTag = __webpack_require__("d44e");
var Iterators = __webpack_require__("3f8c");

var returnThis = function () { return this; };

module.exports = function (IteratorConstructor, NAME, next) {
  var TO_STRING_TAG = NAME + ' Iterator';
  IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
  setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  Iterators[TO_STRING_TAG] = returnThis;
  return IteratorConstructor;
};


/***/ }),

/***/ "9f7f":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var global = __webpack_require__("da84");

// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
var $RegExp = global.RegExp;

exports.UNSUPPORTED_Y = fails(function () {
  var re = $RegExp('a', 'y');
  re.lastIndex = 2;
  return re.exec('abcd') != null;
});

exports.BROKEN_CARET = fails(function () {
  // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  var re = $RegExp('^r', 'gy');
  re.lastIndex = 2;
  return re.exec('str') != null;
});


/***/ }),

/***/ "a017":
/***/ (function(module, exports, __webpack_require__) {

const parse = __webpack_require__("61bb")
const clean = (version, options) => {
  const s = parse(version.trim().replace(/^[=v]+/, ''), options)
  return s ? s.version : null
}
module.exports = clean


/***/ }),

/***/ "a04b":
/***/ (function(module, exports, __webpack_require__) {

var toPrimitive = __webpack_require__("c04e");
var isSymbol = __webpack_require__("d9b5");

// `ToPropertyKey` abstract operation
// https://tc39.es/ecma262/#sec-topropertykey
module.exports = function (argument) {
  var key = toPrimitive(argument, 'string');
  return isSymbol(key) ? key : String(key);
};


/***/ }),

/***/ "a15a":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export years */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");


var year = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setMonth(0, 1);
  date.setHours(0, 0, 0, 0);
}, function(date, step) {
  date.setFullYear(date.getFullYear() + step);
}, function(start, end) {
  return end.getFullYear() - start.getFullYear();
}, function(date) {
  return date.getFullYear();
});

// An optimized implementation for this simple case.
year.every = function(k) {
  return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
    date.setFullYear(Math.floor(date.getFullYear() / k) * k);
    date.setMonth(0, 1);
    date.setHours(0, 0, 0, 0);
  }, function(date, step) {
    date.setFullYear(date.getFullYear() + step * k);
  });
};

/* harmony default export */ __webpack_exports__["a"] = (year);
var years = year.range;


/***/ }),

/***/ "a15b":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var IndexedObject = __webpack_require__("44ad");
var toIndexedObject = __webpack_require__("fc6a");
var arrayMethodIsStrict = __webpack_require__("a640");

var nativeJoin = [].join;

var ES3_STRINGS = IndexedObject != Object;
var STRICT_METHOD = arrayMethodIsStrict('join', ',');

// `Array.prototype.join` method
// https://tc39.es/ecma262/#sec-array.prototype.join
$({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
  join: function join(separator) {
    return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  }
});


/***/ }),

/***/ "a21d":
/***/ (function(module, exports, __webpack_require__) {

const compare = __webpack_require__("f06c")
const rcompare = (a, b, loose) => compare(b, a, loose)
module.exports = rcompare


/***/ }),

/***/ "a2bf":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var isArray = __webpack_require__("e8b5");
var lengthOfArrayLike = __webpack_require__("07fa");
var bind = __webpack_require__("0366");

// `FlattenIntoArray` abstract operation
// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
  var targetIndex = start;
  var sourceIndex = 0;
  var mapFn = mapper ? bind(mapper, thisArg, 3) : false;
  var element, elementLen;

  while (sourceIndex < sourceLen) {
    if (sourceIndex in source) {
      element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];

      if (depth > 0 && isArray(element)) {
        elementLen = lengthOfArrayLike(element);
        targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;
      } else {
        if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');
        target[targetIndex] = element;
      }

      targetIndex++;
    }
    sourceIndex++;
  }
  return targetIndex;
};

module.exports = flattenIntoArray;


/***/ }),

/***/ "a434":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var toAbsoluteIndex = __webpack_require__("23cb");
var toIntegerOrInfinity = __webpack_require__("5926");
var lengthOfArrayLike = __webpack_require__("07fa");
var toObject = __webpack_require__("7b0b");
var arraySpeciesCreate = __webpack_require__("65f0");
var createProperty = __webpack_require__("8418");
var arrayMethodHasSpeciesSupport = __webpack_require__("1dde");

var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');

var max = Math.max;
var min = Math.min;
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';

// `Array.prototype.splice` method
// https://tc39.es/ecma262/#sec-array.prototype.splice
// with adding support of @@species
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  splice: function splice(start, deleteCount /* , ...items */) {
    var O = toObject(this);
    var len = lengthOfArrayLike(O);
    var actualStart = toAbsoluteIndex(start, len);
    var argumentsLength = arguments.length;
    var insertCount, actualDeleteCount, A, k, from, to;
    if (argumentsLength === 0) {
      insertCount = actualDeleteCount = 0;
    } else if (argumentsLength === 1) {
      insertCount = 0;
      actualDeleteCount = len - actualStart;
    } else {
      insertCount = argumentsLength - 2;
      actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
    }
    if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
      throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
    }
    A = arraySpeciesCreate(O, actualDeleteCount);
    for (k = 0; k < actualDeleteCount; k++) {
      from = actualStart + k;
      if (from in O) createProperty(A, k, O[from]);
    }
    A.length = actualDeleteCount;
    if (insertCount < actualDeleteCount) {
      for (k = actualStart; k < len - actualDeleteCount; k++) {
        from = k + actualDeleteCount;
        to = k + insertCount;
        if (from in O) O[to] = O[from];
        else delete O[to];
      }
      for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
    } else if (insertCount > actualDeleteCount) {
      for (k = len - actualDeleteCount; k > actualStart; k--) {
        from = k + actualDeleteCount - 1;
        to = k + insertCount - 1;
        if (from in O) O[to] = O[from];
        else delete O[to];
      }
    }
    for (k = 0; k < insertCount; k++) {
      O[k + actualStart] = arguments[k + 2];
    }
    O.length = len - actualDeleteCount + insertCount;
    return A;
  }
});


/***/ }),

/***/ "a4b4":
/***/ (function(module, exports, __webpack_require__) {

var userAgent = __webpack_require__("342f");

module.exports = /web0s(?!.*chrome)/i.test(userAgent);


/***/ }),

/***/ "a4d3":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var global = __webpack_require__("da84");
var getBuiltIn = __webpack_require__("d066");
var IS_PURE = __webpack_require__("c430");
var DESCRIPTORS = __webpack_require__("83ab");
var NATIVE_SYMBOL = __webpack_require__("4930");
var fails = __webpack_require__("d039");
var hasOwn = __webpack_require__("1a2d");
var isArray = __webpack_require__("e8b5");
var isCallable = __webpack_require__("1626");
var isObject = __webpack_require__("861d");
var isSymbol = __webpack_require__("d9b5");
var anObject = __webpack_require__("825a");
var toObject = __webpack_require__("7b0b");
var toIndexedObject = __webpack_require__("fc6a");
var toPropertyKey = __webpack_require__("a04b");
var $toString = __webpack_require__("577e");
var createPropertyDescriptor = __webpack_require__("5c6c");
var nativeObjectCreate = __webpack_require__("7c73");
var objectKeys = __webpack_require__("df75");
var getOwnPropertyNamesModule = __webpack_require__("241c");
var getOwnPropertyNamesExternal = __webpack_require__("057f");
var getOwnPropertySymbolsModule = __webpack_require__("7418");
var getOwnPropertyDescriptorModule = __webpack_require__("06cf");
var definePropertyModule = __webpack_require__("9bf2");
var propertyIsEnumerableModule = __webpack_require__("d1e7");
var redefine = __webpack_require__("6eeb");
var shared = __webpack_require__("5692");
var sharedKey = __webpack_require__("f772");
var hiddenKeys = __webpack_require__("d012");
var uid = __webpack_require__("90e3");
var wellKnownSymbol = __webpack_require__("b622");
var wrappedWellKnownSymbolModule = __webpack_require__("e538");
var defineWellKnownSymbol = __webpack_require__("746f");
var setToStringTag = __webpack_require__("d44e");
var InternalStateModule = __webpack_require__("69f3");
var $forEach = __webpack_require__("b727").forEach;

var HIDDEN = sharedKey('hidden');
var SYMBOL = 'Symbol';
var PROTOTYPE = 'prototype';
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.getterFor(SYMBOL);
var ObjectPrototype = Object[PROTOTYPE];
var $Symbol = global.Symbol;
var $stringify = getBuiltIn('JSON', 'stringify');
var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
var nativeDefineProperty = definePropertyModule.f;
var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
var AllSymbols = shared('symbols');
var ObjectPrototypeSymbols = shared('op-symbols');
var StringToSymbolRegistry = shared('string-to-symbol-registry');
var SymbolToStringRegistry = shared('symbol-to-string-registry');
var WellKnownSymbolsStore = shared('wks');
var QObject = global.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;

// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDescriptor = DESCRIPTORS && fails(function () {
  return nativeObjectCreate(nativeDefineProperty({}, 'a', {
    get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
  })).a != 7;
}) ? function (O, P, Attributes) {
  var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
  if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
  nativeDefineProperty(O, P, Attributes);
  if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
    nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
  }
} : nativeDefineProperty;

var wrap = function (tag, description) {
  var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);
  setInternalState(symbol, {
    type: SYMBOL,
    tag: tag,
    description: description
  });
  if (!DESCRIPTORS) symbol.description = description;
  return symbol;
};

var $defineProperty = function defineProperty(O, P, Attributes) {
  if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
  anObject(O);
  var key = toPropertyKey(P);
  anObject(Attributes);
  if (hasOwn(AllSymbols, key)) {
    if (!Attributes.enumerable) {
      if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
      O[HIDDEN][key] = true;
    } else {
      if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
      Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
    } return setSymbolDescriptor(O, key, Attributes);
  } return nativeDefineProperty(O, key, Attributes);
};

var $defineProperties = function defineProperties(O, Properties) {
  anObject(O);
  var properties = toIndexedObject(Properties);
  var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
  $forEach(keys, function (key) {
    if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
  });
  return O;
};

var $create = function create(O, Properties) {
  return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
};

var $propertyIsEnumerable = function propertyIsEnumerable(V) {
  var P = toPropertyKey(V);
  var enumerable = nativePropertyIsEnumerable.call(this, P);
  if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
  return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
    ? enumerable : true;
};

var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
  var it = toIndexedObject(O);
  var key = toPropertyKey(P);
  if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
  var descriptor = nativeGetOwnPropertyDescriptor(it, key);
  if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
    descriptor.enumerable = true;
  }
  return descriptor;
};

var $getOwnPropertyNames = function getOwnPropertyNames(O) {
  var names = nativeGetOwnPropertyNames(toIndexedObject(O));
  var result = [];
  $forEach(names, function (key) {
    if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) result.push(key);
  });
  return result;
};

var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
  var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
  var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
  var result = [];
  $forEach(names, function (key) {
    if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
      result.push(AllSymbols[key]);
    }
  });
  return result;
};

// `Symbol` constructor
// https://tc39.es/ecma262/#sec-symbol-constructor
if (!NATIVE_SYMBOL) {
  $Symbol = function Symbol() {
    if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
    var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
    var tag = uid(description);
    var setter = function (value) {
      if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
      if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
      setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
    };
    if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
    return wrap(tag, description);
  };

  redefine($Symbol[PROTOTYPE], 'toString', function toString() {
    return getInternalState(this).tag;
  });

  redefine($Symbol, 'withoutSetter', function (description) {
    return wrap(uid(description), description);
  });

  propertyIsEnumerableModule.f = $propertyIsEnumerable;
  definePropertyModule.f = $defineProperty;
  getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
  getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
  getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;

  wrappedWellKnownSymbolModule.f = function (name) {
    return wrap(wellKnownSymbol(name), name);
  };

  if (DESCRIPTORS) {
    // https://github.com/tc39/proposal-Symbol-description
    nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
      configurable: true,
      get: function description() {
        return getInternalState(this).description;
      }
    });
    if (!IS_PURE) {
      redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
    }
  }
}

$({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
  Symbol: $Symbol
});

$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
  defineWellKnownSymbol(name);
});

$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
  // `Symbol.for` method
  // https://tc39.es/ecma262/#sec-symbol.for
  'for': function (key) {
    var string = $toString(key);
    if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
    var symbol = $Symbol(string);
    StringToSymbolRegistry[string] = symbol;
    SymbolToStringRegistry[symbol] = string;
    return symbol;
  },
  // `Symbol.keyFor` method
  // https://tc39.es/ecma262/#sec-symbol.keyfor
  keyFor: function keyFor(sym) {
    if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
    if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
  },
  useSetter: function () { USE_SETTER = true; },
  useSimple: function () { USE_SETTER = false; }
});

$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
  // `Object.create` method
  // https://tc39.es/ecma262/#sec-object.create
  create: $create,
  // `Object.defineProperty` method
  // https://tc39.es/ecma262/#sec-object.defineproperty
  defineProperty: $defineProperty,
  // `Object.defineProperties` method
  // https://tc39.es/ecma262/#sec-object.defineproperties
  defineProperties: $defineProperties,
  // `Object.getOwnPropertyDescriptor` method
  // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
  getOwnPropertyDescriptor: $getOwnPropertyDescriptor
});

$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
  // `Object.getOwnPropertyNames` method
  // https://tc39.es/ecma262/#sec-object.getownpropertynames
  getOwnPropertyNames: $getOwnPropertyNames,
  // `Object.getOwnPropertySymbols` method
  // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
  getOwnPropertySymbols: $getOwnPropertySymbols
});

// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
// https://bugs.chromium.org/p/v8/issues/detail?id=3443
$({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, {
  getOwnPropertySymbols: function getOwnPropertySymbols(it) {
    return getOwnPropertySymbolsModule.f(toObject(it));
  }
});

// `JSON.stringify` method behavior with symbols
// https://tc39.es/ecma262/#sec-json.stringify
if ($stringify) {
  var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {
    var symbol = $Symbol();
    // MS Edge converts symbol values to JSON as {}
    return $stringify([symbol]) != '[null]'
      // WebKit converts symbol values to JSON as null
      || $stringify({ a: symbol }) != '{}'
      // V8 throws on boxed symbols
      || $stringify(Object(symbol)) != '{}';
  });

  $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
    // eslint-disable-next-line no-unused-vars -- required for `.length`
    stringify: function stringify(it, replacer, space) {
      var args = [it];
      var index = 1;
      var $replacer;
      while (arguments.length > index) args.push(arguments[index++]);
      $replacer = replacer;
      if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
      if (!isArray(replacer)) replacer = function (key, value) {
        if (isCallable($replacer)) value = $replacer.call(this, key, value);
        if (!isSymbol(value)) return value;
      };
      args[1] = replacer;
      return $stringify.apply(null, args);
    }
  });
}

// `Symbol.prototype[@@toPrimitive]` method
// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
  var valueOf = $Symbol[PROTOTYPE].valueOf;
  redefine($Symbol[PROTOTYPE], TO_PRIMITIVE, function () {
    return valueOf.apply(this, arguments);
  });
}
// `Symbol.prototype[@@toStringTag]` property
// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
setToStringTag($Symbol, SYMBOL);

hiddenKeys[HIDDEN] = true;


/***/ }),

/***/ "a591":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return formatLocale; });
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2739");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("6eb2");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("b14c");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("742c");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("a15a");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("77ae");


function localDate(d) {
  if (0 <= d.y && d.y < 100) {
    var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
    date.setFullYear(d.y);
    return date;
  }
  return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
}

function utcDate(d) {
  if (0 <= d.y && d.y < 100) {
    var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
    date.setUTCFullYear(d.y);
    return date;
  }
  return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
}

function newDate(y, m, d) {
  return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};
}

function formatLocale(locale) {
  var locale_dateTime = locale.dateTime,
      locale_date = locale.date,
      locale_time = locale.time,
      locale_periods = locale.periods,
      locale_weekdays = locale.days,
      locale_shortWeekdays = locale.shortDays,
      locale_months = locale.months,
      locale_shortMonths = locale.shortMonths;

  var periodRe = formatRe(locale_periods),
      periodLookup = formatLookup(locale_periods),
      weekdayRe = formatRe(locale_weekdays),
      weekdayLookup = formatLookup(locale_weekdays),
      shortWeekdayRe = formatRe(locale_shortWeekdays),
      shortWeekdayLookup = formatLookup(locale_shortWeekdays),
      monthRe = formatRe(locale_months),
      monthLookup = formatLookup(locale_months),
      shortMonthRe = formatRe(locale_shortMonths),
      shortMonthLookup = formatLookup(locale_shortMonths);

  var formats = {
    "a": formatShortWeekday,
    "A": formatWeekday,
    "b": formatShortMonth,
    "B": formatMonth,
    "c": null,
    "d": formatDayOfMonth,
    "e": formatDayOfMonth,
    "f": formatMicroseconds,
    "g": formatYearISO,
    "G": formatFullYearISO,
    "H": formatHour24,
    "I": formatHour12,
    "j": formatDayOfYear,
    "L": formatMilliseconds,
    "m": formatMonthNumber,
    "M": formatMinutes,
    "p": formatPeriod,
    "q": formatQuarter,
    "Q": formatUnixTimestamp,
    "s": formatUnixTimestampSeconds,
    "S": formatSeconds,
    "u": formatWeekdayNumberMonday,
    "U": formatWeekNumberSunday,
    "V": formatWeekNumberISO,
    "w": formatWeekdayNumberSunday,
    "W": formatWeekNumberMonday,
    "x": null,
    "X": null,
    "y": formatYear,
    "Y": formatFullYear,
    "Z": formatZone,
    "%": formatLiteralPercent
  };

  var utcFormats = {
    "a": formatUTCShortWeekday,
    "A": formatUTCWeekday,
    "b": formatUTCShortMonth,
    "B": formatUTCMonth,
    "c": null,
    "d": formatUTCDayOfMonth,
    "e": formatUTCDayOfMonth,
    "f": formatUTCMicroseconds,
    "g": formatUTCYearISO,
    "G": formatUTCFullYearISO,
    "H": formatUTCHour24,
    "I": formatUTCHour12,
    "j": formatUTCDayOfYear,
    "L": formatUTCMilliseconds,
    "m": formatUTCMonthNumber,
    "M": formatUTCMinutes,
    "p": formatUTCPeriod,
    "q": formatUTCQuarter,
    "Q": formatUnixTimestamp,
    "s": formatUnixTimestampSeconds,
    "S": formatUTCSeconds,
    "u": formatUTCWeekdayNumberMonday,
    "U": formatUTCWeekNumberSunday,
    "V": formatUTCWeekNumberISO,
    "w": formatUTCWeekdayNumberSunday,
    "W": formatUTCWeekNumberMonday,
    "x": null,
    "X": null,
    "y": formatUTCYear,
    "Y": formatUTCFullYear,
    "Z": formatUTCZone,
    "%": formatLiteralPercent
  };

  var parses = {
    "a": parseShortWeekday,
    "A": parseWeekday,
    "b": parseShortMonth,
    "B": parseMonth,
    "c": parseLocaleDateTime,
    "d": parseDayOfMonth,
    "e": parseDayOfMonth,
    "f": parseMicroseconds,
    "g": parseYear,
    "G": parseFullYear,
    "H": parseHour24,
    "I": parseHour24,
    "j": parseDayOfYear,
    "L": parseMilliseconds,
    "m": parseMonthNumber,
    "M": parseMinutes,
    "p": parsePeriod,
    "q": parseQuarter,
    "Q": parseUnixTimestamp,
    "s": parseUnixTimestampSeconds,
    "S": parseSeconds,
    "u": parseWeekdayNumberMonday,
    "U": parseWeekNumberSunday,
    "V": parseWeekNumberISO,
    "w": parseWeekdayNumberSunday,
    "W": parseWeekNumberMonday,
    "x": parseLocaleDate,
    "X": parseLocaleTime,
    "y": parseYear,
    "Y": parseFullYear,
    "Z": parseZone,
    "%": parseLiteralPercent
  };

  // These recursive directive definitions must be deferred.
  formats.x = newFormat(locale_date, formats);
  formats.X = newFormat(locale_time, formats);
  formats.c = newFormat(locale_dateTime, formats);
  utcFormats.x = newFormat(locale_date, utcFormats);
  utcFormats.X = newFormat(locale_time, utcFormats);
  utcFormats.c = newFormat(locale_dateTime, utcFormats);

  function newFormat(specifier, formats) {
    return function(date) {
      var string = [],
          i = -1,
          j = 0,
          n = specifier.length,
          c,
          pad,
          format;

      if (!(date instanceof Date)) date = new Date(+date);

      while (++i < n) {
        if (specifier.charCodeAt(i) === 37) {
          string.push(specifier.slice(j, i));
          if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
          else pad = c === "e" ? " " : "0";
          if (format = formats[c]) c = format(date, pad);
          string.push(c);
          j = i + 1;
        }
      }

      string.push(specifier.slice(j, i));
      return string.join("");
    };
  }

  function newParse(specifier, Z) {
    return function(string) {
      var d = newDate(1900, undefined, 1),
          i = parseSpecifier(d, specifier, string += "", 0),
          week, day;
      if (i != string.length) return null;

      // If a UNIX timestamp is specified, return it.
      if ("Q" in d) return new Date(d.Q);
      if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0));

      // If this is utcParse, never use the local timezone.
      if (Z && !("Z" in d)) d.Z = 0;

      // The am-pm flag is 0 for AM, and 1 for PM.
      if ("p" in d) d.H = d.H % 12 + d.p * 12;

      // If the month was not specified, inherit from the quarter.
      if (d.m === undefined) d.m = "q" in d ? d.q : 0;

      // Convert day-of-week and week-of-year to day-of-year.
      if ("V" in d) {
        if (d.V < 1 || d.V > 53) return null;
        if (!("w" in d)) d.w = 1;
        if ("Z" in d) {
          week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();
          week = day > 4 || day === 0 ? d3_time__WEBPACK_IMPORTED_MODULE_0__[/* utcMonday */ "a"].ceil(week) : Object(d3_time__WEBPACK_IMPORTED_MODULE_0__[/* utcMonday */ "a"])(week);
          week = d3_time__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].offset(week, (d.V - 1) * 7);
          d.y = week.getUTCFullYear();
          d.m = week.getUTCMonth();
          d.d = week.getUTCDate() + (d.w + 6) % 7;
        } else {
          week = localDate(newDate(d.y, 0, 1)), day = week.getDay();
          week = day > 4 || day === 0 ? d3_time__WEBPACK_IMPORTED_MODULE_2__[/* monday */ "a"].ceil(week) : Object(d3_time__WEBPACK_IMPORTED_MODULE_2__[/* monday */ "a"])(week);
          week = d3_time__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].offset(week, (d.V - 1) * 7);
          d.y = week.getFullYear();
          d.m = week.getMonth();
          d.d = week.getDate() + (d.w + 6) % 7;
        }
      } else if ("W" in d || "U" in d) {
        if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
        day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
        d.m = 0;
        d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
      }

      // If a time zone is specified, all fields are interpreted as UTC and then
      // offset according to the specified time zone.
      if ("Z" in d) {
        d.H += d.Z / 100 | 0;
        d.M += d.Z % 100;
        return utcDate(d);
      }

      // Otherwise, all fields are in local time.
      return localDate(d);
    };
  }

  function parseSpecifier(d, specifier, string, j) {
    var i = 0,
        n = specifier.length,
        m = string.length,
        c,
        parse;

    while (i < n) {
      if (j >= m) return -1;
      c = specifier.charCodeAt(i++);
      if (c === 37) {
        c = specifier.charAt(i++);
        parse = parses[c in pads ? specifier.charAt(i++) : c];
        if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
      } else if (c != string.charCodeAt(j++)) {
        return -1;
      }
    }

    return j;
  }

  function parsePeriod(d, string, i) {
    var n = periodRe.exec(string.slice(i));
    return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  }

  function parseShortWeekday(d, string, i) {
    var n = shortWeekdayRe.exec(string.slice(i));
    return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  }

  function parseWeekday(d, string, i) {
    var n = weekdayRe.exec(string.slice(i));
    return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  }

  function parseShortMonth(d, string, i) {
    var n = shortMonthRe.exec(string.slice(i));
    return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  }

  function parseMonth(d, string, i) {
    var n = monthRe.exec(string.slice(i));
    return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
  }

  function parseLocaleDateTime(d, string, i) {
    return parseSpecifier(d, locale_dateTime, string, i);
  }

  function parseLocaleDate(d, string, i) {
    return parseSpecifier(d, locale_date, string, i);
  }

  function parseLocaleTime(d, string, i) {
    return parseSpecifier(d, locale_time, string, i);
  }

  function formatShortWeekday(d) {
    return locale_shortWeekdays[d.getDay()];
  }

  function formatWeekday(d) {
    return locale_weekdays[d.getDay()];
  }

  function formatShortMonth(d) {
    return locale_shortMonths[d.getMonth()];
  }

  function formatMonth(d) {
    return locale_months[d.getMonth()];
  }

  function formatPeriod(d) {
    return locale_periods[+(d.getHours() >= 12)];
  }

  function formatQuarter(d) {
    return 1 + ~~(d.getMonth() / 3);
  }

  function formatUTCShortWeekday(d) {
    return locale_shortWeekdays[d.getUTCDay()];
  }

  function formatUTCWeekday(d) {
    return locale_weekdays[d.getUTCDay()];
  }

  function formatUTCShortMonth(d) {
    return locale_shortMonths[d.getUTCMonth()];
  }

  function formatUTCMonth(d) {
    return locale_months[d.getUTCMonth()];
  }

  function formatUTCPeriod(d) {
    return locale_periods[+(d.getUTCHours() >= 12)];
  }

  function formatUTCQuarter(d) {
    return 1 + ~~(d.getUTCMonth() / 3);
  }

  return {
    format: function(specifier) {
      var f = newFormat(specifier += "", formats);
      f.toString = function() { return specifier; };
      return f;
    },
    parse: function(specifier) {
      var p = newParse(specifier += "", false);
      p.toString = function() { return specifier; };
      return p;
    },
    utcFormat: function(specifier) {
      var f = newFormat(specifier += "", utcFormats);
      f.toString = function() { return specifier; };
      return f;
    },
    utcParse: function(specifier) {
      var p = newParse(specifier += "", true);
      p.toString = function() { return specifier; };
      return p;
    }
  };
}

var pads = {"-": "", "_": " ", "0": "0"},
    numberRe = /^\s*\d+/, // note: ignores next directive
    percentRe = /^%/,
    requoteRe = /[\\^$*+?|[\]().{}]/g;

function pad(value, fill, width) {
  var sign = value < 0 ? "-" : "",
      string = (sign ? -value : value) + "",
      length = string.length;
  return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
}

function requote(s) {
  return s.replace(requoteRe, "\\$&");
}

function formatRe(names) {
  return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
}

function formatLookup(names) {
  return new Map(names.map((name, i) => [name.toLowerCase(), i]));
}

function parseWeekdayNumberSunday(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 1));
  return n ? (d.w = +n[0], i + n[0].length) : -1;
}

function parseWeekdayNumberMonday(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 1));
  return n ? (d.u = +n[0], i + n[0].length) : -1;
}

function parseWeekNumberSunday(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.U = +n[0], i + n[0].length) : -1;
}

function parseWeekNumberISO(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.V = +n[0], i + n[0].length) : -1;
}

function parseWeekNumberMonday(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.W = +n[0], i + n[0].length) : -1;
}

function parseFullYear(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 4));
  return n ? (d.y = +n[0], i + n[0].length) : -1;
}

function parseYear(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
}

function parseZone(d, string, i) {
  var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
  return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
}

function parseQuarter(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 1));
  return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
}

function parseMonthNumber(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
}

function parseDayOfMonth(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.d = +n[0], i + n[0].length) : -1;
}

function parseDayOfYear(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 3));
  return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
}

function parseHour24(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.H = +n[0], i + n[0].length) : -1;
}

function parseMinutes(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.M = +n[0], i + n[0].length) : -1;
}

function parseSeconds(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.S = +n[0], i + n[0].length) : -1;
}

function parseMilliseconds(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 3));
  return n ? (d.L = +n[0], i + n[0].length) : -1;
}

function parseMicroseconds(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 6));
  return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
}

function parseLiteralPercent(d, string, i) {
  var n = percentRe.exec(string.slice(i, i + 1));
  return n ? i + n[0].length : -1;
}

function parseUnixTimestamp(d, string, i) {
  var n = numberRe.exec(string.slice(i));
  return n ? (d.Q = +n[0], i + n[0].length) : -1;
}

function parseUnixTimestampSeconds(d, string, i) {
  var n = numberRe.exec(string.slice(i));
  return n ? (d.s = +n[0], i + n[0].length) : -1;
}

function formatDayOfMonth(d, p) {
  return pad(d.getDate(), p, 2);
}

function formatHour24(d, p) {
  return pad(d.getHours(), p, 2);
}

function formatHour12(d, p) {
  return pad(d.getHours() % 12 || 12, p, 2);
}

function formatDayOfYear(d, p) {
  return pad(1 + d3_time__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].count(Object(d3_time__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(d), d), p, 3);
}

function formatMilliseconds(d, p) {
  return pad(d.getMilliseconds(), p, 3);
}

function formatMicroseconds(d, p) {
  return formatMilliseconds(d, p) + "000";
}

function formatMonthNumber(d, p) {
  return pad(d.getMonth() + 1, p, 2);
}

function formatMinutes(d, p) {
  return pad(d.getMinutes(), p, 2);
}

function formatSeconds(d, p) {
  return pad(d.getSeconds(), p, 2);
}

function formatWeekdayNumberMonday(d) {
  var day = d.getDay();
  return day === 0 ? 7 : day;
}

function formatWeekNumberSunday(d, p) {
  return pad(d3_time__WEBPACK_IMPORTED_MODULE_2__[/* sunday */ "b"].count(Object(d3_time__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(d) - 1, d), p, 2);
}

function dISO(d) {
  var day = d.getDay();
  return (day >= 4 || day === 0) ? Object(d3_time__WEBPACK_IMPORTED_MODULE_2__[/* thursday */ "c"])(d) : d3_time__WEBPACK_IMPORTED_MODULE_2__[/* thursday */ "c"].ceil(d);
}

function formatWeekNumberISO(d, p) {
  d = dISO(d);
  return pad(d3_time__WEBPACK_IMPORTED_MODULE_2__[/* thursday */ "c"].count(Object(d3_time__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(d), d) + (Object(d3_time__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(d).getDay() === 4), p, 2);
}

function formatWeekdayNumberSunday(d) {
  return d.getDay();
}

function formatWeekNumberMonday(d, p) {
  return pad(d3_time__WEBPACK_IMPORTED_MODULE_2__[/* monday */ "a"].count(Object(d3_time__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(d) - 1, d), p, 2);
}

function formatYear(d, p) {
  return pad(d.getFullYear() % 100, p, 2);
}

function formatYearISO(d, p) {
  d = dISO(d);
  return pad(d.getFullYear() % 100, p, 2);
}

function formatFullYear(d, p) {
  return pad(d.getFullYear() % 10000, p, 4);
}

function formatFullYearISO(d, p) {
  var day = d.getDay();
  d = (day >= 4 || day === 0) ? Object(d3_time__WEBPACK_IMPORTED_MODULE_2__[/* thursday */ "c"])(d) : d3_time__WEBPACK_IMPORTED_MODULE_2__[/* thursday */ "c"].ceil(d);
  return pad(d.getFullYear() % 10000, p, 4);
}

function formatZone(d) {
  var z = d.getTimezoneOffset();
  return (z > 0 ? "-" : (z *= -1, "+"))
      + pad(z / 60 | 0, "0", 2)
      + pad(z % 60, "0", 2);
}

function formatUTCDayOfMonth(d, p) {
  return pad(d.getUTCDate(), p, 2);
}

function formatUTCHour24(d, p) {
  return pad(d.getUTCHours(), p, 2);
}

function formatUTCHour12(d, p) {
  return pad(d.getUTCHours() % 12 || 12, p, 2);
}

function formatUTCDayOfYear(d, p) {
  return pad(1 + d3_time__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].count(Object(d3_time__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(d), d), p, 3);
}

function formatUTCMilliseconds(d, p) {
  return pad(d.getUTCMilliseconds(), p, 3);
}

function formatUTCMicroseconds(d, p) {
  return formatUTCMilliseconds(d, p) + "000";
}

function formatUTCMonthNumber(d, p) {
  return pad(d.getUTCMonth() + 1, p, 2);
}

function formatUTCMinutes(d, p) {
  return pad(d.getUTCMinutes(), p, 2);
}

function formatUTCSeconds(d, p) {
  return pad(d.getUTCSeconds(), p, 2);
}

function formatUTCWeekdayNumberMonday(d) {
  var dow = d.getUTCDay();
  return dow === 0 ? 7 : dow;
}

function formatUTCWeekNumberSunday(d, p) {
  return pad(d3_time__WEBPACK_IMPORTED_MODULE_0__[/* utcSunday */ "b"].count(Object(d3_time__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(d) - 1, d), p, 2);
}

function UTCdISO(d) {
  var day = d.getUTCDay();
  return (day >= 4 || day === 0) ? Object(d3_time__WEBPACK_IMPORTED_MODULE_0__[/* utcThursday */ "c"])(d) : d3_time__WEBPACK_IMPORTED_MODULE_0__[/* utcThursday */ "c"].ceil(d);
}

function formatUTCWeekNumberISO(d, p) {
  d = UTCdISO(d);
  return pad(d3_time__WEBPACK_IMPORTED_MODULE_0__[/* utcThursday */ "c"].count(Object(d3_time__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(d), d) + (Object(d3_time__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(d).getUTCDay() === 4), p, 2);
}

function formatUTCWeekdayNumberSunday(d) {
  return d.getUTCDay();
}

function formatUTCWeekNumberMonday(d, p) {
  return pad(d3_time__WEBPACK_IMPORTED_MODULE_0__[/* utcMonday */ "a"].count(Object(d3_time__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(d) - 1, d), p, 2);
}

function formatUTCYear(d, p) {
  return pad(d.getUTCFullYear() % 100, p, 2);
}

function formatUTCYearISO(d, p) {
  d = UTCdISO(d);
  return pad(d.getUTCFullYear() % 100, p, 2);
}

function formatUTCFullYear(d, p) {
  return pad(d.getUTCFullYear() % 10000, p, 4);
}

function formatUTCFullYearISO(d, p) {
  var day = d.getUTCDay();
  d = (day >= 4 || day === 0) ? Object(d3_time__WEBPACK_IMPORTED_MODULE_0__[/* utcThursday */ "c"])(d) : d3_time__WEBPACK_IMPORTED_MODULE_0__[/* utcThursday */ "c"].ceil(d);
  return pad(d.getUTCFullYear() % 10000, p, 4);
}

function formatUTCZone() {
  return "+0000";
}

function formatLiteralPercent() {
  return "%";
}

function formatUnixTimestamp(d) {
  return +d;
}

function formatUnixTimestampSeconds(d) {
  return Math.floor(+d / 1000);
}


/***/ }),

/***/ "a623":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var $every = __webpack_require__("b727").every;
var arrayMethodIsStrict = __webpack_require__("a640");

var STRICT_METHOD = arrayMethodIsStrict('every');

// `Array.prototype.every` method
// https://tc39.es/ecma262/#sec-array.prototype.every
$({ target: 'Array', proto: true, forced: !STRICT_METHOD }, {
  every: function every(callbackfn /* , thisArg */) {
    return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});


/***/ }),

/***/ "a630":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var from = __webpack_require__("4df4");
var checkCorrectnessOfIteration = __webpack_require__("1c7e");

var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
  // eslint-disable-next-line es/no-array-from -- required for testing
  Array.from(iterable);
});

// `Array.from` method
// https://tc39.es/ecma262/#sec-array.from
$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
  from: from
});


/***/ }),

/***/ "a640":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var fails = __webpack_require__("d039");

module.exports = function (METHOD_NAME, argument) {
  var method = [][METHOD_NAME];
  return !!method && fails(function () {
    // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
    method.call(null, argument || function () { throw 1; }, 1);
  });
};


/***/ }),

/***/ "a7fd":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var _formatDecimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("aa74");


/* harmony default export */ __webpack_exports__["a"] = (function(x) {
  return x = Object(_formatDecimal_js__WEBPACK_IMPORTED_MODULE_0__[/* formatDecimalParts */ "b"])(Math.abs(x)), x ? x[1] : NaN;
});


/***/ }),

/***/ "a87b":
/***/ (function(module) {

module.exports = JSON.parse("{\"name\":\"vega-lite\",\"author\":\"Dominik Moritz, Kanit \\\"Ham\\\" Wongsuphasawat, Arvind Satyanarayan, Jeffrey Heer\",\"version\":\"4.8.1\",\"collaborators\":[\"Kanit Wongsuphasawat (http://kanitw.yellowpigz.com)\",\"Dominik Moritz (https://www.domoritz.de)\",\"Arvind Satyanarayan (https://arvindsatya.com)\",\"Jeffrey Heer (https://jheer.org)\"],\"homepage\":\"https://vega.github.io/vega-lite/\",\"description\":\"Vega-Lite is a concise high-level language for interactive visualization.\",\"main\":\"build/vega-lite.js\",\"unpkg\":\"build/vega-lite.min.js\",\"jsdelivr\":\"build/vega-lite.min.js\",\"module\":\"build/src/index\",\"types\":\"build/src/index.d.ts\",\"bin\":{\"vl2png\":\"./bin/vl2png\",\"vl2svg\":\"./bin/vl2svg\",\"vl2pdf\":\"./bin/vl2pdf\",\"vl2vg\":\"./bin/vl2vg\"},\"directories\":{\"test\":\"test\"},\"scripts\":{\"changelog\":\"conventional-changelog -p angular\",\"build\":\"yarn build:only\",\"build:only\":\"yarn tsc:src && rollup -c\",\"postbuild\":\"terser build/vega-lite.js -cm --source-map content=build/vega-lite.js.map,filename=build/vega-lite.min.js.map -o build/vega-lite.min.js && yarn schema\",\"prebuild:examples\":\"yarn build:only\",\"build:examples\":\"yarn data && TZ=America/Los_Angeles scripts/build-examples.sh\",\"prebuild:examples-full\":\"yarn build:only\",\"build:examples-full\":\"TZ=America/Los_Angeles scripts/build-examples.sh 1\",\"build:example\":\"TZ=America/Los_Angeles scripts/build-example.sh\",\"build:toc\":\"yarn build:jekyll && scripts/generate-toc\",\"build:site\":\"yarn tsc:site && rollup -c site/rollup.config.js\",\"build:jekyll\":\"pushd site && bundle exec jekyll build -q && popd\",\"build:versions\":\"scripts/update-version.sh\",\"clean\":\"find build ! -name 'vega-lite-schema.json' -type f -delete && rm -rf site/data/* && rm -f examples/compiled/*.png && find site/examples ! -name 'index.md' ! -name 'data' -type f -delete\",\"predeploy:site\":\"yarn presite\",\"deploy:site\":\"gh-pages -d site\",\"data\":\"rsync -r node_modules/vega-datasets/data/* site/data\",\"schema\":\"mkdir -p build && ts-json-schema-generator -f tsconfig.json -p src/index.ts -t TopLevelSpec --no-type-check --no-ref-encode > build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/\",\"renameschema\":\"scripts/rename-schema.sh\",\"presite\":\"yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh\",\"site\":\"pushd site && bundle exec jekyll serve -I -l && popd\",\"tsc:src\":\"tsc -b src/tsconfig.src.json\",\"tsc:site\":\"tsc -b site/tsconfig.site.json\",\"prettierbase\":\"prettier '**/*.{md,css,yml}'\",\"eslintbase\":\"eslint --ext .ts .\",\"format\":\"yarn eslintbase --fix && yarn prettierbase --write\",\"lint\":\"yarn eslintbase && yarn prettierbase --check\",\"test\":\"jest test/ && yarn lint && yarn schema && jest examples/ && yarn test:runtime\",\"test:inspect\":\"node --inspect-brk ./node_modules/.bin/jest --runInBand test\",\"test:runtime\":\"TZ=America/Los_Angeles jest test-runtime/\",\"test:runtime:generate\":\"yarn build:only && rm -Rf test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime\",\"watch:build\":\"yarn build:only && concurrently --kill-others -n Typescript,Rollup 'yarn tsc:src -w' 'rollup -c -w'\",\"watch:site\":\"concurrently --kill-others -n Typescript,Rollup 'yarn tsc:site -w' 'rollup -c site/rollup.config.js -w'\",\"watch:test\":\"jest --watch\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/vega/vega-lite.git\"},\"license\":\"BSD-3-Clause\",\"bugs\":{\"url\":\"https://github.com/vega/vega-lite/issues\"},\"devDependencies\":{\"@commitlint/cli\":\"^8.3.5\",\"@commitlint/config-conventional\":\"^8.3.4\",\"@rollup/plugin-commonjs\":\"11.0.2\",\"@rollup/plugin-json\":\"^4.0.2\",\"@rollup/plugin-node-resolve\":\"^7.1.1\",\"@types/chai\":\"^4.2.11\",\"@types/d3\":\"^5.7.2\",\"@types/jest\":\"^25.1.4\",\"@types/jest-environment-puppeteer\":\"^4.3.1\",\"@types/mkdirp\":\"^1.0.0\",\"@types/puppeteer\":\"^2.0.1\",\"@typescript-eslint/eslint-plugin\":\"^2.24.0\",\"@typescript-eslint/parser\":\"^2.24.0\",\"ajv\":\"^6.12.0\",\"chai\":\"^4.2.0\",\"cheerio\":\"^1.0.0-rc.3\",\"codecov\":\"^3.6.5\",\"concurrently\":\"^5.1.0\",\"conventional-changelog-cli\":\"^2.0.31\",\"d3\":\"^5.15.0\",\"eslint\":\"^6.8.0\",\"eslint-config-prettier\":\"^6.10.0\",\"eslint-plugin-prettier\":\"^3.1.2\",\"gh-pages\":\"^2.2.0\",\"highlight.js\":\"^9.18.1\",\"http-server\":\"^0.12.1\",\"husky\":\"^4.2.3\",\"jest\":\"^25.1.0\",\"jest-puppeteer\":\"^4.4.0\",\"lint-staged\":\"^10.0.8\",\"mkdirp\":\"^1.0.3\",\"prettier\":\"^1.19.1\",\"puppeteer\":\"^2.1.1\",\"rollup\":\"^2.1.0\",\"rollup-plugin-sourcemaps\":\"^0.5.0\",\"rollup-plugin-terser\":\"^5.3.0\",\"svg2png-many\":\"^0.0.7\",\"terser\":\"^4.6.7\",\"ts-jest\":\"^25.2.1\",\"ts-json-schema-generator\":\"^0.65.0\",\"typescript\":\"~3.8.3\",\"vega-cli\":\"^5.10.0\",\"vega-datasets\":\"^1.30.2\",\"vega-embed\":\"^6.5.1\",\"vega-tooltip\":\"^0.22.0\",\"vega-typings\":\"~0.14.2\",\"yaml-front-matter\":\"^4.1.0\"},\"dependencies\":{\"@types/clone\":\"~0.1.30\",\"@types/fast-json-stable-stringify\":\"^2.0.0\",\"array-flat-polyfill\":\"^1.0.1\",\"clone\":\"~2.1.2\",\"fast-deep-equal\":\"~3.1.1\",\"fast-json-stable-stringify\":\"~2.1.0\",\"json-stringify-pretty-compact\":\"~2.0.0\",\"tslib\":\"~1.11.1\",\"vega-event-selector\":\"~2.0.2\",\"vega-expression\":\"~2.6.3\",\"vega-scale\":\"^6.0.0\",\"vega-util\":\"~1.13.1\",\"yargs\":\"~15.3.1\"},\"peerDependencies\":{\"vega\":\"^5.9.2\"},\"husky\":{\"hooks\":{\"pre-commit\":\"lint-staged\",\"commit-msg\":\"commitlint -E HUSKY_GIT_PARAMS\"}},\"lint-staged\":{\"*.ts\":[\"eslint --fix\",\"git add\"],\"*.{md,css,yml}\":[\"prettier --write\",\"git add\"]},\"jest\":{\"preset\":\"jest-puppeteer\",\"transform\":{\"^.+\\\\.tsx?$\":\"ts-jest\"},\"testRegex\":\"(/__tests__/.*|(\\\\.|/)(test|spec))\\\\.(jsx?|tsx?)$\",\"moduleFileExtensions\":[\"ts\",\"tsx\",\"js\",\"jsx\",\"json\",\"node\"],\"testPathIgnorePatterns\":[\"<rootDir>/node_modules\",\"<rootDir>/build\",\"<rootDir>/_site\",\"<rootDir>/src\"],\"coverageDirectory\":\"./coverage/\",\"collectCoverage\":false}}");

/***/ }),

/***/ "a981":
/***/ (function(module, exports) {

// eslint-disable-next-line es/no-typed-arrays -- safe
module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined';


/***/ }),

/***/ "a9e3":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var DESCRIPTORS = __webpack_require__("83ab");
var global = __webpack_require__("da84");
var isForced = __webpack_require__("94ca");
var redefine = __webpack_require__("6eeb");
var hasOwn = __webpack_require__("1a2d");
var inheritIfRequired = __webpack_require__("7156");
var isSymbol = __webpack_require__("d9b5");
var toPrimitive = __webpack_require__("c04e");
var fails = __webpack_require__("d039");
var getOwnPropertyNames = __webpack_require__("241c").f;
var getOwnPropertyDescriptor = __webpack_require__("06cf").f;
var defineProperty = __webpack_require__("9bf2").f;
var thisNumberValue = __webpack_require__("408a");
var trim = __webpack_require__("58a8").trim;

var NUMBER = 'Number';
var NativeNumber = global[NUMBER];
var NumberPrototype = NativeNumber.prototype;

// `ToNumeric` abstract operation
// https://tc39.es/ecma262/#sec-tonumeric
var toNumeric = function (value) {
  var primValue = toPrimitive(value, 'number');
  return typeof primValue === 'bigint' ? primValue : toNumber(primValue);
};

// `ToNumber` abstract operation
// https://tc39.es/ecma262/#sec-tonumber
var toNumber = function (argument) {
  var it = toPrimitive(argument, 'number');
  var first, third, radix, maxCode, digits, length, index, code;
  if (isSymbol(it)) throw TypeError('Cannot convert a Symbol value to a number');
  if (typeof it == 'string' && it.length > 2) {
    it = trim(it);
    first = it.charCodeAt(0);
    if (first === 43 || first === 45) {
      third = it.charCodeAt(2);
      if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
    } else if (first === 48) {
      switch (it.charCodeAt(1)) {
        case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
        case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
        default: return +it;
      }
      digits = it.slice(2);
      length = digits.length;
      for (index = 0; index < length; index++) {
        code = digits.charCodeAt(index);
        // parseInt parses a string to a first unavailable symbol
        // but ToNumber should return NaN if a string contains unavailable symbols
        if (code < 48 || code > maxCode) return NaN;
      } return parseInt(digits, radix);
    }
  } return +it;
};

// `Number` constructor
// https://tc39.es/ecma262/#sec-number-constructor
if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  var NumberWrapper = function Number(value) {
    var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
    var dummy = this;
    // check on 1..constructor(foo) case
    return dummy instanceof NumberWrapper && fails(function () { thisNumberValue(dummy); })
      ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
  };
  for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (
    // ES3:
    'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
    // ES2015 (in case, if modules with ES2015 Number statics required before):
    'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' +
    // ESNext
    'fromString,range'
  ).split(','), j = 0, key; keys.length > j; j++) {
    if (hasOwn(NativeNumber, key = keys[j]) && !hasOwn(NumberWrapper, key)) {
      defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
    }
  }
  NumberWrapper.prototype = NumberPrototype;
  NumberPrototype.constructor = NumberWrapper;
  redefine(global, NUMBER, NumberWrapper);
}


/***/ }),

/***/ "aa74":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return formatDecimalParts; });
/* harmony default export */ __webpack_exports__["a"] = (function(x) {
  return Math.abs(x = Math.round(x)) >= 1e21
      ? x.toLocaleString("en").replace(/,/g, "")
      : x.toString(10);
});

// Computes the decimal coefficient and exponent of the specified number x with
// significant digits p, where x is positive and p is in [1, 21] or undefined.
// For example, formatDecimalParts(1.23) returns ["123", 0].
function formatDecimalParts(x, p) {
  if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
  var i, coefficient = x.slice(0, i);

  // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
  // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
  return [
    coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
    +x.slice(i + 1)
  ];
}


/***/ }),

/***/ "ab13":
/***/ (function(module, exports, __webpack_require__) {

var wellKnownSymbol = __webpack_require__("b622");

var MATCH = wellKnownSymbol('match');

module.exports = function (METHOD_NAME) {
  var regexp = /./;
  try {
    '/./'[METHOD_NAME](regexp);
  } catch (error1) {
    try {
      regexp[MATCH] = false;
      return '/./'[METHOD_NAME](regexp);
    } catch (error2) { /* empty */ }
  } return false;
};


/***/ }),

/***/ "ac1f":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var exec = __webpack_require__("9263");

// `RegExp.prototype.exec` method
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
  exec: exec
});


/***/ }),

/***/ "acd8":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var $parseFloat = __webpack_require__("7e12");

// `parseFloat` method
// https://tc39.es/ecma262/#sec-parsefloat-string
$({ global: true, forced: parseFloat != $parseFloat }, {
  parseFloat: $parseFloat
});


/***/ }),

/***/ "ace4":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var fails = __webpack_require__("d039");
var ArrayBufferModule = __webpack_require__("621a");
var anObject = __webpack_require__("825a");
var toAbsoluteIndex = __webpack_require__("23cb");
var toLength = __webpack_require__("50c4");
var speciesConstructor = __webpack_require__("4840");

var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
var DataView = ArrayBufferModule.DataView;
var nativeArrayBufferSlice = ArrayBuffer.prototype.slice;

var INCORRECT_SLICE = fails(function () {
  return !new ArrayBuffer(2).slice(1, undefined).byteLength;
});

// `ArrayBuffer.prototype.slice` method
// https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
$({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, {
  slice: function slice(start, end) {
    if (nativeArrayBufferSlice !== undefined && end === undefined) {
      return nativeArrayBufferSlice.call(anObject(this), start); // FF fix
    }
    var length = anObject(this).byteLength;
    var first = toAbsoluteIndex(start, length);
    var fin = toAbsoluteIndex(end === undefined ? length : end, length);
    var result = new (speciesConstructor(this, ArrayBuffer))(toLength(fin - first));
    var viewSource = new DataView(this);
    var viewTarget = new DataView(result);
    var index = 0;
    while (first < fin) {
      viewTarget.setUint8(index++, viewSource.getUint8(first++));
    } return result;
  }
});


/***/ }),

/***/ "ad6d":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var anObject = __webpack_require__("825a");

// `RegExp.prototype.flags` getter implementation
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
module.exports = function () {
  var that = anObject(this);
  var result = '';
  if (that.global) result += 'g';
  if (that.ignoreCase) result += 'i';
  if (that.multiline) result += 'm';
  if (that.dotAll) result += 's';
  if (that.unicode) result += 'u';
  if (that.sticky) result += 'y';
  return result;
};


/***/ }),

/***/ "addb":
/***/ (function(module, exports) {

// TODO: use something more complex like timsort?
var floor = Math.floor;

var mergeSort = function (array, comparefn) {
  var length = array.length;
  var middle = floor(length / 2);
  return length < 8 ? insertionSort(array, comparefn) : merge(
    mergeSort(array.slice(0, middle), comparefn),
    mergeSort(array.slice(middle), comparefn),
    comparefn
  );
};

var insertionSort = function (array, comparefn) {
  var length = array.length;
  var i = 1;
  var element, j;

  while (i < length) {
    j = i;
    element = array[i];
    while (j && comparefn(array[j - 1], element) > 0) {
      array[j] = array[--j];
    }
    if (j !== i++) array[j] = element;
  } return array;
};

var merge = function (left, right, comparefn) {
  var llength = left.length;
  var rlength = right.length;
  var lindex = 0;
  var rindex = 0;
  var result = [];

  while (lindex < llength || rindex < rlength) {
    if (lindex < llength && rindex < rlength) {
      result.push(comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]);
    } else {
      result.push(lindex < llength ? left[lindex++] : right[rindex++]);
    }
  } return result;
};

module.exports = mergeSort;


/***/ }),

/***/ "ae93":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var fails = __webpack_require__("d039");
var isCallable = __webpack_require__("1626");
var create = __webpack_require__("7c73");
var getPrototypeOf = __webpack_require__("e163");
var redefine = __webpack_require__("6eeb");
var wellKnownSymbol = __webpack_require__("b622");
var IS_PURE = __webpack_require__("c430");

var ITERATOR = wellKnownSymbol('iterator');
var BUGGY_SAFARI_ITERATORS = false;

// `%IteratorPrototype%` object
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;

/* eslint-disable es/no-array-prototype-keys -- safe */
if ([].keys) {
  arrayIterator = [].keys();
  // Safari 8 has buggy iterators w/o `next`
  if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
  else {
    PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
    if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  }
}

var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
  var test = {};
  // FF44- legacy iterators case
  return IteratorPrototype[ITERATOR].call(test) !== test;
});

if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);

// `%IteratorPrototype%[@@iterator]()` method
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
if (!isCallable(IteratorPrototype[ITERATOR])) {
  redefine(IteratorPrototype, ITERATOR, function () {
    return this;
  });
}

module.exports = {
  IteratorPrototype: IteratorPrototype,
  BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
};


/***/ }),

/***/ "af03":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");

// check the existence of a method, lowercase
// of a tag and escaping quotes in arguments
module.exports = function (METHOD_NAME) {
  return fails(function () {
    var test = ''[METHOD_NAME]('"');
    return test !== test.toLowerCase() || test.split('"').length > 3;
  });
};


/***/ }),

/***/ "b041":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var TO_STRING_TAG_SUPPORT = __webpack_require__("00ee");
var classof = __webpack_require__("f5df");

// `Object.prototype.toString` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.tostring
module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  return '[object ' + classof(this) + ']';
};


/***/ }),

/***/ "b0c0":
/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var FUNCTION_NAME_EXISTS = __webpack_require__("5e77").EXISTS;
var defineProperty = __webpack_require__("9bf2").f;

var FunctionPrototype = Function.prototype;
var FunctionPrototypeToString = FunctionPrototype.toString;
var nameRE = /^\s*function ([^ (]*)/;
var NAME = 'name';

// Function instances `.name` property
// https://tc39.es/ecma262/#sec-function-instances-name
if (DESCRIPTORS && !FUNCTION_NAME_EXISTS) {
  defineProperty(FunctionPrototype, NAME, {
    configurable: true,
    get: function () {
      try {
        return FunctionPrototypeToString.call(this).match(nameRE)[1];
      } catch (error) {
        return '';
      }
    }
  });
}


/***/ }),

/***/ "b14c":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return sunday; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return monday; });
/* unused harmony export tuesday */
/* unused harmony export wednesday */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return thursday; });
/* unused harmony export friday */
/* unused harmony export saturday */
/* unused harmony export sundays */
/* unused harmony export mondays */
/* unused harmony export tuesdays */
/* unused harmony export wednesdays */
/* unused harmony export thursdays */
/* unused harmony export fridays */
/* unused harmony export saturdays */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");
/* harmony import */ var _duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1738");



function weekday(i) {
  return Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
    date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
    date.setHours(0, 0, 0, 0);
  }, function(date, step) {
    date.setDate(date.getDate() + step * 7);
  }, function(start, end) {
    return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationMinute */ "c"]) / _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationWeek */ "f"];
  });
}

var sunday = weekday(0);
var monday = weekday(1);
var tuesday = weekday(2);
var wednesday = weekday(3);
var thursday = weekday(4);
var friday = weekday(5);
var saturday = weekday(6);

var sundays = sunday.range;
var mondays = monday.range;
var tuesdays = tuesday.range;
var wednesdays = wednesday.range;
var thursdays = thursday.range;
var fridays = friday.range;
var saturdays = saturday.range;


/***/ }),

/***/ "b170":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXTERNAL MODULE: ./node_modules/d3-format/src/exponent.js
var src_exponent = __webpack_require__("a7fd");

// CONCATENATED MODULE: ./node_modules/d3-format/src/formatGroup.js
/* harmony default export */ var formatGroup = (function(grouping, thousands) {
  return function(value, width) {
    var i = value.length,
        t = [],
        j = 0,
        g = grouping[0],
        length = 0;

    while (i > 0 && g > 0) {
      if (length + g + 1 > width) g = Math.max(1, width - length);
      t.push(value.substring(i -= g, i + g));
      if ((length += g + 1) > width) break;
      g = grouping[j = (j + 1) % grouping.length];
    }

    return t.reverse().join(thousands);
  };
});

// CONCATENATED MODULE: ./node_modules/d3-format/src/formatNumerals.js
/* harmony default export */ var formatNumerals = (function(numerals) {
  return function(value) {
    return value.replace(/[0-9]/g, function(i) {
      return numerals[+i];
    });
  };
});

// EXTERNAL MODULE: ./node_modules/d3-format/src/formatSpecifier.js
var formatSpecifier = __webpack_require__("09b8");

// CONCATENATED MODULE: ./node_modules/d3-format/src/formatTrim.js
// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
/* harmony default export */ var formatTrim = (function(s) {
  out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
    switch (s[i]) {
      case ".": i0 = i1 = i; break;
      case "0": if (i0 === 0) i0 = i; i1 = i; break;
      default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
    }
  }
  return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
});

// EXTERNAL MODULE: ./node_modules/d3-format/src/formatDecimal.js
var formatDecimal = __webpack_require__("aa74");

// CONCATENATED MODULE: ./node_modules/d3-format/src/formatPrefixAuto.js


var prefixExponent;

/* harmony default export */ var formatPrefixAuto = (function(x, p) {
  var d = Object(formatDecimal["b" /* formatDecimalParts */])(x, p);
  if (!d) return x + "";
  var coefficient = d[0],
      exponent = d[1],
      i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
      n = coefficient.length;
  return i === n ? coefficient
      : i > n ? coefficient + new Array(i - n + 1).join("0")
      : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
      : "0." + new Array(1 - i).join("0") + Object(formatDecimal["b" /* formatDecimalParts */])(x, Math.max(0, p + i - 1))[0]; // less than 1y!
});

// CONCATENATED MODULE: ./node_modules/d3-format/src/formatRounded.js


/* harmony default export */ var formatRounded = (function(x, p) {
  var d = Object(formatDecimal["b" /* formatDecimalParts */])(x, p);
  if (!d) return x + "";
  var coefficient = d[0],
      exponent = d[1];
  return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
      : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
      : coefficient + new Array(exponent - coefficient.length + 2).join("0");
});

// CONCATENATED MODULE: ./node_modules/d3-format/src/formatTypes.js




/* harmony default export */ var formatTypes = ({
  "%": (x, p) => (x * 100).toFixed(p),
  "b": (x) => Math.round(x).toString(2),
  "c": (x) => x + "",
  "d": formatDecimal["a" /* default */],
  "e": (x, p) => x.toExponential(p),
  "f": (x, p) => x.toFixed(p),
  "g": (x, p) => x.toPrecision(p),
  "o": (x) => Math.round(x).toString(8),
  "p": (x, p) => formatRounded(x * 100, p),
  "r": formatRounded,
  "s": formatPrefixAuto,
  "X": (x) => Math.round(x).toString(16).toUpperCase(),
  "x": (x) => Math.round(x).toString(16)
});

// CONCATENATED MODULE: ./node_modules/d3-format/src/identity.js
/* harmony default export */ var identity = (function(x) {
  return x;
});

// CONCATENATED MODULE: ./node_modules/d3-format/src/locale.js









var map = Array.prototype.map,
    prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];

/* harmony default export */ var src_locale = __webpack_exports__["a"] = (function(locale) {
  var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
      currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
      currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
      decimal = locale.decimal === undefined ? "." : locale.decimal + "",
      numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
      percent = locale.percent === undefined ? "%" : locale.percent + "",
      minus = locale.minus === undefined ? "−" : locale.minus + "",
      nan = locale.nan === undefined ? "NaN" : locale.nan + "";

  function newFormat(specifier) {
    specifier = Object(formatSpecifier["a" /* default */])(specifier);

    var fill = specifier.fill,
        align = specifier.align,
        sign = specifier.sign,
        symbol = specifier.symbol,
        zero = specifier.zero,
        width = specifier.width,
        comma = specifier.comma,
        precision = specifier.precision,
        trim = specifier.trim,
        type = specifier.type;

    // The "n" type is an alias for ",g".
    if (type === "n") comma = true, type = "g";

    // The "" type, and any invalid type, is an alias for ".12~g".
    else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";

    // If zero fill is specified, padding goes after sign and before digits.
    if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";

    // Compute the prefix and suffix.
    // For SI-prefix, the suffix is lazily computed.
    var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
        suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";

    // What format function should we use?
    // Is this an integer type?
    // Can this type generate exponential notation?
    var formatType = formatTypes[type],
        maybeSuffix = /[defgprs%]/.test(type);

    // Set the default precision if not specified,
    // or clamp the specified precision to the supported range.
    // For significant precision, it must be in [1, 21].
    // For fixed precision, it must be in [0, 20].
    precision = precision === undefined ? 6
        : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
        : Math.max(0, Math.min(20, precision));

    function format(value) {
      var valuePrefix = prefix,
          valueSuffix = suffix,
          i, n, c;

      if (type === "c") {
        valueSuffix = formatType(value) + valueSuffix;
        value = "";
      } else {
        value = +value;

        // Determine the sign. -0 is not less than 0, but 1 / -0 is!
        var valueNegative = value < 0 || 1 / value < 0;

        // Perform the initial formatting.
        value = isNaN(value) ? nan : formatType(Math.abs(value), precision);

        // Trim insignificant zeros.
        if (trim) value = formatTrim(value);

        // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
        if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;

        // Compute the prefix and suffix.
        valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
        valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");

        // Break the formatted value into the integer “value” part that can be
        // grouped, and fractional or exponential “suffix” part that is not.
        if (maybeSuffix) {
          i = -1, n = value.length;
          while (++i < n) {
            if (c = value.charCodeAt(i), 48 > c || c > 57) {
              valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
              value = value.slice(0, i);
              break;
            }
          }
        }
      }

      // If the fill character is not "0", grouping is applied before padding.
      if (comma && !zero) value = group(value, Infinity);

      // Compute the padding.
      var length = valuePrefix.length + value.length + valueSuffix.length,
          padding = length < width ? new Array(width - length + 1).join(fill) : "";

      // If the fill character is "0", grouping is applied after padding.
      if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";

      // Reconstruct the final output based on the desired alignment.
      switch (align) {
        case "<": value = valuePrefix + value + valueSuffix + padding; break;
        case "=": value = valuePrefix + padding + value + valueSuffix; break;
        case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
        default: value = padding + valuePrefix + value + valueSuffix; break;
      }

      return numerals(value);
    }

    format.toString = function() {
      return specifier + "";
    };

    return format;
  }

  function formatPrefix(specifier, value) {
    var f = newFormat((specifier = Object(formatSpecifier["a" /* default */])(specifier), specifier.type = "f", specifier)),
        e = Math.max(-8, Math.min(8, Math.floor(Object(src_exponent["a" /* default */])(value) / 3))) * 3,
        k = Math.pow(10, -e),
        prefix = prefixes[8 + e / 3];
    return function(value) {
      return f(k * value) + prefix;
    };
  }

  return {
    format: newFormat,
    formatPrefix: formatPrefix
  };
});


/***/ }),

/***/ "b3c3":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export hours */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");
/* harmony import */ var _duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1738");



var hour = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setTime(date - date.getMilliseconds() - date.getSeconds() * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationSecond */ "e"] - date.getMinutes() * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationMinute */ "c"]);
}, function(date, step) {
  date.setTime(+date + step * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationHour */ "b"]);
}, function(start, end) {
  return (end - start) / _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationHour */ "b"];
}, function(date) {
  return date.getHours();
});

/* harmony default export */ __webpack_exports__["a"] = (hour);
var hours = hour.range;


/***/ }),

/***/ "b420":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var ArrayBufferModule = __webpack_require__("621a");
var NATIVE_ARRAY_BUFFER = __webpack_require__("a981");

// `DataView` constructor
// https://tc39.es/ecma262/#sec-dataview-constructor
$({ global: true, forced: !NATIVE_ARRAY_BUFFER }, {
  DataView: ArrayBufferModule.DataView
});


/***/ }),

/***/ "b575":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var getOwnPropertyDescriptor = __webpack_require__("06cf").f;
var macrotask = __webpack_require__("2cf4").set;
var IS_IOS = __webpack_require__("1cdc");
var IS_IOS_PEBBLE = __webpack_require__("d4c3");
var IS_WEBOS_WEBKIT = __webpack_require__("a4b4");
var IS_NODE = __webpack_require__("605d");

var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
var document = global.document;
var process = global.process;
var Promise = global.Promise;
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;

var flush, head, last, notify, toggle, node, promise, then;

// modern engines have queueMicrotask method
if (!queueMicrotask) {
  flush = function () {
    var parent, fn;
    if (IS_NODE && (parent = process.domain)) parent.exit();
    while (head) {
      fn = head.fn;
      head = head.next;
      try {
        fn();
      } catch (error) {
        if (head) notify();
        else last = undefined;
        throw error;
      }
    } last = undefined;
    if (parent) parent.enter();
  };

  // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
  // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
  if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
    toggle = true;
    node = document.createTextNode('');
    new MutationObserver(flush).observe(node, { characterData: true });
    notify = function () {
      node.data = toggle = !toggle;
    };
  // environments with maybe non-completely correct, but existent Promise
  } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
    // Promise.resolve without an argument throws an error in LG WebOS 2
    promise = Promise.resolve(undefined);
    // workaround of WebKit ~ iOS Safari 10.1 bug
    promise.constructor = Promise;
    then = promise.then;
    notify = function () {
      then.call(promise, flush);
    };
  // Node.js without promises
  } else if (IS_NODE) {
    notify = function () {
      process.nextTick(flush);
    };
  // for other environments - macrotask based on:
  // - setImmediate
  // - MessageChannel
  // - window.postMessag
  // - onreadystatechange
  // - setTimeout
  } else {
    notify = function () {
      // strange IE + webpack dev server bug - use .call(global)
      macrotask.call(global, flush);
    };
  }
}

module.exports = queueMicrotask || function (fn) {
  var task = { fn: fn, next: undefined };
  if (last) last.next = task;
  if (!head) {
    head = task;
    notify();
  } last = task;
};


/***/ }),

/***/ "b622":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var shared = __webpack_require__("5692");
var hasOwn = __webpack_require__("1a2d");
var uid = __webpack_require__("90e3");
var NATIVE_SYMBOL = __webpack_require__("4930");
var USE_SYMBOL_AS_UID = __webpack_require__("fdbf");

var WellKnownSymbolsStore = shared('wks');
var Symbol = global.Symbol;
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;

module.exports = function (name) {
  if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
    if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
      WellKnownSymbolsStore[name] = Symbol[name];
    } else {
      WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
    }
  } return WellKnownSymbolsStore[name];
};


/***/ }),

/***/ "b639":
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <http://feross.org>
 * @license  MIT
 */
/* eslint-disable no-proto */



var base64 = __webpack_require__("1fb5")
var ieee754 = __webpack_require__("9152")
var isArray = __webpack_require__("e3db")

exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
exports.INSPECT_MAX_BYTES = 50

/**
 * If `Buffer.TYPED_ARRAY_SUPPORT`:
 *   === true    Use Uint8Array implementation (fastest)
 *   === false   Use Object implementation (most compatible, even IE6)
 *
 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
 * Opera 11.6+, iOS 4.2+.
 *
 * Due to various browser bugs, sometimes the Object implementation will be used even
 * when the browser supports typed arrays.
 *
 * Note:
 *
 *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
 *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
 *
 *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
 *
 *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
 *     incorrect length in some situations.

 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
 * get the Object implementation, which is slower but behaves correctly.
 */
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  ? global.TYPED_ARRAY_SUPPORT
  : typedArraySupport()

/*
 * Export kMaxLength after typed array support is determined.
 */
exports.kMaxLength = kMaxLength()

function typedArraySupport () {
  try {
    var arr = new Uint8Array(1)
    arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
    return arr.foo() === 42 && // typed array instances can be augmented
        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
        arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  } catch (e) {
    return false
  }
}

function kMaxLength () {
  return Buffer.TYPED_ARRAY_SUPPORT
    ? 0x7fffffff
    : 0x3fffffff
}

function createBuffer (that, length) {
  if (kMaxLength() < length) {
    throw new RangeError('Invalid typed array length')
  }
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    // Return an augmented `Uint8Array` instance, for best performance
    that = new Uint8Array(length)
    that.__proto__ = Buffer.prototype
  } else {
    // Fallback: Return an object instance of the Buffer class
    if (that === null) {
      that = new Buffer(length)
    }
    that.length = length
  }

  return that
}

/**
 * The Buffer constructor returns instances of `Uint8Array` that have their
 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
 * returns a single octet.
 *
 * The `Uint8Array` prototype remains unmodified.
 */

function Buffer (arg, encodingOrOffset, length) {
  if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
    return new Buffer(arg, encodingOrOffset, length)
  }

  // Common case.
  if (typeof arg === 'number') {
    if (typeof encodingOrOffset === 'string') {
      throw new Error(
        'If encoding is specified then the first argument must be a string'
      )
    }
    return allocUnsafe(this, arg)
  }
  return from(this, arg, encodingOrOffset, length)
}

Buffer.poolSize = 8192 // not used by this implementation

// TODO: Legacy, not needed anymore. Remove in next major version.
Buffer._augment = function (arr) {
  arr.__proto__ = Buffer.prototype
  return arr
}

function from (that, value, encodingOrOffset, length) {
  if (typeof value === 'number') {
    throw new TypeError('"value" argument must not be a number')
  }

  if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
    return fromArrayBuffer(that, value, encodingOrOffset, length)
  }

  if (typeof value === 'string') {
    return fromString(that, value, encodingOrOffset)
  }

  return fromObject(that, value)
}

/**
 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
 * if value is a number.
 * Buffer.from(str[, encoding])
 * Buffer.from(array)
 * Buffer.from(buffer)
 * Buffer.from(arrayBuffer[, byteOffset[, length]])
 **/
Buffer.from = function (value, encodingOrOffset, length) {
  return from(null, value, encodingOrOffset, length)
}

if (Buffer.TYPED_ARRAY_SUPPORT) {
  Buffer.prototype.__proto__ = Uint8Array.prototype
  Buffer.__proto__ = Uint8Array
  if (typeof Symbol !== 'undefined' && Symbol.species &&
      Buffer[Symbol.species] === Buffer) {
    // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
    Object.defineProperty(Buffer, Symbol.species, {
      value: null,
      configurable: true
    })
  }
}

function assertSize (size) {
  if (typeof size !== 'number') {
    throw new TypeError('"size" argument must be a number')
  } else if (size < 0) {
    throw new RangeError('"size" argument must not be negative')
  }
}

function alloc (that, size, fill, encoding) {
  assertSize(size)
  if (size <= 0) {
    return createBuffer(that, size)
  }
  if (fill !== undefined) {
    // Only pay attention to encoding if it's a string. This
    // prevents accidentally sending in a number that would
    // be interpretted as a start offset.
    return typeof encoding === 'string'
      ? createBuffer(that, size).fill(fill, encoding)
      : createBuffer(that, size).fill(fill)
  }
  return createBuffer(that, size)
}

/**
 * Creates a new filled Buffer instance.
 * alloc(size[, fill[, encoding]])
 **/
Buffer.alloc = function (size, fill, encoding) {
  return alloc(null, size, fill, encoding)
}

function allocUnsafe (that, size) {
  assertSize(size)
  that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  if (!Buffer.TYPED_ARRAY_SUPPORT) {
    for (var i = 0; i < size; ++i) {
      that[i] = 0
    }
  }
  return that
}

/**
 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
 * */
Buffer.allocUnsafe = function (size) {
  return allocUnsafe(null, size)
}
/**
 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
 */
Buffer.allocUnsafeSlow = function (size) {
  return allocUnsafe(null, size)
}

function fromString (that, string, encoding) {
  if (typeof encoding !== 'string' || encoding === '') {
    encoding = 'utf8'
  }

  if (!Buffer.isEncoding(encoding)) {
    throw new TypeError('"encoding" must be a valid string encoding')
  }

  var length = byteLength(string, encoding) | 0
  that = createBuffer(that, length)

  var actual = that.write(string, encoding)

  if (actual !== length) {
    // Writing a hex string, for example, that contains invalid characters will
    // cause everything after the first invalid character to be ignored. (e.g.
    // 'abxxcd' will be treated as 'ab')
    that = that.slice(0, actual)
  }

  return that
}

function fromArrayLike (that, array) {
  var length = array.length < 0 ? 0 : checked(array.length) | 0
  that = createBuffer(that, length)
  for (var i = 0; i < length; i += 1) {
    that[i] = array[i] & 255
  }
  return that
}

function fromArrayBuffer (that, array, byteOffset, length) {
  array.byteLength // this throws if `array` is not a valid ArrayBuffer

  if (byteOffset < 0 || array.byteLength < byteOffset) {
    throw new RangeError('\'offset\' is out of bounds')
  }

  if (array.byteLength < byteOffset + (length || 0)) {
    throw new RangeError('\'length\' is out of bounds')
  }

  if (byteOffset === undefined && length === undefined) {
    array = new Uint8Array(array)
  } else if (length === undefined) {
    array = new Uint8Array(array, byteOffset)
  } else {
    array = new Uint8Array(array, byteOffset, length)
  }

  if (Buffer.TYPED_ARRAY_SUPPORT) {
    // Return an augmented `Uint8Array` instance, for best performance
    that = array
    that.__proto__ = Buffer.prototype
  } else {
    // Fallback: Return an object instance of the Buffer class
    that = fromArrayLike(that, array)
  }
  return that
}

function fromObject (that, obj) {
  if (Buffer.isBuffer(obj)) {
    var len = checked(obj.length) | 0
    that = createBuffer(that, len)

    if (that.length === 0) {
      return that
    }

    obj.copy(that, 0, 0, len)
    return that
  }

  if (obj) {
    if ((typeof ArrayBuffer !== 'undefined' &&
        obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
      if (typeof obj.length !== 'number' || isnan(obj.length)) {
        return createBuffer(that, 0)
      }
      return fromArrayLike(that, obj)
    }

    if (obj.type === 'Buffer' && isArray(obj.data)) {
      return fromArrayLike(that, obj.data)
    }
  }

  throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
}

function checked (length) {
  // Note: cannot use `length < kMaxLength()` here because that fails when
  // length is NaN (which is otherwise coerced to zero.)
  if (length >= kMaxLength()) {
    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
                         'size: 0x' + kMaxLength().toString(16) + ' bytes')
  }
  return length | 0
}

function SlowBuffer (length) {
  if (+length != length) { // eslint-disable-line eqeqeq
    length = 0
  }
  return Buffer.alloc(+length)
}

Buffer.isBuffer = function isBuffer (b) {
  return !!(b != null && b._isBuffer)
}

Buffer.compare = function compare (a, b) {
  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
    throw new TypeError('Arguments must be Buffers')
  }

  if (a === b) return 0

  var x = a.length
  var y = b.length

  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
    if (a[i] !== b[i]) {
      x = a[i]
      y = b[i]
      break
    }
  }

  if (x < y) return -1
  if (y < x) return 1
  return 0
}

Buffer.isEncoding = function isEncoding (encoding) {
  switch (String(encoding).toLowerCase()) {
    case 'hex':
    case 'utf8':
    case 'utf-8':
    case 'ascii':
    case 'latin1':
    case 'binary':
    case 'base64':
    case 'ucs2':
    case 'ucs-2':
    case 'utf16le':
    case 'utf-16le':
      return true
    default:
      return false
  }
}

Buffer.concat = function concat (list, length) {
  if (!isArray(list)) {
    throw new TypeError('"list" argument must be an Array of Buffers')
  }

  if (list.length === 0) {
    return Buffer.alloc(0)
  }

  var i
  if (length === undefined) {
    length = 0
    for (i = 0; i < list.length; ++i) {
      length += list[i].length
    }
  }

  var buffer = Buffer.allocUnsafe(length)
  var pos = 0
  for (i = 0; i < list.length; ++i) {
    var buf = list[i]
    if (!Buffer.isBuffer(buf)) {
      throw new TypeError('"list" argument must be an Array of Buffers')
    }
    buf.copy(buffer, pos)
    pos += buf.length
  }
  return buffer
}

function byteLength (string, encoding) {
  if (Buffer.isBuffer(string)) {
    return string.length
  }
  if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
      (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
    return string.byteLength
  }
  if (typeof string !== 'string') {
    string = '' + string
  }

  var len = string.length
  if (len === 0) return 0

  // Use a for loop to avoid recursion
  var loweredCase = false
  for (;;) {
    switch (encoding) {
      case 'ascii':
      case 'latin1':
      case 'binary':
        return len
      case 'utf8':
      case 'utf-8':
      case undefined:
        return utf8ToBytes(string).length
      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return len * 2
      case 'hex':
        return len >>> 1
      case 'base64':
        return base64ToBytes(string).length
      default:
        if (loweredCase) return utf8ToBytes(string).length // assume utf8
        encoding = ('' + encoding).toLowerCase()
        loweredCase = true
    }
  }
}
Buffer.byteLength = byteLength

function slowToString (encoding, start, end) {
  var loweredCase = false

  // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  // property of a typed array.

  // This behaves neither like String nor Uint8Array in that we set start/end
  // to their upper/lower bounds if the value passed is out of range.
  // undefined is handled specially as per ECMA-262 6th Edition,
  // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  if (start === undefined || start < 0) {
    start = 0
  }
  // Return early if start > this.length. Done here to prevent potential uint32
  // coercion fail below.
  if (start > this.length) {
    return ''
  }

  if (end === undefined || end > this.length) {
    end = this.length
  }

  if (end <= 0) {
    return ''
  }

  // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  end >>>= 0
  start >>>= 0

  if (end <= start) {
    return ''
  }

  if (!encoding) encoding = 'utf8'

  while (true) {
    switch (encoding) {
      case 'hex':
        return hexSlice(this, start, end)

      case 'utf8':
      case 'utf-8':
        return utf8Slice(this, start, end)

      case 'ascii':
        return asciiSlice(this, start, end)

      case 'latin1':
      case 'binary':
        return latin1Slice(this, start, end)

      case 'base64':
        return base64Slice(this, start, end)

      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return utf16leSlice(this, start, end)

      default:
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
        encoding = (encoding + '').toLowerCase()
        loweredCase = true
    }
  }
}

// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
// Buffer instances.
Buffer.prototype._isBuffer = true

function swap (b, n, m) {
  var i = b[n]
  b[n] = b[m]
  b[m] = i
}

Buffer.prototype.swap16 = function swap16 () {
  var len = this.length
  if (len % 2 !== 0) {
    throw new RangeError('Buffer size must be a multiple of 16-bits')
  }
  for (var i = 0; i < len; i += 2) {
    swap(this, i, i + 1)
  }
  return this
}

Buffer.prototype.swap32 = function swap32 () {
  var len = this.length
  if (len % 4 !== 0) {
    throw new RangeError('Buffer size must be a multiple of 32-bits')
  }
  for (var i = 0; i < len; i += 4) {
    swap(this, i, i + 3)
    swap(this, i + 1, i + 2)
  }
  return this
}

Buffer.prototype.swap64 = function swap64 () {
  var len = this.length
  if (len % 8 !== 0) {
    throw new RangeError('Buffer size must be a multiple of 64-bits')
  }
  for (var i = 0; i < len; i += 8) {
    swap(this, i, i + 7)
    swap(this, i + 1, i + 6)
    swap(this, i + 2, i + 5)
    swap(this, i + 3, i + 4)
  }
  return this
}

Buffer.prototype.toString = function toString () {
  var length = this.length | 0
  if (length === 0) return ''
  if (arguments.length === 0) return utf8Slice(this, 0, length)
  return slowToString.apply(this, arguments)
}

Buffer.prototype.equals = function equals (b) {
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  if (this === b) return true
  return Buffer.compare(this, b) === 0
}

Buffer.prototype.inspect = function inspect () {
  var str = ''
  var max = exports.INSPECT_MAX_BYTES
  if (this.length > 0) {
    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
    if (this.length > max) str += ' ... '
  }
  return '<Buffer ' + str + '>'
}

Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  if (!Buffer.isBuffer(target)) {
    throw new TypeError('Argument must be a Buffer')
  }

  if (start === undefined) {
    start = 0
  }
  if (end === undefined) {
    end = target ? target.length : 0
  }
  if (thisStart === undefined) {
    thisStart = 0
  }
  if (thisEnd === undefined) {
    thisEnd = this.length
  }

  if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
    throw new RangeError('out of range index')
  }

  if (thisStart >= thisEnd && start >= end) {
    return 0
  }
  if (thisStart >= thisEnd) {
    return -1
  }
  if (start >= end) {
    return 1
  }

  start >>>= 0
  end >>>= 0
  thisStart >>>= 0
  thisEnd >>>= 0

  if (this === target) return 0

  var x = thisEnd - thisStart
  var y = end - start
  var len = Math.min(x, y)

  var thisCopy = this.slice(thisStart, thisEnd)
  var targetCopy = target.slice(start, end)

  for (var i = 0; i < len; ++i) {
    if (thisCopy[i] !== targetCopy[i]) {
      x = thisCopy[i]
      y = targetCopy[i]
      break
    }
  }

  if (x < y) return -1
  if (y < x) return 1
  return 0
}

// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
//
// Arguments:
// - buffer - a Buffer to search
// - val - a string, Buffer, or number
// - byteOffset - an index into `buffer`; will be clamped to an int32
// - encoding - an optional encoding, relevant is val is a string
// - dir - true for indexOf, false for lastIndexOf
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  // Empty buffer means no match
  if (buffer.length === 0) return -1

  // Normalize byteOffset
  if (typeof byteOffset === 'string') {
    encoding = byteOffset
    byteOffset = 0
  } else if (byteOffset > 0x7fffffff) {
    byteOffset = 0x7fffffff
  } else if (byteOffset < -0x80000000) {
    byteOffset = -0x80000000
  }
  byteOffset = +byteOffset  // Coerce to Number.
  if (isNaN(byteOffset)) {
    // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
    byteOffset = dir ? 0 : (buffer.length - 1)
  }

  // Normalize byteOffset: negative offsets start from the end of the buffer
  if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  if (byteOffset >= buffer.length) {
    if (dir) return -1
    else byteOffset = buffer.length - 1
  } else if (byteOffset < 0) {
    if (dir) byteOffset = 0
    else return -1
  }

  // Normalize val
  if (typeof val === 'string') {
    val = Buffer.from(val, encoding)
  }

  // Finally, search either indexOf (if dir is true) or lastIndexOf
  if (Buffer.isBuffer(val)) {
    // Special case: looking for empty string/buffer always fails
    if (val.length === 0) {
      return -1
    }
    return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  } else if (typeof val === 'number') {
    val = val & 0xFF // Search for a byte value [0-255]
    if (Buffer.TYPED_ARRAY_SUPPORT &&
        typeof Uint8Array.prototype.indexOf === 'function') {
      if (dir) {
        return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
      } else {
        return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
      }
    }
    return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  }

  throw new TypeError('val must be string, number or Buffer')
}

function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  var indexSize = 1
  var arrLength = arr.length
  var valLength = val.length

  if (encoding !== undefined) {
    encoding = String(encoding).toLowerCase()
    if (encoding === 'ucs2' || encoding === 'ucs-2' ||
        encoding === 'utf16le' || encoding === 'utf-16le') {
      if (arr.length < 2 || val.length < 2) {
        return -1
      }
      indexSize = 2
      arrLength /= 2
      valLength /= 2
      byteOffset /= 2
    }
  }

  function read (buf, i) {
    if (indexSize === 1) {
      return buf[i]
    } else {
      return buf.readUInt16BE(i * indexSize)
    }
  }

  var i
  if (dir) {
    var foundIndex = -1
    for (i = byteOffset; i < arrLength; i++) {
      if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
        if (foundIndex === -1) foundIndex = i
        if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
      } else {
        if (foundIndex !== -1) i -= i - foundIndex
        foundIndex = -1
      }
    }
  } else {
    if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
    for (i = byteOffset; i >= 0; i--) {
      var found = true
      for (var j = 0; j < valLength; j++) {
        if (read(arr, i + j) !== read(val, j)) {
          found = false
          break
        }
      }
      if (found) return i
    }
  }

  return -1
}

Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  return this.indexOf(val, byteOffset, encoding) !== -1
}

Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
}

Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
}

function hexWrite (buf, string, offset, length) {
  offset = Number(offset) || 0
  var remaining = buf.length - offset
  if (!length) {
    length = remaining
  } else {
    length = Number(length)
    if (length > remaining) {
      length = remaining
    }
  }

  // must be an even number of digits
  var strLen = string.length
  if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')

  if (length > strLen / 2) {
    length = strLen / 2
  }
  for (var i = 0; i < length; ++i) {
    var parsed = parseInt(string.substr(i * 2, 2), 16)
    if (isNaN(parsed)) return i
    buf[offset + i] = parsed
  }
  return i
}

function utf8Write (buf, string, offset, length) {
  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}

function asciiWrite (buf, string, offset, length) {
  return blitBuffer(asciiToBytes(string), buf, offset, length)
}

function latin1Write (buf, string, offset, length) {
  return asciiWrite(buf, string, offset, length)
}

function base64Write (buf, string, offset, length) {
  return blitBuffer(base64ToBytes(string), buf, offset, length)
}

function ucs2Write (buf, string, offset, length) {
  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}

Buffer.prototype.write = function write (string, offset, length, encoding) {
  // Buffer#write(string)
  if (offset === undefined) {
    encoding = 'utf8'
    length = this.length
    offset = 0
  // Buffer#write(string, encoding)
  } else if (length === undefined && typeof offset === 'string') {
    encoding = offset
    length = this.length
    offset = 0
  // Buffer#write(string, offset[, length][, encoding])
  } else if (isFinite(offset)) {
    offset = offset | 0
    if (isFinite(length)) {
      length = length | 0
      if (encoding === undefined) encoding = 'utf8'
    } else {
      encoding = length
      length = undefined
    }
  // legacy write(string, encoding, offset, length) - remove in v0.13
  } else {
    throw new Error(
      'Buffer.write(string, encoding, offset[, length]) is no longer supported'
    )
  }

  var remaining = this.length - offset
  if (length === undefined || length > remaining) length = remaining

  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
    throw new RangeError('Attempt to write outside buffer bounds')
  }

  if (!encoding) encoding = 'utf8'

  var loweredCase = false
  for (;;) {
    switch (encoding) {
      case 'hex':
        return hexWrite(this, string, offset, length)

      case 'utf8':
      case 'utf-8':
        return utf8Write(this, string, offset, length)

      case 'ascii':
        return asciiWrite(this, string, offset, length)

      case 'latin1':
      case 'binary':
        return latin1Write(this, string, offset, length)

      case 'base64':
        // Warning: maxLength not taken into account in base64Write
        return base64Write(this, string, offset, length)

      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return ucs2Write(this, string, offset, length)

      default:
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
        encoding = ('' + encoding).toLowerCase()
        loweredCase = true
    }
  }
}

Buffer.prototype.toJSON = function toJSON () {
  return {
    type: 'Buffer',
    data: Array.prototype.slice.call(this._arr || this, 0)
  }
}

function base64Slice (buf, start, end) {
  if (start === 0 && end === buf.length) {
    return base64.fromByteArray(buf)
  } else {
    return base64.fromByteArray(buf.slice(start, end))
  }
}

function utf8Slice (buf, start, end) {
  end = Math.min(buf.length, end)
  var res = []

  var i = start
  while (i < end) {
    var firstByte = buf[i]
    var codePoint = null
    var bytesPerSequence = (firstByte > 0xEF) ? 4
      : (firstByte > 0xDF) ? 3
      : (firstByte > 0xBF) ? 2
      : 1

    if (i + bytesPerSequence <= end) {
      var secondByte, thirdByte, fourthByte, tempCodePoint

      switch (bytesPerSequence) {
        case 1:
          if (firstByte < 0x80) {
            codePoint = firstByte
          }
          break
        case 2:
          secondByte = buf[i + 1]
          if ((secondByte & 0xC0) === 0x80) {
            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
            if (tempCodePoint > 0x7F) {
              codePoint = tempCodePoint
            }
          }
          break
        case 3:
          secondByte = buf[i + 1]
          thirdByte = buf[i + 2]
          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
              codePoint = tempCodePoint
            }
          }
          break
        case 4:
          secondByte = buf[i + 1]
          thirdByte = buf[i + 2]
          fourthByte = buf[i + 3]
          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
              codePoint = tempCodePoint
            }
          }
      }
    }

    if (codePoint === null) {
      // we did not generate a valid codePoint so insert a
      // replacement char (U+FFFD) and advance only 1 byte
      codePoint = 0xFFFD
      bytesPerSequence = 1
    } else if (codePoint > 0xFFFF) {
      // encode to utf16 (surrogate pair dance)
      codePoint -= 0x10000
      res.push(codePoint >>> 10 & 0x3FF | 0xD800)
      codePoint = 0xDC00 | codePoint & 0x3FF
    }

    res.push(codePoint)
    i += bytesPerSequence
  }

  return decodeCodePointsArray(res)
}

// Based on http://stackoverflow.com/a/22747272/680742, the browser with
// the lowest limit is Chrome, with 0x10000 args.
// We go 1 magnitude less, for safety
var MAX_ARGUMENTS_LENGTH = 0x1000

function decodeCodePointsArray (codePoints) {
  var len = codePoints.length
  if (len <= MAX_ARGUMENTS_LENGTH) {
    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  }

  // Decode in chunks to avoid "call stack size exceeded".
  var res = ''
  var i = 0
  while (i < len) {
    res += String.fromCharCode.apply(
      String,
      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
    )
  }
  return res
}

function asciiSlice (buf, start, end) {
  var ret = ''
  end = Math.min(buf.length, end)

  for (var i = start; i < end; ++i) {
    ret += String.fromCharCode(buf[i] & 0x7F)
  }
  return ret
}

function latin1Slice (buf, start, end) {
  var ret = ''
  end = Math.min(buf.length, end)

  for (var i = start; i < end; ++i) {
    ret += String.fromCharCode(buf[i])
  }
  return ret
}

function hexSlice (buf, start, end) {
  var len = buf.length

  if (!start || start < 0) start = 0
  if (!end || end < 0 || end > len) end = len

  var out = ''
  for (var i = start; i < end; ++i) {
    out += toHex(buf[i])
  }
  return out
}

function utf16leSlice (buf, start, end) {
  var bytes = buf.slice(start, end)
  var res = ''
  for (var i = 0; i < bytes.length; i += 2) {
    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  }
  return res
}

Buffer.prototype.slice = function slice (start, end) {
  var len = this.length
  start = ~~start
  end = end === undefined ? len : ~~end

  if (start < 0) {
    start += len
    if (start < 0) start = 0
  } else if (start > len) {
    start = len
  }

  if (end < 0) {
    end += len
    if (end < 0) end = 0
  } else if (end > len) {
    end = len
  }

  if (end < start) end = start

  var newBuf
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    newBuf = this.subarray(start, end)
    newBuf.__proto__ = Buffer.prototype
  } else {
    var sliceLen = end - start
    newBuf = new Buffer(sliceLen, undefined)
    for (var i = 0; i < sliceLen; ++i) {
      newBuf[i] = this[i + start]
    }
  }

  return newBuf
}

/*
 * Need to make sure that buffer isn't trying to write out of bounds.
 */
function checkOffset (offset, ext, length) {
  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}

Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) checkOffset(offset, byteLength, this.length)

  var val = this[offset]
  var mul = 1
  var i = 0
  while (++i < byteLength && (mul *= 0x100)) {
    val += this[offset + i] * mul
  }

  return val
}

Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) {
    checkOffset(offset, byteLength, this.length)
  }

  var val = this[offset + --byteLength]
  var mul = 1
  while (byteLength > 0 && (mul *= 0x100)) {
    val += this[offset + --byteLength] * mul
  }

  return val
}

Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 1, this.length)
  return this[offset]
}

Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length)
  return this[offset] | (this[offset + 1] << 8)
}

Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length)
  return (this[offset] << 8) | this[offset + 1]
}

Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)

  return ((this[offset]) |
      (this[offset + 1] << 8) |
      (this[offset + 2] << 16)) +
      (this[offset + 3] * 0x1000000)
}

Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)

  return (this[offset] * 0x1000000) +
    ((this[offset + 1] << 16) |
    (this[offset + 2] << 8) |
    this[offset + 3])
}

Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) checkOffset(offset, byteLength, this.length)

  var val = this[offset]
  var mul = 1
  var i = 0
  while (++i < byteLength && (mul *= 0x100)) {
    val += this[offset + i] * mul
  }
  mul *= 0x80

  if (val >= mul) val -= Math.pow(2, 8 * byteLength)

  return val
}

Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) checkOffset(offset, byteLength, this.length)

  var i = byteLength
  var mul = 1
  var val = this[offset + --i]
  while (i > 0 && (mul *= 0x100)) {
    val += this[offset + --i] * mul
  }
  mul *= 0x80

  if (val >= mul) val -= Math.pow(2, 8 * byteLength)

  return val
}

Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 1, this.length)
  if (!(this[offset] & 0x80)) return (this[offset])
  return ((0xff - this[offset] + 1) * -1)
}

Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length)
  var val = this[offset] | (this[offset + 1] << 8)
  return (val & 0x8000) ? val | 0xFFFF0000 : val
}

Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length)
  var val = this[offset + 1] | (this[offset] << 8)
  return (val & 0x8000) ? val | 0xFFFF0000 : val
}

Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)

  return (this[offset]) |
    (this[offset + 1] << 8) |
    (this[offset + 2] << 16) |
    (this[offset + 3] << 24)
}

Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)

  return (this[offset] << 24) |
    (this[offset + 1] << 16) |
    (this[offset + 2] << 8) |
    (this[offset + 3])
}

Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)
  return ieee754.read(this, offset, true, 23, 4)
}

Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)
  return ieee754.read(this, offset, false, 23, 4)
}

Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 8, this.length)
  return ieee754.read(this, offset, true, 52, 8)
}

Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 8, this.length)
  return ieee754.read(this, offset, false, 52, 8)
}

function checkInt (buf, value, offset, ext, max, min) {
  if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
}

Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  value = +value
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) {
    var maxBytes = Math.pow(2, 8 * byteLength) - 1
    checkInt(this, value, offset, byteLength, maxBytes, 0)
  }

  var mul = 1
  var i = 0
  this[offset] = value & 0xFF
  while (++i < byteLength && (mul *= 0x100)) {
    this[offset + i] = (value / mul) & 0xFF
  }

  return offset + byteLength
}

Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  value = +value
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) {
    var maxBytes = Math.pow(2, 8 * byteLength) - 1
    checkInt(this, value, offset, byteLength, maxBytes, 0)
  }

  var i = byteLength - 1
  var mul = 1
  this[offset + i] = value & 0xFF
  while (--i >= 0 && (mul *= 0x100)) {
    this[offset + i] = (value / mul) & 0xFF
  }

  return offset + byteLength
}

Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  this[offset] = (value & 0xff)
  return offset + 1
}

function objectWriteUInt16 (buf, value, offset, littleEndian) {
  if (value < 0) value = 0xffff + value + 1
  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
      (littleEndian ? i : 1 - i) * 8
  }
}

Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value & 0xff)
    this[offset + 1] = (value >>> 8)
  } else {
    objectWriteUInt16(this, value, offset, true)
  }
  return offset + 2
}

Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value >>> 8)
    this[offset + 1] = (value & 0xff)
  } else {
    objectWriteUInt16(this, value, offset, false)
  }
  return offset + 2
}

function objectWriteUInt32 (buf, value, offset, littleEndian) {
  if (value < 0) value = 0xffffffff + value + 1
  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  }
}

Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset + 3] = (value >>> 24)
    this[offset + 2] = (value >>> 16)
    this[offset + 1] = (value >>> 8)
    this[offset] = (value & 0xff)
  } else {
    objectWriteUInt32(this, value, offset, true)
  }
  return offset + 4
}

Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value >>> 24)
    this[offset + 1] = (value >>> 16)
    this[offset + 2] = (value >>> 8)
    this[offset + 3] = (value & 0xff)
  } else {
    objectWriteUInt32(this, value, offset, false)
  }
  return offset + 4
}

Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) {
    var limit = Math.pow(2, 8 * byteLength - 1)

    checkInt(this, value, offset, byteLength, limit - 1, -limit)
  }

  var i = 0
  var mul = 1
  var sub = 0
  this[offset] = value & 0xFF
  while (++i < byteLength && (mul *= 0x100)) {
    if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
      sub = 1
    }
    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  }

  return offset + byteLength
}

Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) {
    var limit = Math.pow(2, 8 * byteLength - 1)

    checkInt(this, value, offset, byteLength, limit - 1, -limit)
  }

  var i = byteLength - 1
  var mul = 1
  var sub = 0
  this[offset + i] = value & 0xFF
  while (--i >= 0 && (mul *= 0x100)) {
    if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
      sub = 1
    }
    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  }

  return offset + byteLength
}

Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  if (value < 0) value = 0xff + value + 1
  this[offset] = (value & 0xff)
  return offset + 1
}

Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value & 0xff)
    this[offset + 1] = (value >>> 8)
  } else {
    objectWriteUInt16(this, value, offset, true)
  }
  return offset + 2
}

Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value >>> 8)
    this[offset + 1] = (value & 0xff)
  } else {
    objectWriteUInt16(this, value, offset, false)
  }
  return offset + 2
}

Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value & 0xff)
    this[offset + 1] = (value >>> 8)
    this[offset + 2] = (value >>> 16)
    this[offset + 3] = (value >>> 24)
  } else {
    objectWriteUInt32(this, value, offset, true)
  }
  return offset + 4
}

Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  if (value < 0) value = 0xffffffff + value + 1
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value >>> 24)
    this[offset + 1] = (value >>> 16)
    this[offset + 2] = (value >>> 8)
    this[offset + 3] = (value & 0xff)
  } else {
    objectWriteUInt32(this, value, offset, false)
  }
  return offset + 4
}

function checkIEEE754 (buf, value, offset, ext, max, min) {
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
  if (offset < 0) throw new RangeError('Index out of range')
}

function writeFloat (buf, value, offset, littleEndian, noAssert) {
  if (!noAssert) {
    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  }
  ieee754.write(buf, value, offset, littleEndian, 23, 4)
  return offset + 4
}

Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  return writeFloat(this, value, offset, true, noAssert)
}

Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  return writeFloat(this, value, offset, false, noAssert)
}

function writeDouble (buf, value, offset, littleEndian, noAssert) {
  if (!noAssert) {
    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  }
  ieee754.write(buf, value, offset, littleEndian, 52, 8)
  return offset + 8
}

Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  return writeDouble(this, value, offset, true, noAssert)
}

Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  return writeDouble(this, value, offset, false, noAssert)
}

// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  if (!start) start = 0
  if (!end && end !== 0) end = this.length
  if (targetStart >= target.length) targetStart = target.length
  if (!targetStart) targetStart = 0
  if (end > 0 && end < start) end = start

  // Copy 0 bytes; we're done
  if (end === start) return 0
  if (target.length === 0 || this.length === 0) return 0

  // Fatal error conditions
  if (targetStart < 0) {
    throw new RangeError('targetStart out of bounds')
  }
  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  if (end < 0) throw new RangeError('sourceEnd out of bounds')

  // Are we oob?
  if (end > this.length) end = this.length
  if (target.length - targetStart < end - start) {
    end = target.length - targetStart + start
  }

  var len = end - start
  var i

  if (this === target && start < targetStart && targetStart < end) {
    // descending copy from end
    for (i = len - 1; i >= 0; --i) {
      target[i + targetStart] = this[i + start]
    }
  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
    // ascending copy from start
    for (i = 0; i < len; ++i) {
      target[i + targetStart] = this[i + start]
    }
  } else {
    Uint8Array.prototype.set.call(
      target,
      this.subarray(start, start + len),
      targetStart
    )
  }

  return len
}

// Usage:
//    buffer.fill(number[, offset[, end]])
//    buffer.fill(buffer[, offset[, end]])
//    buffer.fill(string[, offset[, end]][, encoding])
Buffer.prototype.fill = function fill (val, start, end, encoding) {
  // Handle string cases:
  if (typeof val === 'string') {
    if (typeof start === 'string') {
      encoding = start
      start = 0
      end = this.length
    } else if (typeof end === 'string') {
      encoding = end
      end = this.length
    }
    if (val.length === 1) {
      var code = val.charCodeAt(0)
      if (code < 256) {
        val = code
      }
    }
    if (encoding !== undefined && typeof encoding !== 'string') {
      throw new TypeError('encoding must be a string')
    }
    if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
      throw new TypeError('Unknown encoding: ' + encoding)
    }
  } else if (typeof val === 'number') {
    val = val & 255
  }

  // Invalid ranges are not set to a default, so can range check early.
  if (start < 0 || this.length < start || this.length < end) {
    throw new RangeError('Out of range index')
  }

  if (end <= start) {
    return this
  }

  start = start >>> 0
  end = end === undefined ? this.length : end >>> 0

  if (!val) val = 0

  var i
  if (typeof val === 'number') {
    for (i = start; i < end; ++i) {
      this[i] = val
    }
  } else {
    var bytes = Buffer.isBuffer(val)
      ? val
      : utf8ToBytes(new Buffer(val, encoding).toString())
    var len = bytes.length
    for (i = 0; i < end - start; ++i) {
      this[i + start] = bytes[i % len]
    }
  }

  return this
}

// HELPER FUNCTIONS
// ================

var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g

function base64clean (str) {
  // Node strips out invalid characters like \n and \t from the string, base64-js does not
  str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  // Node converts strings with length < 2 to ''
  if (str.length < 2) return ''
  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  while (str.length % 4 !== 0) {
    str = str + '='
  }
  return str
}

function stringtrim (str) {
  if (str.trim) return str.trim()
  return str.replace(/^\s+|\s+$/g, '')
}

function toHex (n) {
  if (n < 16) return '0' + n.toString(16)
  return n.toString(16)
}

function utf8ToBytes (string, units) {
  units = units || Infinity
  var codePoint
  var length = string.length
  var leadSurrogate = null
  var bytes = []

  for (var i = 0; i < length; ++i) {
    codePoint = string.charCodeAt(i)

    // is surrogate component
    if (codePoint > 0xD7FF && codePoint < 0xE000) {
      // last char was a lead
      if (!leadSurrogate) {
        // no lead yet
        if (codePoint > 0xDBFF) {
          // unexpected trail
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
          continue
        } else if (i + 1 === length) {
          // unpaired lead
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
          continue
        }

        // valid lead
        leadSurrogate = codePoint

        continue
      }

      // 2 leads in a row
      if (codePoint < 0xDC00) {
        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
        leadSurrogate = codePoint
        continue
      }

      // valid surrogate pair
      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
    } else if (leadSurrogate) {
      // valid bmp char, but last char was a lead
      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
    }

    leadSurrogate = null

    // encode utf8
    if (codePoint < 0x80) {
      if ((units -= 1) < 0) break
      bytes.push(codePoint)
    } else if (codePoint < 0x800) {
      if ((units -= 2) < 0) break
      bytes.push(
        codePoint >> 0x6 | 0xC0,
        codePoint & 0x3F | 0x80
      )
    } else if (codePoint < 0x10000) {
      if ((units -= 3) < 0) break
      bytes.push(
        codePoint >> 0xC | 0xE0,
        codePoint >> 0x6 & 0x3F | 0x80,
        codePoint & 0x3F | 0x80
      )
    } else if (codePoint < 0x110000) {
      if ((units -= 4) < 0) break
      bytes.push(
        codePoint >> 0x12 | 0xF0,
        codePoint >> 0xC & 0x3F | 0x80,
        codePoint >> 0x6 & 0x3F | 0x80,
        codePoint & 0x3F | 0x80
      )
    } else {
      throw new Error('Invalid code point')
    }
  }

  return bytes
}

function asciiToBytes (str) {
  var byteArray = []
  for (var i = 0; i < str.length; ++i) {
    // Node's code seems to be doing this and not & 0x7F..
    byteArray.push(str.charCodeAt(i) & 0xFF)
  }
  return byteArray
}

function utf16leToBytes (str, units) {
  var c, hi, lo
  var byteArray = []
  for (var i = 0; i < str.length; ++i) {
    if ((units -= 2) < 0) break

    c = str.charCodeAt(i)
    hi = c >> 8
    lo = c % 256
    byteArray.push(lo)
    byteArray.push(hi)
  }

  return byteArray
}

function base64ToBytes (str) {
  return base64.toByteArray(base64clean(str))
}

function blitBuffer (src, dst, offset, length) {
  for (var i = 0; i < length; ++i) {
    if ((i + offset >= dst.length) || (i >= src.length)) break
    dst[i + offset] = src[i]
  }
  return i
}

function isnan (val) {
  return val !== val // eslint-disable-line no-self-compare
}

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))

/***/ }),

/***/ "b64b":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var toObject = __webpack_require__("7b0b");
var nativeKeys = __webpack_require__("df75");
var fails = __webpack_require__("d039");

var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });

// `Object.keys` method
// https://tc39.es/ecma262/#sec-object.keys
$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  keys: function keys(it) {
    return nativeKeys(toObject(it));
  }
});


/***/ }),

/***/ "b680":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var toIntegerOrInfinity = __webpack_require__("5926");
var thisNumberValue = __webpack_require__("408a");
var repeat = __webpack_require__("1148");
var fails = __webpack_require__("d039");

var nativeToFixed = 1.0.toFixed;
var floor = Math.floor;

var pow = function (x, n, acc) {
  return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
};

var log = function (x) {
  var n = 0;
  var x2 = x;
  while (x2 >= 4096) {
    n += 12;
    x2 /= 4096;
  }
  while (x2 >= 2) {
    n += 1;
    x2 /= 2;
  } return n;
};

var multiply = function (data, n, c) {
  var index = -1;
  var c2 = c;
  while (++index < 6) {
    c2 += n * data[index];
    data[index] = c2 % 1e7;
    c2 = floor(c2 / 1e7);
  }
};

var divide = function (data, n) {
  var index = 6;
  var c = 0;
  while (--index >= 0) {
    c += data[index];
    data[index] = floor(c / n);
    c = (c % n) * 1e7;
  }
};

var dataToString = function (data) {
  var index = 6;
  var s = '';
  while (--index >= 0) {
    if (s !== '' || index === 0 || data[index] !== 0) {
      var t = String(data[index]);
      s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t;
    }
  } return s;
};

var FORCED = nativeToFixed && (
  0.00008.toFixed(3) !== '0.000' ||
  0.9.toFixed(0) !== '1' ||
  1.255.toFixed(2) !== '1.25' ||
  1000000000000000128.0.toFixed(0) !== '1000000000000000128'
) || !fails(function () {
  // V8 ~ Android 4.3-
  nativeToFixed.call({});
});

// `Number.prototype.toFixed` method
// https://tc39.es/ecma262/#sec-number.prototype.tofixed
$({ target: 'Number', proto: true, forced: FORCED }, {
  toFixed: function toFixed(fractionDigits) {
    var number = thisNumberValue(this);
    var fractDigits = toIntegerOrInfinity(fractionDigits);
    var data = [0, 0, 0, 0, 0, 0];
    var sign = '';
    var result = '0';
    var e, z, j, k;

    if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits');
    // eslint-disable-next-line no-self-compare -- NaN check
    if (number != number) return 'NaN';
    if (number <= -1e21 || number >= 1e21) return String(number);
    if (number < 0) {
      sign = '-';
      number = -number;
    }
    if (number > 1e-21) {
      e = log(number * pow(2, 69, 1)) - 69;
      z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);
      z *= 0x10000000000000;
      e = 52 - e;
      if (e > 0) {
        multiply(data, 0, z);
        j = fractDigits;
        while (j >= 7) {
          multiply(data, 1e7, 0);
          j -= 7;
        }
        multiply(data, pow(10, j, 1), 0);
        j = e - 1;
        while (j >= 23) {
          divide(data, 1 << 23);
          j -= 23;
        }
        divide(data, 1 << j);
        multiply(data, 1, 1);
        divide(data, 2);
        result = dataToString(data);
      } else {
        multiply(data, 0, z);
        multiply(data, 1 << -e, 0);
        result = dataToString(data) + repeat.call('0', fractDigits);
      }
    }
    if (fractDigits > 0) {
      k = result.length;
      result = sign + (k <= fractDigits
        ? '0.' + repeat.call('0', fractDigits - k) + result
        : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits));
    } else {
      result = sign + result;
    } return result;
  }
});


/***/ }),

/***/ "b727":
/***/ (function(module, exports, __webpack_require__) {

var bind = __webpack_require__("0366");
var IndexedObject = __webpack_require__("44ad");
var toObject = __webpack_require__("7b0b");
var lengthOfArrayLike = __webpack_require__("07fa");
var arraySpeciesCreate = __webpack_require__("65f0");

var push = [].push;

// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
var createMethod = function (TYPE) {
  var IS_MAP = TYPE == 1;
  var IS_FILTER = TYPE == 2;
  var IS_SOME = TYPE == 3;
  var IS_EVERY = TYPE == 4;
  var IS_FIND_INDEX = TYPE == 6;
  var IS_FILTER_REJECT = TYPE == 7;
  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  return function ($this, callbackfn, that, specificCreate) {
    var O = toObject($this);
    var self = IndexedObject(O);
    var boundFunction = bind(callbackfn, that, 3);
    var length = lengthOfArrayLike(self);
    var index = 0;
    var create = specificCreate || arraySpeciesCreate;
    var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
    var value, result;
    for (;length > index; index++) if (NO_HOLES || index in self) {
      value = self[index];
      result = boundFunction(value, index, O);
      if (TYPE) {
        if (IS_MAP) target[index] = result; // map
        else if (result) switch (TYPE) {
          case 3: return true;              // some
          case 5: return value;             // find
          case 6: return index;             // findIndex
          case 2: push.call(target, value); // filter
        } else switch (TYPE) {
          case 4: return false;             // every
          case 7: push.call(target, value); // filterReject
        }
      }
    }
    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  };
};

module.exports = {
  // `Array.prototype.forEach` method
  // https://tc39.es/ecma262/#sec-array.prototype.foreach
  forEach: createMethod(0),
  // `Array.prototype.map` method
  // https://tc39.es/ecma262/#sec-array.prototype.map
  map: createMethod(1),
  // `Array.prototype.filter` method
  // https://tc39.es/ecma262/#sec-array.prototype.filter
  filter: createMethod(2),
  // `Array.prototype.some` method
  // https://tc39.es/ecma262/#sec-array.prototype.some
  some: createMethod(3),
  // `Array.prototype.every` method
  // https://tc39.es/ecma262/#sec-array.prototype.every
  every: createMethod(4),
  // `Array.prototype.find` method
  // https://tc39.es/ecma262/#sec-array.prototype.find
  find: createMethod(5),
  // `Array.prototype.findIndex` method
  // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  findIndex: createMethod(6),
  // `Array.prototype.filterReject` method
  // https://github.com/tc39/proposal-array-filtering
  filterReject: createMethod(7)
};


/***/ }),

/***/ "b8bf":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var DESCRIPTORS = __webpack_require__("83ab");
var create = __webpack_require__("7c73");

// `Object.create` method
// https://tc39.es/ecma262/#sec-object.create
$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
  create: create
});


/***/ }),

/***/ "baa5":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var lastIndexOf = __webpack_require__("e58c");

// `Array.prototype.lastIndexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.lastindexof
// eslint-disable-next-line es/no-array-prototype-lastindexof -- required for testing
$({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, {
  lastIndexOf: lastIndexOf
});


/***/ }),

/***/ "bb2f":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");

module.exports = !fails(function () {
  // eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing
  return Object.isExtensible(Object.preventExtensions({}));
});


/***/ }),

/***/ "bf00":
/***/ (function(module, exports, __webpack_require__) {

const ANY = Symbol('SemVer ANY')
// hoisted class for cyclic dependency
class Comparator {
  static get ANY () {
    return ANY
  }
  constructor (comp, options) {
    options = parseOptions(options)

    if (comp instanceof Comparator) {
      if (comp.loose === !!options.loose) {
        return comp
      } else {
        comp = comp.value
      }
    }

    debug('comparator', comp, options)
    this.options = options
    this.loose = !!options.loose
    this.parse(comp)

    if (this.semver === ANY) {
      this.value = ''
    } else {
      this.value = this.operator + this.semver.version
    }

    debug('comp', this)
  }

  parse (comp) {
    const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
    const m = comp.match(r)

    if (!m) {
      throw new TypeError(`Invalid comparator: ${comp}`)
    }

    this.operator = m[1] !== undefined ? m[1] : ''
    if (this.operator === '=') {
      this.operator = ''
    }

    // if it literally is just '>' or '' then allow anything.
    if (!m[2]) {
      this.semver = ANY
    } else {
      this.semver = new SemVer(m[2], this.options.loose)
    }
  }

  toString () {
    return this.value
  }

  test (version) {
    debug('Comparator.test', version, this.options.loose)

    if (this.semver === ANY || version === ANY) {
      return true
    }

    if (typeof version === 'string') {
      try {
        version = new SemVer(version, this.options)
      } catch (er) {
        return false
      }
    }

    return cmp(version, this.operator, this.semver, this.options)
  }

  intersects (comp, options) {
    if (!(comp instanceof Comparator)) {
      throw new TypeError('a Comparator is required')
    }

    if (!options || typeof options !== 'object') {
      options = {
        loose: !!options,
        includePrerelease: false
      }
    }

    if (this.operator === '') {
      if (this.value === '') {
        return true
      }
      return new Range(comp.value, options).test(this.value)
    } else if (comp.operator === '') {
      if (comp.value === '') {
        return true
      }
      return new Range(this.value, options).test(comp.semver)
    }

    const sameDirectionIncreasing =
      (this.operator === '>=' || this.operator === '>') &&
      (comp.operator === '>=' || comp.operator === '>')
    const sameDirectionDecreasing =
      (this.operator === '<=' || this.operator === '<') &&
      (comp.operator === '<=' || comp.operator === '<')
    const sameSemVer = this.semver.version === comp.semver.version
    const differentDirectionsInclusive =
      (this.operator === '>=' || this.operator === '<=') &&
      (comp.operator === '>=' || comp.operator === '<=')
    const oppositeDirectionsLessThan =
      cmp(this.semver, '<', comp.semver, options) &&
      (this.operator === '>=' || this.operator === '>') &&
        (comp.operator === '<=' || comp.operator === '<')
    const oppositeDirectionsGreaterThan =
      cmp(this.semver, '>', comp.semver, options) &&
      (this.operator === '<=' || this.operator === '<') &&
        (comp.operator === '>=' || comp.operator === '>')

    return (
      sameDirectionIncreasing ||
      sameDirectionDecreasing ||
      (sameSemVer && differentDirectionsInclusive) ||
      oppositeDirectionsLessThan ||
      oppositeDirectionsGreaterThan
    )
  }
}

module.exports = Comparator

const parseOptions = __webpack_require__("e12f")
const {re, t} = __webpack_require__("22c0")
const cmp = __webpack_require__("54c2")
const debug = __webpack_require__("0d7c")
const SemVer = __webpack_require__("df02")
const Range = __webpack_require__("7b1f")


/***/ }),

/***/ "bfa6":
/***/ (function(module, exports, __webpack_require__) {

// given a set of versions and a range, create a "simplified" range
// that includes the same versions that the original range does
// If the original range is shorter than the simplified one, return that.
const satisfies = __webpack_require__("329c")
const compare = __webpack_require__("f06c")
module.exports = (versions, range, options) => {
  const set = []
  let min = null
  let prev = null
  const v = versions.sort((a, b) => compare(a, b, options))
  for (const version of v) {
    const included = satisfies(version, range, options)
    if (included) {
      prev = version
      if (!min)
        min = version
    } else {
      if (prev) {
        set.push([min, prev])
      }
      prev = null
      min = null
    }
  }
  if (min)
    set.push([min, null])

  const ranges = []
  for (const [min, max] of set) {
    if (min === max)
      ranges.push(min)
    else if (!max && min === v[0])
      ranges.push('*')
    else if (!max)
      ranges.push(`>=${min}`)
    else if (min === v[0])
      ranges.push(`<=${max}`)
    else
      ranges.push(`${min} - ${max}`)
  }
  const simplified = ranges.join(' || ')
  const original = typeof range.raw === 'string' ? range.raw : String(range)
  return simplified.length < original.length ? simplified : range
}


/***/ }),

/***/ "c04e":
/***/ (function(module, exports, __webpack_require__) {

var isObject = __webpack_require__("861d");
var isSymbol = __webpack_require__("d9b5");
var getMethod = __webpack_require__("dc4a");
var ordinaryToPrimitive = __webpack_require__("485a");
var wellKnownSymbol = __webpack_require__("b622");

var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');

// `ToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-toprimitive
module.exports = function (input, pref) {
  if (!isObject(input) || isSymbol(input)) return input;
  var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  var result;
  if (exoticToPrim) {
    if (pref === undefined) pref = 'default';
    result = exoticToPrim.call(input, pref);
    if (!isObject(result) || isSymbol(result)) return result;
    throw TypeError("Can't convert object to primitive value");
  }
  if (pref === undefined) pref = 'number';
  return ordinaryToPrimitive(input, pref);
};


/***/ }),

/***/ "c092":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return defaultLocale; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return locale; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return numberFormatDefaultLocale; });
/* unused harmony export numberFormatLocale */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return resetDefaultLocale; });
/* unused harmony export resetNumberFormatDefaultLocale */
/* unused harmony export resetTimeFormatDefaultLocale */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return timeFormatDefaultLocale; });
/* unused harmony export timeFormatLocale */
/* harmony import */ var d3_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("eecb");
/* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("09b8");
/* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("d933");
/* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("d989");
/* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("dad1");
/* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("1231");
/* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("b170");
/* harmony import */ var vega_time__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("de28");
/* harmony import */ var vega_util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("fc17");
/* harmony import */ var d3_time_format__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("4c23");
/* harmony import */ var d3_time_format__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("a591");






function memoize (method) {
  const cache = {};
  return spec => cache[spec] || (cache[spec] = method(spec));
}

function trimZeroes(numberFormat, decimalChar) {
  return x => {
    const str = numberFormat(x),
          dec = str.indexOf(decimalChar);
    if (dec < 0) return str;
    let idx = rightmostDigit(str, dec);
    const end = idx < str.length ? str.slice(idx) : '';

    while (--idx > dec) if (str[idx] !== '0') {
      ++idx;
      break;
    }

    return str.slice(0, idx) + end;
  };
}

function rightmostDigit(str, dec) {
  let i = str.lastIndexOf('e'),
      c;
  if (i > 0) return i;

  for (i = str.length; --i > dec;) {
    c = str.charCodeAt(i);
    if (c >= 48 && c <= 57) return i + 1; // is digit
  }
}

function numberLocale(locale) {
  const format = memoize(locale.format),
        formatPrefix = locale.formatPrefix;
  return {
    format,
    formatPrefix,

    formatFloat(spec) {
      const s = Object(d3_format__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(spec || ',');

      if (s.precision == null) {
        s.precision = 12;

        switch (s.type) {
          case '%':
            s.precision -= 2;
            break;

          case 'e':
            s.precision -= 1;
            break;
        }

        return trimZeroes(format(s), // number format
        format('.1f')(1)[1] // decimal point character
        );
      } else {
        return format(s);
      }
    },

    formatSpan(start, stop, count, specifier) {
      specifier = Object(d3_format__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(specifier == null ? ',f' : specifier);
      const step = Object(d3_array__WEBPACK_IMPORTED_MODULE_0__[/* tickStep */ "c"])(start, stop, count),
            value = Math.max(Math.abs(start), Math.abs(stop));
      let precision;

      if (specifier.precision == null) {
        switch (specifier.type) {
          case 's':
            {
              if (!isNaN(precision = Object(d3_format__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(step, value))) {
                specifier.precision = precision;
              }

              return formatPrefix(specifier, value);
            }

          case '':
          case 'e':
          case 'g':
          case 'p':
          case 'r':
            {
              if (!isNaN(precision = Object(d3_format__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(step, value))) {
                specifier.precision = precision - (specifier.type === 'e');
              }

              break;
            }

          case 'f':
          case '%':
            {
              if (!isNaN(precision = Object(d3_format__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(step))) {
                specifier.precision = precision - (specifier.type === '%') * 2;
              }

              break;
            }
        }
      }

      return format(specifier);
    }

  };
}

let defaultNumberLocale;
resetNumberFormatDefaultLocale();
function resetNumberFormatDefaultLocale() {
  return defaultNumberLocale = numberLocale({
    format: d3_format__WEBPACK_IMPORTED_MODULE_5__[/* format */ "a"],
    formatPrefix: d3_format__WEBPACK_IMPORTED_MODULE_5__[/* formatPrefix */ "b"]
  });
}
function numberFormatLocale(definition) {
  return numberLocale(Object(d3_format__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(definition));
}
function numberFormatDefaultLocale(definition) {
  return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale;
}

function timeMultiFormat(format, interval, spec) {
  spec = spec || {};

  if (!Object(vega_util__WEBPACK_IMPORTED_MODULE_8__[/* isObject */ "H"])(spec)) {
    Object(vega_util__WEBPACK_IMPORTED_MODULE_8__[/* error */ "o"])("Invalid time multi-format specifier: ".concat(spec));
  }

  const second = interval(vega_time__WEBPACK_IMPORTED_MODULE_7__[/* SECONDS */ "i"]),
        minute = interval(vega_time__WEBPACK_IMPORTED_MODULE_7__[/* MINUTES */ "f"]),
        hour = interval(vega_time__WEBPACK_IMPORTED_MODULE_7__[/* HOURS */ "d"]),
        day = interval(vega_time__WEBPACK_IMPORTED_MODULE_7__[/* DATE */ "a"]),
        week = interval(vega_time__WEBPACK_IMPORTED_MODULE_7__[/* WEEK */ "k"]),
        month = interval(vega_time__WEBPACK_IMPORTED_MODULE_7__[/* MONTH */ "g"]),
        quarter = interval(vega_time__WEBPACK_IMPORTED_MODULE_7__[/* QUARTER */ "h"]),
        year = interval(vega_time__WEBPACK_IMPORTED_MODULE_7__[/* YEAR */ "l"]),
        L = format(spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* MILLISECONDS */ "e"]] || '.%L'),
        S = format(spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* SECONDS */ "i"]] || ':%S'),
        M = format(spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* MINUTES */ "f"]] || '%I:%M'),
        H = format(spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* HOURS */ "d"]] || '%I %p'),
        d = format(spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* DATE */ "a"]] || spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* DAY */ "b"]] || '%a %d'),
        w = format(spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* WEEK */ "k"]] || '%b %d'),
        m = format(spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* MONTH */ "g"]] || '%B'),
        q = format(spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* QUARTER */ "h"]] || '%B'),
        y = format(spec[vega_time__WEBPACK_IMPORTED_MODULE_7__[/* YEAR */ "l"]] || '%Y');
  return date => (second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date);
}

function timeLocale(locale) {
  const timeFormat = memoize(locale.format),
        utcFormat = memoize(locale.utcFormat);
  return {
    timeFormat: spec => Object(vega_util__WEBPACK_IMPORTED_MODULE_8__[/* isString */ "J"])(spec) ? timeFormat(spec) : timeMultiFormat(timeFormat, vega_time__WEBPACK_IMPORTED_MODULE_7__[/* timeInterval */ "p"], spec),
    utcFormat: spec => Object(vega_util__WEBPACK_IMPORTED_MODULE_8__[/* isString */ "J"])(spec) ? utcFormat(spec) : timeMultiFormat(utcFormat, vega_time__WEBPACK_IMPORTED_MODULE_7__[/* utcInterval */ "v"], spec),
    timeParse: memoize(locale.parse),
    utcParse: memoize(locale.utcParse)
  };
}

let defaultTimeLocale;
resetTimeFormatDefaultLocale();
function resetTimeFormatDefaultLocale() {
  return defaultTimeLocale = timeLocale({
    format: d3_time_format__WEBPACK_IMPORTED_MODULE_9__[/* timeFormat */ "a"],
    parse: d3_time_format__WEBPACK_IMPORTED_MODULE_9__[/* timeParse */ "b"],
    utcFormat: d3_time_format__WEBPACK_IMPORTED_MODULE_9__[/* utcFormat */ "c"],
    utcParse: d3_time_format__WEBPACK_IMPORTED_MODULE_9__[/* utcParse */ "d"]
  });
}
function timeFormatLocale(definition) {
  return timeLocale(Object(d3_time_format__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"])(definition));
}
function timeFormatDefaultLocale(definition) {
  return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale;
}

const createLocale = (number, time) => Object(vega_util__WEBPACK_IMPORTED_MODULE_8__[/* extend */ "p"])({}, number, time);

function locale(numberSpec, timeSpec) {
  const number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale();
  const time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale();
  return createLocale(number, time);
}
function defaultLocale(numberSpec, timeSpec) {
  const args = arguments.length;

  if (args && args !== 2) {
    Object(vega_util__WEBPACK_IMPORTED_MODULE_8__[/* error */ "o"])('defaultLocale expects either zero or two arguments.');
  }

  return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale());
}
function resetDefaultLocale() {
  resetNumberFormatDefaultLocale();
  resetTimeFormatDefaultLocale();
  return defaultLocale();
}




/***/ }),

/***/ "c0b6":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var bind = __webpack_require__("0538");

// `Function.prototype.bind` method
// https://tc39.es/ecma262/#sec-function.prototype.bind
$({ target: 'Function', proto: true }, {
  bind: bind
});


/***/ }),

/***/ "c19f":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var global = __webpack_require__("da84");
var arrayBufferModule = __webpack_require__("621a");
var setSpecies = __webpack_require__("2626");

var ARRAY_BUFFER = 'ArrayBuffer';
var ArrayBuffer = arrayBufferModule[ARRAY_BUFFER];
var NativeArrayBuffer = global[ARRAY_BUFFER];

// `ArrayBuffer` constructor
// https://tc39.es/ecma262/#sec-arraybuffer-constructor
$({ global: true, forced: NativeArrayBuffer !== ArrayBuffer }, {
  ArrayBuffer: ArrayBuffer
});

setSpecies(ARRAY_BUFFER);


/***/ }),

/***/ "c20d":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var fails = __webpack_require__("d039");
var toString = __webpack_require__("577e");
var trim = __webpack_require__("58a8").trim;
var whitespaces = __webpack_require__("5899");

var $parseInt = global.parseInt;
var Symbol = global.Symbol;
var ITERATOR = Symbol && Symbol.iterator;
var hex = /^[+-]?0x/i;
var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
  // MS Edge 18- broken with boxed symbols
  || (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); }));

// `parseInt` method
// https://tc39.es/ecma262/#sec-parseint-string-radix
module.exports = FORCED ? function parseInt(string, radix) {
  var S = trim(toString(string));
  return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
} : $parseInt;


/***/ }),

/***/ "c430":
/***/ (function(module, exports) {

module.exports = false;


/***/ }),

/***/ "c5fb":
/***/ (function(module, exports, __webpack_require__) {

const compare = __webpack_require__("f06c")
const eq = (a, b, loose) => compare(a, b, loose) === 0
module.exports = eq


/***/ }),

/***/ "c60d":
/***/ (function(module, exports, __webpack_require__) {

var hasOwn = __webpack_require__("1a2d");

module.exports = function (descriptor) {
  return descriptor !== undefined && (hasOwn(descriptor, 'value') || hasOwn(descriptor, 'writable'));
};


/***/ }),

/***/ "c6b6":
/***/ (function(module, exports) {

var toString = {}.toString;

module.exports = function (it) {
  return toString.call(it).slice(8, -1);
};


/***/ }),

/***/ "c6cd":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var setGlobal = __webpack_require__("ce4e");

var SHARED = '__core-js_shared__';
var store = global[SHARED] || setGlobal(SHARED, {});

module.exports = store;


/***/ }),

/***/ "c740":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var $findIndex = __webpack_require__("b727").findIndex;
var addToUnscopables = __webpack_require__("44d2");

var FIND_INDEX = 'findIndex';
var SKIPS_HOLES = true;

// Shouldn't skip holes
if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });

// `Array.prototype.findIndex` method
// https://tc39.es/ecma262/#sec-array.prototype.findindex
$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  findIndex: function findIndex(callbackfn /* , that = undefined */) {
    return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});

// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables(FIND_INDEX);


/***/ }),

/***/ "c8ba":
/***/ (function(module, exports) {

var g;

// This works in non-strict mode
g = (function() {
	return this;
})();

try {
	// This works if eval is allowed (see CSP)
	g = g || new Function("return this")();
} catch (e) {
	// This works if the window reference is available
	if (typeof window === "object") g = window;
}

// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}

module.exports = g;


/***/ }),

/***/ "c8d2":
/***/ (function(module, exports, __webpack_require__) {

var PROPER_FUNCTION_NAME = __webpack_require__("5e77").PROPER;
var fails = __webpack_require__("d039");
var whitespaces = __webpack_require__("5899");

var non = '\u200B\u0085\u180E';

// check that a method works with the correct list
// of whitespaces and has a correct name
module.exports = function (METHOD_NAME) {
  return fails(function () {
    return !!whitespaces[METHOD_NAME]()
      || non[METHOD_NAME]() !== non
      || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
  });
};


/***/ }),

/***/ "c975":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/* eslint-disable es/no-array-prototype-indexof -- required for testing */
var $ = __webpack_require__("23e7");
var $indexOf = __webpack_require__("4d64").indexOf;
var arrayMethodIsStrict = __webpack_require__("a640");

var nativeIndexOf = [].indexOf;

var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
var STRICT_METHOD = arrayMethodIsStrict('indexOf');

// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
  indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
    return NEGATIVE_ZERO
      // convert -0 to +0
      ? nativeIndexOf.apply(this, arguments) || 0
      : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
  }
});


/***/ }),

/***/ "ca0b":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const Range = __webpack_require__("7b1f")
const minSatisfying = (versions, range, options) => {
  let min = null
  let minSV = null
  let rangeObj = null
  try {
    rangeObj = new Range(range, options)
  } catch (er) {
    return null
  }
  versions.forEach((v) => {
    if (rangeObj.test(v)) {
      // satisfies(v, range, options)
      if (!min || minSV.compare(v) === 1) {
        // compare(min, v, true)
        min = v
        minSV = new SemVer(min, options)
      }
    }
  })
  return min
}
module.exports = minSatisfying


/***/ }),

/***/ "ca21":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var log1p = __webpack_require__("1ec1");

// `Math.log1p` method
// https://tc39.es/ecma262/#sec-math.log1p
$({ target: 'Math', stat: true }, { log1p: log1p });


/***/ }),

/***/ "ca84":
/***/ (function(module, exports, __webpack_require__) {

var hasOwn = __webpack_require__("1a2d");
var toIndexedObject = __webpack_require__("fc6a");
var indexOf = __webpack_require__("4d64").indexOf;
var hiddenKeys = __webpack_require__("d012");

module.exports = function (object, names) {
  var O = toIndexedObject(object);
  var i = 0;
  var result = [];
  var key;
  for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && result.push(key);
  // Don't enum bug & hidden keys
  while (names.length > i) if (hasOwn(O, key = names[i++])) {
    ~indexOf(result, key) || result.push(key);
  }
  return result;
};


/***/ }),

/***/ "cb29":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var fill = __webpack_require__("81d5");
var addToUnscopables = __webpack_require__("44d2");

// `Array.prototype.fill` method
// https://tc39.es/ecma262/#sec-array.prototype.fill
$({ target: 'Array', proto: true }, {
  fill: fill
});

// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('fill');


/***/ }),

/***/ "cc12":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isObject = __webpack_require__("861d");

var document = global.document;
// typeof document.createElement is 'object' in old IE
var EXISTS = isObject(document) && isObject(document.createElement);

module.exports = function (it) {
  return EXISTS ? document.createElement(it) : {};
};


/***/ }),

/***/ "cca6":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var assign = __webpack_require__("60da");

// `Object.assign` method
// https://tc39.es/ecma262/#sec-object.assign
// eslint-disable-next-line es/no-object-assign -- required for testing
$({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
  assign: assign
});


/***/ }),

/***/ "cdf9":
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__("825a");
var isObject = __webpack_require__("861d");
var newPromiseCapability = __webpack_require__("f069");

module.exports = function (C, x) {
  anObject(C);
  if (isObject(x) && x.constructor === C) return x;
  var promiseCapability = newPromiseCapability.f(C);
  var resolve = promiseCapability.resolve;
  resolve(x);
  return promiseCapability.promise;
};


/***/ }),

/***/ "ce4e":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");

module.exports = function (key, value) {
  try {
    // eslint-disable-next-line es/no-object-defineproperty -- safe
    Object.defineProperty(global, key, { value: value, configurable: true, writable: true });
  } catch (error) {
    global[key] = value;
  } return value;
};


/***/ }),

/***/ "cefe":
/***/ (function(module, exports, __webpack_require__) {

const Range = __webpack_require__("7b1f")
const validRange = (range, options) => {
  try {
    // Return '*' instead of '' so that truthiness works.
    // This will throw if it's invalid anyway
    return new Range(range, options).range || '*'
  } catch (er) {
    return null
  }
}
module.exports = validRange


/***/ }),

/***/ "d012":
/***/ (function(module, exports) {

module.exports = {};


/***/ }),

/***/ "d039":
/***/ (function(module, exports) {

module.exports = function (exec) {
  try {
    return !!exec();
  } catch (error) {
    return true;
  }
};


/***/ }),

/***/ "d066":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");

var aFunction = function (argument) {
  return isCallable(argument) ? argument : undefined;
};

module.exports = function (namespace, method) {
  return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
};


/***/ }),

/***/ "d1e2":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const Comparator = __webpack_require__("bf00")
const {ANY} = Comparator
const Range = __webpack_require__("7b1f")
const satisfies = __webpack_require__("329c")
const gt = __webpack_require__("eec3")
const lt = __webpack_require__("2426")
const lte = __webpack_require__("6ddc")
const gte = __webpack_require__("0e49")

const outside = (version, range, hilo, options) => {
  version = new SemVer(version, options)
  range = new Range(range, options)

  let gtfn, ltefn, ltfn, comp, ecomp
  switch (hilo) {
    case '>':
      gtfn = gt
      ltefn = lte
      ltfn = lt
      comp = '>'
      ecomp = '>='
      break
    case '<':
      gtfn = lt
      ltefn = gte
      ltfn = gt
      comp = '<'
      ecomp = '<='
      break
    default:
      throw new TypeError('Must provide a hilo val of "<" or ">"')
  }

  // If it satisfies the range it is not outside
  if (satisfies(version, range, options)) {
    return false
  }

  // From now on, variable terms are as if we're in "gtr" mode.
  // but note that everything is flipped for the "ltr" function.

  for (let i = 0; i < range.set.length; ++i) {
    const comparators = range.set[i]

    let high = null
    let low = null

    comparators.forEach((comparator) => {
      if (comparator.semver === ANY) {
        comparator = new Comparator('>=0.0.0')
      }
      high = high || comparator
      low = low || comparator
      if (gtfn(comparator.semver, high.semver, options)) {
        high = comparator
      } else if (ltfn(comparator.semver, low.semver, options)) {
        low = comparator
      }
    })

    // If the edge version comparator has a operator then our version
    // isn't outside it
    if (high.operator === comp || high.operator === ecomp) {
      return false
    }

    // If the lowest version comparator has an operator and our version
    // is less than it then it isn't higher than the range
    if ((!low.operator || low.operator === comp) &&
        ltefn(version, low.semver)) {
      return false
    } else if (low.operator === ecomp && ltfn(version, low.semver)) {
      return false
    }
  }
  return true
}

module.exports = outside


/***/ }),

/***/ "d1e7":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $propertyIsEnumerable = {}.propertyIsEnumerable;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);

// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  var descriptor = getOwnPropertyDescriptor(this, V);
  return !!descriptor && descriptor.enumerable;
} : $propertyIsEnumerable;


/***/ }),

/***/ "d217":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ feature; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ mesh; });

// UNUSED EXPORTS: bbox, meshArcs, merge, mergeArcs, neighbors, quantize, transform, untransform

// CONCATENATED MODULE: ./node_modules/topojson-client/src/identity.js
/* harmony default export */ var identity = (function(x) {
  return x;
});

// CONCATENATED MODULE: ./node_modules/topojson-client/src/transform.js


/* harmony default export */ var src_transform = (function(transform) {
  if (transform == null) return identity;
  var x0,
      y0,
      kx = transform.scale[0],
      ky = transform.scale[1],
      dx = transform.translate[0],
      dy = transform.translate[1];
  return function(input, i) {
    if (!i) x0 = y0 = 0;
    var j = 2, n = input.length, output = new Array(n);
    output[0] = (x0 += input[0]) * kx + dx;
    output[1] = (y0 += input[1]) * ky + dy;
    while (j < n) output[j] = input[j], ++j;
    return output;
  };
});

// CONCATENATED MODULE: ./node_modules/topojson-client/src/bbox.js


/* harmony default export */ var bbox = (function(topology) {
  var t = src_transform(topology.transform), key,
      x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0;

  function bboxPoint(p) {
    p = t(p);
    if (p[0] < x0) x0 = p[0];
    if (p[0] > x1) x1 = p[0];
    if (p[1] < y0) y0 = p[1];
    if (p[1] > y1) y1 = p[1];
  }

  function bboxGeometry(o) {
    switch (o.type) {
      case "GeometryCollection": o.geometries.forEach(bboxGeometry); break;
      case "Point": bboxPoint(o.coordinates); break;
      case "MultiPoint": o.coordinates.forEach(bboxPoint); break;
    }
  }

  topology.arcs.forEach(function(arc) {
    var i = -1, n = arc.length, p;
    while (++i < n) {
      p = t(arc[i], i);
      if (p[0] < x0) x0 = p[0];
      if (p[0] > x1) x1 = p[0];
      if (p[1] < y0) y0 = p[1];
      if (p[1] > y1) y1 = p[1];
    }
  });

  for (key in topology.objects) {
    bboxGeometry(topology.objects[key]);
  }

  return [x0, y0, x1, y1];
});

// CONCATENATED MODULE: ./node_modules/topojson-client/src/reverse.js
/* harmony default export */ var reverse = (function(array, n) {
  var t, j = array.length, i = j - n;
  while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;
});

// CONCATENATED MODULE: ./node_modules/topojson-client/src/feature.js



/* harmony default export */ var feature = (function(topology, o) {
  if (typeof o === "string") o = topology.objects[o];
  return o.type === "GeometryCollection"
      ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature_feature(topology, o); })}
      : feature_feature(topology, o);
});

function feature_feature(topology, o) {
  var id = o.id,
      bbox = o.bbox,
      properties = o.properties == null ? {} : o.properties,
      geometry = feature_object(topology, o);
  return id == null && bbox == null ? {type: "Feature", properties: properties, geometry: geometry}
      : bbox == null ? {type: "Feature", id: id, properties: properties, geometry: geometry}
      : {type: "Feature", id: id, bbox: bbox, properties: properties, geometry: geometry};
}

function feature_object(topology, o) {
  var transformPoint = src_transform(topology.transform),
      arcs = topology.arcs;

  function arc(i, points) {
    if (points.length) points.pop();
    for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) {
      points.push(transformPoint(a[k], k));
    }
    if (i < 0) reverse(points, n);
  }

  function point(p) {
    return transformPoint(p);
  }

  function line(arcs) {
    var points = [];
    for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);
    if (points.length < 2) points.push(points[0]); // This should never happen per the specification.
    return points;
  }

  function ring(arcs) {
    var points = line(arcs);
    while (points.length < 4) points.push(points[0]); // This may happen if an arc has only two points.
    return points;
  }

  function polygon(arcs) {
    return arcs.map(ring);
  }

  function geometry(o) {
    var type = o.type, coordinates;
    switch (type) {
      case "GeometryCollection": return {type: type, geometries: o.geometries.map(geometry)};
      case "Point": coordinates = point(o.coordinates); break;
      case "MultiPoint": coordinates = o.coordinates.map(point); break;
      case "LineString": coordinates = line(o.arcs); break;
      case "MultiLineString": coordinates = o.arcs.map(line); break;
      case "Polygon": coordinates = polygon(o.arcs); break;
      case "MultiPolygon": coordinates = o.arcs.map(polygon); break;
      default: return null;
    }
    return {type: type, coordinates: coordinates};
  }

  return geometry(o);
}

// CONCATENATED MODULE: ./node_modules/topojson-client/src/stitch.js
/* harmony default export */ var stitch = (function(topology, arcs) {
  var stitchedArcs = {},
      fragmentByStart = {},
      fragmentByEnd = {},
      fragments = [],
      emptyIndex = -1;

  // Stitch empty arcs first, since they may be subsumed by other arcs.
  arcs.forEach(function(i, j) {
    var arc = topology.arcs[i < 0 ? ~i : i], t;
    if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {
      t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;
    }
  });

  arcs.forEach(function(i) {
    var e = ends(i),
        start = e[0],
        end = e[1],
        f, g;

    if (f = fragmentByEnd[start]) {
      delete fragmentByEnd[f.end];
      f.push(i);
      f.end = end;
      if (g = fragmentByStart[end]) {
        delete fragmentByStart[g.start];
        var fg = g === f ? f : f.concat(g);
        fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;
      } else {
        fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
      }
    } else if (f = fragmentByStart[end]) {
      delete fragmentByStart[f.start];
      f.unshift(i);
      f.start = start;
      if (g = fragmentByEnd[start]) {
        delete fragmentByEnd[g.end];
        var gf = g === f ? f : g.concat(f);
        fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;
      } else {
        fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
      }
    } else {
      f = [i];
      fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;
    }
  });

  function ends(i) {
    var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;
    if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });
    else p1 = arc[arc.length - 1];
    return i < 0 ? [p1, p0] : [p0, p1];
  }

  function flush(fragmentByEnd, fragmentByStart) {
    for (var k in fragmentByEnd) {
      var f = fragmentByEnd[k];
      delete fragmentByStart[f.start];
      delete f.start;
      delete f.end;
      f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });
      fragments.push(f);
    }
  }

  flush(fragmentByEnd, fragmentByStart);
  flush(fragmentByStart, fragmentByEnd);
  arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });

  return fragments;
});

// CONCATENATED MODULE: ./node_modules/topojson-client/src/mesh.js



/* harmony default export */ var mesh = (function(topology) {
  return feature_object(topology, meshArcs.apply(this, arguments));
});

function meshArcs(topology, object, filter) {
  var arcs, i, n;
  if (arguments.length > 1) arcs = extractArcs(topology, object, filter);
  else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i;
  return {type: "MultiLineString", arcs: stitch(topology, arcs)};
}

function extractArcs(topology, object, filter) {
  var arcs = [],
      geomsByArc = [],
      geom;

  function extract0(i) {
    var j = i < 0 ? ~i : i;
    (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});
  }

  function extract1(arcs) {
    arcs.forEach(extract0);
  }

  function extract2(arcs) {
    arcs.forEach(extract1);
  }

  function extract3(arcs) {
    arcs.forEach(extract2);
  }

  function geometry(o) {
    switch (geom = o, o.type) {
      case "GeometryCollection": o.geometries.forEach(geometry); break;
      case "LineString": extract1(o.arcs); break;
      case "MultiLineString": case "Polygon": extract2(o.arcs); break;
      case "MultiPolygon": extract3(o.arcs); break;
    }
  }

  geometry(object);

  geomsByArc.forEach(filter == null
      ? function(geoms) { arcs.push(geoms[0].i); }
      : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });

  return arcs;
}

// CONCATENATED MODULE: ./node_modules/topojson-client/src/merge.js



function planarRingArea(ring) {
  var i = -1, n = ring.length, a, b = ring[n - 1], area = 0;
  while (++i < n) a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0];
  return Math.abs(area); // Note: doubled area!
}

/* harmony default export */ var merge = (function(topology) {
  return feature_object(topology, mergeArcs.apply(this, arguments));
});

function mergeArcs(topology, objects) {
  var polygonsByArc = {},
      polygons = [],
      groups = [];

  objects.forEach(geometry);

  function geometry(o) {
    switch (o.type) {
      case "GeometryCollection": o.geometries.forEach(geometry); break;
      case "Polygon": extract(o.arcs); break;
      case "MultiPolygon": o.arcs.forEach(extract); break;
    }
  }

  function extract(polygon) {
    polygon.forEach(function(ring) {
      ring.forEach(function(arc) {
        (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);
      });
    });
    polygons.push(polygon);
  }

  function area(ring) {
    return planarRingArea(feature_object(topology, {type: "Polygon", arcs: [ring]}).coordinates[0]);
  }

  polygons.forEach(function(polygon) {
    if (!polygon._) {
      var group = [],
          neighbors = [polygon];
      polygon._ = 1;
      groups.push(group);
      while (polygon = neighbors.pop()) {
        group.push(polygon);
        polygon.forEach(function(ring) {
          ring.forEach(function(arc) {
            polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {
              if (!polygon._) {
                polygon._ = 1;
                neighbors.push(polygon);
              }
            });
          });
        });
      }
    }
  });

  polygons.forEach(function(polygon) {
    delete polygon._;
  });

  return {
    type: "MultiPolygon",
    arcs: groups.map(function(polygons) {
      var arcs = [], n;

      // Extract the exterior (unique) arcs.
      polygons.forEach(function(polygon) {
        polygon.forEach(function(ring) {
          ring.forEach(function(arc) {
            if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {
              arcs.push(arc);
            }
          });
        });
      });

      // Stitch the arcs into one or more rings.
      arcs = stitch(topology, arcs);

      // If more than one ring is returned,
      // at most one of these rings can be the exterior;
      // choose the one with the greatest absolute area.
      if ((n = arcs.length) > 1) {
        for (var i = 1, k = area(arcs[0]), ki, t; i < n; ++i) {
          if ((ki = area(arcs[i])) > k) {
            t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki;
          }
        }
      }

      return arcs;
    }).filter(function(arcs) {
      return arcs.length > 0;
    })
  };
}

// CONCATENATED MODULE: ./node_modules/topojson-client/src/bisect.js
/* harmony default export */ var bisect = (function(a, x) {
  var lo = 0, hi = a.length;
  while (lo < hi) {
    var mid = lo + hi >>> 1;
    if (a[mid] < x) lo = mid + 1;
    else hi = mid;
  }
  return lo;
});

// CONCATENATED MODULE: ./node_modules/topojson-client/src/neighbors.js


/* harmony default export */ var src_neighbors = (function(objects) {
  var indexesByArc = {}, // arc index -> array of object indexes
      neighbors = objects.map(function() { return []; });

  function line(arcs, i) {
    arcs.forEach(function(a) {
      if (a < 0) a = ~a;
      var o = indexesByArc[a];
      if (o) o.push(i);
      else indexesByArc[a] = [i];
    });
  }

  function polygon(arcs, i) {
    arcs.forEach(function(arc) { line(arc, i); });
  }

  function geometry(o, i) {
    if (o.type === "GeometryCollection") o.geometries.forEach(function(o) { geometry(o, i); });
    else if (o.type in geometryType) geometryType[o.type](o.arcs, i);
  }

  var geometryType = {
    LineString: line,
    MultiLineString: polygon,
    Polygon: polygon,
    MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); }
  };

  objects.forEach(geometry);

  for (var i in indexesByArc) {
    for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {
      for (var k = j + 1; k < m; ++k) {
        var ij = indexes[j], ik = indexes[k], n;
        if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);
        if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);
      }
    }
  }

  return neighbors;
});

// CONCATENATED MODULE: ./node_modules/topojson-client/src/untransform.js


/* harmony default export */ var untransform = (function(transform) {
  if (transform == null) return identity;
  var x0,
      y0,
      kx = transform.scale[0],
      ky = transform.scale[1],
      dx = transform.translate[0],
      dy = transform.translate[1];
  return function(input, i) {
    if (!i) x0 = y0 = 0;
    var j = 2,
        n = input.length,
        output = new Array(n),
        x1 = Math.round((input[0] - dx) / kx),
        y1 = Math.round((input[1] - dy) / ky);
    output[0] = x1 - x0, x0 = x1;
    output[1] = y1 - y0, y0 = y1;
    while (j < n) output[j] = input[j], ++j;
    return output;
  };
});

// CONCATENATED MODULE: ./node_modules/topojson-client/src/quantize.js



/* harmony default export */ var quantize = (function(topology, transform) {
  if (topology.transform) throw new Error("already quantized");

  if (!transform || !transform.scale) {
    if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be ≥2");
    box = topology.bbox || bbox(topology);
    var x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3], n;
    transform = {scale: [x1 - x0 ? (x1 - x0) / (n - 1) : 1, y1 - y0 ? (y1 - y0) / (n - 1) : 1], translate: [x0, y0]};
  } else {
    box = topology.bbox;
  }

  var t = untransform(transform), box, key, inputs = topology.objects, outputs = {};

  function quantizePoint(point) {
    return t(point);
  }

  function quantizeGeometry(input) {
    var output;
    switch (input.type) {
      case "GeometryCollection": output = {type: "GeometryCollection", geometries: input.geometries.map(quantizeGeometry)}; break;
      case "Point": output = {type: "Point", coordinates: quantizePoint(input.coordinates)}; break;
      case "MultiPoint": output = {type: "MultiPoint", coordinates: input.coordinates.map(quantizePoint)}; break;
      default: return input;
    }
    if (input.id != null) output.id = input.id;
    if (input.bbox != null) output.bbox = input.bbox;
    if (input.properties != null) output.properties = input.properties;
    return output;
  }

  function quantizeArc(input) {
    var i = 0, j = 1, n = input.length, p, output = new Array(n); // pessimistic
    output[0] = t(input[0], 0);
    while (++i < n) if ((p = t(input[i], i))[0] || p[1]) output[j++] = p; // non-coincident points
    if (j === 1) output[j++] = [0, 0]; // an arc must have at least two points
    output.length = j;
    return output;
  }

  for (key in inputs) outputs[key] = quantizeGeometry(inputs[key]);

  return {
    type: "Topology",
    bbox: box,
    transform: transform,
    objects: outputs,
    arcs: topology.arcs.map(quantizeArc)
  };
});

// CONCATENATED MODULE: ./node_modules/topojson-client/src/index.js










/***/ }),

/***/ "d28b":
/***/ (function(module, exports, __webpack_require__) {

var defineWellKnownSymbol = __webpack_require__("746f");

// `Symbol.iterator` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.iterator
defineWellKnownSymbol('iterator');


/***/ }),

/***/ "d2bb":
/***/ (function(module, exports, __webpack_require__) {

/* eslint-disable no-proto -- safe */
var anObject = __webpack_require__("825a");
var aPossiblePrototype = __webpack_require__("3bbe");

// `Object.setPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.setprototypeof
// Works with __proto__ only. Old v8 can't work with null proto objects.
// eslint-disable-next-line es/no-object-setprototypeof -- safe
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  var CORRECT_SETTER = false;
  var test = {};
  var setter;
  try {
    // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
    setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
    setter.call(test, []);
    CORRECT_SETTER = test instanceof Array;
  } catch (error) { /* empty */ }
  return function setPrototypeOf(O, proto) {
    anObject(O);
    aPossiblePrototype(proto);
    if (CORRECT_SETTER) setter.call(O, proto);
    else O.__proto__ = proto;
    return O;
  };
}() : undefined);


/***/ }),

/***/ "d3b7":
/***/ (function(module, exports, __webpack_require__) {

var TO_STRING_TAG_SUPPORT = __webpack_require__("00ee");
var redefine = __webpack_require__("6eeb");
var toString = __webpack_require__("b041");

// `Object.prototype.toString` method
// https://tc39.es/ecma262/#sec-object.prototype.tostring
if (!TO_STRING_TAG_SUPPORT) {
  redefine(Object.prototype, 'toString', toString, { unsafe: true });
}


/***/ }),

/***/ "d44e":
/***/ (function(module, exports, __webpack_require__) {

var defineProperty = __webpack_require__("9bf2").f;
var hasOwn = __webpack_require__("1a2d");
var wellKnownSymbol = __webpack_require__("b622");

var TO_STRING_TAG = wellKnownSymbol('toStringTag');

module.exports = function (it, TAG, STATIC) {
  if (it && !hasOwn(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
    defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
  }
};


/***/ }),

/***/ "d4c3":
/***/ (function(module, exports, __webpack_require__) {

var userAgent = __webpack_require__("342f");
var global = __webpack_require__("da84");

module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;


/***/ }),

/***/ "d58f":
/***/ (function(module, exports, __webpack_require__) {

var aCallable = __webpack_require__("59ed");
var toObject = __webpack_require__("7b0b");
var IndexedObject = __webpack_require__("44ad");
var lengthOfArrayLike = __webpack_require__("07fa");

// `Array.prototype.{ reduce, reduceRight }` methods implementation
var createMethod = function (IS_RIGHT) {
  return function (that, callbackfn, argumentsLength, memo) {
    aCallable(callbackfn);
    var O = toObject(that);
    var self = IndexedObject(O);
    var length = lengthOfArrayLike(O);
    var index = IS_RIGHT ? length - 1 : 0;
    var i = IS_RIGHT ? -1 : 1;
    if (argumentsLength < 2) while (true) {
      if (index in self) {
        memo = self[index];
        index += i;
        break;
      }
      index += i;
      if (IS_RIGHT ? index < 0 : length <= index) {
        throw TypeError('Reduce of empty array with no initial value');
      }
    }
    for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
      memo = callbackfn(memo, self[index], index, O);
    }
    return memo;
  };
};

module.exports = {
  // `Array.prototype.reduce` method
  // https://tc39.es/ecma262/#sec-array.prototype.reduce
  left: createMethod(false),
  // `Array.prototype.reduceRight` method
  // https://tc39.es/ecma262/#sec-array.prototype.reduceright
  right: createMethod(true)
};


/***/ }),

/***/ "d784":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// TODO: Remove from `core-js@4` since it's moved to entry points
__webpack_require__("ac1f");
var redefine = __webpack_require__("6eeb");
var regexpExec = __webpack_require__("9263");
var fails = __webpack_require__("d039");
var wellKnownSymbol = __webpack_require__("b622");
var createNonEnumerableProperty = __webpack_require__("9112");

var SPECIES = wellKnownSymbol('species');
var RegExpPrototype = RegExp.prototype;

module.exports = function (KEY, exec, FORCED, SHAM) {
  var SYMBOL = wellKnownSymbol(KEY);

  var DELEGATES_TO_SYMBOL = !fails(function () {
    // String methods call symbol-named RegEp methods
    var O = {};
    O[SYMBOL] = function () { return 7; };
    return ''[KEY](O) != 7;
  });

  var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
    // Symbol-named RegExp methods call .exec
    var execCalled = false;
    var re = /a/;

    if (KEY === 'split') {
      // We can't use real regex here since it causes deoptimization
      // and serious performance degradation in V8
      // https://github.com/zloirock/core-js/issues/306
      re = {};
      // RegExp[@@split] doesn't call the regex's exec method, but first creates
      // a new one. We need to return the patched regex when creating the new one.
      re.constructor = {};
      re.constructor[SPECIES] = function () { return re; };
      re.flags = '';
      re[SYMBOL] = /./[SYMBOL];
    }

    re.exec = function () { execCalled = true; return null; };

    re[SYMBOL]('');
    return !execCalled;
  });

  if (
    !DELEGATES_TO_SYMBOL ||
    !DELEGATES_TO_EXEC ||
    FORCED
  ) {
    var nativeRegExpMethod = /./[SYMBOL];
    var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
      var $exec = regexp.exec;
      if ($exec === regexpExec || $exec === RegExpPrototype.exec) {
        if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
          // The native String method already delegates to @@method (this
          // polyfilled function), leasing to infinite recursion.
          // We avoid it by directly calling the native @@method method.
          return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
        }
        return { done: true, value: nativeMethod.call(str, regexp, arg2) };
      }
      return { done: false };
    });

    redefine(String.prototype, KEY, methods[0]);
    redefine(RegExpPrototype, SYMBOL, methods[1]);
  }

  if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
};


/***/ }),

/***/ "d7c6":
/***/ (function(module, exports, __webpack_require__) {

const Range = __webpack_require__("7b1f")
const intersects = (r1, r2, options) => {
  r1 = new Range(r1, options)
  r2 = new Range(r2, options)
  return r1.intersects(r2)
}
module.exports = intersects


/***/ }),

/***/ "d81d":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var $map = __webpack_require__("b727").map;
var arrayMethodHasSpeciesSupport = __webpack_require__("1dde");

var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');

// `Array.prototype.map` method
// https://tc39.es/ecma262/#sec-array.prototype.map
// with adding support of @@species
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  map: function map(callbackfn /* , thisArg */) {
    return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});


/***/ }),

/***/ "d933":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var _exponent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a7fd");


/* harmony default export */ __webpack_exports__["a"] = (function(step, value) {
  return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Object(_exponent_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(value) / 3))) * 3 - Object(_exponent_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(Math.abs(step)));
});


/***/ }),

/***/ "d989":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var _exponent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a7fd");


/* harmony default export */ __webpack_exports__["a"] = (function(step, max) {
  step = Math.abs(step), max = Math.abs(max) - step;
  return Math.max(0, Object(_exponent_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(max) - Object(_exponent_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(step)) + 1;
});


/***/ }),

/***/ "d998":
/***/ (function(module, exports, __webpack_require__) {

var UA = __webpack_require__("342f");

module.exports = /MSIE|Trident/.test(UA);


/***/ }),

/***/ "d9b5":
/***/ (function(module, exports, __webpack_require__) {

var isCallable = __webpack_require__("1626");
var getBuiltIn = __webpack_require__("d066");
var USE_SYMBOL_AS_UID = __webpack_require__("fdbf");

module.exports = USE_SYMBOL_AS_UID ? function (it) {
  return typeof it == 'symbol';
} : function (it) {
  var $Symbol = getBuiltIn('Symbol');
  return isCallable($Symbol) && Object(it) instanceof $Symbol;
};


/***/ }),

/***/ "da84":
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
  return it && it.Math == Math && it;
};

// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
module.exports =
  // eslint-disable-next-line es/no-global-this -- safe
  check(typeof globalThis == 'object' && globalThis) ||
  check(typeof window == 'object' && window) ||
  // eslint-disable-next-line no-restricted-globals -- safe
  check(typeof self == 'object' && self) ||
  check(typeof global == 'object' && global) ||
  // eslint-disable-next-line no-new-func -- fallback
  (function () { return this; })() || Function('return this')();

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))

/***/ }),

/***/ "dad1":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var _exponent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a7fd");


/* harmony default export */ __webpack_exports__["a"] = (function(step) {
  return Math.max(0, -Object(_exponent_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(Math.abs(step)));
});


/***/ }),

/***/ "db0b":
/***/ (function(module, exports, __webpack_require__) {

const outside = __webpack_require__("d1e2")
// Determine if version is less than all the versions possible in the range
const ltr = (version, range, options) => outside(version, range, '<', options)
module.exports = ltr


/***/ }),

/***/ "dbb3":
/***/ (function(module, exports, __webpack_require__) {

const compareBuild = __webpack_require__("8840")
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
module.exports = rsort


/***/ }),

/***/ "dc4a":
/***/ (function(module, exports, __webpack_require__) {

var aCallable = __webpack_require__("59ed");

// `GetMethod` abstract operation
// https://tc39.es/ecma262/#sec-getmethod
module.exports = function (V, P) {
  var func = V[P];
  return func == null ? undefined : aCallable(func);
};


/***/ }),

/***/ "ddb0":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");
var DOMIterables = __webpack_require__("fdbc");
var DOMTokenListPrototype = __webpack_require__("785a");
var ArrayIteratorMethods = __webpack_require__("e260");
var createNonEnumerableProperty = __webpack_require__("9112");
var wellKnownSymbol = __webpack_require__("b622");

var ITERATOR = wellKnownSymbol('iterator');
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var ArrayValues = ArrayIteratorMethods.values;

var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
  if (CollectionPrototype) {
    // some Chrome versions have non-configurable methods on DOMTokenList
    if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
      createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
    } catch (error) {
      CollectionPrototype[ITERATOR] = ArrayValues;
    }
    if (!CollectionPrototype[TO_STRING_TAG]) {
      createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
    }
    if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
      // some Chrome versions have non-configurable methods on DOMTokenList
      if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
        createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
      } catch (error) {
        CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
      }
    }
  }
};

for (var COLLECTION_NAME in DOMIterables) {
  handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype, COLLECTION_NAME);
}

handlePrototype(DOMTokenListPrototype, 'DOMTokenList');


/***/ }),

/***/ "ddc3":
/***/ (function(module, exports, __webpack_require__) {

// just pre-load all the stuff that index.js lazily exports
const internalRe = __webpack_require__("22c0")
module.exports = {
  re: internalRe.re,
  src: internalRe.src,
  tokens: internalRe.t,
  SEMVER_SPEC_VERSION: __webpack_require__("fe45").SEMVER_SPEC_VERSION,
  SemVer: __webpack_require__("df02"),
  compareIdentifiers: __webpack_require__("2874").compareIdentifiers,
  rcompareIdentifiers: __webpack_require__("2874").rcompareIdentifiers,
  parse: __webpack_require__("61bb"),
  valid: __webpack_require__("82ac"),
  clean: __webpack_require__("a017"),
  inc: __webpack_require__("7907"),
  diff: __webpack_require__("627e"),
  major: __webpack_require__("06be"),
  minor: __webpack_require__("609d"),
  patch: __webpack_require__("2c9f"),
  prerelease: __webpack_require__("3bd4"),
  compare: __webpack_require__("f06c"),
  rcompare: __webpack_require__("a21d"),
  compareLoose: __webpack_require__("f182"),
  compareBuild: __webpack_require__("8840"),
  sort: __webpack_require__("9588"),
  rsort: __webpack_require__("dbb3"),
  gt: __webpack_require__("eec3"),
  lt: __webpack_require__("2426"),
  eq: __webpack_require__("c5fb"),
  neq: __webpack_require__("76db"),
  gte: __webpack_require__("0e49"),
  lte: __webpack_require__("6ddc"),
  cmp: __webpack_require__("54c2"),
  coerce: __webpack_require__("7973"),
  Comparator: __webpack_require__("bf00"),
  Range: __webpack_require__("7b1f"),
  satisfies: __webpack_require__("329c"),
  toComparators: __webpack_require__("8f4a"),
  maxSatisfying: __webpack_require__("778d"),
  minSatisfying: __webpack_require__("ca0b"),
  minVersion: __webpack_require__("9647"),
  validRange: __webpack_require__("cefe"),
  outside: __webpack_require__("d1e2"),
  gtr: __webpack_require__("566a"),
  ltr: __webpack_require__("db0b"),
  intersects: __webpack_require__("d7c6"),
  simplifyRange: __webpack_require__("bfa6"),
  subset: __webpack_require__("23d7"),
}


/***/ }),

/***/ "de28":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DATE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DAY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return DAYOFYEAR; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return HOURS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return MILLISECONDS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return MINUTES; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return MONTH; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return QUARTER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return SECONDS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return TIME_UNITS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return WEEK; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return YEAR; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return dayofyear; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return bin; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return timeFloor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return timeInterval; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return timeOffset; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return timeSequence; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return timeUnitSpecifier; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return timeUnits; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return utcFloor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return utcInterval; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return utcOffset; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return utcSequence; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return utcdayofyear; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return utcweek; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return week; });
/* harmony import */ var vega_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fc17");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("742c");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("b14c");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("6eb2");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("2739");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("a15a");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("9603");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("b3c3");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("2c38");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("5edf");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("1809");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("77ae");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("55f8");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("f623");
/* harmony import */ var d3_time__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("f8ee");
/* harmony import */ var d3_array__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("2a2d");
/* harmony import */ var d3_array__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("eecb");




const YEAR = 'year';
const QUARTER = 'quarter';
const MONTH = 'month';
const WEEK = 'week';
const DATE = 'date';
const DAY = 'day';
const DAYOFYEAR = 'dayofyear';
const HOURS = 'hours';
const MINUTES = 'minutes';
const SECONDS = 'seconds';
const MILLISECONDS = 'milliseconds';
const TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS];
const UNITS = TIME_UNITS.reduce((o, u, i) => (o[u] = 1 + i, o), {});
function timeUnits(units) {
  const u = Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* array */ "i"])(units).slice(),
        m = {}; // check validity

  if (!u.length) Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])('Missing time unit.');
  u.forEach(unit => {
    if (Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* hasOwnProperty */ "w"])(UNITS, unit)) {
      m[unit] = 1;
    } else {
      Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])("Invalid time unit: ".concat(unit, "."));
    }
  });
  const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0);

  if (numTypes > 1) {
    Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* error */ "o"])("Incompatible time units: ".concat(units));
  } // ensure proper sort order


  u.sort((a, b) => UNITS[a] - UNITS[b]);
  return u;
}
const defaultSpecifiers = {
  [YEAR]: '%Y ',
  [QUARTER]: 'Q%q ',
  [MONTH]: '%b ',
  [DATE]: '%d ',
  [WEEK]: 'W%U ',
  [DAY]: '%a ',
  [DAYOFYEAR]: '%j ',
  [HOURS]: '%H:00',
  [MINUTES]: '00:%M',
  [SECONDS]: ':%S',
  [MILLISECONDS]: '.%L',
  ["".concat(YEAR, "-").concat(MONTH)]: '%Y-%m ',
  ["".concat(YEAR, "-").concat(MONTH, "-").concat(DATE)]: '%Y-%m-%d ',
  ["".concat(HOURS, "-").concat(MINUTES)]: '%H:%M'
};
function timeUnitSpecifier(units, specifiers) {
  const s = Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* extend */ "p"])({}, defaultSpecifiers, specifiers),
        u = timeUnits(units),
        n = u.length;
  let fmt = '',
      start = 0,
      end,
      key;

  for (start = 0; start < n;) {
    for (end = u.length; end > start; --end) {
      key = u.slice(start, end).join('-');

      if (s[key] != null) {
        fmt += s[key];
        start = end;
        break;
      }
    }
  }

  return fmt.trim();
}

const t0 = new Date();

function localYear(y) {
  t0.setFullYear(y);
  t0.setMonth(0);
  t0.setDate(1);
  t0.setHours(0, 0, 0, 0);
  return t0;
}

function dayofyear(d) {
  return localDayOfYear(new Date(d));
}
function week(d) {
  return localWeekNum(new Date(d));
}
function localDayOfYear(d) {
  return d3_time__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].count(localYear(d.getFullYear()) - 1, d);
}
function localWeekNum(d) {
  return d3_time__WEBPACK_IMPORTED_MODULE_2__[/* sunday */ "b"].count(localYear(d.getFullYear()) - 1, d);
}
function localFirst(y) {
  return localYear(y).getDay();
}
function localDate(y, m, d, H, M, S, L) {
  if (0 <= y && y < 100) {
    const date = new Date(-1, m, d, H, M, S, L);
    date.setFullYear(y);
    return date;
  }

  return new Date(y, m, d, H, M, S, L);
}
function utcdayofyear(d) {
  return utcDayOfYear(new Date(d));
}
function utcweek(d) {
  return utcWeekNum(new Date(d));
}
function utcDayOfYear(d) {
  const y = Date.UTC(d.getUTCFullYear(), 0, 1);
  return d3_time__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].count(y - 1, d);
}
function utcWeekNum(d) {
  const y = Date.UTC(d.getUTCFullYear(), 0, 1);
  return d3_time__WEBPACK_IMPORTED_MODULE_4__[/* utcSunday */ "b"].count(y - 1, d);
}
function utcFirst(y) {
  t0.setTime(Date.UTC(y, 0, 1));
  return t0.getUTCDay();
}
function utcDate(y, m, d, H, M, S, L) {
  if (0 <= y && y < 100) {
    const date = new Date(Date.UTC(-1, m, d, H, M, S, L));
    date.setUTCFullYear(d.y);
    return date;
  }

  return new Date(Date.UTC(y, m, d, H, M, S, L));
}

function floor(units, step, get, inv, newDate) {
  const s = step || 1,
        b = Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* peek */ "W"])(units),
        _ = (unit, p, key) => {
    key = key || unit;
    return getUnit(get[key], inv[key], unit === b && s, p);
  };

  const t = new Date(),
        u = Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* toSet */ "fb"])(units),
        y = u[YEAR] ? _(YEAR) : Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* constant */ "m"])(2012),
        m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : vega_util__WEBPACK_IMPORTED_MODULE_0__[/* zero */ "mb"],
        d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : vega_util__WEBPACK_IMPORTED_MODULE_0__[/* one */ "Q"],
        H = u[HOURS] ? _(HOURS) : vega_util__WEBPACK_IMPORTED_MODULE_0__[/* zero */ "mb"],
        M = u[MINUTES] ? _(MINUTES) : vega_util__WEBPACK_IMPORTED_MODULE_0__[/* zero */ "mb"],
        S = u[SECONDS] ? _(SECONDS) : vega_util__WEBPACK_IMPORTED_MODULE_0__[/* zero */ "mb"],
        L = u[MILLISECONDS] ? _(MILLISECONDS) : vega_util__WEBPACK_IMPORTED_MODULE_0__[/* zero */ "mb"];
  return function (v) {
    t.setTime(+v);
    const year = y(t);
    return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t));
  };
}

function getUnit(f, inv, step, phase) {
  const u = step <= 1 ? f : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) : (d, y) => step * Math.floor(f(d, y) / step);
  return inv ? (d, y) => inv(u(d, y), y) : u;
} // returns the day of the year based on week number, day of week,
// and the day of the week for the first day of the year


function weekday(week, day, firstDay) {
  return day + week * 7 - (firstDay + 6) % 7;
} // -- LOCAL TIME --


const localGet = {
  [YEAR]: d => d.getFullYear(),
  [QUARTER]: d => Math.floor(d.getMonth() / 3),
  [MONTH]: d => d.getMonth(),
  [DATE]: d => d.getDate(),
  [HOURS]: d => d.getHours(),
  [MINUTES]: d => d.getMinutes(),
  [SECONDS]: d => d.getSeconds(),
  [MILLISECONDS]: d => d.getMilliseconds(),
  [DAYOFYEAR]: d => localDayOfYear(d),
  [WEEK]: d => localWeekNum(d),
  [WEEK + DAY]: (d, y) => weekday(localWeekNum(d), d.getDay(), localFirst(y)),
  [DAY]: (d, y) => weekday(1, d.getDay(), localFirst(y))
};
const localInv = {
  [QUARTER]: q => 3 * q,
  [WEEK]: (w, y) => weekday(w, 0, localFirst(y))
};
function timeFloor(units, step) {
  return floor(units, step || 1, localGet, localInv, localDate);
} // -- UTC TIME --

const utcGet = {
  [YEAR]: d => d.getUTCFullYear(),
  [QUARTER]: d => Math.floor(d.getUTCMonth() / 3),
  [MONTH]: d => d.getUTCMonth(),
  [DATE]: d => d.getUTCDate(),
  [HOURS]: d => d.getUTCHours(),
  [MINUTES]: d => d.getUTCMinutes(),
  [SECONDS]: d => d.getUTCSeconds(),
  [MILLISECONDS]: d => d.getUTCMilliseconds(),
  [DAYOFYEAR]: d => utcDayOfYear(d),
  [WEEK]: d => utcWeekNum(d),
  [DAY]: (d, y) => weekday(1, d.getUTCDay(), utcFirst(y)),
  [WEEK + DAY]: (d, y) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y))
};
const utcInv = {
  [QUARTER]: q => 3 * q,
  [WEEK]: (w, y) => weekday(w, 0, utcFirst(y))
};
function utcFloor(units, step) {
  return floor(units, step || 1, utcGet, utcInv, utcDate);
}

const timeIntervals = {
  [YEAR]: d3_time__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"],
  [QUARTER]: d3_time__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].every(3),
  [MONTH]: d3_time__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"],
  [WEEK]: d3_time__WEBPACK_IMPORTED_MODULE_2__[/* sunday */ "b"],
  [DATE]: d3_time__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"],
  [DAY]: d3_time__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"],
  [DAYOFYEAR]: d3_time__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"],
  [HOURS]: d3_time__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"],
  [MINUTES]: d3_time__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"],
  [SECONDS]: d3_time__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"],
  [MILLISECONDS]: d3_time__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"]
};
const utcIntervals = {
  [YEAR]: d3_time__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"],
  [QUARTER]: d3_time__WEBPACK_IMPORTED_MODULE_12__[/* default */ "a"].every(3),
  [MONTH]: d3_time__WEBPACK_IMPORTED_MODULE_12__[/* default */ "a"],
  [WEEK]: d3_time__WEBPACK_IMPORTED_MODULE_4__[/* utcSunday */ "b"],
  [DATE]: d3_time__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"],
  [DAY]: d3_time__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"],
  [DAYOFYEAR]: d3_time__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"],
  [HOURS]: d3_time__WEBPACK_IMPORTED_MODULE_13__[/* default */ "a"],
  [MINUTES]: d3_time__WEBPACK_IMPORTED_MODULE_14__[/* default */ "a"],
  [SECONDS]: d3_time__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"],
  [MILLISECONDS]: d3_time__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"]
};
function timeInterval(unit) {
  return timeIntervals[unit];
}
function utcInterval(unit) {
  return utcIntervals[unit];
}

function offset(ival, date, step) {
  return ival ? ival.offset(date, step) : undefined;
}

function timeOffset(unit, date, step) {
  return offset(timeInterval(unit), date, step);
}
function utcOffset(unit, date, step) {
  return offset(utcInterval(unit), date, step);
}

function sequence(ival, start, stop, step) {
  return ival ? ival.range(start, stop, step) : undefined;
}

function timeSequence(unit, start, stop, step) {
  return sequence(timeInterval(unit), start, stop, step);
}
function utcSequence(unit, start, stop, step) {
  return sequence(utcInterval(unit), start, stop, step);
}

const durationSecond = 1000,
      durationMinute = durationSecond * 60,
      durationHour = durationMinute * 60,
      durationDay = durationHour * 24,
      durationWeek = durationDay * 7,
      durationMonth = durationDay * 30,
      durationYear = durationDay * 365;
const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS],
      Seconds = Milli.slice(0, -1),
      Minutes = Seconds.slice(0, -1),
      Hours = Minutes.slice(0, -1),
      Day = Hours.slice(0, -1),
      Week = [YEAR, WEEK],
      Month = [YEAR, MONTH],
      Year = [YEAR];
const intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]];
function bin (opt) {
  const ext = opt.extent,
        max = opt.maxbins || 40,
        target = Math.abs(Object(vega_util__WEBPACK_IMPORTED_MODULE_0__[/* span */ "Z"])(ext)) / max;
  let i = Object(d3_array__WEBPACK_IMPORTED_MODULE_15__[/* default */ "a"])(i => i[2]).right(intervals, target),
      units,
      step;

  if (i === intervals.length) {
    units = Year, step = Object(d3_array__WEBPACK_IMPORTED_MODULE_16__[/* tickStep */ "c"])(ext[0] / durationYear, ext[1] / durationYear, max);
  } else if (i) {
    i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i];
    units = i[0];
    step = i[1];
  } else {
    units = Milli;
    step = Math.max(Object(d3_array__WEBPACK_IMPORTED_MODULE_16__[/* tickStep */ "c"])(ext[0], ext[1], max), 1);
  }

  return {
    units,
    step
  };
}




/***/ }),

/***/ "df02":
/***/ (function(module, exports, __webpack_require__) {

const debug = __webpack_require__("0d7c")
const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__("fe45")
const { re, t } = __webpack_require__("22c0")

const parseOptions = __webpack_require__("e12f")
const { compareIdentifiers } = __webpack_require__("2874")
class SemVer {
  constructor (version, options) {
    options = parseOptions(options)

    if (version instanceof SemVer) {
      if (version.loose === !!options.loose &&
          version.includePrerelease === !!options.includePrerelease) {
        return version
      } else {
        version = version.version
      }
    } else if (typeof version !== 'string') {
      throw new TypeError(`Invalid Version: ${version}`)
    }

    if (version.length > MAX_LENGTH) {
      throw new TypeError(
        `version is longer than ${MAX_LENGTH} characters`
      )
    }

    debug('SemVer', version, options)
    this.options = options
    this.loose = !!options.loose
    // this isn't actually relevant for versions, but keep it so that we
    // don't run into trouble passing this.options around.
    this.includePrerelease = !!options.includePrerelease

    const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])

    if (!m) {
      throw new TypeError(`Invalid Version: ${version}`)
    }

    this.raw = version

    // these are actually numbers
    this.major = +m[1]
    this.minor = +m[2]
    this.patch = +m[3]

    if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
      throw new TypeError('Invalid major version')
    }

    if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
      throw new TypeError('Invalid minor version')
    }

    if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
      throw new TypeError('Invalid patch version')
    }

    // numberify any prerelease numeric ids
    if (!m[4]) {
      this.prerelease = []
    } else {
      this.prerelease = m[4].split('.').map((id) => {
        if (/^[0-9]+$/.test(id)) {
          const num = +id
          if (num >= 0 && num < MAX_SAFE_INTEGER) {
            return num
          }
        }
        return id
      })
    }

    this.build = m[5] ? m[5].split('.') : []
    this.format()
  }

  format () {
    this.version = `${this.major}.${this.minor}.${this.patch}`
    if (this.prerelease.length) {
      this.version += `-${this.prerelease.join('.')}`
    }
    return this.version
  }

  toString () {
    return this.version
  }

  compare (other) {
    debug('SemVer.compare', this.version, this.options, other)
    if (!(other instanceof SemVer)) {
      if (typeof other === 'string' && other === this.version) {
        return 0
      }
      other = new SemVer(other, this.options)
    }

    if (other.version === this.version) {
      return 0
    }

    return this.compareMain(other) || this.comparePre(other)
  }

  compareMain (other) {
    if (!(other instanceof SemVer)) {
      other = new SemVer(other, this.options)
    }

    return (
      compareIdentifiers(this.major, other.major) ||
      compareIdentifiers(this.minor, other.minor) ||
      compareIdentifiers(this.patch, other.patch)
    )
  }

  comparePre (other) {
    if (!(other instanceof SemVer)) {
      other = new SemVer(other, this.options)
    }

    // NOT having a prerelease is > having one
    if (this.prerelease.length && !other.prerelease.length) {
      return -1
    } else if (!this.prerelease.length && other.prerelease.length) {
      return 1
    } else if (!this.prerelease.length && !other.prerelease.length) {
      return 0
    }

    let i = 0
    do {
      const a = this.prerelease[i]
      const b = other.prerelease[i]
      debug('prerelease compare', i, a, b)
      if (a === undefined && b === undefined) {
        return 0
      } else if (b === undefined) {
        return 1
      } else if (a === undefined) {
        return -1
      } else if (a === b) {
        continue
      } else {
        return compareIdentifiers(a, b)
      }
    } while (++i)
  }

  compareBuild (other) {
    if (!(other instanceof SemVer)) {
      other = new SemVer(other, this.options)
    }

    let i = 0
    do {
      const a = this.build[i]
      const b = other.build[i]
      debug('prerelease compare', i, a, b)
      if (a === undefined && b === undefined) {
        return 0
      } else if (b === undefined) {
        return 1
      } else if (a === undefined) {
        return -1
      } else if (a === b) {
        continue
      } else {
        return compareIdentifiers(a, b)
      }
    } while (++i)
  }

  // preminor will bump the version up to the next minor release, and immediately
  // down to pre-release. premajor and prepatch work the same way.
  inc (release, identifier) {
    switch (release) {
      case 'premajor':
        this.prerelease.length = 0
        this.patch = 0
        this.minor = 0
        this.major++
        this.inc('pre', identifier)
        break
      case 'preminor':
        this.prerelease.length = 0
        this.patch = 0
        this.minor++
        this.inc('pre', identifier)
        break
      case 'prepatch':
        // If this is already a prerelease, it will bump to the next version
        // drop any prereleases that might already exist, since they are not
        // relevant at this point.
        this.prerelease.length = 0
        this.inc('patch', identifier)
        this.inc('pre', identifier)
        break
      // If the input is a non-prerelease version, this acts the same as
      // prepatch.
      case 'prerelease':
        if (this.prerelease.length === 0) {
          this.inc('patch', identifier)
        }
        this.inc('pre', identifier)
        break

      case 'major':
        // If this is a pre-major version, bump up to the same major version.
        // Otherwise increment major.
        // 1.0.0-5 bumps to 1.0.0
        // 1.1.0 bumps to 2.0.0
        if (
          this.minor !== 0 ||
          this.patch !== 0 ||
          this.prerelease.length === 0
        ) {
          this.major++
        }
        this.minor = 0
        this.patch = 0
        this.prerelease = []
        break
      case 'minor':
        // If this is a pre-minor version, bump up to the same minor version.
        // Otherwise increment minor.
        // 1.2.0-5 bumps to 1.2.0
        // 1.2.1 bumps to 1.3.0
        if (this.patch !== 0 || this.prerelease.length === 0) {
          this.minor++
        }
        this.patch = 0
        this.prerelease = []
        break
      case 'patch':
        // If this is not a pre-release version, it will increment the patch.
        // If it is a pre-release it will bump up to the same patch version.
        // 1.2.0-5 patches to 1.2.0
        // 1.2.0 patches to 1.2.1
        if (this.prerelease.length === 0) {
          this.patch++
        }
        this.prerelease = []
        break
      // This probably shouldn't be used publicly.
      // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
      case 'pre':
        if (this.prerelease.length === 0) {
          this.prerelease = [0]
        } else {
          let i = this.prerelease.length
          while (--i >= 0) {
            if (typeof this.prerelease[i] === 'number') {
              this.prerelease[i]++
              i = -2
            }
          }
          if (i === -1) {
            // didn't increment anything
            this.prerelease.push(0)
          }
        }
        if (identifier) {
          // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
          // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
          if (this.prerelease[0] === identifier) {
            if (isNaN(this.prerelease[1])) {
              this.prerelease = [identifier, 0]
            }
          } else {
            this.prerelease = [identifier, 0]
          }
        }
        break

      default:
        throw new Error(`invalid increment argument: ${release}`)
    }
    this.format()
    this.raw = this.version
    return this
  }
}

module.exports = SemVer


/***/ }),

/***/ "df75":
/***/ (function(module, exports, __webpack_require__) {

var internalObjectKeys = __webpack_require__("ca84");
var enumBugKeys = __webpack_require__("7839");

// `Object.keys` method
// https://tc39.es/ecma262/#sec-object.keys
// eslint-disable-next-line es/no-object-keys -- safe
module.exports = Object.keys || function keys(O) {
  return internalObjectKeys(O, enumBugKeys);
};


/***/ }),

/***/ "df7c":
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
// backported and transplited with Babel, with backwards-compat fixes

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
  // if the path tries to go above the root, `up` ends up > 0
  var up = 0;
  for (var i = parts.length - 1; i >= 0; i--) {
    var last = parts[i];
    if (last === '.') {
      parts.splice(i, 1);
    } else if (last === '..') {
      parts.splice(i, 1);
      up++;
    } else if (up) {
      parts.splice(i, 1);
      up--;
    }
  }

  // if the path is allowed to go above the root, restore leading ..s
  if (allowAboveRoot) {
    for (; up--; up) {
      parts.unshift('..');
    }
  }

  return parts;
}

// path.resolve([from ...], to)
// posix version
exports.resolve = function() {
  var resolvedPath = '',
      resolvedAbsolute = false;

  for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
    var path = (i >= 0) ? arguments[i] : process.cwd();

    // Skip empty and invalid entries
    if (typeof path !== 'string') {
      throw new TypeError('Arguments to path.resolve must be strings');
    } else if (!path) {
      continue;
    }

    resolvedPath = path + '/' + resolvedPath;
    resolvedAbsolute = path.charAt(0) === '/';
  }

  // At this point the path should be resolved to a full absolute path, but
  // handle relative paths to be safe (might happen when process.cwd() fails)

  // Normalize the path
  resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
    return !!p;
  }), !resolvedAbsolute).join('/');

  return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
};

// path.normalize(path)
// posix version
exports.normalize = function(path) {
  var isAbsolute = exports.isAbsolute(path),
      trailingSlash = substr(path, -1) === '/';

  // Normalize the path
  path = normalizeArray(filter(path.split('/'), function(p) {
    return !!p;
  }), !isAbsolute).join('/');

  if (!path && !isAbsolute) {
    path = '.';
  }
  if (path && trailingSlash) {
    path += '/';
  }

  return (isAbsolute ? '/' : '') + path;
};

// posix version
exports.isAbsolute = function(path) {
  return path.charAt(0) === '/';
};

// posix version
exports.join = function() {
  var paths = Array.prototype.slice.call(arguments, 0);
  return exports.normalize(filter(paths, function(p, index) {
    if (typeof p !== 'string') {
      throw new TypeError('Arguments to path.join must be strings');
    }
    return p;
  }).join('/'));
};


// path.relative(from, to)
// posix version
exports.relative = function(from, to) {
  from = exports.resolve(from).substr(1);
  to = exports.resolve(to).substr(1);

  function trim(arr) {
    var start = 0;
    for (; start < arr.length; start++) {
      if (arr[start] !== '') break;
    }

    var end = arr.length - 1;
    for (; end >= 0; end--) {
      if (arr[end] !== '') break;
    }

    if (start > end) return [];
    return arr.slice(start, end - start + 1);
  }

  var fromParts = trim(from.split('/'));
  var toParts = trim(to.split('/'));

  var length = Math.min(fromParts.length, toParts.length);
  var samePartsLength = length;
  for (var i = 0; i < length; i++) {
    if (fromParts[i] !== toParts[i]) {
      samePartsLength = i;
      break;
    }
  }

  var outputParts = [];
  for (var i = samePartsLength; i < fromParts.length; i++) {
    outputParts.push('..');
  }

  outputParts = outputParts.concat(toParts.slice(samePartsLength));

  return outputParts.join('/');
};

exports.sep = '/';
exports.delimiter = ':';

exports.dirname = function (path) {
  if (typeof path !== 'string') path = path + '';
  if (path.length === 0) return '.';
  var code = path.charCodeAt(0);
  var hasRoot = code === 47 /*/*/;
  var end = -1;
  var matchedSlash = true;
  for (var i = path.length - 1; i >= 1; --i) {
    code = path.charCodeAt(i);
    if (code === 47 /*/*/) {
        if (!matchedSlash) {
          end = i;
          break;
        }
      } else {
      // We saw the first non-path separator
      matchedSlash = false;
    }
  }

  if (end === -1) return hasRoot ? '/' : '.';
  if (hasRoot && end === 1) {
    // return '//';
    // Backwards-compat fix:
    return '/';
  }
  return path.slice(0, end);
};

function basename(path) {
  if (typeof path !== 'string') path = path + '';

  var start = 0;
  var end = -1;
  var matchedSlash = true;
  var i;

  for (i = path.length - 1; i >= 0; --i) {
    if (path.charCodeAt(i) === 47 /*/*/) {
        // If we reached a path separator that was not part of a set of path
        // separators at the end of the string, stop now
        if (!matchedSlash) {
          start = i + 1;
          break;
        }
      } else if (end === -1) {
      // We saw the first non-path separator, mark this as the end of our
      // path component
      matchedSlash = false;
      end = i + 1;
    }
  }

  if (end === -1) return '';
  return path.slice(start, end);
}

// Uses a mixed approach for backwards-compatibility, as ext behavior changed
// in new Node.js versions, so only basename() above is backported here
exports.basename = function (path, ext) {
  var f = basename(path);
  if (ext && f.substr(-1 * ext.length) === ext) {
    f = f.substr(0, f.length - ext.length);
  }
  return f;
};

exports.extname = function (path) {
  if (typeof path !== 'string') path = path + '';
  var startDot = -1;
  var startPart = 0;
  var end = -1;
  var matchedSlash = true;
  // Track the state of characters (if any) we see before our first dot and
  // after any path separator we find
  var preDotState = 0;
  for (var i = path.length - 1; i >= 0; --i) {
    var code = path.charCodeAt(i);
    if (code === 47 /*/*/) {
        // If we reached a path separator that was not part of a set of path
        // separators at the end of the string, stop now
        if (!matchedSlash) {
          startPart = i + 1;
          break;
        }
        continue;
      }
    if (end === -1) {
      // We saw the first non-path separator, mark this as the end of our
      // extension
      matchedSlash = false;
      end = i + 1;
    }
    if (code === 46 /*.*/) {
        // If this is our first dot, mark it as the start of our extension
        if (startDot === -1)
          startDot = i;
        else if (preDotState !== 1)
          preDotState = 1;
    } else if (startDot !== -1) {
      // We saw a non-dot and non-path separator before our dot, so we should
      // have a good chance at having a non-empty extension
      preDotState = -1;
    }
  }

  if (startDot === -1 || end === -1 ||
      // We saw a non-dot character immediately before the dot
      preDotState === 0 ||
      // The (right-most) trimmed path component is exactly '..'
      preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
    return '';
  }
  return path.slice(startDot, end);
};

function filter (xs, f) {
    if (xs.filter) return xs.filter(f);
    var res = [];
    for (var i = 0; i < xs.length; i++) {
        if (f(xs[i], i, xs)) res.push(xs[i]);
    }
    return res;
}

// String.prototype.substr - negative index don't work in IE8
var substr = 'ab'.substr(-1) === 'b'
    ? function (str, start, len) { return str.substr(start, len) }
    : function (str, start, len) {
        if (start < 0) start = str.length + start;
        return str.substr(start, len);
    }
;

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("4362")))

/***/ }),

/***/ "e01a":
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// `Symbol.prototype.description` getter
// https://tc39.es/ecma262/#sec-symbol.prototype.description

var $ = __webpack_require__("23e7");
var DESCRIPTORS = __webpack_require__("83ab");
var global = __webpack_require__("da84");
var hasOwn = __webpack_require__("1a2d");
var isCallable = __webpack_require__("1626");
var isObject = __webpack_require__("861d");
var defineProperty = __webpack_require__("9bf2").f;
var copyConstructorProperties = __webpack_require__("e893");

var NativeSymbol = global.Symbol;

if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in NativeSymbol.prototype) ||
  // Safari 12 bug
  NativeSymbol().description !== undefined
)) {
  var EmptyStringDescriptionStore = {};
  // wrap Symbol constructor for correct work with undefined description
  var SymbolWrapper = function Symbol() {
    var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
    var result = this instanceof SymbolWrapper
      ? new NativeSymbol(description)
      // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
      : description === undefined ? NativeSymbol() : NativeSymbol(description);
    if (description === '') EmptyStringDescriptionStore[result] = true;
    return result;
  };
  copyConstructorProperties(SymbolWrapper, NativeSymbol);
  var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
  symbolPrototype.constructor = SymbolWrapper;

  var symbolToString = symbolPrototype.toString;
  var nativeSymbol = String(NativeSymbol('test')) == 'Symbol(test)';
  var regexp = /^Symbol\((.*)\)[^)]+$/;
  defineProperty(symbolPrototype, 'description', {
    configurable: true,
    get: function description() {
      var symbol = isObject(this) ? this.valueOf() : this;
      var string = symbolToString.call(symbol);
      if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
      var desc = nativeSymbol ? string.slice(7, -1) : string.replace(regexp, '$1');
      return desc === '' ? undefined : desc;
    }
  });

  $({ global: true, forced: true }, {
    Symbol: SymbolWrapper
  });
}


/***/ }),

/***/ "e12f":
/***/ (function(module, exports) {

// parse out just the options we care about so we always get a consistent
// obj with keys in a consistent order.
const opts = ['includePrerelease', 'loose', 'rtl']
const parseOptions = options =>
  !options ? {}
  : typeof options !== 'object' ? { loose: true }
  : opts.filter(k => options[k]).reduce((options, k) => {
    options[k] = true
    return options
  }, {})
module.exports = parseOptions


/***/ }),

/***/ "e163":
/***/ (function(module, exports, __webpack_require__) {

var hasOwn = __webpack_require__("1a2d");
var isCallable = __webpack_require__("1626");
var toObject = __webpack_require__("7b0b");
var sharedKey = __webpack_require__("f772");
var CORRECT_PROTOTYPE_GETTER = __webpack_require__("e177");

var IE_PROTO = sharedKey('IE_PROTO');
var ObjectPrototype = Object.prototype;

// `Object.getPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.getprototypeof
// eslint-disable-next-line es/no-object-getprototypeof -- safe
module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
  var object = toObject(O);
  if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
  var constructor = object.constructor;
  if (isCallable(constructor) && object instanceof constructor) {
    return constructor.prototype;
  } return object instanceof Object ? ObjectPrototype : null;
};


/***/ }),

/***/ "e177":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");

module.exports = !fails(function () {
  function F() { /* empty */ }
  F.prototype.constructor = null;
  // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
  return Object.getPrototypeOf(new F()) !== F.prototype;
});


/***/ }),

/***/ "e25e":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var $parseInt = __webpack_require__("c20d");

// `parseInt` method
// https://tc39.es/ecma262/#sec-parseint-string-radix
$({ global: true, forced: parseInt != $parseInt }, {
  parseInt: $parseInt
});


/***/ }),

/***/ "e260":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var toIndexedObject = __webpack_require__("fc6a");
var addToUnscopables = __webpack_require__("44d2");
var Iterators = __webpack_require__("3f8c");
var InternalStateModule = __webpack_require__("69f3");
var defineIterator = __webpack_require__("7dd0");

var ARRAY_ITERATOR = 'Array Iterator';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);

// `Array.prototype.entries` method
// https://tc39.es/ecma262/#sec-array.prototype.entries
// `Array.prototype.keys` method
// https://tc39.es/ecma262/#sec-array.prototype.keys
// `Array.prototype.values` method
// https://tc39.es/ecma262/#sec-array.prototype.values
// `Array.prototype[@@iterator]` method
// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
// `CreateArrayIterator` internal method
// https://tc39.es/ecma262/#sec-createarrayiterator
module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  setInternalState(this, {
    type: ARRAY_ITERATOR,
    target: toIndexedObject(iterated), // target
    index: 0,                          // next index
    kind: kind                         // kind
  });
// `%ArrayIteratorPrototype%.next` method
// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
}, function () {
  var state = getInternalState(this);
  var target = state.target;
  var kind = state.kind;
  var index = state.index++;
  if (!target || index >= target.length) {
    state.target = undefined;
    return { value: undefined, done: true };
  }
  if (kind == 'keys') return { value: index, done: false };
  if (kind == 'values') return { value: target[index], done: false };
  return { value: [index, target[index]], done: false };
}, 'values');

// argumentsList[@@iterator] is %ArrayProto_values%
// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
// https://tc39.es/ecma262/#sec-createmappedargumentsobject
Iterators.Arguments = Iterators.Array;

// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');


/***/ }),

/***/ "e285":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");

var globalIsFinite = global.isFinite;

// `Number.isFinite` method
// https://tc39.es/ecma262/#sec-number.isfinite
// eslint-disable-next-line es/no-number-isfinite -- safe
module.exports = Number.isFinite || function isFinite(it) {
  return typeof it == 'number' && globalIsFinite(it);
};


/***/ }),

/***/ "e2cc":
/***/ (function(module, exports, __webpack_require__) {

var redefine = __webpack_require__("6eeb");

module.exports = function (target, src, options) {
  for (var key in src) redefine(target, key, src[key], options);
  return target;
};


/***/ }),

/***/ "e3db":
/***/ (function(module, exports) {

var toString = {}.toString;

module.exports = Array.isArray || function (arr) {
  return toString.call(arr) == '[object Array]';
};


/***/ }),

/***/ "e439":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var fails = __webpack_require__("d039");
var toIndexedObject = __webpack_require__("fc6a");
var nativeGetOwnPropertyDescriptor = __webpack_require__("06cf").f;
var DESCRIPTORS = __webpack_require__("83ab");

var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;

// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
  getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
    return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
  }
});


/***/ }),

/***/ "e538":
/***/ (function(module, exports, __webpack_require__) {

var wellKnownSymbol = __webpack_require__("b622");

exports.f = wellKnownSymbol;


/***/ }),

/***/ "e58c":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/* eslint-disable es/no-array-prototype-lastindexof -- safe */
var toIndexedObject = __webpack_require__("fc6a");
var toIntegerOrInfinity = __webpack_require__("5926");
var lengthOfArrayLike = __webpack_require__("07fa");
var arrayMethodIsStrict = __webpack_require__("a640");

var min = Math.min;
var $lastIndexOf = [].lastIndexOf;
var NEGATIVE_ZERO = !!$lastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
var STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');
var FORCED = NEGATIVE_ZERO || !STRICT_METHOD;

// `Array.prototype.lastIndexOf` method implementation
// https://tc39.es/ecma262/#sec-array.prototype.lastindexof
module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
  // convert -0 to +0
  if (NEGATIVE_ZERO) return $lastIndexOf.apply(this, arguments) || 0;
  var O = toIndexedObject(this);
  var length = lengthOfArrayLike(O);
  var index = length - 1;
  if (arguments.length > 1) index = min(index, toIntegerOrInfinity(arguments[1]));
  if (index < 0) index = length + index;
  for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
  return -1;
} : $lastIndexOf;


/***/ }),

/***/ "e667":
/***/ (function(module, exports) {

module.exports = function (exec) {
  try {
    return { error: false, value: exec() };
  } catch (error) {
    return { error: true, value: error };
  }
};


/***/ }),

/***/ "e6cf":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var IS_PURE = __webpack_require__("c430");
var global = __webpack_require__("da84");
var getBuiltIn = __webpack_require__("d066");
var NativePromise = __webpack_require__("fea9");
var redefine = __webpack_require__("6eeb");
var redefineAll = __webpack_require__("e2cc");
var setPrototypeOf = __webpack_require__("d2bb");
var setToStringTag = __webpack_require__("d44e");
var setSpecies = __webpack_require__("2626");
var aCallable = __webpack_require__("59ed");
var isCallable = __webpack_require__("1626");
var isObject = __webpack_require__("861d");
var anInstance = __webpack_require__("19aa");
var inspectSource = __webpack_require__("8925");
var iterate = __webpack_require__("2266");
var checkCorrectnessOfIteration = __webpack_require__("1c7e");
var speciesConstructor = __webpack_require__("4840");
var task = __webpack_require__("2cf4").set;
var microtask = __webpack_require__("b575");
var promiseResolve = __webpack_require__("cdf9");
var hostReportErrors = __webpack_require__("44de");
var newPromiseCapabilityModule = __webpack_require__("f069");
var perform = __webpack_require__("e667");
var InternalStateModule = __webpack_require__("69f3");
var isForced = __webpack_require__("94ca");
var wellKnownSymbol = __webpack_require__("b622");
var IS_BROWSER = __webpack_require__("6069");
var IS_NODE = __webpack_require__("605d");
var V8_VERSION = __webpack_require__("2d00");

var SPECIES = wellKnownSymbol('species');
var PROMISE = 'Promise';
var getInternalState = InternalStateModule.get;
var setInternalState = InternalStateModule.set;
var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
var NativePromisePrototype = NativePromise && NativePromise.prototype;
var PromiseConstructor = NativePromise;
var PromiseConstructorPrototype = NativePromisePrototype;
var TypeError = global.TypeError;
var document = global.document;
var process = global.process;
var newPromiseCapability = newPromiseCapabilityModule.f;
var newGenericPromiseCapability = newPromiseCapability;
var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
var NATIVE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
var UNHANDLED_REJECTION = 'unhandledrejection';
var REJECTION_HANDLED = 'rejectionhandled';
var PENDING = 0;
var FULFILLED = 1;
var REJECTED = 2;
var HANDLED = 1;
var UNHANDLED = 2;
var SUBCLASSING = false;
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;

var FORCED = isForced(PROMISE, function () {
  var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
  var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
  // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  // We can't detect it synchronously, so just check versions
  if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
  // We need Promise#finally in the pure version for preventing prototype pollution
  if (IS_PURE && !PromiseConstructorPrototype['finally']) return true;
  // We can't use @@species feature detection in V8 since it causes
  // deoptimization and performance degradation
  // https://github.com/zloirock/core-js/issues/679
  if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
  // Detect correctness of subclassing with @@species support
  var promise = new PromiseConstructor(function (resolve) { resolve(1); });
  var FakePromise = function (exec) {
    exec(function () { /* empty */ }, function () { /* empty */ });
  };
  var constructor = promise.constructor = {};
  constructor[SPECIES] = FakePromise;
  SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
  if (!SUBCLASSING) return true;
  // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT;
});

var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
  PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
});

// helpers
var isThenable = function (it) {
  var then;
  return isObject(it) && isCallable(then = it.then) ? then : false;
};

var notify = function (state, isReject) {
  if (state.notified) return;
  state.notified = true;
  var chain = state.reactions;
  microtask(function () {
    var value = state.value;
    var ok = state.state == FULFILLED;
    var index = 0;
    // variable length - can't use forEach
    while (chain.length > index) {
      var reaction = chain[index++];
      var handler = ok ? reaction.ok : reaction.fail;
      var resolve = reaction.resolve;
      var reject = reaction.reject;
      var domain = reaction.domain;
      var result, then, exited;
      try {
        if (handler) {
          if (!ok) {
            if (state.rejection === UNHANDLED) onHandleUnhandled(state);
            state.rejection = HANDLED;
          }
          if (handler === true) result = value;
          else {
            if (domain) domain.enter();
            result = handler(value); // can throw
            if (domain) {
              domain.exit();
              exited = true;
            }
          }
          if (result === reaction.promise) {
            reject(TypeError('Promise-chain cycle'));
          } else if (then = isThenable(result)) {
            then.call(result, resolve, reject);
          } else resolve(result);
        } else reject(value);
      } catch (error) {
        if (domain && !exited) domain.exit();
        reject(error);
      }
    }
    state.reactions = [];
    state.notified = false;
    if (isReject && !state.rejection) onUnhandled(state);
  });
};

var dispatchEvent = function (name, promise, reason) {
  var event, handler;
  if (DISPATCH_EVENT) {
    event = document.createEvent('Event');
    event.promise = promise;
    event.reason = reason;
    event.initEvent(name, false, true);
    global.dispatchEvent(event);
  } else event = { promise: promise, reason: reason };
  if (!NATIVE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
  else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
};

var onUnhandled = function (state) {
  task.call(global, function () {
    var promise = state.facade;
    var value = state.value;
    var IS_UNHANDLED = isUnhandled(state);
    var result;
    if (IS_UNHANDLED) {
      result = perform(function () {
        if (IS_NODE) {
          process.emit('unhandledRejection', value, promise);
        } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
      });
      // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
      state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
      if (result.error) throw result.value;
    }
  });
};

var isUnhandled = function (state) {
  return state.rejection !== HANDLED && !state.parent;
};

var onHandleUnhandled = function (state) {
  task.call(global, function () {
    var promise = state.facade;
    if (IS_NODE) {
      process.emit('rejectionHandled', promise);
    } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
  });
};

var bind = function (fn, state, unwrap) {
  return function (value) {
    fn(state, value, unwrap);
  };
};

var internalReject = function (state, value, unwrap) {
  if (state.done) return;
  state.done = true;
  if (unwrap) state = unwrap;
  state.value = value;
  state.state = REJECTED;
  notify(state, true);
};

var internalResolve = function (state, value, unwrap) {
  if (state.done) return;
  state.done = true;
  if (unwrap) state = unwrap;
  try {
    if (state.facade === value) throw TypeError("Promise can't be resolved itself");
    var then = isThenable(value);
    if (then) {
      microtask(function () {
        var wrapper = { done: false };
        try {
          then.call(value,
            bind(internalResolve, wrapper, state),
            bind(internalReject, wrapper, state)
          );
        } catch (error) {
          internalReject(wrapper, error, state);
        }
      });
    } else {
      state.value = value;
      state.state = FULFILLED;
      notify(state, false);
    }
  } catch (error) {
    internalReject({ done: false }, error, state);
  }
};

// constructor polyfill
if (FORCED) {
  // 25.4.3.1 Promise(executor)
  PromiseConstructor = function Promise(executor) {
    anInstance(this, PromiseConstructor, PROMISE);
    aCallable(executor);
    Internal.call(this);
    var state = getInternalState(this);
    try {
      executor(bind(internalResolve, state), bind(internalReject, state));
    } catch (error) {
      internalReject(state, error);
    }
  };
  PromiseConstructorPrototype = PromiseConstructor.prototype;
  // eslint-disable-next-line no-unused-vars -- required for `.length`
  Internal = function Promise(executor) {
    setInternalState(this, {
      type: PROMISE,
      done: false,
      notified: false,
      parent: false,
      reactions: [],
      rejection: false,
      state: PENDING,
      value: undefined
    });
  };
  Internal.prototype = redefineAll(PromiseConstructorPrototype, {
    // `Promise.prototype.then` method
    // https://tc39.es/ecma262/#sec-promise.prototype.then
    then: function then(onFulfilled, onRejected) {
      var state = getInternalPromiseState(this);
      var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
      reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
      reaction.fail = isCallable(onRejected) && onRejected;
      reaction.domain = IS_NODE ? process.domain : undefined;
      state.parent = true;
      state.reactions.push(reaction);
      if (state.state != PENDING) notify(state, false);
      return reaction.promise;
    },
    // `Promise.prototype.catch` method
    // https://tc39.es/ecma262/#sec-promise.prototype.catch
    'catch': function (onRejected) {
      return this.then(undefined, onRejected);
    }
  });
  OwnPromiseCapability = function () {
    var promise = new Internal();
    var state = getInternalState(promise);
    this.promise = promise;
    this.resolve = bind(internalResolve, state);
    this.reject = bind(internalReject, state);
  };
  newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
    return C === PromiseConstructor || C === PromiseWrapper
      ? new OwnPromiseCapability(C)
      : newGenericPromiseCapability(C);
  };

  if (!IS_PURE && isCallable(NativePromise) && NativePromisePrototype !== Object.prototype) {
    nativeThen = NativePromisePrototype.then;

    if (!SUBCLASSING) {
      // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
      redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
        var that = this;
        return new PromiseConstructor(function (resolve, reject) {
          nativeThen.call(that, resolve, reject);
        }).then(onFulfilled, onRejected);
      // https://github.com/zloirock/core-js/issues/640
      }, { unsafe: true });

      // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
      redefine(NativePromisePrototype, 'catch', PromiseConstructorPrototype['catch'], { unsafe: true });
    }

    // make `.constructor === Promise` work for native promise-based APIs
    try {
      delete NativePromisePrototype.constructor;
    } catch (error) { /* empty */ }

    // make `instanceof Promise` work for native promise-based APIs
    if (setPrototypeOf) {
      setPrototypeOf(NativePromisePrototype, PromiseConstructorPrototype);
    }
  }
}

$({ global: true, wrap: true, forced: FORCED }, {
  Promise: PromiseConstructor
});

setToStringTag(PromiseConstructor, PROMISE, false, true);
setSpecies(PROMISE);

PromiseWrapper = getBuiltIn(PROMISE);

// statics
$({ target: PROMISE, stat: true, forced: FORCED }, {
  // `Promise.reject` method
  // https://tc39.es/ecma262/#sec-promise.reject
  reject: function reject(r) {
    var capability = newPromiseCapability(this);
    capability.reject.call(undefined, r);
    return capability.promise;
  }
});

$({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, {
  // `Promise.resolve` method
  // https://tc39.es/ecma262/#sec-promise.resolve
  resolve: function resolve(x) {
    return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);
  }
});

$({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
  // `Promise.all` method
  // https://tc39.es/ecma262/#sec-promise.all
  all: function all(iterable) {
    var C = this;
    var capability = newPromiseCapability(C);
    var resolve = capability.resolve;
    var reject = capability.reject;
    var result = perform(function () {
      var $promiseResolve = aCallable(C.resolve);
      var values = [];
      var counter = 0;
      var remaining = 1;
      iterate(iterable, function (promise) {
        var index = counter++;
        var alreadyCalled = false;
        values.push(undefined);
        remaining++;
        $promiseResolve.call(C, promise).then(function (value) {
          if (alreadyCalled) return;
          alreadyCalled = true;
          values[index] = value;
          --remaining || resolve(values);
        }, reject);
      });
      --remaining || resolve(values);
    });
    if (result.error) reject(result.value);
    return capability.promise;
  },
  // `Promise.race` method
  // https://tc39.es/ecma262/#sec-promise.race
  race: function race(iterable) {
    var C = this;
    var capability = newPromiseCapability(C);
    var reject = capability.reject;
    var result = perform(function () {
      var $promiseResolve = aCallable(C.resolve);
      iterate(iterable, function (promise) {
        $promiseResolve.call(C, promise).then(capability.resolve, reject);
      });
    });
    if (result.error) reject(result.value);
    return capability.promise;
  }
});


/***/ }),

/***/ "e893":
/***/ (function(module, exports, __webpack_require__) {

var hasOwn = __webpack_require__("1a2d");
var ownKeys = __webpack_require__("56ef");
var getOwnPropertyDescriptorModule = __webpack_require__("06cf");
var definePropertyModule = __webpack_require__("9bf2");

module.exports = function (target, source) {
  var keys = ownKeys(source);
  var defineProperty = definePropertyModule.f;
  var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  for (var i = 0; i < keys.length; i++) {
    var key = keys[i];
    if (!hasOwn(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  }
};


/***/ }),

/***/ "e8b5":
/***/ (function(module, exports, __webpack_require__) {

var classof = __webpack_require__("c6b6");

// `IsArray` abstract operation
// https://tc39.es/ecma262/#sec-isarray
// eslint-disable-next-line es/no-array-isarray -- safe
module.exports = Array.isArray || function isArray(argument) {
  return classof(argument) == 'Array';
};


/***/ }),

/***/ "e95a":
/***/ (function(module, exports, __webpack_require__) {

var wellKnownSymbol = __webpack_require__("b622");
var Iterators = __webpack_require__("3f8c");

var ITERATOR = wellKnownSymbol('iterator');
var ArrayPrototype = Array.prototype;

// check on default Array iterator
module.exports = function (it) {
  return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
};


/***/ }),

/***/ "ebb5":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var NATIVE_ARRAY_BUFFER = __webpack_require__("a981");
var DESCRIPTORS = __webpack_require__("83ab");
var global = __webpack_require__("da84");
var isCallable = __webpack_require__("1626");
var isObject = __webpack_require__("861d");
var hasOwn = __webpack_require__("1a2d");
var classof = __webpack_require__("f5df");
var tryToString = __webpack_require__("0d51");
var createNonEnumerableProperty = __webpack_require__("9112");
var redefine = __webpack_require__("6eeb");
var defineProperty = __webpack_require__("9bf2").f;
var getPrototypeOf = __webpack_require__("e163");
var setPrototypeOf = __webpack_require__("d2bb");
var wellKnownSymbol = __webpack_require__("b622");
var uid = __webpack_require__("90e3");

var Int8Array = global.Int8Array;
var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
var Uint8ClampedArray = global.Uint8ClampedArray;
var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
var TypedArray = Int8Array && getPrototypeOf(Int8Array);
var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
var ObjectPrototype = Object.prototype;
var isPrototypeOf = ObjectPrototype.isPrototypeOf;

var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
var TYPED_ARRAY_CONSTRUCTOR = uid('TYPED_ARRAY_CONSTRUCTOR');
// Fixing native typed arrays in Opera Presto crashes the browser, see #595
var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
var TYPED_ARRAY_TAG_REQIRED = false;
var NAME, Constructor, Prototype;

var TypedArrayConstructorsList = {
  Int8Array: 1,
  Uint8Array: 1,
  Uint8ClampedArray: 1,
  Int16Array: 2,
  Uint16Array: 2,
  Int32Array: 4,
  Uint32Array: 4,
  Float32Array: 4,
  Float64Array: 8
};

var BigIntArrayConstructorsList = {
  BigInt64Array: 8,
  BigUint64Array: 8
};

var isView = function isView(it) {
  if (!isObject(it)) return false;
  var klass = classof(it);
  return klass === 'DataView'
    || hasOwn(TypedArrayConstructorsList, klass)
    || hasOwn(BigIntArrayConstructorsList, klass);
};

var isTypedArray = function (it) {
  if (!isObject(it)) return false;
  var klass = classof(it);
  return hasOwn(TypedArrayConstructorsList, klass)
    || hasOwn(BigIntArrayConstructorsList, klass);
};

var aTypedArray = function (it) {
  if (isTypedArray(it)) return it;
  throw TypeError('Target is not a typed array');
};

var aTypedArrayConstructor = function (C) {
  if (isCallable(C) && (!setPrototypeOf || isPrototypeOf.call(TypedArray, C))) return C;
  throw TypeError(tryToString(C) + ' is not a typed array constructor');
};

var exportTypedArrayMethod = function (KEY, property, forced) {
  if (!DESCRIPTORS) return;
  if (forced) for (var ARRAY in TypedArrayConstructorsList) {
    var TypedArrayConstructor = global[ARRAY];
    if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try {
      delete TypedArrayConstructor.prototype[KEY];
    } catch (error) { /* empty */ }
  }
  if (!TypedArrayPrototype[KEY] || forced) {
    redefine(TypedArrayPrototype, KEY, forced ? property
      : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property);
  }
};

var exportTypedArrayStaticMethod = function (KEY, property, forced) {
  var ARRAY, TypedArrayConstructor;
  if (!DESCRIPTORS) return;
  if (setPrototypeOf) {
    if (forced) for (ARRAY in TypedArrayConstructorsList) {
      TypedArrayConstructor = global[ARRAY];
      if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY)) try {
        delete TypedArrayConstructor[KEY];
      } catch (error) { /* empty */ }
    }
    if (!TypedArray[KEY] || forced) {
      // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
      try {
        return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
      } catch (error) { /* empty */ }
    } else return;
  }
  for (ARRAY in TypedArrayConstructorsList) {
    TypedArrayConstructor = global[ARRAY];
    if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
      redefine(TypedArrayConstructor, KEY, property);
    }
  }
};

for (NAME in TypedArrayConstructorsList) {
  Constructor = global[NAME];
  Prototype = Constructor && Constructor.prototype;
  if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
  else NATIVE_ARRAY_BUFFER_VIEWS = false;
}

for (NAME in BigIntArrayConstructorsList) {
  Constructor = global[NAME];
  Prototype = Constructor && Constructor.prototype;
  if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
}

// WebKit bug - typed arrays constructors prototype is Object.prototype
if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
  // eslint-disable-next-line no-shadow -- safe
  TypedArray = function TypedArray() {
    throw TypeError('Incorrect invocation');
  };
  if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
    if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);
  }
}

if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
  TypedArrayPrototype = TypedArray.prototype;
  if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
    if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
  }
}

// WebKit bug - one more object in Uint8ClampedArray prototype chain
if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
  setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
}

if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {
  TYPED_ARRAY_TAG_REQIRED = true;
  defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () {
    return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
  } });
  for (NAME in TypedArrayConstructorsList) if (global[NAME]) {
    createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
  }
}

module.exports = {
  NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
  TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR,
  TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
  aTypedArray: aTypedArray,
  aTypedArrayConstructor: aTypedArrayConstructor,
  exportTypedArrayMethod: exportTypedArrayMethod,
  exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
  isView: isView,
  isTypedArray: isTypedArray,
  TypedArray: TypedArray,
  TypedArrayPrototype: TypedArrayPrototype
};


/***/ }),

/***/ "eec3":
/***/ (function(module, exports, __webpack_require__) {

const compare = __webpack_require__("f06c")
const gt = (a, b, loose) => compare(a, b, loose) > 0
module.exports = gt


/***/ }),

/***/ "eecb":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return tickIncrement; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return tickStep; });
var e10 = Math.sqrt(50),
    e5 = Math.sqrt(10),
    e2 = Math.sqrt(2);

/* harmony default export */ __webpack_exports__["a"] = (function(start, stop, count) {
  var reverse,
      i = -1,
      n,
      ticks,
      step;

  stop = +stop, start = +start, count = +count;
  if (start === stop && count > 0) return [start];
  if (reverse = stop < start) n = start, start = stop, stop = n;
  if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];

  if (step > 0) {
    let r0 = Math.round(start / step), r1 = Math.round(stop / step);
    if (r0 * step < start) ++r0;
    if (r1 * step > stop) --r1;
    ticks = new Array(n = r1 - r0 + 1);
    while (++i < n) ticks[i] = (r0 + i) * step;
  } else {
    step = -step;
    let r0 = Math.round(start * step), r1 = Math.round(stop * step);
    if (r0 / step < start) ++r0;
    if (r1 / step > stop) --r1;
    ticks = new Array(n = r1 - r0 + 1);
    while (++i < n) ticks[i] = (r0 + i) / step;
  }

  if (reverse) ticks.reverse();

  return ticks;
});

function tickIncrement(start, stop, count) {
  var step = (stop - start) / Math.max(0, count),
      power = Math.floor(Math.log(step) / Math.LN10),
      error = step / Math.pow(10, power);
  return power >= 0
      ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)
      : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
}

function tickStep(start, stop, count) {
  var step0 = Math.abs(stop - start) / Math.max(0, count),
      step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
      error = step0 / step1;
  if (error >= e10) step1 *= 10;
  else if (error >= e5) step1 *= 5;
  else if (error >= e2) step1 *= 2;
  return stop < start ? -step1 : step1;
}


/***/ }),

/***/ "f00c":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var numberIsFinite = __webpack_require__("e285");

// `Number.isFinite` method
// https://tc39.es/ecma262/#sec-number.isfinite
$({ target: 'Number', stat: true }, { isFinite: numberIsFinite });


/***/ }),

/***/ "f069":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var aCallable = __webpack_require__("59ed");

var PromiseCapability = function (C) {
  var resolve, reject;
  this.promise = new C(function ($$resolve, $$reject) {
    if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
    resolve = $$resolve;
    reject = $$reject;
  });
  this.resolve = aCallable(resolve);
  this.reject = aCallable(reject);
};

// `NewPromiseCapability` abstract operation
// https://tc39.es/ecma262/#sec-newpromisecapability
module.exports.f = function (C) {
  return new PromiseCapability(C);
};


/***/ }),

/***/ "f06c":
/***/ (function(module, exports, __webpack_require__) {

const SemVer = __webpack_require__("df02")
const compare = (a, b, loose) =>
  new SemVer(a, loose).compare(new SemVer(b, loose))

module.exports = compare


/***/ }),

/***/ "f182":
/***/ (function(module, exports, __webpack_require__) {

const compare = __webpack_require__("f06c")
const compareLoose = (a, b) => compare(a, b, true)
module.exports = compareLoose


/***/ }),

/***/ "f183":
/***/ (function(module, exports, __webpack_require__) {

var $ = __webpack_require__("23e7");
var hiddenKeys = __webpack_require__("d012");
var isObject = __webpack_require__("861d");
var hasOwn = __webpack_require__("1a2d");
var defineProperty = __webpack_require__("9bf2").f;
var getOwnPropertyNamesModule = __webpack_require__("241c");
var getOwnPropertyNamesExternalModule = __webpack_require__("057f");
var uid = __webpack_require__("90e3");
var FREEZING = __webpack_require__("bb2f");

var REQUIRED = false;
var METADATA = uid('meta');
var id = 0;

// eslint-disable-next-line es/no-object-isextensible -- safe
var isExtensible = Object.isExtensible || function () {
  return true;
};

var setMetadata = function (it) {
  defineProperty(it, METADATA, { value: {
    objectID: 'O' + id++, // object ID
    weakData: {}          // weak collections IDs
  } });
};

var fastKey = function (it, create) {
  // return a primitive with prefix
  if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  if (!hasOwn(it, METADATA)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return 'F';
    // not necessary to add metadata
    if (!create) return 'E';
    // add missing metadata
    setMetadata(it);
  // return object ID
  } return it[METADATA].objectID;
};

var getWeakData = function (it, create) {
  if (!hasOwn(it, METADATA)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return true;
    // not necessary to add metadata
    if (!create) return false;
    // add missing metadata
    setMetadata(it);
  // return the store of weak collections IDs
  } return it[METADATA].weakData;
};

// add metadata on freeze-family methods calling
var onFreeze = function (it) {
  if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
  return it;
};

var enable = function () {
  meta.enable = function () { /* empty */ };
  REQUIRED = true;
  var getOwnPropertyNames = getOwnPropertyNamesModule.f;
  var splice = [].splice;
  var test = {};
  test[METADATA] = 1;

  // prevent exposing of metadata key
  if (getOwnPropertyNames(test).length) {
    getOwnPropertyNamesModule.f = function (it) {
      var result = getOwnPropertyNames(it);
      for (var i = 0, length = result.length; i < length; i++) {
        if (result[i] === METADATA) {
          splice.call(result, i, 1);
          break;
        }
      } return result;
    };

    $({ target: 'Object', stat: true, forced: true }, {
      getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
    });
  }
};

var meta = module.exports = {
  enable: enable,
  fastKey: fastKey,
  getWeakData: getWeakData,
  onFreeze: onFreeze
};

hiddenKeys[METADATA] = true;


/***/ }),

/***/ "f5df":
/***/ (function(module, exports, __webpack_require__) {

var TO_STRING_TAG_SUPPORT = __webpack_require__("00ee");
var isCallable = __webpack_require__("1626");
var classofRaw = __webpack_require__("c6b6");
var wellKnownSymbol = __webpack_require__("b622");

var TO_STRING_TAG = wellKnownSymbol('toStringTag');
// ES3 wrong here
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';

// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
  try {
    return it[key];
  } catch (error) { /* empty */ }
};

// getting tag from ES6+ `Object.prototype.toString`
module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  var O, tag, result;
  return it === undefined ? 'Undefined' : it === null ? 'Null'
    // @@toStringTag case
    : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
    // builtinTag case
    : CORRECT_ARGUMENTS ? classofRaw(O)
    // ES3 arguments fallback
    : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
};


/***/ }),

/***/ "f623":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export utcHours */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");
/* harmony import */ var _duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1738");



var utcHour = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setUTCMinutes(0, 0, 0);
}, function(date, step) {
  date.setTime(+date + step * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationHour */ "b"]);
}, function(start, end) {
  return (end - start) / _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationHour */ "b"];
}, function(date) {
  return date.getUTCHours();
});

/* harmony default export */ __webpack_exports__["a"] = (utcHour);
var utcHours = utcHour.range;


/***/ }),

/***/ "f71e":
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function (data, opts) {
    if (!opts) opts = {};
    if (typeof opts === 'function') opts = { cmp: opts };
    var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;

    var cmp = opts.cmp && (function (f) {
        return function (node) {
            return function (a, b) {
                var aobj = { key: a, value: node[a] };
                var bobj = { key: b, value: node[b] };
                return f(aobj, bobj);
            };
        };
    })(opts.cmp);

    var seen = [];
    return (function stringify (node) {
        if (node && node.toJSON && typeof node.toJSON === 'function') {
            node = node.toJSON();
        }

        if (node === undefined) return;
        if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';
        if (typeof node !== 'object') return JSON.stringify(node);

        var i, out;
        if (Array.isArray(node)) {
            out = '[';
            for (i = 0; i < node.length; i++) {
                if (i) out += ',';
                out += stringify(node[i]) || 'null';
            }
            return out + ']';
        }

        if (node === null) return 'null';

        if (seen.indexOf(node) !== -1) {
            if (cycles) return JSON.stringify('__cycle__');
            throw new TypeError('Converting circular structure to JSON');
        }

        var seenIndex = seen.push(node) - 1;
        var keys = Object.keys(node).sort(cmp && cmp(node));
        out = '';
        for (i = 0; i < keys.length; i++) {
            var key = keys[i];
            var value = stringify(node[key]);

            if (!value) continue;
            if (out) out += ',';
            out += JSON.stringify(key) + ':' + value;
        }
        seen.splice(seenIndex, 1);
        return '{' + out + '}';
    })(data);
};


/***/ }),

/***/ "f748":
/***/ (function(module, exports) {

// `Math.sign` method implementation
// https://tc39.es/ecma262/#sec-math.sign
// eslint-disable-next-line es/no-math-sign -- safe
module.exports = Math.sign || function sign(x) {
  // eslint-disable-next-line no-self-compare -- NaN check
  return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
};


/***/ }),

/***/ "f772":
/***/ (function(module, exports, __webpack_require__) {

var shared = __webpack_require__("5692");
var uid = __webpack_require__("90e3");

var keys = shared('keys');

module.exports = function (key) {
  return keys[key] || (keys[key] = uid(key));
};


/***/ }),

/***/ "f8ee":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export utcMinutes */
/* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("18e2");
/* harmony import */ var _duration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1738");



var utcMinute = Object(_interval_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function(date) {
  date.setUTCSeconds(0, 0);
}, function(date, step) {
  date.setTime(+date + step * _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationMinute */ "c"]);
}, function(start, end) {
  return (end - start) / _duration_js__WEBPACK_IMPORTED_MODULE_1__[/* durationMinute */ "c"];
}, function(date) {
  return date.getUTCMinutes();
});

/* harmony default export */ __webpack_exports__["a"] = (utcMinute);
var utcMinutes = utcMinute.range;


/***/ }),

/***/ "fb15":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// NAMESPACE OBJECT: ./node_modules/fast-json-patch/module/core.mjs
var core_namespaceObject = {};
__webpack_require__.r(core_namespaceObject);
__webpack_require__.d(core_namespaceObject, "JsonPatchError", function() { return JsonPatchError; });
__webpack_require__.d(core_namespaceObject, "deepClone", function() { return deepClone; });
__webpack_require__.d(core_namespaceObject, "getValueByPointer", function() { return getValueByPointer; });
__webpack_require__.d(core_namespaceObject, "applyOperation", function() { return applyOperation; });
__webpack_require__.d(core_namespaceObject, "applyPatch", function() { return applyPatch; });
__webpack_require__.d(core_namespaceObject, "applyReducer", function() { return applyReducer; });
__webpack_require__.d(core_namespaceObject, "validator", function() { return validator; });
__webpack_require__.d(core_namespaceObject, "validate", function() { return validate; });
__webpack_require__.d(core_namespaceObject, "_areEquals", function() { return _areEquals; });

// NAMESPACE OBJECT: ./node_modules/fast-json-patch/module/duplex.mjs
var duplex_namespaceObject = {};
__webpack_require__.r(duplex_namespaceObject);
__webpack_require__.d(duplex_namespaceObject, "unobserve", function() { return unobserve; });
__webpack_require__.d(duplex_namespaceObject, "observe", function() { return observe; });
__webpack_require__.d(duplex_namespaceObject, "generate", function() { return duplex_generate; });
__webpack_require__.d(duplex_namespaceObject, "compare", function() { return duplex_compare; });

// NAMESPACE OBJECT: ./node_modules/vega-transforms/build/vega-transforms.module.js
var vega_transforms_module_namespaceObject = {};
__webpack_require__.r(vega_transforms_module_namespaceObject);
__webpack_require__.d(vega_transforms_module_namespaceObject, "aggregate", function() { return Aggregate; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "bin", function() { return Bin; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "collect", function() { return Collect; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "compare", function() { return Compare; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "countpattern", function() { return CountPattern; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "cross", function() { return Cross; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "density", function() { return Density; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "dotbin", function() { return DotBin; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "expression", function() { return Expression; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "extent", function() { return Extent; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "facet", function() { return Facet; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "field", function() { return Field; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "filter", function() { return Filter; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "flatten", function() { return Flatten; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "fold", function() { return Fold; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "formula", function() { return Formula; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "generate", function() { return Generate; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "impute", function() { return Impute; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "joinaggregate", function() { return JoinAggregate; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "kde", function() { return KDE; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "key", function() { return Key; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "load", function() { return Load; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "lookup", function() { return Lookup; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "multiextent", function() { return MultiExtent; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "multivalues", function() { return MultiValues; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "params", function() { return Params; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "pivot", function() { return Pivot; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "prefacet", function() { return PreFacet; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "project", function() { return Project; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "proxy", function() { return vega_transforms_module_Proxy; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "quantile", function() { return Quantile; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "relay", function() { return Relay; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "sample", function() { return Sample; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "sequence", function() { return Sequence; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "sieve", function() { return Sieve; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "subflow", function() { return Subflow; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "timeunit", function() { return TimeUnit; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "tupleindex", function() { return TupleIndex; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "values", function() { return Values; });
__webpack_require__.d(vega_transforms_module_namespaceObject, "window", function() { return Window; });

// NAMESPACE OBJECT: ./node_modules/d3-interpolate/src/index.js
var src_namespaceObject = {};
__webpack_require__.r(src_namespaceObject);
__webpack_require__.d(src_namespaceObject, "interpolate", function() { return src_value; });
__webpack_require__.d(src_namespaceObject, "interpolateArray", function() { return d3_interpolate_src_array; });
__webpack_require__.d(src_namespaceObject, "interpolateBasis", function() { return src_basis; });
__webpack_require__.d(src_namespaceObject, "interpolateBasisClosed", function() { return src_basisClosed; });
__webpack_require__.d(src_namespaceObject, "interpolateDate", function() { return src_date; });
__webpack_require__.d(src_namespaceObject, "interpolateDiscrete", function() { return discrete; });
__webpack_require__.d(src_namespaceObject, "interpolateHue", function() { return src_hue; });
__webpack_require__.d(src_namespaceObject, "interpolateNumber", function() { return src_number; });
__webpack_require__.d(src_namespaceObject, "interpolateNumberArray", function() { return numberArray; });
__webpack_require__.d(src_namespaceObject, "interpolateObject", function() { return src_object; });
__webpack_require__.d(src_namespaceObject, "interpolateRound", function() { return src_round; });
__webpack_require__.d(src_namespaceObject, "interpolateString", function() { return src_string; });
__webpack_require__.d(src_namespaceObject, "interpolateTransformCss", function() { return interpolateTransformCss; });
__webpack_require__.d(src_namespaceObject, "interpolateTransformSvg", function() { return interpolateTransformSvg; });
__webpack_require__.d(src_namespaceObject, "interpolateZoom", function() { return zoom; });
__webpack_require__.d(src_namespaceObject, "interpolateRgb", function() { return src_rgb; });
__webpack_require__.d(src_namespaceObject, "interpolateRgbBasis", function() { return rgbBasis; });
__webpack_require__.d(src_namespaceObject, "interpolateRgbBasisClosed", function() { return rgbBasisClosed; });
__webpack_require__.d(src_namespaceObject, "interpolateHsl", function() { return src_hsl; });
__webpack_require__.d(src_namespaceObject, "interpolateHslLong", function() { return hslLong; });
__webpack_require__.d(src_namespaceObject, "interpolateLab", function() { return lab_lab; });
__webpack_require__.d(src_namespaceObject, "interpolateHcl", function() { return src_hcl; });
__webpack_require__.d(src_namespaceObject, "interpolateHclLong", function() { return hclLong; });
__webpack_require__.d(src_namespaceObject, "interpolateCubehelix", function() { return src_cubehelix; });
__webpack_require__.d(src_namespaceObject, "interpolateCubehelixLong", function() { return cubehelixLong; });
__webpack_require__.d(src_namespaceObject, "piecewise", function() { return piecewise_piecewise; });
__webpack_require__.d(src_namespaceObject, "quantize", function() { return src_quantize; });

// NAMESPACE OBJECT: ./node_modules/vega-view-transforms/build/vega-view-transforms.module.js
var vega_view_transforms_module_namespaceObject = {};
__webpack_require__.r(vega_view_transforms_module_namespaceObject);
__webpack_require__.d(vega_view_transforms_module_namespaceObject, "bound", function() { return Bound; });
__webpack_require__.d(vega_view_transforms_module_namespaceObject, "identifier", function() { return vega_view_transforms_module_Identifier; });
__webpack_require__.d(vega_view_transforms_module_namespaceObject, "mark", function() { return Mark; });
__webpack_require__.d(vega_view_transforms_module_namespaceObject, "overlap", function() { return Overlap; });
__webpack_require__.d(vega_view_transforms_module_namespaceObject, "render", function() { return Render; });
__webpack_require__.d(vega_view_transforms_module_namespaceObject, "viewlayout", function() { return ViewLayout; });

// NAMESPACE OBJECT: ./node_modules/vega-encode/build/vega-encode.module.js
var vega_encode_module_namespaceObject = {};
__webpack_require__.r(vega_encode_module_namespaceObject);
__webpack_require__.d(vega_encode_module_namespaceObject, "axisticks", function() { return AxisTicks; });
__webpack_require__.d(vega_encode_module_namespaceObject, "datajoin", function() { return DataJoin; });
__webpack_require__.d(vega_encode_module_namespaceObject, "encode", function() { return Encode; });
__webpack_require__.d(vega_encode_module_namespaceObject, "legendentries", function() { return LegendEntries; });
__webpack_require__.d(vega_encode_module_namespaceObject, "linkpath", function() { return LinkPath; });
__webpack_require__.d(vega_encode_module_namespaceObject, "pie", function() { return Pie; });
__webpack_require__.d(vega_encode_module_namespaceObject, "scale", function() { return Scale; });
__webpack_require__.d(vega_encode_module_namespaceObject, "sortitems", function() { return SortItems; });
__webpack_require__.d(vega_encode_module_namespaceObject, "stack", function() { return Stack; });

// NAMESPACE OBJECT: ./node_modules/vega-geo/build/vega-geo.module.js
var vega_geo_module_namespaceObject = {};
__webpack_require__.r(vega_geo_module_namespaceObject);
__webpack_require__.d(vega_geo_module_namespaceObject, "contour", function() { return Contour; });
__webpack_require__.d(vega_geo_module_namespaceObject, "geojson", function() { return GeoJSON; });
__webpack_require__.d(vega_geo_module_namespaceObject, "geopath", function() { return GeoPath; });
__webpack_require__.d(vega_geo_module_namespaceObject, "geopoint", function() { return GeoPoint; });
__webpack_require__.d(vega_geo_module_namespaceObject, "geoshape", function() { return GeoShape; });
__webpack_require__.d(vega_geo_module_namespaceObject, "graticule", function() { return Graticule; });
__webpack_require__.d(vega_geo_module_namespaceObject, "heatmap", function() { return Heatmap; });
__webpack_require__.d(vega_geo_module_namespaceObject, "isocontour", function() { return Isocontour; });
__webpack_require__.d(vega_geo_module_namespaceObject, "kde2d", function() { return KDE2D; });
__webpack_require__.d(vega_geo_module_namespaceObject, "projection", function() { return Projection; });

// NAMESPACE OBJECT: ./node_modules/vega-force/build/vega-force.module.js
var vega_force_module_namespaceObject = {};
__webpack_require__.r(vega_force_module_namespaceObject);
__webpack_require__.d(vega_force_module_namespaceObject, "force", function() { return Force; });

// NAMESPACE OBJECT: ./node_modules/vega-hierarchy/build/vega-hierarchy.module.js
var vega_hierarchy_module_namespaceObject = {};
__webpack_require__.r(vega_hierarchy_module_namespaceObject);
__webpack_require__.d(vega_hierarchy_module_namespaceObject, "nest", function() { return Nest; });
__webpack_require__.d(vega_hierarchy_module_namespaceObject, "pack", function() { return Pack; });
__webpack_require__.d(vega_hierarchy_module_namespaceObject, "partition", function() { return Partition; });
__webpack_require__.d(vega_hierarchy_module_namespaceObject, "stratify", function() { return Stratify; });
__webpack_require__.d(vega_hierarchy_module_namespaceObject, "tree", function() { return Tree; });
__webpack_require__.d(vega_hierarchy_module_namespaceObject, "treelinks", function() { return TreeLinks; });
__webpack_require__.d(vega_hierarchy_module_namespaceObject, "treemap", function() { return Treemap; });

// NAMESPACE OBJECT: ./node_modules/vega-label/build/vega-label.module.js
var vega_label_module_namespaceObject = {};
__webpack_require__.r(vega_label_module_namespaceObject);
__webpack_require__.d(vega_label_module_namespaceObject, "label", function() { return Label; });

// NAMESPACE OBJECT: ./node_modules/vega-regression/build/vega-regression.module.js
var vega_regression_module_namespaceObject = {};
__webpack_require__.r(vega_regression_module_namespaceObject);
__webpack_require__.d(vega_regression_module_namespaceObject, "loess", function() { return Loess; });
__webpack_require__.d(vega_regression_module_namespaceObject, "regression", function() { return Regression; });

// NAMESPACE OBJECT: ./node_modules/vega-voronoi/build/vega-voronoi.module.js
var vega_voronoi_module_namespaceObject = {};
__webpack_require__.r(vega_voronoi_module_namespaceObject);
__webpack_require__.d(vega_voronoi_module_namespaceObject, "voronoi", function() { return vega_voronoi_module_Voronoi; });

// NAMESPACE OBJECT: ./node_modules/vega-wordcloud/build/vega-wordcloud.module.js
var vega_wordcloud_module_namespaceObject = {};
__webpack_require__.r(vega_wordcloud_module_namespaceObject);
__webpack_require__.d(vega_wordcloud_module_namespaceObject, "wordcloud", function() { return Wordcloud; });

// NAMESPACE OBJECT: ./node_modules/vega-crossfilter/build/vega-crossfilter.module.js
var vega_crossfilter_module_namespaceObject = {};
__webpack_require__.r(vega_crossfilter_module_namespaceObject);
__webpack_require__.d(vega_crossfilter_module_namespaceObject, "crossfilter", function() { return CrossFilter; });
__webpack_require__.d(vega_crossfilter_module_namespaceObject, "resolvefilter", function() { return ResolveFilter; });

// NAMESPACE OBJECT: ./node_modules/vega/build/vega.module.js
var vega_module_namespaceObject = {};
__webpack_require__.r(vega_module_namespaceObject);
__webpack_require__.d(vega_module_namespaceObject, "Debug", function() { return vega_util_module["a" /* Debug */]; });
__webpack_require__.d(vega_module_namespaceObject, "Error", function() { return vega_util_module["b" /* Error */]; });
__webpack_require__.d(vega_module_namespaceObject, "Info", function() { return vega_util_module["c" /* Info */]; });
__webpack_require__.d(vega_module_namespaceObject, "None", function() { return vega_util_module["d" /* None */]; });
__webpack_require__.d(vega_module_namespaceObject, "Warn", function() { return vega_util_module["e" /* Warn */]; });
__webpack_require__.d(vega_module_namespaceObject, "accessor", function() { return vega_util_module["f" /* accessor */]; });
__webpack_require__.d(vega_module_namespaceObject, "accessorFields", function() { return vega_util_module["g" /* accessorFields */]; });
__webpack_require__.d(vega_module_namespaceObject, "accessorName", function() { return vega_util_module["h" /* accessorName */]; });
__webpack_require__.d(vega_module_namespaceObject, "array", function() { return vega_util_module["i" /* array */]; });
__webpack_require__.d(vega_module_namespaceObject, "ascending", function() { return vega_util_module["j" /* ascending */]; });
__webpack_require__.d(vega_module_namespaceObject, "clampRange", function() { return vega_util_module["k" /* clampRange */]; });
__webpack_require__.d(vega_module_namespaceObject, "compare", function() { return vega_util_module["l" /* compare */]; });
__webpack_require__.d(vega_module_namespaceObject, "constant", function() { return vega_util_module["m" /* constant */]; });
__webpack_require__.d(vega_module_namespaceObject, "debounce", function() { return vega_util_module["n" /* debounce */]; });
__webpack_require__.d(vega_module_namespaceObject, "error", function() { return vega_util_module["o" /* error */]; });
__webpack_require__.d(vega_module_namespaceObject, "extend", function() { return vega_util_module["p" /* extend */]; });
__webpack_require__.d(vega_module_namespaceObject, "extent", function() { return vega_util_module["q" /* extent */]; });
__webpack_require__.d(vega_module_namespaceObject, "extentIndex", function() { return vega_util_module["r" /* extentIndex */]; });
__webpack_require__.d(vega_module_namespaceObject, "falsy", function() { return vega_util_module["s" /* falsy */]; });
__webpack_require__.d(vega_module_namespaceObject, "fastmap", function() { return vega_util_module["t" /* fastmap */]; });
__webpack_require__.d(vega_module_namespaceObject, "field", function() { return vega_util_module["u" /* field */]; });
__webpack_require__.d(vega_module_namespaceObject, "flush", function() { return vega_util_module["v" /* flush */]; });
__webpack_require__.d(vega_module_namespaceObject, "hasOwnProperty", function() { return vega_util_module["w" /* hasOwnProperty */]; });
__webpack_require__.d(vega_module_namespaceObject, "id", function() { return vega_util_module["x" /* id */]; });
__webpack_require__.d(vega_module_namespaceObject, "identity", function() { return vega_util_module["y" /* identity */]; });
__webpack_require__.d(vega_module_namespaceObject, "inherits", function() { return vega_util_module["z" /* inherits */]; });
__webpack_require__.d(vega_module_namespaceObject, "inrange", function() { return vega_util_module["A" /* inrange */]; });
__webpack_require__.d(vega_module_namespaceObject, "isArray", function() { return vega_util_module["B" /* isArray */]; });
__webpack_require__.d(vega_module_namespaceObject, "isBoolean", function() { return vega_util_module["C" /* isBoolean */]; });
__webpack_require__.d(vega_module_namespaceObject, "isDate", function() { return vega_util_module["D" /* isDate */]; });
__webpack_require__.d(vega_module_namespaceObject, "isFunction", function() { return vega_util_module["E" /* isFunction */]; });
__webpack_require__.d(vega_module_namespaceObject, "isIterable", function() { return vega_util_module["F" /* isIterable */]; });
__webpack_require__.d(vega_module_namespaceObject, "isNumber", function() { return vega_util_module["G" /* isNumber */]; });
__webpack_require__.d(vega_module_namespaceObject, "isObject", function() { return vega_util_module["H" /* isObject */]; });
__webpack_require__.d(vega_module_namespaceObject, "isRegExp", function() { return vega_util_module["I" /* isRegExp */]; });
__webpack_require__.d(vega_module_namespaceObject, "isString", function() { return vega_util_module["J" /* isString */]; });
__webpack_require__.d(vega_module_namespaceObject, "key", function() { return vega_util_module["K" /* key */]; });
__webpack_require__.d(vega_module_namespaceObject, "lerp", function() { return vega_util_module["L" /* lerp */]; });
__webpack_require__.d(vega_module_namespaceObject, "logger", function() { return vega_util_module["M" /* logger */]; });
__webpack_require__.d(vega_module_namespaceObject, "lruCache", function() { return vega_util_module["N" /* lruCache */]; });
__webpack_require__.d(vega_module_namespaceObject, "merge", function() { return vega_util_module["O" /* merge */]; });
__webpack_require__.d(vega_module_namespaceObject, "mergeConfig", function() { return vega_util_module["P" /* mergeConfig */]; });
__webpack_require__.d(vega_module_namespaceObject, "one", function() { return vega_util_module["Q" /* one */]; });
__webpack_require__.d(vega_module_namespaceObject, "pad", function() { return vega_util_module["R" /* pad */]; });
__webpack_require__.d(vega_module_namespaceObject, "panLinear", function() { return vega_util_module["S" /* panLinear */]; });
__webpack_require__.d(vega_module_namespaceObject, "panLog", function() { return vega_util_module["T" /* panLog */]; });
__webpack_require__.d(vega_module_namespaceObject, "panPow", function() { return vega_util_module["U" /* panPow */]; });
__webpack_require__.d(vega_module_namespaceObject, "panSymlog", function() { return vega_util_module["V" /* panSymlog */]; });
__webpack_require__.d(vega_module_namespaceObject, "peek", function() { return vega_util_module["W" /* peek */]; });
__webpack_require__.d(vega_module_namespaceObject, "quarter", function() { return vega_util_module["X" /* quarter */]; });
__webpack_require__.d(vega_module_namespaceObject, "repeat", function() { return vega_util_module["Y" /* repeat */]; });
__webpack_require__.d(vega_module_namespaceObject, "span", function() { return vega_util_module["Z" /* span */]; });
__webpack_require__.d(vega_module_namespaceObject, "splitAccessPath", function() { return vega_util_module["ab" /* splitAccessPath */]; });
__webpack_require__.d(vega_module_namespaceObject, "stringValue", function() { return vega_util_module["bb" /* stringValue */]; });
__webpack_require__.d(vega_module_namespaceObject, "toBoolean", function() { return vega_util_module["cb" /* toBoolean */]; });
__webpack_require__.d(vega_module_namespaceObject, "toDate", function() { return vega_util_module["db" /* toDate */]; });
__webpack_require__.d(vega_module_namespaceObject, "toNumber", function() { return vega_util_module["eb" /* toNumber */]; });
__webpack_require__.d(vega_module_namespaceObject, "toSet", function() { return vega_util_module["fb" /* toSet */]; });
__webpack_require__.d(vega_module_namespaceObject, "toString", function() { return vega_util_module["gb" /* toString */]; });
__webpack_require__.d(vega_module_namespaceObject, "truncate", function() { return vega_util_module["hb" /* truncate */]; });
__webpack_require__.d(vega_module_namespaceObject, "truthy", function() { return vega_util_module["ib" /* truthy */]; });
__webpack_require__.d(vega_module_namespaceObject, "utcquarter", function() { return vega_util_module["jb" /* utcquarter */]; });
__webpack_require__.d(vega_module_namespaceObject, "visitArray", function() { return vega_util_module["kb" /* visitArray */]; });
__webpack_require__.d(vega_module_namespaceObject, "writeConfig", function() { return vega_util_module["lb" /* writeConfig */]; });
__webpack_require__.d(vega_module_namespaceObject, "zero", function() { return vega_util_module["mb" /* zero */]; });
__webpack_require__.d(vega_module_namespaceObject, "zoomLinear", function() { return vega_util_module["nb" /* zoomLinear */]; });
__webpack_require__.d(vega_module_namespaceObject, "zoomLog", function() { return vega_util_module["ob" /* zoomLog */]; });
__webpack_require__.d(vega_module_namespaceObject, "zoomPow", function() { return vega_util_module["pb" /* zoomPow */]; });
__webpack_require__.d(vega_module_namespaceObject, "zoomSymlog", function() { return vega_util_module["qb" /* zoomSymlog */]; });
__webpack_require__.d(vega_module_namespaceObject, "Dataflow", function() { return Dataflow; });
__webpack_require__.d(vega_module_namespaceObject, "EventStream", function() { return EventStream; });
__webpack_require__.d(vega_module_namespaceObject, "MultiPulse", function() { return MultiPulse; });
__webpack_require__.d(vega_module_namespaceObject, "Operator", function() { return Operator; });
__webpack_require__.d(vega_module_namespaceObject, "Parameters", function() { return Parameters; });
__webpack_require__.d(vega_module_namespaceObject, "Pulse", function() { return Pulse; });
__webpack_require__.d(vega_module_namespaceObject, "Transform", function() { return Transform; });
__webpack_require__.d(vega_module_namespaceObject, "changeset", function() { return changeset; });
__webpack_require__.d(vega_module_namespaceObject, "definition", function() { return vega_dataflow_module_definition; });
__webpack_require__.d(vega_module_namespaceObject, "ingest", function() { return ingest$1; });
__webpack_require__.d(vega_module_namespaceObject, "isTuple", function() { return isTuple; });
__webpack_require__.d(vega_module_namespaceObject, "transform", function() { return vega_dataflow_module_transform; });
__webpack_require__.d(vega_module_namespaceObject, "transforms", function() { return vega_dataflow_module_transforms; });
__webpack_require__.d(vega_module_namespaceObject, "tupleid", function() { return tupleid; });
__webpack_require__.d(vega_module_namespaceObject, "bandwidthNRD", function() { return estimateBandwidth; });
__webpack_require__.d(vega_module_namespaceObject, "bin", function() { return vega_statistics_module_bin; });
__webpack_require__.d(vega_module_namespaceObject, "bootstrapCI", function() { return bootstrapCI; });
__webpack_require__.d(vega_module_namespaceObject, "cumulativeLogNormal", function() { return cumulativeLogNormal; });
__webpack_require__.d(vega_module_namespaceObject, "cumulativeNormal", function() { return cumulativeNormal; });
__webpack_require__.d(vega_module_namespaceObject, "cumulativeUniform", function() { return cumulativeUniform; });
__webpack_require__.d(vega_module_namespaceObject, "densityLogNormal", function() { return densityLogNormal; });
__webpack_require__.d(vega_module_namespaceObject, "densityNormal", function() { return densityNormal; });
__webpack_require__.d(vega_module_namespaceObject, "densityUniform", function() { return densityUniform; });
__webpack_require__.d(vega_module_namespaceObject, "dotbin", function() { return dotbin; });
__webpack_require__.d(vega_module_namespaceObject, "quantileLogNormal", function() { return quantileLogNormal; });
__webpack_require__.d(vega_module_namespaceObject, "quantileNormal", function() { return quantileNormal; });
__webpack_require__.d(vega_module_namespaceObject, "quantileUniform", function() { return quantileUniform; });
__webpack_require__.d(vega_module_namespaceObject, "quantiles", function() { return quantiles; });
__webpack_require__.d(vega_module_namespaceObject, "quartiles", function() { return quartiles; });
__webpack_require__.d(vega_module_namespaceObject, "random", function() { return vega_statistics_module_random; });
__webpack_require__.d(vega_module_namespaceObject, "randomInteger", function() { return integer; });
__webpack_require__.d(vega_module_namespaceObject, "randomKDE", function() { return vega_statistics_module_kde; });
__webpack_require__.d(vega_module_namespaceObject, "randomLCG", function() { return lcg; });
__webpack_require__.d(vega_module_namespaceObject, "randomLogNormal", function() { return lognormal; });
__webpack_require__.d(vega_module_namespaceObject, "randomMixture", function() { return mixture; });
__webpack_require__.d(vega_module_namespaceObject, "randomNormal", function() { return gaussian; });
__webpack_require__.d(vega_module_namespaceObject, "randomUniform", function() { return uniform; });
__webpack_require__.d(vega_module_namespaceObject, "regressionExp", function() { return exp; });
__webpack_require__.d(vega_module_namespaceObject, "regressionLinear", function() { return linear; });
__webpack_require__.d(vega_module_namespaceObject, "regressionLoess", function() { return vega_statistics_module_loess; });
__webpack_require__.d(vega_module_namespaceObject, "regressionLog", function() { return log; });
__webpack_require__.d(vega_module_namespaceObject, "regressionPoly", function() { return poly; });
__webpack_require__.d(vega_module_namespaceObject, "regressionPow", function() { return pow; });
__webpack_require__.d(vega_module_namespaceObject, "regressionQuad", function() { return vega_statistics_module_quad; });
__webpack_require__.d(vega_module_namespaceObject, "sampleCurve", function() { return sampleCurve; });
__webpack_require__.d(vega_module_namespaceObject, "sampleLogNormal", function() { return sampleLogNormal; });
__webpack_require__.d(vega_module_namespaceObject, "sampleNormal", function() { return sampleNormal; });
__webpack_require__.d(vega_module_namespaceObject, "sampleUniform", function() { return sampleUniform; });
__webpack_require__.d(vega_module_namespaceObject, "setRandom", function() { return setRandom; });
__webpack_require__.d(vega_module_namespaceObject, "DATE", function() { return vega_time_module["a" /* DATE */]; });
__webpack_require__.d(vega_module_namespaceObject, "DAY", function() { return vega_time_module["b" /* DAY */]; });
__webpack_require__.d(vega_module_namespaceObject, "DAYOFYEAR", function() { return vega_time_module["c" /* DAYOFYEAR */]; });
__webpack_require__.d(vega_module_namespaceObject, "HOURS", function() { return vega_time_module["d" /* HOURS */]; });
__webpack_require__.d(vega_module_namespaceObject, "MILLISECONDS", function() { return vega_time_module["e" /* MILLISECONDS */]; });
__webpack_require__.d(vega_module_namespaceObject, "MINUTES", function() { return vega_time_module["f" /* MINUTES */]; });
__webpack_require__.d(vega_module_namespaceObject, "MONTH", function() { return vega_time_module["g" /* MONTH */]; });
__webpack_require__.d(vega_module_namespaceObject, "QUARTER", function() { return vega_time_module["h" /* QUARTER */]; });
__webpack_require__.d(vega_module_namespaceObject, "SECONDS", function() { return vega_time_module["i" /* SECONDS */]; });
__webpack_require__.d(vega_module_namespaceObject, "TIME_UNITS", function() { return vega_time_module["j" /* TIME_UNITS */]; });
__webpack_require__.d(vega_module_namespaceObject, "WEEK", function() { return vega_time_module["k" /* WEEK */]; });
__webpack_require__.d(vega_module_namespaceObject, "YEAR", function() { return vega_time_module["l" /* YEAR */]; });
__webpack_require__.d(vega_module_namespaceObject, "dayofyear", function() { return vega_time_module["m" /* dayofyear */]; });
__webpack_require__.d(vega_module_namespaceObject, "timeBin", function() { return vega_time_module["n" /* timeBin */]; });
__webpack_require__.d(vega_module_namespaceObject, "timeFloor", function() { return vega_time_module["o" /* timeFloor */]; });
__webpack_require__.d(vega_module_namespaceObject, "timeInterval", function() { return vega_time_module["p" /* timeInterval */]; });
__webpack_require__.d(vega_module_namespaceObject, "timeOffset", function() { return vega_time_module["q" /* timeOffset */]; });
__webpack_require__.d(vega_module_namespaceObject, "timeSequence", function() { return vega_time_module["r" /* timeSequence */]; });
__webpack_require__.d(vega_module_namespaceObject, "timeUnitSpecifier", function() { return vega_time_module["s" /* timeUnitSpecifier */]; });
__webpack_require__.d(vega_module_namespaceObject, "timeUnits", function() { return vega_time_module["t" /* timeUnits */]; });
__webpack_require__.d(vega_module_namespaceObject, "utcFloor", function() { return vega_time_module["u" /* utcFloor */]; });
__webpack_require__.d(vega_module_namespaceObject, "utcInterval", function() { return vega_time_module["v" /* utcInterval */]; });
__webpack_require__.d(vega_module_namespaceObject, "utcOffset", function() { return vega_time_module["w" /* utcOffset */]; });
__webpack_require__.d(vega_module_namespaceObject, "utcSequence", function() { return vega_time_module["x" /* utcSequence */]; });
__webpack_require__.d(vega_module_namespaceObject, "utcdayofyear", function() { return vega_time_module["y" /* utcdayofyear */]; });
__webpack_require__.d(vega_module_namespaceObject, "utcweek", function() { return vega_time_module["z" /* utcweek */]; });
__webpack_require__.d(vega_module_namespaceObject, "week", function() { return vega_time_module["A" /* week */]; });
__webpack_require__.d(vega_module_namespaceObject, "format", function() { return vega_loader_browser_module["a" /* format */]; });
__webpack_require__.d(vega_module_namespaceObject, "formats", function() { return vega_loader_browser_module["b" /* formats */]; });
__webpack_require__.d(vega_module_namespaceObject, "inferType", function() { return vega_loader_browser_module["c" /* inferType */]; });
__webpack_require__.d(vega_module_namespaceObject, "inferTypes", function() { return vega_loader_browser_module["d" /* inferTypes */]; });
__webpack_require__.d(vega_module_namespaceObject, "loader", function() { return vega_loader_browser_module["e" /* loader */]; });
__webpack_require__.d(vega_module_namespaceObject, "read", function() { return vega_loader_browser_module["f" /* read */]; });
__webpack_require__.d(vega_module_namespaceObject, "responseType", function() { return vega_loader_browser_module["g" /* responseType */]; });
__webpack_require__.d(vega_module_namespaceObject, "typeParsers", function() { return vega_loader_browser_module["h" /* typeParsers */]; });
__webpack_require__.d(vega_module_namespaceObject, "Bounds", function() { return Bounds; });
__webpack_require__.d(vega_module_namespaceObject, "CanvasHandler", function() { return CanvasHandler; });
__webpack_require__.d(vega_module_namespaceObject, "CanvasRenderer", function() { return CanvasRenderer; });
__webpack_require__.d(vega_module_namespaceObject, "Gradient", function() { return Gradient; });
__webpack_require__.d(vega_module_namespaceObject, "GroupItem", function() { return GroupItem; });
__webpack_require__.d(vega_module_namespaceObject, "Handler", function() { return vega_scenegraph_module_Handler; });
__webpack_require__.d(vega_module_namespaceObject, "Item", function() { return Item; });
__webpack_require__.d(vega_module_namespaceObject, "Marks", function() { return Marks; });
__webpack_require__.d(vega_module_namespaceObject, "RenderType", function() { return RenderType; });
__webpack_require__.d(vega_module_namespaceObject, "Renderer", function() { return vega_scenegraph_module_Renderer; });
__webpack_require__.d(vega_module_namespaceObject, "ResourceLoader", function() { return ResourceLoader; });
__webpack_require__.d(vega_module_namespaceObject, "SVGHandler", function() { return SVGHandler; });
__webpack_require__.d(vega_module_namespaceObject, "SVGRenderer", function() { return SVGRenderer; });
__webpack_require__.d(vega_module_namespaceObject, "SVGStringRenderer", function() { return SVGStringRenderer; });
__webpack_require__.d(vega_module_namespaceObject, "Scenegraph", function() { return Scenegraph; });
__webpack_require__.d(vega_module_namespaceObject, "boundClip", function() { return boundClip; });
__webpack_require__.d(vega_module_namespaceObject, "boundContext", function() { return boundContext; });
__webpack_require__.d(vega_module_namespaceObject, "boundItem", function() { return boundItem; });
__webpack_require__.d(vega_module_namespaceObject, "boundMark", function() { return boundMark; });
__webpack_require__.d(vega_module_namespaceObject, "boundStroke", function() { return boundStroke; });
__webpack_require__.d(vega_module_namespaceObject, "domChild", function() { return domChild; });
__webpack_require__.d(vega_module_namespaceObject, "domClear", function() { return domClear; });
__webpack_require__.d(vega_module_namespaceObject, "domCreate", function() { return domCreate; });
__webpack_require__.d(vega_module_namespaceObject, "domFind", function() { return domFind; });
__webpack_require__.d(vega_module_namespaceObject, "font", function() { return vega_scenegraph_module_font; });
__webpack_require__.d(vega_module_namespaceObject, "fontFamily", function() { return fontFamily; });
__webpack_require__.d(vega_module_namespaceObject, "fontSize", function() { return vega_scenegraph_module_fontSize; });
__webpack_require__.d(vega_module_namespaceObject, "intersect", function() { return vega_scenegraph_module_intersect; });
__webpack_require__.d(vega_module_namespaceObject, "intersectBoxLine", function() { return intersectBoxLine; });
__webpack_require__.d(vega_module_namespaceObject, "intersectPath", function() { return intersectPath; });
__webpack_require__.d(vega_module_namespaceObject, "intersectPoint", function() { return intersectPoint; });
__webpack_require__.d(vega_module_namespaceObject, "intersectRule", function() { return intersectRule; });
__webpack_require__.d(vega_module_namespaceObject, "lineHeight", function() { return lineHeight; });
__webpack_require__.d(vega_module_namespaceObject, "markup", function() { return markup; });
__webpack_require__.d(vega_module_namespaceObject, "multiLineOffset", function() { return multiLineOffset; });
__webpack_require__.d(vega_module_namespaceObject, "pathCurves", function() { return curves; });
__webpack_require__.d(vega_module_namespaceObject, "pathEqual", function() { return pathEqual; });
__webpack_require__.d(vega_module_namespaceObject, "pathParse", function() { return pathParse; });
__webpack_require__.d(vega_module_namespaceObject, "pathRectangle", function() { return vg_rect; });
__webpack_require__.d(vega_module_namespaceObject, "pathRender", function() { return pathRender; });
__webpack_require__.d(vega_module_namespaceObject, "pathSymbols", function() { return vega_scenegraph_module_symbols; });
__webpack_require__.d(vega_module_namespaceObject, "pathTrail", function() { return vg_trail; });
__webpack_require__.d(vega_module_namespaceObject, "point", function() { return vega_scenegraph_module_point; });
__webpack_require__.d(vega_module_namespaceObject, "renderModule", function() { return renderModule; });
__webpack_require__.d(vega_module_namespaceObject, "resetSVGClipId", function() { return resetSVGClipId; });
__webpack_require__.d(vega_module_namespaceObject, "resetSVGDefIds", function() { return resetSVGDefIds; });
__webpack_require__.d(vega_module_namespaceObject, "sceneEqual", function() { return sceneEqual; });
__webpack_require__.d(vega_module_namespaceObject, "sceneFromJSON", function() { return sceneFromJSON; });
__webpack_require__.d(vega_module_namespaceObject, "scenePickVisit", function() { return pickVisit; });
__webpack_require__.d(vega_module_namespaceObject, "sceneToJSON", function() { return sceneToJSON; });
__webpack_require__.d(vega_module_namespaceObject, "sceneVisit", function() { return vega_scenegraph_module_visit; });
__webpack_require__.d(vega_module_namespaceObject, "sceneZOrder", function() { return zorder; });
__webpack_require__.d(vega_module_namespaceObject, "serializeXML", function() { return serializeXML; });
__webpack_require__.d(vega_module_namespaceObject, "textMetrics", function() { return textMetrics; });
__webpack_require__.d(vega_module_namespaceObject, "interpolate", function() { return vega_scale_module_interpolate; });
__webpack_require__.d(vega_module_namespaceObject, "interpolateColors", function() { return interpolateColors; });
__webpack_require__.d(vega_module_namespaceObject, "interpolateRange", function() { return interpolateRange; });
__webpack_require__.d(vega_module_namespaceObject, "quantizeInterpolator", function() { return quantizeInterpolator; });
__webpack_require__.d(vega_module_namespaceObject, "scale", function() { return vega_scale_module_scale; });
__webpack_require__.d(vega_module_namespaceObject, "scheme", function() { return vega_scale_module_scheme; });
__webpack_require__.d(vega_module_namespaceObject, "projection", function() { return vega_projection_module_projection; });
__webpack_require__.d(vega_module_namespaceObject, "View", function() { return View; });
__webpack_require__.d(vega_module_namespaceObject, "defaultLocale", function() { return vega_format_module["a" /* defaultLocale */]; });
__webpack_require__.d(vega_module_namespaceObject, "formatLocale", function() { return vega_format_module["c" /* numberFormatDefaultLocale */]; });
__webpack_require__.d(vega_module_namespaceObject, "locale", function() { return vega_format_module["b" /* locale */]; });
__webpack_require__.d(vega_module_namespaceObject, "resetDefaultLocale", function() { return vega_format_module["d" /* resetDefaultLocale */]; });
__webpack_require__.d(vega_module_namespaceObject, "timeFormatLocale", function() { return vega_format_module["e" /* timeFormatDefaultLocale */]; });
__webpack_require__.d(vega_module_namespaceObject, "expressionFunction", function() { return expressionFunction; });
__webpack_require__.d(vega_module_namespaceObject, "parse", function() { return vega_parser_module_parse; });
__webpack_require__.d(vega_module_namespaceObject, "runtimeContext", function() { return vega_runtime_module_context; });
__webpack_require__.d(vega_module_namespaceObject, "codegenExpression", function() { return vega_expression_build_vega_expression_module_codegen; });
__webpack_require__.d(vega_module_namespaceObject, "parseExpression", function() { return build_vega_expression_module_parser; });
__webpack_require__.d(vega_module_namespaceObject, "parseSelector", function() { return vega_event_selector_module_eventSelector; });
__webpack_require__.d(vega_module_namespaceObject, "version", function() { return version; });

// NAMESPACE OBJECT: ./node_modules/vega-lite/node_modules/d3-interpolate/src/index.js
var d3_interpolate_src_namespaceObject = {};
__webpack_require__.r(d3_interpolate_src_namespaceObject);
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolate", function() { return d3_interpolate_src_value; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateArray", function() { return node_modules_d3_interpolate_src_array; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateBasis", function() { return d3_interpolate_src_basis; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateBasisClosed", function() { return d3_interpolate_src_basisClosed; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateDate", function() { return d3_interpolate_src_date; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateDiscrete", function() { return src_discrete; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateHue", function() { return d3_interpolate_src_hue; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateNumber", function() { return d3_interpolate_src_number; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateNumberArray", function() { return src_numberArray; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateObject", function() { return d3_interpolate_src_object; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateRound", function() { return d3_interpolate_src_round; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateString", function() { return d3_interpolate_src_string; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateTransformCss", function() { return transform_interpolateTransformCss; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateTransformSvg", function() { return transform_interpolateTransformSvg; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateZoom", function() { return src_zoom; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateRgb", function() { return d3_interpolate_src_rgb; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateRgbBasis", function() { return rgb_rgbBasis; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateRgbBasisClosed", function() { return rgb_rgbBasisClosed; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateHsl", function() { return d3_interpolate_src_hsl; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateHslLong", function() { return hsl_hslLong; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateLab", function() { return d3_interpolate_src_lab_lab; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateHcl", function() { return d3_interpolate_src_hcl; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateHclLong", function() { return hcl_hclLong; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateCubehelix", function() { return d3_interpolate_src_cubehelix; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "interpolateCubehelixLong", function() { return cubehelix_cubehelixLong; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "piecewise", function() { return src_piecewise_piecewise; });
__webpack_require__.d(d3_interpolate_src_namespaceObject, "quantize", function() { return d3_interpolate_src_quantize; });

// NAMESPACE OBJECT: ./node_modules/vega-lite/build/src/log/message.js
var message_namespaceObject = {};
__webpack_require__.r(message_namespaceObject);
__webpack_require__.d(message_namespaceObject, "invalidSpec", function() { return invalidSpec; });
__webpack_require__.d(message_namespaceObject, "FIT_NON_SINGLE", function() { return FIT_NON_SINGLE; });
__webpack_require__.d(message_namespaceObject, "containerSizeNonSingle", function() { return containerSizeNonSingle; });
__webpack_require__.d(message_namespaceObject, "containerSizeNotCompatibleWithAutosize", function() { return containerSizeNotCompatibleWithAutosize; });
__webpack_require__.d(message_namespaceObject, "droppingFit", function() { return droppingFit; });
__webpack_require__.d(message_namespaceObject, "cannotProjectOnChannelWithoutField", function() { return cannotProjectOnChannelWithoutField; });
__webpack_require__.d(message_namespaceObject, "cannotProjectAggregate", function() { return cannotProjectAggregate; });
__webpack_require__.d(message_namespaceObject, "nearestNotSupportForContinuous", function() { return nearestNotSupportForContinuous; });
__webpack_require__.d(message_namespaceObject, "selectionNotSupported", function() { return selectionNotSupported; });
__webpack_require__.d(message_namespaceObject, "selectionNotFound", function() { return selectionNotFound; });
__webpack_require__.d(message_namespaceObject, "SCALE_BINDINGS_CONTINUOUS", function() { return SCALE_BINDINGS_CONTINUOUS; });
__webpack_require__.d(message_namespaceObject, "LEGEND_BINDINGS_PROJECT_LENGTH", function() { return LEGEND_BINDINGS_PROJECT_LENGTH; });
__webpack_require__.d(message_namespaceObject, "noSameUnitLookup", function() { return noSameUnitLookup; });
__webpack_require__.d(message_namespaceObject, "noSuchRepeatedValue", function() { return noSuchRepeatedValue; });
__webpack_require__.d(message_namespaceObject, "columnsNotSupportByRowCol", function() { return columnsNotSupportByRowCol; });
__webpack_require__.d(message_namespaceObject, "CONCAT_CANNOT_SHARE_AXIS", function() { return CONCAT_CANNOT_SHARE_AXIS; });
__webpack_require__.d(message_namespaceObject, "unrecognizedParse", function() { return unrecognizedParse; });
__webpack_require__.d(message_namespaceObject, "differentParse", function() { return differentParse; });
__webpack_require__.d(message_namespaceObject, "invalidTransformIgnored", function() { return invalidTransformIgnored; });
__webpack_require__.d(message_namespaceObject, "NO_FIELDS_NEEDS_AS", function() { return NO_FIELDS_NEEDS_AS; });
__webpack_require__.d(message_namespaceObject, "encodingOverridden", function() { return encodingOverridden; });
__webpack_require__.d(message_namespaceObject, "projectionOverridden", function() { return projectionOverridden; });
__webpack_require__.d(message_namespaceObject, "primitiveChannelDef", function() { return primitiveChannelDef; });
__webpack_require__.d(message_namespaceObject, "invalidFieldType", function() { return invalidFieldType; });
__webpack_require__.d(message_namespaceObject, "invalidFieldTypeForCountAggregate", function() { return invalidFieldTypeForCountAggregate; });
__webpack_require__.d(message_namespaceObject, "invalidAggregate", function() { return invalidAggregate; });
__webpack_require__.d(message_namespaceObject, "missingFieldType", function() { return missingFieldType; });
__webpack_require__.d(message_namespaceObject, "droppingColor", function() { return droppingColor; });
__webpack_require__.d(message_namespaceObject, "emptyFieldDef", function() { return emptyFieldDef; });
__webpack_require__.d(message_namespaceObject, "latLongDeprecated", function() { return latLongDeprecated; });
__webpack_require__.d(message_namespaceObject, "LINE_WITH_VARYING_SIZE", function() { return LINE_WITH_VARYING_SIZE; });
__webpack_require__.d(message_namespaceObject, "incompatibleChannel", function() { return incompatibleChannel; });
__webpack_require__.d(message_namespaceObject, "invalidEncodingChannel", function() { return invalidEncodingChannel; });
__webpack_require__.d(message_namespaceObject, "facetChannelShouldBeDiscrete", function() { return facetChannelShouldBeDiscrete; });
__webpack_require__.d(message_namespaceObject, "facetChannelDropped", function() { return facetChannelDropped; });
__webpack_require__.d(message_namespaceObject, "discreteChannelCannotEncode", function() { return discreteChannelCannotEncode; });
__webpack_require__.d(message_namespaceObject, "lineWithRange", function() { return lineWithRange; });
__webpack_require__.d(message_namespaceObject, "orientOverridden", function() { return orientOverridden; });
__webpack_require__.d(message_namespaceObject, "CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN", function() { return CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN; });
__webpack_require__.d(message_namespaceObject, "RANGE_STEP_DEPRECATED", function() { return RANGE_STEP_DEPRECATED; });
__webpack_require__.d(message_namespaceObject, "cannotUseScalePropertyWithNonColor", function() { return cannotUseScalePropertyWithNonColor; });
__webpack_require__.d(message_namespaceObject, "unaggregateDomainHasNoEffectForRawField", function() { return unaggregateDomainHasNoEffectForRawField; });
__webpack_require__.d(message_namespaceObject, "unaggregateDomainWithNonSharedDomainOp", function() { return unaggregateDomainWithNonSharedDomainOp; });
__webpack_require__.d(message_namespaceObject, "unaggregatedDomainWithLogScale", function() { return unaggregatedDomainWithLogScale; });
__webpack_require__.d(message_namespaceObject, "cannotApplySizeToNonOrientedMark", function() { return cannotApplySizeToNonOrientedMark; });
__webpack_require__.d(message_namespaceObject, "scaleTypeNotWorkWithChannel", function() { return scaleTypeNotWorkWithChannel; });
__webpack_require__.d(message_namespaceObject, "scaleTypeNotWorkWithFieldDef", function() { return scaleTypeNotWorkWithFieldDef; });
__webpack_require__.d(message_namespaceObject, "scalePropertyNotWorkWithScaleType", function() { return scalePropertyNotWorkWithScaleType; });
__webpack_require__.d(message_namespaceObject, "scaleTypeNotWorkWithMark", function() { return scaleTypeNotWorkWithMark; });
__webpack_require__.d(message_namespaceObject, "stepDropped", function() { return stepDropped; });
__webpack_require__.d(message_namespaceObject, "mergeConflictingProperty", function() { return mergeConflictingProperty; });
__webpack_require__.d(message_namespaceObject, "mergeConflictingDomainProperty", function() { return mergeConflictingDomainProperty; });
__webpack_require__.d(message_namespaceObject, "independentScaleMeansIndependentGuide", function() { return independentScaleMeansIndependentGuide; });
__webpack_require__.d(message_namespaceObject, "domainSortDropped", function() { return domainSortDropped; });
__webpack_require__.d(message_namespaceObject, "UNABLE_TO_MERGE_DOMAINS", function() { return UNABLE_TO_MERGE_DOMAINS; });
__webpack_require__.d(message_namespaceObject, "MORE_THAN_ONE_SORT", function() { return MORE_THAN_ONE_SORT; });
__webpack_require__.d(message_namespaceObject, "INVALID_CHANNEL_FOR_AXIS", function() { return INVALID_CHANNEL_FOR_AXIS; });
__webpack_require__.d(message_namespaceObject, "cannotStackRangedMark", function() { return cannotStackRangedMark; });
__webpack_require__.d(message_namespaceObject, "cannotStackNonLinearScale", function() { return cannotStackNonLinearScale; });
__webpack_require__.d(message_namespaceObject, "stackNonSummativeAggregate", function() { return stackNonSummativeAggregate; });
__webpack_require__.d(message_namespaceObject, "invalidTimeUnit", function() { return invalidTimeUnit; });
__webpack_require__.d(message_namespaceObject, "dayReplacedWithDate", function() { return dayReplacedWithDate; });
__webpack_require__.d(message_namespaceObject, "droppedDay", function() { return droppedDay; });
__webpack_require__.d(message_namespaceObject, "errorBarCenterAndExtentAreNotNeeded", function() { return errorBarCenterAndExtentAreNotNeeded; });
__webpack_require__.d(message_namespaceObject, "errorBarCenterIsUsedWithWrongExtent", function() { return errorBarCenterIsUsedWithWrongExtent; });
__webpack_require__.d(message_namespaceObject, "errorBarContinuousAxisHasCustomizedAggregate", function() { return errorBarContinuousAxisHasCustomizedAggregate; });
__webpack_require__.d(message_namespaceObject, "errorBarCenterIsNotNeeded", function() { return errorBarCenterIsNotNeeded; });
__webpack_require__.d(message_namespaceObject, "errorBand1DNotSupport", function() { return errorBand1DNotSupport; });
__webpack_require__.d(message_namespaceObject, "channelRequiredForBinned", function() { return channelRequiredForBinned; });
__webpack_require__.d(message_namespaceObject, "domainRequiredForThresholdScale", function() { return domainRequiredForThresholdScale; });

// NAMESPACE OBJECT: ./node_modules/vega-lite/build/src/compile/legend/encode.js
var legend_encode_namespaceObject = {};
__webpack_require__.r(legend_encode_namespaceObject);
__webpack_require__.d(legend_encode_namespaceObject, "symbols", function() { return encode_symbols; });
__webpack_require__.d(legend_encode_namespaceObject, "gradient", function() { return encode_gradient; });
__webpack_require__.d(legend_encode_namespaceObject, "labels", function() { return encode_labels; });
__webpack_require__.d(legend_encode_namespaceObject, "entries", function() { return encode_entries; });
__webpack_require__.d(legend_encode_namespaceObject, "getFirstConditionValue", function() { return getFirstConditionValue; });

// NAMESPACE OBJECT: ./node_modules/vega-lite/build/src/index.js
var build_src_namespaceObject = {};
__webpack_require__.r(build_src_namespaceObject);
__webpack_require__.d(build_src_namespaceObject, "compile", function() { return compile; });
__webpack_require__.d(build_src_namespaceObject, "extractTransforms", function() { return extractTransforms; });
__webpack_require__.d(build_src_namespaceObject, "normalize", function() { return normalize_normalize; });
__webpack_require__.d(build_src_namespaceObject, "version", function() { return src_version; });

// NAMESPACE OBJECT: ./node_modules/vega-themes/build/vega-themes.module.js
var vega_themes_module_namespaceObject = {};
__webpack_require__.r(vega_themes_module_namespaceObject);
__webpack_require__.d(vega_themes_module_namespaceObject, "dark", function() { return darkTheme; });
__webpack_require__.d(vega_themes_module_namespaceObject, "excel", function() { return excelTheme; });
__webpack_require__.d(vega_themes_module_namespaceObject, "fivethirtyeight", function() { return fiveThirtyEightTheme; });
__webpack_require__.d(vega_themes_module_namespaceObject, "ggplot2", function() { return ggplot2Theme; });
__webpack_require__.d(vega_themes_module_namespaceObject, "googlecharts", function() { return googlechartsTheme; });
__webpack_require__.d(vega_themes_module_namespaceObject, "latimes", function() { return latimesTheme; });
__webpack_require__.d(vega_themes_module_namespaceObject, "quartz", function() { return quartzTheme; });
__webpack_require__.d(vega_themes_module_namespaceObject, "urbaninstitute", function() { return urbanInstituteTheme; });
__webpack_require__.d(vega_themes_module_namespaceObject, "version", function() { return vega_themes_module_version$1; });
__webpack_require__.d(vega_themes_module_namespaceObject, "vox", function() { return voxTheme; });

// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
// This file is imported into lib/wc client bundles.

if (typeof window !== 'undefined') {
  var currentScript = window.document.currentScript
  if (true) {
    var getCurrentScript = __webpack_require__("8875")
    currentScript = getCurrentScript()

    // for backward compatibility, because previously we directly included the polyfill
    if (!('currentScript' in document)) {
      Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
    }
  }

  var setPublicPath_src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
  if (setPublicPath_src) {
    __webpack_require__.p = setPublicPath_src[1] // eslint-disable-line
  }
}

// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.for-each.js
var es_array_for_each = __webpack_require__("4160");

// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.for-each.js
var web_dom_collections_for_each = __webpack_require__("159b");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
var es_object_keys = __webpack_require__("b64b");

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"34b6a564-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./src/components/VegaEmbed/template.html?vue&type=template&id=48d93c13&
var templatevue_type_template_id_48d93c13_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div')}
var staticRenderFns = []


// CONCATENATED MODULE: ./src/components/VegaEmbed/template.html?vue&type=template&id=48d93c13&

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
var es_object_to_string = __webpack_require__("d3b7");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
var es_promise = __webpack_require__("e6cf");

// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js



function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  try {
    var info = gen[key](arg);
    var value = info.value;
  } catch (error) {
    reject(error);
    return;
  }

  if (info.done) {
    resolve(value);
  } else {
    Promise.resolve(value).then(_next, _throw);
  }
}

function _asyncToGenerator(fn) {
  return function () {
    var self = this,
        args = arguments;
    return new Promise(function (resolve, reject) {
      var gen = fn.apply(self, args);

      function _next(value) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
      }

      function _throw(err) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
      }

      _next(undefined);
    });
  };
}
// EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
var regenerator_runtime_runtime = __webpack_require__("96cf");

// CONCATENATED MODULE: ./node_modules/fast-json-patch/module/helpers.mjs
/*!
 * https://github.com/Starcounter-Jack/JSON-Patch
 * (c) 2017 Joachim Wester
 * MIT license
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var _hasOwnProperty = Object.prototype.hasOwnProperty;
function helpers_hasOwnProperty(obj, key) {
    return _hasOwnProperty.call(obj, key);
}
function _objectKeys(obj) {
    if (Array.isArray(obj)) {
        var keys = new Array(obj.length);
        for (var k = 0; k < keys.length; k++) {
            keys[k] = "" + k;
        }
        return keys;
    }
    if (Object.keys) {
        return Object.keys(obj);
    }
    var keys = [];
    for (var i in obj) {
        if (helpers_hasOwnProperty(obj, i)) {
            keys.push(i);
        }
    }
    return keys;
}
;
/**
* Deeply clone the object.
* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)
* @param  {any} obj value to clone
* @return {any} cloned obj
*/
function _deepClone(obj) {
    switch (typeof obj) {
        case "object":
            return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5
        case "undefined":
            return null; //this is how JSON.stringify behaves for array items
        default:
            return obj; //no need to clone primitives
    }
}
//3x faster than cached /^\d+$/.test(str)
function isInteger(str) {
    var i = 0;
    var len = str.length;
    var charCode;
    while (i < len) {
        charCode = str.charCodeAt(i);
        if (charCode >= 48 && charCode <= 57) {
            i++;
            continue;
        }
        return false;
    }
    return true;
}
/**
* Escapes a json pointer path
* @param path The raw pointer
* @return the Escaped path
*/
function escapePathComponent(path) {
    if (path.indexOf('/') === -1 && path.indexOf('~') === -1)
        return path;
    return path.replace(/~/g, '~0').replace(/\//g, '~1');
}
/**
 * Unescapes a json pointer path
 * @param path The escaped pointer
 * @return The unescaped path
 */
function unescapePathComponent(path) {
    return path.replace(/~1/g, '/').replace(/~0/g, '~');
}
function _getPathRecursive(root, obj) {
    var found;
    for (var key in root) {
        if (helpers_hasOwnProperty(root, key)) {
            if (root[key] === obj) {
                return escapePathComponent(key) + '/';
            }
            else if (typeof root[key] === 'object') {
                found = _getPathRecursive(root[key], obj);
                if (found != '') {
                    return escapePathComponent(key) + '/' + found;
                }
            }
        }
    }
    return '';
}
function getPath(root, obj) {
    if (root === obj) {
        return '/';
    }
    var path = _getPathRecursive(root, obj);
    if (path === '') {
        throw new Error("Object not found in root");
    }
    return '/' + path;
}
/**
* Recursively checks whether an object has any undefined values inside.
*/
function hasUndefined(obj) {
    if (obj === undefined) {
        return true;
    }
    if (obj) {
        if (Array.isArray(obj)) {
            for (var i = 0, len = obj.length; i < len; i++) {
                if (hasUndefined(obj[i])) {
                    return true;
                }
            }
        }
        else if (typeof obj === "object") {
            var objKeys = _objectKeys(obj);
            var objKeysLength = objKeys.length;
            for (var i = 0; i < objKeysLength; i++) {
                if (hasUndefined(obj[objKeys[i]])) {
                    return true;
                }
            }
        }
    }
    return false;
}
function patchErrorMessageFormatter(message, args) {
    var messageParts = [message];
    for (var key in args) {
        var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print
        if (typeof value !== 'undefined') {
            messageParts.push(key + ": " + value);
        }
    }
    return messageParts.join('\n');
}
var PatchError = /** @class */ (function (_super) {
    __extends(PatchError, _super);
    function PatchError(message, name, index, operation, tree) {
        var _newTarget = this.constructor;
        var _this = _super.call(this, patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree })) || this;
        _this.name = name;
        _this.index = index;
        _this.operation = operation;
        _this.tree = tree;
        Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359
        _this.message = patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree });
        return _this;
    }
    return PatchError;
}(Error));


// CONCATENATED MODULE: ./node_modules/fast-json-patch/module/core.mjs

var JsonPatchError = PatchError;
var deepClone = _deepClone;
/* We use a Javascript hash to store each
 function. Each hash entry (property) uses
 the operation identifiers specified in rfc6902.
 In this way, we can map each patch operation
 to its dedicated function in efficient way.
 */
/* The operations applicable to an object */
var objOps = {
    add: function (obj, key, document) {
        obj[key] = this.value;
        return { newDocument: document };
    },
    remove: function (obj, key, document) {
        var removed = obj[key];
        delete obj[key];
        return { newDocument: document, removed: removed };
    },
    replace: function (obj, key, document) {
        var removed = obj[key];
        obj[key] = this.value;
        return { newDocument: document, removed: removed };
    },
    move: function (obj, key, document) {
        /* in case move target overwrites an existing value,
        return the removed value, this can be taxing performance-wise,
        and is potentially unneeded */
        var removed = getValueByPointer(document, this.path);
        if (removed) {
            removed = _deepClone(removed);
        }
        var originalValue = applyOperation(document, { op: "remove", path: this.from }).removed;
        applyOperation(document, { op: "add", path: this.path, value: originalValue });
        return { newDocument: document, removed: removed };
    },
    copy: function (obj, key, document) {
        var valueToCopy = getValueByPointer(document, this.from);
        // enforce copy by value so further operations don't affect source (see issue #177)
        applyOperation(document, { op: "add", path: this.path, value: _deepClone(valueToCopy) });
        return { newDocument: document };
    },
    test: function (obj, key, document) {
        return { newDocument: document, test: _areEquals(obj[key], this.value) };
    },
    _get: function (obj, key, document) {
        this.value = obj[key];
        return { newDocument: document };
    }
};
/* The operations applicable to an array. Many are the same as for the object */
var arrOps = {
    add: function (arr, i, document) {
        if (isInteger(i)) {
            arr.splice(i, 0, this.value);
        }
        else { // array props
            arr[i] = this.value;
        }
        // this may be needed when using '-' in an array
        return { newDocument: document, index: i };
    },
    remove: function (arr, i, document) {
        var removedList = arr.splice(i, 1);
        return { newDocument: document, removed: removedList[0] };
    },
    replace: function (arr, i, document) {
        var removed = arr[i];
        arr[i] = this.value;
        return { newDocument: document, removed: removed };
    },
    move: objOps.move,
    copy: objOps.copy,
    test: objOps.test,
    _get: objOps._get
};
/**
 * Retrieves a value from a JSON document by a JSON pointer.
 * Returns the value.
 *
 * @param document The document to get the value from
 * @param pointer an escaped JSON pointer
 * @return The retrieved value
 */
function getValueByPointer(document, pointer) {
    if (pointer == '') {
        return document;
    }
    var getOriginalDestination = { op: "_get", path: pointer };
    applyOperation(document, getOriginalDestination);
    return getOriginalDestination.value;
}
/**
 * Apply a single JSON Patch Operation on a JSON document.
 * Returns the {newDocument, result} of the operation.
 * It modifies the `document` and `operation` objects - it gets the values by reference.
 * If you would like to avoid touching your values, clone them:
 * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.
 *
 * @param document The document to patch
 * @param operation The operation to apply
 * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
 * @param mutateDocument Whether to mutate the original document or clone it before applying
 * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
 * @return `{newDocument, result}` after the operation
 */
function applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {
    if (validateOperation === void 0) { validateOperation = false; }
    if (mutateDocument === void 0) { mutateDocument = true; }
    if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }
    if (index === void 0) { index = 0; }
    if (validateOperation) {
        if (typeof validateOperation == 'function') {
            validateOperation(operation, 0, document, operation.path);
        }
        else {
            validator(operation, 0);
        }
    }
    /* ROOT OPERATIONS */
    if (operation.path === "") {
        var returnValue = { newDocument: document };
        if (operation.op === 'add') {
            returnValue.newDocument = operation.value;
            return returnValue;
        }
        else if (operation.op === 'replace') {
            returnValue.newDocument = operation.value;
            returnValue.removed = document; //document we removed
            return returnValue;
        }
        else if (operation.op === 'move' || operation.op === 'copy') { // it's a move or copy to root
            returnValue.newDocument = getValueByPointer(document, operation.from); // get the value by json-pointer in `from` field
            if (operation.op === 'move') { // report removed item
                returnValue.removed = document;
            }
            return returnValue;
        }
        else if (operation.op === 'test') {
            returnValue.test = _areEquals(document, operation.value);
            if (returnValue.test === false) {
                throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
            }
            returnValue.newDocument = document;
            return returnValue;
        }
        else if (operation.op === 'remove') { // a remove on root
            returnValue.removed = document;
            returnValue.newDocument = null;
            return returnValue;
        }
        else if (operation.op === '_get') {
            operation.value = document;
            return returnValue;
        }
        else { /* bad operation */
            if (validateOperation) {
                throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
            }
            else {
                return returnValue;
            }
        }
    } /* END ROOT OPERATIONS */
    else {
        if (!mutateDocument) {
            document = _deepClone(document);
        }
        var path = operation.path || "";
        var keys = path.split('/');
        var obj = document;
        var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift
        var len = keys.length;
        var existingPathFragment = undefined;
        var key = void 0;
        var validateFunction = void 0;
        if (typeof validateOperation == 'function') {
            validateFunction = validateOperation;
        }
        else {
            validateFunction = validator;
        }
        while (true) {
            key = keys[t];
            if (key && key.indexOf('~') != -1) {
                key = unescapePathComponent(key);
            }
            if (banPrototypeModifications && key == '__proto__') {
                throw new TypeError('JSON-Patch: modifying `__proto__` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');
            }
            if (validateOperation) {
                if (existingPathFragment === undefined) {
                    if (obj[key] === undefined) {
                        existingPathFragment = keys.slice(0, t).join('/');
                    }
                    else if (t == len - 1) {
                        existingPathFragment = operation.path;
                    }
                    if (existingPathFragment !== undefined) {
                        validateFunction(operation, 0, document, existingPathFragment);
                    }
                }
            }
            t++;
            if (Array.isArray(obj)) {
                if (key === '-') {
                    key = obj.length;
                }
                else {
                    if (validateOperation && !isInteger(key)) {
                        throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation, document);
                    } // only parse key when it's an integer for `arr.prop` to work
                    else if (isInteger(key)) {
                        key = ~~key;
                    }
                }
                if (t >= len) {
                    if (validateOperation && operation.op === "add" && key > obj.length) {
                        throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation, document);
                    }
                    var returnValue = arrOps[operation.op].call(operation, obj, key, document); // Apply patch
                    if (returnValue.test === false) {
                        throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
                    }
                    return returnValue;
                }
            }
            else {
                if (t >= len) {
                    var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch
                    if (returnValue.test === false) {
                        throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
                    }
                    return returnValue;
                }
            }
            obj = obj[key];
            // If we have more keys in the path, but the next value isn't a non-null object,
            // throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.
            if (validateOperation && t < len && (!obj || typeof obj !== "object")) {
                throw new JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
            }
        }
    }
}
/**
 * Apply a full JSON Patch array on a JSON document.
 * Returns the {newDocument, result} of the patch.
 * It modifies the `document` object and `patch` - it gets the values by reference.
 * If you would like to avoid touching your values, clone them:
 * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.
 *
 * @param document The document to patch
 * @param patch The patch to apply
 * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
 * @param mutateDocument Whether to mutate the original document or clone it before applying
 * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
 * @return An array of `{newDocument, result}` after the patch
 */
function applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) {
    if (mutateDocument === void 0) { mutateDocument = true; }
    if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }
    if (validateOperation) {
        if (!Array.isArray(patch)) {
            throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
        }
    }
    if (!mutateDocument) {
        document = _deepClone(document);
    }
    var results = new Array(patch.length);
    for (var i = 0, length_1 = patch.length; i < length_1; i++) {
        // we don't need to pass mutateDocument argument because if it was true, we already deep cloned the object, we'll just pass `true`
        results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);
        document = results[i].newDocument; // in case root was replaced
    }
    results.newDocument = document;
    return results;
}
/**
 * Apply a single JSON Patch Operation on a JSON document.
 * Returns the updated document.
 * Suitable as a reducer.
 *
 * @param document The document to patch
 * @param operation The operation to apply
 * @return The updated document
 */
function applyReducer(document, operation, index) {
    var operationResult = applyOperation(document, operation);
    if (operationResult.test === false) { // failed test
        throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
    }
    return operationResult.newDocument;
}
/**
 * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.
 * @param {object} operation - operation object (patch)
 * @param {number} index - index of operation in the sequence
 * @param {object} [document] - object where the operation is supposed to be applied
 * @param {string} [existingPathFragment] - comes along with `document`
 */
function validator(operation, index, document, existingPathFragment) {
    if (typeof operation !== 'object' || operation === null || Array.isArray(operation)) {
        throw new JsonPatchError('Operation is not an object', 'OPERATION_NOT_AN_OBJECT', index, operation, document);
    }
    else if (!objOps[operation.op]) {
        throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
    }
    else if (typeof operation.path !== 'string') {
        throw new JsonPatchError('Operation `path` property is not a string', 'OPERATION_PATH_INVALID', index, operation, document);
    }
    else if (operation.path.indexOf('/') !== 0 && operation.path.length > 0) {
        // paths that aren't empty string should start with "/"
        throw new JsonPatchError('Operation `path` property must start with "/"', 'OPERATION_PATH_INVALID', index, operation, document);
    }
    else if ((operation.op === 'move' || operation.op === 'copy') && typeof operation.from !== 'string') {
        throw new JsonPatchError('Operation `from` property is not present (applicable in `move` and `copy` operations)', 'OPERATION_FROM_REQUIRED', index, operation, document);
    }
    else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {
        throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);
    }
    else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && hasUndefined(operation.value)) {
        throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);
    }
    else if (document) {
        if (operation.op == "add") {
            var pathLen = operation.path.split("/").length;
            var existingPathLen = existingPathFragment.split("/").length;
            if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {
                throw new JsonPatchError('Cannot perform an `add` operation at the desired path', 'OPERATION_PATH_CANNOT_ADD', index, operation, document);
            }
        }
        else if (operation.op === 'replace' || operation.op === 'remove' || operation.op === '_get') {
            if (operation.path !== existingPathFragment) {
                throw new JsonPatchError('Cannot perform the operation at a path that does not exist', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
            }
        }
        else if (operation.op === 'move' || operation.op === 'copy') {
            var existingValue = { op: "_get", path: operation.from, value: undefined };
            var error = validate([existingValue], document);
            if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {
                throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);
            }
        }
    }
}
/**
 * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.
 * If error is encountered, returns a JsonPatchError object
 * @param sequence
 * @param document
 * @returns {JsonPatchError|undefined}
 */
function validate(sequence, document, externalValidator) {
    try {
        if (!Array.isArray(sequence)) {
            throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
        }
        if (document) {
            //clone document and sequence so that we can safely try applying operations
            applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true);
        }
        else {
            externalValidator = externalValidator || validator;
            for (var i = 0; i < sequence.length; i++) {
                externalValidator(sequence[i], i, document, undefined);
            }
        }
    }
    catch (e) {
        if (e instanceof JsonPatchError) {
            return e;
        }
        else {
            throw e;
        }
    }
}
// based on https://github.com/epoberezkin/fast-deep-equal
// MIT License
// Copyright (c) 2017 Evgeny Poberezkin
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
function _areEquals(a, b) {
    if (a === b)
        return true;
    if (a && b && typeof a == 'object' && typeof b == 'object') {
        var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;
        if (arrA && arrB) {
            length = a.length;
            if (length != b.length)
                return false;
            for (i = length; i-- !== 0;)
                if (!_areEquals(a[i], b[i]))
                    return false;
            return true;
        }
        if (arrA != arrB)
            return false;
        var keys = Object.keys(a);
        length = keys.length;
        if (length !== Object.keys(b).length)
            return false;
        for (i = length; i-- !== 0;)
            if (!b.hasOwnProperty(keys[i]))
                return false;
        for (i = length; i-- !== 0;) {
            key = keys[i];
            if (!_areEquals(a[key], b[key]))
                return false;
        }
        return true;
    }
    return a !== a && b !== b;
}
;

// CONCATENATED MODULE: ./node_modules/fast-json-patch/module/duplex.mjs
/*!
 * https://github.com/Starcounter-Jack/JSON-Patch
 * (c) 2017 Joachim Wester
 * MIT license
 */


var beforeDict = new WeakMap();
var Mirror = /** @class */ (function () {
    function Mirror(obj) {
        this.observers = new Map();
        this.obj = obj;
    }
    return Mirror;
}());
var ObserverInfo = /** @class */ (function () {
    function ObserverInfo(callback, observer) {
        this.callback = callback;
        this.observer = observer;
    }
    return ObserverInfo;
}());
function getMirror(obj) {
    return beforeDict.get(obj);
}
function getObserverFromMirror(mirror, callback) {
    return mirror.observers.get(callback);
}
function removeObserverFromMirror(mirror, observer) {
    mirror.observers.delete(observer.callback);
}
/**
 * Detach an observer from an object
 */
function unobserve(root, observer) {
    observer.unobserve();
}
/**
 * Observes changes made to an object, which can then be retrieved using generate
 */
function observe(obj, callback) {
    var patches = [];
    var observer;
    var mirror = getMirror(obj);
    if (!mirror) {
        mirror = new Mirror(obj);
        beforeDict.set(obj, mirror);
    }
    else {
        var observerInfo = getObserverFromMirror(mirror, callback);
        observer = observerInfo && observerInfo.observer;
    }
    if (observer) {
        return observer;
    }
    observer = {};
    mirror.value = _deepClone(obj);
    if (callback) {
        observer.callback = callback;
        observer.next = null;
        var dirtyCheck = function () {
            duplex_generate(observer);
        };
        var fastCheck = function () {
            clearTimeout(observer.next);
            observer.next = setTimeout(dirtyCheck);
        };
        if (typeof window !== 'undefined') { //not Node
            window.addEventListener('mouseup', fastCheck);
            window.addEventListener('keyup', fastCheck);
            window.addEventListener('mousedown', fastCheck);
            window.addEventListener('keydown', fastCheck);
            window.addEventListener('change', fastCheck);
        }
    }
    observer.patches = patches;
    observer.object = obj;
    observer.unobserve = function () {
        duplex_generate(observer);
        clearTimeout(observer.next);
        removeObserverFromMirror(mirror, observer);
        if (typeof window !== 'undefined') {
            window.removeEventListener('mouseup', fastCheck);
            window.removeEventListener('keyup', fastCheck);
            window.removeEventListener('mousedown', fastCheck);
            window.removeEventListener('keydown', fastCheck);
            window.removeEventListener('change', fastCheck);
        }
    };
    mirror.observers.set(callback, new ObserverInfo(callback, observer));
    return observer;
}
/**
 * Generate an array of patches from an observer
 */
function duplex_generate(observer, invertible) {
    if (invertible === void 0) { invertible = false; }
    var mirror = beforeDict.get(observer.object);
    _generate(mirror.value, observer.object, observer.patches, "", invertible);
    if (observer.patches.length) {
        applyPatch(mirror.value, observer.patches);
    }
    var temp = observer.patches;
    if (temp.length > 0) {
        observer.patches = [];
        if (observer.callback) {
            observer.callback(temp);
        }
    }
    return temp;
}
// Dirty check if obj is different from mirror, generate patches and update mirror
function _generate(mirror, obj, patches, path, invertible) {
    if (obj === mirror) {
        return;
    }
    if (typeof obj.toJSON === "function") {
        obj = obj.toJSON();
    }
    var newKeys = _objectKeys(obj);
    var oldKeys = _objectKeys(mirror);
    var changed = false;
    var deleted = false;
    //if ever "move" operation is implemented here, make sure this test runs OK: "should not generate the same patch twice (move)"
    for (var t = oldKeys.length - 1; t >= 0; t--) {
        var key = oldKeys[t];
        var oldVal = mirror[key];
        if (helpers_hasOwnProperty(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {
            var newVal = obj[key];
            if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {
                _generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key), invertible);
            }
            else {
                if (oldVal !== newVal) {
                    changed = true;
                    if (invertible) {
                        patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
                    }
                    patches.push({ op: "replace", path: path + "/" + escapePathComponent(key), value: _deepClone(newVal) });
                }
            }
        }
        else if (Array.isArray(mirror) === Array.isArray(obj)) {
            if (invertible) {
                patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
            }
            patches.push({ op: "remove", path: path + "/" + escapePathComponent(key) });
            deleted = true; // property has been deleted
        }
        else {
            if (invertible) {
                patches.push({ op: "test", path: path, value: mirror });
            }
            patches.push({ op: "replace", path: path, value: obj });
            changed = true;
        }
    }
    if (!deleted && newKeys.length == oldKeys.length) {
        return;
    }
    for (var t = 0; t < newKeys.length; t++) {
        var key = newKeys[t];
        if (!helpers_hasOwnProperty(mirror, key) && obj[key] !== undefined) {
            patches.push({ op: "add", path: path + "/" + escapePathComponent(key), value: _deepClone(obj[key]) });
        }
    }
}
/**
 * Create an array of patches from the differences in two objects
 */
function duplex_compare(tree1, tree2, invertible) {
    if (invertible === void 0) { invertible = false; }
    var patches = [];
    _generate(tree1, tree2, patches, '', invertible);
    return patches;
}

// CONCATENATED MODULE: ./node_modules/fast-json-patch/index.mjs





/**
 * Default export for backwards compat
 */





/* harmony default export */ var fast_json_patch = (Object.assign({}, core_namespaceObject, duplex_namespaceObject, {
    JsonPatchError: PatchError,
    deepClone: _deepClone,
    escapePathComponent: escapePathComponent,
    unescapePathComponent: unescapePathComponent
}));
// EXTERNAL MODULE: ./node_modules/json-stringify-pretty-compact/index.js
var json_stringify_pretty_compact = __webpack_require__("6582");
var json_stringify_pretty_compact_default = /*#__PURE__*/__webpack_require__.n(json_stringify_pretty_compact);

// EXTERNAL MODULE: ./node_modules/semver/index.js
var semver = __webpack_require__("ddc3");

// EXTERNAL MODULE: ./node_modules/vega-util/build/vega-util.module.js
var vega_util_module = __webpack_require__("fc17");

// EXTERNAL MODULE: ./node_modules/vega-loader/build/vega-loader.browser.module.js
var vega_loader_browser_module = __webpack_require__("7ba4");

// EXTERNAL MODULE: ./node_modules/vega-format/build/vega-format.module.js
var vega_format_module = __webpack_require__("c092");

// CONCATENATED MODULE: ./node_modules/vega-dataflow/build/vega-dataflow.module.js




function UniqueList(idFunc) {
  const $ = idFunc || vega_util_module["y" /* identity */],
        list = [],
        ids = {};

  list.add = _ => {
    const id = $(_);

    if (!ids[id]) {
      ids[id] = 1;
      list.push(_);
    }

    return list;
  };

  list.remove = _ => {
    const id = $(_);

    if (ids[id]) {
      ids[id] = 0;
      const idx = list.indexOf(_);
      if (idx >= 0) list.splice(idx, 1);
    }

    return list;
  };

  return list;
}

/**
 * Invoke and await a potentially async callback function. If
 * an error occurs, trap it and route to Dataflow.error.
 * @param {Dataflow} df - The dataflow instance
 * @param {function} callback - A callback function to invoke
 *   and then await. The dataflow will be passed as the single
 *   argument to the function.
 */
async function asyncCallback (df, callback) {
  try {
    await callback(df);
  } catch (err) {
    df.error(err);
  }
}

const TUPLE_ID_KEY = Symbol('vega_id');
let TUPLE_ID = 1;
/**
 * Checks if an input value is a registered tuple.
 * @param {*} t - The value to check.
 * @return {boolean} True if the input is a tuple, false otherwise.
 */

function isTuple(t) {
  return !!(t && tupleid(t));
}
/**
 * Returns the id of a tuple.
 * @param {object} t - The input tuple.
 * @return {*} the tuple id.
 */

function tupleid(t) {
  return t[TUPLE_ID_KEY];
}
/**
 * Sets the id of a tuple.
 * @param {object} t - The input tuple.
 * @param {*} id - The id value to set.
 * @return {object} the input tuple.
 */

function setid(t, id) {
  t[TUPLE_ID_KEY] = id;
  return t;
}
/**
 * Ingest an object or value as a data tuple.
 * If the input value is an object, an id field will be added to it. For
 * efficiency, the input object is modified directly. A copy is not made.
 * If the input value is a literal, it will be wrapped in a new object
 * instance, with the value accessible as the 'data' property.
 * @param datum - The value to ingest.
 * @return {object} The ingested data tuple.
 */


function ingest$1(datum) {
  const t = datum === Object(datum) ? datum : {
    data: datum
  };
  return tupleid(t) ? t : setid(t, TUPLE_ID++);
}
/**
 * Given a source tuple, return a derived copy.
 * @param {object} t - The source tuple.
 * @return {object} The derived tuple.
 */

function vega_dataflow_module_derive(t) {
  return rederive(t, ingest$1({}));
}
/**
 * Rederive a derived tuple by copying values from the source tuple.
 * @param {object} t - The source tuple.
 * @param {object} d - The derived tuple.
 * @return {object} The derived tuple.
 */

function rederive(t, d) {
  for (const k in t) d[k] = t[k];

  return d;
}
/**
 * Replace an existing tuple with a new tuple.
 * @param {object} t - The existing data tuple.
 * @param {object} d - The new tuple that replaces the old.
 * @return {object} The new tuple.
 */

function replace(t, d) {
  return setid(d, tupleid(t));
}
/**
 * Generate an augmented comparator function that provides stable
 * sorting by tuple id when the given comparator produces ties.
 * @param {function} cmp - The comparator to augment.
 * @param {function} [f] - Optional tuple accessor function.
 * @return {function} An augmented comparator function.
 */

function stableCompare(cmp, f) {
  return !cmp ? null : f ? (a, b) => cmp(a, b) || tupleid(f(a)) - tupleid(f(b)) : (a, b) => cmp(a, b) || tupleid(a) - tupleid(b);
}

function isChangeSet(v) {
  return v && v.constructor === changeset;
}
function changeset() {
  const add = [],
        // insert tuples
  rem = [],
        // remove tuples
  mod = [],
        // modify tuples
  remp = [],
        // remove by predicate
  modp = []; // modify by predicate

  let clean = null,
      reflow = false;
  return {
    constructor: changeset,

    insert(t) {
      const d = Object(vega_util_module["i" /* array */])(t),
            n = d.length;

      for (let i = 0; i < n; ++i) add.push(d[i]);

      return this;
    },

    remove(t) {
      const a = Object(vega_util_module["E" /* isFunction */])(t) ? remp : rem,
            d = Object(vega_util_module["i" /* array */])(t),
            n = d.length;

      for (let i = 0; i < n; ++i) a.push(d[i]);

      return this;
    },

    modify(t, field, value) {
      const m = {
        field: field,
        value: Object(vega_util_module["m" /* constant */])(value)
      };

      if (Object(vega_util_module["E" /* isFunction */])(t)) {
        m.filter = t;
        modp.push(m);
      } else {
        m.tuple = t;
        mod.push(m);
      }

      return this;
    },

    encode(t, set) {
      if (Object(vega_util_module["E" /* isFunction */])(t)) modp.push({
        filter: t,
        field: set
      });else mod.push({
        tuple: t,
        field: set
      });
      return this;
    },

    clean(value) {
      clean = value;
      return this;
    },

    reflow() {
      reflow = true;
      return this;
    },

    pulse(pulse, tuples) {
      const cur = {},
            out = {};
      let i, n, m, f, t, id; // build lookup table of current tuples

      for (i = 0, n = tuples.length; i < n; ++i) {
        cur[tupleid(tuples[i])] = 1;
      } // process individual tuples to remove


      for (i = 0, n = rem.length; i < n; ++i) {
        t = rem[i];
        cur[tupleid(t)] = -1;
      } // process predicate-based removals


      for (i = 0, n = remp.length; i < n; ++i) {
        f = remp[i];
        tuples.forEach(t => {
          if (f(t)) cur[tupleid(t)] = -1;
        });
      } // process all add tuples


      for (i = 0, n = add.length; i < n; ++i) {
        t = add[i];
        id = tupleid(t);

        if (cur[id]) {
          // tuple already resides in dataset
          // if flagged for both add and remove, cancel
          cur[id] = 1;
        } else {
          // tuple does not reside in dataset, add
          pulse.add.push(ingest$1(add[i]));
        }
      } // populate pulse rem list


      for (i = 0, n = tuples.length; i < n; ++i) {
        t = tuples[i];
        if (cur[tupleid(t)] < 0) pulse.rem.push(t);
      } // modify helper method


      function modify(t, f, v) {
        if (v) {
          t[f] = v(t);
        } else {
          pulse.encode = f;
        }

        if (!reflow) out[tupleid(t)] = t;
      } // process individual tuples to modify


      for (i = 0, n = mod.length; i < n; ++i) {
        m = mod[i];
        t = m.tuple;
        f = m.field;
        id = cur[tupleid(t)];

        if (id > 0) {
          modify(t, f, m.value);
          pulse.modifies(f);
        }
      } // process predicate-based modifications


      for (i = 0, n = modp.length; i < n; ++i) {
        m = modp[i];
        f = m.filter;
        tuples.forEach(t => {
          if (f(t) && cur[tupleid(t)] > 0) {
            modify(t, m.field, m.value);
          }
        });
        pulse.modifies(m.field);
      } // upon reflow request, populate mod with all non-removed tuples
      // otherwise, populate mod with modified tuples only


      if (reflow) {
        pulse.mod = rem.length || remp.length ? tuples.filter(t => cur[tupleid(t)] > 0) : tuples.slice();
      } else {
        for (id in out) pulse.mod.push(out[id]);
      } // set pulse garbage collection request


      if (clean || clean == null && (rem.length || remp.length)) {
        pulse.clean(true);
      }

      return pulse;
    }

  };
}

const CACHE = '_:mod:_';
/**
 * Hash that tracks modifications to assigned values.
 * Callers *must* use the set method to update values.
 */

function Parameters() {
  Object.defineProperty(this, CACHE, {
    writable: true,
    value: {}
  });
}
Parameters.prototype = {
  /**
   * Set a parameter value. If the parameter value changes, the parameter
   * will be recorded as modified.
   * @param {string} name - The parameter name.
   * @param {number} index - The index into an array-value parameter. Ignored if
   *   the argument is undefined, null or less than zero.
   * @param {*} value - The parameter value to set.
   * @param {boolean} [force=false] - If true, records the parameter as modified
   *   even if the value is unchanged.
   * @return {Parameters} - This parameter object.
   */
  set(name, index, value, force) {
    const o = this,
          v = o[name],
          mod = o[CACHE];

    if (index != null && index >= 0) {
      if (v[index] !== value || force) {
        v[index] = value;
        mod[index + ':' + name] = -1;
        mod[name] = -1;
      }
    } else if (v !== value || force) {
      o[name] = value;
      mod[name] = Object(vega_util_module["B" /* isArray */])(value) ? 1 + value.length : -1;
    }

    return o;
  },

  /**
   * Tests if one or more parameters has been modified. If invoked with no
   * arguments, returns true if any parameter value has changed. If the first
   * argument is array, returns trues if any parameter name in the array has
   * changed. Otherwise, tests if the given name and optional array index has
   * changed.
   * @param {string} name - The parameter name to test.
   * @param {number} [index=undefined] - The parameter array index to test.
   * @return {boolean} - Returns true if a queried parameter was modified.
   */
  modified(name, index) {
    const mod = this[CACHE];

    if (!arguments.length) {
      for (const k in mod) {
        if (mod[k]) return true;
      }

      return false;
    } else if (Object(vega_util_module["B" /* isArray */])(name)) {
      for (let k = 0; k < name.length; ++k) {
        if (mod[name[k]]) return true;
      }

      return false;
    }

    return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name];
  },

  /**
   * Clears the modification records. After calling this method,
   * all parameters are considered unmodified.
   */
  clear() {
    this[CACHE] = {};
    return this;
  }

};

let OP_ID = 0;
const PULSE = 'pulse',
      NO_PARAMS = new Parameters(); // Boolean Flags

const SKIP$1 = 1,
      MODIFIED = 2;
/**
 * An Operator is a processing node in a dataflow graph.
 * Each operator stores a value and an optional value update function.
 * Operators can accept a hash of named parameters. Parameter values can
 * either be direct (JavaScript literals, arrays, objects) or indirect
 * (other operators whose values will be pulled dynamically). Operators
 * included as parameters will have this operator added as a dependency.
 * @constructor
 * @param {*} [init] - The initial value for this operator.
 * @param {function(object, Pulse)} [update] - An update function. Upon
 *   evaluation of this operator, the update function will be invoked and the
 *   return value will be used as the new value of this operator.
 * @param {object} [params] - The parameters for this operator.
 * @param {boolean} [react=true] - Flag indicating if this operator should
 *   listen for changes to upstream operators included as parameters.
 * @see parameters
 */

function Operator(init, update, params, react) {
  this.id = ++OP_ID;
  this.value = init;
  this.stamp = -1;
  this.rank = -1;
  this.qrank = -1;
  this.flags = 0;

  if (update) {
    this._update = update;
  }

  if (params) this.parameters(params, react);
}

function vega_dataflow_module_flag(bit) {
  return function (state) {
    const f = this.flags;
    if (arguments.length === 0) return !!(f & bit);
    this.flags = state ? f | bit : f & ~bit;
    return this;
  };
}

Operator.prototype = {
  /**
   * Returns a list of target operators dependent on this operator.
   * If this list does not exist, it is created and then returned.
   * @return {UniqueList}
   */
  targets() {
    return this._targets || (this._targets = UniqueList(vega_util_module["x" /* id */]));
  },

  /**
   * Sets the value of this operator.
   * @param {*} value - the value to set.
   * @return {Number} Returns 1 if the operator value has changed
   *   according to strict equality, returns 0 otherwise.
   */
  set(value) {
    if (this.value !== value) {
      this.value = value;
      return 1;
    } else {
      return 0;
    }
  },

  /**
   * Indicates that operator evaluation should be skipped on the next pulse.
   * This operator will still propagate incoming pulses, but its update function
   * will not be invoked. The skip flag is reset after every pulse, so calling
   * this method will affect processing of the next pulse only.
   */
  skip: vega_dataflow_module_flag(SKIP$1),

  /**
   * Indicates that this operator's value has been modified on its most recent
   * pulse. Normally modification is checked via strict equality; however, in
   * some cases it is more efficient to update the internal state of an object.
   * In those cases, the modified flag can be used to trigger propagation. Once
   * set, the modification flag persists across pulses until unset. The flag can
   * be used with the last timestamp to test if a modification is recent.
   */
  modified: vega_dataflow_module_flag(MODIFIED),

  /**
   * Sets the parameters for this operator. The parameter values are analyzed for
   * operator instances. If found, this operator will be added as a dependency
   * of the parameterizing operator. Operator values are dynamically marshalled
   * from each operator parameter prior to evaluation. If a parameter value is
   * an array, the array will also be searched for Operator instances. However,
   * the search does not recurse into sub-arrays or object properties.
   * @param {object} params - A hash of operator parameters.
   * @param {boolean} [react=true] - A flag indicating if this operator should
   *   automatically update (react) when parameter values change. In other words,
   *   this flag determines if the operator registers itself as a listener on
   *   any upstream operators included in the parameters.
   * @param {boolean} [initonly=false] - A flag indicating if this operator
   *   should calculate an update only upon its initiatal evaluation, then
   *   deregister dependencies and suppress all future update invocations.
   * @return {Operator[]} - An array of upstream dependencies.
   */
  parameters(params, react, initonly) {
    react = react !== false;
    const argval = this._argval = this._argval || new Parameters(),
          argops = this._argops = this._argops || [],
          deps = [];
    let name, value, n, i;

    const add = (name, index, value) => {
      if (value instanceof Operator) {
        if (value !== this) {
          if (react) value.targets().add(this);
          deps.push(value);
        }

        argops.push({
          op: value,
          name: name,
          index: index
        });
      } else {
        argval.set(name, index, value);
      }
    };

    for (name in params) {
      value = params[name];

      if (name === PULSE) {
        Object(vega_util_module["i" /* array */])(value).forEach(op => {
          if (!(op instanceof Operator)) {
            Object(vega_util_module["o" /* error */])('Pulse parameters must be operator instances.');
          } else if (op !== this) {
            op.targets().add(this);
            deps.push(op);
          }
        });
        this.source = value;
      } else if (Object(vega_util_module["B" /* isArray */])(value)) {
        argval.set(name, -1, Array(n = value.length));

        for (i = 0; i < n; ++i) add(name, i, value[i]);
      } else {
        add(name, -1, value);
      }
    }

    this.marshall().clear(); // initialize values

    if (initonly) argops.initonly = true;
    return deps;
  },

  /**
   * Internal method for marshalling parameter values.
   * Visits each operator dependency to pull the latest value.
   * @return {Parameters} A Parameters object to pass to the update function.
   */
  marshall(stamp) {
    const argval = this._argval || NO_PARAMS,
          argops = this._argops;
    let item, i, op, mod;

    if (argops) {
      const n = argops.length;

      for (i = 0; i < n; ++i) {
        item = argops[i];
        op = item.op;
        mod = op.modified() && op.stamp === stamp;
        argval.set(item.name, item.index, op.value, mod);
      }

      if (argops.initonly) {
        for (i = 0; i < n; ++i) {
          item = argops[i];
          item.op.targets().remove(this);
        }

        this._argops = null;
        this._update = null;
      }
    }

    return argval;
  },

  /**
   * Detach this operator from the dataflow.
   * Unregisters listeners on upstream dependencies.
   */
  detach() {
    const argops = this._argops;
    let i, n, item, op;

    if (argops) {
      for (i = 0, n = argops.length; i < n; ++i) {
        item = argops[i];
        op = item.op;

        if (op._targets) {
          op._targets.remove(this);
        }
      }
    } // remove references to the source and pulse object,
    // if present, to prevent memory leaks of old data.


    this.pulse = null;
    this.source = null;
  },

  /**
   * Delegate method to perform operator processing.
   * Subclasses can override this method to perform custom processing.
   * By default, it marshalls parameters and calls the update function
   * if that function is defined. If the update function does not
   * change the operator value then StopPropagation is returned.
   * If no update function is defined, this method does nothing.
   * @param {Pulse} pulse - the current dataflow pulse.
   * @return The output pulse or StopPropagation. A falsy return value
   *   (including undefined) will let the input pulse pass through.
   */
  evaluate(pulse) {
    const update = this._update;

    if (update) {
      const params = this.marshall(pulse.stamp),
            v = update.call(this, params, pulse);
      params.clear();

      if (v !== this.value) {
        this.value = v;
      } else if (!this.modified()) {
        return pulse.StopPropagation;
      }
    }
  },

  /**
   * Run this operator for the current pulse. If this operator has already
   * been run at (or after) the pulse timestamp, returns StopPropagation.
   * Internally, this method calls {@link evaluate} to perform processing.
   * If {@link evaluate} returns a falsy value, the input pulse is returned.
   * This method should NOT be overridden, instead overrride {@link evaluate}.
   * @param {Pulse} pulse - the current dataflow pulse.
   * @return the output pulse for this operator (or StopPropagation)
   */
  run(pulse) {
    if (pulse.stamp < this.stamp) return pulse.StopPropagation;
    let rv;

    if (this.skip()) {
      this.skip(false);
      rv = 0;
    } else {
      rv = this.evaluate(pulse);
    }

    return this.pulse = rv || pulse;
  }

};

/**
 * Add an operator to the dataflow graph. This function accepts a
 * variety of input argument types. The basic signature supports an
 * initial value, update function and parameters. If the first parameter
 * is an Operator instance, it will be added directly. If it is a
 * constructor for an Operator subclass, a new instance will be instantiated.
 * Otherwise, if the first parameter is a function instance, it will be used
 * as the update function and a null initial value is assumed.
 * @param {*} init - One of: the operator to add, the initial value of
 *   the operator, an operator class to instantiate, or an update function.
 * @param {function} [update] - The operator update function.
 * @param {object} [params] - The operator parameters.
 * @param {boolean} [react=true] - Flag indicating if this operator should
 *   listen for changes to upstream operators included as parameters.
 * @return {Operator} - The added operator.
 */

function vega_dataflow_module_add (init, update, params, react) {
  let shift = 1,
      op;

  if (init instanceof Operator) {
    op = init;
  } else if (init && init.prototype instanceof Operator) {
    op = new init();
  } else if (Object(vega_util_module["E" /* isFunction */])(init)) {
    op = new Operator(null, init);
  } else {
    shift = 0;
    op = new Operator(init, update);
  }

  this.rank(op);

  if (shift) {
    react = params;
    params = update;
  }

  if (params) this.connect(op, op.parameters(params, react));
  this.touch(op);
  return op;
}

/**
 * Connect a target operator as a dependent of source operators.
 * If necessary, this method will rerank the target operator and its
 * dependents to ensure propagation proceeds in a topologically sorted order.
 * @param {Operator} target - The target operator.
 * @param {Array<Operator>} - The source operators that should propagate
 *   to the target operator.
 */
function connect (target, sources) {
  const targetRank = target.rank,
        n = sources.length;

  for (let i = 0; i < n; ++i) {
    if (targetRank < sources[i].rank) {
      this.rerank(target);
      return;
    }
  }
}

let STREAM_ID = 0;
/**
 * Models an event stream.
 * @constructor
 * @param {function(Object, number): boolean} [filter] - Filter predicate.
 *   Events pass through when truthy, events are suppressed when falsy.
 * @param {function(Object): *} [apply] - Applied to input events to produce
 *   new event values.
 * @param {function(Object)} [receive] - Event callback function to invoke
 *   upon receipt of a new event. Use to override standard event processing.
 */

function EventStream(filter, apply, receive) {
  this.id = ++STREAM_ID;
  this.value = null;
  if (receive) this.receive = receive;
  if (filter) this._filter = filter;
  if (apply) this._apply = apply;
}
/**
 * Creates a new event stream instance with the provided
 * (optional) filter, apply and receive functions.
 * @param {function(Object, number): boolean} [filter] - Filter predicate.
 *   Events pass through when truthy, events are suppressed when falsy.
 * @param {function(Object): *} [apply] - Applied to input events to produce
 *   new event values.
 * @see EventStream
 */

function vega_dataflow_module_stream(filter, apply, receive) {
  return new EventStream(filter, apply, receive);
}
EventStream.prototype = {
  _filter: vega_util_module["ib" /* truthy */],
  _apply: vega_util_module["y" /* identity */],

  targets() {
    return this._targets || (this._targets = UniqueList(vega_util_module["x" /* id */]));
  },

  consume(_) {
    if (!arguments.length) return !!this._consume;
    this._consume = !!_;
    return this;
  },

  receive(evt) {
    if (this._filter(evt)) {
      const val = this.value = this._apply(evt),
            trg = this._targets,
            n = trg ? trg.length : 0;

      for (let i = 0; i < n; ++i) trg[i].receive(val);

      if (this._consume) {
        evt.preventDefault();
        evt.stopPropagation();
      }
    }
  },

  filter(filter) {
    const s = vega_dataflow_module_stream(filter);
    this.targets().add(s);
    return s;
  },

  apply(apply) {
    const s = vega_dataflow_module_stream(null, apply);
    this.targets().add(s);
    return s;
  },

  merge() {
    const s = vega_dataflow_module_stream();
    this.targets().add(s);

    for (let i = 0, n = arguments.length; i < n; ++i) {
      arguments[i].targets().add(s);
    }

    return s;
  },

  throttle(pause) {
    let t = -1;
    return this.filter(() => {
      const now = Date.now();

      if (now - t > pause) {
        t = now;
        return 1;
      } else {
        return 0;
      }
    });
  },

  debounce(delay) {
    const s = vega_dataflow_module_stream();
    this.targets().add(vega_dataflow_module_stream(null, null, Object(vega_util_module["n" /* debounce */])(delay, e => {
      const df = e.dataflow;
      s.receive(e);
      if (df && df.run) df.run();
    })));
    return s;
  },

  between(a, b) {
    let active = false;
    a.targets().add(vega_dataflow_module_stream(null, null, () => active = true));
    b.targets().add(vega_dataflow_module_stream(null, null, () => active = false));
    return this.filter(() => active);
  },

  detach() {
    // ensures compatibility with operators (#2753)
    // remove references to other streams and filter functions that may
    // be bound to subcontexts that need to be garbage collected.
    this._filter = vega_util_module["ib" /* truthy */];
    this._targets = null;
  }

};

/**
 * Create a new event stream from an event source.
 * @param {object} source - The event source to monitor. The input must
 *  support the addEventListener method.
 * @param {string} type - The event type.
 * @param {function(object): boolean} [filter] - Event filter function.
 * @param {function(object): *} [apply] - Event application function.
 *   If provided, this function will be invoked and the result will be
 *   used as the downstream event value.
 * @return {EventStream}
 */

function vega_dataflow_module_events (source, type, filter, apply) {
  const df = this,
        s = vega_dataflow_module_stream(filter, apply),
        send = function (e) {
    e.dataflow = df;

    try {
      s.receive(e);
    } catch (error) {
      df.error(error);
    } finally {
      df.run();
    }
  };

  let sources;

  if (typeof source === 'string' && typeof document !== 'undefined') {
    sources = document.querySelectorAll(source);
  } else {
    sources = Object(vega_util_module["i" /* array */])(source);
  }

  const n = sources.length;

  for (let i = 0; i < n; ++i) {
    sources[i].addEventListener(type, send);
  }

  return s;
}

function vega_dataflow_module_parse(data, format) {
  const locale = this.locale();
  return Object(vega_loader_browser_module["f" /* read */])(data, format, locale.timeParse, locale.utcParse);
}
/**
 * Ingests new data into the dataflow. First parses the data using the
 * vega-loader read method, then pulses a changeset to the target operator.
 * @param {Operator} target - The Operator to target with ingested data,
 *   typically a Collect transform instance.
 * @param {*} data - The input data, prior to parsing. For JSON this may
 *   be a string or an object. For CSV, TSV, etc should be a string.
 * @param {object} format - The data format description for parsing
 *   loaded data. This object is passed to the vega-loader read method.
 * @returns {Dataflow}
 */

function ingest(target, data, format) {
  data = this.parse(data, format);
  return this.pulse(target, this.changeset().insert(data));
}
/**
 * Request data from an external source, parse it, and return a Promise.
 * @param {string} url - The URL from which to load the data. This string
 *   is passed to the vega-loader load method.
 * @param {object} [format] - The data format description for parsing
 *   loaded data. This object is passed to the vega-loader read method.
 * @return {Promise} A Promise that resolves upon completion of the request.
 *   The resolved object contains the following properties:
 *   - data: an array of parsed data (or null upon error)
 *   - status: a code for success (0), load fail (-1), or parse fail (-2)
 */

async function request(url, format) {
  const df = this;
  let status = 0,
      data;

  try {
    data = await df.loader().load(url, {
      context: 'dataflow',
      response: Object(vega_loader_browser_module["g" /* responseType */])(format && format.type)
    });

    try {
      data = df.parse(data, format);
    } catch (err) {
      status = -2;
      df.warn('Data ingestion failed', url, err);
    }
  } catch (err) {
    status = -1;
    df.warn('Loading failed', url, err);
  }

  return {
    data,
    status
  };
}
async function preload(target, url, format) {
  const df = this,
        pending = df._pending || loadPending(df);
  pending.requests += 1;
  const res = await df.request(url, format);
  df.pulse(target, df.changeset().remove(vega_util_module["ib" /* truthy */]).insert(res.data || []));
  pending.done();
  return res;
}

function loadPending(df) {
  let accept;
  const pending = new Promise(a => accept = a);
  pending.requests = 0;

  pending.done = () => {
    if (--pending.requests === 0) {
      df._pending = null;
      accept(df);
    }
  };

  return df._pending = pending;
}

const SKIP = {
  skip: true
};
/**
 * Perform operator updates in response to events. Applies an
 * update function to compute a new operator value. If the update function
 * returns a {@link ChangeSet}, the operator will be pulsed with those tuple
 * changes. Otherwise, the operator value will be updated to the return value.
 * @param {EventStream|Operator} source - The event source to react to.
 *   This argument can be either an EventStream or an Operator.
 * @param {Operator|function(object):Operator} target - The operator to update.
 *   This argument can either be an Operator instance or (if the source
 *   argument is an EventStream), a function that accepts an event object as
 *   input and returns an Operator to target.
 * @param {function(Parameters,Event): *} [update] - Optional update function
 *   to compute the new operator value, or a literal value to set. Update
 *   functions expect to receive a parameter object and event as arguments.
 *   This function can either return a new operator value or (if the source
 *   argument is an EventStream) a {@link ChangeSet} instance to pulse
 *   the target operator with tuple changes.
 * @param {object} [params] - The update function parameters.
 * @param {object} [options] - Additional options hash. If not overridden,
 *   updated operators will be skipped by default.
 * @param {boolean} [options.skip] - If true, the operator will
 *  be skipped: it will not be evaluated, but its dependents will be.
 * @param {boolean} [options.force] - If true, the operator will
 *   be re-evaluated even if its value has not changed.
 * @return {Dataflow}
 */

function vega_dataflow_module_on (source, target, update, params, options) {
  const fn = source instanceof Operator ? onOperator : onStream;
  fn(this, source, target, update, params, options);
  return this;
}

function onStream(df, stream, target, update, params, options) {
  const opt = Object(vega_util_module["p" /* extend */])({}, options, SKIP);
  let func, op;
  if (!Object(vega_util_module["E" /* isFunction */])(target)) target = Object(vega_util_module["m" /* constant */])(target);

  if (update === undefined) {
    func = e => df.touch(target(e));
  } else if (Object(vega_util_module["E" /* isFunction */])(update)) {
    op = new Operator(null, update, params, false);

    func = e => {
      op.evaluate(e);
      const t = target(e),
            v = op.value;
      isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt);
    };
  } else {
    func = e => df.update(target(e), update, opt);
  }

  stream.apply(func);
}

function onOperator(df, source, target, update, params, options) {
  if (update === undefined) {
    source.targets().add(target);
  } else {
    const opt = options || {},
          op = new Operator(null, updater(target, update), params, false);
    op.modified(opt.force);
    op.rank = source.rank; // immediately follow source

    source.targets().add(op); // add dependency

    if (target) {
      op.skip(true); // skip first invocation

      op.value = target.value; // initialize value

      op.targets().add(target); // chain dependencies

      df.connect(target, [op]); // rerank as needed, #1672
    }
  }
}

function updater(target, update) {
  update = Object(vega_util_module["E" /* isFunction */])(update) ? update : Object(vega_util_module["m" /* constant */])(update);
  return target ? function (_, pulse) {
    const value = update(_, pulse);

    if (!target.skip()) {
      target.skip(value !== this.value).value = value;
    }

    return value;
  } : update;
}

/**
 * Assigns a rank to an operator. Ranks are assigned in increasing order
 * by incrementing an internal rank counter.
 * @param {Operator} op - The operator to assign a rank.
 */

function rank(op) {
  op.rank = ++this._rank;
}
/**
 * Re-ranks an operator and all downstream target dependencies. This
 * is necessary when upstream dependencies of higher rank are added to
 * a target operator.
 * @param {Operator} op - The operator to re-rank.
 */

function rerank(op) {
  const queue = [op];
  let cur, list, i;

  while (queue.length) {
    this.rank(cur = queue.pop());

    if (list = cur._targets) {
      for (i = list.length; --i >= 0;) {
        queue.push(cur = list[i]);
        if (cur === op) Object(vega_util_module["o" /* error */])('Cycle detected in dataflow graph.');
      }
    }
  }
}

/**
 * Sentinel value indicating pulse propagation should stop.
 */

const StopPropagation = {}; // Pulse visit type flags

const ADD = 1 << 0,
      REM = 1 << 1,
      MOD = 1 << 2,
      ADD_REM = ADD | REM,
      ADD_MOD = ADD | MOD,
      ALL = ADD | REM | MOD,
      REFLOW = 1 << 3,
      SOURCE = 1 << 4,
      NO_SOURCE = 1 << 5,
      NO_FIELDS = 1 << 6;
/**
 * A Pulse enables inter-operator communication during a run of the
 * dataflow graph. In addition to the current timestamp, a pulse may also
 * contain a change-set of added, removed or modified data tuples, as well as
 * a pointer to a full backing data source. Tuple change sets may not
 * be fully materialized; for example, to prevent needless array creation
 * a change set may include larger arrays and corresponding filter functions.
 * The pulse provides a {@link visit} method to enable proper and efficient
 * iteration over requested data tuples.
 *
 * In addition, each pulse can track modification flags for data tuple fields.
 * Responsible transform operators should call the {@link modifies} method to
 * indicate changes to data fields. The {@link modified} method enables
 * querying of this modification state.
 *
 * @constructor
 * @param {Dataflow} dataflow - The backing dataflow instance.
 * @param {number} stamp - The current propagation timestamp.
 * @param {string} [encode] - An optional encoding set name, which is then
 *   accessible as Pulse.encode. Operators can respond to (or ignore) this
 *   setting as appropriate. This parameter can be used in conjunction with
 *   the Encode transform in the vega-encode module.
 */

function Pulse(dataflow, stamp, encode) {
  this.dataflow = dataflow;
  this.stamp = stamp == null ? -1 : stamp;
  this.add = [];
  this.rem = [];
  this.mod = [];
  this.fields = null;
  this.encode = encode || null;
}

function materialize(data, filter) {
  const out = [];
  Object(vega_util_module["kb" /* visitArray */])(data, filter, _ => out.push(_));
  return out;
}

function vega_dataflow_module_filter(pulse, flags) {
  const map = {};
  pulse.visit(flags, t => {
    map[tupleid(t)] = 1;
  });
  return t => map[tupleid(t)] ? null : t;
}

function addFilter(a, b) {
  return a ? (t, i) => a(t, i) && b(t, i) : b;
}

Pulse.prototype = {
  /**
   * Sentinel value indicating pulse propagation should stop.
   */
  StopPropagation,

  /**
   * Boolean flag indicating ADD (added) tuples.
   */
  ADD,

  /**
   * Boolean flag indicating REM (removed) tuples.
   */
  REM,

  /**
   * Boolean flag indicating MOD (modified) tuples.
   */
  MOD,

  /**
   * Boolean flag indicating ADD (added) and REM (removed) tuples.
   */
  ADD_REM,

  /**
   * Boolean flag indicating ADD (added) and MOD (modified) tuples.
   */
  ADD_MOD,

  /**
   * Boolean flag indicating ADD, REM and MOD tuples.
   */
  ALL,

  /**
   * Boolean flag indicating all tuples in a data source
   * except for the ADD, REM and MOD tuples.
   */
  REFLOW,

  /**
   * Boolean flag indicating a 'pass-through' to a
   * backing data source, ignoring ADD, REM and MOD tuples.
   */
  SOURCE,

  /**
   * Boolean flag indicating that source data should be
   * suppressed when creating a forked pulse.
   */
  NO_SOURCE,

  /**
   * Boolean flag indicating that field modifications should be
   * suppressed when creating a forked pulse.
   */
  NO_FIELDS,

  /**
   * Creates a new pulse based on the values of this pulse.
   * The dataflow, time stamp and field modification values are copied over.
   * By default, new empty ADD, REM and MOD arrays are created.
   * @param {number} flags - Integer of boolean flags indicating which (if any)
   *   tuple arrays should be copied to the new pulse. The supported flag values
   *   are ADD, REM and MOD. Array references are copied directly: new array
   *   instances are not created.
   * @return {Pulse} - The forked pulse instance.
   * @see init
   */
  fork(flags) {
    return new Pulse(this.dataflow).init(this, flags);
  },

  /**
   * Creates a copy of this pulse with new materialized array
   * instances for the ADD, REM, MOD, and SOURCE arrays.
   * The dataflow, time stamp and field modification values are copied over.
   * @return {Pulse} - The cloned pulse instance.
   * @see init
   */
  clone() {
    const p = this.fork(ALL);
    p.add = p.add.slice();
    p.rem = p.rem.slice();
    p.mod = p.mod.slice();
    if (p.source) p.source = p.source.slice();
    return p.materialize(ALL | SOURCE);
  },

  /**
   * Returns a pulse that adds all tuples from a backing source. This is
   * useful for cases where operators are added to a dataflow after an
   * upstream data pipeline has already been processed, ensuring that
   * new operators can observe all tuples within a stream.
   * @return {Pulse} - A pulse instance with all source tuples included
   *   in the add array. If the current pulse already has all source
   *   tuples in its add array, it is returned directly. If the current
   *   pulse does not have a backing source, it is returned directly.
   */
  addAll() {
    let p = this;
    const reuse = !p.source || p.add === p.rem // special case for indexed set (e.g., crossfilter)
    || !p.rem.length && p.source.length === p.add.length;

    if (reuse) {
      return p;
    } else {
      p = new Pulse(this.dataflow).init(this);
      p.add = p.source;
      p.rem = []; // new operators can ignore rem #2769

      return p;
    }
  },

  /**
   * Initialize this pulse based on the values of another pulse. This method
   * is used internally by {@link fork} to initialize a new forked tuple.
   * The dataflow, time stamp and field modification values are copied over.
   * By default, new empty ADD, REM and MOD arrays are created.
   * @param {Pulse} src - The source pulse to copy from.
   * @param {number} flags - Integer of boolean flags indicating which (if any)
   *   tuple arrays should be copied to the new pulse. The supported flag values
   *   are ADD, REM and MOD. Array references are copied directly: new array
   *   instances are not created. By default, source data arrays are copied
   *   to the new pulse. Use the NO_SOURCE flag to enforce a null source.
   * @return {Pulse} - Returns this Pulse instance.
   */
  init(src, flags) {
    const p = this;
    p.stamp = src.stamp;
    p.encode = src.encode;

    if (src.fields && !(flags & NO_FIELDS)) {
      p.fields = src.fields;
    }

    if (flags & ADD) {
      p.addF = src.addF;
      p.add = src.add;
    } else {
      p.addF = null;
      p.add = [];
    }

    if (flags & REM) {
      p.remF = src.remF;
      p.rem = src.rem;
    } else {
      p.remF = null;
      p.rem = [];
    }

    if (flags & MOD) {
      p.modF = src.modF;
      p.mod = src.mod;
    } else {
      p.modF = null;
      p.mod = [];
    }

    if (flags & NO_SOURCE) {
      p.srcF = null;
      p.source = null;
    } else {
      p.srcF = src.srcF;
      p.source = src.source;
      if (src.cleans) p.cleans = src.cleans;
    }

    return p;
  },

  /**
   * Schedules a function to run after pulse propagation completes.
   * @param {function} func - The function to run.
   */
  runAfter(func) {
    this.dataflow.runAfter(func);
  },

  /**
   * Indicates if tuples have been added, removed or modified.
   * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query.
   *   Defaults to ALL, returning true if any tuple type has changed.
   * @return {boolean} - Returns true if one or more queried tuple types have
   *   changed, false otherwise.
   */
  changed(flags) {
    const f = flags || ALL;
    return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length;
  },

  /**
   * Forces a "reflow" of tuple values, such that all tuples in the backing
   * source are added to the MOD set, unless already present in the ADD set.
   * @param {boolean} [fork=false] - If true, returns a forked copy of this
   *   pulse, and invokes reflow on that derived pulse.
   * @return {Pulse} - The reflowed pulse instance.
   */
  reflow(fork) {
    if (fork) return this.fork(ALL).reflow();
    const len = this.add.length,
          src = this.source && this.source.length;

    if (src && src !== len) {
      this.mod = this.source;
      if (len) this.filter(MOD, vega_dataflow_module_filter(this, ADD));
    }

    return this;
  },

  /**
   * Get/set metadata to pulse requesting garbage collection
   * to reclaim currently unused resources.
   */
  clean(value) {
    if (arguments.length) {
      this.cleans = !!value;
      return this;
    } else {
      return this.cleans;
    }
  },

  /**
   * Marks one or more data field names as modified to assist dependency
   * tracking and incremental processing by transform operators.
   * @param {string|Array<string>} _ - The field(s) to mark as modified.
   * @return {Pulse} - This pulse instance.
   */
  modifies(_) {
    const hash = this.fields || (this.fields = {});

    if (Object(vega_util_module["B" /* isArray */])(_)) {
      _.forEach(f => hash[f] = true);
    } else {
      hash[_] = true;
    }

    return this;
  },

  /**
   * Checks if one or more data fields have been modified during this pulse
   * propagation timestamp.
   * @param {string|Array<string>} _ - The field(s) to check for modified.
   * @param {boolean} nomod - If true, will check the modified flag even if
   *   no mod tuples exist. If false (default), mod tuples must be present.
   * @return {boolean} - Returns true if any of the provided fields has been
   *   marked as modified, false otherwise.
   */
  modified(_, nomod) {
    const fields = this.fields;
    return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : Object(vega_util_module["B" /* isArray */])(_) ? _.some(f => fields[f]) : fields[_];
  },

  /**
   * Adds a filter function to one more tuple sets. Filters are applied to
   * backing tuple arrays, to determine the actual set of tuples considered
   * added, removed or modified. They can be used to delay materialization of
   * a tuple set in order to avoid expensive array copies. In addition, the
   * filter functions can serve as value transformers: unlike standard predicate
   * function (which return boolean values), Pulse filters should return the
   * actual tuple value to process. If a tuple set is already filtered, the
   * new filter function will be appended into a conjuntive ('and') query.
   * @param {number} flags - Flags indicating the tuple set(s) to filter.
   * @param {function(*):object} filter - Filter function that will be applied
   *   to the tuple set array, and should return a data tuple if the value
   *   should be included in the tuple set, and falsy (or null) otherwise.
   * @return {Pulse} - Returns this pulse instance.
   */
  filter(flags, filter) {
    const p = this;
    if (flags & ADD) p.addF = addFilter(p.addF, filter);
    if (flags & REM) p.remF = addFilter(p.remF, filter);
    if (flags & MOD) p.modF = addFilter(p.modF, filter);
    if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter);
    return p;
  },

  /**
   * Materialize one or more tuple sets in this pulse. If the tuple set(s) have
   * a registered filter function, it will be applied and the tuple set(s) will
   * be replaced with materialized tuple arrays.
   * @param {number} flags - Flags indicating the tuple set(s) to materialize.
   * @return {Pulse} - Returns this pulse instance.
   */
  materialize(flags) {
    flags = flags || ALL;
    const p = this;

    if (flags & ADD && p.addF) {
      p.add = materialize(p.add, p.addF);
      p.addF = null;
    }

    if (flags & REM && p.remF) {
      p.rem = materialize(p.rem, p.remF);
      p.remF = null;
    }

    if (flags & MOD && p.modF) {
      p.mod = materialize(p.mod, p.modF);
      p.modF = null;
    }

    if (flags & SOURCE && p.srcF) {
      p.source = p.source.filter(p.srcF);
      p.srcF = null;
    }

    return p;
  },

  /**
   * Visit one or more tuple sets in this pulse.
   * @param {number} flags - Flags indicating the tuple set(s) to visit.
   *   Legal values are ADD, REM, MOD and SOURCE (if a backing data source
   *   has been set).
   * @param {function(object):*} - Visitor function invoked per-tuple.
   * @return {Pulse} - Returns this pulse instance.
   */
  visit(flags, visitor) {
    const p = this,
          v = visitor;

    if (flags & SOURCE) {
      Object(vega_util_module["kb" /* visitArray */])(p.source, p.srcF, v);
      return p;
    }

    if (flags & ADD) Object(vega_util_module["kb" /* visitArray */])(p.add, p.addF, v);
    if (flags & REM) Object(vega_util_module["kb" /* visitArray */])(p.rem, p.remF, v);
    if (flags & MOD) Object(vega_util_module["kb" /* visitArray */])(p.mod, p.modF, v);
    const src = p.source;

    if (flags & REFLOW && src) {
      const sum = p.add.length + p.mod.length;

      if (sum === src.length) ; else if (sum) {
        Object(vega_util_module["kb" /* visitArray */])(src, vega_dataflow_module_filter(p, ADD_MOD), v);
      } else {
        // if no add/rem/mod tuples, visit source
        Object(vega_util_module["kb" /* visitArray */])(src, p.srcF, v);
      }
    }

    return p;
  }

};

/**
 * Represents a set of multiple pulses. Used as input for operators
 * that accept multiple pulses at a time. Contained pulses are
 * accessible via the public "pulses" array property. This pulse doe
 * not carry added, removed or modified tuples directly. However,
 * the visit method can be used to traverse all such tuples contained
 * in sub-pulses with a timestamp matching this parent multi-pulse.
 * @constructor
 * @param {Dataflow} dataflow - The backing dataflow instance.
 * @param {number} stamp - The timestamp.
 * @param {Array<Pulse>} pulses - The sub-pulses for this multi-pulse.
 */

function MultiPulse(dataflow, stamp, pulses, encode) {
  const p = this,
        n = pulses.length;
  let c = 0;
  this.dataflow = dataflow;
  this.stamp = stamp;
  this.fields = null;
  this.encode = encode || null;
  this.pulses = pulses;

  for (let i = 0; i < n; ++i) {
    const pulse = pulses[i];
    if (pulse.stamp !== stamp) continue;

    if (pulse.fields) {
      const hash = p.fields || (p.fields = {});

      for (const f in pulse.fields) {
        hash[f] = 1;
      }
    }

    if (pulse.changed(p.ADD)) c |= p.ADD;
    if (pulse.changed(p.REM)) c |= p.REM;
    if (pulse.changed(p.MOD)) c |= p.MOD;
  }

  this.changes = c;
}
Object(vega_util_module["z" /* inherits */])(MultiPulse, Pulse, {
  /**
   * Creates a new pulse based on the values of this pulse.
   * The dataflow, time stamp and field modification values are copied over.
   * @return {Pulse}
   */
  fork(flags) {
    const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS);

    if (flags !== undefined) {
      if (flags & p.ADD) this.visit(p.ADD, t => p.add.push(t));
      if (flags & p.REM) this.visit(p.REM, t => p.rem.push(t));
      if (flags & p.MOD) this.visit(p.MOD, t => p.mod.push(t));
    }

    return p;
  },

  changed(flags) {
    return this.changes & flags;
  },

  modified(_) {
    const p = this,
          fields = p.fields;
    return !(fields && p.changes & p.MOD) ? 0 : Object(vega_util_module["B" /* isArray */])(_) ? _.some(f => fields[f]) : fields[_];
  },

  filter() {
    Object(vega_util_module["o" /* error */])('MultiPulse does not support filtering.');
  },

  materialize() {
    Object(vega_util_module["o" /* error */])('MultiPulse does not support materialization.');
  },

  visit(flags, visitor) {
    const p = this,
          pulses = p.pulses,
          n = pulses.length;
    let i = 0;

    if (flags & p.SOURCE) {
      for (; i < n; ++i) {
        pulses[i].visit(flags, visitor);
      }
    } else {
      for (; i < n; ++i) {
        if (pulses[i].stamp === p.stamp) {
          pulses[i].visit(flags, visitor);
        }
      }
    }

    return p;
  }

});

/* eslint-disable require-atomic-updates */
/**
 * Evaluates the dataflow and returns a Promise that resolves when pulse
 * propagation completes. This method will increment the current timestamp
 * and process all updated, pulsed and touched operators. When invoked for
 * the first time, all registered operators will be processed. This method
 * should not be invoked by third-party clients, use {@link runAsync} or
 * {@link run} instead.
 * @param {string} [encode] - The name of an encoding set to invoke during
 *   propagation. This value is added to generated Pulse instances;
 *   operators can then respond to (or ignore) this setting as appropriate.
 *   This parameter can be used in conjunction with the Encode transform in
 *   the vega-encode package.
 * @param {function} [prerun] - An optional callback function to invoke
 *   immediately before dataflow evaluation commences.
 * @param {function} [postrun] - An optional callback function to invoke
 *   after dataflow evaluation completes. The callback will be invoked
 *   after those registered via {@link runAfter}.
 * @return {Promise} - A promise that resolves to this dataflow after
 *   evaluation completes.
 */

async function evaluate(encode, prerun, postrun) {
  const df = this,
        async = []; // if the pulse value is set, this is a re-entrant call

  if (df._pulse) return reentrant(df); // wait for pending datasets to load

  if (df._pending) await df._pending; // invoke prerun function, if provided

  if (prerun) await asyncCallback(df, prerun); // exit early if there are no updates

  if (!df._touched.length) {
    df.debug('Dataflow invoked, but nothing to do.');
    return df;
  } // increment timestamp clock


  const stamp = ++df._clock; // set the current pulse

  df._pulse = new Pulse(df, stamp, encode); // initialize priority queue, reset touched operators

  df._touched.forEach(op => df._enqueue(op, true));

  df._touched = UniqueList(vega_util_module["x" /* id */]);
  let count = 0,
      op,
      next,
      error;

  try {
    while (df._heap.size() > 0) {
      // dequeue operator with highest priority
      op = df._heap.pop(); // re-queue if rank changed

      if (op.rank !== op.qrank) {
        df._enqueue(op, true);

        continue;
      } // otherwise, evaluate the operator


      next = op.run(df._getPulse(op, encode));

      if (next.then) {
        // await if operator returns a promise directly
        next = await next;
      } else if (next.async) {
        // queue parallel asynchronous execution
        async.push(next.async);
        next = StopPropagation;
      } // propagate evaluation, enqueue dependent operators


      if (next !== StopPropagation) {
        if (op._targets) op._targets.forEach(op => df._enqueue(op));
      } // increment visit counter


      ++count;
    }
  } catch (err) {
    df._heap.clear();

    error = err;
  } // reset pulse map


  df._input = {};
  df._pulse = null;
  df.debug(`Pulse ${stamp}: ${count} operators`);

  if (error) {
    df._postrun = [];
    df.error(error);
  } // invoke callbacks queued via runAfter


  if (df._postrun.length) {
    const pr = df._postrun.sort((a, b) => b.priority - a.priority);

    df._postrun = [];

    for (let i = 0; i < pr.length; ++i) {
      await asyncCallback(df, pr[i].callback);
    }
  } // invoke postrun function, if provided


  if (postrun) await asyncCallback(df, postrun); // handle non-blocking asynchronous callbacks

  if (async.length) {
    Promise.all(async).then(cb => df.runAsync(null, () => {
      cb.forEach(f => {
        try {
          f(df);
        } catch (err) {
          df.error(err);
        }
      });
    }));
  }

  return df;
}
/**
 * Queues dataflow evaluation to run once any other queued evaluations have
 * completed and returns a Promise that resolves when the queued pulse
 * propagation completes. If provided, a callback function will be invoked
 * immediately before evaluation commences. This method will ensure a
 * separate evaluation is invoked for each time it is called.
 * @param {string} [encode] - The name of an encoding set to invoke during
 *   propagation. This value is added to generated Pulse instances;
 *   operators can then respond to (or ignore) this setting as appropriate.
 *   This parameter can be used in conjunction with the Encode transform in
 *   the vega-encode package.
 * @param {function} [prerun] - An optional callback function to invoke
 *   immediately before dataflow evaluation commences.
 * @param {function} [postrun] - An optional callback function to invoke
 *   after dataflow evaluation completes. The callback will be invoked
 *   after those registered via {@link runAfter}.
 * @return {Promise} - A promise that resolves to this dataflow after
 *   evaluation completes.
 */

async function runAsync(encode, prerun, postrun) {
  // await previously queued functions
  while (this._running) await this._running; // run dataflow, manage running promise


  const clear = () => this._running = null;

  (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear);
  return this._running;
}
/**
 * Requests dataflow evaluation and the immediately returns this dataflow
 * instance. If there are pending data loading or other asynchronous
 * operations, the dataflow will evaluate asynchronously after this method
 * has been invoked. To track when dataflow evaluation completes, use the
 * {@link runAsync} method instead. This method will raise an error if
 * invoked while the dataflow is already in the midst of evaluation.
 * @param {string} [encode] - The name of an encoding set to invoke during
 *   propagation. This value is added to generated Pulse instances;
 *   operators can then respond to (or ignore) this setting as appropriate.
 *   This parameter can be used in conjunction with the Encode transform in
 *   the vega-encode module.
 * @param {function} [prerun] - An optional callback function to invoke
 *   immediately before dataflow evaluation commences.
 * @param {function} [postrun] - An optional callback function to invoke
 *   after dataflow evaluation completes. The callback will be invoked
 *   after those registered via {@link runAfter}.
 * @return {Dataflow} - This dataflow instance.
 */

function vega_dataflow_module_run(encode, prerun, postrun) {
  return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this);
}
/**
 * Schedules a callback function to be invoked after the current pulse
 * propagation completes. If no propagation is currently occurring,
 * the function is invoked immediately. Callbacks scheduled via runAfter
 * are invoked immediately upon completion of the current cycle, before
 * any request queued via runAsync. This method is primarily intended for
 * internal use. Third-party callers using runAfter to schedule a callback
 * that invokes {@link run} or {@link runAsync} should not use this method,
 * but instead use {@link runAsync} with prerun or postrun arguments.
 * @param {function(Dataflow)} callback - The callback function to run.
 *   The callback will be invoked with this Dataflow instance as its
 *   sole argument.
 * @param {boolean} enqueue - A boolean flag indicating that the
 *   callback should be queued up to run after the next propagation
 *   cycle, suppressing immediate invocation when propagation is not
 *   currently occurring.
 * @param {number} [priority] - A priority value used to sort registered
 *   callbacks to determine execution order. This argument is intended
 *   for internal Vega use only.
 */

function runAfter(callback, enqueue, priority) {
  if (this._pulse || enqueue) {
    // pulse propagation is currently running, queue to run after
    this._postrun.push({
      priority: priority || 0,
      callback: callback
    });
  } else {
    // pulse propagation already complete, invoke immediately
    try {
      callback(this);
    } catch (err) {
      this.error(err);
    }
  }
}
/**
 * Raise an error for re-entrant dataflow evaluation.
 */

function reentrant(df) {
  df.error('Dataflow already running. Use runAsync() to chain invocations.');
  return df;
}
/**
 * Enqueue an operator into the priority queue for evaluation. The operator
 * will be enqueued if it has no registered pulse for the current cycle, or if
 * the force argument is true. Upon enqueue, this method also sets the
 * operator's qrank to the current rank value.
 * @param {Operator} op - The operator to enqueue.
 * @param {boolean} [force] - A flag indicating if the operator should be
 *   forceably added to the queue, even if it has already been previously
 *   enqueued during the current pulse propagation. This is useful when the
 *   dataflow graph is dynamically modified and the operator rank changes.
 */


function enqueue(op, force) {
  const q = op.stamp < this._clock;
  if (q) op.stamp = this._clock;

  if (q || force) {
    op.qrank = op.rank;

    this._heap.push(op);
  }
}
/**
 * Provide a correct pulse for evaluating an operator. If the operator has an
 * explicit source operator, we will try to pull the pulse(s) from it.
 * If there is an array of source operators, we build a multi-pulse.
 * Otherwise, we return a current pulse with correct source data.
 * If the pulse is the pulse map has an explicit target set, we use that.
 * Else if the pulse on the upstream source operator is current, we use that.
 * Else we use the pulse from the pulse map, but copy the source tuple array.
 * @param {Operator} op - The operator for which to get an input pulse.
 * @param {string} [encode] - An (optional) encoding set name with which to
 *   annotate the returned pulse. See {@link run} for more information.
 */

function getPulse(op, encode) {
  const s = op.source,
        stamp = this._clock;
  return s && Object(vega_util_module["B" /* isArray */])(s) ? new MultiPulse(this, stamp, s.map(_ => _.pulse), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse);
}

function singlePulse(p, s) {
  if (s && s.stamp === p.stamp) {
    return s;
  }

  p = p.fork();

  if (s && s !== StopPropagation) {
    p.source = s.source;
  }

  return p;
}

const NO_OPT = {
  skip: false,
  force: false
};
/**
 * Touches an operator, scheduling it to be evaluated. If invoked outside of
 * a pulse propagation, the operator will be evaluated the next time this
 * dataflow is run. If invoked in the midst of pulse propagation, the operator
 * will be queued for evaluation if and only if the operator has not yet been
 * evaluated on the current propagation timestamp.
 * @param {Operator} op - The operator to touch.
 * @param {object} [options] - Additional options hash.
 * @param {boolean} [options.skip] - If true, the operator will
 *   be skipped: it will not be evaluated, but its dependents will be.
 * @return {Dataflow}
 */

function touch(op, options) {
  const opt = options || NO_OPT;

  if (this._pulse) {
    // if in midst of propagation, add to priority queue
    this._enqueue(op);
  } else {
    // otherwise, queue for next propagation
    this._touched.add(op);
  }

  if (opt.skip) op.skip(true);
  return this;
}
/**
 * Updates the value of the given operator.
 * @param {Operator} op - The operator to update.
 * @param {*} value - The value to set.
 * @param {object} [options] - Additional options hash.
 * @param {boolean} [options.force] - If true, the operator will
 *   be re-evaluated even if its value has not changed.
 * @param {boolean} [options.skip] - If true, the operator will
 *   be skipped: it will not be evaluated, but its dependents will be.
 * @return {Dataflow}
 */

function vega_dataflow_module_update(op, value, options) {
  const opt = options || NO_OPT;

  if (op.set(value) || opt.force) {
    this.touch(op, opt);
  }

  return this;
}
/**
 * Pulses an operator with a changeset of tuples. If invoked outside of
 * a pulse propagation, the pulse will be applied the next time this
 * dataflow is run. If invoked in the midst of pulse propagation, the pulse
 * will be added to the set of active pulses and will be applied if and
 * only if the target operator has not yet been evaluated on the current
 * propagation timestamp.
 * @param {Operator} op - The operator to pulse.
 * @param {ChangeSet} value - The tuple changeset to apply.
 * @param {object} [options] - Additional options hash.
 * @param {boolean} [options.skip] - If true, the operator will
 *   be skipped: it will not be evaluated, but its dependents will be.
 * @return {Dataflow}
 */

function vega_dataflow_module_pulse(op, changeset, options) {
  this.touch(op, options || NO_OPT);
  const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)),
        t = op.pulse && op.pulse.source || [];
  p.target = op;
  this._input[op.id] = changeset.pulse(p, t);
  return this;
}

function Heap(cmp) {
  let nodes = [];
  return {
    clear: () => nodes = [],
    size: () => nodes.length,
    peek: () => nodes[0],
    push: x => {
      nodes.push(x);
      return siftdown(nodes, 0, nodes.length - 1, cmp);
    },
    pop: () => {
      const last = nodes.pop();
      let item;

      if (nodes.length) {
        item = nodes[0];
        nodes[0] = last;
        siftup(nodes, 0, cmp);
      } else {
        item = last;
      }

      return item;
    }
  };
}

function siftdown(array, start, idx, cmp) {
  let parent, pidx;
  const item = array[idx];

  while (idx > start) {
    pidx = idx - 1 >> 1;
    parent = array[pidx];

    if (cmp(item, parent) < 0) {
      array[idx] = parent;
      idx = pidx;
      continue;
    }

    break;
  }

  return array[idx] = item;
}

function siftup(array, idx, cmp) {
  const start = idx,
        end = array.length,
        item = array[idx];
  let cidx = (idx << 1) + 1,
      ridx;

  while (cidx < end) {
    ridx = cidx + 1;

    if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) {
      cidx = ridx;
    }

    array[idx] = array[cidx];
    idx = cidx;
    cidx = (idx << 1) + 1;
  }

  array[idx] = item;
  return siftdown(array, start, idx, cmp);
}

/**
 * A dataflow graph for reactive processing of data streams.
 * @constructor
 */

function Dataflow() {
  this.logger(Object(vega_util_module["M" /* logger */])());
  this.logLevel(vega_util_module["b" /* Error */]);
  this._clock = 0;
  this._rank = 0;
  this._locale = Object(vega_format_module["a" /* defaultLocale */])();

  try {
    this._loader = Object(vega_loader_browser_module["e" /* loader */])();
  } catch (e) {// do nothing if loader module is unavailable
  }

  this._touched = UniqueList(vega_util_module["x" /* id */]);
  this._input = {};
  this._pulse = null;
  this._heap = Heap((a, b) => a.qrank - b.qrank);
  this._postrun = [];
}

function logMethod(method) {
  return function () {
    return this._log[method].apply(this, arguments);
  };
}

Dataflow.prototype = {
  /**
   * The current timestamp of this dataflow. This value reflects the
   * timestamp of the previous dataflow run. The dataflow is initialized
   * with a stamp value of 0. The initial run of the dataflow will have
   * a timestap of 1, and so on. This value will match the
   * {@link Pulse.stamp} property.
   * @return {number} - The current timestamp value.
   */
  stamp() {
    return this._clock;
  },

  /**
   * Gets or sets the loader instance to use for data file loading. A
   * loader object must provide a "load" method for loading files and a
   * "sanitize" method for checking URL/filename validity. Both methods
   * should accept a URI and options hash as arguments, and return a Promise
   * that resolves to the loaded file contents (load) or a hash containing
   * sanitized URI data with the sanitized url assigned to the "href" property
   * (sanitize).
   * @param {object} _ - The loader instance to use.
   * @return {object|Dataflow} - If no arguments are provided, returns
   *   the current loader instance. Otherwise returns this Dataflow instance.
   */
  loader(_) {
    if (arguments.length) {
      this._loader = _;
      return this;
    } else {
      return this._loader;
    }
  },

  /**
   * Gets or sets the locale instance to use for formatting and parsing
   * string values. The locale object should be provided by the
   * vega-format library, and include methods such as format, timeFormat,
   * utcFormat, timeParse, and utcParse.
   * @param {object} _ - The locale instance to use.
   * @return {object|Dataflow} - If no arguments are provided, returns
   *   the current locale instance. Otherwise returns this Dataflow instance.
   */
  locale(_) {
    if (arguments.length) {
      this._locale = _;
      return this;
    } else {
      return this._locale;
    }
  },

  /**
   * Get or set the logger instance used to log messages. If no arguments are
   * provided, returns the current logger instance. Otherwise, sets the logger
   * and return this Dataflow instance. Provided loggers must support the full
   * API of logger objects generated by the vega-util logger method. Note that
   * by default the log level of the new logger will be used; use the logLevel
   * method to adjust the log level as needed.
   */
  logger(logger) {
    if (arguments.length) {
      this._log = logger;
      return this;
    } else {
      return this._log;
    }
  },

  /**
   * Logs an error message. By default, logged messages are written to console
   * output. The message will only be logged if the current log level is high
   * enough to permit error messages.
   */
  error: logMethod('error'),

  /**
   * Logs a warning message. By default, logged messages are written to console
   * output. The message will only be logged if the current log level is high
   * enough to permit warning messages.
   */
  warn: logMethod('warn'),

  /**
   * Logs a information message. By default, logged messages are written to
   * console output. The message will only be logged if the current log level is
   * high enough to permit information messages.
   */
  info: logMethod('info'),

  /**
   * Logs a debug message. By default, logged messages are written to console
   * output. The message will only be logged if the current log level is high
   * enough to permit debug messages.
   */
  debug: logMethod('debug'),

  /**
   * Get or set the current log level. If an argument is provided, it
   * will be used as the new log level.
   * @param {number} [level] - Should be one of None, Warn, Info
   * @return {number} - The current log level.
   */
  logLevel: logMethod('level'),

  /**
   * Empty entry threshold for garbage cleaning. Map data structures will
   * perform cleaning once the number of empty entries exceeds this value.
   */
  cleanThreshold: 1e4,
  // OPERATOR REGISTRATION
  add: vega_dataflow_module_add,
  connect,
  rank,
  rerank,
  // OPERATOR UPDATES
  pulse: vega_dataflow_module_pulse,
  touch,
  update: vega_dataflow_module_update,
  changeset,
  // DATA LOADING
  ingest,
  parse: vega_dataflow_module_parse,
  preload,
  request,
  // EVENT HANDLING
  events: vega_dataflow_module_events,
  on: vega_dataflow_module_on,
  // PULSE PROPAGATION
  evaluate,
  run: vega_dataflow_module_run,
  runAsync,
  runAfter,
  _enqueue: enqueue,
  _getPulse: getPulse
};

/**
 * Abstract class for operators that process data tuples.
 * Subclasses must provide a {@link transform} method for operator processing.
 * @constructor
 * @param {*} [init] - The initial value for this operator.
 * @param {object} [params] - The parameters for this operator.
 * @param {Operator} [source] - The operator from which to receive pulses.
 */

function Transform(init, params) {
  Operator.call(this, init, null, params);
}
Object(vega_util_module["z" /* inherits */])(Transform, Operator, {
  /**
   * Overrides {@link Operator.evaluate} for transform operators.
   * Internally, this method calls {@link evaluate} to perform processing.
   * If {@link evaluate} returns a falsy value, the input pulse is returned.
   * This method should NOT be overridden, instead overrride {@link evaluate}.
   * @param {Pulse} pulse - the current dataflow pulse.
   * @return the output pulse for this operator (or StopPropagation)
   */
  run(pulse) {
    if (pulse.stamp < this.stamp) return pulse.StopPropagation;
    let rv;

    if (this.skip()) {
      this.skip(false);
    } else {
      rv = this.evaluate(pulse);
    }

    rv = rv || pulse;

    if (rv.then) {
      rv = rv.then(_ => this.pulse = _);
    } else if (rv !== pulse.StopPropagation) {
      this.pulse = rv;
    }

    return rv;
  },

  /**
   * Overrides {@link Operator.evaluate} for transform operators.
   * Marshalls parameter values and then invokes {@link transform}.
   * @param {Pulse} pulse - the current dataflow pulse.
   * @return {Pulse} The output pulse (or StopPropagation). A falsy return
       value (including undefined) will let the input pulse pass through.
  */
  evaluate(pulse) {
    const params = this.marshall(pulse.stamp),
          out = this.transform(params, pulse);
    params.clear();
    return out;
  },

  /**
   * Process incoming pulses.
   * Subclasses should override this method to implement transforms.
   * @param {Parameters} _ - The operator parameter values.
   * @param {Pulse} pulse - The current dataflow pulse.
   * @return {Pulse} The output pulse (or StopPropagation). A falsy return
   *   value (including undefined) will let the input pulse pass through.
   */
  transform() {}

});

const vega_dataflow_module_transforms = {};
function vega_dataflow_module_definition(type) {
  const t = vega_dataflow_module_transform(type);
  return t && t.Definition || null;
}
function vega_dataflow_module_transform(type) {
  type = type && type.toLowerCase();
  return Object(vega_util_module["w" /* hasOwnProperty */])(vega_dataflow_module_transforms, type) ? vega_dataflow_module_transforms[type] : null;
}



// EXTERNAL MODULE: ./node_modules/d3-array/src/ascending.js
var ascending = __webpack_require__("00fb");

// CONCATENATED MODULE: ./node_modules/d3-array/src/max.js
function max_max(values, valueof) {
  let max;
  if (valueof === undefined) {
    for (const value of values) {
      if (value != null
          && (max < value || (max === undefined && value >= value))) {
        max = value;
      }
    }
  } else {
    let index = -1;
    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null
          && (max < value || (max === undefined && value >= value))) {
        max = value;
      }
    }
  }
  return max;
}

// CONCATENATED MODULE: ./node_modules/d3-array/src/min.js
function min_min(values, valueof) {
  let min;
  if (valueof === undefined) {
    for (const value of values) {
      if (value != null
          && (min > value || (min === undefined && value >= value))) {
        min = value;
      }
    }
  } else {
    let index = -1;
    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null
          && (min > value || (min === undefined && value >= value))) {
        min = value;
      }
    }
  }
  return min;
}

// CONCATENATED MODULE: ./node_modules/d3-array/src/quickselect.js


// Based on https://github.com/mourner/quickselect
// ISC license, Copyright 2018 Vladimir Agafonkin.
function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending["a" /* default */]) {
  while (right > left) {
    if (right - left > 600) {
      const n = right - left + 1;
      const m = k - left + 1;
      const z = Math.log(n);
      const s = 0.5 * Math.exp(2 * z / 3);
      const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
      const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
      const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
      quickselect(array, k, newLeft, newRight, compare);
    }

    const t = array[k];
    let i = left;
    let j = right;

    swap(array, left, k);
    if (compare(array[right], t) > 0) swap(array, left, right);

    while (i < j) {
      swap(array, i, j), ++i, --j;
      while (compare(array[i], t) < 0) ++i;
      while (compare(array[j], t) > 0) --j;
    }

    if (compare(array[left], t) === 0) swap(array, left, j);
    else ++j, swap(array, j, right);

    if (j <= k) left = j + 1;
    if (k <= j) right = j - 1;
  }
  return array;
}

function swap(array, i, j) {
  const t = array[i];
  array[i] = array[j];
  array[j] = t;
}

// CONCATENATED MODULE: ./node_modules/d3-array/src/number.js
/* harmony default export */ var number = (function(x) {
  return x === null ? NaN : +x;
});

function* numbers(values, valueof) {
  if (valueof === undefined) {
    for (let value of values) {
      if (value != null && (value = +value) >= value) {
        yield value;
      }
    }
  } else {
    let index = -1;
    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
        yield value;
      }
    }
  }
}

// CONCATENATED MODULE: ./node_modules/d3-array/src/quantile.js





function quantile_quantile(values, p, valueof) {
  values = Float64Array.from(numbers(values, valueof));
  if (!(n = values.length)) return;
  if ((p = +p) <= 0 || n < 2) return min_min(values);
  if (p >= 1) return max_max(values);
  var n,
      i = (n - 1) * p,
      i0 = Math.floor(i),
      value0 = max_max(quickselect(values, i0).subarray(0, i0 + 1)),
      value1 = min_min(values.subarray(i0 + 1));
  return value0 + (value1 - value0) * (i - i0);
}

function quantileSorted(values, p, valueof = number) {
  if (!(n = values.length)) return;
  if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
  if (p >= 1) return +valueof(values[n - 1], n - 1, values);
  var n,
      i = (n - 1) * p,
      i0 = Math.floor(i),
      value0 = +valueof(values[i0], i0, values),
      value1 = +valueof(values[i0 + 1], i0 + 1, values);
  return value0 + (value1 - value0) * (i - i0);
}

// CONCATENATED MODULE: ./node_modules/d3-array/src/variance.js
function variance(values, valueof) {
  let count = 0;
  let delta;
  let mean = 0;
  let sum = 0;
  if (valueof === undefined) {
    for (let value of values) {
      if (value != null && (value = +value) >= value) {
        delta = value - mean;
        mean += delta / ++count;
        sum += delta * (value - mean);
      }
    }
  } else {
    let index = -1;
    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
        delta = value - mean;
        mean += delta / ++count;
        sum += delta * (value - mean);
      }
    }
  }
  if (count > 1) return sum / (count - 1);
}

// CONCATENATED MODULE: ./node_modules/d3-array/src/deviation.js


function deviation(values, valueof) {
  const v = variance(values, valueof);
  return v ? Math.sqrt(v) : v;
}

// CONCATENATED MODULE: ./node_modules/d3-array/src/median.js


/* harmony default export */ var median = (function(values, valueof) {
  return quantile_quantile(values, 0.5, valueof);
});

// CONCATENATED MODULE: ./node_modules/vega-statistics/build/vega-statistics.module.js


function* vega_statistics_module_numbers (values, valueof) {
  if (valueof == null) {
    for (let value of values) {
      if (value != null && value !== '' && (value = +value) >= value) {
        yield value;
      }
    }
  } else {
    let index = -1;

    for (let value of values) {
      value = valueof(value, ++index, values);

      if (value != null && value !== '' && (value = +value) >= value) {
        yield value;
      }
    }
  }
}

function quantiles (array, p, f) {
  const values = Float64Array.from(vega_statistics_module_numbers(array, f)); // don't depend on return value from typed array sort call
  // protects against undefined sort results in Safari (vega/vega-lite#4964)

  values.sort(ascending["a" /* default */]);
  return p.map(_ => quantileSorted(values, _));
}

function quartiles (array, f) {
  return quantiles(array, [0.25, 0.50, 0.75], f);
}

// Theory, Practice, and Visualization. Wiley.

function estimateBandwidth (array, f) {
  const n = array.length,
        d = deviation(array, f),
        q = quartiles(array, f),
        h = (q[2] - q[0]) / 1.34,
        v = Math.min(d, h) || d || Math.abs(q[0]) || 1;
  return 1.06 * v * Math.pow(n, -0.2);
}

function vega_statistics_module_bin (_) {
  // determine range
  const maxb = _.maxbins || 20,
        base = _.base || 10,
        logb = Math.log(base),
        div = _.divide || [5, 2];
  let min = _.extent[0],
      max = _.extent[1],
      step,
      level,
      minstep,
      v,
      i,
      n;
  const span = _.span || max - min || Math.abs(min) || 1;

  if (_.step) {
    // if step size is explicitly given, use that
    step = _.step;
  } else if (_.steps) {
    // if provided, limit choice to acceptable step sizes
    v = span / maxb;

    for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i);

    step = _.steps[Math.max(0, i - 1)];
  } else {
    // else use span to determine step size
    level = Math.ceil(Math.log(maxb) / logb);
    minstep = _.minstep || 0;
    step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level)); // increase step size if too many bins

    while (Math.ceil(span / step) > maxb) {
      step *= base;
    } // decrease step size if allowed


    for (i = 0, n = div.length; i < n; ++i) {
      v = step / div[i];
      if (v >= minstep && span / v <= maxb) step = v;
    }
  } // update precision, min and max


  v = Math.log(step);
  const precision = v >= 0 ? 0 : ~~(-v / logb) + 1,
        eps = Math.pow(base, -precision - 1);

  if (_.nice || _.nice === undefined) {
    v = Math.floor(min / step + eps) * step;
    min = min < v ? v - step : v;
    max = Math.ceil(max / step) * step;
  }

  return {
    start: min,
    stop: max === min ? min + step : max,
    step: step
  };
}

var vega_statistics_module_random = Math.random;
function setRandom(r) {
  vega_statistics_module_random = r;
}

function bootstrapCI (array, samples, alpha, f) {
  if (!array.length) return [undefined, undefined];
  const values = Float64Array.from(vega_statistics_module_numbers(array, f)),
        n = values.length,
        m = samples;
  let a, i, j, mu;

  for (j = 0, mu = Array(m); j < m; ++j) {
    for (a = 0, i = 0; i < n; ++i) {
      a += values[~~(vega_statistics_module_random() * n)];
    }

    mu[j] = a / n;
  }

  mu.sort(ascending["a" /* default */]);
  return [quantile_quantile(mu, alpha / 2), quantile_quantile(mu, 1 - alpha / 2)];
}

// Dot density binning for dot plot construction.
// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999.
// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf
function dotbin (array, step, smooth, f) {
  f = f || (_ => _);

  const n = array.length,
        v = new Float64Array(n);
  let i = 0,
      j = 1,
      a = f(array[0]),
      b = a,
      w = a + step,
      x;

  for (; j < n; ++j) {
    x = f(array[j]);

    if (x >= w) {
      b = (a + b) / 2;

      for (; i < j; ++i) v[i] = b;

      w = x + step;
      a = x;
    }

    b = x;
  }

  b = (a + b) / 2;

  for (; i < j; ++i) v[i] = b;

  return smooth ? smoothing(v, step + step / 4) : v;
} // perform smoothing to reduce variance
// swap points between "adjacent" stacks
// Wilkinson defines adjacent as within step/4 units

function smoothing(v, thresh) {
  const n = v.length;
  let a = 0,
      b = 1,
      c,
      d; // get left stack

  while (v[a] === v[b]) ++b;

  while (b < n) {
    // get right stack
    c = b + 1;

    while (v[b] === v[c]) ++c; // are stacks adjacent?
    // if so, compare sizes and swap as needed


    if (v[b] - v[b - 1] < thresh) {
      d = b + (a + c - b - b >> 1);

      while (d < b) v[d++] = v[b];

      while (d > b) v[d--] = v[a];
    } // update left stack indices


    a = b;
    b = c;
  }

  return v;
}

function lcg (seed) {
  // Random numbers using a Linear Congruential Generator with seed value
  // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator
  return function () {
    seed = (1103515245 * seed + 12345) % 2147483647;
    return seed / 2147483647;
  };
}

function integer (min, max) {
  if (max == null) {
    max = min;
    min = 0;
  }

  let a, b, d;
  const dist = {
    min(_) {
      if (arguments.length) {
        a = _ || 0;
        d = b - a;
        return dist;
      } else {
        return a;
      }
    },

    max(_) {
      if (arguments.length) {
        b = _ || 0;
        d = b - a;
        return dist;
      } else {
        return b;
      }
    },

    sample() {
      return a + Math.floor(d * vega_statistics_module_random());
    },

    pdf(x) {
      return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0;
    },

    cdf(x) {
      const v = Math.floor(x);
      return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d;
    },

    icdf(p) {
      return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN;
    }

  };
  return dist.min(min).max(max);
}

const SQRT2PI = Math.sqrt(2 * Math.PI);
const SQRT2 = Math.SQRT2;

let nextSample = NaN;
function sampleNormal(mean, stdev) {
  mean = mean || 0;
  stdev = stdev == null ? 1 : stdev;
  let x = 0,
      y = 0,
      rds,
      c;

  if (nextSample === nextSample) {
    x = nextSample;
    nextSample = NaN;
  } else {
    do {
      x = vega_statistics_module_random() * 2 - 1;
      y = vega_statistics_module_random() * 2 - 1;
      rds = x * x + y * y;
    } while (rds === 0 || rds > 1);

    c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform

    x *= c;
    nextSample = y * c;
  }

  return mean + x * stdev;
}
function densityNormal(value, mean, stdev) {
  stdev = stdev == null ? 1 : stdev;
  const z = (value - (mean || 0)) / stdev;
  return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI);
} // Approximation from West (2009)
// Better Approximations to Cumulative Normal Functions

function cumulativeNormal(value, mean, stdev) {
  mean = mean || 0;
  stdev = stdev == null ? 1 : stdev;
  const z = (value - mean) / stdev,
        Z = Math.abs(z);
  let cd;

  if (Z > 37) {
    cd = 0;
  } else {
    const exp = Math.exp(-Z * Z / 2);
    let sum;

    if (Z < 7.07106781186547) {
      sum = 3.52624965998911e-02 * Z + 0.700383064443688;
      sum = sum * Z + 6.37396220353165;
      sum = sum * Z + 33.912866078383;
      sum = sum * Z + 112.079291497871;
      sum = sum * Z + 221.213596169931;
      sum = sum * Z + 220.206867912376;
      cd = exp * sum;
      sum = 8.83883476483184e-02 * Z + 1.75566716318264;
      sum = sum * Z + 16.064177579207;
      sum = sum * Z + 86.7807322029461;
      sum = sum * Z + 296.564248779674;
      sum = sum * Z + 637.333633378831;
      sum = sum * Z + 793.826512519948;
      sum = sum * Z + 440.413735824752;
      cd = cd / sum;
    } else {
      sum = Z + 0.65;
      sum = Z + 4 / sum;
      sum = Z + 3 / sum;
      sum = Z + 2 / sum;
      sum = Z + 1 / sum;
      cd = exp / sum / 2.506628274631;
    }
  }

  return z > 0 ? 1 - cd : cd;
} // Approximation of Probit function using inverse error function.

function quantileNormal(p, mean, stdev) {
  if (p < 0 || p > 1) return NaN;
  return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1);
} // Approximate inverse error function. Implementation from "Approximating
// the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010.
// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0

function erfinv(x) {
  // beware that the logarithm argument must be
  // commputed as (1.0 - x) * (1.0 + x),
  // it must NOT be simplified as 1.0 - x * x as this
  // would induce rounding errors near the boundaries +/-1
  let w = -Math.log((1 - x) * (1 + x)),
      p;

  if (w < 6.25) {
    w -= 3.125;
    p = -3.6444120640178196996e-21;
    p = -1.685059138182016589e-19 + p * w;
    p = 1.2858480715256400167e-18 + p * w;
    p = 1.115787767802518096e-17 + p * w;
    p = -1.333171662854620906e-16 + p * w;
    p = 2.0972767875968561637e-17 + p * w;
    p = 6.6376381343583238325e-15 + p * w;
    p = -4.0545662729752068639e-14 + p * w;
    p = -8.1519341976054721522e-14 + p * w;
    p = 2.6335093153082322977e-12 + p * w;
    p = -1.2975133253453532498e-11 + p * w;
    p = -5.4154120542946279317e-11 + p * w;
    p = 1.051212273321532285e-09 + p * w;
    p = -4.1126339803469836976e-09 + p * w;
    p = -2.9070369957882005086e-08 + p * w;
    p = 4.2347877827932403518e-07 + p * w;
    p = -1.3654692000834678645e-06 + p * w;
    p = -1.3882523362786468719e-05 + p * w;
    p = 0.0001867342080340571352 + p * w;
    p = -0.00074070253416626697512 + p * w;
    p = -0.0060336708714301490533 + p * w;
    p = 0.24015818242558961693 + p * w;
    p = 1.6536545626831027356 + p * w;
  } else if (w < 16.0) {
    w = Math.sqrt(w) - 3.25;
    p = 2.2137376921775787049e-09;
    p = 9.0756561938885390979e-08 + p * w;
    p = -2.7517406297064545428e-07 + p * w;
    p = 1.8239629214389227755e-08 + p * w;
    p = 1.5027403968909827627e-06 + p * w;
    p = -4.013867526981545969e-06 + p * w;
    p = 2.9234449089955446044e-06 + p * w;
    p = 1.2475304481671778723e-05 + p * w;
    p = -4.7318229009055733981e-05 + p * w;
    p = 6.8284851459573175448e-05 + p * w;
    p = 2.4031110387097893999e-05 + p * w;
    p = -0.0003550375203628474796 + p * w;
    p = 0.00095328937973738049703 + p * w;
    p = -0.0016882755560235047313 + p * w;
    p = 0.0024914420961078508066 + p * w;
    p = -0.0037512085075692412107 + p * w;
    p = 0.005370914553590063617 + p * w;
    p = 1.0052589676941592334 + p * w;
    p = 3.0838856104922207635 + p * w;
  } else if (Number.isFinite(w)) {
    w = Math.sqrt(w) - 5.0;
    p = -2.7109920616438573243e-11;
    p = -2.5556418169965252055e-10 + p * w;
    p = 1.5076572693500548083e-09 + p * w;
    p = -3.7894654401267369937e-09 + p * w;
    p = 7.6157012080783393804e-09 + p * w;
    p = -1.4960026627149240478e-08 + p * w;
    p = 2.9147953450901080826e-08 + p * w;
    p = -6.7711997758452339498e-08 + p * w;
    p = 2.2900482228026654717e-07 + p * w;
    p = -9.9298272942317002539e-07 + p * w;
    p = 4.5260625972231537039e-06 + p * w;
    p = -1.9681778105531670567e-05 + p * w;
    p = 7.5995277030017761139e-05 + p * w;
    p = -0.00021503011930044477347 + p * w;
    p = -0.00013871931833623122026 + p * w;
    p = 1.0103004648645343977 + p * w;
    p = 4.8499064014085844221 + p * w;
  } else {
    p = Infinity;
  }

  return p * x;
}

function gaussian (mean, stdev) {
  let mu, sigma;
  const dist = {
    mean(_) {
      if (arguments.length) {
        mu = _ || 0;
        return dist;
      } else {
        return mu;
      }
    },

    stdev(_) {
      if (arguments.length) {
        sigma = _ == null ? 1 : _;
        return dist;
      } else {
        return sigma;
      }
    },

    sample: () => sampleNormal(mu, sigma),
    pdf: value => densityNormal(value, mu, sigma),
    cdf: value => cumulativeNormal(value, mu, sigma),
    icdf: p => quantileNormal(p, mu, sigma)
  };
  return dist.mean(mean).stdev(stdev);
}

function vega_statistics_module_kde (support, bandwidth) {
  const kernel = gaussian();
  let n = 0;
  const dist = {
    data(_) {
      if (arguments.length) {
        support = _;
        n = _ ? _.length : 0;
        return dist.bandwidth(bandwidth);
      } else {
        return support;
      }
    },

    bandwidth(_) {
      if (!arguments.length) return bandwidth;
      bandwidth = _;
      if (!bandwidth && support) bandwidth = estimateBandwidth(support);
      return dist;
    },

    sample() {
      return support[~~(vega_statistics_module_random() * n)] + bandwidth * kernel.sample();
    },

    pdf(x) {
      let y = 0,
          i = 0;

      for (; i < n; ++i) {
        y += kernel.pdf((x - support[i]) / bandwidth);
      }

      return y / bandwidth / n;
    },

    cdf(x) {
      let y = 0,
          i = 0;

      for (; i < n; ++i) {
        y += kernel.cdf((x - support[i]) / bandwidth);
      }

      return y / n;
    },

    icdf() {
      throw Error('KDE icdf not supported.');
    }

  };
  return dist.data(support);
}

function sampleLogNormal(mean, stdev) {
  mean = mean || 0;
  stdev = stdev == null ? 1 : stdev;
  return Math.exp(mean + sampleNormal() * stdev);
}
function densityLogNormal(value, mean, stdev) {
  if (value <= 0) return 0;
  mean = mean || 0;
  stdev = stdev == null ? 1 : stdev;
  const z = (Math.log(value) - mean) / stdev;
  return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value);
}
function cumulativeLogNormal(value, mean, stdev) {
  return cumulativeNormal(Math.log(value), mean, stdev);
}
function quantileLogNormal(p, mean, stdev) {
  return Math.exp(quantileNormal(p, mean, stdev));
}
function lognormal (mean, stdev) {
  let mu, sigma;
  const dist = {
    mean(_) {
      if (arguments.length) {
        mu = _ || 0;
        return dist;
      } else {
        return mu;
      }
    },

    stdev(_) {
      if (arguments.length) {
        sigma = _ == null ? 1 : _;
        return dist;
      } else {
        return sigma;
      }
    },

    sample: () => sampleLogNormal(mu, sigma),
    pdf: value => densityLogNormal(value, mu, sigma),
    cdf: value => cumulativeLogNormal(value, mu, sigma),
    icdf: p => quantileLogNormal(p, mu, sigma)
  };
  return dist.mean(mean).stdev(stdev);
}

function mixture (dists, weights) {
  let m = 0,
      w;

  function normalize(x) {
    const w = [];
    let sum = 0,
        i;

    for (i = 0; i < m; ++i) {
      sum += w[i] = x[i] == null ? 1 : +x[i];
    }

    for (i = 0; i < m; ++i) {
      w[i] /= sum;
    }

    return w;
  }

  const dist = {
    weights(_) {
      if (arguments.length) {
        w = normalize(weights = _ || []);
        return dist;
      }

      return weights;
    },

    distributions(_) {
      if (arguments.length) {
        if (_) {
          m = _.length;
          dists = _;
        } else {
          m = 0;
          dists = [];
        }

        return dist.weights(weights);
      }

      return dists;
    },

    sample() {
      const r = vega_statistics_module_random();
      let d = dists[m - 1],
          v = w[0],
          i = 0; // first select distribution

      for (; i < m - 1; v += w[++i]) {
        if (r < v) {
          d = dists[i];
          break;
        }
      } // then sample from it


      return d.sample();
    },

    pdf(x) {
      let p = 0,
          i = 0;

      for (; i < m; ++i) {
        p += w[i] * dists[i].pdf(x);
      }

      return p;
    },

    cdf(x) {
      let p = 0,
          i = 0;

      for (; i < m; ++i) {
        p += w[i] * dists[i].cdf(x);
      }

      return p;
    },

    icdf() {
      throw Error('Mixture icdf not supported.');
    }

  };
  return dist.distributions(dists).weights(weights);
}

function sampleUniform(min, max) {
  if (max == null) {
    max = min == null ? 1 : min;
    min = 0;
  }

  return min + (max - min) * vega_statistics_module_random();
}
function densityUniform(value, min, max) {
  if (max == null) {
    max = min == null ? 1 : min;
    min = 0;
  }

  return value >= min && value <= max ? 1 / (max - min) : 0;
}
function cumulativeUniform(value, min, max) {
  if (max == null) {
    max = min == null ? 1 : min;
    min = 0;
  }

  return value < min ? 0 : value > max ? 1 : (value - min) / (max - min);
}
function quantileUniform(p, min, max) {
  if (max == null) {
    max = min == null ? 1 : min;
    min = 0;
  }

  return p >= 0 && p <= 1 ? min + p * (max - min) : NaN;
}
function uniform (min, max) {
  let a, b;
  const dist = {
    min(_) {
      if (arguments.length) {
        a = _ || 0;
        return dist;
      } else {
        return a;
      }
    },

    max(_) {
      if (arguments.length) {
        b = _ == null ? 1 : _;
        return dist;
      } else {
        return b;
      }
    },

    sample: () => sampleUniform(a, b),
    pdf: value => densityUniform(value, a, b),
    cdf: value => cumulativeUniform(value, a, b),
    icdf: p => quantileUniform(p, a, b)
  };

  if (max == null) {
    max = min == null ? 1 : min;
    min = 0;
  }

  return dist.min(min).max(max);
}

// Ordinary Least Squares
function ols (uX, uY, uXY, uX2) {
  const delta = uX2 - uX * uX,
        slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta,
        intercept = uY - slope * uX;
  return [intercept, slope];
}

function vega_statistics_module_points(data, x, y, sort) {
  data = data.filter(d => {
    let u = x(d),
        v = y(d);
    return u != null && (u = +u) >= u && v != null && (v = +v) >= v;
  });

  if (sort) {
    data.sort((a, b) => x(a) - x(b));
  }

  const n = data.length,
        X = new Float64Array(n),
        Y = new Float64Array(n); // extract values, calculate means

  let i = 0,
      ux = 0,
      uy = 0,
      xv,
      yv,
      d;

  for (d of data) {
    X[i] = xv = +x(d);
    Y[i] = yv = +y(d);
    ++i;
    ux += (xv - ux) / i;
    uy += (yv - uy) / i;
  } // mean center the data


  for (i = 0; i < n; ++i) {
    X[i] -= ux;
    Y[i] -= uy;
  }

  return [X, Y, ux, uy];
}
function visitPoints(data, x, y, callback) {
  let i = -1,
      u,
      v;

  for (const d of data) {
    u = x(d);
    v = y(d);

    if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) {
      callback(u, v, ++i);
    }
  }
}

// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE

function rSquared (data, x, y, uY, predict) {
  let SSE = 0,
      SST = 0;
  visitPoints(data, x, y, (dx, dy) => {
    const sse = dy - predict(dx),
          sst = dy - uY;
    SSE += sse * sse;
    SST += sst * sst;
  });
  return 1 - SSE / SST;
}

// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE

function linear (data, x, y) {
  let X = 0,
      Y = 0,
      XY = 0,
      X2 = 0,
      n = 0;
  visitPoints(data, x, y, (dx, dy) => {
    ++n;
    X += (dx - X) / n;
    Y += (dy - Y) / n;
    XY += (dx * dy - XY) / n;
    X2 += (dx * dx - X2) / n;
  });

  const coef = ols(X, Y, XY, X2),
        predict = x => coef[0] + coef[1] * x;

  return {
    coef: coef,
    predict: predict,
    rSquared: rSquared(data, x, y, Y, predict)
  };
}

// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE

function log (data, x, y) {
  let X = 0,
      Y = 0,
      XY = 0,
      X2 = 0,
      n = 0;
  visitPoints(data, x, y, (dx, dy) => {
    ++n;
    dx = Math.log(dx);
    X += (dx - X) / n;
    Y += (dy - Y) / n;
    XY += (dx * dy - XY) / n;
    X2 += (dx * dx - X2) / n;
  });

  const coef = ols(X, Y, XY, X2),
        predict = x => coef[0] + coef[1] * Math.log(x);

  return {
    coef: coef,
    predict: predict,
    rSquared: rSquared(data, x, y, Y, predict)
  };
}

function exp (data, x, y) {
  // eslint-disable-next-line no-unused-vars
  const [xv, yv, ux, uy] = vega_statistics_module_points(data, x, y);
  let YL = 0,
      XY = 0,
      XYL = 0,
      X2Y = 0,
      n = 0,
      dx,
      ly,
      xy;
  visitPoints(data, x, y, (_, dy) => {
    dx = xv[n++];
    ly = Math.log(dy);
    xy = dx * dy;
    YL += (dy * ly - YL) / n;
    XY += (xy - XY) / n;
    XYL += (xy * ly - XYL) / n;
    X2Y += (dx * xy - X2Y) / n;
  });

  const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy),
        predict = x => Math.exp(c0 + c1 * (x - ux));

  return {
    coef: [Math.exp(c0 - c1 * ux), c1],
    predict: predict,
    rSquared: rSquared(data, x, y, uy, predict)
  };
}

// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE

function pow (data, x, y) {
  let X = 0,
      Y = 0,
      XY = 0,
      X2 = 0,
      YS = 0,
      n = 0;
  visitPoints(data, x, y, (dx, dy) => {
    const lx = Math.log(dx),
          ly = Math.log(dy);
    ++n;
    X += (lx - X) / n;
    Y += (ly - Y) / n;
    XY += (lx * ly - XY) / n;
    X2 += (lx * lx - X2) / n;
    YS += (dy - YS) / n;
  });

  const coef = ols(X, Y, XY, X2),
        predict = x => coef[0] * Math.pow(x, coef[1]);

  coef[0] = Math.exp(coef[0]);
  return {
    coef: coef,
    predict: predict,
    rSquared: rSquared(data, x, y, YS, predict)
  };
}

function vega_statistics_module_quad (data, x, y) {
  const [xv, yv, ux, uy] = vega_statistics_module_points(data, x, y),
        n = xv.length;
  let X2 = 0,
      X3 = 0,
      X4 = 0,
      XY = 0,
      X2Y = 0,
      i,
      dx,
      dy,
      x2;

  for (i = 0; i < n;) {
    dx = xv[i];
    dy = yv[i++];
    x2 = dx * dx;
    X2 += (x2 - X2) / i;
    X3 += (x2 * dx - X3) / i;
    X4 += (x2 * x2 - X4) / i;
    XY += (dx * dy - XY) / i;
    X2Y += (x2 * dy - X2Y) / i;
  }

  const X2X2 = X4 - X2 * X2,
        d = X2 * X2X2 - X3 * X3,
        a = (X2Y * X2 - XY * X3) / d,
        b = (XY * X2X2 - X2Y * X3) / d,
        c = -a * X2,
        predict = x => {
    x = x - ux;
    return a * x * x + b * x + c + uy;
  }; // transform coefficients back from mean-centered space


  return {
    coef: [c - b * ux + a * ux * ux + uy, b - 2 * a * ux, a],
    predict: predict,
    rSquared: rSquared(data, x, y, uy, predict)
  };
}

// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE
// ... which was adapted from regression-js by Tom Alexander
// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246
// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE

function poly (data, x, y, order) {
  // use more efficient methods for lower orders
  if (order === 1) return linear(data, x, y);
  if (order === 2) return vega_statistics_module_quad(data, x, y);
  const [xv, yv, ux, uy] = vega_statistics_module_points(data, x, y),
        n = xv.length,
        lhs = [],
        rhs = [],
        k = order + 1;
  let i, j, l, v, c;

  for (i = 0; i < k; ++i) {
    for (l = 0, v = 0; l < n; ++l) {
      v += Math.pow(xv[l], i) * yv[l];
    }

    lhs.push(v);
    c = new Float64Array(k);

    for (j = 0; j < k; ++j) {
      for (l = 0, v = 0; l < n; ++l) {
        v += Math.pow(xv[l], i + j);
      }

      c[j] = v;
    }

    rhs.push(c);
  }

  rhs.push(lhs);

  const coef = gaussianElimination(rhs),
        predict = x => {
    x -= ux;
    let y = uy + coef[0] + coef[1] * x + coef[2] * x * x;

    for (i = 3; i < k; ++i) y += coef[i] * Math.pow(x, i);

    return y;
  };

  return {
    coef: uncenter(k, coef, -ux, uy),
    predict: predict,
    rSquared: rSquared(data, x, y, uy, predict)
  };
}

function uncenter(k, a, x, y) {
  const z = Array(k);
  let i, j, v, c; // initialize to zero

  for (i = 0; i < k; ++i) z[i] = 0; // polynomial expansion


  for (i = k - 1; i >= 0; --i) {
    v = a[i];
    c = 1;
    z[i] += v;

    for (j = 1; j <= i; ++j) {
      c *= (i + 1 - j) / j; // binomial coefficent

      z[i - j] += v * Math.pow(x, j) * c;
    }
  } // bias term


  z[0] += y;
  return z;
} // Given an array for a two-dimensional matrix and the polynomial order,
// solve A * x = b using Gaussian elimination.


function gaussianElimination(matrix) {
  const n = matrix.length - 1,
        coef = [];
  let i, j, k, r, t;

  for (i = 0; i < n; ++i) {
    r = i; // max row

    for (j = i + 1; j < n; ++j) {
      if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) {
        r = j;
      }
    }

    for (k = i; k < n + 1; ++k) {
      t = matrix[k][i];
      matrix[k][i] = matrix[k][r];
      matrix[k][r] = t;
    }

    for (j = i + 1; j < n; ++j) {
      for (k = n; k >= i; k--) {
        matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i];
      }
    }
  }

  for (j = n - 1; j >= 0; --j) {
    t = 0;

    for (k = j + 1; k < n; ++k) {
      t += matrix[k][j] * coef[k];
    }

    coef[j] = (matrix[n][j] - t) / matrix[j][j];
  }

  return coef;
}

const maxiters = 2,
      epsilon = 1e-12; // Adapted from science.js by Jason Davies
// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js
// License: https://github.com/jasondavies/science.js/blob/master/LICENSE

function vega_statistics_module_loess (data, x, y, bandwidth) {
  const [xv, yv, ux, uy] = vega_statistics_module_points(data, x, y, true),
        n = xv.length,
        bw = Math.max(2, ~~(bandwidth * n)),
        // # nearest neighbors
  yhat = new Float64Array(n),
        residuals = new Float64Array(n),
        robustWeights = new Float64Array(n).fill(1);

  for (let iter = -1; ++iter <= maxiters;) {
    const interval = [0, bw - 1];

    for (let i = 0; i < n; ++i) {
      const dx = xv[i],
            i0 = interval[0],
            i1 = interval[1],
            edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1;
      let W = 0,
          X = 0,
          Y = 0,
          XY = 0,
          X2 = 0;
      const denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity!

      for (let k = i0; k <= i1; ++k) {
        const xk = xv[k],
              yk = yv[k],
              w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k],
              xkw = xk * w;
        W += w;
        X += xkw;
        Y += yk * w;
        XY += yk * xkw;
        X2 += xk * xkw;
      } // linear regression fit


      const [a, b] = ols(X / W, Y / W, XY / W, X2 / W);
      yhat[i] = a + b * dx;
      residuals[i] = Math.abs(yv[i] - yhat[i]);
      updateInterval(xv, i + 1, interval);
    }

    if (iter === maxiters) {
      break;
    }

    const medianResidual = median(residuals);
    if (Math.abs(medianResidual) < epsilon) break;

    for (let i = 0, arg, w; i < n; ++i) {
      arg = residuals[i] / (6 * medianResidual); // default to epsilon (rather than zero) for large deviations
      // keeping weights tiny but non-zero prevents singularites

      robustWeights[i] = arg >= 1 ? epsilon : (w = 1 - arg * arg) * w;
    }
  }

  return vega_statistics_module_output(xv, yhat, ux, uy);
} // weighting kernel for local regression

function tricube(x) {
  return (x = 1 - x * x * x) * x * x;
} // advance sliding window interval of nearest neighbors


function updateInterval(xv, i, interval) {
  const val = xv[i];
  let left = interval[0],
      right = interval[1] + 1;
  if (right >= xv.length) return; // step right if distance to new right edge is <= distance to old left edge
  // step when distance is equal to ensure movement over duplicate x values

  while (i > left && xv[right] - val <= val - xv[left]) {
    interval[0] = ++left;
    interval[1] = right;
    ++right;
  }
} // generate smoothed output points
// average points with repeated x values


function vega_statistics_module_output(xv, yhat, ux, uy) {
  const n = xv.length,
        out = [];
  let i = 0,
      cnt = 0,
      prev = [],
      v;

  for (; i < n; ++i) {
    v = xv[i] + ux;

    if (prev[0] === v) {
      // average output values via online update
      prev[1] += (yhat[i] - prev[1]) / ++cnt;
    } else {
      // add new output point
      cnt = 0;
      prev[1] += uy;
      prev = [v, yhat[i]];
      out.push(prev);
    }
  }

  prev[1] += uy;
  return out;
}

// subdivide up to accuracy of 0.5 degrees
const MIN_RADIANS = 0.5 * Math.PI / 180; // Adaptively sample an interpolated function over a domain extent

function sampleCurve (f, extent, minSteps, maxSteps) {
  minSteps = minSteps || 25;
  maxSteps = Math.max(minSteps, maxSteps || 200);

  const point = x => [x, f(x)],
        minX = extent[0],
        maxX = extent[1],
        span = maxX - minX,
        stop = span / maxSteps,
        prev = [point(minX)],
        next = [];

  if (minSteps === maxSteps) {
    // no adaptation, sample uniform grid directly and return
    for (let i = 1; i < maxSteps; ++i) {
      prev.push(point(minX + i / minSteps * span));
    }

    prev.push(point(maxX));
    return prev;
  } else {
    // sample minimum points on uniform grid
    // then move on to perform adaptive refinement
    next.push(point(maxX));

    for (let i = minSteps; --i > 0;) {
      next.push(point(minX + i / minSteps * span));
    }
  }

  let p0 = prev[0];
  let p1 = next[next.length - 1];
  const sx = 1 / span;
  const sy = scaleY(p0[1], next);

  while (p1) {
    // midpoint for potential curve subdivision
    const pm = point((p0[0] + p1[0]) / 2);
    const dx = pm[0] - p0[0] >= stop;

    if (dx && angleDelta(p0, pm, p1, sx, sy) > MIN_RADIANS) {
      // maximum resolution has not yet been met, and
      // subdivision midpoint is sufficiently different from endpoint
      // save subdivision, push midpoint onto the visitation stack
      next.push(pm);
    } else {
      // subdivision midpoint sufficiently similar to endpoint
      // skip subdivision, store endpoint, move to next point on the stack
      p0 = p1;
      prev.push(p1);
      next.pop();
    }

    p1 = next[next.length - 1];
  }

  return prev;
}

function scaleY(init, points) {
  let ymin = init;
  let ymax = init;
  const n = points.length;

  for (let i = 0; i < n; ++i) {
    const y = points[i][1];
    if (y < ymin) ymin = y;
    if (y > ymax) ymax = y;
  }

  return 1 / (ymax - ymin);
}

function angleDelta(p, q, r, sx, sy) {
  const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])),
        a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0]));
  return Math.abs(a0 - a1);
}



// CONCATENATED MODULE: ./node_modules/d3-array/src/mean.js
function mean(values, valueof) {
  let count = 0;
  let sum = 0;
  if (valueof === undefined) {
    for (let value of values) {
      if (value != null && (value = +value) >= value) {
        ++count, sum += value;
      }
    }
  } else {
    let index = -1;
    for (let value of values) {
      if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
        ++count, sum += value;
      }
    }
  }
  if (count) return sum / count;
}

// CONCATENATED MODULE: ./node_modules/d3-array/src/range.js
/* harmony default export */ var src_range = (function(start, stop, step) {
  start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;

  var i = -1,
      n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
      range = new Array(n);

  while (++i < n) {
    range[i] = start + i * step;
  }

  return range;
});

// EXTERNAL MODULE: ./node_modules/d3-array/src/bisector.js
var bisector = __webpack_require__("2a2d");

// EXTERNAL MODULE: ./node_modules/vega-time/build/vega-time.module.js
var vega_time_module = __webpack_require__("de28");

// CONCATENATED MODULE: ./node_modules/vega-transforms/build/vega-transforms.module.js






function multikey(f) {
  return x => {
    const n = f.length;
    let i = 1,
        k = String(f[0](x));

    for (; i < n; ++i) {
      k += '|' + f[i](x);
    }

    return k;
  };
}
function groupkey(fields) {
  return !fields || !fields.length ? function () {
    return '';
  } : fields.length === 1 ? fields[0] : multikey(fields);
}

function measureName(op, field, as) {
  return as || op + (!field ? '' : '_' + field);
}

const noop = () => {};

const base_op = {
  init: noop,
  add: noop,
  rem: noop,
  idx: 0
};
const AggregateOps = {
  values: {
    init: m => m.cell.store = true,
    value: m => m.cell.data.values(),
    idx: -1
  },
  count: {
    value: m => m.cell.num
  },
  __count__: {
    value: m => m.missing + m.valid
  },
  missing: {
    value: m => m.missing
  },
  valid: {
    value: m => m.valid
  },
  sum: {
    init: m => m.sum = 0,
    value: m => m.sum,
    add: (m, v) => m.sum += +v,
    rem: (m, v) => m.sum -= v
  },
  product: {
    init: m => m.product = 1,
    value: m => m.valid ? m.product : undefined,
    add: (m, v) => m.product *= v,
    rem: (m, v) => m.product /= v
  },
  mean: {
    init: m => m.mean = 0,
    value: m => m.valid ? m.mean : undefined,
    add: (m, v) => (m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid),
    rem: (m, v) => (m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean)
  },
  average: {
    value: m => m.valid ? m.mean : undefined,
    req: ['mean'],
    idx: 1
  },
  variance: {
    init: m => m.dev = 0,
    value: m => m.valid > 1 ? m.dev / (m.valid - 1) : undefined,
    add: (m, v) => m.dev += m.mean_d * (v - m.mean),
    rem: (m, v) => m.dev -= m.mean_d * (v - m.mean),
    req: ['mean'],
    idx: 1
  },
  variancep: {
    value: m => m.valid > 1 ? m.dev / m.valid : undefined,
    req: ['variance'],
    idx: 2
  },
  stdev: {
    value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined,
    req: ['variance'],
    idx: 2
  },
  stdevp: {
    value: m => m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined,
    req: ['variance'],
    idx: 2
  },
  stderr: {
    value: m => m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined,
    req: ['variance'],
    idx: 2
  },
  distinct: {
    value: m => m.cell.data.distinct(m.get),
    req: ['values'],
    idx: 3
  },
  ci0: {
    value: m => m.cell.data.ci0(m.get),
    req: ['values'],
    idx: 3
  },
  ci1: {
    value: m => m.cell.data.ci1(m.get),
    req: ['values'],
    idx: 3
  },
  median: {
    value: m => m.cell.data.q2(m.get),
    req: ['values'],
    idx: 3
  },
  q1: {
    value: m => m.cell.data.q1(m.get),
    req: ['values'],
    idx: 3
  },
  q3: {
    value: m => m.cell.data.q3(m.get),
    req: ['values'],
    idx: 3
  },
  min: {
    init: m => m.min = undefined,
    value: m => m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min,
    add: (m, v) => {
      if (v < m.min || m.min === undefined) m.min = v;
    },
    rem: (m, v) => {
      if (v <= m.min) m.min = NaN;
    },
    req: ['values'],
    idx: 4
  },
  max: {
    init: m => m.max = undefined,
    value: m => m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max,
    add: (m, v) => {
      if (v > m.max || m.max === undefined) m.max = v;
    },
    rem: (m, v) => {
      if (v >= m.max) m.max = NaN;
    },
    req: ['values'],
    idx: 4
  },
  argmin: {
    init: m => m.argmin = undefined,
    value: m => m.argmin || m.cell.data.argmin(m.get),
    add: (m, v, t) => {
      if (v < m.min) m.argmin = t;
    },
    rem: (m, v) => {
      if (v <= m.min) m.argmin = undefined;
    },
    req: ['min', 'values'],
    idx: 3
  },
  argmax: {
    init: m => m.argmax = undefined,
    value: m => m.argmax || m.cell.data.argmax(m.get),
    add: (m, v, t) => {
      if (v > m.max) m.argmax = t;
    },
    rem: (m, v) => {
      if (v >= m.max) m.argmax = undefined;
    },
    req: ['max', 'values'],
    idx: 3
  }
};
const ValidAggregateOps = Object.keys(AggregateOps);

function measure(key, value) {
  return out => Object(vega_util_module["p" /* extend */])({
    name: key,
    out: out || key
  }, base_op, value);
}

ValidAggregateOps.forEach(key => {
  AggregateOps[key] = measure(key, AggregateOps[key]);
});
function createMeasure(op, name) {
  return AggregateOps[op](name);
}

function compareIndex(a, b) {
  return a.idx - b.idx;
}

function vega_transforms_module_resolve(agg) {
  const map = {};
  agg.forEach(a => map[a.name] = a);

  const getreqs = a => {
    if (!a.req) return;
    a.req.forEach(key => {
      if (!map[key]) getreqs(map[key] = AggregateOps[key]());
    });
  };

  agg.forEach(getreqs);
  return Object.values(map).sort(compareIndex);
}

function vega_transforms_module_init() {
  this.valid = 0;
  this.missing = 0;

  this._ops.forEach(op => op.init(this));
}

function vega_transforms_module_add(v, t) {
  if (v == null || v === '') {
    ++this.missing;
    return;
  }

  if (v !== v) return;
  ++this.valid;

  this._ops.forEach(op => op.add(this, v, t));
}

function vega_transforms_module_rem(v, t) {
  if (v == null || v === '') {
    --this.missing;
    return;
  }

  if (v !== v) return;
  --this.valid;

  this._ops.forEach(op => op.rem(this, v, t));
}

function vega_transforms_module_set(t) {
  this._out.forEach(op => t[op.out] = op.value(this));

  return t;
}

function compileMeasures(agg, field) {
  const get = field || vega_util_module["y" /* identity */],
        ops = vega_transforms_module_resolve(agg),
        out = agg.slice().sort(compareIndex);

  function ctr(cell) {
    this._ops = ops;
    this._out = out;
    this.cell = cell;
    this.init();
  }

  ctr.prototype.init = vega_transforms_module_init;
  ctr.prototype.add = vega_transforms_module_add;
  ctr.prototype.rem = vega_transforms_module_rem;
  ctr.prototype.set = vega_transforms_module_set;
  ctr.prototype.get = get;
  ctr.fields = agg.map(op => op.out);
  return ctr;
}

function TupleStore(key) {
  this._key = key ? Object(vega_util_module["u" /* field */])(key) : tupleid;
  this.reset();
}
const prototype$1 = TupleStore.prototype;

prototype$1.reset = function () {
  this._add = [];
  this._rem = [];
  this._ext = null;
  this._get = null;
  this._q = null;
};

prototype$1.add = function (v) {
  this._add.push(v);
};

prototype$1.rem = function (v) {
  this._rem.push(v);
};

prototype$1.values = function () {
  this._get = null;
  if (this._rem.length === 0) return this._add;
  const a = this._add,
        r = this._rem,
        k = this._key,
        n = a.length,
        m = r.length,
        x = Array(n - m),
        map = {};
  let i, j, v; // use unique key field to clear removed values

  for (i = 0; i < m; ++i) {
    map[k(r[i])] = 1;
  }

  for (i = 0, j = 0; i < n; ++i) {
    if (map[k(v = a[i])]) {
      map[k(v)] = 0;
    } else {
      x[j++] = v;
    }
  }

  this._rem = [];
  return this._add = x;
}; // memoizing statistics methods


prototype$1.distinct = function (get) {
  const v = this.values(),
        map = {};
  let n = v.length,
      count = 0,
      s;

  while (--n >= 0) {
    s = get(v[n]) + '';

    if (!Object(vega_util_module["w" /* hasOwnProperty */])(map, s)) {
      map[s] = 1;
      ++count;
    }
  }

  return count;
};

prototype$1.extent = function (get) {
  if (this._get !== get || !this._ext) {
    const v = this.values(),
          i = Object(vega_util_module["r" /* extentIndex */])(v, get);
    this._ext = [v[i[0]], v[i[1]]];
    this._get = get;
  }

  return this._ext;
};

prototype$1.argmin = function (get) {
  return this.extent(get)[0] || {};
};

prototype$1.argmax = function (get) {
  return this.extent(get)[1] || {};
};

prototype$1.min = function (get) {
  const m = this.extent(get)[0];
  return m != null ? get(m) : undefined;
};

prototype$1.max = function (get) {
  const m = this.extent(get)[1];
  return m != null ? get(m) : undefined;
};

prototype$1.quartile = function (get) {
  if (this._get !== get || !this._q) {
    this._q = quartiles(this.values(), get);
    this._get = get;
  }

  return this._q;
};

prototype$1.q1 = function (get) {
  return this.quartile(get)[0];
};

prototype$1.q2 = function (get) {
  return this.quartile(get)[1];
};

prototype$1.q3 = function (get) {
  return this.quartile(get)[2];
};

prototype$1.ci = function (get) {
  if (this._get !== get || !this._ci) {
    this._ci = bootstrapCI(this.values(), 1000, 0.05, get);
    this._get = get;
  }

  return this._ci;
};

prototype$1.ci0 = function (get) {
  return this.ci(get)[0];
};

prototype$1.ci1 = function (get) {
  return this.ci(get)[1];
};

/**
 * Group-by aggregation operator.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby.
 * @param {Array<function(object): *>} [params.fields] - An array of accessors to aggregate.
 * @param {Array<string>} [params.ops] - An array of strings indicating aggregation operations.
 * @param {Array<string>} [params.as] - An array of output field names for aggregated values.
 * @param {boolean} [params.cross=false] - A flag indicating that the full
 *   cross-product of groupby values should be generated, including empty cells.
 *   If true, the drop parameter is ignored and empty cells are retained.
 * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed.
 */

function Aggregate(params) {
  Transform.call(this, null, params);
  this._adds = []; // array of added output tuples

  this._mods = []; // array of modified output tuples

  this._alen = 0; // number of active added tuples

  this._mlen = 0; // number of active modified tuples

  this._drop = true; // should empty aggregation cells be removed

  this._cross = false; // produce full cross-product of group-by values

  this._dims = []; // group-by dimension accessors

  this._dnames = []; // group-by dimension names

  this._measures = []; // collection of aggregation monoids

  this._countOnly = false; // flag indicating only count aggregation

  this._counts = null; // collection of count fields

  this._prev = null; // previous aggregation cells

  this._inputs = null; // array of dependent input tuple field names

  this._outputs = null; // array of output tuple field names
}
Aggregate.Definition = {
  'type': 'Aggregate',
  'metadata': {
    'generates': true,
    'changes': true
  },
  'params': [{
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'ops',
    'type': 'enum',
    'array': true,
    'values': ValidAggregateOps
  }, {
    'name': 'fields',
    'type': 'field',
    'null': true,
    'array': true
  }, {
    'name': 'as',
    'type': 'string',
    'null': true,
    'array': true
  }, {
    'name': 'drop',
    'type': 'boolean',
    'default': true
  }, {
    'name': 'cross',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'key',
    'type': 'field'
  }]
};
Object(vega_util_module["z" /* inherits */])(Aggregate, Transform, {
  transform(_, pulse) {
    const aggr = this,
          out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
          mod = _.modified();

    aggr.stamp = out.stamp;

    if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) {
      aggr._prev = aggr.value;
      aggr.value = mod ? aggr.init(_) : {};
      pulse.visit(pulse.SOURCE, t => aggr.add(t));
    } else {
      aggr.value = aggr.value || aggr.init(_);
      pulse.visit(pulse.REM, t => aggr.rem(t));
      pulse.visit(pulse.ADD, t => aggr.add(t));
    } // Indicate output fields and return aggregate tuples.


    out.modifies(aggr._outputs); // Should empty cells be dropped?

    aggr._drop = _.drop !== false; // If domain cross-product requested, generate empty cells as needed
    // and ensure that empty cells are not dropped

    if (_.cross && aggr._dims.length > 1) {
      aggr._drop = false;
      aggr.cross();
    }

    if (pulse.clean() && aggr._drop) {
      out.clean(true).runAfter(() => this.clean());
    }

    return aggr.changes(out);
  },

  cross() {
    const aggr = this,
          curr = aggr.value,
          dims = aggr._dnames,
          vals = dims.map(() => ({})),
          n = dims.length; // collect all group-by domain values

    function collect(cells) {
      let key, i, t, v;

      for (key in cells) {
        t = cells[key].tuple;

        for (i = 0; i < n; ++i) {
          vals[i][v = t[dims[i]]] = v;
        }
      }
    }

    collect(aggr._prev);
    collect(curr); // iterate over key cross-product, create cells as needed

    function generate(base, tuple, index) {
      const name = dims[index],
            v = vals[index++];

      for (const k in v) {
        const key = base ? base + '|' + k : k;
        tuple[name] = v[k];
        if (index < n) generate(key, tuple, index);else if (!curr[key]) aggr.cell(key, tuple);
      }
    }

    generate('', {}, 0);
  },

  init(_) {
    // initialize input and output fields
    const inputs = this._inputs = [],
          outputs = this._outputs = [],
          inputMap = {};

    function inputVisit(get) {
      const fields = Object(vega_util_module["i" /* array */])(Object(vega_util_module["g" /* accessorFields */])(get)),
            n = fields.length;
      let i = 0,
          f;

      for (; i < n; ++i) {
        if (!inputMap[f = fields[i]]) {
          inputMap[f] = 1;
          inputs.push(f);
        }
      }
    } // initialize group-by dimensions


    this._dims = Object(vega_util_module["i" /* array */])(_.groupby);
    this._dnames = this._dims.map(d => {
      const dname = Object(vega_util_module["h" /* accessorName */])(d);
      inputVisit(d);
      outputs.push(dname);
      return dname;
    });
    this.cellkey = _.key ? _.key : groupkey(this._dims); // initialize aggregate measures

    this._countOnly = true;
    this._counts = [];
    this._measures = [];
    const fields = _.fields || [null],
          ops = _.ops || ['count'],
          as = _.as || [],
          n = fields.length,
          map = {};
    let field, op, m, mname, outname, i;

    if (n !== ops.length) {
      Object(vega_util_module["o" /* error */])('Unmatched number of fields and aggregate ops.');
    }

    for (i = 0; i < n; ++i) {
      field = fields[i];
      op = ops[i];

      if (field == null && op !== 'count') {
        Object(vega_util_module["o" /* error */])('Null aggregate field specified.');
      }

      mname = Object(vega_util_module["h" /* accessorName */])(field);
      outname = measureName(op, mname, as[i]);
      outputs.push(outname);

      if (op === 'count') {
        this._counts.push(outname);

        continue;
      }

      m = map[mname];

      if (!m) {
        inputVisit(field);
        m = map[mname] = [];
        m.field = field;

        this._measures.push(m);
      }

      if (op !== 'count') this._countOnly = false;
      m.push(createMeasure(op, outname));
    }

    this._measures = this._measures.map(m => compileMeasures(m, m.field));
    return {}; // aggregation cells (this.value)
  },

  // -- Cell Management -----
  cellkey: groupkey(),

  cell(key, t) {
    let cell = this.value[key];

    if (!cell) {
      cell = this.value[key] = this.newcell(key, t);
      this._adds[this._alen++] = cell;
    } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) {
      cell.stamp = this.stamp;
      this._adds[this._alen++] = cell;
    } else if (cell.stamp < this.stamp) {
      cell.stamp = this.stamp;
      this._mods[this._mlen++] = cell;
    }

    return cell;
  },

  newcell(key, t) {
    const cell = {
      key: key,
      num: 0,
      agg: null,
      tuple: this.newtuple(t, this._prev && this._prev[key]),
      stamp: this.stamp,
      store: false
    };

    if (!this._countOnly) {
      const measures = this._measures,
            n = measures.length;
      cell.agg = Array(n);

      for (let i = 0; i < n; ++i) {
        cell.agg[i] = new measures[i](cell);
      }
    }

    if (cell.store) {
      cell.data = new TupleStore();
    }

    return cell;
  },

  newtuple(t, p) {
    const names = this._dnames,
          dims = this._dims,
          n = dims.length,
          x = {};

    for (let i = 0; i < n; ++i) {
      x[names[i]] = dims[i](t);
    }

    return p ? replace(p.tuple, x) : ingest$1(x);
  },

  clean() {
    const cells = this.value;

    for (const key in cells) {
      if (cells[key].num === 0) {
        delete cells[key];
      }
    }
  },

  // -- Process Tuples -----
  add(t) {
    const key = this.cellkey(t),
          cell = this.cell(key, t);
    cell.num += 1;
    if (this._countOnly) return;
    if (cell.store) cell.data.add(t);
    const agg = cell.agg;

    for (let i = 0, n = agg.length; i < n; ++i) {
      agg[i].add(agg[i].get(t), t);
    }
  },

  rem(t) {
    const key = this.cellkey(t),
          cell = this.cell(key, t);
    cell.num -= 1;
    if (this._countOnly) return;
    if (cell.store) cell.data.rem(t);
    const agg = cell.agg;

    for (let i = 0, n = agg.length; i < n; ++i) {
      agg[i].rem(agg[i].get(t), t);
    }
  },

  celltuple(cell) {
    const tuple = cell.tuple,
          counts = this._counts; // consolidate stored values

    if (cell.store) {
      cell.data.values();
    } // update tuple properties


    for (let i = 0, n = counts.length; i < n; ++i) {
      tuple[counts[i]] = cell.num;
    }

    if (!this._countOnly) {
      const agg = cell.agg;

      for (let i = 0, n = agg.length; i < n; ++i) {
        agg[i].set(tuple);
      }
    }

    return tuple;
  },

  changes(out) {
    const adds = this._adds,
          mods = this._mods,
          prev = this._prev,
          drop = this._drop,
          add = out.add,
          rem = out.rem,
          mod = out.mod;
    let cell, key, i, n;
    if (prev) for (key in prev) {
      cell = prev[key];
      if (!drop || cell.num) rem.push(cell.tuple);
    }

    for (i = 0, n = this._alen; i < n; ++i) {
      add.push(this.celltuple(adds[i]));
      adds[i] = null; // for garbage collection
    }

    for (i = 0, n = this._mlen; i < n; ++i) {
      cell = mods[i];
      (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell));
      mods[i] = null; // for garbage collection
    }

    this._alen = this._mlen = 0; // reset list of active cells

    this._prev = null;
    return out;
  }

});

const EPSILON$1 = 1e-14;
/**
 * Generates a binning function for discretizing data.
 * @constructor
 * @param {object} params - The parameters for this operator. The
 *   provided values should be valid options for the {@link bin} function.
 * @param {function(object): *} params.field - The data field to bin.
 */

function Bin(params) {
  Transform.call(this, null, params);
}
Bin.Definition = {
  'type': 'Bin',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field',
    'required': true
  }, {
    'name': 'interval',
    'type': 'boolean',
    'default': true
  }, {
    'name': 'anchor',
    'type': 'number'
  }, {
    'name': 'maxbins',
    'type': 'number',
    'default': 20
  }, {
    'name': 'base',
    'type': 'number',
    'default': 10
  }, {
    'name': 'divide',
    'type': 'number',
    'array': true,
    'default': [5, 2]
  }, {
    'name': 'extent',
    'type': 'number',
    'array': true,
    'length': 2,
    'required': true
  }, {
    'name': 'span',
    'type': 'number'
  }, {
    'name': 'step',
    'type': 'number'
  }, {
    'name': 'steps',
    'type': 'number',
    'array': true
  }, {
    'name': 'minstep',
    'type': 'number',
    'default': 0
  }, {
    'name': 'nice',
    'type': 'boolean',
    'default': true
  }, {
    'name': 'name',
    'type': 'string'
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': 2,
    'default': ['bin0', 'bin1']
  }]
};
Object(vega_util_module["z" /* inherits */])(Bin, Transform, {
  transform(_, pulse) {
    const band = _.interval !== false,
          bins = this._bins(_),
          start = bins.start,
          step = bins.step,
          as = _.as || ['bin0', 'bin1'],
          b0 = as[0],
          b1 = as[1];

    let flag;

    if (_.modified()) {
      pulse = pulse.reflow(true);
      flag = pulse.SOURCE;
    } else {
      flag = pulse.modified(Object(vega_util_module["g" /* accessorFields */])(_.field)) ? pulse.ADD_MOD : pulse.ADD;
    }

    pulse.visit(flag, band ? t => {
      const v = bins(t); // minimum bin value (inclusive)

      t[b0] = v; // maximum bin value (exclusive)
      // use convoluted math for better floating point agreement
      // see https://github.com/vega/vega/issues/830
      // infinite values propagate through this formula! #2227

      t[b1] = v == null ? null : start + step * (1 + (v - start) / step);
    } : t => t[b0] = bins(t));
    return pulse.modifies(band ? as : b0);
  },

  _bins(_) {
    if (this.value && !_.modified()) {
      return this.value;
    }

    const field = _.field,
          bins = vega_statistics_module_bin(_),
          step = bins.step;
    let start = bins.start,
        stop = start + Math.ceil((bins.stop - start) / step) * step,
        a,
        d;

    if ((a = _.anchor) != null) {
      d = a - (start + step * Math.floor((a - start) / step));
      start += d;
      stop += d;
    }

    const f = function (t) {
      let v = Object(vega_util_module["eb" /* toNumber */])(field(t));
      return v == null ? null : v < start ? -Infinity : v > stop ? +Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step));
    };

    f.start = start;
    f.stop = bins.stop;
    f.step = step;
    return this.value = Object(vega_util_module["f" /* accessor */])(f, Object(vega_util_module["g" /* accessorFields */])(field), _.name || 'bin_' + Object(vega_util_module["h" /* accessorName */])(field));
  }

});

function SortedList (idFunc, source, input) {
  const $ = idFunc;
  let data = source || [],
      add = input || [],
      rem = {},
      cnt = 0;
  return {
    add: t => add.push(t),
    remove: t => rem[$(t)] = ++cnt,
    size: () => data.length,
    data: (compare, resort) => {
      if (cnt) {
        data = data.filter(t => !rem[$(t)]);
        rem = {};
        cnt = 0;
      }

      if (resort && compare) {
        data.sort(compare);
      }

      if (add.length) {
        data = compare ? Object(vega_util_module["O" /* merge */])(compare, data, add.sort(compare)) : data.concat(add);
        add = [];
      }

      return data;
    }
  };
}

/**
 * Collects all data tuples that pass through this operator.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(*,*): number} [params.sort] - An optional
 *   comparator function for additionally sorting the collected tuples.
 */

function Collect(params) {
  Transform.call(this, [], params);
}
Collect.Definition = {
  'type': 'Collect',
  'metadata': {
    'source': true
  },
  'params': [{
    'name': 'sort',
    'type': 'compare'
  }]
};
Object(vega_util_module["z" /* inherits */])(Collect, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.ALL),
          list = SortedList(tupleid, this.value, out.materialize(out.ADD).add),
          sort = _.sort,
          mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields));
    out.visit(out.REM, list.remove);
    this.modified(mod);
    this.value = out.source = list.data(stableCompare(sort), mod); // propagate tree root if defined

    if (pulse.source && pulse.source.root) {
      this.value.root = pulse.source.root;
    }

    return out;
  }

});

/**
 * Generates a comparator function.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<string|function>} params.fields - The fields to compare.
 * @param {Array<string>} [params.orders] - The sort orders.
 *   Each entry should be one of "ascending" (default) or "descending".
 */

function Compare(params) {
  Operator.call(this, null, update$5, params);
}
Object(vega_util_module["z" /* inherits */])(Compare, Operator);

function update$5(_) {
  return this.value && !_.modified() ? this.value : Object(vega_util_module["l" /* compare */])(_.fields, _.orders);
}

/**
 * Count regexp-defined pattern occurrences in a text field.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - An accessor for the text field.
 * @param {string} [params.pattern] - RegExp string defining the text pattern.
 * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case.
 * @param {string} [params.stopwords] - RegExp string of words to ignore.
 */

function CountPattern(params) {
  Transform.call(this, null, params);
}
CountPattern.Definition = {
  'type': 'CountPattern',
  'metadata': {
    'generates': true,
    'changes': true
  },
  'params': [{
    'name': 'field',
    'type': 'field',
    'required': true
  }, {
    'name': 'case',
    'type': 'enum',
    'values': ['upper', 'lower', 'mixed'],
    'default': 'mixed'
  }, {
    'name': 'pattern',
    'type': 'string',
    'default': '[\\w"]+'
  }, {
    'name': 'stopwords',
    'type': 'string',
    'default': ''
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': 2,
    'default': ['text', 'count']
  }]
};

function tokenize(text, tcase, match) {
  switch (tcase) {
    case 'upper':
      text = text.toUpperCase();
      break;

    case 'lower':
      text = text.toLowerCase();
      break;
  }

  return text.match(match);
}

Object(vega_util_module["z" /* inherits */])(CountPattern, Transform, {
  transform(_, pulse) {
    const process = update => tuple => {
      var tokens = tokenize(get(tuple), _.case, match) || [],
          t;

      for (var i = 0, n = tokens.length; i < n; ++i) {
        if (!stop.test(t = tokens[i])) update(t);
      }
    };

    const init = this._parameterCheck(_, pulse),
          counts = this._counts,
          match = this._match,
          stop = this._stop,
          get = _.field,
          as = _.as || ['text', 'count'],
          add = process(t => counts[t] = 1 + (counts[t] || 0)),
          rem = process(t => counts[t] -= 1);

    if (init) {
      pulse.visit(pulse.SOURCE, add);
    } else {
      pulse.visit(pulse.ADD, add);
      pulse.visit(pulse.REM, rem);
    }

    return this._finish(pulse, as); // generate output tuples
  },

  _parameterCheck(_, pulse) {
    let init = false;

    if (_.modified('stopwords') || !this._stop) {
      this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i');
      init = true;
    }

    if (_.modified('pattern') || !this._match) {
      this._match = new RegExp(_.pattern || '[\\w\']+', 'g');
      init = true;
    }

    if (_.modified('field') || pulse.modified(_.field.fields)) {
      init = true;
    }

    if (init) this._counts = {};
    return init;
  },

  _finish(pulse, as) {
    const counts = this._counts,
          tuples = this._tuples || (this._tuples = {}),
          text = as[0],
          count = as[1],
          out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
    let w, t, c;

    for (w in counts) {
      t = tuples[w];
      c = counts[w] || 0;

      if (!t && c) {
        tuples[w] = t = ingest$1({});
        t[text] = w;
        t[count] = c;
        out.add.push(t);
      } else if (c === 0) {
        if (t) out.rem.push(t);
        counts[w] = null;
        tuples[w] = null;
      } else if (t[count] !== c) {
        t[count] = c;
        out.mod.push(t);
      }
    }

    return out.modifies(as);
  }

});

/**
 * Perform a cross-product of a tuple stream with itself.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object):boolean} [params.filter] - An optional filter
 *   function for selectively including tuples in the cross product.
 * @param {Array<string>} [params.as] - The names of the output fields.
 */

function Cross(params) {
  Transform.call(this, null, params);
}
Cross.Definition = {
  'type': 'Cross',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'filter',
    'type': 'expr'
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': 2,
    'default': ['a', 'b']
  }]
};
Object(vega_util_module["z" /* inherits */])(Cross, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE),
          as = _.as || ['a', 'b'],
          a = as[0],
          b = as[1],
          reset = !this.value || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter');

    let data = this.value;

    if (reset) {
      if (data) out.rem = data;
      data = pulse.materialize(pulse.SOURCE).source;
      out.add = this.value = vega_transforms_module_cross(data, a, b, _.filter || vega_util_module["ib" /* truthy */]);
    } else {
      out.mod = data;
    }

    out.source = this.value;
    return out.modifies(as);
  }

});

function vega_transforms_module_cross(input, a, b, filter) {
  var data = [],
      t = {},
      n = input.length,
      i = 0,
      j,
      left;

  for (; i < n; ++i) {
    t[a] = left = input[i];

    for (j = 0; j < n; ++j) {
      t[b] = input[j];

      if (filter(t)) {
        data.push(ingest$1(t));
        t = {};
        t[a] = left;
      }
    }
  }

  return data;
}

const Distributions = {
  kde: vega_statistics_module_kde,
  mixture: mixture,
  normal: gaussian,
  lognormal: lognormal,
  uniform: uniform
};
const DISTRIBUTIONS = 'distributions',
      FUNCTION = 'function',
      FIELD = 'field';
/**
 * Parse a parameter object for a probability distribution.
 * @param {object} def - The distribution parameter object.
 * @param {function():Array<object>} - A method for requesting
 *   source data. Used for distributions (such as KDE) that
 *   require sample data points. This method will only be
 *   invoked if the 'from' parameter for a target data source
 *   is not provided. Typically this method returns backing
 *   source data for a Pulse object.
 * @return {object} - The output distribution object.
 */

function vega_transforms_module_parse(def, data) {
  const func = def[FUNCTION];

  if (!Object(vega_util_module["w" /* hasOwnProperty */])(Distributions, func)) {
    Object(vega_util_module["o" /* error */])('Unknown distribution function: ' + func);
  }

  const d = Distributions[func]();

  for (const name in def) {
    // if data field, extract values
    if (name === FIELD) {
      d.data((def.from || data()).map(def[name]));
    } // if distribution mixture, recurse to parse each definition
    else if (name === DISTRIBUTIONS) {
        d[name](def[name].map(_ => vega_transforms_module_parse(_, data)));
      } // otherwise, simply set the parameter
      else if (typeof d[name] === FUNCTION) {
          d[name](def[name]);
        }
  }

  return d;
}

/**
 * Grid sample points for a probability density. Given a distribution and
 * a sampling extent, will generate points suitable for plotting either
 * PDF (probability density function) or CDF (cumulative distribution
 * function) curves.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {object} params.distribution - The probability distribution. This
 *   is an object parameter dependent on the distribution type.
 * @param {string} [params.method='pdf'] - The distribution method to sample.
 *   One of 'pdf' or 'cdf'.
 * @param {Array<number>} [params.extent] - The [min, max] extent over which
 *   to sample the distribution. This argument is required in most cases, but
 *   can be omitted if the distribution (e.g., 'kde') supports a 'data' method
 *   that returns numerical sample points from which the extent can be deduced.
 * @param {number} [params.minsteps=25] - The minimum number of curve samples
 *   for plotting the density.
 * @param {number} [params.maxsteps=200] - The maximum number of curve samples
 *   for plotting the density.
 * @param {number} [params.steps] - The exact number of curve samples for
 *   plotting the density. If specified, overrides both minsteps and maxsteps
 *   to set an exact number of uniform samples. Useful in conjunction with
 *   a fixed extent to ensure consistent sample points for stacked densities.
 */

function Density(params) {
  Transform.call(this, null, params);
}
const distributions = [{
  'key': {
    'function': 'normal'
  },
  'params': [{
    'name': 'mean',
    'type': 'number',
    'default': 0
  }, {
    'name': 'stdev',
    'type': 'number',
    'default': 1
  }]
}, {
  'key': {
    'function': 'lognormal'
  },
  'params': [{
    'name': 'mean',
    'type': 'number',
    'default': 0
  }, {
    'name': 'stdev',
    'type': 'number',
    'default': 1
  }]
}, {
  'key': {
    'function': 'uniform'
  },
  'params': [{
    'name': 'min',
    'type': 'number',
    'default': 0
  }, {
    'name': 'max',
    'type': 'number',
    'default': 1
  }]
}, {
  'key': {
    'function': 'kde'
  },
  'params': [{
    'name': 'field',
    'type': 'field',
    'required': true
  }, {
    'name': 'from',
    'type': 'data'
  }, {
    'name': 'bandwidth',
    'type': 'number',
    'default': 0
  }]
}];
const vega_transforms_module_mixture = {
  'key': {
    'function': 'mixture'
  },
  'params': [{
    'name': 'distributions',
    'type': 'param',
    'array': true,
    'params': distributions
  }, {
    'name': 'weights',
    'type': 'number',
    'array': true
  }]
};
Density.Definition = {
  'type': 'Density',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'extent',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'steps',
    'type': 'number'
  }, {
    'name': 'minsteps',
    'type': 'number',
    'default': 25
  }, {
    'name': 'maxsteps',
    'type': 'number',
    'default': 200
  }, {
    'name': 'method',
    'type': 'string',
    'default': 'pdf',
    'values': ['pdf', 'cdf']
  }, {
    'name': 'distribution',
    'type': 'param',
    'params': distributions.concat(vega_transforms_module_mixture)
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'default': ['value', 'density']
  }]
};
Object(vega_util_module["z" /* inherits */])(Density, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);

    if (!this.value || pulse.changed() || _.modified()) {
      const dist = vega_transforms_module_parse(_.distribution, vega_transforms_module_source(pulse)),
            minsteps = _.steps || _.minsteps || 25,
            maxsteps = _.steps || _.maxsteps || 200;
      let method = _.method || 'pdf';

      if (method !== 'pdf' && method !== 'cdf') {
        Object(vega_util_module["o" /* error */])('Invalid density method: ' + method);
      }

      if (!_.extent && !dist.data) {
        Object(vega_util_module["o" /* error */])('Missing density extent parameter.');
      }

      method = dist[method];
      const as = _.as || ['value', 'density'],
            domain = _.extent || Object(vega_util_module["q" /* extent */])(dist.data()),
            values = sampleCurve(method, domain, minsteps, maxsteps).map(v => {
        const tuple = {};
        tuple[as[0]] = v[0];
        tuple[as[1]] = v[1];
        return ingest$1(tuple);
      });
      if (this.value) out.rem = this.value;
      this.value = out.add = out.source = values;
    }

    return out;
  }

});

function vega_transforms_module_source(pulse) {
  return () => pulse.materialize(pulse.SOURCE).source;
}

function fieldNames(fields, as) {
  if (!fields) return null;
  return fields.map((f, i) => as[i] || Object(vega_util_module["h" /* accessorName */])(f));
}
function partition$1(data, groupby, field) {
  const groups = [],
        get = f => f(t);

  let map, i, n, t, k, g; // partition data points into groups

  if (groupby == null) {
    groups.push(data.map(field));
  } else {
    for (map = {}, i = 0, n = data.length; i < n; ++i) {
      t = data[i];
      k = groupby.map(get);
      g = map[k];

      if (!g) {
        map[k] = g = [];
        g.dims = k;
        groups.push(g);
      }

      g.push(field(t));
    }
  }

  return groups;
}

const Output = 'bin';
/**
 * Dot density binning for dot plot construction.
 * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999.
 * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The value field to bin.
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby.
 * @param {number} [params.step] - The step size (bin width) within which dots should be
 *   stacked. Defaults to 1/30 of the extent of the data *field*.
 * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density
 *   stacks should be smoothed to reduce variance.
 */

function DotBin(params) {
  Transform.call(this, null, params);
}
DotBin.Definition = {
  'type': 'DotBin',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field',
    'required': true
  }, {
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'step',
    'type': 'number'
  }, {
    'name': 'smooth',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'as',
    'type': 'string',
    'default': Output
  }]
};

const autostep = (data, field) => Object(vega_util_module["Z" /* span */])(Object(vega_util_module["q" /* extent */])(data, field)) / 30;

Object(vega_util_module["z" /* inherits */])(DotBin, Transform, {
  transform(_, pulse) {
    if (this.value && !(_.modified() || pulse.changed())) {
      return pulse; // early exit
    }

    const source = pulse.materialize(pulse.SOURCE).source,
          groups = partition$1(pulse.source, _.groupby, vega_util_module["y" /* identity */]),
          smooth = _.smooth || false,
          field = _.field,
          step = _.step || autostep(source, field),
          sort = stableCompare((a, b) => field(a) - field(b)),
          as = _.as || Output,
          n = groups.length; // compute dotplot bins per group

    let min = Infinity,
        max = -Infinity,
        i = 0,
        j;

    for (; i < n; ++i) {
      const g = groups[i].sort(sort);
      j = -1;

      for (const v of dotbin(g, step, smooth, field)) {
        if (v < min) min = v;
        if (v > max) max = v;
        g[++j][as] = v;
      }
    }

    this.value = {
      start: min,
      stop: max,
      step: step
    };
    return pulse.reflow(true).modifies(as);
  }

});

/**
 * Wraps an expression function with access to external parameters.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function} params.expr - The expression function. The
 *  function should accept both a datum and a parameter object.
 *  This operator's value will be a new function that wraps the
 *  expression function with access to this operator's parameters.
 */

function Expression(params) {
  Operator.call(this, null, update$4, params);
  this.modified(true);
}
Object(vega_util_module["z" /* inherits */])(Expression, Operator);

function update$4(_) {
  const expr = _.expr;
  return this.value && !_.modified('expr') ? this.value : Object(vega_util_module["f" /* accessor */])(datum => expr(datum, _), Object(vega_util_module["g" /* accessorFields */])(expr), Object(vega_util_module["h" /* accessorName */])(expr));
}

/**
 * Computes extents (min/max) for a data field.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The field over which to compute extends.
 */

function Extent(params) {
  Transform.call(this, [undefined, undefined], params);
}
Extent.Definition = {
  'type': 'Extent',
  'metadata': {},
  'params': [{
    'name': 'field',
    'type': 'field',
    'required': true
  }]
};
Object(vega_util_module["z" /* inherits */])(Extent, Transform, {
  transform(_, pulse) {
    const extent = this.value,
          field = _.field,
          mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field');

    let min = extent[0],
        max = extent[1];

    if (mod || min == null) {
      min = +Infinity;
      max = -Infinity;
    }

    pulse.visit(mod ? pulse.SOURCE : pulse.ADD, t => {
      const v = Object(vega_util_module["eb" /* toNumber */])(field(t));

      if (v != null) {
        // NaNs will fail all comparisons!
        if (v < min) min = v;
        if (v > max) max = v;
      }
    });

    if (!Number.isFinite(min) || !Number.isFinite(max)) {
      let name = Object(vega_util_module["h" /* accessorName */])(field);
      if (name) name = ` for field "${name}"`;
      pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`);
      min = max = undefined;
    }

    this.value = [min, max];
  }

});

/**
 * Provides a bridge between a parent transform and a target subflow that
 * consumes only a subset of the tuples that pass through the parent.
 * @constructor
 * @param {Pulse} pulse - A pulse to use as the value of this operator.
 * @param {Transform} parent - The parent transform (typically a Facet instance).
 */

function Subflow(pulse, parent) {
  Operator.call(this, pulse);
  this.parent = parent;
  this.count = 0;
}
Object(vega_util_module["z" /* inherits */])(Subflow, Operator, {
  /**
   * Routes pulses from this subflow to a target transform.
   * @param {Transform} target - A transform that receives the subflow of tuples.
   */
  connect(target) {
    this.detachSubflow = target.detachSubflow;
    this.targets().add(target);
    return target.source = this;
  },

  /**
   * Add an 'add' tuple to the subflow pulse.
   * @param {Tuple} t - The tuple being added.
   */
  add(t) {
    this.count += 1;
    this.value.add.push(t);
  },

  /**
   * Add a 'rem' tuple to the subflow pulse.
   * @param {Tuple} t - The tuple being removed.
   */
  rem(t) {
    this.count -= 1;
    this.value.rem.push(t);
  },

  /**
   * Add a 'mod' tuple to the subflow pulse.
   * @param {Tuple} t - The tuple being modified.
   */
  mod(t) {
    this.value.mod.push(t);
  },

  /**
   * Re-initialize this operator's pulse value.
   * @param {Pulse} pulse - The pulse to copy from.
   * @see Pulse.init
   */
  init(pulse) {
    this.value.init(pulse, pulse.NO_SOURCE);
  },

  /**
   * Evaluate this operator. This method overrides the
   * default behavior to simply return the contained pulse value.
   * @return {Pulse}
   */
  evaluate() {
    // assert: this.value.stamp === pulse.stamp
    return this.value;
  }

});

/**
 * Facets a dataflow into a set of subflows based on a key.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(Dataflow, string): Operator} params.subflow - A function
 *   that generates a subflow of operators and returns its root operator.
 * @param {function(object): *} params.key - The key field to facet by.
 */

function Facet(params) {
  Transform.call(this, {}, params);
  this._keys = Object(vega_util_module["t" /* fastmap */])(); // cache previously calculated key values
  // keep track of active subflows, use as targets array for listeners
  // this allows us to limit propagation to only updated subflows

  const a = this._targets = [];
  a.active = 0;

  a.forEach = f => {
    for (let i = 0, n = a.active; i < n; ++i) {
      f(a[i], i, a);
    }
  };
}
Object(vega_util_module["z" /* inherits */])(Facet, Transform, {
  activate(flow) {
    this._targets[this._targets.active++] = flow;
  },

  // parent argument provided by PreFacet subclass
  subflow(key, flow, pulse, parent) {
    const flows = this.value;
    let sf = Object(vega_util_module["w" /* hasOwnProperty */])(flows, key) && flows[key],
        df,
        p;

    if (!sf) {
      p = parent || (p = this._group[key]) && p.tuple;
      df = pulse.dataflow;
      sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this);
      df.add(sf).connect(flow(df, key, p));
      flows[key] = sf;
      this.activate(sf);
    } else if (sf.value.stamp < pulse.stamp) {
      sf.init(pulse);
      this.activate(sf);
    }

    return sf;
  },

  clean() {
    const flows = this.value;
    let detached = 0;

    for (const key in flows) {
      if (flows[key].count === 0) {
        const detach = flows[key].detachSubflow;
        if (detach) detach();
        delete flows[key];
        ++detached;
      }
    } // remove inactive targets from the active targets array


    if (detached) {
      const active = this._targets.filter(sf => sf && sf.count > 0);

      this.initTargets(active);
    }
  },

  initTargets(act) {
    const a = this._targets,
          n = a.length,
          m = act ? act.length : 0;
    let i = 0;

    for (; i < m; ++i) {
      a[i] = act[i];
    }

    for (; i < n && a[i] != null; ++i) {
      a[i] = null; // ensure old flows can be garbage collected
    }

    a.active = m;
  },

  transform(_, pulse) {
    const df = pulse.dataflow,
          key = _.key,
          flow = _.subflow,
          cache = this._keys,
          rekey = _.modified('key'),
          subflow = key => this.subflow(key, flow, pulse);

    this._group = _.group || {};
    this.initTargets(); // reset list of active subflows

    pulse.visit(pulse.REM, t => {
      const id = tupleid(t),
            k = cache.get(id);

      if (k !== undefined) {
        cache.delete(id);
        subflow(k).rem(t);
      }
    });
    pulse.visit(pulse.ADD, t => {
      const k = key(t);
      cache.set(tupleid(t), k);
      subflow(k).add(t);
    });

    if (rekey || pulse.modified(key.fields)) {
      pulse.visit(pulse.MOD, t => {
        const id = tupleid(t),
              k0 = cache.get(id),
              k1 = key(t);

        if (k0 === k1) {
          subflow(k1).mod(t);
        } else {
          cache.set(id, k1);
          subflow(k0).rem(t);
          subflow(k1).add(t);
        }
      });
    } else if (pulse.changed(pulse.MOD)) {
      pulse.visit(pulse.MOD, t => {
        subflow(cache.get(tupleid(t))).mod(t);
      });
    }

    if (rekey) {
      pulse.visit(pulse.REFLOW, t => {
        const id = tupleid(t),
              k0 = cache.get(id),
              k1 = key(t);

        if (k0 !== k1) {
          cache.set(id, k1);
          subflow(k0).rem(t);
          subflow(k1).add(t);
        }
      });
    }

    if (pulse.clean()) {
      df.runAfter(() => {
        this.clean();
        cache.clean();
      });
    } else if (cache.empty > df.cleanThreshold) {
      df.runAfter(cache.clean);
    }

    return pulse;
  }

});

/**
 * Generates one or more field accessor functions.
 * If the 'name' parameter is an array, an array of field accessors
 * will be created and the 'as' parameter will be ignored.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {string} params.name - The field name(s) to access.
 * @param {string} params.as - The accessor function name.
 */

function Field(params) {
  Operator.call(this, null, update$3, params);
}
Object(vega_util_module["z" /* inherits */])(Field, Operator);

function update$3(_) {
  return this.value && !_.modified() ? this.value : Object(vega_util_module["B" /* isArray */])(_.name) ? Object(vega_util_module["i" /* array */])(_.name).map(f => Object(vega_util_module["u" /* field */])(f)) : Object(vega_util_module["u" /* field */])(_.name, _.as);
}

/**
 * Filters data tuples according to a predicate function.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.expr - The predicate expression function
 *   that determines a tuple's filter status. Truthy values pass the filter.
 */

function Filter(params) {
  Transform.call(this, Object(vega_util_module["t" /* fastmap */])(), params);
}
Filter.Definition = {
  'type': 'Filter',
  'metadata': {
    'changes': true
  },
  'params': [{
    'name': 'expr',
    'type': 'expr',
    'required': true
  }]
};
Object(vega_util_module["z" /* inherits */])(Filter, Transform, {
  transform(_, pulse) {
    const df = pulse.dataflow,
          cache = this.value,
          // cache ids of filtered tuples
    output = pulse.fork(),
          add = output.add,
          rem = output.rem,
          mod = output.mod,
          test = _.expr;
    let isMod = true;
    pulse.visit(pulse.REM, t => {
      const id = tupleid(t);
      if (!cache.has(id)) rem.push(t);else cache.delete(id);
    });
    pulse.visit(pulse.ADD, t => {
      if (test(t, _)) add.push(t);else cache.set(tupleid(t), 1);
    });

    function revisit(t) {
      const id = tupleid(t),
            b = test(t, _),
            s = cache.get(id);

      if (b && s) {
        cache.delete(id);
        add.push(t);
      } else if (!b && !s) {
        cache.set(id, 1);
        rem.push(t);
      } else if (isMod && b && !s) {
        mod.push(t);
      }
    }

    pulse.visit(pulse.MOD, revisit);

    if (_.modified()) {
      isMod = false;
      pulse.visit(pulse.REFLOW, revisit);
    }

    if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean);
    return output;
  }

});

/**
 * Flattens array-typed field values into new data objects.
 * If multiple fields are specified, they are treated as parallel arrays,
 * with output values included for each matching index (or null if missing).
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<function(object): *>} params.fields - An array of field
 *   accessors for the tuple fields that should be flattened.
 * @param {string} [params.index] - Optional output field name for index
 *   value. If unspecified, no index field is included in the output.
 * @param {Array<string>} [params.as] - Output field names for flattened
 *   array fields. Any unspecified fields will use the field name provided
 *   by the fields accessors.
 */

function Flatten(params) {
  Transform.call(this, [], params);
}
Flatten.Definition = {
  'type': 'Flatten',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'fields',
    'type': 'field',
    'array': true,
    'required': true
  }, {
    'name': 'index',
    'type': 'string'
  }, {
    'name': 'as',
    'type': 'string',
    'array': true
  }]
};
Object(vega_util_module["z" /* inherits */])(Flatten, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE),
          fields = _.fields,
          as = fieldNames(fields, _.as || []),
          index = _.index || null,
          m = as.length; // remove any previous results

    out.rem = this.value; // generate flattened tuples

    pulse.visit(pulse.SOURCE, t => {
      const arrays = fields.map(f => f(t)),
            maxlen = arrays.reduce((l, a) => Math.max(l, a.length), 0);
      let i = 0,
          j,
          d,
          v;

      for (; i < maxlen; ++i) {
        d = vega_dataflow_module_derive(t);

        for (j = 0; j < m; ++j) {
          d[as[j]] = (v = arrays[j][i]) == null ? null : v;
        }

        if (index) {
          d[index] = i;
        }

        out.add.push(d);
      }
    });
    this.value = out.source = out.add;
    if (index) out.modifies(index);
    return out.modifies(as);
  }

});

/**
 * Folds one more tuple fields into multiple tuples in which the field
 * name and values are available under new 'key' and 'value' fields.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.fields - An array of field accessors
 *   for the tuple fields that should be folded.
 * @param {Array<string>} [params.as] - Output field names for folded key
 *   and value fields, defaults to ['key', 'value'].
 */

function Fold(params) {
  Transform.call(this, [], params);
}
Fold.Definition = {
  'type': 'Fold',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'fields',
    'type': 'field',
    'array': true,
    'required': true
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': 2,
    'default': ['key', 'value']
  }]
};
Object(vega_util_module["z" /* inherits */])(Fold, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE),
          fields = _.fields,
          fnames = fields.map(vega_util_module["h" /* accessorName */]),
          as = _.as || ['key', 'value'],
          k = as[0],
          v = as[1],
          n = fields.length;
    out.rem = this.value;
    pulse.visit(pulse.SOURCE, t => {
      for (let i = 0, d; i < n; ++i) {
        d = vega_dataflow_module_derive(t);
        d[k] = fnames[i];
        d[v] = fields[i](t);
        out.add.push(d);
      }
    });
    this.value = out.source = out.add;
    return out.modifies(as);
  }

});

/**
 * Invokes a function for each data tuple and saves the results as a new field.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.expr - The formula function to invoke for each tuple.
 * @param {string} params.as - The field name under which to save the result.
 * @param {boolean} [params.initonly=false] - If true, the formula is applied to
 *   added tuples only, and does not update in response to modifications.
 */

function Formula(params) {
  Transform.call(this, null, params);
}
Formula.Definition = {
  'type': 'Formula',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'expr',
    'type': 'expr',
    'required': true
  }, {
    'name': 'as',
    'type': 'string',
    'required': true
  }, {
    'name': 'initonly',
    'type': 'boolean'
  }]
};
Object(vega_util_module["z" /* inherits */])(Formula, Transform, {
  transform(_, pulse) {
    const func = _.expr,
          as = _.as,
          mod = _.modified(),
          flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD;

    if (mod) {
      // parameters updated, need to reflow
      pulse = pulse.materialize().reflow(true);
    }

    if (!_.initonly) {
      pulse.modifies(as);
    }

    return pulse.visit(flag, t => t[as] = func(t, _));
  }

});

/**
 * Generates data tuples using a provided generator function.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(Parameters): object} params.generator - A tuple generator
 *   function. This function is given the operator parameters as input.
 *   Changes to any additional parameters will not trigger re-calculation
 *   of previously generated tuples. Only future tuples are affected.
 * @param {number} params.size - The number of tuples to produce.
 */

function Generate(params) {
  Transform.call(this, [], params);
}
Object(vega_util_module["z" /* inherits */])(Generate, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.ALL),
          gen = _.generator;
    let data = this.value,
        num = _.size - data.length,
        add,
        rem,
        t;

    if (num > 0) {
      // need more tuples, generate and add
      for (add = []; --num >= 0;) {
        add.push(t = ingest$1(gen(_)));
        data.push(t);
      }

      out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add;
    } else {
      // need fewer tuples, remove
      rem = data.slice(0, -num);
      out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem;
      data = data.slice(-num);
    }

    out.source = this.value = data;
    return out;
  }

});

const Methods = {
  value: 'value',
  median: median,
  mean: mean,
  min: min_min,
  max: max_max
};
const Empty = [];
/**
 * Impute missing values.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The value field to impute.
 * @param {Array<function(object): *>} [params.groupby] - An array of
 *   accessors to determine series within which to perform imputation.
 * @param {function(object): *} params.key - An accessor for a key value.
 *   Each key value should be unique within a group. New tuples will be
 *   imputed for any key values that are not found within a group.
 * @param {Array<*>} [params.keyvals] - Optional array of required key
 *   values. New tuples will be imputed for any key values that are not
 *   found within a group. In addition, these values will be automatically
 *   augmented with the key values observed in the input data.
 * @param {string} [method='value'] - The imputation method to use. One of
 *   'value', 'mean', 'median', 'max', 'min'.
 * @param {*} [value=0] - The constant value to use for imputation
 *   when using method 'value'.
 */

function Impute(params) {
  Transform.call(this, [], params);
}
Impute.Definition = {
  'type': 'Impute',
  'metadata': {
    'changes': true
  },
  'params': [{
    'name': 'field',
    'type': 'field',
    'required': true
  }, {
    'name': 'key',
    'type': 'field',
    'required': true
  }, {
    'name': 'keyvals',
    'array': true
  }, {
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'method',
    'type': 'enum',
    'default': 'value',
    'values': ['value', 'mean', 'median', 'max', 'min']
  }, {
    'name': 'value',
    'default': 0
  }]
};

function getValue(_) {
  var m = _.method || Methods.value,
      v;

  if (Methods[m] == null) {
    Object(vega_util_module["o" /* error */])('Unrecognized imputation method: ' + m);
  } else if (m === Methods.value) {
    v = _.value !== undefined ? _.value : 0;
    return () => v;
  } else {
    return Methods[m];
  }
}

function getField(_) {
  const f = _.field;
  return t => t ? f(t) : NaN;
}

Object(vega_util_module["z" /* inherits */])(Impute, Transform, {
  transform(_, pulse) {
    var out = pulse.fork(pulse.ALL),
        impute = getValue(_),
        field = getField(_),
        fName = Object(vega_util_module["h" /* accessorName */])(_.field),
        kName = Object(vega_util_module["h" /* accessorName */])(_.key),
        gNames = (_.groupby || []).map(vega_util_module["h" /* accessorName */]),
        groups = vega_transforms_module_partition(pulse.source, _.groupby, _.key, _.keyvals),
        curr = [],
        prev = this.value,
        m = groups.domain.length,
        group,
        value,
        gVals,
        kVal,
        g,
        i,
        j,
        l,
        n,
        t;

    for (g = 0, l = groups.length; g < l; ++g) {
      group = groups[g];
      gVals = group.values;
      value = NaN; // add tuples for missing values

      for (j = 0; j < m; ++j) {
        if (group[j] != null) continue;
        kVal = groups.domain[j];
        t = {
          _impute: true
        };

        for (i = 0, n = gVals.length; i < n; ++i) t[gNames[i]] = gVals[i];

        t[kName] = kVal;
        t[fName] = Number.isNaN(value) ? value = impute(group, field) : value;
        curr.push(ingest$1(t));
      }
    } // update pulse with imputed tuples


    if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr);
    if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev);
    this.value = curr;
    return out;
  }

});

function vega_transforms_module_partition(data, groupby, key, keyvals) {
  var get = f => f(t),
      groups = [],
      domain = keyvals ? keyvals.slice() : [],
      kMap = {},
      gMap = {},
      gVals,
      gKey,
      group,
      i,
      j,
      k,
      n,
      t;

  domain.forEach((k, i) => kMap[k] = i + 1);

  for (i = 0, n = data.length; i < n; ++i) {
    t = data[i];
    k = key(t);
    j = kMap[k] || (kMap[k] = domain.push(k));
    gKey = (gVals = groupby ? groupby.map(get) : Empty) + '';

    if (!(group = gMap[gKey])) {
      group = gMap[gKey] = [];
      groups.push(group);
      group.values = gVals;
    }

    group[j - 1] = t;
  }

  groups.domain = domain;
  return groups;
}

/**
 * Extend input tuples with aggregate values.
 * Calcuates aggregate values and joins them with the input stream.
 * @constructor
 */

function JoinAggregate(params) {
  Aggregate.call(this, params);
}
JoinAggregate.Definition = {
  'type': 'JoinAggregate',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'fields',
    'type': 'field',
    'null': true,
    'array': true
  }, {
    'name': 'ops',
    'type': 'enum',
    'array': true,
    'values': ValidAggregateOps
  }, {
    'name': 'as',
    'type': 'string',
    'null': true,
    'array': true
  }, {
    'name': 'key',
    'type': 'field'
  }]
};
Object(vega_util_module["z" /* inherits */])(JoinAggregate, Aggregate, {
  transform(_, pulse) {
    const aggr = this,
          mod = _.modified();

    let cells; // process all input tuples to calculate aggregates

    if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) {
      cells = aggr.value = mod ? aggr.init(_) : {};
      pulse.visit(pulse.SOURCE, t => aggr.add(t));
    } else {
      cells = aggr.value = aggr.value || this.init(_);
      pulse.visit(pulse.REM, t => aggr.rem(t));
      pulse.visit(pulse.ADD, t => aggr.add(t));
    } // update aggregation cells


    aggr.changes(); // write aggregate values to input tuples

    pulse.visit(pulse.SOURCE, t => {
      Object(vega_util_module["p" /* extend */])(t, cells[aggr.cellkey(t)].tuple);
    });
    return pulse.reflow(mod).modifies(this._outputs);
  },

  changes() {
    const adds = this._adds,
          mods = this._mods;
    let i, n;

    for (i = 0, n = this._alen; i < n; ++i) {
      this.celltuple(adds[i]);
      adds[i] = null; // for garbage collection
    }

    for (i = 0, n = this._mlen; i < n; ++i) {
      this.celltuple(mods[i]);
      mods[i] = null; // for garbage collection
    }

    this._alen = this._mlen = 0; // reset list of active cells
  }

});

/**
 * Compute kernel density estimates (KDE) for one or more data groups.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors
 *   to groupby.
 * @param {function(object): *} params.field - An accessor for the data field
 *   to estimate.
 * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth.
 *   If zero or unspecified, the bandwidth is automatically determined.
 * @param {boolean} [params.counts=false] - A boolean flag indicating if the
 *   output values should be probability estimates (false, default) or
 *   smoothed counts (true).
 * @param {string} [params.cumulative=false] - A boolean flag indicating if a
 *   density (false) or cumulative distribution (true) should be generated.
 * @param {Array<number>} [params.extent] - The domain extent over which to
 *   plot the density. If unspecified, the [min, max] data extent is used.
 * @param {string} [params.resolve='independent'] - Indicates how parameters for
 *   multiple densities should be resolved. If "independent" (the default), each
 *   density may have its own domain extent and dynamic number of curve sample
 *   steps. If "shared", the KDE transform will ensure that all densities are
 *   defined over a shared domain and curve steps, enabling stacking.
 * @param {number} [params.minsteps=25] - The minimum number of curve samples
 *   for plotting the density.
 * @param {number} [params.maxsteps=200] - The maximum number of curve samples
 *   for plotting the density.
 * @param {number} [params.steps] - The exact number of curve samples for
 *   plotting the density. If specified, overrides both minsteps and maxsteps
 *   to set an exact number of uniform samples. Useful in conjunction with
 *   a fixed extent to ensure consistent sample points for stacked densities.
 */

function KDE(params) {
  Transform.call(this, null, params);
}
KDE.Definition = {
  'type': 'KDE',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'field',
    'type': 'field',
    'required': true
  }, {
    'name': 'cumulative',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'counts',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'bandwidth',
    'type': 'number',
    'default': 0
  }, {
    'name': 'extent',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'resolve',
    'type': 'enum',
    'values': ['shared', 'independent'],
    'default': 'independent'
  }, {
    'name': 'steps',
    'type': 'number'
  }, {
    'name': 'minsteps',
    'type': 'number',
    'default': 25
  }, {
    'name': 'maxsteps',
    'type': 'number',
    'default': 200
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'default': ['value', 'density']
  }]
};
Object(vega_util_module["z" /* inherits */])(KDE, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);

    if (!this.value || pulse.changed() || _.modified()) {
      const source = pulse.materialize(pulse.SOURCE).source,
            groups = partition$1(source, _.groupby, _.field),
            names = (_.groupby || []).map(vega_util_module["h" /* accessorName */]),
            bandwidth = _.bandwidth,
            method = _.cumulative ? 'cdf' : 'pdf',
            as = _.as || ['value', 'density'],
            values = [];
      let domain = _.extent,
          minsteps = _.steps || _.minsteps || 25,
          maxsteps = _.steps || _.maxsteps || 200;

      if (method !== 'pdf' && method !== 'cdf') {
        Object(vega_util_module["o" /* error */])('Invalid density method: ' + method);
      }

      if (_.resolve === 'shared') {
        if (!domain) domain = Object(vega_util_module["q" /* extent */])(source, _.field);
        minsteps = maxsteps = _.steps || maxsteps;
      }

      groups.forEach(g => {
        const density = vega_statistics_module_kde(g, bandwidth)[method],
              scale = _.counts ? g.length : 1,
              local = domain || Object(vega_util_module["q" /* extent */])(g);
        sampleCurve(density, local, minsteps, maxsteps).forEach(v => {
          const t = {};

          for (let i = 0; i < names.length; ++i) {
            t[names[i]] = g.dims[i];
          }

          t[as[0]] = v[0];
          t[as[1]] = v[1] * scale;
          values.push(ingest$1(t));
        });
      });
      if (this.value) out.rem = this.value;
      this.value = out.add = out.source = values;
    }

    return out;
  }

});

/**
 * Generates a key function.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<string>} params.fields - The field name(s) for the key function.
 * @param {boolean} params.flat - A boolean flag indicating if the field names
 *  should be treated as flat property names, side-stepping nested field
 *  lookups normally indicated by dot or bracket notation.
 */

function Key(params) {
  Operator.call(this, null, update$2, params);
}
Object(vega_util_module["z" /* inherits */])(Key, Operator);

function update$2(_) {
  return this.value && !_.modified() ? this.value : Object(vega_util_module["K" /* key */])(_.fields, _.flat);
}

/**
 * Load and parse data from an external source. Marshalls parameter
 * values and then invokes the Dataflow request method.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {string} params.url - The URL to load from.
 * @param {object} params.format - The data format options.
 */

function Load(params) {
  Transform.call(this, [], params);
  this._pending = null;
}
Object(vega_util_module["z" /* inherits */])(Load, Transform, {
  transform(_, pulse) {
    const df = pulse.dataflow;

    if (this._pending) {
      // update state and return pulse
      return vega_transforms_module_output(this, pulse, this._pending);
    }

    if (vega_transforms_module_stop(_)) return pulse.StopPropagation;

    if (_.values) {
      // parse and ingest values, return output pulse
      return vega_transforms_module_output(this, pulse, df.parse(_.values, _.format));
    } else if (_.async) {
      // return promise for non-blocking async loading
      const p = df.request(_.url, _.format).then(res => {
        this._pending = Object(vega_util_module["i" /* array */])(res.data);
        return df => df.touch(this);
      });
      return {
        async: p
      };
    } else {
      // return promise for synchronous loading
      return df.request(_.url, _.format).then(res => vega_transforms_module_output(this, pulse, Object(vega_util_module["i" /* array */])(res.data)));
    }
  }

});

function vega_transforms_module_stop(_) {
  return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format'));
}

function vega_transforms_module_output(op, pulse, data) {
  data.forEach(ingest$1);
  const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE);
  out.rem = op.value;
  op.value = out.source = out.add = data;
  op._pending = null;
  if (out.rem.length) out.clean(true);
  return out;
}

/**
 * Extend tuples by joining them with values from a lookup table.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Map} params.index - The lookup table map.
 * @param {Array<function(object): *} params.fields - The fields to lookup.
 * @param {Array<string>} params.as - Output field names for each lookup value.
 * @param {*} [params.default] - A default value to use if lookup fails.
 */

function Lookup(params) {
  Transform.call(this, {}, params);
}
Lookup.Definition = {
  'type': 'Lookup',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'index',
    'type': 'index',
    'params': [{
      'name': 'from',
      'type': 'data',
      'required': true
    }, {
      'name': 'key',
      'type': 'field',
      'required': true
    }]
  }, {
    'name': 'values',
    'type': 'field',
    'array': true
  }, {
    'name': 'fields',
    'type': 'field',
    'array': true,
    'required': true
  }, {
    'name': 'as',
    'type': 'string',
    'array': true
  }, {
    'name': 'default',
    'default': null
  }]
};
Object(vega_util_module["z" /* inherits */])(Lookup, Transform, {
  transform(_, pulse) {
    const keys = _.fields,
          index = _.index,
          values = _.values,
          defaultValue = _.default == null ? null : _.default,
          reset = _.modified(),
          n = keys.length;

    let flag = reset ? pulse.SOURCE : pulse.ADD,
        out = pulse,
        as = _.as,
        set,
        m,
        mods;

    if (values) {
      m = values.length;

      if (n > 1 && !as) {
        Object(vega_util_module["o" /* error */])('Multi-field lookup requires explicit "as" parameter.');
      }

      if (as && as.length !== n * m) {
        Object(vega_util_module["o" /* error */])('The "as" parameter has too few output field names.');
      }

      as = as || values.map(vega_util_module["h" /* accessorName */]);

      set = function (t) {
        for (var i = 0, k = 0, j, v; i < n; ++i) {
          v = index.get(keys[i](t));
          if (v == null) for (j = 0; j < m; ++j, ++k) t[as[k]] = defaultValue;else for (j = 0; j < m; ++j, ++k) t[as[k]] = values[j](v);
        }
      };
    } else {
      if (!as) {
        Object(vega_util_module["o" /* error */])('Missing output field names.');
      }

      set = function (t) {
        for (var i = 0, v; i < n; ++i) {
          v = index.get(keys[i](t));
          t[as[i]] = v == null ? defaultValue : v;
        }
      };
    }

    if (reset) {
      out = pulse.reflow(true);
    } else {
      mods = keys.some(k => pulse.modified(k.fields));
      flag |= mods ? pulse.MOD : 0;
    }

    pulse.visit(flag, set);
    return out.modifies(as);
  }

});

/**
 * Computes global min/max extents over a collection of extents.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<Array<number>>} params.extents - The input extents.
 */

function MultiExtent(params) {
  Operator.call(this, null, update$1, params);
}
Object(vega_util_module["z" /* inherits */])(MultiExtent, Operator);

function update$1(_) {
  if (this.value && !_.modified()) {
    return this.value;
  }

  const ext = _.extents,
        n = ext.length;
  let min = +Infinity,
      max = -Infinity,
      i,
      e;

  for (i = 0; i < n; ++i) {
    e = ext[i];
    if (e[0] < min) min = e[0];
    if (e[1] > max) max = e[1];
  }

  return [min, max];
}

/**
 * Merge a collection of value arrays.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<Array<*>>} params.values - The input value arrrays.
 */

function MultiValues(params) {
  Operator.call(this, null, vega_transforms_module_update, params);
}
Object(vega_util_module["z" /* inherits */])(MultiValues, Operator);

function vega_transforms_module_update(_) {
  return this.value && !_.modified() ? this.value : _.values.reduce((data, _) => data.concat(_), []);
}

/**
 * Operator whose value is simply its parameter hash. This operator is
 * useful for enabling reactive updates to values of nested objects.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */

function Params(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(Params, Transform, {
  transform(_, pulse) {
    this.modified(_.modified());
    this.value = _;
    return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples
  }

});

/**
 * Aggregate and pivot selected field values to become new fields.
 * This operator is useful to construction cross-tabulations.
 * @constructor
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors
 *  to groupby. These fields act just like groupby fields of an Aggregate transform.
 * @param {function(object): *} params.field - The field to pivot on. The unique
 *  values of this field become new field names in the output stream.
 * @param {function(object): *} params.value - The field to populate pivoted fields.
 *  The aggregate values of this field become the values of the new pivoted fields.
 * @param {string} [params.op] - The aggregation operation for the value field,
 *  applied per cell in the output stream. The default is "sum".
 * @param {number} [params.limit] - An optional parameter indicating the maximum
 *  number of pivoted fields to generate. The pivoted field names are sorted in
 *  ascending order prior to enforcing the limit.
 */

function Pivot(params) {
  Aggregate.call(this, params);
}
Pivot.Definition = {
  'type': 'Pivot',
  'metadata': {
    'generates': true,
    'changes': true
  },
  'params': [{
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'field',
    'type': 'field',
    'required': true
  }, {
    'name': 'value',
    'type': 'field',
    'required': true
  }, {
    'name': 'op',
    'type': 'enum',
    'values': ValidAggregateOps,
    'default': 'sum'
  }, {
    'name': 'limit',
    'type': 'number',
    'default': 0
  }, {
    'name': 'key',
    'type': 'field'
  }]
};
Object(vega_util_module["z" /* inherits */])(Pivot, Aggregate, {
  _transform: Aggregate.prototype.transform,

  transform(_, pulse) {
    return this._transform(aggregateParams(_, pulse), pulse);
  }

}); // Shoehorn a pivot transform into an aggregate transform!
// First collect all unique pivot field values.
// Then generate aggregate fields for each output pivot field.

function aggregateParams(_, pulse) {
  const key = _.field,
        value = _.value,
        op = (_.op === 'count' ? '__count__' : _.op) || 'sum',
        fields = Object(vega_util_module["g" /* accessorFields */])(key).concat(Object(vega_util_module["g" /* accessorFields */])(value)),
        keys = pivotKeys(key, _.limit || 0, pulse); // if data stream content changes, pivot fields may change
  // flag parameter modification to ensure re-initialization

  if (pulse.changed()) _.set('__pivot__', null, null, true);
  return {
    key: _.key,
    groupby: _.groupby,
    ops: keys.map(() => op),
    fields: keys.map(k => vega_transforms_module_get(k, key, value, fields)),
    as: keys.map(k => k + ''),
    modified: _.modified.bind(_)
  };
} // Generate aggregate field accessor.
// Output NaN for non-existent values; aggregator will ignore!


function vega_transforms_module_get(k, key, value, fields) {
  return Object(vega_util_module["f" /* accessor */])(d => key(d) === k ? value(d) : NaN, fields, k + '');
} // Collect (and optionally limit) all unique pivot values.


function pivotKeys(key, limit, pulse) {
  const map = {},
        list = [];
  pulse.visit(pulse.SOURCE, t => {
    const k = key(t);

    if (!map[k]) {
      map[k] = 1;
      list.push(k);
    }
  });
  list.sort(vega_util_module["j" /* ascending */]);
  return limit ? list.slice(0, limit) : list;
}

/**
 * Partitions pre-faceted data into tuple subflows.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(Dataflow, string): Operator} params.subflow - A function
 *   that generates a subflow of operators and returns its root operator.
 * @param {function(object): Array<object>} params.field - The field
 *   accessor for an array of subflow tuple objects.
 */

function PreFacet(params) {
  Facet.call(this, params);
}
Object(vega_util_module["z" /* inherits */])(PreFacet, Facet, {
  transform(_, pulse) {
    const flow = _.subflow,
          field = _.field,
          subflow = t => this.subflow(tupleid(t), flow, pulse, t);

    if (_.modified('field') || field && pulse.modified(Object(vega_util_module["g" /* accessorFields */])(field))) {
      Object(vega_util_module["o" /* error */])('PreFacet does not support field modification.');
    }

    this.initTargets(); // reset list of active subflows

    if (field) {
      pulse.visit(pulse.MOD, t => {
        const sf = subflow(t);
        field(t).forEach(_ => sf.mod(_));
      });
      pulse.visit(pulse.ADD, t => {
        const sf = subflow(t);
        field(t).forEach(_ => sf.add(ingest$1(_)));
      });
      pulse.visit(pulse.REM, t => {
        const sf = subflow(t);
        field(t).forEach(_ => sf.rem(_));
      });
    } else {
      pulse.visit(pulse.MOD, t => subflow(t).mod(t));
      pulse.visit(pulse.ADD, t => subflow(t).add(t));
      pulse.visit(pulse.REM, t => subflow(t).rem(t));
    }

    if (pulse.clean()) {
      pulse.runAfter(() => this.clean());
    }

    return pulse;
  }

});

/**
 * Performs a relational projection, copying selected fields from source
 * tuples to a new set of derived tuples.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<function(object): *} params.fields - The fields to project,
 *   as an array of field accessors. If unspecified, all fields will be
 *   copied with names unchanged.
 * @param {Array<string>} [params.as] - Output field names for each projected
 *   field. Any unspecified fields will use the field name provided by
 *   the field accessor.
 */

function Project(params) {
  Transform.call(this, null, params);
}
Project.Definition = {
  'type': 'Project',
  'metadata': {
    'generates': true,
    'changes': true
  },
  'params': [{
    'name': 'fields',
    'type': 'field',
    'array': true
  }, {
    'name': 'as',
    'type': 'string',
    'null': true,
    'array': true
  }]
};
Object(vega_util_module["z" /* inherits */])(Project, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE),
          fields = _.fields,
          as = fieldNames(_.fields, _.as || []),
          derive = fields ? (s, t) => vega_transforms_module_project(s, t, fields, as) : rederive;
    let lut;

    if (this.value) {
      lut = this.value;
    } else {
      pulse = pulse.addAll();
      lut = this.value = {};
    }

    pulse.visit(pulse.REM, t => {
      const id = tupleid(t);
      out.rem.push(lut[id]);
      lut[id] = null;
    });
    pulse.visit(pulse.ADD, t => {
      const dt = derive(t, ingest$1({}));
      lut[tupleid(t)] = dt;
      out.add.push(dt);
    });
    pulse.visit(pulse.MOD, t => {
      out.mod.push(derive(t, lut[tupleid(t)]));
    });
    return out;
  }

});

function vega_transforms_module_project(s, t, fields, as) {
  for (let i = 0, n = fields.length; i < n; ++i) {
    t[as[i]] = fields[i](s);
  }

  return t;
}

/**
 * Proxy the value of another operator as a pure signal value.
 * Ensures no tuples are propagated.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {*} params.value - The value to proxy, becomes the value of this operator.
 */

function vega_transforms_module_Proxy(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(vega_transforms_module_Proxy, Transform, {
  transform(_, pulse) {
    this.value = _.value;
    return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;
  }

});

/**
 * Generates sample quantile values from an input data stream.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - An accessor for the data field
 *   over which to calculate quantile values.
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors
 *   to groupby.
 * @param {Array<number>} [params.probs] - An array of probabilities in
 *   the range (0, 1) for which to compute quantile values. If not specified,
 *   the *step* parameter will be used.
 * @param {Array<number>} [params.step=0.01] - A probability step size for
 *   sampling quantile values. All values from one-half the step size up to
 *   1 (exclusive) will be sampled. This parameter is only used if the
 *   *quantiles* parameter is not provided.
 */

function Quantile(params) {
  Transform.call(this, null, params);
}
Quantile.Definition = {
  'type': 'Quantile',
  'metadata': {
    'generates': true,
    'changes': true
  },
  'params': [{
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'field',
    'type': 'field',
    'required': true
  }, {
    'name': 'probs',
    'type': 'number',
    'array': true
  }, {
    'name': 'step',
    'type': 'number',
    'default': 0.01
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'default': ['prob', 'value']
  }]
};
const EPSILON = 1e-14;
Object(vega_util_module["z" /* inherits */])(Quantile, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
          as = _.as || ['prob', 'value'];

    if (this.value && !_.modified() && !pulse.changed()) {
      out.source = this.value;
      return out;
    }

    const source = pulse.materialize(pulse.SOURCE).source,
          groups = partition$1(source, _.groupby, _.field),
          names = (_.groupby || []).map(vega_util_module["h" /* accessorName */]),
          values = [],
          step = _.step || 0.01,
          p = _.probs || src_range(step / 2, 1 - EPSILON, step),
          n = p.length;
    groups.forEach(g => {
      const q = quantiles(g, p);

      for (let i = 0; i < n; ++i) {
        const t = {};

        for (let i = 0; i < names.length; ++i) {
          t[names[i]] = g.dims[i];
        }

        t[as[0]] = p[i];
        t[as[1]] = q[i];
        values.push(ingest$1(t));
      }
    });
    if (this.value) out.rem = this.value;
    this.value = out.add = out.source = values;
    return out;
  }

});

/**
 * Relays a data stream between data processing pipelines.
 * If the derive parameter is set, this transform will create derived
 * copies of observed tuples. This provides derived data streams in which
 * modifications to the tuples do not pollute an upstream data source.
 * @param {object} params - The parameters for this operator.
 * @param {number} [params.derive=false] - Boolean flag indicating if
 *   the transform should make derived copies of incoming tuples.
 * @constructor
 */

function Relay(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(Relay, Transform, {
  transform(_, pulse) {
    let out, lut;

    if (this.value) {
      lut = this.value;
    } else {
      out = pulse = pulse.addAll();
      lut = this.value = {};
    }

    if (_.derive) {
      out = pulse.fork(pulse.NO_SOURCE);
      pulse.visit(pulse.REM, t => {
        const id = tupleid(t);
        out.rem.push(lut[id]);
        lut[id] = null;
      });
      pulse.visit(pulse.ADD, t => {
        const dt = vega_dataflow_module_derive(t);
        lut[tupleid(t)] = dt;
        out.add.push(dt);
      });
      pulse.visit(pulse.MOD, t => {
        const dt = lut[tupleid(t)];

        for (const k in t) {
          dt[k] = t[k]; // down stream writes may overwrite re-derived tuples
          // conservatively mark all source fields as modified

          out.modifies(k);
        }

        out.mod.push(dt);
      });
    }

    return out;
  }

});

/**
 * Samples tuples passing through this operator.
 * Uses reservoir sampling to maintain a representative sample.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {number} [params.size=1000] - The maximum number of samples.
 */

function Sample(params) {
  Transform.call(this, [], params);
  this.count = 0;
}
Sample.Definition = {
  'type': 'Sample',
  'metadata': {},
  'params': [{
    'name': 'size',
    'type': 'number',
    'default': 1000
  }]
};
Object(vega_util_module["z" /* inherits */])(Sample, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE),
          mod = _.modified('size'),
          num = _.size,
          map = this.value.reduce((m, t) => (m[tupleid(t)] = 1, m), {});

    let res = this.value,
        cnt = this.count,
        cap = 0; // sample reservoir update function

    function update(t) {
      let p, idx;

      if (res.length < num) {
        res.push(t);
      } else {
        idx = ~~((cnt + 1) * vega_statistics_module_random());

        if (idx < res.length && idx >= cap) {
          p = res[idx];
          if (map[tupleid(p)]) out.rem.push(p); // eviction

          res[idx] = t;
        }
      }

      ++cnt;
    }

    if (pulse.rem.length) {
      // find all tuples that should be removed, add to output
      pulse.visit(pulse.REM, t => {
        const id = tupleid(t);

        if (map[id]) {
          map[id] = -1;
          out.rem.push(t);
        }

        --cnt;
      }); // filter removed tuples out of the sample reservoir

      res = res.filter(t => map[tupleid(t)] !== -1);
    }

    if ((pulse.rem.length || mod) && res.length < num && pulse.source) {
      // replenish sample if backing data source is available
      cap = cnt = res.length;
      pulse.visit(pulse.SOURCE, t => {
        // update, but skip previously sampled tuples
        if (!map[tupleid(t)]) update(t);
      });
      cap = -1;
    }

    if (mod && res.length > num) {
      const n = res.length - num;

      for (let i = 0; i < n; ++i) {
        map[tupleid(res[i])] = -1;
        out.rem.push(res[i]);
      }

      res = res.slice(n);
    }

    if (pulse.mod.length) {
      // propagate modified tuples in the sample reservoir
      pulse.visit(pulse.MOD, t => {
        if (map[tupleid(t)]) out.mod.push(t);
      });
    }

    if (pulse.add.length) {
      // update sample reservoir
      pulse.visit(pulse.ADD, update);
    }

    if (pulse.add.length || cap < 0) {
      // output newly added tuples
      out.add = res.filter(t => !map[tupleid(t)]);
    }

    this.count = cnt;
    this.value = out.source = res;
    return out;
  }

});

/**
 * Generates data tuples for a specified sequence range of numbers.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {number} params.start - The first number in the sequence.
 * @param {number} params.stop - The last number (exclusive) in the sequence.
 * @param {number} [params.step=1] - The step size between numbers in the sequence.
 */

function Sequence(params) {
  Transform.call(this, null, params);
}
Sequence.Definition = {
  'type': 'Sequence',
  'metadata': {
    'generates': true,
    'changes': true
  },
  'params': [{
    'name': 'start',
    'type': 'number',
    'required': true
  }, {
    'name': 'stop',
    'type': 'number',
    'required': true
  }, {
    'name': 'step',
    'type': 'number',
    'default': 1
  }, {
    'name': 'as',
    'type': 'string',
    'default': 'data'
  }]
};
Object(vega_util_module["z" /* inherits */])(Sequence, Transform, {
  transform(_, pulse) {
    if (this.value && !_.modified()) return;
    const out = pulse.materialize().fork(pulse.MOD),
          as = _.as || 'data';
    out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem;
    this.value = src_range(_.start, _.stop, _.step || 1).map(v => {
      const t = {};
      t[as] = v;
      return ingest$1(t);
    });
    out.add = pulse.add.concat(this.value);
    return out;
  }

});

/**
 * Propagates a new pulse without any tuples so long as the input
 * pulse contains some added, removed or modified tuples.
 * @param {object} params - The parameters for this operator.
 * @constructor
 */

function Sieve(params) {
  Transform.call(this, null, params);
  this.modified(true); // always treat as modified
}
Object(vega_util_module["z" /* inherits */])(Sieve, Transform, {
  transform(_, pulse) {
    this.value = pulse.source;
    return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;
  }

});

/**
 * Discretize dates to specific time units.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The data field containing date/time values.
 */

function TimeUnit(params) {
  Transform.call(this, null, params);
}
const OUTPUT = ['unit0', 'unit1'];
TimeUnit.Definition = {
  'type': 'TimeUnit',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field',
    'required': true
  }, {
    'name': 'interval',
    'type': 'boolean',
    'default': true
  }, {
    'name': 'units',
    'type': 'enum',
    'values': vega_time_module["j" /* TIME_UNITS */],
    'array': true
  }, {
    'name': 'step',
    'type': 'number',
    'default': 1
  }, {
    'name': 'maxbins',
    'type': 'number',
    'default': 40
  }, {
    'name': 'extent',
    'type': 'date',
    'array': true
  }, {
    'name': 'timezone',
    'type': 'enum',
    'default': 'local',
    'values': ['local', 'utc']
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': 2,
    'default': OUTPUT
  }]
};
Object(vega_util_module["z" /* inherits */])(TimeUnit, Transform, {
  transform(_, pulse) {
    const field = _.field,
          band = _.interval !== false,
          utc = _.timezone === 'utc',
          floor = this._floor(_, pulse),
          offset = (utc ? vega_time_module["v" /* utcInterval */] : vega_time_module["p" /* timeInterval */])(floor.unit).offset,
          as = _.as || OUTPUT,
          u0 = as[0],
          u1 = as[1],
          step = floor.step;

    let min = floor.start || Infinity,
        max = floor.stop || -Infinity,
        flag = pulse.ADD;

    if (_.modified() || pulse.modified(Object(vega_util_module["g" /* accessorFields */])(field))) {
      pulse = pulse.reflow(true);
      flag = pulse.SOURCE;
      min = Infinity;
      max = -Infinity;
    }

    pulse.visit(flag, t => {
      const v = field(t);
      let a, b;

      if (v == null) {
        t[u0] = null;
        if (band) t[u1] = null;
      } else {
        t[u0] = a = b = floor(v);
        if (band) t[u1] = b = offset(a, step);
        if (a < min) min = a;
        if (b > max) max = b;
      }
    });
    floor.start = min;
    floor.stop = max;
    return pulse.modifies(band ? as : u0);
  },

  _floor(_, pulse) {
    const utc = _.timezone === 'utc'; // get parameters

    const {
      units,
      step
    } = _.units ? {
      units: _.units,
      step: _.step || 1
    } : Object(vega_time_module["n" /* timeBin */])({
      extent: _.extent || Object(vega_util_module["q" /* extent */])(pulse.materialize(pulse.SOURCE).source, _.field),
      maxbins: _.maxbins
    }); // check / standardize time units

    const tunits = Object(vega_time_module["t" /* timeUnits */])(units),
          prev = this.value || {},
          floor = (utc ? vega_time_module["u" /* utcFloor */] : vega_time_module["o" /* timeFloor */])(tunits, step);
    floor.unit = Object(vega_util_module["W" /* peek */])(tunits);
    floor.units = tunits;
    floor.step = step;
    floor.start = prev.start;
    floor.stop = prev.stop;
    return this.value = floor;
  }

});

/**
 * An index that maps from unique, string-coerced, field values to tuples.
 * Assumes that the field serves as a unique key with no duplicate values.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The field accessor to index.
 */

function TupleIndex(params) {
  Transform.call(this, Object(vega_util_module["t" /* fastmap */])(), params);
}
Object(vega_util_module["z" /* inherits */])(TupleIndex, Transform, {
  transform(_, pulse) {
    const df = pulse.dataflow,
          field = _.field,
          index = this.value,
          set = t => index.set(field(t), t);

    let mod = true;

    if (_.modified('field') || pulse.modified(field.fields)) {
      index.clear();
      pulse.visit(pulse.SOURCE, set);
    } else if (pulse.changed()) {
      pulse.visit(pulse.REM, t => index.delete(field(t)));
      pulse.visit(pulse.ADD, set);
    } else {
      mod = false;
    }

    this.modified(mod);
    if (index.empty > df.cleanThreshold) df.runAfter(index.clean);
    return pulse.fork();
  }

});

/**
 * Extracts an array of values. Assumes the source data has already been
 * reduced as needed (e.g., by an upstream Aggregate transform).
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The domain field to extract.
 * @param {function(*,*): number} [params.sort] - An optional
 *   comparator function for sorting the values. The comparator will be
 *   applied to backing tuples prior to value extraction.
 */

function Values(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(Values, Transform, {
  transform(_, pulse) {
    const run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields);

    if (run) {
      this.value = (_.sort ? pulse.source.slice().sort(stableCompare(_.sort)) : pulse.source).map(_.field);
    }
  }

});

function WindowOp(op, field, param, as) {
  const fn = WindowOps[op](field, param);
  return {
    init: fn.init || vega_util_module["mb" /* zero */],
    update: function (w, t) {
      t[as] = fn.next(w);
    }
  };
}
const WindowOps = {
  row_number: function () {
    return {
      next: w => w.index + 1
    };
  },
  rank: function () {
    let rank;
    return {
      init: () => rank = 1,
      next: w => {
        const i = w.index,
              data = w.data;
        return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank;
      }
    };
  },
  dense_rank: function () {
    let drank;
    return {
      init: () => drank = 1,
      next: w => {
        const i = w.index,
              d = w.data;
        return i && w.compare(d[i - 1], d[i]) ? ++drank : drank;
      }
    };
  },
  percent_rank: function () {
    const rank = WindowOps.rank(),
          next = rank.next;
    return {
      init: rank.init,
      next: w => (next(w) - 1) / (w.data.length - 1)
    };
  },
  cume_dist: function () {
    let cume;
    return {
      init: () => cume = 0,
      next: w => {
        const d = w.data,
              c = w.compare;
        let i = w.index;

        if (cume < i) {
          while (i + 1 < d.length && !c(d[i], d[i + 1])) ++i;

          cume = i;
        }

        return (1 + cume) / d.length;
      }
    };
  },
  ntile: function (field, num) {
    num = +num;
    if (!(num > 0)) Object(vega_util_module["o" /* error */])('ntile num must be greater than zero.');
    const cume = WindowOps.cume_dist(),
          next = cume.next;
    return {
      init: cume.init,
      next: w => Math.ceil(num * next(w))
    };
  },
  lag: function (field, offset) {
    offset = +offset || 1;
    return {
      next: w => {
        const i = w.index - offset;
        return i >= 0 ? field(w.data[i]) : null;
      }
    };
  },
  lead: function (field, offset) {
    offset = +offset || 1;
    return {
      next: w => {
        const i = w.index + offset,
              d = w.data;
        return i < d.length ? field(d[i]) : null;
      }
    };
  },
  first_value: function (field) {
    return {
      next: w => field(w.data[w.i0])
    };
  },
  last_value: function (field) {
    return {
      next: w => field(w.data[w.i1 - 1])
    };
  },
  nth_value: function (field, nth) {
    nth = +nth;
    if (!(nth > 0)) Object(vega_util_module["o" /* error */])('nth_value nth must be greater than zero.');
    return {
      next: w => {
        const i = w.i0 + (nth - 1);
        return i < w.i1 ? field(w.data[i]) : null;
      }
    };
  },
  prev_value: function (field) {
    let prev;
    return {
      init: () => prev = null,
      next: w => {
        const v = field(w.data[w.index]);
        return v != null ? prev = v : prev;
      }
    };
  },
  next_value: function (field) {
    let v, i;
    return {
      init: () => (v = null, i = -1),
      next: w => {
        const d = w.data;
        return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]);
      }
    };
  }
};

function find(field, data, index) {
  for (let n = data.length; index < n; ++index) {
    const v = field(data[index]);
    if (v != null) return index;
  }

  return -1;
}

const ValidWindowOps = Object.keys(WindowOps);

function WindowState(_) {
  const ops = Object(vega_util_module["i" /* array */])(_.ops),
        fields = Object(vega_util_module["i" /* array */])(_.fields),
        params = Object(vega_util_module["i" /* array */])(_.params),
        as = Object(vega_util_module["i" /* array */])(_.as),
        outputs = this.outputs = [],
        windows = this.windows = [],
        inputs = {},
        map = {},
        counts = [],
        measures = [];
  let countOnly = true;

  function visitInputs(f) {
    Object(vega_util_module["i" /* array */])(Object(vega_util_module["g" /* accessorFields */])(f)).forEach(_ => inputs[_] = 1);
  }

  visitInputs(_.sort);
  ops.forEach((op, i) => {
    const field = fields[i],
          mname = Object(vega_util_module["h" /* accessorName */])(field),
          name = measureName(op, mname, as[i]);
    visitInputs(field);
    outputs.push(name); // Window operation

    if (Object(vega_util_module["w" /* hasOwnProperty */])(WindowOps, op)) {
      windows.push(WindowOp(op, fields[i], params[i], name));
    } // Aggregate operation
    else {
        if (field == null && op !== 'count') {
          Object(vega_util_module["o" /* error */])('Null aggregate field specified.');
        }

        if (op === 'count') {
          counts.push(name);
          return;
        }

        countOnly = false;
        let m = map[mname];

        if (!m) {
          m = map[mname] = [];
          m.field = field;
          measures.push(m);
        }

        m.push(createMeasure(op, name));
      }
  });

  if (counts.length || measures.length) {
    this.cell = cell(measures, counts, countOnly);
  }

  this.inputs = Object.keys(inputs);
}
const vega_transforms_module_prototype = WindowState.prototype;

vega_transforms_module_prototype.init = function () {
  this.windows.forEach(_ => _.init());
  if (this.cell) this.cell.init();
};

vega_transforms_module_prototype.update = function (w, t) {
  const cell = this.cell,
        wind = this.windows,
        data = w.data,
        m = wind && wind.length;
  let j;

  if (cell) {
    for (j = w.p0; j < w.i0; ++j) cell.rem(data[j]);

    for (j = w.p1; j < w.i1; ++j) cell.add(data[j]);

    cell.set(t);
  }

  for (j = 0; j < m; ++j) wind[j].update(w, t);
};

function cell(measures, counts, countOnly) {
  measures = measures.map(m => compileMeasures(m, m.field));
  const cell = {
    num: 0,
    agg: null,
    store: false,
    count: counts
  };

  if (!countOnly) {
    var n = measures.length,
        a = cell.agg = Array(n),
        i = 0;

    for (; i < n; ++i) a[i] = new measures[i](cell);
  }

  if (cell.store) {
    var store = cell.data = new TupleStore();
  }

  cell.add = function (t) {
    cell.num += 1;
    if (countOnly) return;
    if (store) store.add(t);

    for (let i = 0; i < n; ++i) {
      a[i].add(a[i].get(t), t);
    }
  };

  cell.rem = function (t) {
    cell.num -= 1;
    if (countOnly) return;
    if (store) store.rem(t);

    for (let i = 0; i < n; ++i) {
      a[i].rem(a[i].get(t), t);
    }
  };

  cell.set = function (t) {
    let i, n; // consolidate stored values

    if (store) store.values(); // update tuple properties

    for (i = 0, n = counts.length; i < n; ++i) t[counts[i]] = cell.num;

    if (!countOnly) for (i = 0, n = a.length; i < n; ++i) a[i].set(t);
  };

  cell.init = function () {
    cell.num = 0;
    if (store) store.reset();

    for (let i = 0; i < n; ++i) a[i].init();
  };

  return cell;
}

/**
 * Perform window calculations and write results to the input stream.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window.
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors by which to partition tuples into separate windows.
 * @param {Array<string>} params.ops - An array of strings indicating window operations to perform.
 * @param {Array<function(object): *>} [params.fields] - An array of accessors
 *   for data fields to use as inputs to window operations.
 * @param {Array<*>} [params.params] - An array of parameter values for window operations.
 * @param {Array<string>} [params.as] - An array of output field names for window operations.
 * @param {Array<number>} [params.frame] - Window frame definition as two-element array.
 * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row
 *   number alone, ignoring peers with identical sort values. If false (default),
 *   the window boundaries will be adjusted to include peer values.
 */

function Window(params) {
  Transform.call(this, {}, params);
  this._mlen = 0;
  this._mods = [];
}
Window.Definition = {
  'type': 'Window',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'sort',
    'type': 'compare'
  }, {
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'ops',
    'type': 'enum',
    'array': true,
    'values': ValidWindowOps.concat(ValidAggregateOps)
  }, {
    'name': 'params',
    'type': 'number',
    'null': true,
    'array': true
  }, {
    'name': 'fields',
    'type': 'field',
    'null': true,
    'array': true
  }, {
    'name': 'as',
    'type': 'string',
    'null': true,
    'array': true
  }, {
    'name': 'frame',
    'type': 'number',
    'null': true,
    'array': true,
    'length': 2,
    'default': [null, 0]
  }, {
    'name': 'ignorePeers',
    'type': 'boolean',
    'default': false
  }]
};
Object(vega_util_module["z" /* inherits */])(Window, Transform, {
  transform(_, pulse) {
    this.stamp = pulse.stamp;

    const mod = _.modified(),
          cmp = stableCompare(_.sort),
          key = groupkey(_.groupby),
          group = t => this.group(key(t)); // initialize window state


    let state = this.state;

    if (!state || mod) {
      state = this.state = new WindowState(_);
    } // partition input tuples


    if (mod || pulse.modified(state.inputs)) {
      this.value = {};
      pulse.visit(pulse.SOURCE, t => group(t).add(t));
    } else {
      pulse.visit(pulse.REM, t => group(t).remove(t));
      pulse.visit(pulse.ADD, t => group(t).add(t));
    } // perform window calculations for each modified partition


    for (let i = 0, n = this._mlen; i < n; ++i) {
      processPartition(this._mods[i], state, cmp, _);
    }

    this._mlen = 0;
    this._mods = []; // TODO don't reflow everything?

    return pulse.reflow(mod).modifies(state.outputs);
  },

  group(key) {
    let group = this.value[key];

    if (!group) {
      group = this.value[key] = SortedList(tupleid);
      group.stamp = -1;
    }

    if (group.stamp < this.stamp) {
      group.stamp = this.stamp;
      this._mods[this._mlen++] = group;
    }

    return group;
  }

});

function processPartition(list, state, cmp, _) {
  const sort = _.sort,
        range = sort && !_.ignorePeers,
        frame = _.frame || [null, 0],
        data = list.data(cmp),
        // use cmp for stable sort
  n = data.length,
        b = range ? Object(bisector["a" /* default */])(sort) : null,
        w = {
    i0: 0,
    i1: 0,
    p0: 0,
    p1: 0,
    index: 0,
    data: data,
    compare: sort || Object(vega_util_module["m" /* constant */])(-1)
  };
  state.init();

  for (let i = 0; i < n; ++i) {
    setWindow(w, frame, i, n);
    if (range) adjustRange(w, b);
    state.update(w, data[i]);
  }
}

function setWindow(w, f, i, n) {
  w.p0 = w.i0;
  w.p1 = w.i1;
  w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0]));
  w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1);
  w.index = i;
} // if frame type is 'range', adjust window for peer values


function adjustRange(w, bisect) {
  const r0 = w.i0,
        r1 = w.i1 - 1,
        c = w.compare,
        d = w.data,
        n = d.length - 1;
  if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]);
  if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]);
}



// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/basis.js
function basis_point(that, x, y) {
  that._context.bezierCurveTo(
    (2 * that._x0 + that._x1) / 3,
    (2 * that._y0 + that._y1) / 3,
    (that._x0 + 2 * that._x1) / 3,
    (that._y0 + 2 * that._y1) / 3,
    (that._x0 + 4 * that._x1 + x) / 6,
    (that._y0 + 4 * that._y1 + y) / 6
  );
}

function Basis(context) {
  this._context = context;
}

Basis.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 =
    this._y0 = this._y1 = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 3: basis_point(this, this._x1, this._y1); // proceed
      case 2: this._context.lineTo(this._x1, this._y1); break;
    }
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._point) {
      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
      case 1: this._point = 2; break;
      case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed
      default: basis_point(this, x, y); break;
    }
    this._x0 = this._x1, this._x1 = x;
    this._y0 = this._y1, this._y1 = y;
  }
};

/* harmony default export */ var basis = (function(context) {
  return new Basis(context);
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/noop.js
/* harmony default export */ var src_noop = (function() {});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/basisClosed.js



function BasisClosed(context) {
  this._context = context;
}

BasisClosed.prototype = {
  areaStart: src_noop,
  areaEnd: src_noop,
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =
    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 1: {
        this._context.moveTo(this._x2, this._y2);
        this._context.closePath();
        break;
      }
      case 2: {
        this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);
        this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);
        this._context.closePath();
        break;
      }
      case 3: {
        this.point(this._x2, this._y2);
        this.point(this._x3, this._y3);
        this.point(this._x4, this._y4);
        break;
      }
    }
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._point) {
      case 0: this._point = 1; this._x2 = x, this._y2 = y; break;
      case 1: this._point = 2; this._x3 = x, this._y3 = y; break;
      case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;
      default: basis_point(this, x, y); break;
    }
    this._x0 = this._x1, this._x1 = x;
    this._y0 = this._y1, this._y1 = y;
  }
};

/* harmony default export */ var basisClosed = (function(context) {
  return new BasisClosed(context);
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/basisOpen.js


function BasisOpen(context) {
  this._context = context;
}

BasisOpen.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 =
    this._y0 = this._y1 = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._point) {
      case 0: this._point = 1; break;
      case 1: this._point = 2; break;
      case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;
      case 3: this._point = 4; // proceed
      default: basis_point(this, x, y); break;
    }
    this._x0 = this._x1, this._x1 = x;
    this._y0 = this._y1, this._y1 = y;
  }
};

/* harmony default export */ var basisOpen = (function(context) {
  return new BasisOpen(context);
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/bundle.js


function Bundle(context, beta) {
  this._basis = new Basis(context);
  this._beta = beta;
}

Bundle.prototype = {
  lineStart: function() {
    this._x = [];
    this._y = [];
    this._basis.lineStart();
  },
  lineEnd: function() {
    var x = this._x,
        y = this._y,
        j = x.length - 1;

    if (j > 0) {
      var x0 = x[0],
          y0 = y[0],
          dx = x[j] - x0,
          dy = y[j] - y0,
          i = -1,
          t;

      while (++i <= j) {
        t = i / j;
        this._basis.point(
          this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),
          this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)
        );
      }
    }

    this._x = this._y = null;
    this._basis.lineEnd();
  },
  point: function(x, y) {
    this._x.push(+x);
    this._y.push(+y);
  }
};

/* harmony default export */ var curve_bundle = ((function custom(beta) {

  function bundle(context) {
    return beta === 1 ? new Basis(context) : new Bundle(context, beta);
  }

  bundle.beta = function(beta) {
    return custom(+beta);
  };

  return bundle;
})(0.85));

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/cardinal.js
function cardinal_point(that, x, y) {
  that._context.bezierCurveTo(
    that._x1 + that._k * (that._x2 - that._x0),
    that._y1 + that._k * (that._y2 - that._y0),
    that._x2 + that._k * (that._x1 - x),
    that._y2 + that._k * (that._y1 - y),
    that._x2,
    that._y2
  );
}

function Cardinal(context, tension) {
  this._context = context;
  this._k = (1 - tension) / 6;
}

Cardinal.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 =
    this._y0 = this._y1 = this._y2 = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2: this._context.lineTo(this._x2, this._y2); break;
      case 3: cardinal_point(this, this._x1, this._y1); break;
    }
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._point) {
      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
      case 1: this._point = 2; this._x1 = x, this._y1 = y; break;
      case 2: this._point = 3; // proceed
      default: cardinal_point(this, x, y); break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  }
};

/* harmony default export */ var cardinal = ((function custom(tension) {

  function cardinal(context) {
    return new Cardinal(context, tension);
  }

  cardinal.tension = function(tension) {
    return custom(+tension);
  };

  return cardinal;
})(0));

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/cardinalOpen.js


function CardinalOpen(context, tension) {
  this._context = context;
  this._k = (1 - tension) / 6;
}

CardinalOpen.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 =
    this._y0 = this._y1 = this._y2 = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._point) {
      case 0: this._point = 1; break;
      case 1: this._point = 2; break;
      case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
      case 3: this._point = 4; // proceed
      default: cardinal_point(this, x, y); break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  }
};

/* harmony default export */ var cardinalOpen = ((function custom(tension) {

  function cardinal(context) {
    return new CardinalOpen(context, tension);
  }

  cardinal.tension = function(tension) {
    return custom(+tension);
  };

  return cardinal;
})(0));

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/cardinalClosed.js



function CardinalClosed(context, tension) {
  this._context = context;
  this._k = (1 - tension) / 6;
}

CardinalClosed.prototype = {
  areaStart: src_noop,
  areaEnd: src_noop,
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 1: {
        this._context.moveTo(this._x3, this._y3);
        this._context.closePath();
        break;
      }
      case 2: {
        this._context.lineTo(this._x3, this._y3);
        this._context.closePath();
        break;
      }
      case 3: {
        this.point(this._x3, this._y3);
        this.point(this._x4, this._y4);
        this.point(this._x5, this._y5);
        break;
      }
    }
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._point) {
      case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
      case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
      case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
      default: cardinal_point(this, x, y); break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  }
};

/* harmony default export */ var cardinalClosed = ((function custom(tension) {

  function cardinal(context) {
    return new CardinalClosed(context, tension);
  }

  cardinal.tension = function(tension) {
    return custom(+tension);
  };

  return cardinal;
})(0));

// CONCATENATED MODULE: ./node_modules/d3-shape/src/math.js
var abs = Math.abs;
var atan2 = Math.atan2;
var cos = Math.cos;
var math_max = Math.max;
var math_min = Math.min;
var sin = Math.sin;
var sqrt = Math.sqrt;

var math_epsilon = 1e-12;
var pi = Math.PI;
var halfPi = pi / 2;
var tau = 2 * pi;

function acos(x) {
  return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
}

function asin(x) {
  return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
}

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/catmullRom.js



function catmullRom_point(that, x, y) {
  var x1 = that._x1,
      y1 = that._y1,
      x2 = that._x2,
      y2 = that._y2;

  if (that._l01_a > math_epsilon) {
    var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,
        n = 3 * that._l01_a * (that._l01_a + that._l12_a);
    x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
    y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
  }

  if (that._l23_a > math_epsilon) {
    var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,
        m = 3 * that._l23_a * (that._l23_a + that._l12_a);
    x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
    y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
  }

  that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);
}

function CatmullRom(context, alpha) {
  this._context = context;
  this._alpha = alpha;
}

CatmullRom.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 =
    this._y0 = this._y1 = this._y2 = NaN;
    this._l01_a = this._l12_a = this._l23_a =
    this._l01_2a = this._l12_2a = this._l23_2a =
    this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2: this._context.lineTo(this._x2, this._y2); break;
      case 3: this.point(this._x2, this._y2); break;
    }
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    x = +x, y = +y;

    if (this._point) {
      var x23 = this._x2 - x,
          y23 = this._y2 - y;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
    }

    switch (this._point) {
      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
      case 1: this._point = 2; break;
      case 2: this._point = 3; // proceed
      default: catmullRom_point(this, x, y); break;
    }

    this._l01_a = this._l12_a, this._l12_a = this._l23_a;
    this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  }
};

/* harmony default export */ var curve_catmullRom = ((function custom(alpha) {

  function catmullRom(context) {
    return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);
  }

  catmullRom.alpha = function(alpha) {
    return custom(+alpha);
  };

  return catmullRom;
})(0.5));

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/catmullRomClosed.js




function CatmullRomClosed(context, alpha) {
  this._context = context;
  this._alpha = alpha;
}

CatmullRomClosed.prototype = {
  areaStart: src_noop,
  areaEnd: src_noop,
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
    this._l01_a = this._l12_a = this._l23_a =
    this._l01_2a = this._l12_2a = this._l23_2a =
    this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 1: {
        this._context.moveTo(this._x3, this._y3);
        this._context.closePath();
        break;
      }
      case 2: {
        this._context.lineTo(this._x3, this._y3);
        this._context.closePath();
        break;
      }
      case 3: {
        this.point(this._x3, this._y3);
        this.point(this._x4, this._y4);
        this.point(this._x5, this._y5);
        break;
      }
    }
  },
  point: function(x, y) {
    x = +x, y = +y;

    if (this._point) {
      var x23 = this._x2 - x,
          y23 = this._y2 - y;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
    }

    switch (this._point) {
      case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
      case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
      case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
      default: catmullRom_point(this, x, y); break;
    }

    this._l01_a = this._l12_a, this._l12_a = this._l23_a;
    this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  }
};

/* harmony default export */ var catmullRomClosed = ((function custom(alpha) {

  function catmullRom(context) {
    return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
  }

  catmullRom.alpha = function(alpha) {
    return custom(+alpha);
  };

  return catmullRom;
})(0.5));

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/catmullRomOpen.js



function CatmullRomOpen(context, alpha) {
  this._context = context;
  this._alpha = alpha;
}

CatmullRomOpen.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 =
    this._y0 = this._y1 = this._y2 = NaN;
    this._l01_a = this._l12_a = this._l23_a =
    this._l01_2a = this._l12_2a = this._l23_2a =
    this._point = 0;
  },
  lineEnd: function() {
    if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    x = +x, y = +y;

    if (this._point) {
      var x23 = this._x2 - x,
          y23 = this._y2 - y;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
    }

    switch (this._point) {
      case 0: this._point = 1; break;
      case 1: this._point = 2; break;
      case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
      case 3: this._point = 4; // proceed
      default: catmullRom_point(this, x, y); break;
    }

    this._l01_a = this._l12_a, this._l12_a = this._l23_a;
    this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  }
};

/* harmony default export */ var catmullRomOpen = ((function custom(alpha) {

  function catmullRom(context) {
    return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
  }

  catmullRom.alpha = function(alpha) {
    return custom(+alpha);
  };

  return catmullRom;
})(0.5));

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/linear.js
function Linear(context) {
  this._context = context;
}

Linear.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._point) {
      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
      case 1: this._point = 2; // proceed
      default: this._context.lineTo(x, y); break;
    }
  }
};

/* harmony default export */ var curve_linear = (function(context) {
  return new Linear(context);
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/linearClosed.js


function LinearClosed(context) {
  this._context = context;
}

LinearClosed.prototype = {
  areaStart: src_noop,
  areaEnd: src_noop,
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    if (this._point) this._context.closePath();
  },
  point: function(x, y) {
    x = +x, y = +y;
    if (this._point) this._context.lineTo(x, y);
    else this._point = 1, this._context.moveTo(x, y);
  }
};

/* harmony default export */ var linearClosed = (function(context) {
  return new LinearClosed(context);
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/monotone.js
function monotone_sign(x) {
  return x < 0 ? -1 : 1;
}

// Calculate the slopes of the tangents (Hermite-type interpolation) based on
// the following paper: Steffen, M. 1990. A Simple Method for Monotonic
// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.
// NOV(II), P. 443, 1990.
function slope3(that, x2, y2) {
  var h0 = that._x1 - that._x0,
      h1 = x2 - that._x1,
      s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),
      s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),
      p = (s0 * h1 + s1 * h0) / (h0 + h1);
  return (monotone_sign(s0) + monotone_sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
}

// Calculate a one-sided slope.
function slope2(that, t) {
  var h = that._x1 - that._x0;
  return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
}

// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations
// "you can express cubic Hermite interpolation in terms of cubic Bézier curves
// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
function monotone_point(that, t0, t1) {
  var x0 = that._x0,
      y0 = that._y0,
      x1 = that._x1,
      y1 = that._y1,
      dx = (x1 - x0) / 3;
  that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
}

function MonotoneX(context) {
  this._context = context;
}

MonotoneX.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 =
    this._y0 = this._y1 =
    this._t0 = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2: this._context.lineTo(this._x1, this._y1); break;
      case 3: monotone_point(this, this._t0, slope2(this, this._t0)); break;
    }
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    this._line = 1 - this._line;
  },
  point: function(x, y) {
    var t1 = NaN;

    x = +x, y = +y;
    if (x === this._x1 && y === this._y1) return; // Ignore coincident points.
    switch (this._point) {
      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
      case 1: this._point = 2; break;
      case 2: this._point = 3; monotone_point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;
      default: monotone_point(this, this._t0, t1 = slope3(this, x, y)); break;
    }

    this._x0 = this._x1, this._x1 = x;
    this._y0 = this._y1, this._y1 = y;
    this._t0 = t1;
  }
}

function MonotoneY(context) {
  this._context = new ReflectContext(context);
}

(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {
  MonotoneX.prototype.point.call(this, y, x);
};

function ReflectContext(context) {
  this._context = context;
}

ReflectContext.prototype = {
  moveTo: function(x, y) { this._context.moveTo(y, x); },
  closePath: function() { this._context.closePath(); },
  lineTo: function(x, y) { this._context.lineTo(y, x); },
  bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }
};

function monotoneX(context) {
  return new MonotoneX(context);
}

function monotoneY(context) {
  return new MonotoneY(context);
}

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/natural.js
function Natural(context) {
  this._context = context;
}

Natural.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x = [];
    this._y = [];
  },
  lineEnd: function() {
    var x = this._x,
        y = this._y,
        n = x.length;

    if (n) {
      this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);
      if (n === 2) {
        this._context.lineTo(x[1], y[1]);
      } else {
        var px = controlPoints(x),
            py = controlPoints(y);
        for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {
          this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);
        }
      }
    }

    if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();
    this._line = 1 - this._line;
    this._x = this._y = null;
  },
  point: function(x, y) {
    this._x.push(+x);
    this._y.push(+y);
  }
};

// See https://www.particleincell.com/2012/bezier-splines/ for derivation.
function controlPoints(x) {
  var i,
      n = x.length - 1,
      m,
      a = new Array(n),
      b = new Array(n),
      r = new Array(n);
  a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];
  for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];
  a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];
  for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];
  a[n - 1] = r[n - 1] / b[n - 1];
  for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];
  b[n - 1] = (x[n] + a[n - 1]) / 2;
  for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];
  return [a, b];
}

/* harmony default export */ var natural = (function(context) {
  return new Natural(context);
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/step.js
function Step(context, t) {
  this._context = context;
  this._t = t;
}

Step.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x = this._y = NaN;
    this._point = 0;
  },
  lineEnd: function() {
    if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);
    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
    if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._point) {
      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
      case 1: this._point = 2; // proceed
      default: {
        if (this._t <= 0) {
          this._context.lineTo(this._x, y);
          this._context.lineTo(x, y);
        } else {
          var x1 = this._x * (1 - this._t) + x * this._t;
          this._context.lineTo(x1, this._y);
          this._context.lineTo(x1, y);
        }
        break;
      }
    }
    this._x = x, this._y = y;
  }
};

/* harmony default export */ var curve_step = (function(context) {
  return new Step(context, 0.5);
});

function stepBefore(context) {
  return new Step(context, 0);
}

function stepAfter(context) {
  return new Step(context, 1);
}

// CONCATENATED MODULE: ./node_modules/d3-path/src/path.js
const path_pi = Math.PI,
    path_tau = 2 * path_pi,
    path_epsilon = 1e-6,
    tauEpsilon = path_tau - path_epsilon;

function Path() {
  this._x0 = this._y0 = // start of current subpath
  this._x1 = this._y1 = null; // end of current subpath
  this._ = "";
}

function path_path() {
  return new Path;
}

Path.prototype = path_path.prototype = {
  constructor: Path,
  moveTo: function(x, y) {
    this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
  },
  closePath: function() {
    if (this._x1 !== null) {
      this._x1 = this._x0, this._y1 = this._y0;
      this._ += "Z";
    }
  },
  lineTo: function(x, y) {
    this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
  },
  quadraticCurveTo: function(x1, y1, x, y) {
    this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
  },
  bezierCurveTo: function(x1, y1, x2, y2, x, y) {
    this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
  },
  arcTo: function(x1, y1, x2, y2, r) {
    x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
    var x0 = this._x1,
        y0 = this._y1,
        x21 = x2 - x1,
        y21 = y2 - y1,
        x01 = x0 - x1,
        y01 = y0 - y1,
        l01_2 = x01 * x01 + y01 * y01;

    // Is the radius negative? Error.
    if (r < 0) throw new Error("negative radius: " + r);

    // Is this path empty? Move to (x1,y1).
    if (this._x1 === null) {
      this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
    }

    // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
    else if (!(l01_2 > path_epsilon));

    // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
    // Equivalently, is (x1,y1) coincident with (x2,y2)?
    // Or, is the radius zero? Line to (x1,y1).
    else if (!(Math.abs(y01 * x21 - y21 * x01) > path_epsilon) || !r) {
      this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
    }

    // Otherwise, draw an arc!
    else {
      var x20 = x2 - x0,
          y20 = y2 - y0,
          l21_2 = x21 * x21 + y21 * y21,
          l20_2 = x20 * x20 + y20 * y20,
          l21 = Math.sqrt(l21_2),
          l01 = Math.sqrt(l01_2),
          l = r * Math.tan((path_pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
          t01 = l / l01,
          t21 = l / l21;

      // If the start tangent is not coincident with (x0,y0), line to.
      if (Math.abs(t01 - 1) > path_epsilon) {
        this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
      }

      this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
    }
  },
  arc: function(x, y, r, a0, a1, ccw) {
    x = +x, y = +y, r = +r, ccw = !!ccw;
    var dx = r * Math.cos(a0),
        dy = r * Math.sin(a0),
        x0 = x + dx,
        y0 = y + dy,
        cw = 1 ^ ccw,
        da = ccw ? a0 - a1 : a1 - a0;

    // Is the radius negative? Error.
    if (r < 0) throw new Error("negative radius: " + r);

    // Is this path empty? Move to (x0,y0).
    if (this._x1 === null) {
      this._ += "M" + x0 + "," + y0;
    }

    // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
    else if (Math.abs(this._x1 - x0) > path_epsilon || Math.abs(this._y1 - y0) > path_epsilon) {
      this._ += "L" + x0 + "," + y0;
    }

    // Is this arc empty? We’re done.
    if (!r) return;

    // Does the angle go the wrong way? Flip the direction.
    if (da < 0) da = da % path_tau + path_tau;

    // Is this a complete circle? Draw two arcs to complete the circle.
    if (da > tauEpsilon) {
      this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
    }

    // Is this arc non-empty? Draw an arc!
    else if (da > path_epsilon) {
      this._ += "A" + r + "," + r + ",0," + (+(da >= path_pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
    }
  },
  rect: function(x, y, w, h) {
    this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
  },
  toString: function() {
    return this._;
  }
};

/* harmony default export */ var src_path = (path_path);

// CONCATENATED MODULE: ./node_modules/d3-shape/src/constant.js
/* harmony default export */ var src_constant = (function(x) {
  return function constant() {
    return x;
  };
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/arc.js




function arcInnerRadius(d) {
  return d.innerRadius;
}

function arcOuterRadius(d) {
  return d.outerRadius;
}

function arcStartAngle(d) {
  return d.startAngle;
}

function arcEndAngle(d) {
  return d.endAngle;
}

function arcPadAngle(d) {
  return d && d.padAngle; // Note: optional!
}

function arc_intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
  var x10 = x1 - x0, y10 = y1 - y0,
      x32 = x3 - x2, y32 = y3 - y2,
      t = y32 * x10 - x32 * y10;
  if (t * t < math_epsilon) return;
  t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
  return [x0 + t * x10, y0 + t * y10];
}

// Compute perpendicular offset line of length rc.
// http://mathworld.wolfram.com/Circle-LineIntersection.html
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
  var x01 = x0 - x1,
      y01 = y0 - y1,
      lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
      ox = lo * y01,
      oy = -lo * x01,
      x11 = x0 + ox,
      y11 = y0 + oy,
      x10 = x1 + ox,
      y10 = y1 + oy,
      x00 = (x11 + x10) / 2,
      y00 = (y11 + y10) / 2,
      dx = x10 - x11,
      dy = y10 - y11,
      d2 = dx * dx + dy * dy,
      r = r1 - rc,
      D = x11 * y10 - x10 * y11,
      d = (dy < 0 ? -1 : 1) * sqrt(math_max(0, r * r * d2 - D * D)),
      cx0 = (D * dy - dx * d) / d2,
      cy0 = (-D * dx - dy * d) / d2,
      cx1 = (D * dy + dx * d) / d2,
      cy1 = (-D * dx + dy * d) / d2,
      dx0 = cx0 - x00,
      dy0 = cy0 - y00,
      dx1 = cx1 - x00,
      dy1 = cy1 - y00;

  // Pick the closer of the two intersection points.
  // TODO Is there a faster way to determine which intersection to use?
  if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;

  return {
    cx: cx0,
    cy: cy0,
    x01: -ox,
    y01: -oy,
    x11: cx0 * (r1 / r - 1),
    y11: cy0 * (r1 / r - 1)
  };
}

/* harmony default export */ var src_arc = (function() {
  var innerRadius = arcInnerRadius,
      outerRadius = arcOuterRadius,
      cornerRadius = src_constant(0),
      padRadius = null,
      startAngle = arcStartAngle,
      endAngle = arcEndAngle,
      padAngle = arcPadAngle,
      context = null;

  function arc() {
    var buffer,
        r,
        r0 = +innerRadius.apply(this, arguments),
        r1 = +outerRadius.apply(this, arguments),
        a0 = startAngle.apply(this, arguments) - halfPi,
        a1 = endAngle.apply(this, arguments) - halfPi,
        da = abs(a1 - a0),
        cw = a1 > a0;

    if (!context) context = buffer = src_path();

    // Ensure that the outer radius is always larger than the inner radius.
    if (r1 < r0) r = r1, r1 = r0, r0 = r;

    // Is it a point?
    if (!(r1 > math_epsilon)) context.moveTo(0, 0);

    // Or is it a circle or annulus?
    else if (da > tau - math_epsilon) {
      context.moveTo(r1 * cos(a0), r1 * sin(a0));
      context.arc(0, 0, r1, a0, a1, !cw);
      if (r0 > math_epsilon) {
        context.moveTo(r0 * cos(a1), r0 * sin(a1));
        context.arc(0, 0, r0, a1, a0, cw);
      }
    }

    // Or is it a circular or annular sector?
    else {
      var a01 = a0,
          a11 = a1,
          a00 = a0,
          a10 = a1,
          da0 = da,
          da1 = da,
          ap = padAngle.apply(this, arguments) / 2,
          rp = (ap > math_epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
          rc = math_min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
          rc0 = rc,
          rc1 = rc,
          t0,
          t1;

      // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
      if (rp > math_epsilon) {
        var p0 = asin(rp / r0 * sin(ap)),
            p1 = asin(rp / r1 * sin(ap));
        if ((da0 -= p0 * 2) > math_epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;
        else da0 = 0, a00 = a10 = (a0 + a1) / 2;
        if ((da1 -= p1 * 2) > math_epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;
        else da1 = 0, a01 = a11 = (a0 + a1) / 2;
      }

      var x01 = r1 * cos(a01),
          y01 = r1 * sin(a01),
          x10 = r0 * cos(a10),
          y10 = r0 * sin(a10);

      // Apply rounded corners?
      if (rc > math_epsilon) {
        var x11 = r1 * cos(a11),
            y11 = r1 * sin(a11),
            x00 = r0 * cos(a00),
            y00 = r0 * sin(a00),
            oc;

        // Restrict the corner radius according to the sector angle.
        if (da < pi && (oc = arc_intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
          var ax = x01 - oc[0],
              ay = y01 - oc[1],
              bx = x11 - oc[0],
              by = y11 - oc[1],
              kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
              lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
          rc0 = math_min(rc, (r0 - lc) / (kc - 1));
          rc1 = math_min(rc, (r1 - lc) / (kc + 1));
        }
      }

      // Is the sector collapsed to a line?
      if (!(da1 > math_epsilon)) context.moveTo(x01, y01);

      // Does the sector’s outer ring have rounded corners?
      else if (rc1 > math_epsilon) {
        t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
        t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);

        context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);

        // Have the corners merged?
        if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);

        // Otherwise, draw the two corners and the ring.
        else {
          context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
          context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
          context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
        }
      }

      // Or is the outer ring just a circular arc?
      else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);

      // Is there no inner ring, and it’s a circular sector?
      // Or perhaps it’s an annular sector collapsed due to padding?
      if (!(r0 > math_epsilon) || !(da0 > math_epsilon)) context.lineTo(x10, y10);

      // Does the sector’s inner ring (or point) have rounded corners?
      else if (rc0 > math_epsilon) {
        t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
        t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);

        context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);

        // Have the corners merged?
        if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);

        // Otherwise, draw the two corners and the ring.
        else {
          context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
          context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
          context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
        }
      }

      // Or is the inner ring just a circular arc?
      else context.arc(0, 0, r0, a10, a00, cw);
    }

    context.closePath();

    if (buffer) return context = null, buffer + "" || null;
  }

  arc.centroid = function() {
    var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
        a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
    return [cos(a) * r, sin(a) * r];
  };

  arc.innerRadius = function(_) {
    return arguments.length ? (innerRadius = typeof _ === "function" ? _ : src_constant(+_), arc) : innerRadius;
  };

  arc.outerRadius = function(_) {
    return arguments.length ? (outerRadius = typeof _ === "function" ? _ : src_constant(+_), arc) : outerRadius;
  };

  arc.cornerRadius = function(_) {
    return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : src_constant(+_), arc) : cornerRadius;
  };

  arc.padRadius = function(_) {
    return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : src_constant(+_), arc) : padRadius;
  };

  arc.startAngle = function(_) {
    return arguments.length ? (startAngle = typeof _ === "function" ? _ : src_constant(+_), arc) : startAngle;
  };

  arc.endAngle = function(_) {
    return arguments.length ? (endAngle = typeof _ === "function" ? _ : src_constant(+_), arc) : endAngle;
  };

  arc.padAngle = function(_) {
    return arguments.length ? (padAngle = typeof _ === "function" ? _ : src_constant(+_), arc) : padAngle;
  };

  arc.context = function(_) {
    return arguments.length ? ((context = _ == null ? null : _), arc) : context;
  };

  return arc;
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/array.js
var slice = Array.prototype.slice;

/* harmony default export */ var src_array = (function(x) {
  return typeof x === "object" && "length" in x
    ? x // Array, TypedArray, NodeList, array-like
    : Array.from(x); // Map, Set, iterable, string, or anything else
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/point.js
function point_x(p) {
  return p[0];
}

function point_y(p) {
  return p[1];
}

// CONCATENATED MODULE: ./node_modules/d3-shape/src/line.js






/* harmony default export */ var src_line = (function(x, y) {
  var defined = src_constant(true),
      context = null,
      curve = curve_linear,
      output = null;

  x = typeof x === "function" ? x : (x === undefined) ? point_x : src_constant(x);
  y = typeof y === "function" ? y : (y === undefined) ? point_y : src_constant(y);

  function line(data) {
    var i,
        n = (data = src_array(data)).length,
        d,
        defined0 = false,
        buffer;

    if (context == null) output = curve(buffer = src_path());

    for (i = 0; i <= n; ++i) {
      if (!(i < n && defined(d = data[i], i, data)) === defined0) {
        if (defined0 = !defined0) output.lineStart();
        else output.lineEnd();
      }
      if (defined0) output.point(+x(d, i, data), +y(d, i, data));
    }

    if (buffer) return output = null, buffer + "" || null;
  }

  line.x = function(_) {
    return arguments.length ? (x = typeof _ === "function" ? _ : src_constant(+_), line) : x;
  };

  line.y = function(_) {
    return arguments.length ? (y = typeof _ === "function" ? _ : src_constant(+_), line) : y;
  };

  line.defined = function(_) {
    return arguments.length ? (defined = typeof _ === "function" ? _ : src_constant(!!_), line) : defined;
  };

  line.curve = function(_) {
    return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
  };

  line.context = function(_) {
    return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
  };

  return line;
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/area.js







/* harmony default export */ var src_area = (function(x0, y0, y1) {
  var x1 = null,
      defined = src_constant(true),
      context = null,
      curve = curve_linear,
      output = null;

  x0 = typeof x0 === "function" ? x0 : (x0 === undefined) ? point_x : src_constant(+x0);
  y0 = typeof y0 === "function" ? y0 : (y0 === undefined) ? src_constant(0) : src_constant(+y0);
  y1 = typeof y1 === "function" ? y1 : (y1 === undefined) ? point_y : src_constant(+y1);

  function area(data) {
    var i,
        j,
        k,
        n = (data = src_array(data)).length,
        d,
        defined0 = false,
        buffer,
        x0z = new Array(n),
        y0z = new Array(n);

    if (context == null) output = curve(buffer = src_path());

    for (i = 0; i <= n; ++i) {
      if (!(i < n && defined(d = data[i], i, data)) === defined0) {
        if (defined0 = !defined0) {
          j = i;
          output.areaStart();
          output.lineStart();
        } else {
          output.lineEnd();
          output.lineStart();
          for (k = i - 1; k >= j; --k) {
            output.point(x0z[k], y0z[k]);
          }
          output.lineEnd();
          output.areaEnd();
        }
      }
      if (defined0) {
        x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);
        output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);
      }
    }

    if (buffer) return output = null, buffer + "" || null;
  }

  function arealine() {
    return src_line().defined(defined).curve(curve).context(context);
  }

  area.x = function(_) {
    return arguments.length ? (x0 = typeof _ === "function" ? _ : src_constant(+_), x1 = null, area) : x0;
  };

  area.x0 = function(_) {
    return arguments.length ? (x0 = typeof _ === "function" ? _ : src_constant(+_), area) : x0;
  };

  area.x1 = function(_) {
    return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : src_constant(+_), area) : x1;
  };

  area.y = function(_) {
    return arguments.length ? (y0 = typeof _ === "function" ? _ : src_constant(+_), y1 = null, area) : y0;
  };

  area.y0 = function(_) {
    return arguments.length ? (y0 = typeof _ === "function" ? _ : src_constant(+_), area) : y0;
  };

  area.y1 = function(_) {
    return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : src_constant(+_), area) : y1;
  };

  area.lineX0 =
  area.lineY0 = function() {
    return arealine().x(x0).y(y0);
  };

  area.lineY1 = function() {
    return arealine().x(x0).y(y1);
  };

  area.lineX1 = function() {
    return arealine().x(x1).y(y0);
  };

  area.defined = function(_) {
    return arguments.length ? (defined = typeof _ === "function" ? _ : src_constant(!!_), area) : defined;
  };

  area.curve = function(_) {
    return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;
  };

  area.context = function(_) {
    return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;
  };

  return area;
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/circle.js


/* harmony default export */ var symbol_circle = ({
  draw: function(context, size) {
    var r = Math.sqrt(size / pi);
    context.moveTo(r, 0);
    context.arc(0, 0, r, 0, tau);
  }
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/cross.js
/* harmony default export */ var symbol_cross = ({
  draw: function(context, size) {
    var r = Math.sqrt(size / 5) / 2;
    context.moveTo(-3 * r, -r);
    context.lineTo(-r, -r);
    context.lineTo(-r, -3 * r);
    context.lineTo(r, -3 * r);
    context.lineTo(r, -r);
    context.lineTo(3 * r, -r);
    context.lineTo(3 * r, r);
    context.lineTo(r, r);
    context.lineTo(r, 3 * r);
    context.lineTo(-r, 3 * r);
    context.lineTo(-r, r);
    context.lineTo(-3 * r, r);
    context.closePath();
  }
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/diamond.js
var tan30 = Math.sqrt(1 / 3),
    tan30_2 = tan30 * 2;

/* harmony default export */ var diamond = ({
  draw: function(context, size) {
    var y = Math.sqrt(size / tan30_2),
        x = y * tan30;
    context.moveTo(0, -y);
    context.lineTo(x, 0);
    context.lineTo(0, y);
    context.lineTo(-x, 0);
    context.closePath();
  }
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/star.js


var ka = 0.89081309152928522810,
    kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10),
    star_kx = Math.sin(tau / 10) * kr,
    star_ky = -Math.cos(tau / 10) * kr;

/* harmony default export */ var star = ({
  draw: function(context, size) {
    var r = Math.sqrt(size * ka),
        x = star_kx * r,
        y = star_ky * r;
    context.moveTo(0, -r);
    context.lineTo(x, y);
    for (var i = 1; i < 5; ++i) {
      var a = tau * i / 5,
          c = Math.cos(a),
          s = Math.sin(a);
      context.lineTo(s * r, -c * r);
      context.lineTo(c * x - s * y, s * x + c * y);
    }
    context.closePath();
  }
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/square.js
/* harmony default export */ var square = ({
  draw: function(context, size) {
    var w = Math.sqrt(size),
        x = -w / 2;
    context.rect(x, x, w, w);
  }
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/triangle.js
var sqrt3 = Math.sqrt(3);

/* harmony default export */ var triangle = ({
  draw: function(context, size) {
    var y = -Math.sqrt(size / (sqrt3 * 3));
    context.moveTo(0, y * 2);
    context.lineTo(-sqrt3 * y, -y);
    context.lineTo(sqrt3 * y, -y);
    context.closePath();
  }
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/wye.js
var wye_c = -0.5,
    wye_s = Math.sqrt(3) / 2,
    wye_k = 1 / Math.sqrt(12),
    wye_a = (wye_k / 2 + 1) * 3;

/* harmony default export */ var wye = ({
  draw: function(context, size) {
    var r = Math.sqrt(size / wye_a),
        x0 = r / 2,
        y0 = r * wye_k,
        x1 = x0,
        y1 = r * wye_k + r,
        x2 = -x1,
        y2 = y1;
    context.moveTo(x0, y0);
    context.lineTo(x1, y1);
    context.lineTo(x2, y2);
    context.lineTo(wye_c * x0 - wye_s * y0, wye_s * x0 + wye_c * y0);
    context.lineTo(wye_c * x1 - wye_s * y1, wye_s * x1 + wye_c * y1);
    context.lineTo(wye_c * x2 - wye_s * y2, wye_s * x2 + wye_c * y2);
    context.lineTo(wye_c * x0 + wye_s * y0, wye_c * y0 - wye_s * x0);
    context.lineTo(wye_c * x1 + wye_s * y1, wye_c * y1 - wye_s * x1);
    context.lineTo(wye_c * x2 + wye_s * y2, wye_c * y2 - wye_s * x2);
    context.closePath();
  }
});

// CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol.js










var symbols = [
  symbol_circle,
  symbol_cross,
  diamond,
  square,
  star,
  triangle,
  wye
];

/* harmony default export */ var src_symbol = (function(type, size) {
  var context = null;
  type = typeof type === "function" ? type : src_constant(type || symbol_circle);
  size = typeof size === "function" ? size : src_constant(size === undefined ? 64 : +size);

  function symbol() {
    var buffer;
    if (!context) context = buffer = src_path();
    type.apply(this, arguments).draw(context, +size.apply(this, arguments));
    if (buffer) return context = null, buffer + "" || null;
  }

  symbol.type = function(_) {
    return arguments.length ? (type = typeof _ === "function" ? _ : src_constant(_), symbol) : type;
  };

  symbol.size = function(_) {
    return arguments.length ? (size = typeof _ === "function" ? _ : src_constant(+_), symbol) : size;
  };

  symbol.context = function(_) {
    return arguments.length ? (context = _ == null ? null : _, symbol) : context;
  };

  return symbol;
});

// CONCATENATED MODULE: ./node_modules/vega-canvas/src/domCanvas.js
function domCanvas(w, h) {
  if (typeof document !== 'undefined' && document.createElement) {
    const c = document.createElement('canvas');
    if (c && c.getContext) {
      c.width = w;
      c.height = h;
      return c;
    }
  }
  return null;
}

const domImage = () =>
  typeof Image !== 'undefined' ? Image : null;

// CONCATENATED MODULE: ./node_modules/vega-canvas/index.browser.js


// CONCATENATED MODULE: ./node_modules/d3-array/src/bisect.js




const ascendingBisect = Object(bisector["a" /* default */])(ascending["a" /* default */]);
const bisectRight = ascendingBisect.right;
const bisectLeft = ascendingBisect.left;
const bisectCenter = Object(bisector["a" /* default */])(number).center;
/* harmony default export */ var src_bisect = (bisectRight);

// CONCATENATED MODULE: ./node_modules/d3-scale/src/init.js
function initRange(domain, range) {
  switch (arguments.length) {
    case 0: break;
    case 1: this.range(domain); break;
    default: this.range(range).domain(domain); break;
  }
  return this;
}

function initInterpolator(domain, interpolator) {
  switch (arguments.length) {
    case 0: break;
    case 1: {
      if (typeof domain === "function") this.interpolator(domain);
      else this.range(domain);
      break;
    }
    default: {
      this.domain(domain);
      if (typeof interpolator === "function") this.interpolator(interpolator);
      else this.range(interpolator);
      break;
    }
  }
  return this;
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/ordinal.js


const ordinal_implicit = Symbol("implicit");

function ordinal() {
  var index = new Map(),
      domain = [],
      range = [],
      unknown = ordinal_implicit;

  function scale(d) {
    var key = d + "", i = index.get(key);
    if (!i) {
      if (unknown !== ordinal_implicit) return unknown;
      index.set(key, i = domain.push(d));
    }
    return range[(i - 1) % range.length];
  }

  scale.domain = function(_) {
    if (!arguments.length) return domain.slice();
    domain = [], index = new Map();
    for (const value of _) {
      const key = value + "";
      if (index.has(key)) continue;
      index.set(key, domain.push(value));
    }
    return scale;
  };

  scale.range = function(_) {
    return arguments.length ? (range = Array.from(_), scale) : range.slice();
  };

  scale.unknown = function(_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  scale.copy = function() {
    return ordinal(domain, range).unknown(unknown);
  };

  initRange.apply(scale, arguments);

  return scale;
}

// EXTERNAL MODULE: ./node_modules/d3-array/src/ticks.js
var src_ticks = __webpack_require__("eecb");

// EXTERNAL MODULE: ./node_modules/d3-format/src/formatSpecifier.js
var formatSpecifier = __webpack_require__("09b8");

// EXTERNAL MODULE: ./node_modules/d3-format/src/precisionPrefix.js
var precisionPrefix = __webpack_require__("d933");

// EXTERNAL MODULE: ./node_modules/d3-format/src/defaultLocale.js
var defaultLocale = __webpack_require__("1231");

// EXTERNAL MODULE: ./node_modules/d3-format/src/precisionRound.js
var precisionRound = __webpack_require__("d989");

// EXTERNAL MODULE: ./node_modules/d3-format/src/precisionFixed.js
var precisionFixed = __webpack_require__("dad1");

// CONCATENATED MODULE: ./node_modules/d3-scale/src/tickFormat.js



function tickFormat_tickFormat(start, stop, count, specifier) {
  var step = Object(src_ticks["c" /* tickStep */])(start, stop, count),
      precision;
  specifier = Object(formatSpecifier["a" /* default */])(specifier == null ? ",f" : specifier);
  switch (specifier.type) {
    case "s": {
      var value = Math.max(Math.abs(start), Math.abs(stop));
      if (specifier.precision == null && !isNaN(precision = Object(precisionPrefix["a" /* default */])(step, value))) specifier.precision = precision;
      return Object(defaultLocale["b" /* formatPrefix */])(specifier, value);
    }
    case "":
    case "e":
    case "g":
    case "p":
    case "r": {
      if (specifier.precision == null && !isNaN(precision = Object(precisionRound["a" /* default */])(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
      break;
    }
    case "f":
    case "%": {
      if (specifier.precision == null && !isNaN(precision = Object(precisionFixed["a" /* default */])(step))) specifier.precision = precision - (specifier.type === "%") * 2;
      break;
    }
  }
  return Object(defaultLocale["a" /* format */])(specifier);
}

// CONCATENATED MODULE: ./node_modules/d3-color/src/define.js
/* harmony default export */ var define = (function(constructor, factory, prototype) {
  constructor.prototype = factory.prototype = prototype;
  prototype.constructor = constructor;
});

function extend(parent, definition) {
  var prototype = Object.create(parent.prototype);
  for (var key in definition) prototype[key] = definition[key];
  return prototype;
}

// CONCATENATED MODULE: ./node_modules/d3-color/src/color.js


function Color() {}

var color_darker = 0.7;
var color_brighter = 1 / color_darker;

var reI = "\\s*([+-]?\\d+)\\s*",
    reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
    reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
    reHex = /^#([0-9a-f]{3,8})$/,
    reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
    reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
    reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
    reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
    reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
    reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");

var named = {
  aliceblue: 0xf0f8ff,
  antiquewhite: 0xfaebd7,
  aqua: 0x00ffff,
  aquamarine: 0x7fffd4,
  azure: 0xf0ffff,
  beige: 0xf5f5dc,
  bisque: 0xffe4c4,
  black: 0x000000,
  blanchedalmond: 0xffebcd,
  blue: 0x0000ff,
  blueviolet: 0x8a2be2,
  brown: 0xa52a2a,
  burlywood: 0xdeb887,
  cadetblue: 0x5f9ea0,
  chartreuse: 0x7fff00,
  chocolate: 0xd2691e,
  coral: 0xff7f50,
  cornflowerblue: 0x6495ed,
  cornsilk: 0xfff8dc,
  crimson: 0xdc143c,
  cyan: 0x00ffff,
  darkblue: 0x00008b,
  darkcyan: 0x008b8b,
  darkgoldenrod: 0xb8860b,
  darkgray: 0xa9a9a9,
  darkgreen: 0x006400,
  darkgrey: 0xa9a9a9,
  darkkhaki: 0xbdb76b,
  darkmagenta: 0x8b008b,
  darkolivegreen: 0x556b2f,
  darkorange: 0xff8c00,
  darkorchid: 0x9932cc,
  darkred: 0x8b0000,
  darksalmon: 0xe9967a,
  darkseagreen: 0x8fbc8f,
  darkslateblue: 0x483d8b,
  darkslategray: 0x2f4f4f,
  darkslategrey: 0x2f4f4f,
  darkturquoise: 0x00ced1,
  darkviolet: 0x9400d3,
  deeppink: 0xff1493,
  deepskyblue: 0x00bfff,
  dimgray: 0x696969,
  dimgrey: 0x696969,
  dodgerblue: 0x1e90ff,
  firebrick: 0xb22222,
  floralwhite: 0xfffaf0,
  forestgreen: 0x228b22,
  fuchsia: 0xff00ff,
  gainsboro: 0xdcdcdc,
  ghostwhite: 0xf8f8ff,
  gold: 0xffd700,
  goldenrod: 0xdaa520,
  gray: 0x808080,
  green: 0x008000,
  greenyellow: 0xadff2f,
  grey: 0x808080,
  honeydew: 0xf0fff0,
  hotpink: 0xff69b4,
  indianred: 0xcd5c5c,
  indigo: 0x4b0082,
  ivory: 0xfffff0,
  khaki: 0xf0e68c,
  lavender: 0xe6e6fa,
  lavenderblush: 0xfff0f5,
  lawngreen: 0x7cfc00,
  lemonchiffon: 0xfffacd,
  lightblue: 0xadd8e6,
  lightcoral: 0xf08080,
  lightcyan: 0xe0ffff,
  lightgoldenrodyellow: 0xfafad2,
  lightgray: 0xd3d3d3,
  lightgreen: 0x90ee90,
  lightgrey: 0xd3d3d3,
  lightpink: 0xffb6c1,
  lightsalmon: 0xffa07a,
  lightseagreen: 0x20b2aa,
  lightskyblue: 0x87cefa,
  lightslategray: 0x778899,
  lightslategrey: 0x778899,
  lightsteelblue: 0xb0c4de,
  lightyellow: 0xffffe0,
  lime: 0x00ff00,
  limegreen: 0x32cd32,
  linen: 0xfaf0e6,
  magenta: 0xff00ff,
  maroon: 0x800000,
  mediumaquamarine: 0x66cdaa,
  mediumblue: 0x0000cd,
  mediumorchid: 0xba55d3,
  mediumpurple: 0x9370db,
  mediumseagreen: 0x3cb371,
  mediumslateblue: 0x7b68ee,
  mediumspringgreen: 0x00fa9a,
  mediumturquoise: 0x48d1cc,
  mediumvioletred: 0xc71585,
  midnightblue: 0x191970,
  mintcream: 0xf5fffa,
  mistyrose: 0xffe4e1,
  moccasin: 0xffe4b5,
  navajowhite: 0xffdead,
  navy: 0x000080,
  oldlace: 0xfdf5e6,
  olive: 0x808000,
  olivedrab: 0x6b8e23,
  orange: 0xffa500,
  orangered: 0xff4500,
  orchid: 0xda70d6,
  palegoldenrod: 0xeee8aa,
  palegreen: 0x98fb98,
  paleturquoise: 0xafeeee,
  palevioletred: 0xdb7093,
  papayawhip: 0xffefd5,
  peachpuff: 0xffdab9,
  peru: 0xcd853f,
  pink: 0xffc0cb,
  plum: 0xdda0dd,
  powderblue: 0xb0e0e6,
  purple: 0x800080,
  rebeccapurple: 0x663399,
  red: 0xff0000,
  rosybrown: 0xbc8f8f,
  royalblue: 0x4169e1,
  saddlebrown: 0x8b4513,
  salmon: 0xfa8072,
  sandybrown: 0xf4a460,
  seagreen: 0x2e8b57,
  seashell: 0xfff5ee,
  sienna: 0xa0522d,
  silver: 0xc0c0c0,
  skyblue: 0x87ceeb,
  slateblue: 0x6a5acd,
  slategray: 0x708090,
  slategrey: 0x708090,
  snow: 0xfffafa,
  springgreen: 0x00ff7f,
  steelblue: 0x4682b4,
  tan: 0xd2b48c,
  teal: 0x008080,
  thistle: 0xd8bfd8,
  tomato: 0xff6347,
  turquoise: 0x40e0d0,
  violet: 0xee82ee,
  wheat: 0xf5deb3,
  white: 0xffffff,
  whitesmoke: 0xf5f5f5,
  yellow: 0xffff00,
  yellowgreen: 0x9acd32
};

define(Color, color_color, {
  copy: function(channels) {
    return Object.assign(new this.constructor, this, channels);
  },
  displayable: function() {
    return this.rgb().displayable();
  },
  hex: color_formatHex, // Deprecated! Use color.formatHex.
  formatHex: color_formatHex,
  formatHsl: color_formatHsl,
  formatRgb: color_formatRgb,
  toString: color_formatRgb
});

function color_formatHex() {
  return this.rgb().formatHex();
}

function color_formatHsl() {
  return hslConvert(this).formatHsl();
}

function color_formatRgb() {
  return this.rgb().formatRgb();
}

function color_color(format) {
  var m, l;
  format = (format + "").trim().toLowerCase();
  return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
      : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
      : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
      : 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
      : null) // invalid hex
      : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
      : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
      : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
      : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
      : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
      : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
      : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
      : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
      : null;
}

function rgbn(n) {
  return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
}

function rgba(r, g, b, a) {
  if (a <= 0) r = g = b = NaN;
  return new Rgb(r, g, b, a);
}

function rgbConvert(o) {
  if (!(o instanceof Color)) o = color_color(o);
  if (!o) return new Rgb;
  o = o.rgb();
  return new Rgb(o.r, o.g, o.b, o.opacity);
}

function color_rgb(r, g, b, opacity) {
  return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
}

function Rgb(r, g, b, opacity) {
  this.r = +r;
  this.g = +g;
  this.b = +b;
  this.opacity = +opacity;
}

define(Rgb, color_rgb, extend(Color, {
  brighter: function(k) {
    k = k == null ? color_brighter : Math.pow(color_brighter, k);
    return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  },
  darker: function(k) {
    k = k == null ? color_darker : Math.pow(color_darker, k);
    return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  },
  rgb: function() {
    return this;
  },
  displayable: function() {
    return (-0.5 <= this.r && this.r < 255.5)
        && (-0.5 <= this.g && this.g < 255.5)
        && (-0.5 <= this.b && this.b < 255.5)
        && (0 <= this.opacity && this.opacity <= 1);
  },
  hex: rgb_formatHex, // Deprecated! Use color.formatHex.
  formatHex: rgb_formatHex,
  formatRgb: rgb_formatRgb,
  toString: rgb_formatRgb
}));

function rgb_formatHex() {
  return "#" + hex(this.r) + hex(this.g) + hex(this.b);
}

function rgb_formatRgb() {
  var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
  return (a === 1 ? "rgb(" : "rgba(")
      + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
      + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
      + Math.max(0, Math.min(255, Math.round(this.b) || 0))
      + (a === 1 ? ")" : ", " + a + ")");
}

function hex(value) {
  value = Math.max(0, Math.min(255, Math.round(value) || 0));
  return (value < 16 ? "0" : "") + value.toString(16);
}

function hsla(h, s, l, a) {
  if (a <= 0) h = s = l = NaN;
  else if (l <= 0 || l >= 1) h = s = NaN;
  else if (s <= 0) h = NaN;
  return new Hsl(h, s, l, a);
}

function hslConvert(o) {
  if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
  if (!(o instanceof Color)) o = color_color(o);
  if (!o) return new Hsl;
  if (o instanceof Hsl) return o;
  o = o.rgb();
  var r = o.r / 255,
      g = o.g / 255,
      b = o.b / 255,
      min = Math.min(r, g, b),
      max = Math.max(r, g, b),
      h = NaN,
      s = max - min,
      l = (max + min) / 2;
  if (s) {
    if (r === max) h = (g - b) / s + (g < b) * 6;
    else if (g === max) h = (b - r) / s + 2;
    else h = (r - g) / s + 4;
    s /= l < 0.5 ? max + min : 2 - max - min;
    h *= 60;
  } else {
    s = l > 0 && l < 1 ? 0 : h;
  }
  return new Hsl(h, s, l, o.opacity);
}

function hsl(h, s, l, opacity) {
  return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
}

function Hsl(h, s, l, opacity) {
  this.h = +h;
  this.s = +s;
  this.l = +l;
  this.opacity = +opacity;
}

define(Hsl, hsl, extend(Color, {
  brighter: function(k) {
    k = k == null ? color_brighter : Math.pow(color_brighter, k);
    return new Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  darker: function(k) {
    k = k == null ? color_darker : Math.pow(color_darker, k);
    return new Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  rgb: function() {
    var h = this.h % 360 + (this.h < 0) * 360,
        s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
        l = this.l,
        m2 = l + (l < 0.5 ? l : 1 - l) * s,
        m1 = 2 * l - m2;
    return new Rgb(
      hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
      hsl2rgb(h, m1, m2),
      hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
      this.opacity
    );
  },
  displayable: function() {
    return (0 <= this.s && this.s <= 1 || isNaN(this.s))
        && (0 <= this.l && this.l <= 1)
        && (0 <= this.opacity && this.opacity <= 1);
  },
  formatHsl: function() {
    var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
    return (a === 1 ? "hsl(" : "hsla(")
        + (this.h || 0) + ", "
        + (this.s || 0) * 100 + "%, "
        + (this.l || 0) * 100 + "%"
        + (a === 1 ? ")" : ", " + a + ")");
  }
}));

/* From FvD 13.37, CSS Color Module Level 3 */
function hsl2rgb(h, m1, m2) {
  return (h < 60 ? m1 + (m2 - m1) * h / 60
      : h < 180 ? m2
      : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
      : m1) * 255;
}

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/basis.js
function basis_basis(t1, v0, v1, v2, v3) {
  var t2 = t1 * t1, t3 = t2 * t1;
  return ((1 - 3 * t1 + 3 * t2 - t3) * v0
      + (4 - 6 * t2 + 3 * t3) * v1
      + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
      + t3 * v3) / 6;
}

/* harmony default export */ var src_basis = (function(values) {
  var n = values.length - 1;
  return function(t) {
    var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
        v1 = values[i],
        v2 = values[i + 1],
        v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
        v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
    return basis_basis((t - i / n) * n, v0, v1, v2, v3);
  };
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/basisClosed.js


/* harmony default export */ var src_basisClosed = (function(values) {
  var n = values.length;
  return function(t) {
    var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
        v0 = values[(i + n - 1) % n],
        v1 = values[i % n],
        v2 = values[(i + 1) % n],
        v3 = values[(i + 2) % n];
    return basis_basis((t - i / n) * n, v0, v1, v2, v3);
  };
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/constant.js
/* harmony default export */ var d3_interpolate_src_constant = (x => () => x);

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/color.js


function color_linear(a, d) {
  return function(t) {
    return a + t * d;
  };
}

function exponential(a, b, y) {
  return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
    return Math.pow(a + t * b, y);
  };
}

function color_hue(a, b) {
  var d = b - a;
  return d ? color_linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : d3_interpolate_src_constant(isNaN(a) ? b : a);
}

function color_gamma(y) {
  return (y = +y) === 1 ? nogamma : function(a, b) {
    return b - a ? exponential(a, b, y) : d3_interpolate_src_constant(isNaN(a) ? b : a);
  };
}

function nogamma(a, b) {
  var d = b - a;
  return d ? color_linear(a, d) : d3_interpolate_src_constant(isNaN(a) ? b : a);
}

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/rgb.js





/* harmony default export */ var src_rgb = ((function rgbGamma(y) {
  var color = color_gamma(y);

  function rgb(start, end) {
    var r = color((start = color_rgb(start)).r, (end = color_rgb(end)).r),
        g = color(start.g, end.g),
        b = color(start.b, end.b),
        opacity = nogamma(start.opacity, end.opacity);
    return function(t) {
      start.r = r(t);
      start.g = g(t);
      start.b = b(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }

  rgb.gamma = rgbGamma;

  return rgb;
})(1));

function rgbSpline(spline) {
  return function(colors) {
    var n = colors.length,
        r = new Array(n),
        g = new Array(n),
        b = new Array(n),
        i, color;
    for (i = 0; i < n; ++i) {
      color = color_rgb(colors[i]);
      r[i] = color.r || 0;
      g[i] = color.g || 0;
      b[i] = color.b || 0;
    }
    r = spline(r);
    g = spline(g);
    b = spline(b);
    color.opacity = 1;
    return function(t) {
      color.r = r(t);
      color.g = g(t);
      color.b = b(t);
      return color + "";
    };
  };
}

var rgbBasis = rgbSpline(src_basis);
var rgbBasisClosed = rgbSpline(src_basisClosed);

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/numberArray.js
/* harmony default export */ var numberArray = (function(a, b) {
  if (!b) b = [];
  var n = a ? Math.min(b.length, a.length) : 0,
      c = b.slice(),
      i;
  return function(t) {
    for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
    return c;
  };
});

function isNumberArray(x) {
  return ArrayBuffer.isView(x) && !(x instanceof DataView);
}

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/array.js



/* harmony default export */ var d3_interpolate_src_array = (function(a, b) {
  return (isNumberArray(b) ? numberArray : genericArray)(a, b);
});

function genericArray(a, b) {
  var nb = b ? b.length : 0,
      na = a ? Math.min(nb, a.length) : 0,
      x = new Array(na),
      c = new Array(nb),
      i;

  for (i = 0; i < na; ++i) x[i] = src_value(a[i], b[i]);
  for (; i < nb; ++i) c[i] = b[i];

  return function(t) {
    for (i = 0; i < na; ++i) c[i] = x[i](t);
    return c;
  };
}

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/date.js
/* harmony default export */ var src_date = (function(a, b) {
  var d = new Date;
  return a = +a, b = +b, function(t) {
    return d.setTime(a * (1 - t) + b * t), d;
  };
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/number.js
/* harmony default export */ var src_number = (function(a, b) {
  return a = +a, b = +b, function(t) {
    return a * (1 - t) + b * t;
  };
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/object.js


/* harmony default export */ var src_object = (function(a, b) {
  var i = {},
      c = {},
      k;

  if (a === null || typeof a !== "object") a = {};
  if (b === null || typeof b !== "object") b = {};

  for (k in b) {
    if (k in a) {
      i[k] = src_value(a[k], b[k]);
    } else {
      c[k] = b[k];
    }
  }

  return function(t) {
    for (k in i) c[k] = i[k](t);
    return c;
  };
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/string.js


var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
    reB = new RegExp(reA.source, "g");

function string_zero(b) {
  return function() {
    return b;
  };
}

function one(b) {
  return function(t) {
    return b(t) + "";
  };
}

/* harmony default export */ var src_string = (function(a, b) {
  var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
      am, // current match in a
      bm, // current match in b
      bs, // string preceding current number in b, if any
      i = -1, // index in s
      s = [], // string constants and placeholders
      q = []; // number interpolators

  // Coerce inputs to strings.
  a = a + "", b = b + "";

  // Interpolate pairs of numbers in a & b.
  while ((am = reA.exec(a))
      && (bm = reB.exec(b))) {
    if ((bs = bm.index) > bi) { // a string precedes the next number in b
      bs = b.slice(bi, bs);
      if (s[i]) s[i] += bs; // coalesce with previous string
      else s[++i] = bs;
    }
    if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
      if (s[i]) s[i] += bm; // coalesce with previous string
      else s[++i] = bm;
    } else { // interpolate non-matching numbers
      s[++i] = null;
      q.push({i: i, x: src_number(am, bm)});
    }
    bi = reB.lastIndex;
  }

  // Add remains of b.
  if (bi < b.length) {
    bs = b.slice(bi);
    if (s[i]) s[i] += bs; // coalesce with previous string
    else s[++i] = bs;
  }

  // Special optimization for only a single match.
  // Otherwise, interpolate each of the numbers and rejoin the string.
  return s.length < 2 ? (q[0]
      ? one(q[0].x)
      : string_zero(b))
      : (b = q.length, function(t) {
          for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
          return s.join("");
        });
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/value.js










/* harmony default export */ var src_value = (function(a, b) {
  var t = typeof b, c;
  return b == null || t === "boolean" ? d3_interpolate_src_constant(b)
      : (t === "number" ? src_number
      : t === "string" ? ((c = color_color(b)) ? (b = c, src_rgb) : src_string)
      : b instanceof color_color ? src_rgb
      : b instanceof Date ? src_date
      : isNumberArray(b) ? numberArray
      : Array.isArray(b) ? genericArray
      : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? src_object
      : src_number)(a, b);
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/round.js
/* harmony default export */ var src_round = (function(a, b) {
  return a = +a, b = +b, function(t) {
    return Math.round(a * (1 - t) + b * t);
  };
});

// CONCATENATED MODULE: ./node_modules/d3-scale/src/constant.js
function constant_constants(x) {
  return function() {
    return x;
  };
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/number.js
function number_number(x) {
  return +x;
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/continuous.js





var continuous_unit = [0, 1];

function identity(x) {
  return x;
}

function continuous_normalize(a, b) {
  return (b -= (a = +a))
      ? function(x) { return (x - a) / b; }
      : constant_constants(isNaN(b) ? NaN : 0.5);
}

function clamper(a, b) {
  var t;
  if (a > b) t = a, a = b, b = t;
  return function(x) { return Math.max(a, Math.min(b, x)); };
}

// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
function bimap(domain, range, interpolate) {
  var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
  if (d1 < d0) d0 = continuous_normalize(d1, d0), r0 = interpolate(r1, r0);
  else d0 = continuous_normalize(d0, d1), r0 = interpolate(r0, r1);
  return function(x) { return r0(d0(x)); };
}

function polymap(domain, range, interpolate) {
  var j = Math.min(domain.length, range.length) - 1,
      d = new Array(j),
      r = new Array(j),
      i = -1;

  // Reverse descending domains.
  if (domain[j] < domain[0]) {
    domain = domain.slice().reverse();
    range = range.slice().reverse();
  }

  while (++i < j) {
    d[i] = continuous_normalize(domain[i], domain[i + 1]);
    r[i] = interpolate(range[i], range[i + 1]);
  }

  return function(x) {
    var i = src_bisect(domain, x, 1, j) - 1;
    return r[i](d[i](x));
  };
}

function continuous_copy(source, target) {
  return target
      .domain(source.domain())
      .range(source.range())
      .interpolate(source.interpolate())
      .clamp(source.clamp())
      .unknown(source.unknown());
}

function transformer() {
  var domain = continuous_unit,
      range = continuous_unit,
      interpolate = src_value,
      transform,
      untransform,
      unknown,
      clamp = identity,
      piecewise,
      output,
      input;

  function rescale() {
    var n = Math.min(domain.length, range.length);
    if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);
    piecewise = n > 2 ? polymap : bimap;
    output = input = null;
    return scale;
  }

  function scale(x) {
    return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));
  }

  scale.invert = function(y) {
    return clamp(untransform((input || (input = piecewise(range, domain.map(transform), src_number)))(y)));
  };

  scale.domain = function(_) {
    return arguments.length ? (domain = Array.from(_, number_number), rescale()) : domain.slice();
  };

  scale.range = function(_) {
    return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
  };

  scale.rangeRound = function(_) {
    return range = Array.from(_), interpolate = src_round, rescale();
  };

  scale.clamp = function(_) {
    return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;
  };

  scale.interpolate = function(_) {
    return arguments.length ? (interpolate = _, rescale()) : interpolate;
  };

  scale.unknown = function(_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  return function(t, u) {
    transform = t, untransform = u;
    return rescale();
  };
}

function continuous() {
  return transformer()(identity, identity);
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/linear.js





function linearish(scale) {
  var domain = scale.domain;

  scale.ticks = function(count) {
    var d = domain();
    return Object(src_ticks["a" /* default */])(d[0], d[d.length - 1], count == null ? 10 : count);
  };

  scale.tickFormat = function(count, specifier) {
    var d = domain();
    return tickFormat_tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
  };

  scale.nice = function(count) {
    if (count == null) count = 10;

    var d = domain();
    var i0 = 0;
    var i1 = d.length - 1;
    var start = d[i0];
    var stop = d[i1];
    var prestep;
    var step;
    var maxIter = 10;

    if (stop < start) {
      step = start, start = stop, stop = step;
      step = i0, i0 = i1, i1 = step;
    }
    
    while (maxIter-- > 0) {
      step = Object(src_ticks["b" /* tickIncrement */])(start, stop, count);
      if (step === prestep) {
        d[i0] = start
        d[i1] = stop
        return domain(d);
      } else if (step > 0) {
        start = Math.floor(start / step) * step;
        stop = Math.ceil(stop / step) * step;
      } else if (step < 0) {
        start = Math.ceil(start * step) / step;
        stop = Math.floor(stop * step) / step;
      } else {
        break;
      }
      prestep = step;
    }

    return scale;
  };

  return scale;
}

function linear_linear() {
  var scale = continuous();

  scale.copy = function() {
    return continuous_copy(scale, linear_linear());
  };

  initRange.apply(scale, arguments);

  return linearish(scale);
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/identity.js



function identity_identity(domain) {
  var unknown;

  function scale(x) {
    return x == null || isNaN(x = +x) ? unknown : x;
  }

  scale.invert = scale;

  scale.domain = scale.range = function(_) {
    return arguments.length ? (domain = Array.from(_, number_number), scale) : domain.slice();
  };

  scale.unknown = function(_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  scale.copy = function() {
    return identity_identity(domain).unknown(unknown);
  };

  domain = arguments.length ? Array.from(domain, number_number) : [0, 1];

  return linearish(scale);
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/nice.js
function nice_nice(domain, interval) {
  domain = domain.slice();

  var i0 = 0,
      i1 = domain.length - 1,
      x0 = domain[i0],
      x1 = domain[i1],
      t;

  if (x1 < x0) {
    t = i0, i0 = i1, i1 = t;
    t = x0, x0 = x1, x1 = t;
  }

  domain[i0] = interval.floor(x0);
  domain[i1] = interval.ceil(x1);
  return domain;
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/log.js






function transformLog(x) {
  return Math.log(x);
}

function transformExp(x) {
  return Math.exp(x);
}

function transformLogn(x) {
  return -Math.log(-x);
}

function transformExpn(x) {
  return -Math.exp(-x);
}

function pow10(x) {
  return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
}

function powp(base) {
  return base === 10 ? pow10
      : base === Math.E ? Math.exp
      : function(x) { return Math.pow(base, x); };
}

function logp(base) {
  return base === Math.E ? Math.log
      : base === 10 && Math.log10
      || base === 2 && Math.log2
      || (base = Math.log(base), function(x) { return Math.log(x) / base; });
}

function reflect(f) {
  return function(x) {
    return -f(-x);
  };
}

function loggish(transform) {
  var scale = transform(transformLog, transformExp),
      domain = scale.domain,
      base = 10,
      logs,
      pows;

  function rescale() {
    logs = logp(base), pows = powp(base);
    if (domain()[0] < 0) {
      logs = reflect(logs), pows = reflect(pows);
      transform(transformLogn, transformExpn);
    } else {
      transform(transformLog, transformExp);
    }
    return scale;
  }

  scale.base = function(_) {
    return arguments.length ? (base = +_, rescale()) : base;
  };

  scale.domain = function(_) {
    return arguments.length ? (domain(_), rescale()) : domain();
  };

  scale.ticks = function(count) {
    var d = domain(),
        u = d[0],
        v = d[d.length - 1],
        r;

    if (r = v < u) i = u, u = v, v = i;

    var i = logs(u),
        j = logs(v),
        p,
        k,
        t,
        n = count == null ? 10 : +count,
        z = [];

    if (!(base % 1) && j - i < n) {
      i = Math.floor(i), j = Math.ceil(j);
      if (u > 0) for (; i <= j; ++i) {
        for (k = 1, p = pows(i); k < base; ++k) {
          t = p * k;
          if (t < u) continue;
          if (t > v) break;
          z.push(t);
        }
      } else for (; i <= j; ++i) {
        for (k = base - 1, p = pows(i); k >= 1; --k) {
          t = p * k;
          if (t < u) continue;
          if (t > v) break;
          z.push(t);
        }
      }
      if (z.length * 2 < n) z = Object(src_ticks["a" /* default */])(u, v, n);
    } else {
      z = Object(src_ticks["a" /* default */])(i, j, Math.min(j - i, n)).map(pows);
    }

    return r ? z.reverse() : z;
  };

  scale.tickFormat = function(count, specifier) {
    if (specifier == null) specifier = base === 10 ? ".0e" : ",";
    if (typeof specifier !== "function") specifier = Object(defaultLocale["a" /* format */])(specifier);
    if (count === Infinity) return specifier;
    if (count == null) count = 10;
    var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
    return function(d) {
      var i = d / pows(Math.round(logs(d)));
      if (i * base < base - 0.5) i *= base;
      return i <= k ? specifier(d) : "";
    };
  };

  scale.nice = function() {
    return domain(nice_nice(domain(), {
      floor: function(x) { return pows(Math.floor(logs(x))); },
      ceil: function(x) { return pows(Math.ceil(logs(x))); }
    }));
  };

  return scale;
}

function log_log() {
  var scale = loggish(transformer()).domain([1, 10]);

  scale.copy = function() {
    return continuous_copy(scale, log_log()).base(scale.base());
  };

  initRange.apply(scale, arguments);

  return scale;
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/pow.js




function transformPow(exponent) {
  return function(x) {
    return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
  };
}

function transformSqrt(x) {
  return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
}

function transformSquare(x) {
  return x < 0 ? -x * x : x * x;
}

function powish(transform) {
  var scale = transform(identity, identity),
      exponent = 1;

  function rescale() {
    return exponent === 1 ? transform(identity, identity)
        : exponent === 0.5 ? transform(transformSqrt, transformSquare)
        : transform(transformPow(exponent), transformPow(1 / exponent));
  }

  scale.exponent = function(_) {
    return arguments.length ? (exponent = +_, rescale()) : exponent;
  };

  return linearish(scale);
}

function pow_pow() {
  var scale = powish(transformer());

  scale.copy = function() {
    return continuous_copy(scale, pow_pow()).exponent(scale.exponent());
  };

  initRange.apply(scale, arguments);

  return scale;
}

function pow_sqrt() {
  return pow_pow.apply(null, arguments).exponent(0.5);
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/symlog.js




function transformSymlog(c) {
  return function(x) {
    return Math.sign(x) * Math.log1p(Math.abs(x / c));
  };
}

function transformSymexp(c) {
  return function(x) {
    return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
  };
}

function symlogish(transform) {
  var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));

  scale.constant = function(_) {
    return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;
  };

  return linearish(scale);
}

function symlog() {
  var scale = symlogish(transformer());

  scale.copy = function() {
    return continuous_copy(scale, symlog()).constant(scale.constant());
  };

  return initRange.apply(scale, arguments);
}

// EXTERNAL MODULE: ./node_modules/d3-time/src/duration.js
var duration = __webpack_require__("1738");

// EXTERNAL MODULE: ./node_modules/d3-time/src/millisecond.js
var millisecond = __webpack_require__("1809");

// EXTERNAL MODULE: ./node_modules/d3-time/src/second.js
var src_second = __webpack_require__("5edf");

// EXTERNAL MODULE: ./node_modules/d3-time/src/minute.js
var src_minute = __webpack_require__("2c38");

// EXTERNAL MODULE: ./node_modules/d3-time/src/hour.js
var src_hour = __webpack_require__("b3c3");

// EXTERNAL MODULE: ./node_modules/d3-time/src/day.js
var src_day = __webpack_require__("742c");

// EXTERNAL MODULE: ./node_modules/d3-time/src/week.js
var src_week = __webpack_require__("b14c");

// EXTERNAL MODULE: ./node_modules/d3-time/src/month.js
var src_month = __webpack_require__("9603");

// EXTERNAL MODULE: ./node_modules/d3-time/src/year.js
var src_year = __webpack_require__("a15a");

// EXTERNAL MODULE: ./node_modules/d3-time/src/utcMinute.js
var utcMinute = __webpack_require__("f8ee");

// EXTERNAL MODULE: ./node_modules/d3-time/src/utcHour.js
var utcHour = __webpack_require__("f623");

// EXTERNAL MODULE: ./node_modules/d3-time/src/utcDay.js
var utcDay = __webpack_require__("6eb2");

// EXTERNAL MODULE: ./node_modules/d3-time/src/utcWeek.js
var utcWeek = __webpack_require__("2739");

// EXTERNAL MODULE: ./node_modules/d3-time/src/utcMonth.js
var utcMonth = __webpack_require__("55f8");

// EXTERNAL MODULE: ./node_modules/d3-time/src/utcYear.js
var utcYear = __webpack_require__("77ae");

// CONCATENATED MODULE: ./node_modules/d3-time/src/ticks.js

















function ticker(year, month, week, day, hour, minute) {

  const tickIntervals = [
    [src_second["a" /* default */],  1,      duration["e" /* durationSecond */]],
    [src_second["a" /* default */],  5,  5 * duration["e" /* durationSecond */]],
    [src_second["a" /* default */], 15, 15 * duration["e" /* durationSecond */]],
    [src_second["a" /* default */], 30, 30 * duration["e" /* durationSecond */]],
    [minute,  1,      duration["c" /* durationMinute */]],
    [minute,  5,  5 * duration["c" /* durationMinute */]],
    [minute, 15, 15 * duration["c" /* durationMinute */]],
    [minute, 30, 30 * duration["c" /* durationMinute */]],
    [  hour,  1,      duration["b" /* durationHour */]  ],
    [  hour,  3,  3 * duration["b" /* durationHour */]  ],
    [  hour,  6,  6 * duration["b" /* durationHour */]  ],
    [  hour, 12, 12 * duration["b" /* durationHour */]  ],
    [   day,  1,      duration["a" /* durationDay */]   ],
    [   day,  2,  2 * duration["a" /* durationDay */]   ],
    [  week,  1,      duration["f" /* durationWeek */]  ],
    [ month,  1,      duration["d" /* durationMonth */] ],
    [ month,  3,  3 * duration["d" /* durationMonth */] ],
    [  year,  1,      duration["g" /* durationYear */]  ]
  ];

  function ticks(start, stop, count) {
    const reverse = stop < start;
    if (reverse) [start, stop] = [stop, start];
    const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count);
    const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop
    return reverse ? ticks.reverse() : ticks;
  }

  function tickInterval(start, stop, count) {
    const target = Math.abs(stop - start) / count;
    const i = Object(bisector["a" /* default */])(([,, step]) => step).right(tickIntervals, target);
    if (i === tickIntervals.length) return year.every(Object(src_ticks["c" /* tickStep */])(start / duration["g" /* durationYear */], stop / duration["g" /* durationYear */], count));
    if (i === 0) return millisecond["a" /* default */].every(Math.max(Object(src_ticks["c" /* tickStep */])(start, stop, count), 1));
    const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
    return t.every(step);
  }

  return [ticks, tickInterval];
}

const [utcTicks, utcTickInterval] = ticker(utcYear["a" /* default */], utcMonth["a" /* default */], utcWeek["b" /* utcSunday */], utcDay["a" /* default */], utcHour["a" /* default */], utcMinute["a" /* default */]);
const [timeTicks, timeTickInterval] = ticker(src_year["a" /* default */], src_month["a" /* default */], src_week["b" /* sunday */], src_day["a" /* default */], src_hour["a" /* default */], src_minute["a" /* default */]);



// EXTERNAL MODULE: ./node_modules/d3-time-format/src/defaultLocale.js
var src_defaultLocale = __webpack_require__("4c23");

// CONCATENATED MODULE: ./node_modules/d3-scale/src/time.js






function time_date(t) {
  return new Date(t);
}

function time_number(t) {
  return t instanceof Date ? +t : +new Date(+t);
}

function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {
  var scale = continuous(),
      invert = scale.invert,
      domain = scale.domain;

  var formatMillisecond = format(".%L"),
      formatSecond = format(":%S"),
      formatMinute = format("%I:%M"),
      formatHour = format("%I %p"),
      formatDay = format("%a %d"),
      formatWeek = format("%b %d"),
      formatMonth = format("%B"),
      formatYear = format("%Y");

  function tickFormat(date) {
    return (second(date) < date ? formatMillisecond
        : minute(date) < date ? formatSecond
        : hour(date) < date ? formatMinute
        : day(date) < date ? formatHour
        : month(date) < date ? (week(date) < date ? formatDay : formatWeek)
        : year(date) < date ? formatMonth
        : formatYear)(date);
  }

  scale.invert = function(y) {
    return new Date(invert(y));
  };

  scale.domain = function(_) {
    return arguments.length ? domain(Array.from(_, time_number)) : domain().map(time_date);
  };

  scale.ticks = function(interval) {
    var d = domain();
    return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);
  };

  scale.tickFormat = function(count, specifier) {
    return specifier == null ? tickFormat : format(specifier);
  };

  scale.nice = function(interval) {
    var d = domain();
    if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);
    return interval ? domain(nice_nice(d, interval)) : scale;
  };

  scale.copy = function() {
    return continuous_copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));
  };

  return scale;
}

function time_time() {
  return initRange.apply(calendar(timeTicks, timeTickInterval, src_year["a" /* default */], src_month["a" /* default */], src_week["b" /* sunday */], src_day["a" /* default */], src_hour["a" /* default */], src_minute["a" /* default */], src_second["a" /* default */], src_defaultLocale["a" /* timeFormat */]).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/utcTime.js





function utcTime() {
  return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear["a" /* default */], utcMonth["a" /* default */], utcWeek["b" /* utcSunday */], utcDay["a" /* default */], utcHour["a" /* default */], utcMinute["a" /* default */], src_second["a" /* default */], src_defaultLocale["c" /* utcFormat */]).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/sequential.js








function sequential_transformer() {
  var x0 = 0,
      x1 = 1,
      t0,
      t1,
      k10,
      transform,
      interpolator = identity,
      clamp = false,
      unknown;

  function scale(x) {
    return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));
  }

  scale.domain = function(_) {
    return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];
  };

  scale.clamp = function(_) {
    return arguments.length ? (clamp = !!_, scale) : clamp;
  };

  scale.interpolator = function(_) {
    return arguments.length ? (interpolator = _, scale) : interpolator;
  };

  function range(interpolate) {
    return function(_) {
      var r0, r1;
      return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)];
    };
  }

  scale.range = range(src_value);

  scale.rangeRound = range(src_round);

  scale.unknown = function(_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  return function(t) {
    transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);
    return scale;
  };
}

function sequential_copy(source, target) {
  return target
      .domain(source.domain())
      .interpolator(source.interpolator())
      .clamp(source.clamp())
      .unknown(source.unknown());
}

function sequential() {
  var scale = linearish(sequential_transformer()(identity));

  scale.copy = function() {
    return sequential_copy(scale, sequential());
  };

  return initInterpolator.apply(scale, arguments);
}

function sequentialLog() {
  var scale = loggish(sequential_transformer()).domain([1, 10]);

  scale.copy = function() {
    return sequential_copy(scale, sequentialLog()).base(scale.base());
  };

  return initInterpolator.apply(scale, arguments);
}

function sequentialSymlog() {
  var scale = symlogish(sequential_transformer());

  scale.copy = function() {
    return sequential_copy(scale, sequentialSymlog()).constant(scale.constant());
  };

  return initInterpolator.apply(scale, arguments);
}

function sequentialPow() {
  var scale = powish(sequential_transformer());

  scale.copy = function() {
    return sequential_copy(scale, sequentialPow()).exponent(scale.exponent());
  };

  return initInterpolator.apply(scale, arguments);
}

function sequentialSqrt() {
  return sequentialPow.apply(null, arguments).exponent(0.5);
}

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/piecewise.js


function piecewise_piecewise(interpolate, values) {
  if (values === undefined) values = interpolate, interpolate = src_value;
  var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);
  while (i < n) I[i] = interpolate(v, v = values[++i]);
  return function(t) {
    var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
    return I[i](t - i);
  };
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/diverging.js









function diverging_transformer() {
  var x0 = 0,
      x1 = 0.5,
      x2 = 1,
      s = 1,
      t0,
      t1,
      t2,
      k10,
      k21,
      interpolator = identity,
      transform,
      clamp = false,
      unknown;

  function scale(x) {
    return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));
  }

  scale.domain = function(_) {
    return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [x0, x1, x2];
  };

  scale.clamp = function(_) {
    return arguments.length ? (clamp = !!_, scale) : clamp;
  };

  scale.interpolator = function(_) {
    return arguments.length ? (interpolator = _, scale) : interpolator;
  };

  function range(interpolate) {
    return function(_) {
      var r0, r1, r2;
      return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise_piecewise(interpolate, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)];
    };
  }

  scale.range = range(src_value);

  scale.rangeRound = range(src_round);

  scale.unknown = function(_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  return function(t) {
    transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1;
    return scale;
  };
}

function diverging() {
  var scale = linearish(diverging_transformer()(identity));

  scale.copy = function() {
    return sequential_copy(scale, diverging());
  };

  return initInterpolator.apply(scale, arguments);
}

function divergingLog() {
  var scale = loggish(diverging_transformer()).domain([0.1, 1, 10]);

  scale.copy = function() {
    return sequential_copy(scale, divergingLog()).base(scale.base());
  };

  return initInterpolator.apply(scale, arguments);
}

function divergingSymlog() {
  var scale = symlogish(diverging_transformer());

  scale.copy = function() {
    return sequential_copy(scale, divergingSymlog()).constant(scale.constant());
  };

  return initInterpolator.apply(scale, arguments);
}

function divergingPow() {
  var scale = powish(diverging_transformer());

  scale.copy = function() {
    return sequential_copy(scale, divergingPow()).exponent(scale.exponent());
  };

  return initInterpolator.apply(scale, arguments);
}

function divergingSqrt() {
  return divergingPow.apply(null, arguments).exponent(0.5);
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/quantile.js



function src_quantile_quantile() {
  var domain = [],
      range = [],
      thresholds = [],
      unknown;

  function rescale() {
    var i = 0, n = Math.max(1, range.length);
    thresholds = new Array(n - 1);
    while (++i < n) thresholds[i - 1] = quantileSorted(domain, i / n);
    return scale;
  }

  function scale(x) {
    return x == null || isNaN(x = +x) ? unknown : range[src_bisect(thresholds, x)];
  }

  scale.invertExtent = function(y) {
    var i = range.indexOf(y);
    return i < 0 ? [NaN, NaN] : [
      i > 0 ? thresholds[i - 1] : domain[0],
      i < thresholds.length ? thresholds[i] : domain[domain.length - 1]
    ];
  };

  scale.domain = function(_) {
    if (!arguments.length) return domain.slice();
    domain = [];
    for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);
    domain.sort(ascending["a" /* default */]);
    return rescale();
  };

  scale.range = function(_) {
    return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
  };

  scale.unknown = function(_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  scale.quantiles = function() {
    return thresholds.slice();
  };

  scale.copy = function() {
    return src_quantile_quantile()
        .domain(domain)
        .range(range)
        .unknown(unknown);
  };

  return initRange.apply(scale, arguments);
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/quantize.js




function quantize() {
  var x0 = 0,
      x1 = 1,
      n = 1,
      domain = [0.5],
      range = [0, 1],
      unknown;

  function scale(x) {
    return x != null && x <= x ? range[src_bisect(domain, x, 0, n)] : unknown;
  }

  function rescale() {
    var i = -1;
    domain = new Array(n);
    while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
    return scale;
  }

  scale.domain = function(_) {
    return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];
  };

  scale.range = function(_) {
    return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();
  };

  scale.invertExtent = function(y) {
    var i = range.indexOf(y);
    return i < 0 ? [NaN, NaN]
        : i < 1 ? [x0, domain[0]]
        : i >= n ? [domain[n - 1], x1]
        : [domain[i - 1], domain[i]];
  };

  scale.unknown = function(_) {
    return arguments.length ? (unknown = _, scale) : scale;
  };

  scale.thresholds = function() {
    return domain.slice();
  };

  scale.copy = function() {
    return quantize()
        .domain([x0, x1])
        .range(range)
        .unknown(unknown);
  };

  return initRange.apply(linearish(scale), arguments);
}

// CONCATENATED MODULE: ./node_modules/d3-scale/src/threshold.js



function threshold_threshold() {
  var domain = [0.5],
      range = [0, 1],
      unknown,
      n = 1;

  function scale(x) {
    return x != null && x <= x ? range[src_bisect(domain, x, 0, n)] : unknown;
  }

  scale.domain = function(_) {
    return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();
  };

  scale.range = function(_) {
    return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();
  };

  scale.invertExtent = function(y) {
    var i = range.indexOf(y);
    return [domain[i - 1], domain[i]];
  };

  scale.unknown = function(_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  scale.copy = function() {
    return threshold_threshold()
        .domain(domain)
        .range(range)
        .unknown(unknown);
  };

  return initRange.apply(scale, arguments);
}

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/discrete.js
/* harmony default export */ var discrete = (function(range) {
  var n = range.length;
  return function(t) {
    return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
  };
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/hue.js


/* harmony default export */ var src_hue = (function(a, b) {
  var i = color_hue(+a, +b);
  return function(t) {
    var x = i(t);
    return x - 360 * Math.floor(x / 360);
  };
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/transform/decompose.js
var degrees = 180 / Math.PI;

var decompose_identity = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};

/* harmony default export */ var decompose = (function(a, b, c, d, e, f) {
  var scaleX, scaleY, skewX;
  if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
  if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
  if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
  if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
  return {
    translateX: e,
    translateY: f,
    rotate: Math.atan2(b, a) * degrees,
    skewX: Math.atan(skewX) * degrees,
    scaleX: scaleX,
    scaleY: scaleY
  };
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/transform/parse.js


var svgNode;

/* eslint-disable no-undef */
function parseCss(value) {
  const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
  return m.isIdentity ? decompose_identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
}

function parseSvg(value) {
  if (value == null) return decompose_identity;
  if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
  svgNode.setAttribute("transform", value);
  if (!(value = svgNode.transform.baseVal.consolidate())) return decompose_identity;
  value = value.matrix;
  return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
}

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/transform/index.js



function interpolateTransform(parse, pxComma, pxParen, degParen) {

  function pop(s) {
    return s.length ? s.pop() + " " : "";
  }

  function translate(xa, ya, xb, yb, s, q) {
    if (xa !== xb || ya !== yb) {
      var i = s.push("translate(", null, pxComma, null, pxParen);
      q.push({i: i - 4, x: src_number(xa, xb)}, {i: i - 2, x: src_number(ya, yb)});
    } else if (xb || yb) {
      s.push("translate(" + xb + pxComma + yb + pxParen);
    }
  }

  function rotate(a, b, s, q) {
    if (a !== b) {
      if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
      q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: src_number(a, b)});
    } else if (b) {
      s.push(pop(s) + "rotate(" + b + degParen);
    }
  }

  function skewX(a, b, s, q) {
    if (a !== b) {
      q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: src_number(a, b)});
    } else if (b) {
      s.push(pop(s) + "skewX(" + b + degParen);
    }
  }

  function scale(xa, ya, xb, yb, s, q) {
    if (xa !== xb || ya !== yb) {
      var i = s.push(pop(s) + "scale(", null, ",", null, ")");
      q.push({i: i - 4, x: src_number(xa, xb)}, {i: i - 2, x: src_number(ya, yb)});
    } else if (xb !== 1 || yb !== 1) {
      s.push(pop(s) + "scale(" + xb + "," + yb + ")");
    }
  }

  return function(a, b) {
    var s = [], // string constants and placeholders
        q = []; // number interpolators
    a = parse(a), b = parse(b);
    translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
    rotate(a.rotate, b.rotate, s, q);
    skewX(a.skewX, b.skewX, s, q);
    scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
    a = b = null; // gc
    return function(t) {
      var i = -1, n = q.length, o;
      while (++i < n) s[(o = q[i]).i] = o.x(t);
      return s.join("");
    };
  };
}

var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/zoom.js
var epsilon2 = 1e-12;

function zoom_cosh(x) {
  return ((x = Math.exp(x)) + 1 / x) / 2;
}

function zoom_sinh(x) {
  return ((x = Math.exp(x)) - 1 / x) / 2;
}

function tanh(x) {
  return ((x = Math.exp(2 * x)) - 1) / (x + 1);
}

/* harmony default export */ var zoom = ((function zoomRho(rho, rho2, rho4) {

  // p0 = [ux0, uy0, w0]
  // p1 = [ux1, uy1, w1]
  function zoom(p0, p1) {
    var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
        ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
        dx = ux1 - ux0,
        dy = uy1 - uy0,
        d2 = dx * dx + dy * dy,
        i,
        S;

    // Special case for u0 ≅ u1.
    if (d2 < epsilon2) {
      S = Math.log(w1 / w0) / rho;
      i = function(t) {
        return [
          ux0 + t * dx,
          uy0 + t * dy,
          w0 * Math.exp(rho * t * S)
        ];
      }
    }

    // General case.
    else {
      var d1 = Math.sqrt(d2),
          b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
          b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
          r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
          r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
      S = (r1 - r0) / rho;
      i = function(t) {
        var s = t * S,
            coshr0 = zoom_cosh(r0),
            u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - zoom_sinh(r0));
        return [
          ux0 + u * dx,
          uy0 + u * dy,
          w0 * coshr0 / zoom_cosh(rho * s + r0)
        ];
      }
    }

    i.duration = S * 1000 * rho / Math.SQRT2;

    return i;
  }

  zoom.rho = function(_) {
    var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
    return zoomRho(_1, _2, _4);
  };

  return zoom;
})(Math.SQRT2, 2, 4));

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/hsl.js



function hsl_hsl(hue) {
  return function(start, end) {
    var h = hue((start = hsl(start)).h, (end = hsl(end)).h),
        s = nogamma(start.s, end.s),
        l = nogamma(start.l, end.l),
        opacity = nogamma(start.opacity, end.opacity);
    return function(t) {
      start.h = h(t);
      start.s = s(t);
      start.l = l(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }
}

/* harmony default export */ var src_hsl = (hsl_hsl(color_hue));
var hslLong = hsl_hsl(nogamma);

// CONCATENATED MODULE: ./node_modules/d3-color/src/math.js
const radians = Math.PI / 180;
const math_degrees = 180 / Math.PI;

// CONCATENATED MODULE: ./node_modules/d3-color/src/lab.js




// https://observablehq.com/@mbostock/lab-and-rgb
const K = 18,
    Xn = 0.96422,
    Yn = 1,
    Zn = 0.82521,
    lab_t0 = 4 / 29,
    lab_t1 = 6 / 29,
    lab_t2 = 3 * lab_t1 * lab_t1,
    t3 = lab_t1 * lab_t1 * lab_t1;

function labConvert(o) {
  if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
  if (o instanceof Hcl) return hcl2lab(o);
  if (!(o instanceof Rgb)) o = rgbConvert(o);
  var r = rgb2lrgb(o.r),
      g = rgb2lrgb(o.g),
      b = rgb2lrgb(o.b),
      y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
  if (r === g && g === b) x = z = y; else {
    x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
    z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
  }
  return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
}

function gray(l, opacity) {
  return new Lab(l, 0, 0, opacity == null ? 1 : opacity);
}

function lab(l, a, b, opacity) {
  return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
}

function Lab(l, a, b, opacity) {
  this.l = +l;
  this.a = +a;
  this.b = +b;
  this.opacity = +opacity;
}

define(Lab, lab, extend(Color, {
  brighter: function(k) {
    return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  },
  darker: function(k) {
    return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  },
  rgb: function() {
    var y = (this.l + 16) / 116,
        x = isNaN(this.a) ? y : y + this.a / 500,
        z = isNaN(this.b) ? y : y - this.b / 200;
    x = Xn * lab2xyz(x);
    y = Yn * lab2xyz(y);
    z = Zn * lab2xyz(z);
    return new Rgb(
      lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
      lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
      lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
      this.opacity
    );
  }
}));

function xyz2lab(t) {
  return t > t3 ? Math.pow(t, 1 / 3) : t / lab_t2 + lab_t0;
}

function lab2xyz(t) {
  return t > lab_t1 ? t * t * t : lab_t2 * (t - lab_t0);
}

function lrgb2rgb(x) {
  return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}

function rgb2lrgb(x) {
  return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
}

function hclConvert(o) {
  if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
  if (!(o instanceof Lab)) o = labConvert(o);
  if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
  var h = Math.atan2(o.b, o.a) * math_degrees;
  return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
}

function lch(l, c, h, opacity) {
  return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}

function hcl(h, c, l, opacity) {
  return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}

function Hcl(h, c, l, opacity) {
  this.h = +h;
  this.c = +c;
  this.l = +l;
  this.opacity = +opacity;
}

function hcl2lab(o) {
  if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
  var h = o.h * radians;
  return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}

define(Hcl, hcl, extend(Color, {
  brighter: function(k) {
    return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
  },
  darker: function(k) {
    return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
  },
  rgb: function() {
    return hcl2lab(this).rgb();
  }
}));

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/lab.js



function lab_lab(start, end) {
  var l = nogamma((start = lab(start)).l, (end = lab(end)).l),
      a = nogamma(start.a, end.a),
      b = nogamma(start.b, end.b),
      opacity = nogamma(start.opacity, end.opacity);
  return function(t) {
    start.l = l(t);
    start.a = a(t);
    start.b = b(t);
    start.opacity = opacity(t);
    return start + "";
  };
}

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/hcl.js



function hcl_hcl(hue) {
  return function(start, end) {
    var h = hue((start = hcl(start)).h, (end = hcl(end)).h),
        c = nogamma(start.c, end.c),
        l = nogamma(start.l, end.l),
        opacity = nogamma(start.opacity, end.opacity);
    return function(t) {
      start.h = h(t);
      start.c = c(t);
      start.l = l(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }
}

/* harmony default export */ var src_hcl = (hcl_hcl(color_hue));
var hclLong = hcl_hcl(nogamma);

// CONCATENATED MODULE: ./node_modules/d3-color/src/cubehelix.js




var cubehelix_A = -0.14861,
    cubehelix_B = +1.78277,
    C = -0.29227,
    cubehelix_D = -0.90649,
    E = +1.97294,
    ED = E * cubehelix_D,
    EB = E * cubehelix_B,
    BC_DA = cubehelix_B * C - cubehelix_D * cubehelix_A;

function cubehelixConvert(o) {
  if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
  if (!(o instanceof Rgb)) o = rgbConvert(o);
  var r = o.r / 255,
      g = o.g / 255,
      b = o.b / 255,
      l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
      bl = b - l,
      k = (E * (g - l) - C * bl) / cubehelix_D,
      s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
      h = s ? Math.atan2(k, bl) * math_degrees - 120 : NaN;
  return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}

function cubehelix_cubehelix(h, s, l, opacity) {
  return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
}

function Cubehelix(h, s, l, opacity) {
  this.h = +h;
  this.s = +s;
  this.l = +l;
  this.opacity = +opacity;
}

define(Cubehelix, cubehelix_cubehelix, extend(Color, {
  brighter: function(k) {
    k = k == null ? color_brighter : Math.pow(color_brighter, k);
    return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  },
  darker: function(k) {
    k = k == null ? color_darker : Math.pow(color_darker, k);
    return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  },
  rgb: function() {
    var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,
        l = +this.l,
        a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
        cosh = Math.cos(h),
        sinh = Math.sin(h);
    return new Rgb(
      255 * (l + a * (cubehelix_A * cosh + cubehelix_B * sinh)),
      255 * (l + a * (C * cosh + cubehelix_D * sinh)),
      255 * (l + a * (E * cosh)),
      this.opacity
    );
  }
}));

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/cubehelix.js



function src_cubehelix_cubehelix(hue) {
  return (function cubehelixGamma(y) {
    y = +y;

    function cubehelix(start, end) {
      var h = hue((start = cubehelix_cubehelix(start)).h, (end = cubehelix_cubehelix(end)).h),
          s = nogamma(start.s, end.s),
          l = nogamma(start.l, end.l),
          opacity = nogamma(start.opacity, end.opacity);
      return function(t) {
        start.h = h(t);
        start.s = s(t);
        start.l = l(Math.pow(t, y));
        start.opacity = opacity(t);
        return start + "";
      };
    }

    cubehelix.gamma = cubehelixGamma;

    return cubehelix;
  })(1);
}

/* harmony default export */ var src_cubehelix = (src_cubehelix_cubehelix(color_hue));
var cubehelixLong = src_cubehelix_cubehelix(nogamma);

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/quantize.js
/* harmony default export */ var src_quantize = (function(interpolator, n) {
  var samples = new Array(n);
  for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
  return samples;
});

// CONCATENATED MODULE: ./node_modules/d3-interpolate/src/index.js






















// CONCATENATED MODULE: ./node_modules/vega-scale/build/vega-scale.module.js








function bandSpace (count, paddingInner, paddingOuter) {
  const space = count - paddingInner + paddingOuter * 2;
  return count ? space > 0 ? space : 1 : 0;
}

const Identity = 'identity';
const vega_scale_module_Linear = 'linear';
const Log = 'log';
const Pow = 'pow';
const Sqrt = 'sqrt';
const Symlog = 'symlog';
const Time = 'time';
const UTC = 'utc';
const Sequential = 'sequential';
const Diverging = 'diverging';
const vega_scale_module_Quantile = 'quantile';
const Quantize = 'quantize';
const Threshold = 'threshold';
const Ordinal = 'ordinal';
const Point = 'point';
const Band = 'band';
const BinOrdinal = 'bin-ordinal'; // categories

const Continuous = 'continuous';
const Discrete = 'discrete';
const Discretizing = 'discretizing';
const Interpolating = 'interpolating';
const Temporal = 'temporal';

function invertRange (scale) {
  return function (_) {
    let lo = _[0],
        hi = _[1],
        t;

    if (hi < lo) {
      t = lo;
      lo = hi;
      hi = t;
    }

    return [scale.invert(lo), scale.invert(hi)];
  };
}

function invertRangeExtent (scale) {
  return function (_) {
    const range = scale.range();
    let lo = _[0],
        hi = _[1],
        min = -1,
        max,
        t,
        i,
        n;

    if (hi < lo) {
      t = lo;
      lo = hi;
      hi = t;
    }

    for (i = 0, n = range.length; i < n; ++i) {
      if (range[i] >= lo && range[i] <= hi) {
        if (min < 0) min = i;
        max = i;
      }
    }

    if (min < 0) return undefined;
    lo = scale.invertExtent(range[min]);
    hi = scale.invertExtent(range[max]);
    return [lo[0] === undefined ? lo[1] : lo[0], hi[1] === undefined ? hi[0] : hi[1]];
  };
}

function vega_scale_module_band() {
  const scale = ordinal().unknown(undefined),
        domain = scale.domain,
        ordinalRange = scale.range;
  let range$1 = [0, 1],
      step,
      bandwidth,
      round = false,
      paddingInner = 0,
      paddingOuter = 0,
      align = 0.5;
  delete scale.unknown;

  function rescale() {
    const n = domain().length,
          reverse = range$1[1] < range$1[0],
          stop = range$1[1 - reverse],
          space = bandSpace(n, paddingInner, paddingOuter);
    let start = range$1[reverse - 0];
    step = (stop - start) / (space || 1);

    if (round) {
      step = Math.floor(step);
    }

    start += (stop - start - step * (n - paddingInner)) * align;
    bandwidth = step * (1 - paddingInner);

    if (round) {
      start = Math.round(start);
      bandwidth = Math.round(bandwidth);
    }

    const values = src_range(n).map(i => start + step * i);
    return ordinalRange(reverse ? values.reverse() : values);
  }

  scale.domain = function (_) {
    if (arguments.length) {
      domain(_);
      return rescale();
    } else {
      return domain();
    }
  };

  scale.range = function (_) {
    if (arguments.length) {
      range$1 = [+_[0], +_[1]];
      return rescale();
    } else {
      return range$1.slice();
    }
  };

  scale.rangeRound = function (_) {
    range$1 = [+_[0], +_[1]];
    round = true;
    return rescale();
  };

  scale.bandwidth = function () {
    return bandwidth;
  };

  scale.step = function () {
    return step;
  };

  scale.round = function (_) {
    if (arguments.length) {
      round = !!_;
      return rescale();
    } else {
      return round;
    }
  };

  scale.padding = function (_) {
    if (arguments.length) {
      paddingOuter = Math.max(0, Math.min(1, _));
      paddingInner = paddingOuter;
      return rescale();
    } else {
      return paddingInner;
    }
  };

  scale.paddingInner = function (_) {
    if (arguments.length) {
      paddingInner = Math.max(0, Math.min(1, _));
      return rescale();
    } else {
      return paddingInner;
    }
  };

  scale.paddingOuter = function (_) {
    if (arguments.length) {
      paddingOuter = Math.max(0, Math.min(1, _));
      return rescale();
    } else {
      return paddingOuter;
    }
  };

  scale.align = function (_) {
    if (arguments.length) {
      align = Math.max(0, Math.min(1, _));
      return rescale();
    } else {
      return align;
    }
  };

  scale.invertRange = function (_) {
    // bail if range has null or undefined values
    if (_[0] == null || _[1] == null) return;
    const reverse = range$1[1] < range$1[0],
          values = reverse ? ordinalRange().reverse() : ordinalRange(),
          n = values.length - 1;
    let lo = +_[0],
        hi = +_[1],
        a,
        b,
        t; // bail if either range endpoint is invalid

    if (lo !== lo || hi !== hi) return; // order range inputs, bail if outside of scale range

    if (hi < lo) {
      t = lo;
      lo = hi;
      hi = t;
    }

    if (hi < values[0] || lo > range$1[1 - reverse]) return; // binary search to index into scale range

    a = Math.max(0, bisectRight(values, lo) - 1);
    b = lo === hi ? a : bisectRight(values, hi) - 1; // increment index a if lo is within padding gap

    if (lo - values[a] > bandwidth + 1e-10) ++a;

    if (reverse) {
      // map + swap
      t = a;
      a = n - b;
      b = n - t;
    }

    return a > b ? undefined : domain().slice(a, b + 1);
  };

  scale.invert = function (_) {
    const value = scale.invertRange([_, _]);
    return value ? value[0] : value;
  };

  scale.copy = function () {
    return vega_scale_module_band().domain(domain()).range(range$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
  };

  return rescale();
}

function pointish(scale) {
  const copy = scale.copy;
  scale.padding = scale.paddingOuter;
  delete scale.paddingInner;

  scale.copy = function () {
    return pointish(copy());
  };

  return scale;
}

function vega_scale_module_point() {
  return pointish(vega_scale_module_band().paddingInner(1));
}

var vega_scale_module_map = Array.prototype.map;
function vega_scale_module_numbers(_) {
  return vega_scale_module_map.call(_, vega_util_module["eb" /* toNumber */]);
}

const vega_scale_module_slice = Array.prototype.slice;

function scaleBinOrdinal() {
  let domain = [],
      range = [];

  function scale(x) {
    return x == null || x !== x ? undefined : range[(src_bisect(domain, x) - 1) % range.length];
  }

  scale.domain = function (_) {
    if (arguments.length) {
      domain = vega_scale_module_numbers(_);
      return scale;
    } else {
      return domain.slice();
    }
  };

  scale.range = function (_) {
    if (arguments.length) {
      range = vega_scale_module_slice.call(_);
      return scale;
    } else {
      return range.slice();
    }
  };

  scale.tickFormat = function (count, specifier) {
    return tickFormat_tickFormat(domain[0], Object(vega_util_module["W" /* peek */])(domain), count == null ? 10 : count, specifier);
  };

  scale.copy = function () {
    return scaleBinOrdinal().domain(scale.domain()).range(scale.range());
  };

  return scale;
}

const vega_scale_module_scales = {};
/**
 * Augment scales with their type and needed inverse methods.
 */

function vega_scale_module_create(type, constructor, metadata) {
  const ctr = function scale() {
    const s = constructor();

    if (!s.invertRange) {
      s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined;
    }

    s.type = type;
    return s;
  };

  ctr.metadata = Object(vega_util_module["fb" /* toSet */])(Object(vega_util_module["i" /* array */])(metadata));
  return ctr;
}

function vega_scale_module_scale(type, scale, metadata) {
  if (arguments.length > 1) {
    vega_scale_module_scales[type] = vega_scale_module_create(type, scale, metadata);
    return this;
  } else {
    return isValidScaleType(type) ? vega_scale_module_scales[type] : undefined;
  }
} // identity scale

vega_scale_module_scale(Identity, identity_identity); // continuous scales

vega_scale_module_scale(vega_scale_module_Linear, linear_linear, Continuous);
vega_scale_module_scale(Log, log_log, [Continuous, Log]);
vega_scale_module_scale(Pow, pow_pow, Continuous);
vega_scale_module_scale(Sqrt, pow_sqrt, Continuous);
vega_scale_module_scale(Symlog, symlog, Continuous);
vega_scale_module_scale(Time, time_time, [Continuous, Temporal]);
vega_scale_module_scale(UTC, utcTime, [Continuous, Temporal]); // sequential scales

vega_scale_module_scale(Sequential, sequential, [Continuous, Interpolating]); // backwards compat

vega_scale_module_scale("".concat(Sequential, "-").concat(vega_scale_module_Linear), sequential, [Continuous, Interpolating]);
vega_scale_module_scale("".concat(Sequential, "-").concat(Log), sequentialLog, [Continuous, Interpolating, Log]);
vega_scale_module_scale("".concat(Sequential, "-").concat(Pow), sequentialPow, [Continuous, Interpolating]);
vega_scale_module_scale("".concat(Sequential, "-").concat(Sqrt), sequentialSqrt, [Continuous, Interpolating]);
vega_scale_module_scale("".concat(Sequential, "-").concat(Symlog), sequentialSymlog, [Continuous, Interpolating]); // diverging scales

vega_scale_module_scale("".concat(Diverging, "-").concat(vega_scale_module_Linear), diverging, [Continuous, Interpolating]);
vega_scale_module_scale("".concat(Diverging, "-").concat(Log), divergingLog, [Continuous, Interpolating, Log]);
vega_scale_module_scale("".concat(Diverging, "-").concat(Pow), divergingPow, [Continuous, Interpolating]);
vega_scale_module_scale("".concat(Diverging, "-").concat(Sqrt), divergingSqrt, [Continuous, Interpolating]);
vega_scale_module_scale("".concat(Diverging, "-").concat(Symlog), divergingSymlog, [Continuous, Interpolating]); // discretizing scales

vega_scale_module_scale(vega_scale_module_Quantile, src_quantile_quantile, [Discretizing, vega_scale_module_Quantile]);
vega_scale_module_scale(Quantize, quantize, Discretizing);
vega_scale_module_scale(Threshold, threshold_threshold, Discretizing); // discrete scales

vega_scale_module_scale(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]);
vega_scale_module_scale(Ordinal, ordinal, Discrete);
vega_scale_module_scale(Band, vega_scale_module_band, Discrete);
vega_scale_module_scale(Point, vega_scale_module_point, Discrete);
function isValidScaleType(type) {
  return Object(vega_util_module["w" /* hasOwnProperty */])(vega_scale_module_scales, type);
}

function hasType(key, type) {
  const s = vega_scale_module_scales[key];
  return s && s.metadata[type];
}

function isContinuous(key) {
  return hasType(key, Continuous);
}
function isDiscrete(key) {
  return hasType(key, Discrete);
}
function isDiscretizing(key) {
  return hasType(key, Discretizing);
}
function isLogarithmic(key) {
  return hasType(key, Log);
}
function isTemporal(key) {
  return hasType(key, Temporal);
}
function isInterpolating(key) {
  return hasType(key, Interpolating);
}
function isQuantile(key) {
  return hasType(key, vega_scale_module_Quantile);
}

const scaleProps = ['clamp', 'base', 'constant', 'exponent'];
function interpolateRange(interpolator, range) {
  const start = range[0],
        span = Object(vega_util_module["W" /* peek */])(range) - start;
  return function (i) {
    return interpolator(start + i * span);
  };
}
function interpolateColors(colors, type, gamma) {
  return piecewise_piecewise(vega_scale_module_interpolate(type || 'rgb', gamma), colors);
}
function quantizeInterpolator(interpolator, count) {
  const samples = new Array(count),
        n = count + 1;

  for (let i = 0; i < count;) samples[i] = interpolator(++i / n);

  return samples;
}
function scaleCopy(scale) {
  const t = scale.type,
        s = scale.copy();
  s.type = t;
  return s;
}
function scaleFraction(scale$1, min, max) {
  const delta = max - min;
  let i, t, s;

  if (!delta || !Number.isFinite(delta)) {
    return Object(vega_util_module["m" /* constant */])(0.5);
  } else {
    i = (t = scale$1.type).indexOf('-');
    t = i < 0 ? t : t.slice(i + 1);
    s = vega_scale_module_scale(t)().domain([min, max]).range([0, 1]);
    scaleProps.forEach(m => scale$1[m] ? s[m](scale$1[m]()) : 0);
    return s;
  }
}
function vega_scale_module_interpolate(type, gamma) {
  const interp = src_namespaceObject[vega_scale_module_method(type)];
  return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp;
}

function vega_scale_module_method(type) {
  return 'interpolate' + type.toLowerCase().split('-').map(s => s[0].toUpperCase() + s.slice(1)).join('');
}

const vega_scale_module_continuous = {
  blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90',
  greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429',
  greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e',
  oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303',
  purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c',
  reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13',
  blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429',
  bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71',
  greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1',
  orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403',
  purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281',
  purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353',
  purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a',
  redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174',
  yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034',
  yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204',
  yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225',
  blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07',
  brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147',
  purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29',
  purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07',
  redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85',
  redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434',
  yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185',
  redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695',
  redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837',
  pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419',
  spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2',
  viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725',
  magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf',
  inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4',
  plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921',
  cividis: '00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647',
  rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa',
  sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040',
  turbo: '23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00',
  browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632',
  tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985',
  teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667',
  warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e',
  goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36',
  goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26',
  goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e',
  lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b',
  lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc',
  lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c',
  lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b',
  lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988',
  darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff',
  darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff',
  darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa',
  darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff',
  darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c'
};
const vega_scale_module_discrete = {
  category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf',
  category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5',
  category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6',
  category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9',
  tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac',
  tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5',
  accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666',
  dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666',
  paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928',
  pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2',
  pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc',
  set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999',
  set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3',
  set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f'
};

function vega_scale_module_colors(palette) {
  const n = palette.length / 6 | 0,
        c = new Array(n);

  for (let i = 0; i < n;) {
    c[i] = '#' + palette.slice(i * 6, ++i * 6);
  }

  return c;
}

function vega_scale_module_apply(_, f) {
  for (const k in _) vega_scale_module_scheme(k, f(_[k]));
}

const schemes = {};
vega_scale_module_apply(vega_scale_module_discrete, vega_scale_module_colors);
vega_scale_module_apply(vega_scale_module_continuous, _ => interpolateColors(vega_scale_module_colors(_)));
function vega_scale_module_scheme(name, scheme) {
  name = name && name.toLowerCase();

  if (arguments.length > 1) {
    schemes[name] = scheme;
    return this;
  } else {
    return schemes[name];
  }
}

const SymbolLegend = 'symbol';
const DiscreteLegend = 'discrete';
const GradientLegend = 'gradient';

const vega_scale_module_defaultFormatter = value => Object(vega_util_module["B" /* isArray */])(value) ? value.map(v => String(v)) : String(value);

const vega_scale_module_ascending = (a, b) => a[1] - b[1];

const descending = (a, b) => b[1] - a[1];
/**
 * Determine the tick count or interval function.
 * @param {Scale} scale - The scale for which to generate tick values.
 * @param {*} count - The desired tick count or interval specifier.
 * @param {number} minStep - The desired minimum step between tick values.
 * @return {*} - The tick count or interval function.
 */


function tickCount(scale, count, minStep) {
  let step;

  if (Object(vega_util_module["G" /* isNumber */])(count)) {
    if (scale.bins) {
      count = Math.max(count, scale.bins.length);
    }

    if (minStep != null) {
      count = Math.min(count, Math.floor(Object(vega_util_module["Z" /* span */])(scale.domain()) / minStep || 1));
    }
  }

  if (Object(vega_util_module["H" /* isObject */])(count)) {
    step = count.step;
    count = count.interval;
  }

  if (Object(vega_util_module["J" /* isString */])(count)) {
    count = scale.type === Time ? Object(vega_time_module["p" /* timeInterval */])(count) : scale.type == UTC ? Object(vega_time_module["v" /* utcInterval */])(count) : Object(vega_util_module["o" /* error */])('Only time and utc scales accept interval strings.');
    if (step) count = count.every(step);
  }

  return count;
}
/**
 * Filter a set of candidate tick values, ensuring that only tick values
 * that lie within the scale range are included.
 * @param {Scale} scale - The scale for which to generate tick values.
 * @param {Array<*>} ticks - The candidate tick values.
 * @param {*} count - The tick count or interval function.
 * @return {Array<*>} - The filtered tick values.
 */

function validTicks(scale, ticks, count) {
  let range = scale.range(),
      lo = range[0],
      hi = Object(vega_util_module["W" /* peek */])(range),
      cmp = vega_scale_module_ascending;

  if (lo > hi) {
    range = hi;
    hi = lo;
    lo = range;
    cmp = descending;
  }

  lo = Math.floor(lo);
  hi = Math.ceil(hi); // filter ticks to valid values within the range
  // additionally sort ticks in range order (#2579)

  ticks = ticks.map(v => [v, scale(v)]).filter(_ => lo <= _[1] && _[1] <= hi).sort(cmp).map(_ => _[0]);

  if (count > 0 && ticks.length > 1) {
    const endpoints = [ticks[0], Object(vega_util_module["W" /* peek */])(ticks)];

    while (ticks.length > count && ticks.length >= 3) {
      ticks = ticks.filter((_, i) => !(i % 2));
    }

    if (ticks.length < 3) {
      ticks = endpoints;
    }
  }

  return ticks;
}
/**
 * Generate tick values for the given scale and approximate tick count or
 * interval value. If the scale has a 'ticks' method, it will be used to
 * generate the ticks, with the count argument passed as a parameter. If the
 * scale lacks a 'ticks' method, the full scale domain will be returned.
 * @param {Scale} scale - The scale for which to generate tick values.
 * @param {*} [count] - The approximate number of desired ticks.
 * @return {Array<*>} - The generated tick values.
 */

function tickValues(scale, count) {
  return scale.bins ? validTicks(scale, scale.bins) : scale.ticks ? scale.ticks(count) : scale.domain();
}
/**
 * Generate a label format function for a scale. If the scale has a
 * 'tickFormat' method, it will be used to generate the formatter, with the
 * count and specifier arguments passed as parameters. If the scale lacks a
 * 'tickFormat' method, the returned formatter performs simple string coercion.
 * If the input scale is a logarithmic scale and the format specifier does not
 * indicate a desired decimal precision, a special variable precision formatter
 * that automatically trims trailing zeroes will be generated.
 * @param {Scale} scale - The scale for which to generate the label formatter.
 * @param {*} [count] - The approximate number of desired ticks.
 * @param {string} [specifier] - The format specifier. Must be a legal d3
 *   specifier string (see https://github.com/d3/d3-format#formatSpecifier) or
 *   time multi-format specifier object.
 * @return {function(*):string} - The generated label formatter.
 */

function vega_scale_module_tickFormat(locale, scale, count, specifier, formatType, noSkip) {
  const type = scale.type;
  let format = vega_scale_module_defaultFormatter;

  if (type === Time || formatType === Time) {
    format = locale.timeFormat(specifier);
  } else if (type === UTC || formatType === UTC) {
    format = locale.utcFormat(specifier);
  } else if (isLogarithmic(type)) {
    const varfmt = locale.formatFloat(specifier);

    if (noSkip || scale.bins) {
      format = varfmt;
    } else {
      const test = tickLog(scale, count, false);

      format = _ => test(_) ? varfmt(_) : '';
    }
  } else if (scale.tickFormat) {
    // if d3 scale has tickFormat, it must be continuous
    const d = scale.domain();
    format = locale.formatSpan(d[0], d[d.length - 1], count, specifier);
  } else if (specifier) {
    format = locale.format(specifier);
  }

  return format;
}
function tickLog(scale, count, values) {
  const ticks = tickValues(scale, count),
        base = scale.base(),
        logb = Math.log(base),
        k = Math.max(1, base * count / ticks.length); // apply d3-scale's log format filter criteria

  const test = d => {
    let i = d / Math.pow(base, Math.round(Math.log(d) / logb));
    if (i * base < base - 0.5) i *= base;
    return i <= k;
  };

  return values ? ticks.filter(test) : test;
}

const vega_scale_module_symbols = {
  [vega_scale_module_Quantile]: 'quantiles',
  [Quantize]: 'thresholds',
  [Threshold]: 'domain'
};
const vega_scale_module_formats = {
  [vega_scale_module_Quantile]: 'quantiles',
  [Quantize]: 'domain'
};
function labelValues(scale, count) {
  return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : vega_scale_module_symbols[scale.type] ? thresholdValues(scale[vega_scale_module_symbols[scale.type]]()) : tickValues(scale, count);
}
function thresholdFormat(locale, scale, specifier) {
  const _ = scale[vega_scale_module_formats[scale.type]](),
        n = _.length;

  let d = n > 1 ? _[1] - _[0] : _[0],
      i;

  for (i = 1; i < n; ++i) {
    d = Math.min(d, _[i] - _[i - 1]);
  } // tickCount = 3 ticks times 10 for increased resolution


  return locale.formatSpan(0, d, 3 * 10, specifier);
}

function thresholdValues(thresholds) {
  const values = [-Infinity].concat(thresholds);
  values.max = +Infinity;
  return values;
}

function binValues(bins) {
  const values = bins.slice(0, -1);
  values.max = Object(vega_util_module["W" /* peek */])(bins);
  return values;
}

const isDiscreteRange = scale => vega_scale_module_symbols[scale.type] || scale.bins;

function labelFormat(locale, scale, count, type, specifier, formatType, noSkip) {
  const format = vega_scale_module_formats[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : vega_scale_module_tickFormat(locale, scale, count, specifier, formatType, noSkip);
  return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format);
}

const formatRange = format => (value, index, array) => {
  const limit = vega_scale_module_get(array[index + 1], vega_scale_module_get(array.max, +Infinity)),
        lo = formatValue(value, format),
        hi = formatValue(limit, format);
  return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo;
};

const vega_scale_module_get = (value, dflt) => value != null ? value : dflt;

const formatDiscrete = format => (value, index) => index ? format(value) : null;

const formatPoint = format => value => format(value);

const formatValue = (value, format) => Number.isFinite(value) ? format(value) : null;

function labelFraction(scale) {
  const domain = scale.domain(),
        count = domain.length - 1;
  let lo = +domain[0],
      hi = +Object(vega_util_module["W" /* peek */])(domain),
      span = hi - lo;

  if (scale.type === Threshold) {
    const adjust = count ? span / count : 0.1;
    lo -= adjust;
    hi += adjust;
    span = hi - lo;
  }

  return value => (value - lo) / span;
}

function vega_scale_module_format(locale, scale, specifier, formatType) {
  const type = formatType || scale.type; // replace abbreviated time specifiers to improve screen reader experience

  if (Object(vega_util_module["J" /* isString */])(specifier) && isTemporal(type)) {
    specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B');
  }

  return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true);
}

function domainCaption(locale, scale, opt) {
  opt = opt || {};
  const max = Math.max(3, opt.maxlen || 7),
        fmt = vega_scale_module_format(locale, scale, opt.format, opt.formatType); // if scale breaks domain into bins, describe boundaries

  if (isDiscretizing(scale.type)) {
    const v = labelValues(scale).slice(1).map(fmt),
          n = v.length;
    return "".concat(n, " boundar").concat(n === 1 ? 'y' : 'ies', ": ").concat(v.join(', '));
  } // if scale domain is discrete, list values
  else if (isDiscrete(scale.type)) {
      const d = scale.domain(),
            n = d.length,
            v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', ');
      return "".concat(n, " value").concat(n === 1 ? '' : 's', ": ").concat(v);
    } // if scale domain is continuous, describe value range
    else {
        const d = scale.domain();
        return "values from ".concat(fmt(d[0]), " to ").concat(fmt(Object(vega_util_module["W" /* peek */])(d)));
      }
}



// CONCATENATED MODULE: ./node_modules/vega-scenegraph/build/vega-scenegraph.module.js







let gradient_id = 0;
function resetSVGGradientId() {
  gradient_id = 0;
}
const patternPrefix = 'p_';
function isGradient(value) {
  return value && value.gradient;
}
function gradientRef(g, defs, base) {
  const type = g.gradient;
  let id = g.id,
      prefix = type === 'radial' ? patternPrefix : ''; // check id, assign default values as needed

  if (!id) {
    id = g.id = 'gradient_' + gradient_id++;

    if (type === 'radial') {
      g.x1 = vega_scenegraph_module_get(g.x1, 0.5);
      g.y1 = vega_scenegraph_module_get(g.y1, 0.5);
      g.r1 = vega_scenegraph_module_get(g.r1, 0);
      g.x2 = vega_scenegraph_module_get(g.x2, 0.5);
      g.y2 = vega_scenegraph_module_get(g.y2, 0.5);
      g.r2 = vega_scenegraph_module_get(g.r2, 0.5);
      prefix = patternPrefix;
    } else {
      g.x1 = vega_scenegraph_module_get(g.x1, 0);
      g.y1 = vega_scenegraph_module_get(g.y1, 0);
      g.x2 = vega_scenegraph_module_get(g.x2, 1);
      g.y2 = vega_scenegraph_module_get(g.y2, 0);
    }
  } // register definition


  defs[id] = g; // return url reference

  return 'url(' + (base || '') + '#' + prefix + id + ')';
}

function vega_scenegraph_module_get(val, def) {
  return val != null ? val : def;
}

function Gradient (p0, p1) {
  var stops = [],
      gradient;
  return gradient = {
    gradient: 'linear',
    x1: p0 ? p0[0] : 0,
    y1: p0 ? p0[1] : 0,
    x2: p1 ? p1[0] : 1,
    y2: p1 ? p1[1] : 0,
    stops: stops,
    stop: function (offset, color) {
      stops.push({
        offset: offset,
        color: color
      });
      return gradient;
    }
  };
}

const lookup = {
  'basis': {
    curve: basis
  },
  'basis-closed': {
    curve: basisClosed
  },
  'basis-open': {
    curve: basisOpen
  },
  'bundle': {
    curve: curve_bundle,
    tension: 'beta',
    value: 0.85
  },
  'cardinal': {
    curve: cardinal,
    tension: 'tension',
    value: 0
  },
  'cardinal-open': {
    curve: cardinalOpen,
    tension: 'tension',
    value: 0
  },
  'cardinal-closed': {
    curve: cardinalClosed,
    tension: 'tension',
    value: 0
  },
  'catmull-rom': {
    curve: curve_catmullRom,
    tension: 'alpha',
    value: 0.5
  },
  'catmull-rom-closed': {
    curve: catmullRomClosed,
    tension: 'alpha',
    value: 0.5
  },
  'catmull-rom-open': {
    curve: catmullRomOpen,
    tension: 'alpha',
    value: 0.5
  },
  'linear': {
    curve: curve_linear
  },
  'linear-closed': {
    curve: linearClosed
  },
  'monotone': {
    horizontal: monotoneY,
    vertical: monotoneX
  },
  'natural': {
    curve: natural
  },
  'step': {
    curve: curve_step
  },
  'step-after': {
    curve: stepAfter
  },
  'step-before': {
    curve: stepBefore
  }
};
function curves(type, orientation, tension) {
  var entry = Object(vega_util_module["w" /* hasOwnProperty */])(lookup, type) && lookup[type],
      curve = null;

  if (entry) {
    curve = entry.curve || entry[orientation || 'vertical'];

    if (entry.tension && tension != null) {
      curve = curve[entry.tension](tension);
    }
  }

  return curve;
}

// Path parsing and rendering code adapted from fabric.js -- Thanks!
const cmdlen = {
  m: 2,
  l: 2,
  h: 1,
  v: 1,
  c: 6,
  s: 4,
  q: 4,
  t: 2,
  a: 7
},
      regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\.\d+)(\.\d)/g, /(\d)([-+])/g, /\s|,|###/];
function pathParse (pathstr) {
  const result = [];
  let curr, chunks, parsed, param, cmd, len, i, j, n, m; // First, break path into command sequence

  const path = pathstr.slice().replace(regexp[0], '###$1').split(regexp[1]).slice(1); // Next, parse each command in turn

  for (i = 0, n = path.length; i < n; ++i) {
    curr = path[i];
    chunks = curr.slice(1).trim().replace(regexp[2], '$1###$2').replace(regexp[3], '$1###$2').split(regexp[4]);
    cmd = curr.charAt(0);
    parsed = [cmd];

    for (j = 0, m = chunks.length; j < m; ++j) {
      if ((param = +chunks[j]) === param) {
        // not NaN
        parsed.push(param);
      }
    }

    len = cmdlen[cmd.toLowerCase()];

    if (parsed.length - 1 > len) {
      const m = parsed.length;
      j = 1;
      result.push([cmd].concat(parsed.slice(j, j += len))); // handle implicit lineTo (#2803)

      cmd = cmd === 'M' ? 'L' : cmd === 'm' ? 'l' : cmd;

      for (; j < m; j += len) {
        result.push([cmd].concat(parsed.slice(j, j + len)));
      }
    } else {
      result.push(parsed);
    }
  }

  return result;
}

const DegToRad = Math.PI / 180;
const Epsilon = 1e-14;
const HalfPi = Math.PI / 2;
const Tau = Math.PI * 2;
const HalfSqrt3 = Math.sqrt(3) / 2;

var segmentCache = {};
var bezierCache = {};
var join = [].join; // Copied from Inkscape svgtopdf, thanks!

function vega_scenegraph_module_segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {
  const key = join.call(arguments);

  if (segmentCache[key]) {
    return segmentCache[key];
  }

  const th = rotateX * DegToRad;
  const sin_th = Math.sin(th);
  const cos_th = Math.cos(th);
  rx = Math.abs(rx);
  ry = Math.abs(ry);
  const px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;
  const py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;
  let pl = px * px / (rx * rx) + py * py / (ry * ry);

  if (pl > 1) {
    pl = Math.sqrt(pl);
    rx *= pl;
    ry *= pl;
  }

  const a00 = cos_th / rx;
  const a01 = sin_th / rx;
  const a10 = -sin_th / ry;
  const a11 = cos_th / ry;
  const x0 = a00 * ox + a01 * oy;
  const y0 = a10 * ox + a11 * oy;
  const x1 = a00 * x + a01 * y;
  const y1 = a10 * x + a11 * y;
  const d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
  let sfactor_sq = 1 / d - 0.25;
  if (sfactor_sq < 0) sfactor_sq = 0;
  let sfactor = Math.sqrt(sfactor_sq);
  if (sweep == large) sfactor = -sfactor;
  const xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);
  const yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);
  const th0 = Math.atan2(y0 - yc, x0 - xc);
  const th1 = Math.atan2(y1 - yc, x1 - xc);
  let th_arc = th1 - th0;

  if (th_arc < 0 && sweep === 1) {
    th_arc += Tau;
  } else if (th_arc > 0 && sweep === 0) {
    th_arc -= Tau;
  }

  const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001)));
  const result = [];

  for (let i = 0; i < segs; ++i) {
    const th2 = th0 + i * th_arc / segs;
    const th3 = th0 + (i + 1) * th_arc / segs;
    result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th];
  }

  return segmentCache[key] = result;
}
function bezier(params) {
  const key = join.call(params);

  if (bezierCache[key]) {
    return bezierCache[key];
  }

  var cx = params[0],
      cy = params[1],
      th0 = params[2],
      th1 = params[3],
      rx = params[4],
      ry = params[5],
      sin_th = params[6],
      cos_th = params[7];
  const a00 = cos_th * rx;
  const a01 = -sin_th * ry;
  const a10 = sin_th * rx;
  const a11 = cos_th * ry;
  const cos_th0 = Math.cos(th0);
  const sin_th0 = Math.sin(th0);
  const cos_th1 = Math.cos(th1);
  const sin_th1 = Math.sin(th1);
  const th_half = 0.5 * (th1 - th0);
  const sin_th_h2 = Math.sin(th_half * 0.5);
  const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half);
  const x1 = cx + cos_th0 - t * sin_th0;
  const y1 = cy + sin_th0 + t * cos_th0;
  const x3 = cx + cos_th1;
  const y3 = cy + sin_th1;
  const x2 = x3 + t * sin_th1;
  const y2 = y3 - t * cos_th1;
  return bezierCache[key] = [a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3];
}

const vega_scenegraph_module_temp = ['l', 0, 0, 0, 0, 0, 0, 0];

function vega_scenegraph_module_scale$1(current, sX, sY) {
  const c = vega_scenegraph_module_temp[0] = current[0];

  if (c === 'a' || c === 'A') {
    vega_scenegraph_module_temp[1] = sX * current[1];
    vega_scenegraph_module_temp[2] = sY * current[2];
    vega_scenegraph_module_temp[3] = current[3];
    vega_scenegraph_module_temp[4] = current[4];
    vega_scenegraph_module_temp[5] = current[5];
    vega_scenegraph_module_temp[6] = sX * current[6];
    vega_scenegraph_module_temp[7] = sY * current[7];
  } else if (c === 'h' || c === 'H') {
    vega_scenegraph_module_temp[1] = sX * current[1];
  } else if (c === 'v' || c === 'V') {
    vega_scenegraph_module_temp[1] = sY * current[1];
  } else {
    for (var i = 1, n = current.length; i < n; ++i) {
      vega_scenegraph_module_temp[i] = (i % 2 == 1 ? sX : sY) * current[i];
    }
  }

  return vega_scenegraph_module_temp;
}

function pathRender (context, path, l, t, sX, sY) {
  var current,
      // current instruction
  previous = null,
      x = 0,
      // current x
  y = 0,
      // current y
  controlX = 0,
      // current control point x
  controlY = 0,
      // current control point y
  tempX,
      tempY,
      tempControlX,
      tempControlY;
  if (l == null) l = 0;
  if (t == null) t = 0;
  if (sX == null) sX = 1;
  if (sY == null) sY = sX;
  if (context.beginPath) context.beginPath();

  for (var i = 0, len = path.length; i < len; ++i) {
    current = path[i];

    if (sX !== 1 || sY !== 1) {
      current = vega_scenegraph_module_scale$1(current, sX, sY);
    }

    switch (current[0]) {
      // first letter
      case 'l':
        // lineto, relative
        x += current[1];
        y += current[2];
        context.lineTo(x + l, y + t);
        break;

      case 'L':
        // lineto, absolute
        x = current[1];
        y = current[2];
        context.lineTo(x + l, y + t);
        break;

      case 'h':
        // horizontal lineto, relative
        x += current[1];
        context.lineTo(x + l, y + t);
        break;

      case 'H':
        // horizontal lineto, absolute
        x = current[1];
        context.lineTo(x + l, y + t);
        break;

      case 'v':
        // vertical lineto, relative
        y += current[1];
        context.lineTo(x + l, y + t);
        break;

      case 'V':
        // verical lineto, absolute
        y = current[1];
        context.lineTo(x + l, y + t);
        break;

      case 'm':
        // moveTo, relative
        x += current[1];
        y += current[2];
        context.moveTo(x + l, y + t);
        break;

      case 'M':
        // moveTo, absolute
        x = current[1];
        y = current[2];
        context.moveTo(x + l, y + t);
        break;

      case 'c':
        // bezierCurveTo, relative
        tempX = x + current[5];
        tempY = y + current[6];
        controlX = x + current[3];
        controlY = y + current[4];
        context.bezierCurveTo(x + current[1] + l, // x1
        y + current[2] + t, // y1
        controlX + l, // x2
        controlY + t, // y2
        tempX + l, tempY + t);
        x = tempX;
        y = tempY;
        break;

      case 'C':
        // bezierCurveTo, absolute
        x = current[5];
        y = current[6];
        controlX = current[3];
        controlY = current[4];
        context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t);
        break;

      case 's':
        // shorthand cubic bezierCurveTo, relative
        // transform to absolute x,y
        tempX = x + current[3];
        tempY = y + current[4]; // calculate reflection of previous control points

        controlX = 2 * x - controlX;
        controlY = 2 * y - controlY;
        context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t); // set control point to 2nd one of this command
        // the first control point is assumed to be the reflection of
        // the second control point on the previous command relative
        // to the current point.

        controlX = x + current[1];
        controlY = y + current[2];
        x = tempX;
        y = tempY;
        break;

      case 'S':
        // shorthand cubic bezierCurveTo, absolute
        tempX = current[3];
        tempY = current[4]; // calculate reflection of previous control points

        controlX = 2 * x - controlX;
        controlY = 2 * y - controlY;
        context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t);
        x = tempX;
        y = tempY; // set control point to 2nd one of this command
        // the first control point is assumed to be the reflection of
        // the second control point on the previous command relative
        // to the current point.

        controlX = current[1];
        controlY = current[2];
        break;

      case 'q':
        // quadraticCurveTo, relative
        // transform to absolute x,y
        tempX = x + current[3];
        tempY = y + current[4];
        controlX = x + current[1];
        controlY = y + current[2];
        context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t);
        x = tempX;
        y = tempY;
        break;

      case 'Q':
        // quadraticCurveTo, absolute
        tempX = current[3];
        tempY = current[4];
        context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t);
        x = tempX;
        y = tempY;
        controlX = current[1];
        controlY = current[2];
        break;

      case 't':
        // shorthand quadraticCurveTo, relative
        // transform to absolute x,y
        tempX = x + current[1];
        tempY = y + current[2];

        if (previous[0].match(/[QqTt]/) === null) {
          // If there is no previous command or if the previous command was not a Q, q, T or t,
          // assume the control point is coincident with the current point
          controlX = x;
          controlY = y;
        } else if (previous[0] === 't') {
          // calculate reflection of previous control points for t
          controlX = 2 * x - tempControlX;
          controlY = 2 * y - tempControlY;
        } else if (previous[0] === 'q') {
          // calculate reflection of previous control points for q
          controlX = 2 * x - controlX;
          controlY = 2 * y - controlY;
        }

        tempControlX = controlX;
        tempControlY = controlY;
        context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t);
        x = tempX;
        y = tempY;
        controlX = x + current[1];
        controlY = y + current[2];
        break;

      case 'T':
        tempX = current[1];
        tempY = current[2]; // calculate reflection of previous control points

        controlX = 2 * x - controlX;
        controlY = 2 * y - controlY;
        context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t);
        x = tempX;
        y = tempY;
        break;

      case 'a':
        drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x + l, current[7] + y + t]);
        x += current[6];
        y += current[7];
        break;

      case 'A':
        drawArc(context, x + l, y + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]);
        x = current[6];
        y = current[7];
        break;

      case 'z':
      case 'Z':
        context.closePath();
        break;
    }

    previous = current;
  }
}

function drawArc(context, x, y, coords) {
  const seg = vega_scenegraph_module_segments(coords[5], // end x
  coords[6], // end y
  coords[0], // radius x
  coords[1], // radius y
  coords[3], // large flag
  coords[4], // sweep flag
  coords[2], // rotation
  x, y);

  for (let i = 0; i < seg.length; ++i) {
    const bez = bezier(seg[i]);
    context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);
  }
}

const Tan30 = 0.5773502691896257;
const builtins = {
  'circle': {
    draw: function (context, size) {
      const r = Math.sqrt(size) / 2;
      context.moveTo(r, 0);
      context.arc(0, 0, r, 0, Tau);
    }
  },
  'cross': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2,
          s = r / 2.5;
      context.moveTo(-r, -s);
      context.lineTo(-r, s);
      context.lineTo(-s, s);
      context.lineTo(-s, r);
      context.lineTo(s, r);
      context.lineTo(s, s);
      context.lineTo(r, s);
      context.lineTo(r, -s);
      context.lineTo(s, -s);
      context.lineTo(s, -r);
      context.lineTo(-s, -r);
      context.lineTo(-s, -s);
      context.closePath();
    }
  },
  'diamond': {
    draw: function (context, size) {
      const r = Math.sqrt(size) / 2;
      context.moveTo(-r, 0);
      context.lineTo(0, -r);
      context.lineTo(r, 0);
      context.lineTo(0, r);
      context.closePath();
    }
  },
  'square': {
    draw: function (context, size) {
      var w = Math.sqrt(size),
          x = -w / 2;
      context.rect(x, x, w, w);
    }
  },
  'arrow': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2,
          s = r / 7,
          t = r / 2.5,
          v = r / 8;
      context.moveTo(-s, r);
      context.lineTo(s, r);
      context.lineTo(s, -v);
      context.lineTo(t, -v);
      context.lineTo(0, -r);
      context.lineTo(-t, -v);
      context.lineTo(-s, -v);
      context.closePath();
    }
  },
  'wedge': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2,
          h = HalfSqrt3 * r,
          o = h - r * Tan30,
          b = r / 4;
      context.moveTo(0, -h - o);
      context.lineTo(-b, h - o);
      context.lineTo(b, h - o);
      context.closePath();
    }
  },
  'triangle': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2,
          h = HalfSqrt3 * r,
          o = h - r * Tan30;
      context.moveTo(0, -h - o);
      context.lineTo(-r, h - o);
      context.lineTo(r, h - o);
      context.closePath();
    }
  },
  'triangle-up': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2,
          h = HalfSqrt3 * r;
      context.moveTo(0, -h);
      context.lineTo(-r, h);
      context.lineTo(r, h);
      context.closePath();
    }
  },
  'triangle-down': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2,
          h = HalfSqrt3 * r;
      context.moveTo(0, h);
      context.lineTo(-r, -h);
      context.lineTo(r, -h);
      context.closePath();
    }
  },
  'triangle-right': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2,
          h = HalfSqrt3 * r;
      context.moveTo(h, 0);
      context.lineTo(-h, -r);
      context.lineTo(-h, r);
      context.closePath();
    }
  },
  'triangle-left': {
    draw: function (context, size) {
      var r = Math.sqrt(size) / 2,
          h = HalfSqrt3 * r;
      context.moveTo(-h, 0);
      context.lineTo(h, -r);
      context.lineTo(h, r);
      context.closePath();
    }
  },
  'stroke': {
    draw: function (context, size) {
      const r = Math.sqrt(size) / 2;
      context.moveTo(-r, 0);
      context.lineTo(r, 0);
    }
  }
};
function vega_scenegraph_module_symbols(_) {
  return Object(vega_util_module["w" /* hasOwnProperty */])(builtins, _) ? builtins[_] : customSymbol(_);
}
var vega_scenegraph_module_custom = {};

function customSymbol(path) {
  if (!Object(vega_util_module["w" /* hasOwnProperty */])(vega_scenegraph_module_custom, path)) {
    const parsed = pathParse(path);
    vega_scenegraph_module_custom[path] = {
      draw: function (context, size) {
        pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2);
      }
    };
  }

  return vega_scenegraph_module_custom[path];
}

const vega_scenegraph_module_C = 0.448084975506; // C = 1 - c

function rectangleX(d) {
  return d.x;
}

function rectangleY(d) {
  return d.y;
}

function rectangleWidth(d) {
  return d.width;
}

function rectangleHeight(d) {
  return d.height;
}

function vega_scenegraph_module_number(_) {
  return typeof _ === 'function' ? _ : () => +_;
}

function vega_scenegraph_module_clamp(value, min, max) {
  return Math.max(min, Math.min(value, max));
}

function vg_rect () {
  var x = rectangleX,
      y = rectangleY,
      width = rectangleWidth,
      height = rectangleHeight,
      crTL = vega_scenegraph_module_number(0),
      crTR = crTL,
      crBL = crTL,
      crBR = crTL,
      context = null;

  function rectangle(_, x0, y0) {
    var buffer,
        x1 = x0 != null ? x0 : +x.call(this, _),
        y1 = y0 != null ? y0 : +y.call(this, _),
        w = +width.call(this, _),
        h = +height.call(this, _),
        s = Math.min(w, h) / 2,
        tl = vega_scenegraph_module_clamp(+crTL.call(this, _), 0, s),
        tr = vega_scenegraph_module_clamp(+crTR.call(this, _), 0, s),
        bl = vega_scenegraph_module_clamp(+crBL.call(this, _), 0, s),
        br = vega_scenegraph_module_clamp(+crBR.call(this, _), 0, s);
    if (!context) context = buffer = src_path();

    if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) {
      context.rect(x1, y1, w, h);
    } else {
      var x2 = x1 + w,
          y2 = y1 + h;
      context.moveTo(x1 + tl, y1);
      context.lineTo(x2 - tr, y1);
      context.bezierCurveTo(x2 - vega_scenegraph_module_C * tr, y1, x2, y1 + vega_scenegraph_module_C * tr, x2, y1 + tr);
      context.lineTo(x2, y2 - br);
      context.bezierCurveTo(x2, y2 - vega_scenegraph_module_C * br, x2 - vega_scenegraph_module_C * br, y2, x2 - br, y2);
      context.lineTo(x1 + bl, y2);
      context.bezierCurveTo(x1 + vega_scenegraph_module_C * bl, y2, x1, y2 - vega_scenegraph_module_C * bl, x1, y2 - bl);
      context.lineTo(x1, y1 + tl);
      context.bezierCurveTo(x1, y1 + vega_scenegraph_module_C * tl, x1 + vega_scenegraph_module_C * tl, y1, x1 + tl, y1);
      context.closePath();
    }

    if (buffer) {
      context = null;
      return buffer + '' || null;
    }
  }

  rectangle.x = function (_) {
    if (arguments.length) {
      x = vega_scenegraph_module_number(_);
      return rectangle;
    } else {
      return x;
    }
  };

  rectangle.y = function (_) {
    if (arguments.length) {
      y = vega_scenegraph_module_number(_);
      return rectangle;
    } else {
      return y;
    }
  };

  rectangle.width = function (_) {
    if (arguments.length) {
      width = vega_scenegraph_module_number(_);
      return rectangle;
    } else {
      return width;
    }
  };

  rectangle.height = function (_) {
    if (arguments.length) {
      height = vega_scenegraph_module_number(_);
      return rectangle;
    } else {
      return height;
    }
  };

  rectangle.cornerRadius = function (tl, tr, br, bl) {
    if (arguments.length) {
      crTL = vega_scenegraph_module_number(tl);
      crTR = tr != null ? vega_scenegraph_module_number(tr) : crTL;
      crBR = br != null ? vega_scenegraph_module_number(br) : crTL;
      crBL = bl != null ? vega_scenegraph_module_number(bl) : crTR;
      return rectangle;
    } else {
      return crTL;
    }
  };

  rectangle.context = function (_) {
    if (arguments.length) {
      context = _ == null ? null : _;
      return rectangle;
    } else {
      return context;
    }
  };

  return rectangle;
}

function vg_trail () {
  var x,
      y,
      size,
      defined,
      context = null,
      ready,
      x1,
      y1,
      r1;

  function point(x2, y2, w2) {
    const r2 = w2 / 2;

    if (ready) {
      var ux = y1 - y2,
          uy = x2 - x1;

      if (ux || uy) {
        // get normal vector
        var ud = Math.sqrt(ux * ux + uy * uy),
            rx = (ux /= ud) * r1,
            ry = (uy /= ud) * r1,
            t = Math.atan2(uy, ux); // draw segment

        context.moveTo(x1 - rx, y1 - ry);
        context.lineTo(x2 - ux * r2, y2 - uy * r2);
        context.arc(x2, y2, r2, t - Math.PI, t);
        context.lineTo(x1 + rx, y1 + ry);
        context.arc(x1, y1, r1, t, t + Math.PI);
      } else {
        context.arc(x2, y2, r2, 0, Tau);
      }

      context.closePath();
    } else {
      ready = 1;
    }

    x1 = x2;
    y1 = y2;
    r1 = r2;
  }

  function trail(data) {
    var i,
        n = data.length,
        d,
        defined0 = false,
        buffer;
    if (context == null) context = buffer = src_path();

    for (i = 0; i <= n; ++i) {
      if (!(i < n && defined(d = data[i], i, data)) === defined0) {
        if (defined0 = !defined0) ready = 0;
      }

      if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data));
    }

    if (buffer) {
      context = null;
      return buffer + '' || null;
    }
  }

  trail.x = function (_) {
    if (arguments.length) {
      x = _;
      return trail;
    } else {
      return x;
    }
  };

  trail.y = function (_) {
    if (arguments.length) {
      y = _;
      return trail;
    } else {
      return y;
    }
  };

  trail.size = function (_) {
    if (arguments.length) {
      size = _;
      return trail;
    } else {
      return size;
    }
  };

  trail.defined = function (_) {
    if (arguments.length) {
      defined = _;
      return trail;
    } else {
      return defined;
    }
  };

  trail.context = function (_) {
    if (arguments.length) {
      if (_ == null) {
        context = null;
      } else {
        context = _;
      }

      return trail;
    } else {
      return context;
    }
  };

  return trail;
}

function value$1(a, b) {
  return a != null ? a : b;
}

const vega_scenegraph_module_x = item => item.x || 0,
      vega_scenegraph_module_y = item => item.y || 0,
      vega_scenegraph_module_w = item => item.width || 0,
      vega_scenegraph_module_h = item => item.height || 0,
      xw = item => (item.x || 0) + (item.width || 0),
      yh = item => (item.y || 0) + (item.height || 0),
      vega_scenegraph_module_sa = item => item.startAngle || 0,
      ea = item => item.endAngle || 0,
      vega_scenegraph_module_pa = item => item.padAngle || 0,
      ir = item => item.innerRadius || 0,
      vega_scenegraph_module_or = item => item.outerRadius || 0,
      vega_scenegraph_module_cr = item => item.cornerRadius || 0,
      vega_scenegraph_module_tl = item => value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0,
      vega_scenegraph_module_tr = item => value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0,
      vega_scenegraph_module_br = item => value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0,
      vega_scenegraph_module_bl = item => value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0,
      vega_scenegraph_module_sz = item => value$1(item.size, 64),
      ts = item => item.size || 1,
      vega_scenegraph_module_def = item => !(item.defined === false),
      vega_scenegraph_module_type = item => vega_scenegraph_module_symbols(item.shape || 'circle');

const arcShape = src_arc().startAngle(vega_scenegraph_module_sa).endAngle(ea).padAngle(vega_scenegraph_module_pa).innerRadius(ir).outerRadius(vega_scenegraph_module_or).cornerRadius(vega_scenegraph_module_cr),
      areavShape = src_area().x(vega_scenegraph_module_x).y1(vega_scenegraph_module_y).y0(yh).defined(vega_scenegraph_module_def),
      areahShape = src_area().y(vega_scenegraph_module_y).x1(vega_scenegraph_module_x).x0(xw).defined(vega_scenegraph_module_def),
      lineShape = src_line().x(vega_scenegraph_module_x).y(vega_scenegraph_module_y).defined(vega_scenegraph_module_def),
      rectShape = vg_rect().x(vega_scenegraph_module_x).y(vega_scenegraph_module_y).width(vega_scenegraph_module_w).height(vega_scenegraph_module_h).cornerRadius(vega_scenegraph_module_tl, vega_scenegraph_module_tr, vega_scenegraph_module_br, vega_scenegraph_module_bl),
      symbolShape = src_symbol().type(vega_scenegraph_module_type).size(vega_scenegraph_module_sz),
      trailShape = vg_trail().x(vega_scenegraph_module_x).y(vega_scenegraph_module_y).defined(vega_scenegraph_module_def).size(ts);
function vega_scenegraph_module_hasCornerRadius(item) {
  return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft;
}
function arc$1(context, item) {
  return arcShape.context(context)(item);
}
function area$1(context, items) {
  const item = items[0],
        interp = item.interpolate || 'linear';
  return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items);
}
function line$1(context, items) {
  const item = items[0],
        interp = item.interpolate || 'linear';
  return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items);
}
function vega_scenegraph_module_rectangle(context, item, x, y) {
  return rectShape.context(context)(item, x, y);
}
function shape$1(context, item) {
  return (item.mark.shape || item.shape).context(context)(item);
}
function symbol$1(context, item) {
  return symbolShape.context(context)(item);
}
function trail$1(context, items) {
  return trailShape.context(context)(items);
}

var clip_id = 1;
function resetSVGClipId() {
  clip_id = 1;
}
function clip$1 (renderer, item, size) {
  var clip = item.clip,
      defs = renderer._defs,
      id = item.clip_id || (item.clip_id = 'clip' + clip_id++),
      c = defs.clipping[id] || (defs.clipping[id] = {
    id: id
  });

  if (Object(vega_util_module["E" /* isFunction */])(clip)) {
    c.path = clip(null);
  } else if (vega_scenegraph_module_hasCornerRadius(size)) {
    c.path = vega_scenegraph_module_rectangle(null, size, 0, 0);
  } else {
    c.width = size.width || 0;
    c.height = size.height || 0;
  }

  return 'url(#' + id + ')';
}

function Bounds(b) {
  this.clear();
  if (b) this.union(b);
}
Bounds.prototype = {
  clone() {
    return new Bounds(this);
  },

  clear() {
    this.x1 = +Number.MAX_VALUE;
    this.y1 = +Number.MAX_VALUE;
    this.x2 = -Number.MAX_VALUE;
    this.y2 = -Number.MAX_VALUE;
    return this;
  },

  empty() {
    return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
  },

  equals(b) {
    return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
  },

  set(x1, y1, x2, y2) {
    if (x2 < x1) {
      this.x2 = x1;
      this.x1 = x2;
    } else {
      this.x1 = x1;
      this.x2 = x2;
    }

    if (y2 < y1) {
      this.y2 = y1;
      this.y1 = y2;
    } else {
      this.y1 = y1;
      this.y2 = y2;
    }

    return this;
  },

  add(x, y) {
    if (x < this.x1) this.x1 = x;
    if (y < this.y1) this.y1 = y;
    if (x > this.x2) this.x2 = x;
    if (y > this.y2) this.y2 = y;
    return this;
  },

  expand(d) {
    this.x1 -= d;
    this.y1 -= d;
    this.x2 += d;
    this.y2 += d;
    return this;
  },

  round() {
    this.x1 = Math.floor(this.x1);
    this.y1 = Math.floor(this.y1);
    this.x2 = Math.ceil(this.x2);
    this.y2 = Math.ceil(this.y2);
    return this;
  },

  scale(s) {
    this.x1 *= s;
    this.y1 *= s;
    this.x2 *= s;
    this.y2 *= s;
    return this;
  },

  translate(dx, dy) {
    this.x1 += dx;
    this.x2 += dx;
    this.y1 += dy;
    this.y2 += dy;
    return this;
  },

  rotate(angle, x, y) {
    const p = this.rotatedPoints(angle, x, y);
    return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
  },

  rotatedPoints(angle, x, y) {
    var {
      x1,
      y1,
      x2,
      y2
    } = this,
        cos = Math.cos(angle),
        sin = Math.sin(angle),
        cx = x - x * cos + y * sin,
        cy = y - x * sin - y * cos;
    return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy];
  },

  union(b) {
    if (b.x1 < this.x1) this.x1 = b.x1;
    if (b.y1 < this.y1) this.y1 = b.y1;
    if (b.x2 > this.x2) this.x2 = b.x2;
    if (b.y2 > this.y2) this.y2 = b.y2;
    return this;
  },

  intersect(b) {
    if (b.x1 > this.x1) this.x1 = b.x1;
    if (b.y1 > this.y1) this.y1 = b.y1;
    if (b.x2 < this.x2) this.x2 = b.x2;
    if (b.y2 < this.y2) this.y2 = b.y2;
    return this;
  },

  encloses(b) {
    return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
  },

  alignsWith(b) {
    return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2);
  },

  intersects(b) {
    return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
  },

  contains(x, y) {
    return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
  },

  width() {
    return this.x2 - this.x1;
  },

  height() {
    return this.y2 - this.y1;
  }

};

function Item(mark) {
  this.mark = mark;
  this.bounds = this.bounds || new Bounds();
}

function GroupItem(mark) {
  Item.call(this, mark);
  this.items = this.items || [];
}
Object(vega_util_module["z" /* inherits */])(GroupItem, Item);

function ResourceLoader(customLoader) {
  this._pending = 0;
  this._loader = customLoader || Object(vega_loader_browser_module["e" /* loader */])();
}

function increment(loader) {
  loader._pending += 1;
}

function decrement(loader) {
  loader._pending -= 1;
}

ResourceLoader.prototype = {
  pending() {
    return this._pending;
  },

  sanitizeURL(uri) {
    const loader = this;
    increment(loader);
    return loader._loader.sanitize(uri, {
      context: 'href'
    }).then(opt => {
      decrement(loader);
      return opt;
    }).catch(() => {
      decrement(loader);
      return null;
    });
  },

  loadImage(uri) {
    const loader = this,
          Image = domImage();
    increment(loader);
    return loader._loader.sanitize(uri, {
      context: 'image'
    }).then(opt => {
      const url = opt.href;
      if (!url || !Image) throw {
        url: url
      };
      const img = new Image(); // set crossOrigin only if cors is defined; empty string sets anonymous mode
      // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin

      const cors = Object(vega_util_module["w" /* hasOwnProperty */])(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous';
      if (cors != null) img.crossOrigin = cors; // attempt to load image resource

      img.onload = () => decrement(loader);

      img.onerror = () => decrement(loader);

      img.src = url;
      return img;
    }).catch(e => {
      decrement(loader);
      return {
        complete: false,
        width: 0,
        height: 0,
        src: e && e.url || ''
      };
    });
  },

  ready() {
    const loader = this;
    return new Promise(accept => {
      function poll(value) {
        if (!loader.pending()) accept(value);else setTimeout(() => {
          poll(true);
        }, 10);
      }

      poll(false);
    });
  }

};

function boundStroke (bounds, item, miter) {
  if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) {
    const sw = item.strokeWidth != null ? +item.strokeWidth : 1;
    bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0));
  }

  return bounds;
}

function miterAdjustment(item, strokeWidth) {
  // TODO: more sophisticated adjustment? Or miter support in boundContext?
  return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth;
}

const circleThreshold = Tau - 1e-8;
let vega_scenegraph_module_bounds, lx, ly, rot, ma, mb, mc, vega_scenegraph_module_md;

const vega_scenegraph_module_add = (x, y) => vega_scenegraph_module_bounds.add(x, y);

const addL = (x, y) => vega_scenegraph_module_add(lx = x, ly = y);

const addX = x => vega_scenegraph_module_add(x, vega_scenegraph_module_bounds.y1);

const addY = y => vega_scenegraph_module_add(vega_scenegraph_module_bounds.x1, y);

const px = (x, y) => ma * x + mc * y;

const py = (x, y) => mb * x + vega_scenegraph_module_md * y;

const addp = (x, y) => vega_scenegraph_module_add(px(x, y), py(x, y));

const addpL = (x, y) => addL(px(x, y), py(x, y));

function boundContext (_, deg) {
  vega_scenegraph_module_bounds = _;

  if (deg) {
    rot = deg * DegToRad;
    ma = vega_scenegraph_module_md = Math.cos(rot);
    mb = Math.sin(rot);
    mc = -mb;
  } else {
    ma = vega_scenegraph_module_md = 1;
    rot = mb = mc = 0;
  }

  return context$1;
}
const context$1 = {
  beginPath() {},

  closePath() {},

  moveTo: addpL,
  lineTo: addpL,

  rect(x, y, w, h) {
    if (rot) {
      addp(x + w, y);
      addp(x + w, y + h);
      addp(x, y + h);
      addpL(x, y);
    } else {
      vega_scenegraph_module_add(x + w, y + h);
      addL(x, y);
    }
  },

  quadraticCurveTo(x1, y1, x2, y2) {
    const px1 = px(x1, y1),
          py1 = py(x1, y1),
          px2 = px(x2, y2),
          py2 = py(x2, y2);
    quadExtrema(lx, px1, px2, addX);
    quadExtrema(ly, py1, py2, addY);
    addL(px2, py2);
  },

  bezierCurveTo(x1, y1, x2, y2, x3, y3) {
    const px1 = px(x1, y1),
          py1 = py(x1, y1),
          px2 = px(x2, y2),
          py2 = py(x2, y2),
          px3 = px(x3, y3),
          py3 = py(x3, y3);
    cubicExtrema(lx, px1, px2, px3, addX);
    cubicExtrema(ly, py1, py2, py3, addY);
    addL(px3, py3);
  },

  arc(cx, cy, r, sa, ea, ccw) {
    sa += rot;
    ea += rot; // store last point on path

    lx = r * Math.cos(ea) + cx;
    ly = r * Math.sin(ea) + cy;

    if (Math.abs(ea - sa) > circleThreshold) {
      // treat as full circle
      vega_scenegraph_module_add(cx - r, cy - r);
      vega_scenegraph_module_add(cx + r, cy + r);
    } else {
      const update = a => vega_scenegraph_module_add(r * Math.cos(a) + cx, r * Math.sin(a) + cy);

      let s, i; // sample end points

      update(sa);
      update(ea); // sample interior points aligned with 90 degrees

      if (ea !== sa) {
        sa = sa % Tau;
        if (sa < 0) sa += Tau;
        ea = ea % Tau;
        if (ea < 0) ea += Tau;

        if (ea < sa) {
          ccw = !ccw; // flip direction

          s = sa;
          sa = ea;
          ea = s; // swap end-points
        }

        if (ccw) {
          ea -= Tau;
          s = sa - sa % HalfPi;

          for (i = 0; i < 4 && s > ea; ++i, s -= HalfPi) update(s);
        } else {
          s = sa - sa % HalfPi + HalfPi;

          for (i = 0; i < 4 && s < ea; ++i, s = s + HalfPi) update(s);
        }
      }
    }
  }

};

function quadExtrema(x0, x1, x2, cb) {
  const t = (x0 - x1) / (x0 + x2 - 2 * x1);
  if (0 < t && t < 1) cb(x0 + (x1 - x0) * t);
}

function cubicExtrema(x0, x1, x2, x3, cb) {
  const a = x3 - x0 + 3 * x1 - 3 * x2,
        b = x0 + x2 - 2 * x1,
        c = x0 - x1;
  let t0 = 0,
      t1 = 0,
      r; // solve for parameter t

  if (Math.abs(a) > Epsilon) {
    // quadratic equation
    r = b * b + c * a;

    if (r >= 0) {
      r = Math.sqrt(r);
      t0 = (-b + r) / a;
      t1 = (-b - r) / a;
    }
  } else {
    // linear equation
    t0 = 0.5 * c / b;
  } // calculate position


  if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3));
  if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3));
}

function cubic(t, x0, x1, x2, x3) {
  const s = 1 - t,
        s2 = s * s,
        t2 = t * t;
  return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3;
}

var vega_scenegraph_module_context = (vega_scenegraph_module_context = domCanvas(1, 1)) ? vega_scenegraph_module_context.getContext('2d') : null;

const vega_scenegraph_module_b = new Bounds();
function intersectPath(draw) {
  return function (item, brush) {
    // rely on (inaccurate) bounds intersection if no context
    if (!vega_scenegraph_module_context) return true; // add path to offscreen graphics context

    draw(vega_scenegraph_module_context, item); // get bounds intersection region

    vega_scenegraph_module_b.clear().union(item.bounds).intersect(brush).round();
    const {
      x1,
      y1,
      x2,
      y2
    } = vega_scenegraph_module_b; // iterate over intersection region
    // perform fine grained inclusion test

    for (let y = y1; y <= y2; ++y) {
      for (let x = x1; x <= x2; ++x) {
        if (vega_scenegraph_module_context.isPointInPath(x, y)) {
          return true;
        }
      }
    } // false if no hits in intersection region


    return false;
  };
}
function intersectPoint(item, box) {
  return box.contains(item.x || 0, item.y || 0);
}
function intersectRect(item, box) {
  const x = item.x || 0,
        y = item.y || 0,
        w = item.width || 0,
        h = item.height || 0;
  return box.intersects(vega_scenegraph_module_b.set(x, y, x + w, y + h));
}
function intersectRule(item, box) {
  const x = item.x || 0,
        y = item.y || 0,
        x2 = item.x2 != null ? item.x2 : x,
        y2 = item.y2 != null ? item.y2 : y;
  return intersectBoxLine(box, x, y, x2, y2);
}
function intersectBoxLine(box, x, y, u, v) {
  const {
    x1,
    y1,
    x2,
    y2
  } = box,
        dx = u - x,
        dy = v - y;
  let t0 = 0,
      t1 = 1,
      p,
      q,
      r,
      e;

  for (e = 0; e < 4; ++e) {
    if (e === 0) {
      p = -dx;
      q = -(x1 - x);
    }

    if (e === 1) {
      p = dx;
      q = x2 - x;
    }

    if (e === 2) {
      p = -dy;
      q = -(y1 - y);
    }

    if (e === 3) {
      p = dy;
      q = y2 - y;
    }

    if (Math.abs(p) < 1e-10 && q < 0) return false;
    r = q / p;

    if (p < 0) {
      if (r > t1) return false;else if (r > t0) t0 = r;
    } else if (p > 0) {
      if (r < t0) return false;else if (r < t1) t1 = r;
    }
  }

  return true;
}

function blend (context, item) {
  context.globalCompositeOperation = item.blend || 'source-over';
}

function vega_scenegraph_module_value (value, dflt) {
  return value == null ? dflt : value;
}

function addStops(gradient, stops) {
  const n = stops.length;

  for (let i = 0; i < n; ++i) {
    gradient.addColorStop(stops[i].offset, stops[i].color);
  }

  return gradient;
}

function vega_scenegraph_module_gradient (context, spec, bounds) {
  const w = bounds.width(),
        h = bounds.height();
  let gradient;

  if (spec.gradient === 'radial') {
    gradient = context.createRadialGradient(bounds.x1 + vega_scenegraph_module_value(spec.x1, 0.5) * w, bounds.y1 + vega_scenegraph_module_value(spec.y1, 0.5) * h, Math.max(w, h) * vega_scenegraph_module_value(spec.r1, 0), bounds.x1 + vega_scenegraph_module_value(spec.x2, 0.5) * w, bounds.y1 + vega_scenegraph_module_value(spec.y2, 0.5) * h, Math.max(w, h) * vega_scenegraph_module_value(spec.r2, 0.5));
  } else {
    // linear gradient
    const x1 = vega_scenegraph_module_value(spec.x1, 0),
          y1 = vega_scenegraph_module_value(spec.y1, 0),
          x2 = vega_scenegraph_module_value(spec.x2, 1),
          y2 = vega_scenegraph_module_value(spec.y2, 0);

    if (x1 === x2 || y1 === y2 || w === h) {
      // axis aligned: use normal gradient
      gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h);
    } else {
      // not axis aligned: render gradient into a pattern (#2365)
      // this allows us to use normalized bounding box coordinates
      const image = domCanvas(Math.ceil(w), Math.ceil(h)),
            ictx = image.getContext('2d');
      ictx.scale(w, h);
      ictx.fillStyle = addStops(ictx.createLinearGradient(x1, y1, x2, y2), spec.stops);
      ictx.fillRect(0, 0, w, h);
      return context.createPattern(image, 'no-repeat');
    }
  }

  return addStops(gradient, spec.stops);
}

function vega_scenegraph_module_color (context, item, value) {
  return isGradient(value) ? vega_scenegraph_module_gradient(context, value, item.bounds) : value;
}

function vega_scenegraph_module_fill (context, item, opacity) {
  opacity *= item.fillOpacity == null ? 1 : item.fillOpacity;

  if (opacity > 0) {
    context.globalAlpha = opacity;
    context.fillStyle = vega_scenegraph_module_color(context, item, item.fill);
    return true;
  } else {
    return false;
  }
}

var vega_scenegraph_module_Empty = [];
function vega_scenegraph_module_stroke (context, item, opacity) {
  var lw = (lw = item.strokeWidth) != null ? lw : 1;
  if (lw <= 0) return false;
  opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity;

  if (opacity > 0) {
    context.globalAlpha = opacity;
    context.strokeStyle = vega_scenegraph_module_color(context, item, item.stroke);
    context.lineWidth = lw;
    context.lineCap = item.strokeCap || 'butt';
    context.lineJoin = item.strokeJoin || 'miter';
    context.miterLimit = item.strokeMiterLimit || 10;

    if (context.setLineDash) {
      context.setLineDash(item.strokeDash || vega_scenegraph_module_Empty);
      context.lineDashOffset = item.strokeDashOffset || 0;
    }

    return true;
  } else {
    return false;
  }
}

function vega_scenegraph_module_compare(a, b) {
  return a.zindex - b.zindex || a.index - b.index;
}

function zorder(scene) {
  if (!scene.zdirty) return scene.zitems;
  var items = scene.items,
      output = [],
      item,
      i,
      n;

  for (i = 0, n = items.length; i < n; ++i) {
    item = items[i];
    item.index = i;
    if (item.zindex) output.push(item);
  }

  scene.zdirty = false;
  return scene.zitems = output.sort(vega_scenegraph_module_compare);
}
function vega_scenegraph_module_visit(scene, visitor) {
  var items = scene.items,
      i,
      n;
  if (!items || !items.length) return;
  const zitems = zorder(scene);

  if (zitems && zitems.length) {
    for (i = 0, n = items.length; i < n; ++i) {
      if (!items[i].zindex) visitor(items[i]);
    }

    items = zitems;
  }

  for (i = 0, n = items.length; i < n; ++i) {
    visitor(items[i]);
  }
}
function pickVisit(scene, visitor) {
  var items = scene.items,
      hit,
      i;
  if (!items || !items.length) return null;
  const zitems = zorder(scene);
  if (zitems && zitems.length) items = zitems;

  for (i = items.length; --i >= 0;) {
    if (hit = visitor(items[i])) return hit;
  }

  if (items === zitems) {
    for (items = scene.items, i = items.length; --i >= 0;) {
      if (!items[i].zindex) {
        if (hit = visitor(items[i])) return hit;
      }
    }
  }

  return null;
}

function drawAll(path) {
  return function (context, scene, bounds) {
    vega_scenegraph_module_visit(scene, item => {
      if (!bounds || bounds.intersects(item.bounds)) {
        drawPath(path, context, item, item);
      }
    });
  };
}
function drawOne(path) {
  return function (context, scene, bounds) {
    if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) {
      drawPath(path, context, scene.items[0], scene.items);
    }
  };
}

function drawPath(path, context, item, items) {
  var opacity = item.opacity == null ? 1 : item.opacity;
  if (opacity === 0) return;
  if (path(context, items)) return;
  blend(context, item);

  if (item.fill && vega_scenegraph_module_fill(context, item, opacity)) {
    context.fill();
  }

  if (item.stroke && vega_scenegraph_module_stroke(context, item, opacity)) {
    context.stroke();
  }
}

function pick$1(test) {
  test = test || vega_util_module["ib" /* truthy */];
  return function (context, scene, x, y, gx, gy) {
    x *= context.pixelRatio;
    y *= context.pixelRatio;
    return pickVisit(scene, item => {
      const b = item.bounds; // first hit test against bounding box

      if (b && !b.contains(gx, gy) || !b) return; // if in bounding box, perform more careful test

      if (test(context, item, x, y, gx, gy)) return item;
    });
  };
}
function hitPath(path, filled) {
  return function (context, o, x, y) {
    var item = Array.isArray(o) ? o[0] : o,
        fill = filled == null ? item.fill : filled,
        stroke = item.stroke && context.isPointInStroke,
        lw,
        lc;

    if (stroke) {
      lw = item.strokeWidth;
      lc = item.strokeCap;
      context.lineWidth = lw != null ? lw : 1;
      context.lineCap = lc != null ? lc : 'butt';
    }

    return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y);
  };
}
function pickPath(path) {
  return pick$1(hitPath(path));
}

function vega_scenegraph_module_translate(x, y) {
  return 'translate(' + x + ',' + y + ')';
}
function vega_scenegraph_module_rotate(a) {
  return 'rotate(' + a + ')';
}
function vega_scenegraph_module_scale(scaleX, scaleY) {
  return 'scale(' + scaleX + ',' + scaleY + ')';
}
function translateItem(item) {
  return vega_scenegraph_module_translate(item.x || 0, item.y || 0);
}
function rotateItem(item) {
  return vega_scenegraph_module_translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + vega_scenegraph_module_rotate(item.angle) : '');
}
function transformItem(item) {
  return vega_scenegraph_module_translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + vega_scenegraph_module_rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + vega_scenegraph_module_scale(item.scaleX || 1, item.scaleY || 1) : '');
}

function markItemPath (type, shape, isect) {
  function attr(emit, item) {
    emit('transform', rotateItem(item));
    emit('d', shape(null, item));
  }

  function bound(bounds, item) {
    shape(boundContext(bounds, item.angle), item);
    return boundStroke(bounds, item).translate(item.x || 0, item.y || 0);
  }

  function draw(context, item) {
    var x = item.x || 0,
        y = item.y || 0,
        a = item.angle || 0;
    context.translate(x, y);
    if (a) context.rotate(a *= DegToRad);
    context.beginPath();
    shape(context, item);
    if (a) context.rotate(-a);
    context.translate(-x, -y);
  }

  return {
    type: type,
    tag: 'path',
    nested: false,
    attr: attr,
    bound: bound,
    draw: drawAll(draw),
    pick: pickPath(draw),
    isect: isect || intersectPath(draw)
  };
}

var vega_scenegraph_module_arc = markItemPath('arc', arc$1);

function pickArea(a, p) {
  var v = a[0].orient === 'horizontal' ? p[1] : p[0],
      z = a[0].orient === 'horizontal' ? 'y' : 'x',
      i = a.length,
      min = +Infinity,
      hit,
      d;

  while (--i >= 0) {
    if (a[i].defined === false) continue;
    d = Math.abs(a[i][z] - v);

    if (d < min) {
      min = d;
      hit = a[i];
    }
  }

  return hit;
}
function pickLine(a, p) {
  var t = Math.pow(a[0].strokeWidth || 1, 2),
      i = a.length,
      dx,
      dy,
      dd;

  while (--i >= 0) {
    if (a[i].defined === false) continue;
    dx = a[i].x - p[0];
    dy = a[i].y - p[1];
    dd = dx * dx + dy * dy;
    if (dd < t) return a[i];
  }

  return null;
}
function pickTrail(a, p) {
  var i = a.length,
      dx,
      dy,
      dd;

  while (--i >= 0) {
    if (a[i].defined === false) continue;
    dx = a[i].x - p[0];
    dy = a[i].y - p[1];
    dd = dx * dx + dy * dy;
    dx = a[i].size || 1;
    if (dd < dx * dx) return a[i];
  }

  return null;
}

function markMultiItemPath (type, shape, tip) {
  function attr(emit, item) {
    var items = item.mark.items;
    if (items.length) emit('d', shape(null, items));
  }

  function bound(bounds, mark) {
    var items = mark.items;

    if (items.length === 0) {
      return bounds;
    } else {
      shape(boundContext(bounds), items);
      return boundStroke(bounds, items[0]);
    }
  }

  function draw(context, items) {
    context.beginPath();
    shape(context, items);
  }

  const hit = hitPath(draw);

  function pick(context, scene, x, y, gx, gy) {
    var items = scene.items,
        b = scene.bounds;

    if (!items || !items.length || b && !b.contains(gx, gy)) {
      return null;
    }

    x *= context.pixelRatio;
    y *= context.pixelRatio;
    return hit(context, items, x, y) ? items[0] : null;
  }

  return {
    type: type,
    tag: 'path',
    nested: true,
    attr: attr,
    bound: bound,
    draw: drawOne(draw),
    pick: pick,
    isect: intersectPoint,
    tip: tip
  };
}

var vega_scenegraph_module_area = markMultiItemPath('area', area$1, pickArea);

function vega_scenegraph_module_clip (context, scene) {
  var clip = scene.clip;
  context.save();

  if (Object(vega_util_module["E" /* isFunction */])(clip)) {
    context.beginPath();
    clip(context);
    context.clip();
  } else {
    clipGroup(context, scene.group);
  }
}
function clipGroup(context, group) {
  context.beginPath();
  vega_scenegraph_module_hasCornerRadius(group) ? vega_scenegraph_module_rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0);
  context.clip();
}

function offset$1(item) {
  const sw = vega_scenegraph_module_value(item.strokeWidth, 1);
  return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0;
}

function attr$5(emit, item) {
  emit('transform', translateItem(item));
}

function emitRectangle(emit, item) {
  const off = offset$1(item);
  emit('d', vega_scenegraph_module_rectangle(null, item, off, off));
}

function background(emit, item) {
  emit('class', 'background');
  emit('aria-hidden', true);
  emitRectangle(emit, item);
}

function foreground(emit, item) {
  emit('class', 'foreground');
  emit('aria-hidden', true);

  if (item.strokeForeground) {
    emitRectangle(emit, item);
  } else {
    emit('d', '');
  }
}

function vega_scenegraph_module_content(emit, item, renderer) {
  const url = item.clip ? clip$1(renderer, item, item) : null;
  emit('clip-path', url);
}

function bound$5(bounds, group) {
  if (!group.clip && group.items) {
    const items = group.items,
          m = items.length;

    for (let j = 0; j < m; ++j) {
      bounds.union(items[j].bounds);
    }
  }

  if ((group.clip || group.width || group.height) && !group.noBound) {
    bounds.add(0, 0).add(group.width || 0, group.height || 0);
  }

  boundStroke(bounds, group);
  return bounds.translate(group.x || 0, group.y || 0);
}

function rectanglePath(context, group, x, y) {
  const off = offset$1(group);
  context.beginPath();
  vega_scenegraph_module_rectangle(context, group, (x || 0) + off, (y || 0) + off);
}

const hitBackground = hitPath(rectanglePath);
const hitForeground = hitPath(rectanglePath, false);
const hitCorner = hitPath(rectanglePath, true);

function draw$4(context, scene, bounds) {
  vega_scenegraph_module_visit(scene, group => {
    const gx = group.x || 0,
          gy = group.y || 0,
          fore = group.strokeForeground,
          opacity = group.opacity == null ? 1 : group.opacity; // draw group background

    if ((group.stroke || group.fill) && opacity) {
      rectanglePath(context, group, gx, gy);
      blend(context, group);

      if (group.fill && vega_scenegraph_module_fill(context, group, opacity)) {
        context.fill();
      }

      if (group.stroke && !fore && vega_scenegraph_module_stroke(context, group, opacity)) {
        context.stroke();
      }
    } // setup graphics context, set clip and bounds


    context.save();
    context.translate(gx, gy);
    if (group.clip) clipGroup(context, group);
    if (bounds) bounds.translate(-gx, -gy); // draw group contents

    vega_scenegraph_module_visit(group, item => {
      this.draw(context, item, bounds);
    }); // restore graphics context

    if (bounds) bounds.translate(gx, gy);
    context.restore(); // draw group foreground

    if (fore && group.stroke && opacity) {
      rectanglePath(context, group, gx, gy);
      blend(context, group);

      if (vega_scenegraph_module_stroke(context, group, opacity)) {
        context.stroke();
      }
    }
  });
}

function pick(context, scene, x, y, gx, gy) {
  if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) {
    return null;
  }

  const cx = x * context.pixelRatio,
        cy = y * context.pixelRatio;
  return pickVisit(scene, group => {
    let hit, dx, dy; // first hit test bounding box

    const b = group.bounds;
    if (b && !b.contains(gx, gy)) return; // passed bounds check, test rectangular clip

    dx = group.x || 0;
    dy = group.y || 0;
    const dw = dx + (group.width || 0),
          dh = dy + (group.height || 0),
          c = group.clip;
    if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; // adjust coordinate system

    context.save();
    context.translate(dx, dy);
    dx = gx - dx;
    dy = gy - dy; // test background for rounded corner clip

    if (c && vega_scenegraph_module_hasCornerRadius(group) && !hitCorner(context, group, cx, cy)) {
      context.restore();
      return null;
    }

    const fore = group.strokeForeground,
          ix = scene.interactive !== false; // hit test against group foreground

    if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) {
      context.restore();
      return group;
    } // hit test against contained marks


    hit = pickVisit(group, mark => pickMark(mark, dx, dy) ? this.pick(mark, x, y, dx, dy) : null); // hit test against group background

    if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) {
      hit = group;
    } // restore state and return


    context.restore();
    return hit || null;
  });
}

function pickMark(mark, x, y) {
  return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y);
}

var vega_scenegraph_module_group = {
  type: 'group',
  tag: 'g',
  nested: false,
  attr: attr$5,
  bound: bound$5,
  draw: draw$4,
  pick: pick,
  isect: intersectRect,
  content: vega_scenegraph_module_content,
  background: background,
  foreground: foreground
};

var vega_scenegraph_module_metadata = {
  'xmlns': 'http://www.w3.org/2000/svg',
  'xmlns:xlink': 'http://www.w3.org/1999/xlink',
  'version': '1.1'
};

function getImage(item, renderer) {
  var image = item.image;

  if (!image || item.url && item.url !== image.url) {
    image = {
      complete: false,
      width: 0,
      height: 0
    };
    renderer.loadImage(item.url).then(image => {
      item.image = image;
      item.image.url = item.url;
    });
  }

  return image;
}

function imageWidth(item, image) {
  return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width;
}

function imageHeight(item, image) {
  return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height;
}

function imageXOffset(align, w) {
  return align === 'center' ? w / 2 : align === 'right' ? w : 0;
}

function imageYOffset(baseline, h) {
  return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0;
}

function attr$4(emit, item, renderer) {
  const img = getImage(item, renderer),
        w = imageWidth(item, img),
        h = imageHeight(item, img),
        x = (item.x || 0) - imageXOffset(item.align, w),
        y = (item.y || 0) - imageYOffset(item.baseline, h),
        i = !img.src && img.toDataURL ? img.toDataURL() : img.src || '';
  emit('href', i, vega_scenegraph_module_metadata['xmlns:xlink'], 'xlink:href');
  emit('transform', vega_scenegraph_module_translate(x, y));
  emit('width', w);
  emit('height', h);
  emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid');
}

function bound$4(bounds, item) {
  const img = item.image,
        w = imageWidth(item, img),
        h = imageHeight(item, img),
        x = (item.x || 0) - imageXOffset(item.align, w),
        y = (item.y || 0) - imageYOffset(item.baseline, h);
  return bounds.set(x, y, x + w, y + h);
}

function draw$3(context, scene, bounds) {
  vega_scenegraph_module_visit(scene, item => {
    if (bounds && !bounds.intersects(item.bounds)) return; // bounds check

    const img = getImage(item, this);
    let w = imageWidth(item, img);
    let h = imageHeight(item, img);
    if (w === 0 || h === 0) return; // early exit

    let x = (item.x || 0) - imageXOffset(item.align, w),
        y = (item.y || 0) - imageYOffset(item.baseline, h),
        opacity,
        ar0,
        ar1,
        t;

    if (item.aspect !== false) {
      ar0 = img.width / img.height;
      ar1 = item.width / item.height;

      if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) {
        if (ar1 < ar0) {
          t = w / ar0;
          y += (h - t) / 2;
          h = t;
        } else {
          t = h * ar0;
          x += (w - t) / 2;
          w = t;
        }
      }
    }

    if (img.complete || img.toDataURL) {
      blend(context, item);
      context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1;
      context.imageSmoothingEnabled = item.smooth !== false;
      context.drawImage(img, x, y, w, h);
    }
  });
}

var vega_scenegraph_module_image = {
  type: 'image',
  tag: 'image',
  nested: false,
  attr: attr$4,
  bound: bound$4,
  draw: draw$3,
  pick: pick$1(),
  isect: vega_util_module["ib" /* truthy */],
  // bounds check is sufficient
  get: getImage,
  xOffset: imageXOffset,
  yOffset: imageYOffset
};

var vega_scenegraph_module_line = markMultiItemPath('line', line$1, pickLine);

function attr$3(emit, item) {
  var sx = item.scaleX || 1,
      sy = item.scaleY || 1;

  if (sx !== 1 || sy !== 1) {
    emit('vector-effect', 'non-scaling-stroke');
  }

  emit('transform', transformItem(item));
  emit('d', item.path);
}

function path$1(context, item) {
  var path = item.path;
  if (path == null) return true;
  var x = item.x || 0,
      y = item.y || 0,
      sx = item.scaleX || 1,
      sy = item.scaleY || 1,
      a = (item.angle || 0) * DegToRad,
      cache = item.pathCache;

  if (!cache || cache.path !== path) {
    (item.pathCache = cache = pathParse(path)).path = path;
  }

  if (a && context.rotate && context.translate) {
    context.translate(x, y);
    context.rotate(a);
    pathRender(context, cache, 0, 0, sx, sy);
    context.rotate(-a);
    context.translate(-x, -y);
  } else {
    pathRender(context, cache, x, y, sx, sy);
  }
}

function bound$3(bounds, item) {
  return path$1(boundContext(bounds, item.angle), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true);
}

var path$2 = {
  type: 'path',
  tag: 'path',
  nested: false,
  attr: attr$3,
  bound: bound$3,
  draw: drawAll(path$1),
  pick: pickPath(path$1),
  isect: intersectPath(path$1)
};

function attr$2(emit, item) {
  emit('d', vega_scenegraph_module_rectangle(null, item));
}

function bound$2(bounds, item) {
  var x, y;
  return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item);
}

function draw$2(context, item) {
  context.beginPath();
  vega_scenegraph_module_rectangle(context, item);
}

var rect = {
  type: 'rect',
  tag: 'path',
  nested: false,
  attr: attr$2,
  bound: bound$2,
  draw: drawAll(draw$2),
  pick: pickPath(draw$2),
  isect: intersectRect
};

function attr$1(emit, item) {
  emit('transform', translateItem(item));
  emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0);
  emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0);
}

function bound$1(bounds, item) {
  var x1, y1;
  return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item);
}

function vega_scenegraph_module_path(context, item, opacity) {
  var x1, y1, x2, y2;

  if (item.stroke && vega_scenegraph_module_stroke(context, item, opacity)) {
    x1 = item.x || 0;
    y1 = item.y || 0;
    x2 = item.x2 != null ? item.x2 : x1;
    y2 = item.y2 != null ? item.y2 : y1;
    context.beginPath();
    context.moveTo(x1, y1);
    context.lineTo(x2, y2);
    return true;
  }

  return false;
}

function draw$1(context, scene, bounds) {
  vega_scenegraph_module_visit(scene, item => {
    if (bounds && !bounds.intersects(item.bounds)) return; // bounds check

    var opacity = item.opacity == null ? 1 : item.opacity;

    if (opacity && vega_scenegraph_module_path(context, item, opacity)) {
      blend(context, item);
      context.stroke();
    }
  });
}

function hit$1(context, item, x, y) {
  if (!context.isPointInStroke) return false;
  return vega_scenegraph_module_path(context, item, 1) && context.isPointInStroke(x, y);
}

var vega_scenegraph_module_rule = {
  type: 'rule',
  tag: 'line',
  nested: false,
  attr: attr$1,
  bound: bound$1,
  draw: draw$1,
  pick: pick$1(hit$1),
  isect: intersectRule
};

var vega_scenegraph_module_shape = markItemPath('shape', shape$1);

var vega_scenegraph_module_symbol = markItemPath('symbol', symbol$1, intersectPoint);

const widthCache = Object(vega_util_module["N" /* lruCache */])();
var textMetrics = {
  height: vega_scenegraph_module_fontSize,
  measureWidth: measureWidth,
  estimateWidth: estimateWidth,
  width: estimateWidth,
  canvas: useCanvas
};
useCanvas(true);

function useCanvas(use) {
  textMetrics.width = use && vega_scenegraph_module_context ? measureWidth : estimateWidth;
} // make simple estimate if no canvas is available


function estimateWidth(item, text) {
  return _estimateWidth(textValue(item, text), vega_scenegraph_module_fontSize(item));
}

function _estimateWidth(text, currentFontHeight) {
  return ~~(0.8 * text.length * currentFontHeight);
} // measure text width if canvas is available


function measureWidth(item, text) {
  return vega_scenegraph_module_fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, vega_scenegraph_module_font(item));
}

function _measureWidth(text, currentFont) {
  const key = `(${currentFont}) ${text}`;
  let width = widthCache.get(key);

  if (width === undefined) {
    vega_scenegraph_module_context.font = currentFont;
    width = vega_scenegraph_module_context.measureText(text).width;
    widthCache.set(key, width);
  }

  return width;
}

function vega_scenegraph_module_fontSize(item) {
  return item.fontSize != null ? +item.fontSize || 0 : 11;
}
function lineHeight(item) {
  return item.lineHeight != null ? item.lineHeight : vega_scenegraph_module_fontSize(item) + 2;
}

function lineArray(_) {
  return Object(vega_util_module["B" /* isArray */])(_) ? _.length > 1 ? _ : _[0] : _;
}

function textLines(item) {
  return lineArray(item.lineBreak && item.text && !Object(vega_util_module["B" /* isArray */])(item.text) ? item.text.split(item.lineBreak) : item.text);
}
function multiLineOffset(item) {
  const tl = textLines(item);
  return (Object(vega_util_module["B" /* isArray */])(tl) ? tl.length - 1 : 0) * lineHeight(item);
}
function textValue(item, line) {
  const text = line == null ? '' : (line + '').trim();
  return item.limit > 0 && text.length ? truncate(item, text) : text;
}

function widthGetter(item) {
  if (textMetrics.width === measureWidth) {
    // we are using canvas
    const currentFont = vega_scenegraph_module_font(item);
    return text => _measureWidth(text, currentFont);
  } else {
    // we are relying on estimates
    const currentFontHeight = vega_scenegraph_module_fontSize(item);
    return text => _estimateWidth(text, currentFontHeight);
  }
}

function truncate(item, text) {
  var limit = +item.limit,
      width = widthGetter(item);
  if (width(text) < limit) return text;
  var ellipsis = item.ellipsis || '\u2026',
      rtl = item.dir === 'rtl',
      lo = 0,
      hi = text.length,
      mid;
  limit -= width(ellipsis);

  if (rtl) {
    while (lo < hi) {
      mid = lo + hi >>> 1;
      if (width(text.slice(mid)) > limit) lo = mid + 1;else hi = mid;
    }

    return ellipsis + text.slice(lo);
  } else {
    while (lo < hi) {
      mid = 1 + (lo + hi >>> 1);
      if (width(text.slice(0, mid)) < limit) lo = mid;else hi = mid - 1;
    }

    return text.slice(0, lo) + ellipsis;
  }
}

function fontFamily(item, quote) {
  var font = item.font;
  return (quote && font ? String(font).replace(/"/g, '\'') : font) || 'sans-serif';
}
function vega_scenegraph_module_font(item, quote) {
  return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + vega_scenegraph_module_fontSize(item) + 'px ' + fontFamily(item, quote);
}
function vega_scenegraph_module_offset(item) {
  // perform our own font baseline calculation
  // why? not all browsers support SVG 1.1 'alignment-baseline' :(
  // this also ensures consistent layout across renderers
  var baseline = item.baseline,
      h = vega_scenegraph_module_fontSize(item);
  return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0);
}

const textAlign = {
  'left': 'start',
  'center': 'middle',
  'right': 'end'
};
const tempBounds = new Bounds();

function anchorPoint(item) {
  var x = item.x || 0,
      y = item.y || 0,
      r = item.radius || 0,
      t;

  if (r) {
    t = (item.theta || 0) - HalfPi;
    x += r * Math.cos(t);
    y += r * Math.sin(t);
  }

  tempBounds.x1 = x;
  tempBounds.y1 = y;
  return tempBounds;
}

function attr(emit, item) {
  var dx = item.dx || 0,
      dy = (item.dy || 0) + vega_scenegraph_module_offset(item),
      p = anchorPoint(item),
      x = p.x1,
      y = p.y1,
      a = item.angle || 0,
      t;
  emit('text-anchor', textAlign[item.align] || 'start');

  if (a) {
    t = vega_scenegraph_module_translate(x, y) + ' ' + vega_scenegraph_module_rotate(a);
    if (dx || dy) t += ' ' + vega_scenegraph_module_translate(dx, dy);
  } else {
    t = vega_scenegraph_module_translate(x + dx, y + dy);
  }

  emit('transform', t);
}

function vega_scenegraph_module_bound(bounds, item, mode) {
  var h = textMetrics.height(item),
      a = item.align,
      p = anchorPoint(item),
      x = p.x1,
      y = p.y1,
      dx = item.dx || 0,
      dy = (item.dy || 0) + vega_scenegraph_module_offset(item) - Math.round(0.8 * h),
      // use 4/5 offset
  tl = textLines(item),
      w; // get dimensions

  if (Object(vega_util_module["B" /* isArray */])(tl)) {
    // multi-line text
    h += lineHeight(item) * (tl.length - 1);
    w = tl.reduce((w, t) => Math.max(w, textMetrics.width(item, t)), 0);
  } else {
    // single-line text
    w = textMetrics.width(item, tl);
  } // horizontal alignment


  if (a === 'center') {
    dx -= w / 2;
  } else if (a === 'right') {
    dx -= w;
  } else ;

  bounds.set(dx += x, dy += y, dx + w, dy + h);

  if (item.angle && !mode) {
    bounds.rotate(item.angle * DegToRad, x, y);
  } else if (mode === 2) {
    return bounds.rotatedPoints(item.angle * DegToRad, x, y);
  }

  return bounds;
}

function draw(context, scene, bounds) {
  vega_scenegraph_module_visit(scene, item => {
    var opacity = item.opacity == null ? 1 : item.opacity,
        p,
        x,
        y,
        i,
        lh,
        tl,
        str;
    if (bounds && !bounds.intersects(item.bounds) || // bounds check
    opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return;
    context.font = vega_scenegraph_module_font(item);
    context.textAlign = item.align || 'left';
    p = anchorPoint(item);
    x = p.x1, y = p.y1;

    if (item.angle) {
      context.save();
      context.translate(x, y);
      context.rotate(item.angle * DegToRad);
      x = y = 0; // reset x, y
    }

    x += item.dx || 0;
    y += (item.dy || 0) + vega_scenegraph_module_offset(item);
    tl = textLines(item);
    blend(context, item);

    if (Object(vega_util_module["B" /* isArray */])(tl)) {
      lh = lineHeight(item);

      for (i = 0; i < tl.length; ++i) {
        str = textValue(item, tl[i]);

        if (item.fill && vega_scenegraph_module_fill(context, item, opacity)) {
          context.fillText(str, x, y);
        }

        if (item.stroke && vega_scenegraph_module_stroke(context, item, opacity)) {
          context.strokeText(str, x, y);
        }

        y += lh;
      }
    } else {
      str = textValue(item, tl);

      if (item.fill && vega_scenegraph_module_fill(context, item, opacity)) {
        context.fillText(str, x, y);
      }

      if (item.stroke && vega_scenegraph_module_stroke(context, item, opacity)) {
        context.strokeText(str, x, y);
      }
    }

    if (item.angle) context.restore();
  });
}

function hit(context, item, x, y, gx, gy) {
  if (item.fontSize <= 0) return false;
  if (!item.angle) return true; // bounds sufficient if no rotation
  // project point into space of unrotated bounds

  var p = anchorPoint(item),
      ax = p.x1,
      ay = p.y1,
      b = vega_scenegraph_module_bound(tempBounds, item, 1),
      a = -item.angle * DegToRad,
      cos = Math.cos(a),
      sin = Math.sin(a),
      px = cos * gx - sin * gy + (ax - cos * ax + sin * ay),
      py = sin * gx + cos * gy + (ay - sin * ax - cos * ay);
  return b.contains(px, py);
}

function intersectText(item, box) {
  const p = vega_scenegraph_module_bound(tempBounds, item, 2);
  return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]);
}

var vega_scenegraph_module_text = {
  type: 'text',
  tag: 'text',
  nested: false,
  attr: attr,
  bound: vega_scenegraph_module_bound,
  draw: draw,
  pick: pick$1(hit),
  isect: intersectText
};

var vega_scenegraph_module_trail = markMultiItemPath('trail', trail$1, pickTrail);

var Marks = {
  arc: vega_scenegraph_module_arc,
  area: vega_scenegraph_module_area,
  group: vega_scenegraph_module_group,
  image: vega_scenegraph_module_image,
  line: vega_scenegraph_module_line,
  path: path$2,
  rect: rect,
  rule: vega_scenegraph_module_rule,
  shape: vega_scenegraph_module_shape,
  symbol: vega_scenegraph_module_symbol,
  text: vega_scenegraph_module_text,
  trail: vega_scenegraph_module_trail
};

function boundItem (item, func, opt) {
  var type = Marks[item.mark.marktype],
      bound = func || type.bound;
  if (type.nested) item = item.mark;
  return bound(item.bounds || (item.bounds = new Bounds()), item, opt);
}

var DUMMY = {
  mark: null
};
function boundMark (mark, bounds, opt) {
  var type = Marks[mark.marktype],
      bound = type.bound,
      items = mark.items,
      hasItems = items && items.length,
      i,
      n,
      item,
      b;

  if (type.nested) {
    if (hasItems) {
      item = items[0];
    } else {
      // no items, fake it
      DUMMY.mark = mark;
      item = DUMMY;
    }

    b = boundItem(item, bound, opt);
    bounds = bounds && bounds.union(b) || b;
    return bounds;
  }

  bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds();

  if (hasItems) {
    for (i = 0, n = items.length; i < n; ++i) {
      bounds.union(boundItem(items[i], bound, opt));
    }
  }

  return mark.bounds = bounds;
}

const vega_scenegraph_module_keys = ['marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', 'x', 'y', 'width', 'height', 'align', 'baseline', // layout
'fill', 'fillOpacity', 'opacity', 'blend', // fill
'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap', // stroke
'strokeDash', 'strokeDashOffset', // stroke dash
'strokeForeground', 'strokeOffset', // group
'startAngle', 'endAngle', 'innerRadius', 'outerRadius', // arc
'cornerRadius', 'padAngle', // arc, rect
'cornerRadiusTopLeft', 'cornerRadiusTopRight', // rect, group
'cornerRadiusBottomLeft', 'cornerRadiusBottomRight', 'interpolate', 'tension', 'orient', 'defined', // area, line
'url', 'aspect', 'smooth', // image
'path', 'scaleX', 'scaleY', // path
'x2', 'y2', // rule
'size', 'shape', // symbol
'text', 'angle', 'theta', 'radius', 'dir', 'dx', 'dy', // text
'ellipsis', 'limit', 'lineBreak', 'lineHeight', 'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant', // font
'description', 'aria', 'ariaRole', 'ariaRoleDescription' // aria
];
function sceneToJSON(scene, indent) {
  return JSON.stringify(scene, vega_scenegraph_module_keys, indent);
}
function sceneFromJSON(json) {
  const scene = typeof json === 'string' ? JSON.parse(json) : json;
  return vega_scenegraph_module_initialize(scene);
}

function vega_scenegraph_module_initialize(scene) {
  var type = scene.marktype,
      items = scene.items,
      parent,
      i,
      n;

  if (items) {
    for (i = 0, n = items.length; i < n; ++i) {
      parent = type ? 'mark' : 'group';
      items[i][parent] = scene;
      if (items[i].zindex) items[i][parent].zdirty = true;
      if ('group' === (type || parent)) vega_scenegraph_module_initialize(items[i]);
    }
  }

  if (type) boundMark(scene);
  return scene;
}

function Scenegraph(scene) {
  if (arguments.length) {
    this.root = sceneFromJSON(scene);
  } else {
    this.root = createMark({
      marktype: 'group',
      name: 'root',
      role: 'frame'
    });
    this.root.items = [new GroupItem(this.root)];
  }
}
Scenegraph.prototype = {
  toJSON(indent) {
    return sceneToJSON(this.root, indent || 0);
  },

  mark(markdef, group, index) {
    group = group || this.root.items[0];
    const mark = createMark(markdef, group);
    group.items[index] = mark;
    if (mark.zindex) mark.group.zdirty = true;
    return mark;
  }

};

function createMark(def, group) {
  const mark = {
    bounds: new Bounds(),
    clip: !!def.clip,
    group: group,
    interactive: def.interactive === false ? false : true,
    items: [],
    marktype: def.marktype,
    name: def.name || undefined,
    role: def.role || undefined,
    zindex: def.zindex || 0
  }; // add accessibility properties if defined

  if (def.aria != null) {
    mark.aria = def.aria;
  }

  if (def.description) {
    mark.description = def.description;
  }

  return mark;
}

// create a new DOM element
function domCreate(doc, tag, ns) {
  if (!doc && typeof document !== 'undefined' && document.createElement) {
    doc = document;
  }

  return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null;
} // find first child element with matching tag

function domFind(el, tag) {
  tag = tag.toLowerCase();
  var nodes = el.childNodes,
      i = 0,
      n = nodes.length;

  for (; i < n; ++i) if (nodes[i].tagName.toLowerCase() === tag) {
    return nodes[i];
  }
} // retrieve child element at given index
// create & insert if doesn't exist or if tags do not match

function domChild(el, index, tag, ns) {
  var a = el.childNodes[index],
      b;

  if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) {
    b = a || null;
    a = domCreate(el.ownerDocument, tag, ns);
    el.insertBefore(a, b);
  }

  return a;
} // remove all child elements at or above the given index

function domClear(el, index) {
  var nodes = el.childNodes,
      curr = nodes.length;

  while (curr > index) el.removeChild(nodes[--curr]);

  return el;
} // generate css class name for mark

function cssClass(mark) {
  return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : '');
}

function vega_scenegraph_module_point (event, el) {
  const rect = el.getBoundingClientRect();
  return [event.clientX - rect.left - (el.clientLeft || 0), event.clientY - rect.top - (el.clientTop || 0)];
}

function resolveItem (item, event, el, origin) {
  var mark = item && item.mark,
      mdef,
      p;

  if (mark && (mdef = Marks[mark.marktype]).tip) {
    p = vega_scenegraph_module_point(event, el);
    p[0] -= origin[0];
    p[1] -= origin[1];

    while (item = item.mark.group) {
      p[0] -= item.x || 0;
      p[1] -= item.y || 0;
    }

    item = mdef.tip(mark.items, p);
  }

  return item;
}

/**
 * Create a new Handler instance.
 * @param {object} [customLoader] - Optional loader instance for
 *   href URL sanitization. If not specified, a standard loader
 *   instance will be generated.
 * @param {function} [customTooltip] - Optional tooltip handler
 *   function for custom tooltip display.
 * @constructor
 */

function vega_scenegraph_module_Handler(customLoader, customTooltip) {
  this._active = null;
  this._handlers = {};
  this._loader = customLoader || Object(vega_loader_browser_module["e" /* loader */])();
  this._tooltip = customTooltip || defaultTooltip;
} // The default tooltip display handler.
// Sets the HTML title attribute on the visualization container.

function defaultTooltip(handler, event, item, value) {
  handler.element().setAttribute('title', value || '');
}

vega_scenegraph_module_Handler.prototype = {
  /**
   * Initialize a new Handler instance.
   * @param {DOMElement} el - The containing DOM element for the display.
   * @param {Array<number>} origin - The origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {object} [obj] - Optional context object that should serve as
   *   the "this" context for event callbacks.
   * @return {Handler} - This handler instance.
   */
  initialize(el, origin, obj) {
    this._el = el;
    this._obj = obj || null;
    return this.origin(origin);
  },

  /**
   * Returns the parent container element for a visualization.
   * @return {DOMElement} - The containing DOM element.
   */
  element() {
    return this._el;
  },

  /**
   * Returns the scene element (e.g., canvas or SVG) of the visualization
   * Subclasses must override if the first child is not the scene element.
   * @return {DOMElement} - The scene (e.g., canvas or SVG) element.
   */
  canvas() {
    return this._el && this._el.firstChild;
  },

  /**
   * Get / set the origin coordinates of the visualization.
   */
  origin(origin) {
    if (arguments.length) {
      this._origin = origin || [0, 0];
      return this;
    } else {
      return this._origin.slice();
    }
  },

  /**
   * Get / set the scenegraph root.
   */
  scene(scene) {
    if (!arguments.length) return this._scene;
    this._scene = scene;
    return this;
  },

  /**
   * Add an event handler. Subclasses should override this method.
   */
  on()
  /*type, handler*/
  {},

  /**
   * Remove an event handler. Subclasses should override this method.
   */
  off()
  /*type, handler*/
  {},

  /**
   * Utility method for finding the array index of an event handler.
   * @param {Array} h - An array of registered event handlers.
   * @param {string} type - The event type.
   * @param {function} handler - The event handler instance to find.
   * @return {number} - The handler's array index or -1 if not registered.
   */
  _handlerIndex(h, type, handler) {
    for (let i = h ? h.length : 0; --i >= 0;) {
      if (h[i].type === type && (!handler || h[i].handler === handler)) {
        return i;
      }
    }

    return -1;
  },

  /**
   * Returns an array with registered event handlers.
   * @param {string} [type] - The event type to query. Any annotations
   *   are ignored; for example, for the argument "click.foo", ".foo" will
   *   be ignored and the method returns all "click" handlers. If type is
   *   null or unspecified, this method returns handlers for all types.
   * @return {Array} - A new array containing all registered event handlers.
   */
  handlers(type) {
    const h = this._handlers,
          a = [];

    if (type) {
      a.push(...h[this.eventName(type)]);
    } else {
      for (const k in h) {
        a.push(...h[k]);
      }
    }

    return a;
  },

  /**
   * Parses an event name string to return the specific event type.
   * For example, given "click.foo" returns "click"
   * @param {string} name - The input event type string.
   * @return {string} - A string with the event type only.
   */
  eventName(name) {
    const i = name.indexOf('.');
    return i < 0 ? name : name.slice(0, i);
  },

  /**
   * Handle hyperlink navigation in response to an item.href value.
   * @param {Event} event - The event triggering hyperlink navigation.
   * @param {Item} item - The scenegraph item.
   * @param {string} href - The URL to navigate to.
   */
  handleHref(event, item, href) {
    this._loader.sanitize(href, {
      context: 'href'
    }).then(opt => {
      const e = new MouseEvent(event.type, event),
            a = domCreate(null, 'a');

      for (const name in opt) a.setAttribute(name, opt[name]);

      a.dispatchEvent(e);
    }).catch(() => {
      /* do nothing */
    });
  },

  /**
   * Handle tooltip display in response to an item.tooltip value.
   * @param {Event} event - The event triggering tooltip display.
   * @param {Item} item - The scenegraph item.
   * @param {boolean} show - A boolean flag indicating whether
   *   to show or hide a tooltip for the given item.
   */
  handleTooltip(event, item, show) {
    if (item && item.tooltip != null) {
      item = resolveItem(item, event, this.canvas(), this._origin);
      const value = show && item && item.tooltip || null;

      this._tooltip.call(this._obj, this, event, item, value);
    }
  },

  /**
   * Returns the size of a scenegraph item and its position relative
   * to the viewport.
   * @param {Item} item - The scenegraph item.
   * @return {object} - A bounding box object (compatible with the
   *   DOMRect type) consisting of x, y, width, heigh, top, left,
   *   right, and bottom properties.
   */
  getItemBoundingClientRect(item) {
    const el = this.canvas();
    if (!el) return;
    const rect = el.getBoundingClientRect(),
          origin = this._origin,
          bounds = item.bounds,
          width = bounds.width(),
          height = bounds.height();
    let x = bounds.x1 + origin[0] + rect.left,
        y = bounds.y1 + origin[1] + rect.top; // translate coordinate for each parent group

    while (item.mark && (item = item.mark.group)) {
      x += item.x || 0;
      y += item.y || 0;
    } // return DOMRect-compatible bounding box


    return {
      x,
      y,
      width,
      height,
      left: x,
      top: y,
      right: x + width,
      bottom: y + height
    };
  }

};

/**
 * Create a new Renderer instance.
 * @param {object} [loader] - Optional loader instance for
 *   image and href URL sanitization. If not specified, a
 *   standard loader instance will be generated.
 * @constructor
 */

function vega_scenegraph_module_Renderer(loader) {
  this._el = null;
  this._bgcolor = null;
  this._loader = new ResourceLoader(loader);
}
vega_scenegraph_module_Renderer.prototype = {
  /**
   * Initialize a new Renderer instance.
   * @param {DOMElement} el - The containing DOM element for the display.
   * @param {number} width - The coordinate width of the display, in pixels.
   * @param {number} height - The coordinate height of the display, in pixels.
   * @param {Array<number>} origin - The origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply
   *   the width and height to determine the final pixel size.
   * @return {Renderer} - This renderer instance.
   */
  initialize(el, width, height, origin, scaleFactor) {
    this._el = el;
    return this.resize(width, height, origin, scaleFactor);
  },

  /**
   * Returns the parent container element for a visualization.
   * @return {DOMElement} - The containing DOM element.
   */
  element() {
    return this._el;
  },

  /**
   * Returns the scene element (e.g., canvas or SVG) of the visualization
   * Subclasses must override if the first child is not the scene element.
   * @return {DOMElement} - The scene (e.g., canvas or SVG) element.
   */
  canvas() {
    return this._el && this._el.firstChild;
  },

  /**
   * Get / set the background color.
   */
  background(bgcolor) {
    if (arguments.length === 0) return this._bgcolor;
    this._bgcolor = bgcolor;
    return this;
  },

  /**
   * Resize the display.
   * @param {number} width - The new coordinate width of the display, in pixels.
   * @param {number} height - The new coordinate height of the display, in pixels.
   * @param {Array<number>} origin - The new origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply
   *   the width and height to determine the final pixel size.
   * @return {Renderer} - This renderer instance;
   */
  resize(width, height, origin, scaleFactor) {
    this._width = width;
    this._height = height;
    this._origin = origin || [0, 0];
    this._scale = scaleFactor || 1;
    return this;
  },

  /**
   * Report a dirty item whose bounds should be redrawn.
   * This base class method does nothing. Subclasses that perform
   * incremental should implement this method.
   * @param {Item} item - The dirty item whose bounds should be redrawn.
   */
  dirty()
  /*item*/
  {},

  /**
   * Render an input scenegraph, potentially with a set of dirty items.
   * This method will perform an immediate rendering with available resources.
   * The renderer may also need to perform image loading to perform a complete
   * render. This process can lead to asynchronous re-rendering of the scene
   * after this method returns. To receive notification when rendering is
   * complete, use the renderAsync method instead.
   * @param {object} scene - The root mark of a scenegraph to render.
   * @return {Renderer} - This renderer instance.
   */
  render(scene) {
    const r = this; // bind arguments into a render call, and cache it
    // this function may be subsequently called for async redraw

    r._call = function () {
      r._render(scene);
    }; // invoke the renderer


    r._call(); // clear the cached call for garbage collection
    // async redraws will stash their own copy


    r._call = null;
    return r;
  },

  /**
   * Internal rendering method. Renderer subclasses should override this
   * method to actually perform rendering.
   * @param {object} scene - The root mark of a scenegraph to render.
   */
  _render()
  /*scene*/
  {// subclasses to override
  },

  /**
   * Asynchronous rendering method. Similar to render, but returns a Promise
   * that resolves when all rendering is completed. Sometimes a renderer must
   * perform image loading to get a complete rendering. The returned
   * Promise will not resolve until this process completes.
   * @param {object} scene - The root mark of a scenegraph to render.
   * @return {Promise} - A Promise that resolves when rendering is complete.
   */
  renderAsync(scene) {
    const r = this.render(scene);
    return this._ready ? this._ready.then(() => r) : Promise.resolve(r);
  },

  /**
   * Internal method for asynchronous resource loading.
   * Proxies method calls to the ImageLoader, and tracks loading
   * progress to invoke a re-render once complete.
   * @param {string} method - The method name to invoke on the ImageLoader.
   * @param {string} uri - The URI for the requested resource.
   * @return {Promise} - A Promise that resolves to the requested resource.
   */
  _load(method, uri) {
    var r = this,
        p = r._loader[method](uri);

    if (!r._ready) {
      // re-render the scene when loading completes
      const call = r._call;
      r._ready = r._loader.ready().then(redraw => {
        if (redraw) call();
        r._ready = null;
      });
    }

    return p;
  },

  /**
   * Sanitize a URL to include as a hyperlink in the rendered scene.
   * This method proxies a call to ImageLoader.sanitizeURL, but also tracks
   * image loading progress and invokes a re-render once complete.
   * @param {string} uri - The URI string to sanitize.
   * @return {Promise} - A Promise that resolves to the sanitized URL.
   */
  sanitizeURL(uri) {
    return this._load('sanitizeURL', uri);
  },

  /**
   * Requests an image to include in the rendered scene.
   * This method proxies a call to ImageLoader.loadImage, but also tracks
   * image loading progress and invokes a re-render once complete.
   * @param {string} uri - The URI string of the image.
   * @return {Promise} - A Promise that resolves to the loaded Image.
   */
  loadImage(uri) {
    return this._load('loadImage', uri);
  }

};

const KeyDownEvent = 'keydown';
const KeyPressEvent = 'keypress';
const KeyUpEvent = 'keyup';
const DragEnterEvent = 'dragenter';
const DragLeaveEvent = 'dragleave';
const DragOverEvent = 'dragover';
const MouseDownEvent = 'mousedown';
const MouseUpEvent = 'mouseup';
const MouseMoveEvent = 'mousemove';
const MouseOutEvent = 'mouseout';
const MouseOverEvent = 'mouseover';
const ClickEvent = 'click';
const DoubleClickEvent = 'dblclick';
const WheelEvent = 'wheel';
const MouseWheelEvent = 'mousewheel';
const TouchStartEvent = 'touchstart';
const TouchMoveEvent = 'touchmove';
const TouchEndEvent = 'touchend';
const Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent];
const TooltipShowEvent = MouseMoveEvent;
const TooltipHideEvent = MouseOutEvent;
const HrefEvent = ClickEvent;

function CanvasHandler(loader, tooltip) {
  vega_scenegraph_module_Handler.call(this, loader, tooltip);
  this._down = null;
  this._touch = null;
  this._first = true;
  this._events = {};
}

const eventBundle = type => type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type]; // lazily add listeners to the canvas as needed


function eventListenerCheck(handler, type) {
  eventBundle(type).forEach(_ => addEventListener(handler, _));
}

function addEventListener(handler, type) {
  const canvas = handler.canvas();

  if (canvas && !handler._events[type]) {
    handler._events[type] = 1;
    canvas.addEventListener(type, handler[type] ? evt => handler[type](evt) : evt => handler.fire(type, evt));
  }
}

function move(moveEvent, overEvent, outEvent) {
  return function (evt) {
    const a = this._active,
          p = this.pickEvent(evt);

    if (p === a) {
      // active item and picked item are the same
      this.fire(moveEvent, evt); // fire move
    } else {
      // active item and picked item are different
      if (!a || !a.exit) {
        // fire out for prior active item
        // suppress if active item was removed from scene
        this.fire(outEvent, evt);
      }

      this._active = p; // set new active item

      this.fire(overEvent, evt); // fire over for new active item

      this.fire(moveEvent, evt); // fire move for new active item
    }
  };
}

function inactive(type) {
  return function (evt) {
    this.fire(type, evt);
    this._active = null;
  };
}

Object(vega_util_module["z" /* inherits */])(CanvasHandler, vega_scenegraph_module_Handler, {
  initialize(el, origin, obj) {
    this._canvas = el && domFind(el, 'canvas'); // add minimal events required for proper state management

    [ClickEvent, MouseDownEvent, MouseMoveEvent, MouseOutEvent, DragLeaveEvent].forEach(type => eventListenerCheck(this, type));
    return vega_scenegraph_module_Handler.prototype.initialize.call(this, el, origin, obj);
  },

  // return the backing canvas instance
  canvas() {
    return this._canvas;
  },

  // retrieve the current canvas context
  context() {
    return this._canvas.getContext('2d');
  },

  // supported events
  events: Events,

  // to keep old versions of firefox happy
  DOMMouseScroll(evt) {
    this.fire(MouseWheelEvent, evt);
  },

  mousemove: move(MouseMoveEvent, MouseOverEvent, MouseOutEvent),
  dragover: move(DragOverEvent, DragEnterEvent, DragLeaveEvent),
  mouseout: inactive(MouseOutEvent),
  dragleave: inactive(DragLeaveEvent),

  mousedown(evt) {
    this._down = this._active;
    this.fire(MouseDownEvent, evt);
  },

  click(evt) {
    if (this._down === this._active) {
      this.fire(ClickEvent, evt);
      this._down = null;
    }
  },

  touchstart(evt) {
    this._touch = this.pickEvent(evt.changedTouches[0]);

    if (this._first) {
      this._active = this._touch;
      this._first = false;
    }

    this.fire(TouchStartEvent, evt, true);
  },

  touchmove(evt) {
    this.fire(TouchMoveEvent, evt, true);
  },

  touchend(evt) {
    this.fire(TouchEndEvent, evt, true);
    this._touch = null;
  },

  // fire an event
  fire(type, evt, touch) {
    const a = touch ? this._touch : this._active,
          h = this._handlers[type]; // set event type relative to scenegraph items

    evt.vegaType = type; // handle hyperlinks and tooltips first

    if (type === HrefEvent && a && a.href) {
      this.handleHref(evt, a, a.href);
    } else if (type === TooltipShowEvent || type === TooltipHideEvent) {
      this.handleTooltip(evt, a, type !== TooltipHideEvent);
    } // invoke all registered handlers


    if (h) {
      for (let i = 0, len = h.length; i < len; ++i) {
        h[i].handler.call(this._obj, evt, a);
      }
    }
  },

  // add an event handler
  on(type, handler) {
    const name = this.eventName(type),
          h = this._handlers,
          i = this._handlerIndex(h[name], type, handler);

    if (i < 0) {
      eventListenerCheck(this, type);
      (h[name] || (h[name] = [])).push({
        type: type,
        handler: handler
      });
    }

    return this;
  },

  // remove an event handler
  off(type, handler) {
    const name = this.eventName(type),
          h = this._handlers[name],
          i = this._handlerIndex(h, type, handler);

    if (i >= 0) {
      h.splice(i, 1);
    }

    return this;
  },

  pickEvent(evt) {
    const p = vega_scenegraph_module_point(evt, this._canvas),
          o = this._origin;
    return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]);
  },

  // find the scenegraph item at the current mouse position
  // x, y -- the absolute x, y mouse coordinates on the canvas element
  // gx, gy -- the relative coordinates within the current group
  pick(scene, x, y, gx, gy) {
    const g = this.context(),
          mark = Marks[scene.marktype];
    return mark.pick.call(this, g, scene, x, y, gx, gy);
  }

});

function devicePixelRatio() {
  return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;
}

var pixelRatio = devicePixelRatio();
function resize (canvas, width, height, origin, scaleFactor, opt) {
  const inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null,
        context = canvas.getContext('2d'),
        ratio = inDOM ? pixelRatio : scaleFactor;
  canvas.width = width * ratio;
  canvas.height = height * ratio;

  for (const key in opt) {
    context[key] = opt[key];
  }

  if (inDOM && ratio !== 1) {
    canvas.style.width = width + 'px';
    canvas.style.height = height + 'px';
  }

  context.pixelRatio = ratio;
  context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]);
  return canvas;
}

function CanvasRenderer(loader) {
  vega_scenegraph_module_Renderer.call(this, loader);
  this._options = {};
  this._redraw = false;
  this._dirty = new Bounds();
  this._tempb = new Bounds();
}
const base$1 = vega_scenegraph_module_Renderer.prototype;

const vega_scenegraph_module_viewBounds = (origin, width, height) => new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]);

function clipToBounds(g, b, origin) {
  // expand bounds by 1 pixel, then round to pixel boundaries
  b.expand(1).round(); // align to base pixel grid in case of non-integer scaling (#2425)

  if (g.pixelRatio % 1) {
    b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio);
  } // to avoid artifacts translate if origin has fractional pixels


  b.translate(-(origin[0] % 1), -(origin[1] % 1)); // set clip path

  g.beginPath();
  g.rect(b.x1, b.y1, b.width(), b.height());
  g.clip();
  return b;
}

Object(vega_util_module["z" /* inherits */])(CanvasRenderer, vega_scenegraph_module_Renderer, {
  initialize(el, width, height, origin, scaleFactor, options) {
    this._options = options || {};
    this._canvas = this._options.externalContext ? null : domCanvas(1, 1, this._options.type); // instantiate a small canvas

    if (el && this._canvas) {
      domClear(el, 0).appendChild(this._canvas);

      this._canvas.setAttribute('class', 'marks');
    } // this method will invoke resize to size the canvas appropriately


    return base$1.initialize.call(this, el, width, height, origin, scaleFactor);
  },

  resize(width, height, origin, scaleFactor) {
    base$1.resize.call(this, width, height, origin, scaleFactor);

    if (this._canvas) {
      // configure canvas size and transform
      resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context);
    } else {
      // external context needs to be scaled and positioned to origin
      const ctx = this._options.externalContext;
      if (!ctx) Object(vega_util_module["o" /* error */])('CanvasRenderer is missing a valid canvas or context');
      ctx.scale(this._scale, this._scale);
      ctx.translate(this._origin[0], this._origin[1]);
    }

    this._redraw = true;
    return this;
  },

  canvas() {
    return this._canvas;
  },

  context() {
    return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null);
  },

  dirty(item) {
    const b = this._tempb.clear().union(item.bounds);

    let g = item.mark.group;

    while (g) {
      b.translate(g.x || 0, g.y || 0);
      g = g.mark.group;
    }

    this._dirty.union(b);
  },

  _render(scene) {
    const g = this.context(),
          o = this._origin,
          w = this._width,
          h = this._height,
          db = this._dirty,
          vb = vega_scenegraph_module_viewBounds(o, w, h); // setup

    g.save();
    const b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o);
    this.clear(-o[0], -o[1], w, h); // render

    this.draw(g, scene, b); // takedown

    g.restore();
    db.clear();
    return this;
  },

  draw(ctx, scene, bounds) {
    const mark = Marks[scene.marktype];
    if (scene.clip) vega_scenegraph_module_clip(ctx, scene);
    mark.draw.call(this, ctx, scene, bounds);
    if (scene.clip) ctx.restore();
  },

  clear(x, y, w, h) {
    const opt = this._options,
          g = this.context();

    if (opt.type !== 'pdf' && !opt.externalContext) {
      // calling clear rect voids vector output in pdf mode
      // and could remove external context content (#2615)
      g.clearRect(x, y, w, h);
    }

    if (this._bgcolor != null) {
      g.fillStyle = this._bgcolor;
      g.fillRect(x, y, w, h);
    }
  }

});

function SVGHandler(loader, tooltip) {
  vega_scenegraph_module_Handler.call(this, loader, tooltip);
  const h = this;
  h._hrefHandler = listener(h, (evt, item) => {
    if (item && item.href) h.handleHref(evt, item, item.href);
  });
  h._tooltipHandler = listener(h, (evt, item) => {
    h.handleTooltip(evt, item, evt.type !== TooltipHideEvent);
  });
} // wrap an event listener for the SVG DOM

const listener = (context, handler) => evt => {
  let item = evt.target.__data__;
  item = Array.isArray(item) ? item[0] : item;
  evt.vegaType = evt.type;
  handler.call(context._obj, evt, item);
};

Object(vega_util_module["z" /* inherits */])(SVGHandler, vega_scenegraph_module_Handler, {
  initialize(el, origin, obj) {
    let svg = this._svg;

    if (svg) {
      svg.removeEventListener(HrefEvent, this._hrefHandler);
      svg.removeEventListener(TooltipShowEvent, this._tooltipHandler);
      svg.removeEventListener(TooltipHideEvent, this._tooltipHandler);
    }

    this._svg = svg = el && domFind(el, 'svg');

    if (svg) {
      svg.addEventListener(HrefEvent, this._hrefHandler);
      svg.addEventListener(TooltipShowEvent, this._tooltipHandler);
      svg.addEventListener(TooltipHideEvent, this._tooltipHandler);
    }

    return vega_scenegraph_module_Handler.prototype.initialize.call(this, el, origin, obj);
  },

  canvas() {
    return this._svg;
  },

  // add an event handler
  on(type, handler) {
    const name = this.eventName(type),
          h = this._handlers,
          i = this._handlerIndex(h[name], type, handler);

    if (i < 0) {
      const x = {
        type,
        handler,
        listener: listener(this, handler)
      };
      (h[name] || (h[name] = [])).push(x);

      if (this._svg) {
        this._svg.addEventListener(name, x.listener);
      }
    }

    return this;
  },

  // remove an event handler
  off(type, handler) {
    const name = this.eventName(type),
          h = this._handlers[name],
          i = this._handlerIndex(h, type, handler);

    if (i >= 0) {
      if (this._svg) {
        this._svg.removeEventListener(name, h[i].listener);
      }

      h.splice(i, 1);
    }

    return this;
  }

});

const ARIA_HIDDEN = 'aria-hidden';
const ARIA_LABEL = 'aria-label';
const ARIA_ROLE = 'role';
const ARIA_ROLEDESCRIPTION = 'aria-roledescription';
const GRAPHICS_OBJECT = 'graphics-object';
const GRAPHICS_SYMBOL = 'graphics-symbol';

const vega_scenegraph_module_bundle = (role, roledesc, label) => ({
  [ARIA_ROLE]: role,
  [ARIA_ROLEDESCRIPTION]: roledesc,
  [ARIA_LABEL]: label || undefined
}); // these roles are covered by related roles
// we can ignore them, no need to generate attributes


const AriaIgnore = Object(vega_util_module["fb" /* toSet */])(['axis-domain', 'axis-grid', 'axis-label', 'axis-tick', 'axis-title', 'legend-band', 'legend-entry', 'legend-gradient', 'legend-label', 'legend-title', 'legend-symbol', 'title']); // aria attribute generators for guide roles

const AriaGuides = {
  'axis': {
    desc: 'axis',
    caption: axisCaption
  },
  'legend': {
    desc: 'legend',
    caption: legendCaption
  },
  'title-text': {
    desc: 'title',
    caption: item => `Title text '${titleCaption(item)}'`
  },
  'title-subtitle': {
    desc: 'subtitle',
    caption: item => `Subtitle text '${titleCaption(item)}'`
  }
}; // aria properties generated for mark item encoding channels

const AriaEncode = {
  ariaRole: ARIA_ROLE,
  ariaRoleDescription: ARIA_ROLEDESCRIPTION,
  description: ARIA_LABEL
};
function ariaItemAttributes(emit, item) {
  const hide = item.aria === false;
  emit(ARIA_HIDDEN, hide || undefined);

  if (hide || item.description == null) {
    for (const prop in AriaEncode) {
      emit(AriaEncode[prop], undefined);
    }
  } else {
    const type = item.mark.marktype;
    emit(ARIA_LABEL, item.description);
    emit(ARIA_ROLE, item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL));
    emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type} mark`);
  }
}
function ariaMarkAttributes(mark) {
  return mark.aria === false ? {
    [ARIA_HIDDEN]: true
  } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark);
}

function ariaMark(mark) {
  const type = mark.marktype;
  const recurse = type === 'group' || type === 'text' || mark.items.some(_ => _.description != null && _.aria !== false);
  return vega_scenegraph_module_bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type} mark container`, mark.description);
}

function ariaGuide(mark, opt) {
  try {
    const item = mark.items[0],
          caption = opt.caption || (() => '');

    return vega_scenegraph_module_bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item));
  } catch (err) {
    return null;
  }
}

function titleCaption(item) {
  return Object(vega_util_module["i" /* array */])(item.text).join(' ');
}

function axisCaption(item) {
  const datum = item.datum,
        orient = item.orient,
        title = datum.title ? extractTitle(item) : null,
        ctx = item.context,
        scale = ctx.scales[datum.scale].value,
        locale = ctx.dataflow.locale(),
        type = scale.type,
        xy = orient === 'left' || orient === 'right' ? 'Y' : 'X';
  return `${xy}-axis` + (title ? ` titled '${title}'` : '') + ` for a ${isDiscrete(type) ? 'discrete' : type} scale` + ` with ${domainCaption(locale, scale, item)}`;
}

function legendCaption(item) {
  const datum = item.datum,
        title = datum.title ? extractTitle(item) : null,
        type = `${datum.type || ''} legend`.trim(),
        scales = datum.scales,
        props = Object.keys(scales),
        ctx = item.context,
        scale = ctx.scales[scales[props[0]]].value,
        locale = ctx.dataflow.locale();
  return capitalize(type) + (title ? ` titled '${title}'` : '') + ` for ${channelCaption(props)}` + ` with ${domainCaption(locale, scale, item)}`;
}

function extractTitle(item) {
  try {
    return Object(vega_util_module["i" /* array */])(Object(vega_util_module["W" /* peek */])(item.items).items[0].text).join(' ');
  } catch (err) {
    return null;
  }
}

function channelCaption(props) {
  props = props.map(p => p + (p === 'fill' || p === 'stroke' ? ' color' : ''));
  return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + Object(vega_util_module["W" /* peek */])(props);
}

function capitalize(s) {
  return s.length ? s[0].toUpperCase() + s.slice(1) : s;
}

const innerText = val => (val + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');

const attrText = val => innerText(val).replace(/"/g, '&quot;').replace(/\t/g, '&#x9;').replace(/\n/g, '&#xA;').replace(/\r/g, '&#xD;');

function markup() {
  let buf = '',
      outer = '',
      inner = '';

  const stack = [],
        clear = () => outer = inner = '',
        push = tag => {
    if (outer) {
      buf += `${outer}>${inner}`;
      clear();
    }

    stack.push(tag);
  },
        attr = (name, value) => {
    if (value != null) outer += ` ${name}="${attrText(value)}"`;
    return m;
  },
        m = {
    open(tag, ...attrs) {
      push(tag);
      outer = '<' + tag;

      for (const set of attrs) {
        for (const key in set) attr(key, set[key]);
      }

      return m;
    },

    close() {
      const tag = stack.pop();

      if (outer) {
        buf += outer + (inner ? `>${inner}</${tag}>` : '/>');
      } else {
        buf += `</${tag}>`;
      }

      clear();
      return m;
    },

    attr,
    text: t => (inner += innerText(t), m),
    toString: () => buf
  };

  return m;
}
const serializeXML = node => _serialize(markup(), node) + '';

function _serialize(m, node) {
  m.open(node.tagName);

  if (node.hasAttributes()) {
    const attrs = node.attributes,
          n = attrs.length;

    for (let i = 0; i < n; ++i) {
      m.attr(attrs[i].name, attrs[i].value);
    }
  }

  if (node.hasChildNodes()) {
    const children = node.childNodes,
          n = children.length;

    for (let i = 0; i < n; i++) {
      const child = children[i];
      child.nodeType === 3 // text node
      ? m.text(child.nodeValue) : _serialize(m, child);
    }
  }

  return m.close();
}

const vega_scenegraph_module_styles = {
  fill: 'fill',
  fillOpacity: 'fill-opacity',
  stroke: 'stroke',
  strokeOpacity: 'stroke-opacity',
  strokeWidth: 'stroke-width',
  strokeCap: 'stroke-linecap',
  strokeJoin: 'stroke-linejoin',
  strokeDash: 'stroke-dasharray',
  strokeDashOffset: 'stroke-dashoffset',
  strokeMiterLimit: 'stroke-miterlimit',
  opacity: 'opacity',
  blend: 'mix-blend-mode'
}; // ensure miter limit default is consistent with canvas (#2498)

const rootAttributes = {
  'fill': 'none',
  'stroke-miterlimit': 10
};

const RootIndex = 0,
      xmlns = 'http://www.w3.org/2000/xmlns/',
      svgns = vega_scenegraph_module_metadata.xmlns;
function SVGRenderer(loader) {
  vega_scenegraph_module_Renderer.call(this, loader);
  this._dirtyID = 0;
  this._dirty = [];
  this._svg = null;
  this._root = null;
  this._defs = null;
}
const vega_scenegraph_module_base = vega_scenegraph_module_Renderer.prototype;
Object(vega_util_module["z" /* inherits */])(SVGRenderer, vega_scenegraph_module_Renderer, {
  /**
   * Initialize a new SVGRenderer instance.
   * @param {DOMElement} el - The containing DOM element for the display.
   * @param {number} width - The coordinate width of the display, in pixels.
   * @param {number} height - The coordinate height of the display, in pixels.
   * @param {Array<number>} origin - The origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply
   *   the width and height to determine the final pixel size.
   * @return {SVGRenderer} - This renderer instance.
   */
  initialize(el, width, height, origin, scaleFactor) {
    // create the svg definitions cache
    this._defs = {};

    this._clearDefs();

    if (el) {
      this._svg = domChild(el, 0, 'svg', svgns);

      this._svg.setAttributeNS(xmlns, 'xmlns', svgns);

      this._svg.setAttributeNS(xmlns, 'xmlns:xlink', vega_scenegraph_module_metadata['xmlns:xlink']);

      this._svg.setAttribute('version', vega_scenegraph_module_metadata['version']);

      this._svg.setAttribute('class', 'marks');

      domClear(el, 1); // set the svg root group

      this._root = domChild(this._svg, RootIndex, 'g', svgns);
      setAttributes(this._root, rootAttributes); // ensure no additional child elements

      domClear(this._svg, RootIndex + 1);
    } // set background color if defined


    this.background(this._bgcolor);
    return vega_scenegraph_module_base.initialize.call(this, el, width, height, origin, scaleFactor);
  },

  /**
   * Get / set the background color.
   */
  background(bgcolor) {
    if (arguments.length && this._svg) {
      this._svg.style.setProperty('background-color', bgcolor);
    }

    return vega_scenegraph_module_base.background.apply(this, arguments);
  },

  /**
   * Resize the display.
   * @param {number} width - The new coordinate width of the display, in pixels.
   * @param {number} height - The new coordinate height of the display, in pixels.
   * @param {Array<number>} origin - The new origin of the display, in pixels.
   *   The coordinate system will be translated to this point.
   * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply
   *   the width and height to determine the final pixel size.
   * @return {SVGRenderer} - This renderer instance;
   */
  resize(width, height, origin, scaleFactor) {
    vega_scenegraph_module_base.resize.call(this, width, height, origin, scaleFactor);

    if (this._svg) {
      setAttributes(this._svg, {
        width: this._width * this._scale,
        height: this._height * this._scale,
        viewBox: `0 0 ${this._width} ${this._height}`
      });

      this._root.setAttribute('transform', `translate(${this._origin})`);
    }

    this._dirty = [];
    return this;
  },

  /**
   * Returns the SVG element of the visualization.
   * @return {DOMElement} - The SVG element.
   */
  canvas() {
    return this._svg;
  },

  /**
   * Returns an SVG text string for the rendered content,
   * or null if this renderer is currently headless.
   */
  svg() {
    const svg = this._svg,
          bg = this._bgcolor;
    if (!svg) return null;
    let node;

    if (bg) {
      svg.removeAttribute('style');
      node = domChild(svg, RootIndex, 'rect', svgns);
      setAttributes(node, {
        width: this._width,
        height: this._height,
        fill: bg
      });
    }

    const text = serializeXML(svg);

    if (bg) {
      svg.removeChild(node);

      this._svg.style.setProperty('background-color', bg);
    }

    return text;
  },

  /**
   * Internal rendering method.
   * @param {object} scene - The root mark of a scenegraph to render.
   */
  _render(scene) {
    // perform spot updates and re-render markup
    if (this._dirtyCheck()) {
      if (this._dirtyAll) this._clearDefs();
      this.mark(this._root, scene);
      domClear(this._root, 1);
    }

    this.defs();
    this._dirty = [];
    ++this._dirtyID;
    return this;
  },

  // -- Manage rendering of items marked as dirty --

  /**
   * Flag a mark item as dirty.
   * @param {Item} item - The mark item.
   */
  dirty(item) {
    if (item.dirty !== this._dirtyID) {
      item.dirty = this._dirtyID;

      this._dirty.push(item);
    }
  },

  /**
   * Check if a mark item is considered dirty.
   * @param {Item} item - The mark item.
   */
  isDirty(item) {
    return this._dirtyAll || !item._svg || item.dirty === this._dirtyID;
  },

  /**
   * Internal method to check dirty status and, if possible,
   * make targetted updates without a full rendering pass.
   */
  _dirtyCheck() {
    this._dirtyAll = true;
    const items = this._dirty;
    if (!items.length || !this._dirtyID) return true;
    const id = ++this._dirtyID;
    let item, mark, type, mdef, i, n, o;

    for (i = 0, n = items.length; i < n; ++i) {
      item = items[i];
      mark = item.mark;

      if (mark.marktype !== type) {
        // memoize mark instance lookup
        type = mark.marktype;
        mdef = Marks[type];
      }

      if (mark.zdirty && mark.dirty !== id) {
        this._dirtyAll = false;
        dirtyParents(item, id);
        mark.items.forEach(i => {
          i.dirty = id;
        });
      }

      if (mark.zdirty) continue; // handle in standard drawing pass

      if (item.exit) {
        // EXIT
        if (mdef.nested && mark.items.length) {
          // if nested mark with remaining points, update instead
          o = mark.items[0];
          if (o._svg) this._update(mdef, o._svg, o);
        } else if (item._svg) {
          // otherwise remove from DOM
          o = item._svg.parentNode;
          if (o) o.removeChild(item._svg);
        }

        item._svg = null;
        continue;
      }

      item = mdef.nested ? mark.items[0] : item;
      if (item._update === id) continue; // already visited

      if (!item._svg || !item._svg.ownerSVGElement) {
        // ENTER
        this._dirtyAll = false;
        dirtyParents(item, id);
      } else {
        // IN-PLACE UPDATE
        this._update(mdef, item._svg, item);
      }

      item._update = id;
    }

    return !this._dirtyAll;
  },

  // -- Construct & maintain scenegraph to SVG mapping ---

  /**
   * Render a set of mark items.
   * @param {SVGElement} el - The parent element in the SVG tree.
   * @param {object} scene - The mark parent to render.
   * @param {SVGElement} prev - The previous sibling in the SVG tree.
   */
  mark(el, scene, prev) {
    if (!this.isDirty(scene)) return scene._svg;
    const svg = this._svg,
          mdef = Marks[scene.marktype],
          events = scene.interactive === false ? 'none' : null,
          isGroup = mdef.tag === 'g';
    let sibling = null,
        i = 0;
    const parent = vega_scenegraph_module_bind(scene, el, prev, 'g', svg);
    parent.setAttribute('class', cssClass(scene)); // apply aria attributes to parent container element

    const aria = ariaMarkAttributes(scene);

    for (const key in aria) setAttribute(parent, key, aria[key]);

    if (!isGroup) {
      setAttribute(parent, 'pointer-events', events);
    }

    setAttribute(parent, 'clip-path', scene.clip ? clip$1(this, scene, scene.group) : null);

    const process = item => {
      const dirty = this.isDirty(item),
            node = vega_scenegraph_module_bind(item, parent, sibling, mdef.tag, svg);

      if (dirty) {
        this._update(mdef, node, item);

        if (isGroup) vega_scenegraph_module_recurse(this, node, item);
      }

      sibling = node;
      ++i;
    };

    if (mdef.nested) {
      if (scene.items.length) process(scene.items[0]);
    } else {
      vega_scenegraph_module_visit(scene, process);
    }

    domClear(parent, i);
    return parent;
  },

  /**
   * Update the attributes of an SVG element for a mark item.
   * @param {object} mdef - The mark definition object
   * @param {SVGElement} el - The SVG element.
   * @param {Item} item - The mark item.
   */
  _update(mdef, el, item) {
    // set dom element and values cache
    // provides access to emit method
    vega_scenegraph_module_element = el;
    vega_scenegraph_module_values = el.__values__; // apply aria-specific properties

    ariaItemAttributes(emit, item); // apply svg attributes

    mdef.attr(emit, item, this); // some marks need special treatment

    const extra = mark_extras[mdef.type];
    if (extra) extra.call(this, mdef, el, item); // apply svg style attributes
    // note: element state may have been modified by 'extra' method

    if (vega_scenegraph_module_element) this.style(vega_scenegraph_module_element, item);
  },

  /**
   * Update the presentation attributes of an SVG element for a mark item.
   * @param {SVGElement} el - The SVG element.
   * @param {Item} item - The mark item.
   */
  style(el, item) {
    if (item == null) return;

    for (const prop in vega_scenegraph_module_styles) {
      let value = prop === 'font' ? fontFamily(item) : item[prop];
      if (value === vega_scenegraph_module_values[prop]) continue;
      const name = vega_scenegraph_module_styles[prop];

      if (value == null) {
        el.removeAttribute(name);
      } else {
        if (isGradient(value)) {
          value = gradientRef(value, this._defs.gradient, vega_scenegraph_module_href());
        }

        el.setAttribute(name, value + '');
      }

      vega_scenegraph_module_values[prop] = value;
    }
  },

  /**
   * Render SVG defs, as needed.
   * Must be called *after* marks have been processed to ensure the
   * collected state is current and accurate.
   */
  defs() {
    const svg = this._svg,
          defs = this._defs;
    let el = defs.el,
        index = 0;

    for (const id in defs.gradient) {
      if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns);
      index = updateGradient(el, defs.gradient[id], index);
    }

    for (const id in defs.clipping) {
      if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns);
      index = updateClipping(el, defs.clipping[id], index);
    } // clean-up


    if (el) {
      index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index);
    }
  },

  /**
   * Clear defs caches.
   */
  _clearDefs() {
    const def = this._defs;
    def.gradient = {};
    def.clipping = {};
  }

}); // mark ancestor chain with a dirty id

function dirtyParents(item, id) {
  for (; item && item.dirty !== id; item = item.mark.group) {
    item.dirty = id;

    if (item.mark && item.mark.dirty !== id) {
      item.mark.dirty = id;
    } else return;
  }
} // update gradient definitions


function updateGradient(el, grad, index) {
  let i, n, stop;

  if (grad.gradient === 'radial') {
    // SVG radial gradients automatically transform to normalized bbox
    // coordinates, in a way that is cumbersome to replicate in canvas.
    // We wrap the radial gradient in a pattern element, allowing us to
    // maintain a circular gradient that matches what canvas provides.
    let pt = domChild(el, index++, 'pattern', svgns);
    setAttributes(pt, {
      id: patternPrefix + grad.id,
      viewBox: '0,0,1,1',
      width: '100%',
      height: '100%',
      preserveAspectRatio: 'xMidYMid slice'
    });
    pt = domChild(pt, 0, 'rect', svgns);
    setAttributes(pt, {
      width: 1,
      height: 1,
      fill: `url(${vega_scenegraph_module_href()}#${grad.id})`
    });
    el = domChild(el, index++, 'radialGradient', svgns);
    setAttributes(el, {
      id: grad.id,
      fx: grad.x1,
      fy: grad.y1,
      fr: grad.r1,
      cx: grad.x2,
      cy: grad.y2,
      r: grad.r2
    });
  } else {
    el = domChild(el, index++, 'linearGradient', svgns);
    setAttributes(el, {
      id: grad.id,
      x1: grad.x1,
      x2: grad.x2,
      y1: grad.y1,
      y2: grad.y2
    });
  }

  for (i = 0, n = grad.stops.length; i < n; ++i) {
    stop = domChild(el, i, 'stop', svgns);
    stop.setAttribute('offset', grad.stops[i].offset);
    stop.setAttribute('stop-color', grad.stops[i].color);
  }

  domClear(el, i);
  return index;
} // update clipping path definitions


function updateClipping(el, clip, index) {
  let mask;
  el = domChild(el, index, 'clipPath', svgns);
  el.setAttribute('id', clip.id);

  if (clip.path) {
    mask = domChild(el, 0, 'path', svgns);
    mask.setAttribute('d', clip.path);
  } else {
    mask = domChild(el, 0, 'rect', svgns);
    setAttributes(mask, {
      x: 0,
      y: 0,
      width: clip.width,
      height: clip.height
    });
  }

  domClear(el, 1);
  return index + 1;
} // Recursively process group contents.


function vega_scenegraph_module_recurse(renderer, el, group) {
  el = el.lastChild.previousSibling;
  let prev,
      idx = 0;
  vega_scenegraph_module_visit(group, item => {
    prev = renderer.mark(el, item, prev);
    ++idx;
  }); // remove any extraneous DOM elements

  domClear(el, 1 + idx);
} // Bind a scenegraph item to an SVG DOM element.
// Create new SVG elements as needed.


function vega_scenegraph_module_bind(item, el, sibling, tag, svg) {
  let node = item._svg,
      doc; // create a new dom node if needed

  if (!node) {
    doc = el.ownerDocument;
    node = domCreate(doc, tag, svgns);
    item._svg = node;

    if (item.mark) {
      node.__data__ = item;
      node.__values__ = {
        fill: 'default'
      }; // if group, create background, content, and foreground elements

      if (tag === 'g') {
        const bg = domCreate(doc, 'path', svgns);
        node.appendChild(bg);
        bg.__data__ = item;
        const cg = domCreate(doc, 'g', svgns);
        node.appendChild(cg);
        cg.__data__ = item;
        const fg = domCreate(doc, 'path', svgns);
        node.appendChild(fg);
        fg.__data__ = item;
        fg.__values__ = {
          fill: 'default'
        };
      }
    }
  } // (re-)insert if (a) not contained in SVG or (b) sibling order has changed


  if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) {
    el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild);
  }

  return node;
} // check if two nodes are ordered siblings


function siblingCheck(node, sibling) {
  return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same
} // -- Set attributes & styles on SVG elements ---


let vega_scenegraph_module_element = null,
    // temp var for current SVG element
vega_scenegraph_module_values = null; // temp var for current values hash
// Extra configuration for certain mark types

const mark_extras = {
  group(mdef, el, item) {
    const fg = vega_scenegraph_module_element = el.childNodes[2];
    vega_scenegraph_module_values = fg.__values__;
    mdef.foreground(emit, item, this);
    vega_scenegraph_module_values = el.__values__; // use parent's values hash

    vega_scenegraph_module_element = el.childNodes[1];
    mdef.content(emit, item, this);
    const bg = vega_scenegraph_module_element = el.childNodes[0];
    mdef.background(emit, item, this);
    const value = item.mark.interactive === false ? 'none' : null;

    if (value !== vega_scenegraph_module_values.events) {
      setAttribute(fg, 'pointer-events', value);
      setAttribute(bg, 'pointer-events', value);
      vega_scenegraph_module_values.events = value;
    }

    if (item.strokeForeground && item.stroke) {
      const fill = item.fill;
      setAttribute(fg, 'display', null); // set style of background

      this.style(bg, item);
      setAttribute(bg, 'stroke', null); // set style of foreground

      if (fill) item.fill = null;
      vega_scenegraph_module_values = fg.__values__;
      this.style(fg, item);
      if (fill) item.fill = fill; // leave element null to prevent downstream styling

      vega_scenegraph_module_element = null;
    } else {
      // ensure foreground is ignored
      setAttribute(fg, 'display', 'none');
    }
  },

  image(mdef, el, item) {
    if (item.smooth === false) {
      setStyle(el, 'image-rendering', 'optimizeSpeed');
      setStyle(el, 'image-rendering', 'pixelated');
    } else {
      setStyle(el, 'image-rendering', null);
    }
  },

  text(mdef, el, item) {
    const tl = textLines(item);
    let key, value, doc, lh;

    if (Object(vega_util_module["B" /* isArray */])(tl)) {
      // multi-line text
      value = tl.map(_ => textValue(item, _));
      key = value.join('\n'); // content cache key

      if (key !== vega_scenegraph_module_values.text) {
        domClear(el, 0);
        doc = el.ownerDocument;
        lh = lineHeight(item);
        value.forEach((t, i) => {
          const ts = domCreate(doc, 'tspan', svgns);
          ts.__data__ = item; // data binding

          ts.textContent = t;

          if (i) {
            ts.setAttribute('x', 0);
            ts.setAttribute('dy', lh);
          }

          el.appendChild(ts);
        });
        vega_scenegraph_module_values.text = key;
      }
    } else {
      // single-line text
      value = textValue(item, tl);

      if (value !== vega_scenegraph_module_values.text) {
        el.textContent = value;
        vega_scenegraph_module_values.text = value;
      }
    }

    setAttribute(el, 'font-family', fontFamily(item));
    setAttribute(el, 'font-size', vega_scenegraph_module_fontSize(item) + 'px');
    setAttribute(el, 'font-style', item.fontStyle);
    setAttribute(el, 'font-variant', item.fontVariant);
    setAttribute(el, 'font-weight', item.fontWeight);
  }

};

function emit(name, value, ns) {
  // early exit if value is unchanged
  if (value === vega_scenegraph_module_values[name]) return; // use appropriate method given namespace (ns)

  if (ns) {
    setAttributeNS(vega_scenegraph_module_element, name, value, ns);
  } else {
    setAttribute(vega_scenegraph_module_element, name, value);
  } // note current value for future comparison


  vega_scenegraph_module_values[name] = value;
}

function setStyle(el, name, value) {
  if (value !== vega_scenegraph_module_values[name]) {
    if (value == null) {
      el.style.removeProperty(name);
    } else {
      el.style.setProperty(name, value + '');
    }

    vega_scenegraph_module_values[name] = value;
  }
}

function setAttributes(el, attrs) {
  for (const key in attrs) {
    setAttribute(el, key, attrs[key]);
  }
}

function setAttribute(el, name, value) {
  if (value != null) {
    // if value is provided, update DOM attribute
    el.setAttribute(name, value);
  } else {
    // else remove DOM attribute
    el.removeAttribute(name);
  }
}

function setAttributeNS(el, name, value, ns) {
  if (value != null) {
    // if value is provided, update DOM attribute
    el.setAttributeNS(ns, name, value);
  } else {
    // else remove DOM attribute
    el.removeAttributeNS(ns, name);
  }
}

function vega_scenegraph_module_href() {
  let loc;
  return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href;
}

function SVGStringRenderer(loader) {
  vega_scenegraph_module_Renderer.call(this, loader);
  this._text = null;
  this._defs = {
    gradient: {},
    clipping: {}
  };
}
Object(vega_util_module["z" /* inherits */])(SVGStringRenderer, vega_scenegraph_module_Renderer, {
  /**
   * Returns the rendered SVG text string,
   * or null if rendering has not yet occurred.
   */
  svg() {
    return this._text;
  },

  /**
   * Internal rendering method.
   * @param {object} scene - The root mark of a scenegraph to render.
   */
  _render(scene) {
    const m = markup(); // svg tag

    m.open('svg', Object(vega_util_module["p" /* extend */])({}, vega_scenegraph_module_metadata, {
      class: 'marks',
      width: this._width * this._scale,
      height: this._height * this._scale,
      viewBox: `0 0 ${this._width} ${this._height}`
    })); // background, if defined

    const bg = this._bgcolor;

    if (bg && bg !== 'transparent' && bg !== 'none') {
      m.open('rect', {
        width: this._width,
        height: this._height,
        fill: bg
      }).close();
    } // root content group


    m.open('g', rootAttributes, {
      transform: 'translate(' + this._origin + ')'
    });
    this.mark(m, scene);
    m.close(); // </g>
    // defs

    this.defs(m); // get SVG text string

    this._text = m.close() + '';
    return this;
  },

  /**
   * Render a set of mark items.
   * @param {object} m - The markup context.
   * @param {object} scene - The mark parent to render.
   */
  mark(m, scene) {
    const mdef = Marks[scene.marktype],
          tag = mdef.tag,
          attrList = [ariaItemAttributes, mdef.attr]; // render opening group tag

    m.open('g', {
      'class': cssClass(scene),
      'clip-path': scene.clip ? clip$1(this, scene, scene.group) : null
    }, ariaMarkAttributes(scene), {
      'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null
    }); // render contained elements

    const process = item => {
      const href = this.href(item);
      if (href) m.open('a', href);
      m.open(tag, this.attr(scene, item, attrList, tag !== 'g' ? tag : null));

      if (tag === 'text') {
        const tl = textLines(item);

        if (Object(vega_util_module["B" /* isArray */])(tl)) {
          // multi-line text
          const attrs = {
            x: 0,
            dy: lineHeight(item)
          };

          for (let i = 0; i < tl.length; ++i) {
            m.open('tspan', i ? attrs : null).text(textValue(item, tl[i])).close();
          }
        } else {
          // single-line text
          m.text(textValue(item, tl));
        }
      } else if (tag === 'g') {
        const fore = item.strokeForeground,
              fill = item.fill,
              stroke = item.stroke;

        if (fore && stroke) {
          item.stroke = null;
        }

        m.open('path', this.attr(scene, item, mdef.background, 'bgrect')).close(); // recurse for group content

        m.open('g', this.attr(scene, item, mdef.content));
        vega_scenegraph_module_visit(item, scene => this.mark(m, scene));
        m.close();

        if (fore && stroke) {
          if (fill) item.fill = null;
          item.stroke = stroke;
          m.open('path', this.attr(scene, item, mdef.foreground, 'bgrect')).close();
          if (fill) item.fill = fill;
        } else {
          m.open('path', this.attr(scene, item, mdef.foreground, 'bgfore')).close();
        }
      }

      m.close(); // </tag>

      if (href) m.close(); // </a>
    };

    if (mdef.nested) {
      if (scene.items && scene.items.length) process(scene.items[0]);
    } else {
      vega_scenegraph_module_visit(scene, process);
    } // render closing group tag


    return m.close(); // </g>
  },

  /**
   * Get href attributes for a hyperlinked mark item.
   * @param {Item} item - The mark item.
   */
  href(item) {
    const href = item.href;
    let attr;

    if (href) {
      if (attr = this._hrefs && this._hrefs[href]) {
        return attr;
      } else {
        this.sanitizeURL(href).then(attr => {
          // rewrite to use xlink namespace
          attr['xlink:href'] = attr.href;
          attr.href = null;
          (this._hrefs || (this._hrefs = {}))[href] = attr;
        });
      }
    }

    return null;
  },

  /**
   * Get an object of SVG attributes for a mark item.
   * @param {object} scene - The mark parent.
   * @param {Item} item - The mark item.
   * @param {array|function} attrs - One or more attribute emitters.
   * @param {string} tag - The tag being rendered.
   */
  attr(scene, item, attrs, tag) {
    const object = {},
          emit = (name, value, ns, prefixed) => {
      object[prefixed || name] = value;
    }; // apply mark specific attributes


    if (Array.isArray(attrs)) {
      attrs.forEach(fn => fn(emit, item, this));
    } else {
      attrs(emit, item, this);
    } // apply style attributes


    if (tag) {
      vega_scenegraph_module_style(object, item, scene, tag, this._defs);
    }

    return object;
  },

  /**
   * Render SVG defs, as needed.
   * Must be called *after* marks have been processed to ensure the
   * collected state is current and accurate.
   * @param {object} m - The markup context.
   */
  defs(m) {
    const gradient = this._defs.gradient,
          clipping = this._defs.clipping,
          count = Object.keys(gradient).length + Object.keys(clipping).length;
    if (count === 0) return; // nothing to do

    m.open('defs');

    for (const id in gradient) {
      const def = gradient[id],
            stops = def.stops;

      if (def.gradient === 'radial') {
        // SVG radial gradients automatically transform to normalized bbox
        // coordinates, in a way that is cumbersome to replicate in canvas.
        // We wrap the radial gradient in a pattern element, allowing us to
        // maintain a circular gradient that matches what canvas provides.
        m.open('pattern', {
          id: patternPrefix + id,
          viewBox: '0,0,1,1',
          width: '100%',
          height: '100%',
          preserveAspectRatio: 'xMidYMid slice'
        });
        m.open('rect', {
          width: '1',
          height: '1',
          fill: 'url(#' + id + ')'
        }).close();
        m.close(); // </pattern>

        m.open('radialGradient', {
          id: id,
          fx: def.x1,
          fy: def.y1,
          fr: def.r1,
          cx: def.x2,
          cy: def.y2,
          r: def.r2
        });
      } else {
        m.open('linearGradient', {
          id: id,
          x1: def.x1,
          x2: def.x2,
          y1: def.y1,
          y2: def.y2
        });
      }

      for (let i = 0; i < stops.length; ++i) {
        m.open('stop', {
          offset: stops[i].offset,
          'stop-color': stops[i].color
        }).close();
      }

      m.close();
    }

    for (const id in clipping) {
      const def = clipping[id];
      m.open('clipPath', {
        id: id
      });

      if (def.path) {
        m.open('path', {
          d: def.path
        }).close();
      } else {
        m.open('rect', {
          x: 0,
          y: 0,
          width: def.width,
          height: def.height
        }).close();
      }

      m.close();
    }

    m.close();
  }

}); // Helper function for attr for style presentation attributes

function vega_scenegraph_module_style(s, item, scene, tag, defs) {
  if (item == null) return s;

  if (tag === 'bgrect' && scene.interactive === false) {
    s['pointer-events'] = 'none';
  }

  if (tag === 'bgfore') {
    if (scene.interactive === false) {
      s['pointer-events'] = 'none';
    }

    s.display = 'none';
    if (item.fill !== null) return s;
  }

  if (tag === 'image' && item.smooth === false) {
    s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;';
  }

  if (tag === 'text') {
    s['font-family'] = fontFamily(item);
    s['font-size'] = vega_scenegraph_module_fontSize(item) + 'px';
    s['font-style'] = item.fontStyle;
    s['font-variant'] = item.fontVariant;
    s['font-weight'] = item.fontWeight;
  }

  for (const prop in vega_scenegraph_module_styles) {
    let value = item[prop];
    const name = vega_scenegraph_module_styles[prop];

    if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; else if (value != null) {
      if (isGradient(value)) {
        value = gradientRef(value, defs.gradient, '');
      }

      s[name] = value;
    }
  }

  return s;
}

const Canvas = 'canvas';
const PNG = 'png';
const SVG = 'svg';
const None = 'none';
const RenderType = {
  Canvas: Canvas,
  PNG: PNG,
  SVG: SVG,
  None: None
};
const modules = {};
modules[Canvas] = modules[PNG] = {
  renderer: CanvasRenderer,
  headless: CanvasRenderer,
  handler: CanvasHandler
};
modules[SVG] = {
  renderer: SVGRenderer,
  headless: SVGStringRenderer,
  handler: SVGHandler
};
modules[None] = {};
function renderModule(name, _) {
  name = String(name || '').toLowerCase();

  if (arguments.length > 1) {
    modules[name] = _;
    return this;
  } else {
    return modules[name];
  }
}

function vega_scenegraph_module_intersect(scene, bounds, filter) {
  const hits = [],
        // intersection results
  box = new Bounds().union(bounds),
        // defensive copy
  type = scene.marktype;
  return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : Object(vega_util_module["o" /* error */])('Intersect scene must be mark node or group item.');
}

function intersectMark(mark, box, filter, hits) {
  if (visitMark(mark, box, filter)) {
    const items = mark.items,
          type = mark.marktype,
          n = items.length;
    let i = 0;

    if (type === 'group') {
      for (; i < n; ++i) {
        intersectGroup(items[i], box, filter, hits);
      }
    } else {
      for (const test = Marks[type].isect; i < n; ++i) {
        const item = items[i];
        if (intersectItem(item, box, test)) hits.push(item);
      }
    }
  }

  return hits;
}

function visitMark(mark, box, filter) {
  // process if bounds intersect and if
  // (1) mark is a group mark (so we must recurse), or
  // (2) mark is interactive and passes filter
  return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark)));
}

function intersectGroup(group, box, filter, hits) {
  // test intersect against group
  // skip groups by default unless filter says otherwise
  if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) {
    hits.push(group);
  } // recursively test children marks
  // translate box to group coordinate space


  const marks = group.items,
        n = marks && marks.length;

  if (n) {
    const x = group.x || 0,
          y = group.y || 0;
    box.translate(-x, -y);

    for (let i = 0; i < n; ++i) {
      intersectMark(marks[i], box, filter, hits);
    }

    box.translate(x, y);
  }

  return hits;
}

function intersectItem(item, box, test) {
  // test bounds enclosure, bounds intersection, then detailed test
  const bounds = item.bounds;
  return box.encloses(bounds) || box.intersects(bounds) && test(item, box);
}

const clipBounds = new Bounds();
function boundClip (mark) {
  const clip = mark.clip;

  if (Object(vega_util_module["E" /* isFunction */])(clip)) {
    clip(boundContext(clipBounds.clear()));
  } else if (clip) {
    clipBounds.set(0, 0, mark.group.width, mark.group.height);
  } else return;

  mark.bounds.intersect(clipBounds);
}

const TOLERANCE = 1e-9;
function sceneEqual(a, b, key) {
  return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : Object(vega_util_module["G" /* isNumber */])(a) && Object(vega_util_module["G" /* isNumber */])(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !Object(vega_util_module["H" /* isObject */])(a) && !Object(vega_util_module["H" /* isObject */])(b) ? a == b : objectEqual(a, b);
}
function pathEqual(a, b) {
  return sceneEqual(pathParse(a), pathParse(b));
}

function objectEqual(a, b) {
  var ka = Object.keys(a),
      kb = Object.keys(b),
      key,
      i;
  if (ka.length !== kb.length) return false;
  ka.sort();
  kb.sort();

  for (i = ka.length - 1; i >= 0; i--) {
    if (ka[i] != kb[i]) return false;
  }

  for (i = ka.length - 1; i >= 0; i--) {
    key = ka[i];
    if (!sceneEqual(a[key], b[key], key)) return false;
  }

  return typeof a === typeof b;
}

function resetSVGDefIds() {
  resetSVGClipId();
  resetSVGGradientId();
}



// CONCATENATED MODULE: ./node_modules/vega-view-transforms/build/vega-view-transforms.module.js




const Top = 'top';
const Left = 'left';
const Right = 'right';
const Bottom = 'bottom';
const TopLeft = 'top-left';
const TopRight = 'top-right';
const BottomLeft = 'bottom-left';
const BottomRight = 'bottom-right';
const Start = 'start';
const Middle = 'middle';
const End = 'end';
const vega_view_transforms_module_X = 'x';
const vega_view_transforms_module_Y = 'y';
const Group = 'group';
const AxisRole = 'axis';
const TitleRole = 'title';
const FrameRole = 'frame';
const ScopeRole = 'scope';
const LegendRole = 'legend';
const RowHeader = 'row-header';
const RowFooter = 'row-footer';
const RowTitle = 'row-title';
const ColHeader = 'column-header';
const ColFooter = 'column-footer';
const ColTitle = 'column-title';
const Padding = 'padding';
const Symbols = 'symbol';
const Fit = 'fit';
const FitX = 'fit-x';
const FitY = 'fit-y';
const Pad = 'pad';
const vega_view_transforms_module_None = 'none';
const All = 'all';
const Each = 'each';
const Flush = 'flush';
const Column = 'column';
const Row = 'row';

/**
 * Calculate bounding boxes for scenegraph items.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {object} params.mark - The scenegraph mark instance to bound.
 */

function Bound(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(Bound, Transform, {
  transform(_, pulse) {
    const view = pulse.dataflow,
          mark = _.mark,
          type = mark.marktype,
          entry = Marks[type],
          bound = entry.bound;
    let markBounds = mark.bounds,
        rebound;

    if (entry.nested) {
      // multi-item marks have a single bounds instance
      if (mark.items.length) view.dirty(mark.items[0]);
      markBounds = vega_view_transforms_module_boundItem(mark, bound);
      mark.items.forEach(item => {
        item.bounds.clear().union(markBounds);
      });
    } else if (type === Group || _.modified()) {
      // operator parameters modified -> re-bound all items
      // updates group bounds in response to modified group content
      pulse.visit(pulse.MOD, item => view.dirty(item));
      markBounds.clear();
      mark.items.forEach(item => markBounds.union(vega_view_transforms_module_boundItem(item, bound))); // force reflow for axes/legends/titles to propagate any layout changes

      switch (mark.role) {
        case AxisRole:
        case LegendRole:
        case TitleRole:
          pulse.reflow();
      }
    } else {
      // incrementally update bounds, re-bound mark as needed
      rebound = pulse.changed(pulse.REM);
      pulse.visit(pulse.ADD, item => {
        markBounds.union(vega_view_transforms_module_boundItem(item, bound));
      });
      pulse.visit(pulse.MOD, item => {
        rebound = rebound || markBounds.alignsWith(item.bounds);
        view.dirty(item);
        markBounds.union(vega_view_transforms_module_boundItem(item, bound));
      });

      if (rebound) {
        markBounds.clear();
        mark.items.forEach(item => markBounds.union(item.bounds));
      }
    } // ensure mark bounds do not exceed any clipping region


    boundClip(mark);
    return pulse.modifies('bounds');
  }

});

function vega_view_transforms_module_boundItem(item, bound, opt) {
  return bound(item.bounds.clear(), item, opt);
}

const COUNTER_NAME = ':vega_identifier:';
/**
 * Adds a unique identifier to all added tuples.
 * This transform creates a new signal that serves as an id counter.
 * As a result, the id counter is shared across all instances of this
 * transform, generating unique ids across multiple data streams. In
 * addition, this signal value can be included in a snapshot of the
 * dataflow state, enabling correct resumption of id allocation.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {string} params.as - The field name for the generated identifier.
 */

function vega_view_transforms_module_Identifier(params) {
  Transform.call(this, 0, params);
}
vega_view_transforms_module_Identifier.Definition = {
  'type': 'Identifier',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'as',
    'type': 'string',
    'required': true
  }]
};
Object(vega_util_module["z" /* inherits */])(vega_view_transforms_module_Identifier, Transform, {
  transform(_, pulse) {
    const counter = getCounter(pulse.dataflow),
          as = _.as;
    let id = counter.value;
    pulse.visit(pulse.ADD, t => t[as] = t[as] || ++id);
    counter.set(this.value = id);
    return pulse;
  }

});

function getCounter(view) {
  return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0));
}

/**
 * Bind scenegraph items to a scenegraph mark instance.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {object} params.markdef - The mark definition for creating the mark.
 *   This is an object of legal scenegraph mark properties which *must* include
 *   the 'marktype' property.
 */

function Mark(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(Mark, Transform, {
  transform(_, pulse) {
    let mark = this.value; // acquire mark on first invocation, bind context and group

    if (!mark) {
      mark = pulse.dataflow.scenegraph().mark(_.markdef, vega_view_transforms_module_lookup(_), _.index);
      mark.group.context = _.context;
      if (!_.context.group) _.context.group = mark.group;
      mark.source = this.source; // point to upstream collector

      mark.clip = _.clip;
      mark.interactive = _.interactive;
      this.value = mark;
    } // initialize entering items


    const Init = mark.marktype === Group ? GroupItem : Item;
    pulse.visit(pulse.ADD, item => Init.call(item, mark)); // update clipping and/or interactive status

    if (_.modified('clip') || _.modified('interactive')) {
      mark.clip = _.clip;
      mark.interactive = !!_.interactive;
      mark.zdirty = true; // force scenegraph re-eval

      pulse.reflow();
    } // bind items array to scenegraph mark


    mark.items = pulse.source;
    return pulse;
  }

});

function vega_view_transforms_module_lookup(_) {
  const g = _.groups,
        p = _.parent;
  return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null;
}

/**
 * Analyze items for overlap, changing opacity to hide items with
 * overlapping bounding boxes. This transform will preserve at least
 * two items (e.g., first and last) even if overlap persists.
 * @param {object} params - The parameters for this operator.
 * @param {function(*,*): number} [params.sort] - A comparator
 *   function for sorting items.
 * @param {object} [params.method] - The overlap removal method to apply.
 *   One of 'parity' (default, hide every other item until there is no
 *   more overlap) or 'greedy' (sequentially scan and hide and items that
 *   overlap with the last visible item).
 * @param {object} [params.boundScale] - A scale whose range should be used
 *   to bound the items. Items exceeding the bounds of the scale range
 *   will be treated as overlapping. If null or undefined, no bounds check
 *   will be applied.
 * @param {object} [params.boundOrient] - The orientation of the scale
 *   (top, bottom, left, or right) used to bound items. This parameter is
 *   ignored if boundScale is null or undefined.
 * @param {object} [params.boundTolerance] - The tolerance in pixels for
 *   bound inclusion testing (default 1). This specifies by how many pixels
 *   an item's bounds may exceed the scale range bounds and not be culled.
 * @constructor
 */

function Overlap(params) {
  Transform.call(this, null, params);
}
const methods = {
  parity: items => items.filter((item, i) => i % 2 ? item.opacity = 0 : 1),
  greedy: (items, sep) => {
    let a;
    return items.filter((b, i) => !i || !vega_view_transforms_module_intersect(a.bounds, b.bounds, sep) ? (a = b, 1) : b.opacity = 0);
  }
}; // compute bounding box intersection
// including padding pixels of separation

const vega_view_transforms_module_intersect = (a, b, sep) => sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);

const hasOverlap = (items, pad) => {
  for (var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i) {
    if (vega_view_transforms_module_intersect(a, b = items[i].bounds, pad)) return true;
  }
};

const hasBounds = item => {
  const b = item.bounds;
  return b.width() > 1 && b.height() > 1;
};

const boundTest = (scale, orient, tolerance) => {
  var range = scale.range(),
      b = new Bounds();

  if (orient === Top || orient === Bottom) {
    b.set(range[0], -Infinity, range[1], +Infinity);
  } else {
    b.set(-Infinity, range[0], +Infinity, range[1]);
  }

  b.expand(tolerance || 1);
  return item => b.encloses(item.bounds);
}; // reset all items to be fully opaque


const vega_view_transforms_module_reset = source => {
  source.forEach(item => item.opacity = 1);
  return source;
}; // add all tuples to mod, fork pulse if parameters were modified
// fork prevents cross-stream tuple pollution (e.g., pulse from scale)


const vega_view_transforms_module_reflow = (pulse, _) => pulse.reflow(_.modified()).modifies('opacity');

Object(vega_util_module["z" /* inherits */])(Overlap, Transform, {
  transform(_, pulse) {
    const reduce = methods[_.method] || methods.parity,
          sep = _.separation || 0;
    let source = pulse.materialize(pulse.SOURCE).source,
        items,
        test;
    if (!source || !source.length) return;

    if (!_.method) {
      // early exit if method is falsy
      if (_.modified('method')) {
        vega_view_transforms_module_reset(source);
        pulse = vega_view_transforms_module_reflow(pulse, _);
      }

      return pulse;
    } // skip labels with no content


    source = source.filter(hasBounds); // early exit, nothing to do

    if (!source.length) return;

    if (_.sort) {
      source = source.slice().sort(_.sort);
    }

    items = vega_view_transforms_module_reset(source);
    pulse = vega_view_transforms_module_reflow(pulse, _);

    if (items.length >= 3 && hasOverlap(items, sep)) {
      do {
        items = reduce(items, sep);
      } while (items.length >= 3 && hasOverlap(items, sep));

      if (items.length < 3 && !Object(vega_util_module["W" /* peek */])(source).opacity) {
        if (items.length > 1) Object(vega_util_module["W" /* peek */])(items).opacity = 0;
        Object(vega_util_module["W" /* peek */])(source).opacity = 1;
      }
    }

    if (_.boundScale && _.boundTolerance >= 0) {
      test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance);
      source.forEach(item => {
        if (!test(item)) item.opacity = 0;
      });
    } // re-calculate mark bounds


    const bounds = items[0].mark.bounds.clear();
    source.forEach(item => {
      if (item.opacity) bounds.union(item.bounds);
    });
    return pulse;
  }

});

/**
 * Queue modified scenegraph items for rendering.
 * @constructor
 */

function Render(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(Render, Transform, {
  transform(_, pulse) {
    const view = pulse.dataflow;
    pulse.visit(pulse.ALL, item => view.dirty(item)); // set z-index dirty flag as needed

    if (pulse.fields && pulse.fields['zindex']) {
      const item = pulse.source && pulse.source[0];
      if (item) item.mark.zdirty = true;
    }
  }

});

const vega_view_transforms_module_tempBounds = new Bounds();
function vega_view_transforms_module_set(item, property, value) {
  return item[property] === value ? 0 : (item[property] = value, 1);
}

function isYAxis(mark) {
  var orient = mark.items[0].orient;
  return orient === Left || orient === Right;
}

function axisIndices(datum) {
  let index = +datum.grid;
  return [datum.ticks ? index++ : -1, // ticks index
  datum.labels ? index++ : -1, // labels index
  index + +datum.domain // title index
  ];
}

function axisLayout(view, axis, width, height) {
  var item = axis.items[0],
      datum = item.datum,
      delta = item.translate != null ? item.translate : 0.5,
      orient = item.orient,
      indices = axisIndices(datum),
      range = item.range,
      offset = item.offset,
      position = item.position,
      minExtent = item.minExtent,
      maxExtent = item.maxExtent,
      title = datum.title && item.items[indices[2]].items[0],
      titlePadding = item.titlePadding,
      bounds = item.bounds,
      dl = title && multiLineOffset(title),
      x = 0,
      y = 0,
      i,
      s;
  vega_view_transforms_module_tempBounds.clear().union(bounds);
  bounds.clear();
  if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds);
  if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds); // position axis group and title

  switch (orient) {
    case Top:
      x = position || 0;
      y = -offset;
      s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1));
      bounds.add(0, -s).add(range, 0);
      if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds);
      break;

    case Left:
      x = -offset;
      y = position || 0;
      s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1));
      bounds.add(-s, 0).add(0, range);
      if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds);
      break;

    case Right:
      x = width + offset;
      y = position || 0;
      s = Math.max(minExtent, Math.min(maxExtent, bounds.x2));
      bounds.add(0, 0).add(s, range);
      if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds);
      break;

    case Bottom:
      x = position || 0;
      y = height + offset;
      s = Math.max(minExtent, Math.min(maxExtent, bounds.y2));
      bounds.add(0, 0).add(range, s);
      if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds);
      break;

    default:
      x = item.x;
      y = item.y;
  } // update bounds


  boundStroke(bounds.translate(x, y), item);

  if (vega_view_transforms_module_set(item, 'x', x + delta) | vega_view_transforms_module_set(item, 'y', y + delta)) {
    item.bounds = vega_view_transforms_module_tempBounds;
    view.dirty(item);
    item.bounds = bounds;
    view.dirty(item);
  }

  return item.mark.bounds.clear().union(bounds);
}

function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) {
  const b = title.bounds;

  if (title.auto) {
    const v = sign * (offset + dl + pad);
    let dx = 0,
        dy = 0;
    view.dirty(title);
    isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v);
    title.mark.bounds.clear().union(b.translate(-dx, -dy));
    view.dirty(title);
  }

  bounds.union(b);
}

const vega_view_transforms_module_min = (a, b) => Math.floor(Math.min(a, b));

const vega_view_transforms_module_max = (a, b) => Math.ceil(Math.max(a, b));

function gridLayoutGroups(group) {
  var groups = group.items,
      n = groups.length,
      i = 0,
      mark,
      items;
  const views = {
    marks: [],
    rowheaders: [],
    rowfooters: [],
    colheaders: [],
    colfooters: [],
    rowtitle: null,
    coltitle: null
  }; // layout axes, gather legends, collect bounds

  for (; i < n; ++i) {
    mark = groups[i];
    items = mark.items;

    if (mark.marktype === Group) {
      switch (mark.role) {
        case AxisRole:
        case LegendRole:
        case TitleRole:
          break;

        case RowHeader:
          views.rowheaders.push(...items);
          break;

        case RowFooter:
          views.rowfooters.push(...items);
          break;

        case ColHeader:
          views.colheaders.push(...items);
          break;

        case ColFooter:
          views.colfooters.push(...items);
          break;

        case RowTitle:
          views.rowtitle = items[0];
          break;

        case ColTitle:
          views.coltitle = items[0];
          break;

        default:
          views.marks.push(...items);
      }
    }
  }

  return views;
}

function bboxFlush(item) {
  return new Bounds().set(0, 0, item.width || 0, item.height || 0);
}

function bboxFull(item) {
  const b = item.bounds.clone();
  return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0));
}

function vega_view_transforms_module_get(opt, key, d) {
  const v = Object(vega_util_module["H" /* isObject */])(opt) ? opt[key] : opt;
  return v != null ? v : d !== undefined ? d : 0;
}

function offsetValue(v) {
  return v < 0 ? Math.ceil(-v) : 0;
}

function gridLayout(view, groups, opt) {
  var dirty = !opt.nodirty,
      bbox = opt.bounds === Flush ? bboxFlush : bboxFull,
      bounds = vega_view_transforms_module_tempBounds.set(0, 0, 0, 0),
      alignCol = vega_view_transforms_module_get(opt.align, Column),
      alignRow = vega_view_transforms_module_get(opt.align, Row),
      padCol = vega_view_transforms_module_get(opt.padding, Column),
      padRow = vega_view_transforms_module_get(opt.padding, Row),
      ncols = opt.columns || groups.length,
      nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols),
      n = groups.length,
      xOffset = Array(n),
      xExtent = Array(ncols),
      xMax = 0,
      yOffset = Array(n),
      yExtent = Array(nrows),
      yMax = 0,
      dx = Array(n),
      dy = Array(n),
      boxes = Array(n),
      m,
      i,
      c,
      r,
      b,
      g,
      px,
      py,
      x,
      y,
      offset;

  for (i = 0; i < ncols; ++i) xExtent[i] = 0;

  for (i = 0; i < nrows; ++i) yExtent[i] = 0; // determine offsets for each group


  for (i = 0; i < n; ++i) {
    g = groups[i];
    b = boxes[i] = bbox(g);
    g.x = g.x || 0;
    dx[i] = 0;
    g.y = g.y || 0;
    dy[i] = 0;
    c = i % ncols;
    r = ~~(i / ncols);
    xMax = Math.max(xMax, px = Math.ceil(b.x2));
    yMax = Math.max(yMax, py = Math.ceil(b.y2));
    xExtent[c] = Math.max(xExtent[c], px);
    yExtent[r] = Math.max(yExtent[r], py);
    xOffset[i] = padCol + offsetValue(b.x1);
    yOffset[i] = padRow + offsetValue(b.y1);
    if (dirty) view.dirty(groups[i]);
  } // set initial alignment offsets


  for (i = 0; i < n; ++i) {
    if (i % ncols === 0) xOffset[i] = 0;
    if (i < ncols) yOffset[i] = 0;
  } // enforce column alignment constraints


  if (alignCol === Each) {
    for (c = 1; c < ncols; ++c) {
      for (offset = 0, i = c; i < n; i += ncols) {
        if (offset < xOffset[i]) offset = xOffset[i];
      }

      for (i = c; i < n; i += ncols) {
        xOffset[i] = offset + xExtent[c - 1];
      }
    }
  } else if (alignCol === All) {
    for (offset = 0, i = 0; i < n; ++i) {
      if (i % ncols && offset < xOffset[i]) offset = xOffset[i];
    }

    for (i = 0; i < n; ++i) {
      if (i % ncols) xOffset[i] = offset + xMax;
    }
  } else {
    for (alignCol = false, c = 1; c < ncols; ++c) {
      for (i = c; i < n; i += ncols) {
        xOffset[i] += xExtent[c - 1];
      }
    }
  } // enforce row alignment constraints


  if (alignRow === Each) {
    for (r = 1; r < nrows; ++r) {
      for (offset = 0, i = r * ncols, m = i + ncols; i < m; ++i) {
        if (offset < yOffset[i]) offset = yOffset[i];
      }

      for (i = r * ncols; i < m; ++i) {
        yOffset[i] = offset + yExtent[r - 1];
      }
    }
  } else if (alignRow === All) {
    for (offset = 0, i = ncols; i < n; ++i) {
      if (offset < yOffset[i]) offset = yOffset[i];
    }

    for (i = ncols; i < n; ++i) {
      yOffset[i] = offset + yMax;
    }
  } else {
    for (alignRow = false, r = 1; r < nrows; ++r) {
      for (i = r * ncols, m = i + ncols; i < m; ++i) {
        yOffset[i] += yExtent[r - 1];
      }
    }
  } // perform horizontal grid layout


  for (x = 0, i = 0; i < n; ++i) {
    x = xOffset[i] + (i % ncols ? x : 0);
    dx[i] += x - groups[i].x;
  } // perform vertical grid layout


  for (c = 0; c < ncols; ++c) {
    for (y = 0, i = c; i < n; i += ncols) {
      y += yOffset[i];
      dy[i] += y - groups[i].y;
    }
  } // perform horizontal centering


  if (alignCol && vega_view_transforms_module_get(opt.center, Column) && nrows > 1) {
    for (i = 0; i < n; ++i) {
      b = alignCol === All ? xMax : xExtent[i % ncols];
      x = b - boxes[i].x2 - groups[i].x - dx[i];
      if (x > 0) dx[i] += x / 2;
    }
  } // perform vertical centering


  if (alignRow && vega_view_transforms_module_get(opt.center, Row) && ncols !== 1) {
    for (i = 0; i < n; ++i) {
      b = alignRow === All ? yMax : yExtent[~~(i / ncols)];
      y = b - boxes[i].y2 - groups[i].y - dy[i];
      if (y > 0) dy[i] += y / 2;
    }
  } // position grid relative to anchor


  for (i = 0; i < n; ++i) {
    bounds.union(boxes[i].translate(dx[i], dy[i]));
  }

  x = vega_view_transforms_module_get(opt.anchor, vega_view_transforms_module_X);
  y = vega_view_transforms_module_get(opt.anchor, vega_view_transforms_module_Y);

  switch (vega_view_transforms_module_get(opt.anchor, Column)) {
    case End:
      x -= bounds.width();
      break;

    case Middle:
      x -= bounds.width() / 2;
  }

  switch (vega_view_transforms_module_get(opt.anchor, Row)) {
    case End:
      y -= bounds.height();
      break;

    case Middle:
      y -= bounds.height() / 2;
  }

  x = Math.round(x);
  y = Math.round(y); // update mark positions, bounds, dirty

  bounds.clear();

  for (i = 0; i < n; ++i) {
    groups[i].mark.bounds.clear();
  }

  for (i = 0; i < n; ++i) {
    g = groups[i];
    g.x += dx[i] += x;
    g.y += dy[i] += y;
    bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i])));
    if (dirty) view.dirty(g);
  }

  return bounds;
}
function trellisLayout(view, group, opt) {
  var views = gridLayoutGroups(group),
      groups = views.marks,
      bbox = opt.bounds === Flush ? boundFlush : boundFull,
      off = opt.offset,
      ncols = opt.columns || groups.length,
      nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols),
      cells = nrows * ncols,
      x,
      y,
      x2,
      y2,
      anchor,
      band,
      offset; // -- initial grid layout

  const bounds = gridLayout(view, groups, opt);
  if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid
  // -- layout grid headers and footers --
  // perform row header layout

  if (views.rowheaders) {
    band = vega_view_transforms_module_get(opt.headerBand, Row, null);
    x = vega_view_transforms_module_layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -vega_view_transforms_module_get(off, 'rowHeader'), vega_view_transforms_module_min, 0, bbox, 'x1', 0, ncols, 1, band);
  } // perform column header layout


  if (views.colheaders) {
    band = vega_view_transforms_module_get(opt.headerBand, Column, null);
    y = vega_view_transforms_module_layoutHeaders(view, views.colheaders, groups, ncols, ncols, -vega_view_transforms_module_get(off, 'columnHeader'), vega_view_transforms_module_min, 1, bbox, 'y1', 0, 1, ncols, band);
  } // perform row footer layout


  if (views.rowfooters) {
    band = vega_view_transforms_module_get(opt.footerBand, Row, null);
    x2 = vega_view_transforms_module_layoutHeaders(view, views.rowfooters, groups, ncols, nrows, vega_view_transforms_module_get(off, 'rowFooter'), vega_view_transforms_module_max, 0, bbox, 'x2', ncols - 1, ncols, 1, band);
  } // perform column footer layout


  if (views.colfooters) {
    band = vega_view_transforms_module_get(opt.footerBand, Column, null);
    y2 = vega_view_transforms_module_layoutHeaders(view, views.colfooters, groups, ncols, ncols, vega_view_transforms_module_get(off, 'columnFooter'), vega_view_transforms_module_max, 1, bbox, 'y2', cells - ncols, 1, ncols, band);
  } // perform row title layout


  if (views.rowtitle) {
    anchor = vega_view_transforms_module_get(opt.titleAnchor, Row);
    offset = vega_view_transforms_module_get(off, 'rowTitle');
    offset = anchor === End ? x2 + offset : x - offset;
    band = vega_view_transforms_module_get(opt.titleBand, Row, 0.5);
    layoutTitle(view, views.rowtitle, offset, 0, bounds, band);
  } // perform column title layout


  if (views.coltitle) {
    anchor = vega_view_transforms_module_get(opt.titleAnchor, Column);
    offset = vega_view_transforms_module_get(off, 'columnTitle');
    offset = anchor === End ? y2 + offset : y - offset;
    band = vega_view_transforms_module_get(opt.titleBand, Column, 0.5);
    layoutTitle(view, views.coltitle, offset, 1, bounds, band);
  }
}

function boundFlush(item, field) {
  return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined;
}

function boundFull(item, field) {
  return item.bounds[field];
}

function vega_view_transforms_module_layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) {
  var n = groups.length,
      init = 0,
      edge = 0,
      i,
      j,
      k,
      m,
      b,
      h,
      g,
      x,
      y; // if no groups, early exit and return 0

  if (!n) return init; // compute margin

  for (i = start; i < n; i += stride) {
    if (groups[i]) init = agg(init, bound(groups[i], bf));
  } // if no headers, return margin calculation


  if (!headers.length) return init; // check if number of headers exceeds number of rows or columns

  if (headers.length > limit) {
    view.warn('Grid headers exceed limit: ' + limit);
    headers = headers.slice(0, limit);
  } // apply offset


  init += offset; // clear mark bounds for all headers

  for (j = 0, m = headers.length; j < m; ++j) {
    view.dirty(headers[j]);
    headers[j].mark.bounds.clear();
  } // layout each header


  for (i = start, j = 0, m = headers.length; j < m; ++j, i += stride) {
    h = headers[j];
    b = h.mark.bounds; // search for nearest group to align to
    // necessary if table has empty cells

    for (k = i; k >= 0 && (g = groups[k]) == null; k -= back); // assign coordinates and update bounds


    if (isX) {
      x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width());
      y = init;
    } else {
      x = init;
      y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height());
    }

    b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0)));
    h.x = x;
    h.y = y;
    view.dirty(h); // update current edge of layout bounds

    edge = agg(edge, b[bf]);
  }

  return edge;
}

function layoutTitle(view, g, offset, isX, bounds, band) {
  if (!g) return;
  view.dirty(g); // compute title coordinates

  var x = offset,
      y = offset;
  isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height()); // assign coordinates and update bounds

  g.bounds.translate(x - (g.x || 0), y - (g.y || 0));
  g.mark.bounds.clear().union(g.bounds);
  g.x = x;
  g.y = y; // queue title for redraw

  view.dirty(g);
}

function lookup$1(config, orient) {
  const opt = config[orient] || {};
  return (key, d) => opt[key] != null ? opt[key] : config[key] != null ? config[key] : d;
} // if legends specify offset directly, use the maximum specified value


function vega_view_transforms_module_offsets(legends, value) {
  let max = -Infinity;
  legends.forEach(item => {
    if (item.offset != null) max = Math.max(max, item.offset);
  });
  return max > -Infinity ? max : value;
}

function legendParams(g, orient, config, xb, yb, w, h) {
  const _ = lookup$1(config, orient),
        offset = vega_view_transforms_module_offsets(g, _('offset', 0)),
        anchor = _('anchor', Start),
        mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0;

  const p = {
    align: Each,
    bounds: _('bounds', Flush),
    columns: _('direction') === 'vertical' ? 1 : g.length,
    padding: _('margin', 8),
    center: _('center'),
    nodirty: true
  };

  switch (orient) {
    case Left:
      p.anchor = {
        x: Math.floor(xb.x1) - offset,
        column: End,
        y: mult * (h || xb.height() + 2 * xb.y1),
        row: anchor
      };
      break;

    case Right:
      p.anchor = {
        x: Math.ceil(xb.x2) + offset,
        y: mult * (h || xb.height() + 2 * xb.y1),
        row: anchor
      };
      break;

    case Top:
      p.anchor = {
        y: Math.floor(yb.y1) - offset,
        row: End,
        x: mult * (w || yb.width() + 2 * yb.x1),
        column: anchor
      };
      break;

    case Bottom:
      p.anchor = {
        y: Math.ceil(yb.y2) + offset,
        x: mult * (w || yb.width() + 2 * yb.x1),
        column: anchor
      };
      break;

    case TopLeft:
      p.anchor = {
        x: offset,
        y: offset
      };
      break;

    case TopRight:
      p.anchor = {
        x: w - offset,
        y: offset,
        column: End
      };
      break;

    case BottomLeft:
      p.anchor = {
        x: offset,
        y: h - offset,
        row: End
      };
      break;

    case BottomRight:
      p.anchor = {
        x: w - offset,
        y: h - offset,
        column: End,
        row: End
      };
      break;
  }

  return p;
}
function legendLayout(view, legend) {
  var item = legend.items[0],
      datum = item.datum,
      orient = item.orient,
      bounds = item.bounds,
      x = item.x,
      y = item.y,
      w,
      h; // cache current bounds for later comparison

  item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone();
  bounds.clear(); // adjust legend to accommodate padding and title

  legendGroupLayout(view, item, item.items[0].items[0]); // aggregate bounds to determine size, and include origin

  bounds = legendBounds(item, bounds);
  w = 2 * item.padding;
  h = 2 * item.padding;

  if (!bounds.empty()) {
    w = Math.ceil(bounds.width() + w);
    h = Math.ceil(bounds.height() + h);
  }

  if (datum.type === Symbols) {
    legendEntryLayout(item.items[0].items[0].items[0].items);
  }

  if (orient !== vega_view_transforms_module_None) {
    item.x = x = 0;
    item.y = y = 0;
  }

  item.width = w;
  item.height = h;
  boundStroke(bounds.set(x, y, x + w, y + h), item);
  item.mark.bounds.clear().union(bounds);
  return item;
}

function legendBounds(item, b) {
  // aggregate item bounds
  item.items.forEach(_ => b.union(_.bounds)); // anchor to legend origin

  b.x1 = item.padding;
  b.y1 = item.padding;
  return b;
}

function legendGroupLayout(view, item, entry) {
  var pad = item.padding,
      ex = pad - entry.x,
      ey = pad - entry.y;

  if (!item.datum.title) {
    if (ex || ey) vega_view_transforms_module_translate(view, entry, ex, ey);
  } else {
    var title = item.items[1].items[0],
        anchor = title.anchor,
        tpad = item.titlePadding || 0,
        tx = pad - title.x,
        ty = pad - title.y;

    switch (title.orient) {
      case Left:
        ex += Math.ceil(title.bounds.width()) + tpad;
        break;

      case Right:
      case Bottom:
        break;

      default:
        ey += title.bounds.height() + tpad;
    }

    if (ex || ey) vega_view_transforms_module_translate(view, entry, ex, ey);

    switch (title.orient) {
      case Left:
        ty += legendTitleOffset(item, entry, title, anchor, 1, 1);
        break;

      case Right:
        tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad;
        ty += legendTitleOffset(item, entry, title, anchor, 1, 1);
        break;

      case Bottom:
        tx += legendTitleOffset(item, entry, title, anchor, 0, 0);
        ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad;
        break;

      default:
        tx += legendTitleOffset(item, entry, title, anchor, 0, 0);
    }

    if (tx || ty) vega_view_transforms_module_translate(view, title, tx, ty); // translate legend if title pushes into negative coordinates

    if ((tx = Math.round(title.bounds.x1 - pad)) < 0) {
      vega_view_transforms_module_translate(view, entry, -tx, 0);
      vega_view_transforms_module_translate(view, title, -tx, 0);
    }
  }
}

function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) {
  const grad = item.datum.type !== 'symbol',
        vgrad = title.datum.vgrad,
        e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry,
        s = e.bounds[y ? 'y2' : 'x2'] - item.padding,
        u = vgrad && lr ? s : 0,
        v = vgrad && lr ? 0 : s,
        o = y <= 0 ? 0 : multiLineOffset(title);
  return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o));
}

function vega_view_transforms_module_translate(view, item, dx, dy) {
  item.x += dx;
  item.y += dy;
  item.bounds.translate(dx, dy);
  item.mark.bounds.translate(dx, dy);
  view.dirty(item);
}

function legendEntryLayout(entries) {
  // get max widths for each column
  const widths = entries.reduce((w, g) => {
    w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0);
    return w;
  }, {}); // set dimensions of legend entry groups

  entries.forEach(g => {
    g.width = widths[g.column];
    g.height = g.bounds.y2 - g.y;
  });
}

function titleLayout(view, mark, width, height, viewBounds) {
  var group = mark.items[0],
      frame = group.frame,
      orient = group.orient,
      anchor = group.anchor,
      offset = group.offset,
      padding = group.padding,
      title = group.items[0].items[0],
      subtitle = group.items[1] && group.items[1].items[0],
      end = orient === Left || orient === Right ? height : width,
      start = 0,
      x = 0,
      y = 0,
      sx = 0,
      sy = 0,
      pos;

  if (frame !== Group) {
    orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2);
  } else if (orient === Left) {
    start = height, end = 0;
  }

  pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2;

  if (subtitle && subtitle.text) {
    // position subtitle
    switch (orient) {
      case Top:
      case Bottom:
        sy = title.bounds.height() + padding;
        break;

      case Left:
        sx = title.bounds.width() + padding;
        break;

      case Right:
        sx = -title.bounds.width() - padding;
        break;
    }

    vega_view_transforms_module_tempBounds.clear().union(subtitle.bounds);
    vega_view_transforms_module_tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0));

    if (vega_view_transforms_module_set(subtitle, 'x', sx) | vega_view_transforms_module_set(subtitle, 'y', sy)) {
      view.dirty(subtitle);
      subtitle.bounds.clear().union(vega_view_transforms_module_tempBounds);
      subtitle.mark.bounds.clear().union(vega_view_transforms_module_tempBounds);
      view.dirty(subtitle);
    }

    vega_view_transforms_module_tempBounds.clear().union(subtitle.bounds);
  } else {
    vega_view_transforms_module_tempBounds.clear();
  }

  vega_view_transforms_module_tempBounds.union(title.bounds); // position title group

  switch (orient) {
    case Top:
      x = pos;
      y = viewBounds.y1 - vega_view_transforms_module_tempBounds.height() - offset;
      break;

    case Left:
      x = viewBounds.x1 - vega_view_transforms_module_tempBounds.width() - offset;
      y = pos;
      break;

    case Right:
      x = viewBounds.x2 + vega_view_transforms_module_tempBounds.width() + offset;
      y = pos;
      break;

    case Bottom:
      x = pos;
      y = viewBounds.y2 + offset;
      break;

    default:
      x = group.x;
      y = group.y;
  }

  if (vega_view_transforms_module_set(group, 'x', x) | vega_view_transforms_module_set(group, 'y', y)) {
    vega_view_transforms_module_tempBounds.translate(x, y);
    view.dirty(group);
    group.bounds.clear().union(vega_view_transforms_module_tempBounds);
    mark.bounds.clear().union(vega_view_transforms_module_tempBounds);
    view.dirty(group);
  }

  return group.bounds;
}

/**
 * Layout view elements such as axes and legends.
 * Also performs size adjustments.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {object} params.mark - Scenegraph mark of groups to layout.
 */

function ViewLayout(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(ViewLayout, Transform, {
  transform(_, pulse) {
    const view = pulse.dataflow;

    _.mark.items.forEach(group => {
      if (_.layout) trellisLayout(view, group, _.layout);
      layoutGroup(view, group, _);
    });

    return shouldReflow(_.mark.group) ? pulse.reflow() : pulse;
  }

});

function shouldReflow(group) {
  // We typically should reflow if layout is invoked (#2568), as child items
  // may have resized and reflow ensures group bounds are re-calculated.
  // However, legend entries have a special exception to avoid instability.
  // For example, if a selected legend symbol gains a stroke on hover,
  // we don't want to re-position subsequent elements in the legend.
  return group && group.mark.role !== 'legend-entry';
}

function layoutGroup(view, group, _) {
  var items = group.items,
      width = Math.max(0, group.width || 0),
      height = Math.max(0, group.height || 0),
      viewBounds = new Bounds().set(0, 0, width, height),
      xBounds = viewBounds.clone(),
      yBounds = viewBounds.clone(),
      legends = [],
      title,
      mark,
      orient,
      b,
      i,
      n; // layout axes, gather legends, collect bounds

  for (i = 0, n = items.length; i < n; ++i) {
    mark = items[i];

    switch (mark.role) {
      case AxisRole:
        b = isYAxis(mark) ? xBounds : yBounds;
        b.union(axisLayout(view, mark, width, height));
        break;

      case TitleRole:
        title = mark;
        break;

      case LegendRole:
        legends.push(legendLayout(view, mark));
        break;

      case FrameRole:
      case ScopeRole:
      case RowHeader:
      case RowFooter:
      case RowTitle:
      case ColHeader:
      case ColFooter:
      case ColTitle:
        xBounds.union(mark.bounds);
        yBounds.union(mark.bounds);
        break;

      default:
        viewBounds.union(mark.bounds);
    }
  } // layout legends, adjust viewBounds


  if (legends.length) {
    // group legends by orient
    const l = {};
    legends.forEach(item => {
      orient = item.orient || Right;
      if (orient !== vega_view_transforms_module_None) (l[orient] || (l[orient] = [])).push(item);
    }); // perform grid layout for each orient group

    for (const orient in l) {
      const g = l[orient];
      gridLayout(view, g, legendParams(g, orient, _.legends, xBounds, yBounds, width, height));
    } // update view bounds


    legends.forEach(item => {
      const b = item.bounds;

      if (!b.equals(item._bounds)) {
        item.bounds = item._bounds;
        view.dirty(item); // dirty previous location

        item.bounds = b;
        view.dirty(item);
      }

      if (_.autosize && _.autosize.type === Fit) {
        // For autosize fit, incorporate the orthogonal dimension only.
        // Legends that overrun the chart area will then be clipped;
        // otherwise the chart area gets reduced to nothing!
        switch (item.orient) {
          case Left:
          case Right:
            viewBounds.add(b.x1, 0).add(b.x2, 0);
            break;

          case Top:
          case Bottom:
            viewBounds.add(0, b.y1).add(0, b.y2);
        }
      } else {
        viewBounds.union(b);
      }
    });
  } // combine bounding boxes


  viewBounds.union(xBounds).union(yBounds); // layout title, adjust bounds

  if (title) {
    viewBounds.union(titleLayout(view, title, width, height, viewBounds));
  } // override aggregated view bounds if content is clipped


  if (group.clip) {
    viewBounds.set(0, 0, group.width || 0, group.height || 0);
  } // perform size adjustment


  viewSizeLayout(view, group, viewBounds, _);
}

function viewSizeLayout(view, group, viewBounds, _) {
  const auto = _.autosize || {},
        type = auto.type;
  if (view._autosize < 1 || !type) return;
  let viewWidth = view._width,
      viewHeight = view._height,
      width = Math.max(0, group.width || 0),
      left = Math.max(0, Math.ceil(-viewBounds.x1)),
      height = Math.max(0, group.height || 0),
      top = Math.max(0, Math.ceil(-viewBounds.y1));
  const right = Math.max(0, Math.ceil(viewBounds.x2 - width)),
        bottom = Math.max(0, Math.ceil(viewBounds.y2 - height));

  if (auto.contains === Padding) {
    const padding = view.padding();
    viewWidth -= padding.left + padding.right;
    viewHeight -= padding.top + padding.bottom;
  }

  if (type === vega_view_transforms_module_None) {
    left = 0;
    top = 0;
    width = viewWidth;
    height = viewHeight;
  } else if (type === Fit) {
    width = Math.max(0, viewWidth - left - right);
    height = Math.max(0, viewHeight - top - bottom);
  } else if (type === FitX) {
    width = Math.max(0, viewWidth - left - right);
    viewHeight = height + top + bottom;
  } else if (type === FitY) {
    viewWidth = width + left + right;
    height = Math.max(0, viewHeight - top - bottom);
  } else if (type === Pad) {
    viewWidth = width + left + right;
    viewHeight = height + top + bottom;
  }

  view._resizeView(viewWidth, viewHeight, width, height, [left, top], auto.resize);
}



// CONCATENATED MODULE: ./node_modules/d3-array/src/sum.js
function sum_sum(values, valueof) {
  let sum = 0;
  if (valueof === undefined) {
    for (let value of values) {
      if (value = +value) {
        sum += value;
      }
    }
  } else {
    let index = -1;
    for (let value of values) {
      if (value = +valueof(value, ++index, values)) {
        sum += value;
      }
    }
  }
  return sum;
}

// CONCATENATED MODULE: ./node_modules/vega-encode/build/vega-encode.module.js






/**
 * Generates axis ticks for visualizing a spatial scale.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Scale} params.scale - The scale to generate ticks for.
 * @param {*} [params.count=10] - The approximate number of ticks, or
 *   desired tick interval, to use.
 * @param {Array<*>} [params.values] - The exact tick values to use.
 *   These must be legal domain values for the provided scale.
 *   If provided, the count argument is ignored.
 * @param {function(*):string} [params.formatSpecifier] - A format specifier
 *   to use in conjunction with scale.tickFormat. Legal values are
 *   any valid d3 4.0 format specifier.
 * @param {function(*):string} [params.format] - The format function to use.
 *   If provided, the formatSpecifier argument is ignored.
 */

function AxisTicks(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(AxisTicks, Transform, {
  transform(_, pulse) {
    if (this.value && !_.modified()) {
      return pulse.StopPropagation;
    }

    var locale = pulse.dataflow.locale(),
        out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
        ticks = this.value,
        scale = _.scale,
        tally = _.count == null ? _.values ? _.values.length : 10 : _.count,
        count = tickCount(scale, tally, _.minstep),
        format = _.format || vega_scale_module_tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values),
        values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count);
    if (ticks) out.rem = ticks;
    ticks = values.map((value, i) => ingest$1({
      index: i / (values.length - 1 || 1),
      value: value,
      label: format(value)
    }));

    if (_.extra && ticks.length) {
      // add an extra tick pegged to the initial domain value
      // this is used to generate axes with 'binned' domains
      ticks.push(ingest$1({
        index: -1,
        extra: {
          value: ticks[0].value
        },
        label: ''
      }));
    }

    out.source = ticks;
    out.add = ticks;
    this.value = ticks;
    return out;
  }

});

/**
 * Joins a set of data elements against a set of visual items.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): object} [params.item] - An item generator function.
 * @param {function(object): *} [params.key] - The key field associating data and visual items.
 */

function DataJoin(params) {
  Transform.call(this, null, params);
}

function defaultItemCreate() {
  return ingest$1({});
}

function newMap(key) {
  const map = Object(vega_util_module["t" /* fastmap */])().test(t => t.exit);

  map.lookup = t => map.get(key(t));

  return map;
}

Object(vega_util_module["z" /* inherits */])(DataJoin, Transform, {
  transform(_, pulse) {
    var df = pulse.dataflow,
        out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
        item = _.item || defaultItemCreate,
        key = _.key || tupleid,
        map = this.value; // prevent transient (e.g., hover) requests from
    // cascading across marks derived from marks

    if (Object(vega_util_module["B" /* isArray */])(out.encode)) {
      out.encode = null;
    }

    if (map && (_.modified('key') || pulse.modified(key))) {
      Object(vega_util_module["o" /* error */])('DataJoin does not support modified key function or fields.');
    }

    if (!map) {
      pulse = pulse.addAll();
      this.value = map = newMap(key);
    }

    pulse.visit(pulse.ADD, t => {
      const k = key(t);
      let x = map.get(k);

      if (x) {
        if (x.exit) {
          map.empty--;
          out.add.push(x);
        } else {
          out.mod.push(x);
        }
      } else {
        x = item(t);
        map.set(k, x);
        out.add.push(x);
      }

      x.datum = t;
      x.exit = false;
    });
    pulse.visit(pulse.MOD, t => {
      const k = key(t),
            x = map.get(k);

      if (x) {
        x.datum = t;
        out.mod.push(x);
      }
    });
    pulse.visit(pulse.REM, t => {
      const k = key(t),
            x = map.get(k);

      if (t === x.datum && !x.exit) {
        out.rem.push(x);
        x.exit = true;
        ++map.empty;
      }
    });
    if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum');

    if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) {
      df.runAfter(map.clean);
    }

    return out;
  }

});

/**
 * Invokes encoding functions for visual items.
 * @constructor
 * @param {object} params - The parameters to the encoding functions. This
 *   parameter object will be passed through to all invoked encoding functions.
 * @param {object} [params.mod=false] - Flag indicating if tuples in the input
 *   mod set that are unmodified by encoders should be included in the output.
 * @param {object} param.encoders - The encoding functions
 * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set
 * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set
 * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set
 */

function Encode(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(Encode, Transform, {
  transform(_, pulse) {
    var out = pulse.fork(pulse.ADD_REM),
        fmod = _.mod || false,
        encoders = _.encoders,
        encode = pulse.encode; // if an array, the encode directive includes additional sets
    // that must be defined in order for the primary set to be invoked
    // e.g., only run the update set if the hover set is defined

    if (Object(vega_util_module["B" /* isArray */])(encode)) {
      if (out.changed() || encode.every(e => encoders[e])) {
        encode = encode[0];
        out.encode = null; // consume targeted encode directive
      } else {
        return pulse.StopPropagation;
      }
    } // marshall encoder functions


    var reenter = encode === 'enter',
        update = encoders.update || vega_util_module["s" /* falsy */],
        enter = encoders.enter || vega_util_module["s" /* falsy */],
        exit = encoders.exit || vega_util_module["s" /* falsy */],
        set = (encode && !reenter ? encoders[encode] : update) || vega_util_module["s" /* falsy */];

    if (pulse.changed(pulse.ADD)) {
      pulse.visit(pulse.ADD, t => {
        enter(t, _);
        update(t, _);
      });
      out.modifies(enter.output);
      out.modifies(update.output);

      if (set !== vega_util_module["s" /* falsy */] && set !== update) {
        pulse.visit(pulse.ADD, t => {
          set(t, _);
        });
        out.modifies(set.output);
      }
    }

    if (pulse.changed(pulse.REM) && exit !== vega_util_module["s" /* falsy */]) {
      pulse.visit(pulse.REM, t => {
        exit(t, _);
      });
      out.modifies(exit.output);
    }

    if (reenter || set !== vega_util_module["s" /* falsy */]) {
      const flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0);

      if (reenter) {
        pulse.visit(flag, t => {
          const mod = enter(t, _) || fmod;
          if (set(t, _) || mod) out.mod.push(t);
        });
        if (out.mod.length) out.modifies(enter.output);
      } else {
        pulse.visit(flag, t => {
          if (set(t, _) || fmod) out.mod.push(t);
        });
      }

      if (out.mod.length) out.modifies(set.output);
    }

    return out.changed() ? out : pulse.StopPropagation;
  }

});

/**
 * Generates legend entries for visualizing a scale.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Scale} params.scale - The scale to generate items for.
 * @param {*} [params.count=5] - The approximate number of items, or
 *   desired tick interval, to use.
 * @param {*} [params.limit] - The maximum number of entries to
 *   include in a symbol legend.
 * @param {Array<*>} [params.values] - The exact tick values to use.
 *   These must be legal domain values for the provided scale.
 *   If provided, the count argument is ignored.
 * @param {string} [params.formatSpecifier] - A format specifier
 *   to use in conjunction with scale.tickFormat. Legal values are
 *   any valid D3 format specifier string.
 * @param {function(*):string} [params.format] - The format function to use.
 *   If provided, the formatSpecifier argument is ignored.
 */

function LegendEntries(params) {
  Transform.call(this, [], params);
}
Object(vega_util_module["z" /* inherits */])(LegendEntries, Transform, {
  transform(_, pulse) {
    if (this.value != null && !_.modified()) {
      return pulse.StopPropagation;
    }

    var locale = pulse.dataflow.locale(),
        out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
        items = this.value,
        type = _.type || SymbolLegend,
        scale = _.scale,
        limit = +_.limit,
        count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep),
        lskip = !!_.values || type === SymbolLegend,
        format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip),
        values = _.values || labelValues(scale, count),
        domain,
        fraction,
        size,
        offset,
        ellipsis;
    if (items) out.rem = items;

    if (type === SymbolLegend) {
      if (limit && values.length > limit) {
        pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.');
        items = values.slice(0, limit - 1);
        ellipsis = true;
      } else {
        items = values;
      }

      if (Object(vega_util_module["E" /* isFunction */])(size = _.size)) {
        // if first value maps to size zero, remove from list (vega#717)
        if (!_.values && scale(items[0]) === 0) {
          items = items.slice(1);
        } // compute size offset for legend entries


        offset = items.reduce((max, value) => Math.max(max, size(value, _)), 0);
      } else {
        size = Object(vega_util_module["m" /* constant */])(offset = size || 8);
      }

      items = items.map((value, index) => ingest$1({
        index: index,
        label: format(value, index, items),
        value: value,
        offset: offset,
        size: size(value, _)
      }));

      if (ellipsis) {
        ellipsis = values[items.length];
        items.push(ingest$1({
          index: items.length,
          label: "\u2026".concat(values.length - items.length, " entries"),
          value: ellipsis,
          offset: offset,
          size: size(ellipsis, _)
        }));
      }
    } else if (type === GradientLegend) {
      domain = scale.domain(), fraction = scaleFraction(scale, domain[0], Object(vega_util_module["W" /* peek */])(domain)); // if automatic label generation produces 2 or fewer values,
      // use the domain end points instead (fixes vega/vega#1364)

      if (values.length < 3 && !_.values && domain[0] !== Object(vega_util_module["W" /* peek */])(domain)) {
        values = [domain[0], Object(vega_util_module["W" /* peek */])(domain)];
      }

      items = values.map((value, index) => ingest$1({
        index: index,
        label: format(value, index, values),
        value: value,
        perc: fraction(value)
      }));
    } else {
      size = values.length - 1;
      fraction = labelFraction(scale);
      items = values.map((value, index) => ingest$1({
        index: index,
        label: format(value, index, values),
        value: value,
        perc: index ? fraction(value) : 0,
        perc2: index === size ? 1 : fraction(values[index + 1])
      }));
    }

    out.source = items;
    out.add = items;
    this.value = items;
    return out;
  }

});

const sourceX = t => t.source.x;

const sourceY = t => t.source.y;

const targetX = t => t.target.x;

const targetY = t => t.target.y;
/**
 * Layout paths linking source and target elements.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */


function LinkPath(params) {
  Transform.call(this, {}, params);
}
LinkPath.Definition = {
  'type': 'LinkPath',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'sourceX',
    'type': 'field',
    'default': 'source.x'
  }, {
    'name': 'sourceY',
    'type': 'field',
    'default': 'source.y'
  }, {
    'name': 'targetX',
    'type': 'field',
    'default': 'target.x'
  }, {
    'name': 'targetY',
    'type': 'field',
    'default': 'target.y'
  }, {
    'name': 'orient',
    'type': 'enum',
    'default': 'vertical',
    'values': ['horizontal', 'vertical', 'radial']
  }, {
    'name': 'shape',
    'type': 'enum',
    'default': 'line',
    'values': ['line', 'arc', 'curve', 'diagonal', 'orthogonal']
  }, {
    'name': 'require',
    'type': 'signal'
  }, {
    'name': 'as',
    'type': 'string',
    'default': 'path'
  }]
};
Object(vega_util_module["z" /* inherits */])(LinkPath, Transform, {
  transform(_, pulse) {
    var sx = _.sourceX || sourceX,
        sy = _.sourceY || sourceY,
        tx = _.targetX || targetX,
        ty = _.targetY || targetY,
        as = _.as || 'path',
        orient = _.orient || 'vertical',
        shape = _.shape || 'line',
        path = Paths.get(shape + '-' + orient) || Paths.get(shape);

    if (!path) {
      Object(vega_util_module["o" /* error */])('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : ''));
    }

    pulse.visit(pulse.SOURCE, t => {
      t[as] = path(sx(t), sy(t), tx(t), ty(t));
    });
    return pulse.reflow(_.modified()).modifies(as);
  }

});

const vega_encode_module_line = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'L' + tx + ',' + ty;

const lineR = (sa, sr, ta, tr) => vega_encode_module_line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));

const vega_encode_module_arc = (sx, sy, tx, ty) => {
  var dx = tx - sx,
      dy = ty - sy,
      rr = Math.sqrt(dx * dx + dy * dy) / 2,
      ra = 180 * Math.atan2(dy, dx) / Math.PI;
  return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty;
};

const arcR = (sa, sr, ta, tr) => vega_encode_module_arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));

const vega_encode_module_curve = (sx, sy, tx, ty) => {
  const dx = tx - sx,
        dy = ty - sy,
        ix = 0.2 * (dx + dy),
        iy = 0.2 * (dy - dx);
  return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty;
};

const curveR = (sa, sr, ta, tr) => vega_encode_module_curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));

const orthoX = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'V' + ty + 'H' + tx;

const orthoY = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'H' + tx + 'V' + ty;

const orthoR = (sa, sr, ta, tr) => {
  const sc = Math.cos(sa),
        ss = Math.sin(sa),
        tc = Math.cos(ta),
        ts = Math.sin(ta),
        sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa;
  return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts;
};

const diagonalX = (sx, sy, tx, ty) => {
  const m = (sx + tx) / 2;
  return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty;
};

const diagonalY = (sx, sy, tx, ty) => {
  const m = (sy + ty) / 2;
  return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty;
};

const diagonalR = (sa, sr, ta, tr) => {
  const sc = Math.cos(sa),
        ss = Math.sin(sa),
        tc = Math.cos(ta),
        ts = Math.sin(ta),
        mr = (sr + tr) / 2;
  return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts;
};

const Paths = Object(vega_util_module["t" /* fastmap */])({
  'line': vega_encode_module_line,
  'line-radial': lineR,
  'arc': vega_encode_module_arc,
  'arc-radial': arcR,
  'curve': vega_encode_module_curve,
  'curve-radial': curveR,
  'orthogonal-horizontal': orthoX,
  'orthogonal-vertical': orthoY,
  'orthogonal-radial': orthoR,
  'diagonal-horizontal': diagonalX,
  'diagonal-vertical': diagonalY,
  'diagonal-radial': diagonalR
});

/**
 * Pie and donut chart layout.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The value field to size pie segments.
 * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout.
 * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout.
 * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value.
 */

function Pie(params) {
  Transform.call(this, null, params);
}
Pie.Definition = {
  'type': 'Pie',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field'
  }, {
    'name': 'startAngle',
    'type': 'number',
    'default': 0
  }, {
    'name': 'endAngle',
    'type': 'number',
    'default': 6.283185307179586
  }, {
    'name': 'sort',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': 2,
    'default': ['startAngle', 'endAngle']
  }]
};
Object(vega_util_module["z" /* inherits */])(Pie, Transform, {
  transform(_, pulse) {
    var as = _.as || ['startAngle', 'endAngle'],
        startAngle = as[0],
        endAngle = as[1],
        field = _.field || vega_util_module["Q" /* one */],
        start = _.startAngle || 0,
        stop = _.endAngle != null ? _.endAngle : 2 * Math.PI,
        data = pulse.source,
        values = data.map(field),
        n = values.length,
        a = start,
        k = (stop - start) / sum_sum(values),
        index = src_range(n),
        i,
        t,
        v;

    if (_.sort) {
      index.sort((a, b) => values[a] - values[b]);
    }

    for (i = 0; i < n; ++i) {
      v = values[index[i]];
      t = data[index[i]];
      t[startAngle] = a;
      t[endAngle] = a += v * k;
    }

    this.value = values;
    return pulse.reflow(_.modified()).modifies(as);
  }

});

const DEFAULT_COUNT = 5;

function includeZero(scale) {
  const type = scale.type;
  return !scale.bins && (type === vega_scale_module_Linear || type === Pow || type === Sqrt);
}

function includePad(type) {
  return isContinuous(type) && type !== Sequential;
}

const vega_encode_module_SKIP = Object(vega_util_module["fb" /* toSet */])(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']);
/**
 * Maintains a scale function mapping data values to visual channels.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */

function Scale(params) {
  Transform.call(this, null, params);
  this.modified(true); // always treat as modified
}
Object(vega_util_module["z" /* inherits */])(Scale, Transform, {
  transform(_, pulse) {
    var df = pulse.dataflow,
        scale$1 = this.value,
        key = scaleKey(_);

    if (!scale$1 || key !== scale$1.type) {
      this.value = scale$1 = vega_scale_module_scale(key)();
    }

    for (key in _) if (!vega_encode_module_SKIP[key]) {
      // padding is a scale property for band/point but not others
      if (key === 'padding' && includePad(scale$1.type)) continue; // invoke scale property setter, raise warning if not found

      Object(vega_util_module["E" /* isFunction */])(scale$1[key]) ? scale$1[key](_[key]) : df.warn('Unsupported scale property: ' + key);
    }

    configureRange(scale$1, _, configureBins(scale$1, _, configureDomain(scale$1, _, df)));
    return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
  }

});

function scaleKey(_) {
  var t = _.type,
      d = '',
      n; // backwards compatibility pre Vega 5.

  if (t === Sequential) return Sequential + '-' + vega_scale_module_Linear;

  if (isContinuousColor(_)) {
    n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0;
    d = n === 2 ? Sequential + '-' : n === 3 ? Diverging + '-' : '';
  }

  return (d + t || vega_scale_module_Linear).toLowerCase();
}

function isContinuousColor(_) {
  const t = _.type;
  return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(vega_util_module["J" /* isString */]));
}

function configureDomain(scale, _, df) {
  // check raw domain, if provided use that and exit early
  const raw = rawDomain(scale, _.domainRaw, df);
  if (raw > -1) return raw;
  var domain = _.domain,
      type = scale.type,
      zero = _.zero || _.zero === undefined && includeZero(scale),
      n,
      mid;
  if (!domain) return 0; // adjust continuous domain for minimum pixel padding

  if (includePad(type) && _.padding && domain[0] !== Object(vega_util_module["W" /* peek */])(domain)) {
    domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant);
  } // adjust domain based on zero, min, max settings


  if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) {
    n = (domain = domain.slice()).length - 1 || 1;

    if (zero) {
      if (domain[0] > 0) domain[0] = 0;
      if (domain[n] < 0) domain[n] = 0;
    }

    if (_.domainMin != null) domain[0] = _.domainMin;
    if (_.domainMax != null) domain[n] = _.domainMax;

    if (_.domainMid != null) {
      mid = _.domainMid;
      const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n;
      if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid);
      domain.splice(i, 0, mid);
    }
  } // set the scale domain


  scale.domain(domainCheck(type, domain, df)); // if ordinal scale domain is defined, prevent implicit
  // domain construction as side-effect of scale lookup

  if (type === Ordinal) {
    scale.unknown(_.domainImplicit ? ordinal_implicit : undefined);
  } // perform 'nice' adjustment as requested


  if (_.nice && scale.nice) {
    scale.nice(_.nice !== true && tickCount(scale, _.nice) || null);
  } // return the cardinality of the domain


  return domain.length;
}

function rawDomain(scale, raw, df) {
  if (raw) {
    scale.domain(domainCheck(scale.type, raw, df));
    return raw.length;
  } else {
    return -1;
  }
}

function padDomain(type, domain, range, pad, exponent, constant) {
  var span = Math.abs(Object(vega_util_module["W" /* peek */])(range) - range[0]),
      frac = span / (span - 2 * pad),
      d = type === Log ? Object(vega_util_module["ob" /* zoomLog */])(domain, null, frac) : type === Sqrt ? Object(vega_util_module["pb" /* zoomPow */])(domain, null, frac, 0.5) : type === Pow ? Object(vega_util_module["pb" /* zoomPow */])(domain, null, frac, exponent || 1) : type === Symlog ? Object(vega_util_module["qb" /* zoomSymlog */])(domain, null, frac, constant || 1) : Object(vega_util_module["nb" /* zoomLinear */])(domain, null, frac);
  domain = domain.slice();
  domain[0] = d[0];
  domain[domain.length - 1] = d[1];
  return domain;
}

function domainCheck(type, domain, df) {
  if (isLogarithmic(type)) {
    // sum signs of domain values
    // if all pos or all neg, abs(sum) === domain.length
    var s = Math.abs(domain.reduce((s, v) => s + (v < 0 ? -1 : v > 0 ? 1 : 0), 0));

    if (s !== domain.length) {
      df.warn('Log scale domain includes zero: ' + Object(vega_util_module["bb" /* stringValue */])(domain));
    }
  }

  return domain;
}

function configureBins(scale, _, count) {
  let bins = _.bins;

  if (bins && !Object(vega_util_module["B" /* isArray */])(bins)) {
    // generate bin boundary array
    const domain = scale.domain(),
          lo = domain[0],
          hi = Object(vega_util_module["W" /* peek */])(domain),
          step = bins.step;
    let start = bins.start == null ? lo : bins.start,
        stop = bins.stop == null ? hi : bins.stop;
    if (!step) Object(vega_util_module["o" /* error */])('Scale bins parameter missing step property.');
    if (start < lo) start = step * Math.ceil(lo / step);
    if (stop > hi) stop = step * Math.floor(hi / step);
    bins = src_range(start, stop + step / 2, step);
  }

  if (bins) {
    // assign bin boundaries to scale instance
    scale.bins = bins;
  } else if (scale.bins) {
    // no current bins, remove bins if previously set
    delete scale.bins;
  } // special handling for bin-ordinal scales


  if (scale.type === BinOrdinal) {
    if (!bins) {
      // the domain specifies the bins
      scale.bins = scale.domain();
    } else if (!_.domain && !_.domainRaw) {
      // the bins specify the domain
      scale.domain(bins);
      count = bins.length;
    }
  } // return domain cardinality


  return count;
}

function configureRange(scale, _, count) {
  var type = scale.type,
      round = _.round || false,
      range = _.range; // if range step specified, calculate full range extent

  if (_.rangeStep != null) {
    range = configureRangeStep(type, _, count);
  } // else if a range scheme is defined, use that
  else if (_.scheme) {
      range = configureScheme(type, _, count);

      if (Object(vega_util_module["E" /* isFunction */])(range)) {
        if (scale.interpolator) {
          return scale.interpolator(range);
        } else {
          Object(vega_util_module["o" /* error */])("Scale type ".concat(type, " does not support interpolating color schemes."));
        }
      }
    } // given a range array for an interpolating scale, convert to interpolator


  if (range && isInterpolating(type)) {
    return scale.interpolator(interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma));
  } // configure rounding / interpolation


  if (range && _.interpolate && scale.interpolate) {
    scale.interpolate(vega_scale_module_interpolate(_.interpolate, _.interpolateGamma));
  } else if (Object(vega_util_module["E" /* isFunction */])(scale.round)) {
    scale.round(round);
  } else if (Object(vega_util_module["E" /* isFunction */])(scale.rangeRound)) {
    scale.interpolate(round ? src_round : src_value);
  }

  if (range) scale.range(flip(range, _.reverse));
}

function configureRangeStep(type, _, count) {
  if (type !== Band && type !== Point) {
    Object(vega_util_module["o" /* error */])('Only band and point scales support rangeStep.');
  } // calculate full range based on requested step size and padding


  var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0,
      inner = type === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0;
  return [0, _.rangeStep * bandSpace(count, inner, outer)];
}

function configureScheme(type, _, count) {
  var extent = _.schemeExtent,
      name,
      scheme$1;

  if (Object(vega_util_module["B" /* isArray */])(_.scheme)) {
    scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma);
  } else {
    name = _.scheme.toLowerCase();
    scheme$1 = vega_scale_module_scheme(name);
    if (!scheme$1) Object(vega_util_module["o" /* error */])("Unrecognized scheme name: ".concat(_.scheme));
  } // determine size for potential discrete range


  count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === vega_scale_module_Quantile || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate

  return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) : Object(vega_util_module["E" /* isFunction */])(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) : type === Ordinal ? scheme$1 : scheme$1.slice(0, count);
}

function adjustScheme(scheme, extent, reverse) {
  return Object(vega_util_module["E" /* isFunction */])(scheme) && (extent || reverse) ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) : scheme;
}

function flip(array, reverse) {
  return reverse ? array.slice().reverse() : array;
}

/**
 * Sorts scenegraph items in the pulse source array.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(*,*): number} [params.sort] - A comparator
 *   function for sorting tuples.
 */

function SortItems(params) {
  Transform.call(this, null, params);
}
Object(vega_util_module["z" /* inherits */])(SortItems, Transform, {
  transform(_, pulse) {
    const mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum');
    if (mod) pulse.source.sort(stableCompare(_.sort));
    this.modified(mod);
    return pulse;
  }

});

const Zero = 'zero',
      Center = 'center',
      Normalize = 'normalize',
      DefOutput = ['y0', 'y1'];
/**
 * Stack layout for visualization elements.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The value field to stack.
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby.
 * @param {function(object,object): number} [params.sort] - A comparator for stack sorting.
 * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'.
 */

function Stack(params) {
  Transform.call(this, null, params);
}
Stack.Definition = {
  'type': 'Stack',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field'
  }, {
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'sort',
    'type': 'compare'
  }, {
    'name': 'offset',
    'type': 'enum',
    'default': Zero,
    'values': [Zero, Center, Normalize]
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': 2,
    'default': DefOutput
  }]
};
Object(vega_util_module["z" /* inherits */])(Stack, Transform, {
  transform(_, pulse) {
    var as = _.as || DefOutput,
        y0 = as[0],
        y1 = as[1],
        sort = stableCompare(_.sort),
        field = _.field || vega_util_module["Q" /* one */],
        stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,
        groups,
        i,
        n,
        max; // partition, sum, and sort the stack groups

    groups = vega_encode_module_partition(pulse.source, _.groupby, sort, field); // compute stack layouts per group

    for (i = 0, n = groups.length, max = groups.max; i < n; ++i) {
      stack(groups[i], max, field, y0, y1);
    }

    return pulse.reflow(_.modified()).modifies(as);
  }

});

function stackCenter(group, max, field, y0, y1) {
  var last = (max - group.sum) / 2,
      m = group.length,
      j = 0,
      t;

  for (; j < m; ++j) {
    t = group[j];
    t[y0] = last;
    t[y1] = last += Math.abs(field(t));
  }
}

function stackNormalize(group, max, field, y0, y1) {
  var scale = 1 / group.sum,
      last = 0,
      m = group.length,
      j = 0,
      v = 0,
      t;

  for (; j < m; ++j) {
    t = group[j];
    t[y0] = last;
    t[y1] = last = scale * (v += Math.abs(field(t)));
  }
}

function stackZero(group, max, field, y0, y1) {
  var lastPos = 0,
      lastNeg = 0,
      m = group.length,
      j = 0,
      v,
      t;

  for (; j < m; ++j) {
    t = group[j];
    v = +field(t);

    if (v < 0) {
      t[y0] = lastNeg;
      t[y1] = lastNeg += v;
    } else {
      t[y0] = lastPos;
      t[y1] = lastPos += v;
    }
  }
}

function vega_encode_module_partition(data, groupby, sort, field) {
  var groups = [],
      get = f => f(t),
      map,
      i,
      n,
      m,
      t,
      k,
      g,
      s,
      max; // partition data points into stack groups


  if (groupby == null) {
    groups.push(data.slice());
  } else {
    for (map = {}, i = 0, n = data.length; i < n; ++i) {
      t = data[i];
      k = groupby.map(get);
      g = map[k];

      if (!g) {
        map[k] = g = [];
        groups.push(g);
      }

      g.push(t);
    }
  } // compute sums of groups, sort groups as needed


  for (k = 0, max = 0, m = groups.length; k < m; ++k) {
    g = groups[k];

    for (i = 0, s = 0, n = g.length; i < n; ++i) {
      s += Math.abs(field(g[i]));
    }

    g.sum = s;
    if (s > max) max = s;
    if (sort) g.sort(sort);
  }

  groups.max = max;
  return groups;
}



// CONCATENATED MODULE: ./node_modules/d3-geo/src/identity.js
/* harmony default export */ var src_identity = (x => x);

// CONCATENATED MODULE: ./node_modules/d3-geo/src/stream.js
function streamGeometry(geometry, stream) {
  if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
    streamGeometryType[geometry.type](geometry, stream);
  }
}

var streamObjectType = {
  Feature: function(object, stream) {
    streamGeometry(object.geometry, stream);
  },
  FeatureCollection: function(object, stream) {
    var features = object.features, i = -1, n = features.length;
    while (++i < n) streamGeometry(features[i].geometry, stream);
  }
};

var streamGeometryType = {
  Sphere: function(object, stream) {
    stream.sphere();
  },
  Point: function(object, stream) {
    object = object.coordinates;
    stream.point(object[0], object[1], object[2]);
  },
  MultiPoint: function(object, stream) {
    var coordinates = object.coordinates, i = -1, n = coordinates.length;
    while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);
  },
  LineString: function(object, stream) {
    streamLine(object.coordinates, stream, 0);
  },
  MultiLineString: function(object, stream) {
    var coordinates = object.coordinates, i = -1, n = coordinates.length;
    while (++i < n) streamLine(coordinates[i], stream, 0);
  },
  Polygon: function(object, stream) {
    streamPolygon(object.coordinates, stream);
  },
  MultiPolygon: function(object, stream) {
    var coordinates = object.coordinates, i = -1, n = coordinates.length;
    while (++i < n) streamPolygon(coordinates[i], stream);
  },
  GeometryCollection: function(object, stream) {
    var geometries = object.geometries, i = -1, n = geometries.length;
    while (++i < n) streamGeometry(geometries[i], stream);
  }
};

function streamLine(coordinates, stream, closed) {
  var i = -1, n = coordinates.length - closed, coordinate;
  stream.lineStart();
  while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);
  stream.lineEnd();
}

function streamPolygon(coordinates, stream) {
  var i = -1, n = coordinates.length;
  stream.polygonStart();
  while (++i < n) streamLine(coordinates[i], stream, 1);
  stream.polygonEnd();
}

/* harmony default export */ var src_stream = (function(object, stream) {
  if (object && streamObjectType.hasOwnProperty(object.type)) {
    streamObjectType[object.type](object, stream);
  } else {
    streamGeometry(object, stream);
  }
});

// CONCATENATED MODULE: ./node_modules/d3-array/src/fsum.js
// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423
class Adder {
  constructor() {
    this._partials = new Float64Array(32);
    this._n = 0;
  }
  add(x) {
    const p = this._partials;
    let i = 0;
    for (let j = 0; j < this._n && j < 32; j++) {
      const y = p[j],
        hi = x + y,
        lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
      if (lo) p[i++] = lo;
      x = hi;
    }
    p[i] = x;
    this._n = i + 1;
    return this;
  }
  valueOf() {
    const p = this._partials;
    let n = this._n, x, y, lo, hi = 0;
    if (n > 0) {
      hi = p[--n];
      while (n > 0) {
        x = hi;
        y = p[--n];
        hi = x + y;
        lo = y - (hi - x);
        if (lo) break;
      }
      if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) {
        y = lo * 2;
        x = hi + y;
        if (y == x - hi) hi = x;
      }
    }
    return hi;
  }
}

function fsum(values, valueof) {
  const adder = new Adder();
  if (valueof === undefined) {
    for (let value of values) {
      if (value = +value) {
        adder.add(value);
      }
    }
  } else {
    let index = -1;
    for (let value of values) {
      if (value = +valueof(value, ++index, values)) {
        adder.add(value);
      }
    }
  }
  return +adder;
}

function fcumsum(values, valueof) {
  const adder = new Adder();
  let index = -1;
  return Float64Array.from(values, valueof === undefined
      ? v => adder.add(+v || 0)
      : v => adder.add(+valueof(v, ++index, values) || 0)
  );
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/math.js
var src_math_epsilon = 1e-6;
var math_epsilon2 = 1e-12;
var math_pi = Math.PI;
var math_halfPi = math_pi / 2;
var quarterPi = math_pi / 4;
var math_tau = math_pi * 2;

var src_math_degrees = 180 / math_pi;
var math_radians = math_pi / 180;

var math_abs = Math.abs;
var atan = Math.atan;
var math_atan2 = Math.atan2;
var math_cos = Math.cos;
var ceil = Math.ceil;
var math_exp = Math.exp;
var math_floor = Math.floor;
var hypot = Math.hypot;
var math_log = Math.log;
var math_pow = Math.pow;
var math_sin = Math.sin;
var math_sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };
var math_sqrt = Math.sqrt;
var tan = Math.tan;

function math_acos(x) {
  return x > 1 ? 0 : x < -1 ? math_pi : Math.acos(x);
}

function math_asin(x) {
  return x > 1 ? math_halfPi : x < -1 ? -math_halfPi : Math.asin(x);
}

function haversin(x) {
  return (x = math_sin(x / 2)) * x;
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/noop.js
function noop_noop() {}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/path/area.js




var areaSum = new Adder(),
    areaRingSum = new Adder(),
    area_x00,
    area_y00,
    area_x0,
    area_y0;

var areaStream = {
  point: noop_noop,
  lineStart: noop_noop,
  lineEnd: noop_noop,
  polygonStart: function() {
    areaStream.lineStart = areaRingStart;
    areaStream.lineEnd = areaRingEnd;
  },
  polygonEnd: function() {
    areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop_noop;
    areaSum.add(math_abs(areaRingSum));
    areaRingSum = new Adder();
  },
  result: function() {
    var area = areaSum / 2;
    areaSum = new Adder();
    return area;
  }
};

function areaRingStart() {
  areaStream.point = areaPointFirst;
}

function areaPointFirst(x, y) {
  areaStream.point = areaPoint;
  area_x00 = area_x0 = x, area_y00 = area_y0 = y;
}

function areaPoint(x, y) {
  areaRingSum.add(area_y0 * x - area_x0 * y);
  area_x0 = x, area_y0 = y;
}

function areaRingEnd() {
  areaPoint(area_x00, area_y00);
}

/* harmony default export */ var path_area = (areaStream);

// CONCATENATED MODULE: ./node_modules/d3-geo/src/path/bounds.js


var bounds_x0 = Infinity,
    bounds_y0 = bounds_x0,
    bounds_x1 = -bounds_x0,
    bounds_y1 = bounds_x1;

var boundsStream = {
  point: boundsPoint,
  lineStart: noop_noop,
  lineEnd: noop_noop,
  polygonStart: noop_noop,
  polygonEnd: noop_noop,
  result: function() {
    var bounds = [[bounds_x0, bounds_y0], [bounds_x1, bounds_y1]];
    bounds_x1 = bounds_y1 = -(bounds_y0 = bounds_x0 = Infinity);
    return bounds;
  }
};

function boundsPoint(x, y) {
  if (x < bounds_x0) bounds_x0 = x;
  if (x > bounds_x1) bounds_x1 = x;
  if (y < bounds_y0) bounds_y0 = y;
  if (y > bounds_y1) bounds_y1 = y;
}

/* harmony default export */ var path_bounds = (boundsStream);

// CONCATENATED MODULE: ./node_modules/d3-geo/src/path/centroid.js


// TODO Enforce positive area for exterior, negative area for interior?

var centroid_X0 = 0,
    centroid_Y0 = 0,
    Z0 = 0,
    centroid_X1 = 0,
    centroid_Y1 = 0,
    Z1 = 0,
    X2 = 0,
    Y2 = 0,
    Z2 = 0,
    centroid_x00,
    centroid_y00,
    centroid_x0,
    centroid_y0;

var centroidStream = {
  point: centroidPoint,
  lineStart: centroidLineStart,
  lineEnd: centroidLineEnd,
  polygonStart: function() {
    centroidStream.lineStart = centroidRingStart;
    centroidStream.lineEnd = centroidRingEnd;
  },
  polygonEnd: function() {
    centroidStream.point = centroidPoint;
    centroidStream.lineStart = centroidLineStart;
    centroidStream.lineEnd = centroidLineEnd;
  },
  result: function() {
    var centroid = Z2 ? [X2 / Z2, Y2 / Z2]
        : Z1 ? [centroid_X1 / Z1, centroid_Y1 / Z1]
        : Z0 ? [centroid_X0 / Z0, centroid_Y0 / Z0]
        : [NaN, NaN];
    centroid_X0 = centroid_Y0 = Z0 =
    centroid_X1 = centroid_Y1 = Z1 =
    X2 = Y2 = Z2 = 0;
    return centroid;
  }
};

function centroidPoint(x, y) {
  centroid_X0 += x;
  centroid_Y0 += y;
  ++Z0;
}

function centroidLineStart() {
  centroidStream.point = centroidPointFirstLine;
}

function centroidPointFirstLine(x, y) {
  centroidStream.point = centroidPointLine;
  centroidPoint(centroid_x0 = x, centroid_y0 = y);
}

function centroidPointLine(x, y) {
  var dx = x - centroid_x0, dy = y - centroid_y0, z = math_sqrt(dx * dx + dy * dy);
  centroid_X1 += z * (centroid_x0 + x) / 2;
  centroid_Y1 += z * (centroid_y0 + y) / 2;
  Z1 += z;
  centroidPoint(centroid_x0 = x, centroid_y0 = y);
}

function centroidLineEnd() {
  centroidStream.point = centroidPoint;
}

function centroidRingStart() {
  centroidStream.point = centroidPointFirstRing;
}

function centroidRingEnd() {
  centroidPointRing(centroid_x00, centroid_y00);
}

function centroidPointFirstRing(x, y) {
  centroidStream.point = centroidPointRing;
  centroidPoint(centroid_x00 = centroid_x0 = x, centroid_y00 = centroid_y0 = y);
}

function centroidPointRing(x, y) {
  var dx = x - centroid_x0,
      dy = y - centroid_y0,
      z = math_sqrt(dx * dx + dy * dy);

  centroid_X1 += z * (centroid_x0 + x) / 2;
  centroid_Y1 += z * (centroid_y0 + y) / 2;
  Z1 += z;

  z = centroid_y0 * x - centroid_x0 * y;
  X2 += z * (centroid_x0 + x);
  Y2 += z * (centroid_y0 + y);
  Z2 += z * 3;
  centroidPoint(centroid_x0 = x, centroid_y0 = y);
}

/* harmony default export */ var centroid = (centroidStream);

// CONCATENATED MODULE: ./node_modules/d3-geo/src/path/context.js



function PathContext(context) {
  this._context = context;
}

PathContext.prototype = {
  _radius: 4.5,
  pointRadius: function(_) {
    return this._radius = _, this;
  },
  polygonStart: function() {
    this._line = 0;
  },
  polygonEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    if (this._line === 0) this._context.closePath();
    this._point = NaN;
  },
  point: function(x, y) {
    switch (this._point) {
      case 0: {
        this._context.moveTo(x, y);
        this._point = 1;
        break;
      }
      case 1: {
        this._context.lineTo(x, y);
        break;
      }
      default: {
        this._context.moveTo(x + this._radius, y);
        this._context.arc(x, y, this._radius, 0, math_tau);
        break;
      }
    }
  },
  result: noop_noop
};

// CONCATENATED MODULE: ./node_modules/d3-geo/src/path/measure.js




var lengthSum = new Adder(),
    lengthRing,
    measure_x00,
    measure_y00,
    measure_x0,
    measure_y0;

var lengthStream = {
  point: noop_noop,
  lineStart: function() {
    lengthStream.point = lengthPointFirst;
  },
  lineEnd: function() {
    if (lengthRing) lengthPoint(measure_x00, measure_y00);
    lengthStream.point = noop_noop;
  },
  polygonStart: function() {
    lengthRing = true;
  },
  polygonEnd: function() {
    lengthRing = null;
  },
  result: function() {
    var length = +lengthSum;
    lengthSum = new Adder();
    return length;
  }
};

function lengthPointFirst(x, y) {
  lengthStream.point = lengthPoint;
  measure_x00 = measure_x0 = x, measure_y00 = measure_y0 = y;
}

function lengthPoint(x, y) {
  measure_x0 -= x, measure_y0 -= y;
  lengthSum.add(math_sqrt(measure_x0 * measure_x0 + measure_y0 * measure_y0));
  measure_x0 = x, measure_y0 = y;
}

/* harmony default export */ var path_measure = (lengthStream);

// CONCATENATED MODULE: ./node_modules/d3-geo/src/path/string.js
function PathString() {
  this._string = [];
}

PathString.prototype = {
  _radius: 4.5,
  _circle: string_circle(4.5),
  pointRadius: function(_) {
    if ((_ = +_) !== this._radius) this._radius = _, this._circle = null;
    return this;
  },
  polygonStart: function() {
    this._line = 0;
  },
  polygonEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    if (this._line === 0) this._string.push("Z");
    this._point = NaN;
  },
  point: function(x, y) {
    switch (this._point) {
      case 0: {
        this._string.push("M", x, ",", y);
        this._point = 1;
        break;
      }
      case 1: {
        this._string.push("L", x, ",", y);
        break;
      }
      default: {
        if (this._circle == null) this._circle = string_circle(this._radius);
        this._string.push("M", x, ",", y, this._circle);
        break;
      }
    }
  },
  result: function() {
    if (this._string.length) {
      var result = this._string.join("");
      this._string = [];
      return result;
    } else {
      return null;
    }
  }
};

function string_circle(radius) {
  return "m0," + radius
      + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius
      + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius
      + "z";
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/path/index.js









/* harmony default export */ var d3_geo_src_path = (function(projection, context) {
  var pointRadius = 4.5,
      projectionStream,
      contextStream;

  function path(object) {
    if (object) {
      if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
      src_stream(object, projectionStream(contextStream));
    }
    return contextStream.result();
  }

  path.area = function(object) {
    src_stream(object, projectionStream(path_area));
    return path_area.result();
  };

  path.measure = function(object) {
    src_stream(object, projectionStream(path_measure));
    return path_measure.result();
  };

  path.bounds = function(object) {
    src_stream(object, projectionStream(path_bounds));
    return path_bounds.result();
  };

  path.centroid = function(object) {
    src_stream(object, projectionStream(centroid));
    return centroid.result();
  };

  path.projection = function(_) {
    return arguments.length ? (projectionStream = _ == null ? (projection = null, src_identity) : (projection = _).stream, path) : projection;
  };

  path.context = function(_) {
    if (!arguments.length) return context;
    contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _);
    if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
    return path;
  };

  path.pointRadius = function(_) {
    if (!arguments.length) return pointRadius;
    pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
    return path;
  };

  return path.projection(projection).context(context);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/clip/buffer.js


/* harmony default export */ var clip_buffer = (function() {
  var lines = [],
      line;
  return {
    point: function(x, y, m) {
      line.push([x, y, m]);
    },
    lineStart: function() {
      lines.push(line = []);
    },
    lineEnd: noop_noop,
    rejoin: function() {
      if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
    },
    result: function() {
      var result = lines;
      lines = [];
      line = null;
      return result;
    }
  };
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/pointEqual.js


/* harmony default export */ var pointEqual = (function(a, b) {
  return math_abs(a[0] - b[0]) < src_math_epsilon && math_abs(a[1] - b[1]) < src_math_epsilon;
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/clip/rejoin.js



function Intersection(point, points, other, entry) {
  this.x = point;
  this.z = points;
  this.o = other; // another intersection
  this.e = entry; // is an entry?
  this.v = false; // visited
  this.n = this.p = null; // next & previous
}

// A generalized polygon clipping algorithm: given a polygon that has been cut
// into its visible line segments, and rejoins the segments by interpolating
// along the clip edge.
/* harmony default export */ var rejoin = (function(segments, compareIntersection, startInside, interpolate, stream) {
  var subject = [],
      clip = [],
      i,
      n;

  segments.forEach(function(segment) {
    if ((n = segment.length - 1) <= 0) return;
    var n, p0 = segment[0], p1 = segment[n], x;

    if (pointEqual(p0, p1)) {
      if (!p0[2] && !p1[2]) {
        stream.lineStart();
        for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);
        stream.lineEnd();
        return;
      }
      // handle degenerate cases by moving the point
      p1[0] += 2 * src_math_epsilon;
    }

    subject.push(x = new Intersection(p0, segment, null, true));
    clip.push(x.o = new Intersection(p0, null, x, false));
    subject.push(x = new Intersection(p1, segment, null, false));
    clip.push(x.o = new Intersection(p1, null, x, true));
  });

  if (!subject.length) return;

  clip.sort(compareIntersection);
  rejoin_link(subject);
  rejoin_link(clip);

  for (i = 0, n = clip.length; i < n; ++i) {
    clip[i].e = startInside = !startInside;
  }

  var start = subject[0],
      points,
      point;

  while (1) {
    // Find first unvisited intersection.
    var current = start,
        isSubject = true;
    while (current.v) if ((current = current.n) === start) return;
    points = current.z;
    stream.lineStart();
    do {
      current.v = current.o.v = true;
      if (current.e) {
        if (isSubject) {
          for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);
        } else {
          interpolate(current.x, current.n.x, 1, stream);
        }
        current = current.n;
      } else {
        if (isSubject) {
          points = current.p.z;
          for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);
        } else {
          interpolate(current.x, current.p.x, -1, stream);
        }
        current = current.p;
      }
      current = current.o;
      points = current.z;
      isSubject = !isSubject;
    } while (!current.v);
    stream.lineEnd();
  }
});

function rejoin_link(array) {
  if (!(n = array.length)) return;
  var n,
      i = 0,
      a = array[0],
      b;
  while (++i < n) {
    a.n = b = array[i];
    b.p = a;
    a = b;
  }
  a.n = b = array[0];
  b.p = a;
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/cartesian.js


function cartesian_spherical(cartesian) {
  return [math_atan2(cartesian[1], cartesian[0]), math_asin(cartesian[2])];
}

function cartesian_cartesian(spherical) {
  var lambda = spherical[0], phi = spherical[1], cosPhi = math_cos(phi);
  return [cosPhi * math_cos(lambda), cosPhi * math_sin(lambda), math_sin(phi)];
}

function cartesianDot(a, b) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}

function cartesianCross(a, b) {
  return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
}

// TODO return a
function cartesianAddInPlace(a, b) {
  a[0] += b[0], a[1] += b[1], a[2] += b[2];
}

function cartesianScale(vector, k) {
  return [vector[0] * k, vector[1] * k, vector[2] * k];
}

// TODO return d
function cartesianNormalizeInPlace(d) {
  var l = math_sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
  d[0] /= l, d[1] /= l, d[2] /= l;
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/polygonContains.js




function longitude(point) {
  if (math_abs(point[0]) <= math_pi)
    return point[0];
  else
    return math_sign(point[0]) * ((math_abs(point[0]) + math_pi) % math_tau - math_pi);
}

/* harmony default export */ var polygonContains = (function(polygon, point) {
  var lambda = longitude(point),
      phi = point[1],
      sinPhi = math_sin(phi),
      normal = [math_sin(lambda), -math_cos(lambda), 0],
      angle = 0,
      winding = 0;

  var sum = new Adder();

  if (sinPhi === 1) phi = math_halfPi + src_math_epsilon;
  else if (sinPhi === -1) phi = -math_halfPi - src_math_epsilon;

  for (var i = 0, n = polygon.length; i < n; ++i) {
    if (!(m = (ring = polygon[i]).length)) continue;
    var ring,
        m,
        point0 = ring[m - 1],
        lambda0 = longitude(point0),
        phi0 = point0[1] / 2 + quarterPi,
        sinPhi0 = math_sin(phi0),
        cosPhi0 = math_cos(phi0);

    for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
      var point1 = ring[j],
          lambda1 = longitude(point1),
          phi1 = point1[1] / 2 + quarterPi,
          sinPhi1 = math_sin(phi1),
          cosPhi1 = math_cos(phi1),
          delta = lambda1 - lambda0,
          sign = delta >= 0 ? 1 : -1,
          absDelta = sign * delta,
          antimeridian = absDelta > math_pi,
          k = sinPhi0 * sinPhi1;

      sum.add(math_atan2(k * sign * math_sin(absDelta), cosPhi0 * cosPhi1 + k * math_cos(absDelta)));
      angle += antimeridian ? delta + sign * math_tau : delta;

      // Are the longitudes either side of the point’s meridian (lambda),
      // and are the latitudes smaller than the parallel (phi)?
      if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
        var arc = cartesianCross(cartesian_cartesian(point0), cartesian_cartesian(point1));
        cartesianNormalizeInPlace(arc);
        var intersection = cartesianCross(normal, arc);
        cartesianNormalizeInPlace(intersection);
        var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * math_asin(intersection[2]);
        if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
          winding += antimeridian ^ delta >= 0 ? 1 : -1;
        }
      }
    }
  }

  // First, determine whether the South pole is inside or outside:
  //
  // It is inside if:
  // * the polygon winds around it in a clockwise direction.
  // * the polygon does not (cumulatively) wind around it, but has a negative
  //   (counter-clockwise) area.
  //
  // Second, count the (signed) number of times a segment crosses a lambda
  // from the point to the South pole.  If it is zero, then the point is the
  // same side as the South pole.

  return (angle < -src_math_epsilon || angle < src_math_epsilon && sum < -math_epsilon2) ^ (winding & 1);
});

// CONCATENATED MODULE: ./node_modules/d3-array/src/merge.js
function* merge_flatten(arrays) {
  for (const array of arrays) {
    yield* array;
  }
}

function merge_merge(arrays) {
  return Array.from(merge_flatten(arrays));
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/clip/index.js






/* harmony default export */ var src_clip = (function(pointVisible, clipLine, interpolate, start) {
  return function(sink) {
    var line = clipLine(sink),
        ringBuffer = clip_buffer(),
        ringSink = clipLine(ringBuffer),
        polygonStarted = false,
        polygon,
        segments,
        ring;

    var clip = {
      point: point,
      lineStart: lineStart,
      lineEnd: lineEnd,
      polygonStart: function() {
        clip.point = pointRing;
        clip.lineStart = ringStart;
        clip.lineEnd = ringEnd;
        segments = [];
        polygon = [];
      },
      polygonEnd: function() {
        clip.point = point;
        clip.lineStart = lineStart;
        clip.lineEnd = lineEnd;
        segments = merge_merge(segments);
        var startInside = polygonContains(polygon, start);
        if (segments.length) {
          if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
          rejoin(segments, clip_compareIntersection, startInside, interpolate, sink);
        } else if (startInside) {
          if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
          sink.lineStart();
          interpolate(null, null, 1, sink);
          sink.lineEnd();
        }
        if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
        segments = polygon = null;
      },
      sphere: function() {
        sink.polygonStart();
        sink.lineStart();
        interpolate(null, null, 1, sink);
        sink.lineEnd();
        sink.polygonEnd();
      }
    };

    function point(lambda, phi) {
      if (pointVisible(lambda, phi)) sink.point(lambda, phi);
    }

    function pointLine(lambda, phi) {
      line.point(lambda, phi);
    }

    function lineStart() {
      clip.point = pointLine;
      line.lineStart();
    }

    function lineEnd() {
      clip.point = point;
      line.lineEnd();
    }

    function pointRing(lambda, phi) {
      ring.push([lambda, phi]);
      ringSink.point(lambda, phi);
    }

    function ringStart() {
      ringSink.lineStart();
      ring = [];
    }

    function ringEnd() {
      pointRing(ring[0][0], ring[0][1]);
      ringSink.lineEnd();

      var clean = ringSink.clean(),
          ringSegments = ringBuffer.result(),
          i, n = ringSegments.length, m,
          segment,
          point;

      ring.pop();
      polygon.push(ring);
      ring = null;

      if (!n) return;

      // No intersections.
      if (clean & 1) {
        segment = ringSegments[0];
        if ((m = segment.length - 1) > 0) {
          if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
          sink.lineStart();
          for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);
          sink.lineEnd();
        }
        return;
      }

      // Rejoin connected segments.
      // TODO reuse ringBuffer.rejoin()?
      if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));

      segments.push(ringSegments.filter(validSegment));
    }

    return clip;
  };
});

function validSegment(segment) {
  return segment.length > 1;
}

// Intersections are sorted along the clip edge. For both antimeridian cutting
// and circle clipping, the same comparison is used.
function clip_compareIntersection(a, b) {
  return ((a = a.x)[0] < 0 ? a[1] - math_halfPi - src_math_epsilon : math_halfPi - a[1])
       - ((b = b.x)[0] < 0 ? b[1] - math_halfPi - src_math_epsilon : math_halfPi - b[1]);
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/clip/antimeridian.js



/* harmony default export */ var clip_antimeridian = (src_clip(
  function() { return true; },
  clipAntimeridianLine,
  clipAntimeridianInterpolate,
  [-math_pi, -math_halfPi]
));

// Takes a line and cuts into visible segments. Return values: 0 - there were
// intersections or the line was empty; 1 - no intersections; 2 - there were
// intersections, and the first and last segments should be rejoined.
function clipAntimeridianLine(stream) {
  var lambda0 = NaN,
      phi0 = NaN,
      sign0 = NaN,
      clean; // no intersections

  return {
    lineStart: function() {
      stream.lineStart();
      clean = 1;
    },
    point: function(lambda1, phi1) {
      var sign1 = lambda1 > 0 ? math_pi : -math_pi,
          delta = math_abs(lambda1 - lambda0);
      if (math_abs(delta - math_pi) < src_math_epsilon) { // line crosses a pole
        stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? math_halfPi : -math_halfPi);
        stream.point(sign0, phi0);
        stream.lineEnd();
        stream.lineStart();
        stream.point(sign1, phi0);
        stream.point(lambda1, phi0);
        clean = 0;
      } else if (sign0 !== sign1 && delta >= math_pi) { // line crosses antimeridian
        if (math_abs(lambda0 - sign0) < src_math_epsilon) lambda0 -= sign0 * src_math_epsilon; // handle degeneracies
        if (math_abs(lambda1 - sign1) < src_math_epsilon) lambda1 -= sign1 * src_math_epsilon;
        phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
        stream.point(sign0, phi0);
        stream.lineEnd();
        stream.lineStart();
        stream.point(sign1, phi0);
        clean = 0;
      }
      stream.point(lambda0 = lambda1, phi0 = phi1);
      sign0 = sign1;
    },
    lineEnd: function() {
      stream.lineEnd();
      lambda0 = phi0 = NaN;
    },
    clean: function() {
      return 2 - clean; // if intersections, rejoin first and last segments
    }
  };
}

function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {
  var cosPhi0,
      cosPhi1,
      sinLambda0Lambda1 = math_sin(lambda0 - lambda1);
  return math_abs(sinLambda0Lambda1) > src_math_epsilon
      ? atan((math_sin(phi0) * (cosPhi1 = math_cos(phi1)) * math_sin(lambda1)
          - math_sin(phi1) * (cosPhi0 = math_cos(phi0)) * math_sin(lambda0))
          / (cosPhi0 * cosPhi1 * sinLambda0Lambda1))
      : (phi0 + phi1) / 2;
}

function clipAntimeridianInterpolate(from, to, direction, stream) {
  var phi;
  if (from == null) {
    phi = direction * math_halfPi;
    stream.point(-math_pi, phi);
    stream.point(0, phi);
    stream.point(math_pi, phi);
    stream.point(math_pi, 0);
    stream.point(math_pi, -phi);
    stream.point(0, -phi);
    stream.point(-math_pi, -phi);
    stream.point(-math_pi, 0);
    stream.point(-math_pi, phi);
  } else if (math_abs(from[0] - to[0]) > src_math_epsilon) {
    var lambda = from[0] < to[0] ? math_pi : -math_pi;
    phi = direction * lambda / 2;
    stream.point(-lambda, phi);
    stream.point(0, phi);
    stream.point(lambda, phi);
  } else {
    stream.point(to[0], to[1]);
  }
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/constant.js
/* harmony default export */ var d3_geo_src_constant = (function(x) {
  return function() {
    return x;
  };
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/compose.js
/* harmony default export */ var compose = (function(a, b) {

  function compose(x, y) {
    return x = a(x, y), b(x[0], x[1]);
  }

  if (a.invert && b.invert) compose.invert = function(x, y) {
    return x = b.invert(x, y), x && a.invert(x[0], x[1]);
  };

  return compose;
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/rotation.js



function rotationIdentity(lambda, phi) {
  return [math_abs(lambda) > math_pi ? lambda + Math.round(-lambda / math_tau) * math_tau : lambda, phi];
}

rotationIdentity.invert = rotationIdentity;

function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
  return (deltaLambda %= math_tau) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma))
    : rotationLambda(deltaLambda))
    : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma)
    : rotationIdentity);
}

function forwardRotationLambda(deltaLambda) {
  return function(lambda, phi) {
    return lambda += deltaLambda, [lambda > math_pi ? lambda - math_tau : lambda < -math_pi ? lambda + math_tau : lambda, phi];
  };
}

function rotationLambda(deltaLambda) {
  var rotation = forwardRotationLambda(deltaLambda);
  rotation.invert = forwardRotationLambda(-deltaLambda);
  return rotation;
}

function rotationPhiGamma(deltaPhi, deltaGamma) {
  var cosDeltaPhi = math_cos(deltaPhi),
      sinDeltaPhi = math_sin(deltaPhi),
      cosDeltaGamma = math_cos(deltaGamma),
      sinDeltaGamma = math_sin(deltaGamma);

  function rotation(lambda, phi) {
    var cosPhi = math_cos(phi),
        x = math_cos(lambda) * cosPhi,
        y = math_sin(lambda) * cosPhi,
        z = math_sin(phi),
        k = z * cosDeltaPhi + x * sinDeltaPhi;
    return [
      math_atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),
      math_asin(k * cosDeltaGamma + y * sinDeltaGamma)
    ];
  }

  rotation.invert = function(lambda, phi) {
    var cosPhi = math_cos(phi),
        x = math_cos(lambda) * cosPhi,
        y = math_sin(lambda) * cosPhi,
        z = math_sin(phi),
        k = z * cosDeltaGamma - y * sinDeltaGamma;
    return [
      math_atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),
      math_asin(k * cosDeltaPhi - x * sinDeltaPhi)
    ];
  };

  return rotation;
}

/* harmony default export */ var src_rotation = (function(rotate) {
  rotate = rotateRadians(rotate[0] * math_radians, rotate[1] * math_radians, rotate.length > 2 ? rotate[2] * math_radians : 0);

  function forward(coordinates) {
    coordinates = rotate(coordinates[0] * math_radians, coordinates[1] * math_radians);
    return coordinates[0] *= src_math_degrees, coordinates[1] *= src_math_degrees, coordinates;
  }

  forward.invert = function(coordinates) {
    coordinates = rotate.invert(coordinates[0] * math_radians, coordinates[1] * math_radians);
    return coordinates[0] *= src_math_degrees, coordinates[1] *= src_math_degrees, coordinates;
  };

  return forward;
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/circle.js





// Generates a circle centered at [0°, 0°], with a given radius and precision.
function circleStream(stream, radius, delta, direction, t0, t1) {
  if (!delta) return;
  var cosRadius = math_cos(radius),
      sinRadius = math_sin(radius),
      step = direction * delta;
  if (t0 == null) {
    t0 = radius + direction * math_tau;
    t1 = radius - step / 2;
  } else {
    t0 = circleRadius(cosRadius, t0);
    t1 = circleRadius(cosRadius, t1);
    if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * math_tau;
  }
  for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
    point = cartesian_spherical([cosRadius, -sinRadius * math_cos(t), -sinRadius * math_sin(t)]);
    stream.point(point[0], point[1]);
  }
}

// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].
function circleRadius(cosRadius, point) {
  point = cartesian_cartesian(point), point[0] -= cosRadius;
  cartesianNormalizeInPlace(point);
  var radius = math_acos(-point[1]);
  return ((-point[2] < 0 ? -radius : radius) + math_tau - src_math_epsilon) % math_tau;
}

/* harmony default export */ var src_circle = (function() {
  var center = d3_geo_src_constant([0, 0]),
      radius = d3_geo_src_constant(90),
      precision = d3_geo_src_constant(6),
      ring,
      rotate,
      stream = {point: point};

  function point(x, y) {
    ring.push(x = rotate(x, y));
    x[0] *= src_math_degrees, x[1] *= src_math_degrees;
  }

  function circle() {
    var c = center.apply(this, arguments),
        r = radius.apply(this, arguments) * math_radians,
        p = precision.apply(this, arguments) * math_radians;
    ring = [];
    rotate = rotateRadians(-c[0] * math_radians, -c[1] * math_radians, 0).invert;
    circleStream(stream, r, p, 1);
    c = {type: "Polygon", coordinates: [ring]};
    ring = rotate = null;
    return c;
  }

  circle.center = function(_) {
    return arguments.length ? (center = typeof _ === "function" ? _ : d3_geo_src_constant([+_[0], +_[1]]), circle) : center;
  };

  circle.radius = function(_) {
    return arguments.length ? (radius = typeof _ === "function" ? _ : d3_geo_src_constant(+_), circle) : radius;
  };

  circle.precision = function(_) {
    return arguments.length ? (precision = typeof _ === "function" ? _ : d3_geo_src_constant(+_), circle) : precision;
  };

  return circle;
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/clip/circle.js






/* harmony default export */ var clip_circle = (function(radius) {
  var cr = math_cos(radius),
      delta = 6 * math_radians,
      smallRadius = cr > 0,
      notHemisphere = math_abs(cr) > src_math_epsilon; // TODO optimise for this common case

  function interpolate(from, to, direction, stream) {
    circleStream(stream, radius, delta, direction, from, to);
  }

  function visible(lambda, phi) {
    return math_cos(lambda) * math_cos(phi) > cr;
  }

  // Takes a line and cuts into visible segments. Return values used for polygon
  // clipping: 0 - there were intersections or the line was empty; 1 - no
  // intersections 2 - there were intersections, and the first and last segments
  // should be rejoined.
  function clipLine(stream) {
    var point0, // previous point
        c0, // code for previous point
        v0, // visibility of previous point
        v00, // visibility of first point
        clean; // no intersections
    return {
      lineStart: function() {
        v00 = v0 = false;
        clean = 1;
      },
      point: function(lambda, phi) {
        var point1 = [lambda, phi],
            point2,
            v = visible(lambda, phi),
            c = smallRadius
              ? v ? 0 : code(lambda, phi)
              : v ? code(lambda + (lambda < 0 ? math_pi : -math_pi), phi) : 0;
        if (!point0 && (v00 = v0 = v)) stream.lineStart();
        if (v !== v0) {
          point2 = intersect(point0, point1);
          if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2))
            point1[2] = 1;
        }
        if (v !== v0) {
          clean = 0;
          if (v) {
            // outside going in
            stream.lineStart();
            point2 = intersect(point1, point0);
            stream.point(point2[0], point2[1]);
          } else {
            // inside going out
            point2 = intersect(point0, point1);
            stream.point(point2[0], point2[1], 2);
            stream.lineEnd();
          }
          point0 = point2;
        } else if (notHemisphere && point0 && smallRadius ^ v) {
          var t;
          // If the codes for two points are different, or are both zero,
          // and there this segment intersects with the small circle.
          if (!(c & c0) && (t = intersect(point1, point0, true))) {
            clean = 0;
            if (smallRadius) {
              stream.lineStart();
              stream.point(t[0][0], t[0][1]);
              stream.point(t[1][0], t[1][1]);
              stream.lineEnd();
            } else {
              stream.point(t[1][0], t[1][1]);
              stream.lineEnd();
              stream.lineStart();
              stream.point(t[0][0], t[0][1], 3);
            }
          }
        }
        if (v && (!point0 || !pointEqual(point0, point1))) {
          stream.point(point1[0], point1[1]);
        }
        point0 = point1, v0 = v, c0 = c;
      },
      lineEnd: function() {
        if (v0) stream.lineEnd();
        point0 = null;
      },
      // Rejoin first and last segments if there were intersections and the first
      // and last points were visible.
      clean: function() {
        return clean | ((v00 && v0) << 1);
      }
    };
  }

  // Intersects the great circle between a and b with the clip circle.
  function intersect(a, b, two) {
    var pa = cartesian_cartesian(a),
        pb = cartesian_cartesian(b);

    // We have two planes, n1.p = d1 and n2.p = d2.
    // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).
    var n1 = [1, 0, 0], // normal
        n2 = cartesianCross(pa, pb),
        n2n2 = cartesianDot(n2, n2),
        n1n2 = n2[0], // cartesianDot(n1, n2),
        determinant = n2n2 - n1n2 * n1n2;

    // Two polar points.
    if (!determinant) return !two && a;

    var c1 =  cr * n2n2 / determinant,
        c2 = -cr * n1n2 / determinant,
        n1xn2 = cartesianCross(n1, n2),
        A = cartesianScale(n1, c1),
        B = cartesianScale(n2, c2);
    cartesianAddInPlace(A, B);

    // Solve |p(t)|^2 = 1.
    var u = n1xn2,
        w = cartesianDot(A, u),
        uu = cartesianDot(u, u),
        t2 = w * w - uu * (cartesianDot(A, A) - 1);

    if (t2 < 0) return;

    var t = math_sqrt(t2),
        q = cartesianScale(u, (-w - t) / uu);
    cartesianAddInPlace(q, A);
    q = cartesian_spherical(q);

    if (!two) return q;

    // Two intersection points.
    var lambda0 = a[0],
        lambda1 = b[0],
        phi0 = a[1],
        phi1 = b[1],
        z;

    if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;

    var delta = lambda1 - lambda0,
        polar = math_abs(delta - math_pi) < src_math_epsilon,
        meridian = polar || delta < src_math_epsilon;

    if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;

    // Check that the first point is between a and b.
    if (meridian
        ? polar
          ? phi0 + phi1 > 0 ^ q[1] < (math_abs(q[0] - lambda0) < src_math_epsilon ? phi0 : phi1)
          : phi0 <= q[1] && q[1] <= phi1
        : delta > math_pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
      var q1 = cartesianScale(u, (-w + t) / uu);
      cartesianAddInPlace(q1, A);
      return [q, cartesian_spherical(q1)];
    }
  }

  // Generates a 4-bit vector representing the location of a point relative to
  // the small circle's bounding box.
  function code(lambda, phi) {
    var r = smallRadius ? radius : math_pi - radius,
        code = 0;
    if (lambda < -r) code |= 1; // left
    else if (lambda > r) code |= 2; // right
    if (phi < -r) code |= 4; // below
    else if (phi > r) code |= 8; // above
    return code;
  }

  return src_clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-math_pi, radius - math_pi]);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/clip/line.js
/* harmony default export */ var clip_line = (function(a, b, x0, y0, x1, y1) {
  var ax = a[0],
      ay = a[1],
      bx = b[0],
      by = b[1],
      t0 = 0,
      t1 = 1,
      dx = bx - ax,
      dy = by - ay,
      r;

  r = x0 - ax;
  if (!dx && r > 0) return;
  r /= dx;
  if (dx < 0) {
    if (r < t0) return;
    if (r < t1) t1 = r;
  } else if (dx > 0) {
    if (r > t1) return;
    if (r > t0) t0 = r;
  }

  r = x1 - ax;
  if (!dx && r < 0) return;
  r /= dx;
  if (dx < 0) {
    if (r > t1) return;
    if (r > t0) t0 = r;
  } else if (dx > 0) {
    if (r < t0) return;
    if (r < t1) t1 = r;
  }

  r = y0 - ay;
  if (!dy && r > 0) return;
  r /= dy;
  if (dy < 0) {
    if (r < t0) return;
    if (r < t1) t1 = r;
  } else if (dy > 0) {
    if (r > t1) return;
    if (r > t0) t0 = r;
  }

  r = y1 - ay;
  if (!dy && r < 0) return;
  r /= dy;
  if (dy < 0) {
    if (r > t1) return;
    if (r > t0) t0 = r;
  } else if (dy > 0) {
    if (r < t0) return;
    if (r < t1) t1 = r;
  }

  if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
  if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
  return true;
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/clip/rectangle.js






var clipMax = 1e9, clipMin = -clipMax;

// TODO Use d3-polygon’s polygonContains here for the ring check?
// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?

function clipRectangle(x0, y0, x1, y1) {

  function visible(x, y) {
    return x0 <= x && x <= x1 && y0 <= y && y <= y1;
  }

  function interpolate(from, to, direction, stream) {
    var a = 0, a1 = 0;
    if (from == null
        || (a = corner(from, direction)) !== (a1 = corner(to, direction))
        || comparePoint(from, to) < 0 ^ direction > 0) {
      do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
      while ((a = (a + direction + 4) % 4) !== a1);
    } else {
      stream.point(to[0], to[1]);
    }
  }

  function corner(p, direction) {
    return math_abs(p[0] - x0) < src_math_epsilon ? direction > 0 ? 0 : 3
        : math_abs(p[0] - x1) < src_math_epsilon ? direction > 0 ? 2 : 1
        : math_abs(p[1] - y0) < src_math_epsilon ? direction > 0 ? 1 : 0
        : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon
  }

  function compareIntersection(a, b) {
    return comparePoint(a.x, b.x);
  }

  function comparePoint(a, b) {
    var ca = corner(a, 1),
        cb = corner(b, 1);
    return ca !== cb ? ca - cb
        : ca === 0 ? b[1] - a[1]
        : ca === 1 ? a[0] - b[0]
        : ca === 2 ? a[1] - b[1]
        : b[0] - a[0];
  }

  return function(stream) {
    var activeStream = stream,
        bufferStream = clip_buffer(),
        segments,
        polygon,
        ring,
        x__, y__, v__, // first point
        x_, y_, v_, // previous point
        first,
        clean;

    var clipStream = {
      point: point,
      lineStart: lineStart,
      lineEnd: lineEnd,
      polygonStart: polygonStart,
      polygonEnd: polygonEnd
    };

    function point(x, y) {
      if (visible(x, y)) activeStream.point(x, y);
    }

    function polygonInside() {
      var winding = 0;

      for (var i = 0, n = polygon.length; i < n; ++i) {
        for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {
          a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];
          if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; }
          else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; }
        }
      }

      return winding;
    }

    // Buffer geometry within a polygon and then clip it en masse.
    function polygonStart() {
      activeStream = bufferStream, segments = [], polygon = [], clean = true;
    }

    function polygonEnd() {
      var startInside = polygonInside(),
          cleanInside = clean && startInside,
          visible = (segments = merge_merge(segments)).length;
      if (cleanInside || visible) {
        stream.polygonStart();
        if (cleanInside) {
          stream.lineStart();
          interpolate(null, null, 1, stream);
          stream.lineEnd();
        }
        if (visible) {
          rejoin(segments, compareIntersection, startInside, interpolate, stream);
        }
        stream.polygonEnd();
      }
      activeStream = stream, segments = polygon = ring = null;
    }

    function lineStart() {
      clipStream.point = linePoint;
      if (polygon) polygon.push(ring = []);
      first = true;
      v_ = false;
      x_ = y_ = NaN;
    }

    // TODO rather than special-case polygons, simply handle them separately.
    // Ideally, coincident intersection points should be jittered to avoid
    // clipping issues.
    function lineEnd() {
      if (segments) {
        linePoint(x__, y__);
        if (v__ && v_) bufferStream.rejoin();
        segments.push(bufferStream.result());
      }
      clipStream.point = point;
      if (v_) activeStream.lineEnd();
    }

    function linePoint(x, y) {
      var v = visible(x, y);
      if (polygon) ring.push([x, y]);
      if (first) {
        x__ = x, y__ = y, v__ = v;
        first = false;
        if (v) {
          activeStream.lineStart();
          activeStream.point(x, y);
        }
      } else {
        if (v && v_) activeStream.point(x, y);
        else {
          var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],
              b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];
          if (clip_line(a, b, x0, y0, x1, y1)) {
            if (!v_) {
              activeStream.lineStart();
              activeStream.point(a[0], a[1]);
            }
            activeStream.point(b[0], b[1]);
            if (!v) activeStream.lineEnd();
            clean = false;
          } else if (v) {
            activeStream.lineStart();
            activeStream.point(x, y);
            clean = false;
          }
        }
      }
      x_ = x, y_ = y, v_ = v;
    }

    return clipStream;
  };
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/transform.js
/* harmony default export */ var src_transform = (function(methods) {
  return {
    stream: transform_transformer(methods)
  };
});

function transform_transformer(methods) {
  return function(stream) {
    var s = new TransformStream;
    for (var key in methods) s[key] = methods[key];
    s.stream = stream;
    return s;
  };
}

function TransformStream() {}

TransformStream.prototype = {
  constructor: TransformStream,
  point: function(x, y) { this.stream.point(x, y); },
  sphere: function() { this.stream.sphere(); },
  lineStart: function() { this.stream.lineStart(); },
  lineEnd: function() { this.stream.lineEnd(); },
  polygonStart: function() { this.stream.polygonStart(); },
  polygonEnd: function() { this.stream.polygonEnd(); }
};

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/fit.js



function fit_fit(projection, fitBounds, object) {
  var clip = projection.clipExtent && projection.clipExtent();
  projection.scale(150).translate([0, 0]);
  if (clip != null) projection.clipExtent(null);
  src_stream(object, projection.stream(path_bounds));
  fitBounds(path_bounds.result());
  if (clip != null) projection.clipExtent(clip);
  return projection;
}

function fitExtent(projection, extent, object) {
  return fit_fit(projection, function(b) {
    var w = extent[1][0] - extent[0][0],
        h = extent[1][1] - extent[0][1],
        k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),
        x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,
        y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
    projection.scale(150 * k).translate([x, y]);
  }, object);
}

function fitSize(projection, size, object) {
  return fitExtent(projection, [[0, 0], size], object);
}

function fitWidth(projection, width, object) {
  return fit_fit(projection, function(b) {
    var w = +width,
        k = w / (b[1][0] - b[0][0]),
        x = (w - k * (b[1][0] + b[0][0])) / 2,
        y = -k * b[0][1];
    projection.scale(150 * k).translate([x, y]);
  }, object);
}

function fitHeight(projection, height, object) {
  return fit_fit(projection, function(b) {
    var h = +height,
        k = h / (b[1][1] - b[0][1]),
        x = -k * b[0][0],
        y = (h - k * (b[1][1] + b[0][1])) / 2;
    projection.scale(150 * k).translate([x, y]);
  }, object);
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/resample.js




var resample_maxDepth = 16, // maximum depth of subdivision
    cosMinDistance = math_cos(30 * math_radians); // cos(minimum angular distance)

/* harmony default export */ var resample = (function(project, delta2) {
  return +delta2 ? resample_resample(project, delta2) : resampleNone(project);
});

function resampleNone(project) {
  return transform_transformer({
    point: function(x, y) {
      x = project(x, y);
      this.stream.point(x[0], x[1]);
    }
  });
}

function resample_resample(project, delta2) {

  function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {
    var dx = x1 - x0,
        dy = y1 - y0,
        d2 = dx * dx + dy * dy;
    if (d2 > 4 * delta2 && depth--) {
      var a = a0 + a1,
          b = b0 + b1,
          c = c0 + c1,
          m = math_sqrt(a * a + b * b + c * c),
          phi2 = math_asin(c /= m),
          lambda2 = math_abs(math_abs(c) - 1) < src_math_epsilon || math_abs(lambda0 - lambda1) < src_math_epsilon ? (lambda0 + lambda1) / 2 : math_atan2(b, a),
          p = project(lambda2, phi2),
          x2 = p[0],
          y2 = p[1],
          dx2 = x2 - x0,
          dy2 = y2 - y0,
          dz = dy * dx2 - dx * dy2;
      if (dz * dz / d2 > delta2 // perpendicular projected distance
          || math_abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end
          || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance
        resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);
        stream.point(x2, y2);
        resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);
      }
    }
  }
  return function(stream) {
    var lambda00, x00, y00, a00, b00, c00, // first point
        lambda0, x0, y0, a0, b0, c0; // previous point

    var resampleStream = {
      point: point,
      lineStart: lineStart,
      lineEnd: lineEnd,
      polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; },
      polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; }
    };

    function point(x, y) {
      x = project(x, y);
      stream.point(x[0], x[1]);
    }

    function lineStart() {
      x0 = NaN;
      resampleStream.point = linePoint;
      stream.lineStart();
    }

    function linePoint(lambda, phi) {
      var c = cartesian_cartesian([lambda, phi]), p = project(lambda, phi);
      resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], resample_maxDepth, stream);
      stream.point(x0, y0);
    }

    function lineEnd() {
      resampleStream.point = point;
      stream.lineEnd();
    }

    function ringStart() {
      lineStart();
      resampleStream.point = ringPoint;
      resampleStream.lineEnd = ringEnd;
    }

    function ringPoint(lambda, phi) {
      linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
      resampleStream.point = linePoint;
    }

    function ringEnd() {
      resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, resample_maxDepth, stream);
      resampleStream.lineEnd = lineEnd;
      lineEnd();
    }

    return resampleStream;
  };
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/index.js











var transformRadians = transform_transformer({
  point: function(x, y) {
    this.stream.point(x * math_radians, y * math_radians);
  }
});

function transformRotate(rotate) {
  return transform_transformer({
    point: function(x, y) {
      var r = rotate(x, y);
      return this.stream.point(r[0], r[1]);
    }
  });
}

function scaleTranslate(k, dx, dy, sx, sy) {
  function transform(x, y) {
    x *= sx; y *= sy;
    return [dx + k * x, dy - k * y];
  }
  transform.invert = function(x, y) {
    return [(x - dx) / k * sx, (dy - y) / k * sy];
  };
  return transform;
}

function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {
  if (!alpha) return scaleTranslate(k, dx, dy, sx, sy);
  var cosAlpha = math_cos(alpha),
      sinAlpha = math_sin(alpha),
      a = cosAlpha * k,
      b = sinAlpha * k,
      ai = cosAlpha / k,
      bi = sinAlpha / k,
      ci = (sinAlpha * dy - cosAlpha * dx) / k,
      fi = (sinAlpha * dx + cosAlpha * dy) / k;
  function transform(x, y) {
    x *= sx; y *= sy;
    return [a * x - b * y + dx, dy - b * x - a * y];
  }
  transform.invert = function(x, y) {
    return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];
  };
  return transform;
}

function projection_projection(project) {
  return projectionMutator(function() { return project; })();
}

function projectionMutator(projectAt) {
  var project,
      k = 150, // scale
      x = 480, y = 250, // translate
      lambda = 0, phi = 0, // center
      deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate
      alpha = 0, // post-rotate angle
      sx = 1, // reflectX
      sy = 1, // reflectX
      theta = null, preclip = clip_antimeridian, // pre-clip angle
      x0 = null, y0, x1, y1, postclip = src_identity, // post-clip extent
      delta2 = 0.5, // precision
      projectResample,
      projectTransform,
      projectRotateTransform,
      cache,
      cacheStream;

  function projection(point) {
    return projectRotateTransform(point[0] * math_radians, point[1] * math_radians);
  }

  function invert(point) {
    point = projectRotateTransform.invert(point[0], point[1]);
    return point && [point[0] * src_math_degrees, point[1] * src_math_degrees];
  }

  projection.stream = function(stream) {
    return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
  };

  projection.preclip = function(_) {
    return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;
  };

  projection.postclip = function(_) {
    return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
  };

  projection.clipAngle = function(_) {
    return arguments.length ? (preclip = +_ ? clip_circle(theta = _ * math_radians) : (theta = null, clip_antimeridian), reset()) : theta * src_math_degrees;
  };

  projection.clipExtent = function(_) {
    return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, src_identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
  };

  projection.scale = function(_) {
    return arguments.length ? (k = +_, recenter()) : k;
  };

  projection.translate = function(_) {
    return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
  };

  projection.center = function(_) {
    return arguments.length ? (lambda = _[0] % 360 * math_radians, phi = _[1] % 360 * math_radians, recenter()) : [lambda * src_math_degrees, phi * src_math_degrees];
  };

  projection.rotate = function(_) {
    return arguments.length ? (deltaLambda = _[0] % 360 * math_radians, deltaPhi = _[1] % 360 * math_radians, deltaGamma = _.length > 2 ? _[2] % 360 * math_radians : 0, recenter()) : [deltaLambda * src_math_degrees, deltaPhi * src_math_degrees, deltaGamma * src_math_degrees];
  };

  projection.angle = function(_) {
    return arguments.length ? (alpha = _ % 360 * math_radians, recenter()) : alpha * src_math_degrees;
  };

  projection.reflectX = function(_) {
    return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;
  };

  projection.reflectY = function(_) {
    return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
  };

  projection.precision = function(_) {
    return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : math_sqrt(delta2);
  };

  projection.fitExtent = function(extent, object) {
    return fitExtent(projection, extent, object);
  };

  projection.fitSize = function(size, object) {
    return fitSize(projection, size, object);
  };

  projection.fitWidth = function(width, object) {
    return fitWidth(projection, width, object);
  };

  projection.fitHeight = function(height, object) {
    return fitHeight(projection, height, object);
  };

  function recenter() {
    var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)),
        transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);
    rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
    projectTransform = compose(project, transform);
    projectRotateTransform = compose(rotate, projectTransform);
    projectResample = resample(projectTransform, delta2);
    return reset();
  }

  function reset() {
    cache = cacheStream = null;
    return projection;
  }

  return function() {
    project = projectAt.apply(this, arguments);
    projection.invert = project.invert && invert;
    return recenter();
  };
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/conic.js



function conicProjection(projectAt) {
  var phi0 = 0,
      phi1 = math_pi / 3,
      m = projectionMutator(projectAt),
      p = m(phi0, phi1);

  p.parallels = function(_) {
    return arguments.length ? m(phi0 = _[0] * math_radians, phi1 = _[1] * math_radians) : [phi0 * src_math_degrees, phi1 * src_math_degrees];
  };

  return p;
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/cylindricalEqualArea.js


function cylindricalEqualAreaRaw(phi0) {
  var cosPhi0 = math_cos(phi0);

  function forward(lambda, phi) {
    return [lambda * cosPhi0, math_sin(phi) / cosPhi0];
  }

  forward.invert = function(x, y) {
    return [x / cosPhi0, math_asin(y * cosPhi0)];
  };

  return forward;
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/conicEqualArea.js




function conicEqualAreaRaw(y0, y1) {
  var sy0 = math_sin(y0), n = (sy0 + math_sin(y1)) / 2;

  // Are the parallels symmetrical around the Equator?
  if (math_abs(n) < src_math_epsilon) return cylindricalEqualAreaRaw(y0);

  var c = 1 + sy0 * (2 * n - sy0), r0 = math_sqrt(c) / n;

  function project(x, y) {
    var r = math_sqrt(c - 2 * n * math_sin(y)) / n;
    return [r * math_sin(x *= n), r0 - r * math_cos(x)];
  }

  project.invert = function(x, y) {
    var r0y = r0 - y,
        l = math_atan2(x, math_abs(r0y)) * math_sign(r0y);
    if (r0y * n < 0)
      l -= math_pi * math_sign(x) * math_sign(r0y);
    return [l / n, math_asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];
  };

  return project;
}

/* harmony default export */ var conicEqualArea = (function() {
  return conicProjection(conicEqualAreaRaw)
      .scale(155.424)
      .center([0, 33.6442]);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/albers.js


/* harmony default export */ var albers = (function() {
  return conicEqualArea()
      .parallels([29.5, 45.5])
      .scale(1070)
      .translate([480, 250])
      .rotate([96, 0])
      .center([-0.6, 38.7]);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/albersUsa.js





// The projections must have mutually exclusive clip regions on the sphere,
// as this will avoid emitting interleaving lines and polygons.
function multiplex(streams) {
  var n = streams.length;
  return {
    point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); },
    sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); },
    lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); },
    lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); },
    polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); },
    polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); }
  };
}

// A composite projection for the United States, configured by default for
// 960×500. The projection also works quite well at 960×600 if you change the
// scale to 1285 and adjust the translate accordingly. The set of standard
// parallels for each region comes from USGS, which is published here:
// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
/* harmony default export */ var projection_albersUsa = (function() {
  var cache,
      cacheStream,
      lower48 = albers(), lower48Point,
      alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338
      hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007
      point, pointStream = {point: function(x, y) { point = [x, y]; }};

  function albersUsa(coordinates) {
    var x = coordinates[0], y = coordinates[1];
    return point = null,
        (lower48Point.point(x, y), point)
        || (alaskaPoint.point(x, y), point)
        || (hawaiiPoint.point(x, y), point);
  }

  albersUsa.invert = function(coordinates) {
    var k = lower48.scale(),
        t = lower48.translate(),
        x = (coordinates[0] - t[0]) / k,
        y = (coordinates[1] - t[1]) / k;
    return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska
        : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii
        : lower48).invert(coordinates);
  };

  albersUsa.stream = function(stream) {
    return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);
  };

  albersUsa.precision = function(_) {
    if (!arguments.length) return lower48.precision();
    lower48.precision(_), alaska.precision(_), hawaii.precision(_);
    return reset();
  };

  albersUsa.scale = function(_) {
    if (!arguments.length) return lower48.scale();
    lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);
    return albersUsa.translate(lower48.translate());
  };

  albersUsa.translate = function(_) {
    if (!arguments.length) return lower48.translate();
    var k = lower48.scale(), x = +_[0], y = +_[1];

    lower48Point = lower48
        .translate(_)
        .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])
        .stream(pointStream);

    alaskaPoint = alaska
        .translate([x - 0.307 * k, y + 0.201 * k])
        .clipExtent([[x - 0.425 * k + src_math_epsilon, y + 0.120 * k + src_math_epsilon], [x - 0.214 * k - src_math_epsilon, y + 0.234 * k - src_math_epsilon]])
        .stream(pointStream);

    hawaiiPoint = hawaii
        .translate([x - 0.205 * k, y + 0.212 * k])
        .clipExtent([[x - 0.214 * k + src_math_epsilon, y + 0.166 * k + src_math_epsilon], [x - 0.115 * k - src_math_epsilon, y + 0.234 * k - src_math_epsilon]])
        .stream(pointStream);

    return reset();
  };

  albersUsa.fitExtent = function(extent, object) {
    return fitExtent(albersUsa, extent, object);
  };

  albersUsa.fitSize = function(size, object) {
    return fitSize(albersUsa, size, object);
  };

  albersUsa.fitWidth = function(width, object) {
    return fitWidth(albersUsa, width, object);
  };

  albersUsa.fitHeight = function(height, object) {
    return fitHeight(albersUsa, height, object);
  };

  function reset() {
    cache = cacheStream = null;
    return albersUsa;
  }

  return albersUsa.scale(1070);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/azimuthal.js


function azimuthalRaw(scale) {
  return function(x, y) {
    var cx = math_cos(x),
        cy = math_cos(y),
        k = scale(cx * cy);
        if (k === Infinity) return [2, 0];
    return [
      k * cy * math_sin(x),
      k * math_sin(y)
    ];
  }
}

function azimuthalInvert(angle) {
  return function(x, y) {
    var z = math_sqrt(x * x + y * y),
        c = angle(z),
        sc = math_sin(c),
        cc = math_cos(c);
    return [
      math_atan2(x * sc, z * cc),
      math_asin(z && y * sc / z)
    ];
  }
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/azimuthalEqualArea.js




var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {
  return math_sqrt(2 / (1 + cxcy));
});

azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {
  return 2 * math_asin(z / 2);
});

/* harmony default export */ var azimuthalEqualArea = (function() {
  return projection_projection(azimuthalEqualAreaRaw)
      .scale(124.75)
      .clipAngle(180 - 1e-3);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/azimuthalEquidistant.js




var azimuthalEquidistantRaw = azimuthalRaw(function(c) {
  return (c = math_acos(c)) && c / math_sin(c);
});

azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {
  return z;
});

/* harmony default export */ var azimuthalEquidistant = (function() {
  return projection_projection(azimuthalEquidistantRaw)
      .scale(79.4188)
      .clipAngle(180 - 1e-3);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/mercator.js




function mercatorRaw(lambda, phi) {
  return [lambda, math_log(tan((math_halfPi + phi) / 2))];
}

mercatorRaw.invert = function(x, y) {
  return [x, 2 * atan(math_exp(y)) - math_halfPi];
};

/* harmony default export */ var mercator = (function() {
  return mercatorProjection(mercatorRaw)
      .scale(961 / math_tau);
});

function mercatorProjection(project) {
  var m = projection_projection(project),
      center = m.center,
      scale = m.scale,
      translate = m.translate,
      clipExtent = m.clipExtent,
      x0 = null, y0, x1, y1; // clip extent

  m.scale = function(_) {
    return arguments.length ? (scale(_), reclip()) : scale();
  };

  m.translate = function(_) {
    return arguments.length ? (translate(_), reclip()) : translate();
  };

  m.center = function(_) {
    return arguments.length ? (center(_), reclip()) : center();
  };

  m.clipExtent = function(_) {
    return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];
  };

  function reclip() {
    var k = math_pi * scale(),
        t = m(src_rotation(m.rotate()).invert([0, 0]));
    return clipExtent(x0 == null
        ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw
        ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]]
        : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);
  }

  return reclip();
}

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/conicConformal.js




function tany(y) {
  return tan((math_halfPi + y) / 2);
}

function conicConformalRaw(y0, y1) {
  var cy0 = math_cos(y0),
      n = y0 === y1 ? math_sin(y0) : math_log(cy0 / math_cos(y1)) / math_log(tany(y1) / tany(y0)),
      f = cy0 * math_pow(tany(y0), n) / n;

  if (!n) return mercatorRaw;

  function project(x, y) {
    if (f > 0) { if (y < -math_halfPi + src_math_epsilon) y = -math_halfPi + src_math_epsilon; }
    else { if (y > math_halfPi - src_math_epsilon) y = math_halfPi - src_math_epsilon; }
    var r = f / math_pow(tany(y), n);
    return [r * math_sin(n * x), f - r * math_cos(n * x)];
  }

  project.invert = function(x, y) {
    var fy = f - y, r = math_sign(n) * math_sqrt(x * x + fy * fy),
      l = math_atan2(x, math_abs(fy)) * math_sign(fy);
    if (fy * n < 0)
      l -= math_pi * math_sign(x) * math_sign(fy);
    return [l / n, 2 * atan(math_pow(f / r, 1 / n)) - math_halfPi];
  };

  return project;
}

/* harmony default export */ var conicConformal = (function() {
  return conicProjection(conicConformalRaw)
      .scale(109.5)
      .parallels([30, 30]);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/equirectangular.js


function equirectangularRaw(lambda, phi) {
  return [lambda, phi];
}

equirectangularRaw.invert = equirectangularRaw;

/* harmony default export */ var equirectangular = (function() {
  return projection_projection(equirectangularRaw)
      .scale(152.63);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/conicEquidistant.js




function conicEquidistantRaw(y0, y1) {
  var cy0 = math_cos(y0),
      n = y0 === y1 ? math_sin(y0) : (cy0 - math_cos(y1)) / (y1 - y0),
      g = cy0 / n + y0;

  if (math_abs(n) < src_math_epsilon) return equirectangularRaw;

  function project(x, y) {
    var gy = g - y, nx = n * x;
    return [gy * math_sin(nx), g - gy * math_cos(nx)];
  }

  project.invert = function(x, y) {
    var gy = g - y,
        l = math_atan2(x, math_abs(gy)) * math_sign(gy);
    if (gy * n < 0)
      l -= math_pi * math_sign(x) * math_sign(gy);
    return [l / n, g - math_sign(n) * math_sqrt(x * x + gy * gy)];
  };

  return project;
}

/* harmony default export */ var conicEquidistant = (function() {
  return conicProjection(conicEquidistantRaw)
      .scale(131.154)
      .center([0, 13.9389]);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/equalEarth.js



var A1 = 1.340264,
    A2 = -0.081106,
    A3 = 0.000893,
    A4 = 0.003796,
    equalEarth_M = math_sqrt(3) / 2,
    equalEarth_iterations = 12;

function equalEarthRaw(lambda, phi) {
  var l = math_asin(equalEarth_M * math_sin(phi)), l2 = l * l, l6 = l2 * l2 * l2;
  return [
    lambda * math_cos(l) / (equalEarth_M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))),
    l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))
  ];
}

equalEarthRaw.invert = function(x, y) {
  var l = y, l2 = l * l, l6 = l2 * l2 * l2;
  for (var i = 0, delta, fy, fpy; i < equalEarth_iterations; ++i) {
    fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;
    fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);
    l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;
    if (math_abs(delta) < math_epsilon2) break;
  }
  return [
    equalEarth_M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / math_cos(l),
    math_asin(math_sin(l) / equalEarth_M)
  ];
};

/* harmony default export */ var equalEarth = (function() {
  return projection_projection(equalEarthRaw)
      .scale(177.158);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/gnomonic.js




function gnomonicRaw(x, y) {
  var cy = math_cos(y), k = math_cos(x) * cy;
  return [cy * math_sin(x) / k, math_sin(y) / k];
}

gnomonicRaw.invert = azimuthalInvert(atan);

/* harmony default export */ var gnomonic = (function() {
  return projection_projection(gnomonicRaw)
      .scale(144.049)
      .clipAngle(60);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/identity.js






/* harmony default export */ var projection_identity = (function() {
  var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, // scale, translate and reflect
      alpha = 0, ca, sa, // angle
      x0 = null, y0, x1, y1, // clip extent
      kx = 1, ky = 1,
      transform = transform_transformer({
        point: function(x, y) {
          var p = projection([x, y])
          this.stream.point(p[0], p[1]);
        }
      }),
      postclip = src_identity,
      cache,
      cacheStream;

  function reset() {
    kx = k * sx;
    ky = k * sy;
    cache = cacheStream = null;
    return projection;
  }

  function projection (p) {
    var x = p[0] * kx, y = p[1] * ky;
    if (alpha) {
      var t = y * ca - x * sa;
      x = x * ca + y * sa;
      y = t;
    }    
    return [x + tx, y + ty];
  }
  projection.invert = function(p) {
    var x = p[0] - tx, y = p[1] - ty;
    if (alpha) {
      var t = y * ca + x * sa;
      x = x * ca - y * sa;
      y = t;
    }
    return [x / kx, y / ky];
  };
  projection.stream = function(stream) {
    return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream));
  };
  projection.postclip = function(_) {
    return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
  };
  projection.clipExtent = function(_) {
    return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, src_identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
  };
  projection.scale = function(_) {
    return arguments.length ? (k = +_, reset()) : k;
  };
  projection.translate = function(_) {
    return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];
  }
  projection.angle = function(_) {
    return arguments.length ? (alpha = _ % 360 * math_radians, sa = math_sin(alpha), ca = math_cos(alpha), reset()) : alpha * src_math_degrees;
  };
  projection.reflectX = function(_) {
    return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;
  };
  projection.reflectY = function(_) {
    return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0;
  };
  projection.fitExtent = function(extent, object) {
    return fitExtent(projection, extent, object);
  };
  projection.fitSize = function(size, object) {
    return fitSize(projection, size, object);
  };
  projection.fitWidth = function(width, object) {
    return fitWidth(projection, width, object);
  };
  projection.fitHeight = function(height, object) {
    return fitHeight(projection, height, object);
  };

  return projection;
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/naturalEarth1.js



function naturalEarth1Raw(lambda, phi) {
  var phi2 = phi * phi, phi4 = phi2 * phi2;
  return [
    lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))),
    phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4)))
  ];
}

naturalEarth1Raw.invert = function(x, y) {
  var phi = y, i = 25, delta;
  do {
    var phi2 = phi * phi, phi4 = phi2 * phi2;
    phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) /
        (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4)));
  } while (math_abs(delta) > src_math_epsilon && --i > 0);
  return [
    x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))),
    phi
  ];
};

/* harmony default export */ var naturalEarth1 = (function() {
  return projection_projection(naturalEarth1Raw)
      .scale(175.295);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/orthographic.js




function orthographicRaw(x, y) {
  return [math_cos(y) * math_sin(x), math_sin(y)];
}

orthographicRaw.invert = azimuthalInvert(math_asin);

/* harmony default export */ var orthographic = (function() {
  return projection_projection(orthographicRaw)
      .scale(249.5)
      .clipAngle(90 + src_math_epsilon);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/stereographic.js




function stereographicRaw(x, y) {
  var cy = math_cos(y), k = 1 + math_cos(x) * cy;
  return [cy * math_sin(x) / k, math_sin(y) / k];
}

stereographicRaw.invert = azimuthalInvert(function(z) {
  return 2 * atan(z);
});

/* harmony default export */ var stereographic = (function() {
  return projection_projection(stereographicRaw)
      .scale(250)
      .clipAngle(142);
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/projection/transverseMercator.js



function transverseMercatorRaw(lambda, phi) {
  return [math_log(tan((math_halfPi + phi) / 2)), -lambda];
}

transverseMercatorRaw.invert = function(x, y) {
  return [-y, 2 * atan(math_exp(x)) - math_halfPi];
};

/* harmony default export */ var transverseMercator = (function() {
  var m = mercatorProjection(transverseMercatorRaw),
      center = m.center,
      rotate = m.rotate;

  m.center = function(_) {
    return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]);
  };

  m.rotate = function(_) {
    return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);
  };

  return rotate([0, 0, 90])
      .scale(159.155);
});

// CONCATENATED MODULE: ./node_modules/d3-geo-projection/src/math.js
var src_math_abs = Math.abs;
var math_atan = Math.atan;
var src_math_atan2 = Math.atan2;
var math_ceil = Math.ceil;
var src_math_cos = Math.cos;
var src_math_exp = Math.exp;
var src_math_floor = Math.floor;
var src_math_log = Math.log;
var src_math_max = Math.max;
var src_math_min = Math.min;
var src_math_pow = Math.pow;
var math_round = Math.round;
var src_math_sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };
var src_math_sin = Math.sin;
var math_tan = Math.tan;

var d3_geo_projection_src_math_epsilon = 1e-6;
var src_math_epsilon2 = 1e-12;
var src_math_pi = Math.PI;
var src_math_halfPi = src_math_pi / 2;
var math_quarterPi = src_math_pi / 4;
var sqrt1_2 = Math.SQRT1_2;
var sqrt2 = src_math_sqrt(2);
var sqrtPi = src_math_sqrt(src_math_pi);
var src_math_tau = src_math_pi * 2;
var d3_geo_projection_src_math_degrees = 180 / src_math_pi;
var src_math_radians = src_math_pi / 180;

function sinci(x) {
  return x ? x / Math.sin(x) : 1;
}

function src_math_asin(x) {
  return x > 1 ? src_math_halfPi : x < -1 ? -src_math_halfPi : Math.asin(x);
}

function src_math_acos(x) {
  return x > 1 ? 0 : x < -1 ? src_math_pi : Math.acos(x);
}

function src_math_sqrt(x) {
  return x > 0 ? Math.sqrt(x) : 0;
}

function math_tanh(x) {
  x = src_math_exp(2 * x);
  return (x - 1) / (x + 1);
}

function math_sinh(x) {
  return (src_math_exp(x) - src_math_exp(-x)) / 2;
}

function math_cosh(x) {
  return (src_math_exp(x) + src_math_exp(-x)) / 2;
}

function arsinh(x) {
  return src_math_log(x + src_math_sqrt(x * x + 1));
}

function arcosh(x) {
  return src_math_log(x + src_math_sqrt(x * x - 1));
}

// CONCATENATED MODULE: ./node_modules/d3-geo-projection/src/mollweide.js



function mollweideBromleyTheta(cp, phi) {
  var cpsinPhi = cp * src_math_sin(phi), i = 30, delta;
  do phi -= delta = (phi + src_math_sin(phi) - cpsinPhi) / (1 + src_math_cos(phi));
  while (src_math_abs(delta) > d3_geo_projection_src_math_epsilon && --i > 0);
  return phi / 2;
}

function mollweideBromleyRaw(cx, cy, cp) {

  function forward(lambda, phi) {
    return [cx * lambda * src_math_cos(phi = mollweideBromleyTheta(cp, phi)), cy * src_math_sin(phi)];
  }

  forward.invert = function(x, y) {
    return y = src_math_asin(y / cy), [x / (cx * src_math_cos(y)), src_math_asin((2 * y + src_math_sin(2 * y)) / cp)];
  };

  return forward;
}

var mollweideRaw = mollweideBromleyRaw(sqrt2 / src_math_halfPi, sqrt2, src_math_pi);

/* harmony default export */ var mollweide = (function() {
  return projection_projection(mollweideRaw)
      .scale(169.529);
});

// CONCATENATED MODULE: ./node_modules/vega-projection/build/vega-projection.module.js



const defaultPath = d3_geo_src_path();
const projectionProperties = [// standard properties in d3-geo
'clipAngle', 'clipExtent', 'scale', 'translate', 'center', 'rotate', 'parallels', 'precision', 'reflectX', 'reflectY', // extended properties in d3-geo-projections
'coefficient', 'distance', 'fraction', 'lobes', 'parallel', 'radius', 'ratio', 'spacing', 'tilt'];
/**
 * Augment projections with their type and a copy method.
 */

function vega_projection_module_create(type, constructor) {
  return function projection() {
    const p = constructor();
    p.type = type;
    p.path = d3_geo_src_path().projection(p);

    p.copy = p.copy || function () {
      const c = projection();
      projectionProperties.forEach(prop => {
        if (p[prop]) c[prop](p[prop]());
      });
      c.path.pointRadius(p.path.pointRadius());
      return c;
    };

    return p;
  };
}

function vega_projection_module_projection(type, proj) {
  if (!type || typeof type !== 'string') {
    throw new Error('Projection type must be a name string.');
  }

  type = type.toLowerCase();

  if (arguments.length > 1) {
    vega_projection_module_projections[type] = vega_projection_module_create(type, proj);
    return this;
  } else {
    return vega_projection_module_projections[type] || null;
  }
}
function getProjectionPath(proj) {
  return proj && proj.path || defaultPath;
}
const vega_projection_module_projections = {
  // base d3-geo projection types
  albers: albers,
  albersusa: projection_albersUsa,
  azimuthalequalarea: azimuthalEqualArea,
  azimuthalequidistant: azimuthalEquidistant,
  conicconformal: conicConformal,
  conicequalarea: conicEqualArea,
  conicequidistant: conicEquidistant,
  equalEarth: equalEarth,
  equirectangular: equirectangular,
  gnomonic: gnomonic,
  identity: projection_identity,
  mercator: mercator,
  mollweide: mollweide,
  naturalEarth1: naturalEarth1,
  orthographic: orthographic,
  stereographic: stereographic,
  transversemercator: transverseMercator
};

for (const key in vega_projection_module_projections) {
  vega_projection_module_projection(key, vega_projection_module_projections[key]);
}



// CONCATENATED MODULE: ./node_modules/d3-geo/src/graticule.js



function graticuleX(y0, y1, dy) {
  var y = src_range(y0, y1 - src_math_epsilon, dy).concat(y1);
  return function(x) { return y.map(function(y) { return [x, y]; }); };
}

function graticuleY(x0, x1, dx) {
  var x = src_range(x0, x1 - src_math_epsilon, dx).concat(x1);
  return function(y) { return x.map(function(x) { return [x, y]; }); };
}

function graticule_graticule() {
  var x1, x0, X1, X0,
      y1, y0, Y1, Y0,
      dx = 10, dy = dx, DX = 90, DY = 360,
      x, y, X, Y,
      precision = 2.5;

  function graticule() {
    return {type: "MultiLineString", coordinates: lines()};
  }

  function lines() {
    return src_range(ceil(X0 / DX) * DX, X1, DX).map(X)
        .concat(src_range(ceil(Y0 / DY) * DY, Y1, DY).map(Y))
        .concat(src_range(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return math_abs(x % DX) > src_math_epsilon; }).map(x))
        .concat(src_range(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return math_abs(y % DY) > src_math_epsilon; }).map(y));
  }

  graticule.lines = function() {
    return lines().map(function(coordinates) { return {type: "LineString", coordinates: coordinates}; });
  };

  graticule.outline = function() {
    return {
      type: "Polygon",
      coordinates: [
        X(X0).concat(
        Y(Y1).slice(1),
        X(X1).reverse().slice(1),
        Y(Y0).reverse().slice(1))
      ]
    };
  };

  graticule.extent = function(_) {
    if (!arguments.length) return graticule.extentMinor();
    return graticule.extentMajor(_).extentMinor(_);
  };

  graticule.extentMajor = function(_) {
    if (!arguments.length) return [[X0, Y0], [X1, Y1]];
    X0 = +_[0][0], X1 = +_[1][0];
    Y0 = +_[0][1], Y1 = +_[1][1];
    if (X0 > X1) _ = X0, X0 = X1, X1 = _;
    if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;
    return graticule.precision(precision);
  };

  graticule.extentMinor = function(_) {
    if (!arguments.length) return [[x0, y0], [x1, y1]];
    x0 = +_[0][0], x1 = +_[1][0];
    y0 = +_[0][1], y1 = +_[1][1];
    if (x0 > x1) _ = x0, x0 = x1, x1 = _;
    if (y0 > y1) _ = y0, y0 = y1, y1 = _;
    return graticule.precision(precision);
  };

  graticule.step = function(_) {
    if (!arguments.length) return graticule.stepMinor();
    return graticule.stepMajor(_).stepMinor(_);
  };

  graticule.stepMajor = function(_) {
    if (!arguments.length) return [DX, DY];
    DX = +_[0], DY = +_[1];
    return graticule;
  };

  graticule.stepMinor = function(_) {
    if (!arguments.length) return [dx, dy];
    dx = +_[0], dy = +_[1];
    return graticule;
  };

  graticule.precision = function(_) {
    if (!arguments.length) return precision;
    precision = +_;
    x = graticuleX(y0, y1, 90);
    y = graticuleY(x0, x1, precision);
    X = graticuleX(Y0, Y1, 90);
    Y = graticuleY(X0, X1, precision);
    return graticule;
  };

  return graticule
      .extentMajor([[-180, -90 + src_math_epsilon], [180, 90 - src_math_epsilon]])
      .extentMinor([[-180, -80 - src_math_epsilon], [180, 80 + src_math_epsilon]]);
}

function graticule10() {
  return graticule_graticule()();
}

// CONCATENATED MODULE: ./node_modules/vega-geo/build/vega-geo.module.js









function vega_geo_module_noop() {}

const cases = [[], [[[1.0, 1.5], [0.5, 1.0]]], [[[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [0.5, 1.0]]], [[[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 1.5], [0.5, 1.0]], [[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 0.5], [1.0, 1.5]]], [[[1.0, 0.5], [0.5, 1.0]]], [[[0.5, 1.0], [1.0, 0.5]]], [[[1.0, 1.5], [1.0, 0.5]]], [[[0.5, 1.0], [1.0, 0.5]], [[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [1.0, 0.5]]], [[[0.5, 1.0], [1.5, 1.0]]], [[[1.0, 1.5], [1.5, 1.0]]], [[[0.5, 1.0], [1.0, 1.5]]], []]; // Implementation adapted from d3/d3-contour. Thanks!

function vega_geo_module_contours () {
  var dx = 1,
      dy = 1,
      smooth = smoothLinear;

  function contours(values, tz) {
    return tz.map(value => contour(values, value));
  } // Accumulate, smooth contour rings, assign holes to exterior rings.
  // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js


  function contour(values, value) {
    var polygons = [],
        holes = [];
    isorings(values, value, ring => {
      smooth(ring, values, value);
      if (vega_geo_module_area(ring) > 0) polygons.push([ring]);else holes.push(ring);
    });
    holes.forEach(hole => {
      for (var i = 0, n = polygons.length, polygon; i < n; ++i) {
        if (vega_geo_module_contains((polygon = polygons[i])[0], hole) !== -1) {
          polygon.push(hole);
          return;
        }
      }
    });
    return {
      type: 'MultiPolygon',
      value: value,
      coordinates: polygons
    };
  } // Marching squares with isolines stitched into rings.
  // Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/stitch.js


  function isorings(values, value, callback) {
    var fragmentByStart = new Array(),
        fragmentByEnd = new Array(),
        x,
        y,
        t0,
        t1,
        t2,
        t3; // Special case for the first row (y = -1, t2 = t3 = 0).

    x = y = -1;
    t1 = values[0] >= value;
    cases[t1 << 1].forEach(stitch);

    while (++x < dx - 1) {
      t0 = t1, t1 = values[x + 1] >= value;
      cases[t0 | t1 << 1].forEach(stitch);
    }

    cases[t1 << 0].forEach(stitch); // General case for the intermediate rows.

    while (++y < dy - 1) {
      x = -1;
      t1 = values[y * dx + dx] >= value;
      t2 = values[y * dx] >= value;
      cases[t1 << 1 | t2 << 2].forEach(stitch);

      while (++x < dx - 1) {
        t0 = t1, t1 = values[y * dx + dx + x + 1] >= value;
        t3 = t2, t2 = values[y * dx + x + 1] >= value;
        cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch);
      }

      cases[t1 | t2 << 3].forEach(stitch);
    } // Special case for the last row (y = dy - 1, t0 = t1 = 0).


    x = -1;
    t2 = values[y * dx] >= value;
    cases[t2 << 2].forEach(stitch);

    while (++x < dx - 1) {
      t3 = t2, t2 = values[y * dx + x + 1] >= value;
      cases[t2 << 2 | t3 << 3].forEach(stitch);
    }

    cases[t2 << 3].forEach(stitch);

    function stitch(line) {
      var start = [line[0][0] + x, line[0][1] + y],
          end = [line[1][0] + x, line[1][1] + y],
          startIndex = index(start),
          endIndex = index(end),
          f,
          g;

      if (f = fragmentByEnd[startIndex]) {
        if (g = fragmentByStart[endIndex]) {
          delete fragmentByEnd[f.end];
          delete fragmentByStart[g.start];

          if (f === g) {
            f.ring.push(end);
            callback(f.ring);
          } else {
            fragmentByStart[f.start] = fragmentByEnd[g.end] = {
              start: f.start,
              end: g.end,
              ring: f.ring.concat(g.ring)
            };
          }
        } else {
          delete fragmentByEnd[f.end];
          f.ring.push(end);
          fragmentByEnd[f.end = endIndex] = f;
        }
      } else if (f = fragmentByStart[endIndex]) {
        if (g = fragmentByEnd[startIndex]) {
          delete fragmentByStart[f.start];
          delete fragmentByEnd[g.end];

          if (f === g) {
            f.ring.push(end);
            callback(f.ring);
          } else {
            fragmentByStart[g.start] = fragmentByEnd[f.end] = {
              start: g.start,
              end: f.end,
              ring: g.ring.concat(f.ring)
            };
          }
        } else {
          delete fragmentByStart[f.start];
          f.ring.unshift(start);
          fragmentByStart[f.start = startIndex] = f;
        }
      } else {
        fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {
          start: startIndex,
          end: endIndex,
          ring: [start, end]
        };
      }
    }
  }

  function index(point) {
    return point[0] * 2 + point[1] * (dx + 1) * 4;
  }

  function smoothLinear(ring, values, value) {
    ring.forEach(point => {
      var x = point[0],
          y = point[1],
          xt = x | 0,
          yt = y | 0,
          v0,
          v1 = values[yt * dx + xt];

      if (x > 0 && x < dx && xt === x) {
        v0 = values[yt * dx + xt - 1];
        point[0] = x + (value - v0) / (v1 - v0) - 0.5;
      }

      if (y > 0 && y < dy && yt === y) {
        v0 = values[(yt - 1) * dx + xt];
        point[1] = y + (value - v0) / (v1 - v0) - 0.5;
      }
    });
  }

  contours.contour = contour;

  contours.size = function (_) {
    if (!arguments.length) return [dx, dy];

    var _0 = Math.floor(_[0]),
        _1 = Math.floor(_[1]);

    if (!(_0 >= 0 && _1 >= 0)) Object(vega_util_module["o" /* error */])('invalid size');
    return dx = _0, dy = _1, contours;
  };

  contours.smooth = function (_) {
    return arguments.length ? (smooth = _ ? smoothLinear : vega_geo_module_noop, contours) : smooth === smoothLinear;
  };

  return contours;
}

function vega_geo_module_area(ring) {
  var i = 0,
      n = ring.length,
      area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];

  while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];

  return area;
}

function vega_geo_module_contains(ring, hole) {
  var i = -1,
      n = hole.length,
      c;

  while (++i < n) if (c = ringContains(ring, hole[i])) return c;

  return 0;
}

function ringContains(ring, point) {
  var x = point[0],
      y = point[1],
      contains = -1;

  for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) {
    var pi = ring[i],
        xi = pi[0],
        yi = pi[1],
        pj = ring[j],
        xj = pj[0],
        yj = pj[1];
    if (segmentContains(pi, pj, point)) return 0;
    if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains;
  }

  return contains;
}

function segmentContains(a, b, c) {
  var i;
  return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]);
}

function collinear(a, b, c) {
  return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]);
}

function within(p, q, r) {
  return p <= q && q <= r || r <= q && q <= p;
}

function vega_geo_module_quantize (k, nice, zero) {
  return function (values) {
    var ex = Object(vega_util_module["q" /* extent */])(values),
        start = zero ? Math.min(ex[0], 0) : ex[0],
        stop = ex[1],
        span = stop - start,
        step = nice ? Object(src_ticks["c" /* tickStep */])(start, stop, k) : span / (k + 1);
    return src_range(start + step, stop, step);
  };
}

/**
 * Generate isocontours (level sets) based on input raster grid data.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} [params.field] - The field with raster grid
 *   data. If unspecified, the tuple itself is interpreted as a raster grid.
 * @param {Array<number>} [params.thresholds] - Contour threshold array. If
 *   specified, the levels, nice, resolve, and zero parameters are ignored.
 * @param {number} [params.levels] - The desired number of contour levels.
 * @param {boolean} [params.nice] - Boolean flag indicating if the contour
 *   threshold values should be automatically aligned to "nice"
 *   human-friendly values. Setting this flag may cause the number of
 *   thresholds to deviate from the specified levels.
 * @param {string} [params.resolve] - The method for resolving thresholds
 *   across multiple input grids. If 'independent' (the default), threshold
 *   calculation will be performed separately for each grid. If 'shared', a
 *   single set of threshold values will be used for all input grids.
 * @param {boolean} [params.zero] - Boolean flag indicating if the contour
 *   threshold values should include zero.
 * @param {boolean} [params.smooth] - Boolean flag indicating if the contour
 *   polygons should be smoothed using linear interpolation. The default is
 *   true. The parameter is ignored when using density estimation.
 * @param {boolean} [params.scale] - Optional numerical value by which to
 *   scale the output isocontour coordinates. This parameter can be useful
 *   to scale the contours to match a desired output resolution.
 * @param {string} [params.as='contour'] - The output field in which to store
 *   the generated isocontour data (default 'contour').
 */

function Isocontour(params) {
  Transform.call(this, null, params);
}
Isocontour.Definition = {
  'type': 'Isocontour',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'field',
    'type': 'field'
  }, {
    'name': 'thresholds',
    'type': 'number',
    'array': true
  }, {
    'name': 'levels',
    'type': 'number'
  }, {
    'name': 'nice',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'resolve',
    'type': 'enum',
    'values': ['shared', 'independent'],
    'default': 'independent'
  }, {
    'name': 'zero',
    'type': 'boolean',
    'default': true
  }, {
    'name': 'smooth',
    'type': 'boolean',
    'default': true
  }, {
    'name': 'scale',
    'type': 'number',
    'expr': true
  }, {
    'name': 'translate',
    'type': 'number',
    'array': true,
    'expr': true
  }, {
    'name': 'as',
    'type': 'string',
    'null': true,
    'default': 'contour'
  }]
};
Object(vega_util_module["z" /* inherits */])(Isocontour, Transform, {
  transform(_, pulse) {
    if (this.value && !pulse.changed() && !_.modified()) {
      return pulse.StopPropagation;
    }

    var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
        source = pulse.materialize(pulse.SOURCE).source,
        field = _.field || vega_util_module["y" /* identity */],
        contour = vega_geo_module_contours().smooth(_.smooth !== false),
        tz = _.thresholds || levels(source, field, _),
        as = _.as === null ? null : _.as || 'contour',
        values = [];
    source.forEach(t => {
      const grid = field(t); // generate contour paths in GeoJSON format

      const paths = contour.size([grid.width, grid.height])(grid.values, Object(vega_util_module["B" /* isArray */])(tz) ? tz : tz(grid.values)); // adjust contour path coordinates as needed

      transformPaths(paths, grid, t, _); // ingest; copy source data properties to output

      paths.forEach(p => {
        values.push(rederive(t, ingest$1(as != null ? {
          [as]: p
        } : p)));
      });
    });
    if (this.value) out.rem = this.value;
    this.value = out.source = out.add = values;
    return out;
  }

});

function levels(values, f, _) {
  const q = vega_geo_module_quantize(_.levels || 10, _.nice, _.zero !== false);
  return _.resolve !== 'shared' ? q : q(values.map(t => max_max(f(t).values)));
}

function transformPaths(paths, grid, datum, _) {
  let s = _.scale || grid.scale,
      t = _.translate || grid.translate;
  if (Object(vega_util_module["E" /* isFunction */])(s)) s = s(datum, _);
  if (Object(vega_util_module["E" /* isFunction */])(t)) t = t(datum, _);
  if ((s === 1 || s == null) && !t) return;
  const sx = (Object(vega_util_module["G" /* isNumber */])(s) ? s : s[0]) || 1,
        sy = (Object(vega_util_module["G" /* isNumber */])(s) ? s : s[1]) || 1,
        tx = t && t[0] || 0,
        ty = t && t[1] || 0;
  paths.forEach(vega_geo_module_transform(grid, sx, sy, tx, ty));
}

function vega_geo_module_transform(grid, sx, sy, tx, ty) {
  const x1 = grid.x1 || 0,
        y1 = grid.y1 || 0,
        flip = sx * sy < 0;

  function transformPolygon(coordinates) {
    coordinates.forEach(transformRing);
  }

  function transformRing(coordinates) {
    if (flip) coordinates.reverse(); // maintain winding order

    coordinates.forEach(transformPoint);
  }

  function transformPoint(coordinates) {
    coordinates[0] = (coordinates[0] - x1) * sx + tx;
    coordinates[1] = (coordinates[1] - y1) * sy + ty;
  }

  return function (geometry) {
    geometry.coordinates.forEach(transformPolygon);
    return geometry;
  };
}

function vega_geo_module_radius(bw, data, f) {
  const v = bw >= 0 ? bw : estimateBandwidth(data, f);
  return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2);
}

function vega_geo_module_number(_) {
  return Object(vega_util_module["E" /* isFunction */])(_) ? _ : Object(vega_util_module["m" /* constant */])(+_);
} // Implementation adapted from d3/d3-contour. Thanks!


function density2D () {
  var x = d => d[0],
      y = d => d[1],
      weight = vega_util_module["Q" /* one */],
      bandwidth = [-1, -1],
      dx = 960,
      dy = 500,
      k = 2; // log2(cellSize)


  function density(data, counts) {
    const rx = vega_geo_module_radius(bandwidth[0], data, x) >> k,
          // blur x-radius
    ry = vega_geo_module_radius(bandwidth[1], data, y) >> k,
          // blur y-radius
    ox = rx ? rx + 2 : 0,
          // x-offset padding for blur
    oy = ry ? ry + 2 : 0,
          // y-offset padding for blur
    n = 2 * ox + (dx >> k),
          // grid width
    m = 2 * oy + (dy >> k),
          // grid height
    values0 = new Float32Array(n * m),
          values1 = new Float32Array(n * m);
    let values = values0;
    data.forEach(d => {
      const xi = ox + (+x(d) >> k),
            yi = oy + (+y(d) >> k);

      if (xi >= 0 && xi < n && yi >= 0 && yi < m) {
        values0[xi + yi * n] += +weight(d);
      }
    });

    if (rx > 0 && ry > 0) {
      blurX(n, m, values0, values1, rx);
      blurY(n, m, values1, values0, ry);
      blurX(n, m, values0, values1, rx);
      blurY(n, m, values1, values0, ry);
      blurX(n, m, values0, values1, rx);
      blurY(n, m, values1, values0, ry);
    } else if (rx > 0) {
      blurX(n, m, values0, values1, rx);
      blurX(n, m, values1, values0, rx);
      blurX(n, m, values0, values1, rx);
      values = values1;
    } else if (ry > 0) {
      blurY(n, m, values0, values1, ry);
      blurY(n, m, values1, values0, ry);
      blurY(n, m, values0, values1, ry);
      values = values1;
    } // scale density estimates
    // density in points per square pixel or probability density


    const s = counts ? Math.pow(2, -2 * k) : 1 / sum_sum(values);

    for (let i = 0, sz = n * m; i < sz; ++i) values[i] *= s;

    return {
      values: values,
      scale: 1 << k,
      width: n,
      height: m,
      x1: ox,
      y1: oy,
      x2: ox + (dx >> k),
      y2: oy + (dy >> k)
    };
  }

  density.x = function (_) {
    return arguments.length ? (x = vega_geo_module_number(_), density) : x;
  };

  density.y = function (_) {
    return arguments.length ? (y = vega_geo_module_number(_), density) : y;
  };

  density.weight = function (_) {
    return arguments.length ? (weight = vega_geo_module_number(_), density) : weight;
  };

  density.size = function (_) {
    if (!arguments.length) return [dx, dy];

    var _0 = +_[0],
        _1 = +_[1];

    if (!(_0 >= 0 && _1 >= 0)) Object(vega_util_module["o" /* error */])('invalid size');
    return dx = _0, dy = _1, density;
  };

  density.cellSize = function (_) {
    if (!arguments.length) return 1 << k;
    if (!((_ = +_) >= 1)) Object(vega_util_module["o" /* error */])('invalid cell size');
    k = Math.floor(Math.log(_) / Math.LN2);
    return density;
  };

  density.bandwidth = function (_) {
    if (!arguments.length) return bandwidth;
    _ = Object(vega_util_module["i" /* array */])(_);
    if (_.length === 1) _ = [+_[0], +_[0]];
    if (_.length !== 2) Object(vega_util_module["o" /* error */])('invalid bandwidth');
    return bandwidth = _, density;
  };

  return density;
}

function blurX(n, m, source, target, r) {
  const w = (r << 1) + 1;

  for (let j = 0; j < m; ++j) {
    for (let i = 0, sr = 0; i < n + r; ++i) {
      if (i < n) {
        sr += source[i + j * n];
      }

      if (i >= r) {
        if (i >= w) {
          sr -= source[i - w + j * n];
        }

        target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w);
      }
    }
  }
}

function blurY(n, m, source, target, r) {
  const w = (r << 1) + 1;

  for (let i = 0; i < n; ++i) {
    for (let j = 0, sr = 0; j < m + r; ++j) {
      if (j < m) {
        sr += source[i + j * n];
      }

      if (j >= r) {
        if (j >= w) {
          sr -= source[i + (j - w) * n];
        }

        target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w);
      }
    }
  }
}

/**
 * Perform 2D kernel-density estimation of point data.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<number>} params.size - The [width, height] extent (in
 *   units of input pixels) over which to perform density estimation.
 * @param {function(object): number} params.x - The x-coordinate accessor.
 * @param {function(object): number} params.y - The y-coordinate accessor.
 * @param {function(object): number} [params.weight] - The weight accessor.
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors
 *   to groupby.
 * @param {number} [params.cellSize] - Contour density calculation cell size.
 *   This parameter determines the level of spatial approximation. For example,
 *   the default value of 4 maps to 2x reductions in both x- and y- dimensions.
 *   A value of 1 will result in an output raster grid whose dimensions exactly
 *   matches the size parameter.
 * @param {Array<number>} [params.bandwidth] - The KDE kernel bandwidths,
 *   in pixels. The input can be a two-element array specifying separate
 *   x and y bandwidths, or a single-element array specifying both. If the
 *   bandwidth is unspecified or less than zero, the bandwidth will be
 *   automatically determined.
 * @param {boolean} [params.counts=false] - A boolean flag indicating if the
 *   output values should be probability estimates (false, default) or
 *   smoothed counts (true).
 * @param {string} [params.as='grid'] - The output field in which to store
 *   the generated raster grid (default 'grid').
 */

function KDE2D(params) {
  Transform.call(this, null, params);
}
KDE2D.Definition = {
  'type': 'KDE2D',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'size',
    'type': 'number',
    'array': true,
    'length': 2,
    'required': true
  }, {
    'name': 'x',
    'type': 'field',
    'required': true
  }, {
    'name': 'y',
    'type': 'field',
    'required': true
  }, {
    'name': 'weight',
    'type': 'field'
  }, {
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'cellSize',
    'type': 'number'
  }, {
    'name': 'bandwidth',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'counts',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'as',
    'type': 'string',
    'default': 'grid'
  }]
};
const PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth'];
function vega_geo_module_params(obj, _) {
  PARAMS.forEach(param => _[param] != null ? obj[param](_[param]) : 0);
  return obj;
}
Object(vega_util_module["z" /* inherits */])(KDE2D, Transform, {
  transform(_, pulse) {
    if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation;
    var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
        source = pulse.materialize(pulse.SOURCE).source,
        groups = vega_geo_module_partition(source, _.groupby),
        names = (_.groupby || []).map(vega_util_module["h" /* accessorName */]),
        kde = vega_geo_module_params(density2D(), _),
        as = _.as || 'grid',
        values = [];

    function set(t, vals) {
      for (let i = 0; i < names.length; ++i) t[names[i]] = vals[i];

      return t;
    } // generate density raster grids


    values = groups.map(g => ingest$1(set({
      [as]: kde(g, _.counts)
    }, g.dims)));
    if (this.value) out.rem = this.value;
    this.value = out.source = out.add = values;
    return out;
  }

});
function vega_geo_module_partition(data, groupby) {
  var groups = [],
      get = f => f(t),
      map,
      i,
      n,
      t,
      k,
      g; // partition data points into groups


  if (groupby == null) {
    groups.push(data);
  } else {
    for (map = {}, i = 0, n = data.length; i < n; ++i) {
      t = data[i];
      k = groupby.map(get);
      g = map[k];

      if (!g) {
        map[k] = g = [];
        g.dims = k;
        groups.push(g);
      }

      g.push(t);
    }
  }

  return groups;
}

/**
 * Generate contours based on kernel-density estimation of point data.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<number>} params.size - The dimensions [width, height] over which to compute contours.
 *  If the values parameter is provided, this must be the dimensions of the input data.
 *  If density estimation is performed, this is the output view dimensions in pixels.
 * @param {Array<number>} [params.values] - An array of numeric values representing an
 *  width x height grid of values over which to compute contours. If unspecified, this
 *  transform will instead attempt to compute contours for the kernel density estimate
 *  using values drawn from data tuples in the input pulse.
 * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation.
 * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation.
 * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation.
 * @param {number} [params.cellSize] - Contour density calculation cell size.
 * @param {number} [params.bandwidth] - Kernel density estimation bandwidth.
 * @param {Array<number>} [params.thresholds] - Contour threshold array. If
 *   this parameter is set, the count and nice parameters will be ignored.
 * @param {number} [params.count] - The desired number of contours.
 * @param {boolean} [params.nice] - Boolean flag indicating if the contour
 *   threshold values should be automatically aligned to "nice"
 *   human-friendly values. Setting this flag may cause the number of
 *   thresholds to deviate from the specified count.
 * @param {boolean} [params.smooth] - Boolean flag indicating if the contour
 *   polygons should be smoothed using linear interpolation. The default is
 *   true. The parameter is ignored when using density estimation.
 */

function Contour(params) {
  Transform.call(this, null, params);
}
Contour.Definition = {
  'type': 'Contour',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'size',
    'type': 'number',
    'array': true,
    'length': 2,
    'required': true
  }, {
    'name': 'values',
    'type': 'number',
    'array': true
  }, {
    'name': 'x',
    'type': 'field'
  }, {
    'name': 'y',
    'type': 'field'
  }, {
    'name': 'weight',
    'type': 'field'
  }, {
    'name': 'cellSize',
    'type': 'number'
  }, {
    'name': 'bandwidth',
    'type': 'number'
  }, {
    'name': 'count',
    'type': 'number'
  }, {
    'name': 'nice',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'thresholds',
    'type': 'number',
    'array': true
  }, {
    'name': 'smooth',
    'type': 'boolean',
    'default': true
  }]
};
Object(vega_util_module["z" /* inherits */])(Contour, Transform, {
  transform(_, pulse) {
    if (this.value && !pulse.changed() && !_.modified()) {
      return pulse.StopPropagation;
    }

    var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
        contour = vega_geo_module_contours().smooth(_.smooth !== false),
        values = _.values,
        thresh = _.thresholds || vega_geo_module_quantize(_.count || 10, _.nice, !!values),
        size = _.size,
        grid,
        post;

    if (!values) {
      values = pulse.materialize(pulse.SOURCE).source;
      grid = vega_geo_module_params(density2D(), _)(values, true);
      post = vega_geo_module_transform(grid, grid.scale || 1, grid.scale || 1, 0, 0);
      size = [grid.width, grid.height];
      values = grid.values;
    }

    thresh = Object(vega_util_module["B" /* isArray */])(thresh) ? thresh : thresh(values);
    values = contour.size(size)(values, thresh);
    if (post) values.forEach(post);
    if (this.value) out.rem = this.value;
    this.value = out.source = out.add = (values || []).map(ingest$1);
    return out;
  }

});

const Feature = 'Feature';
const FeatureCollection = 'FeatureCollection';
const MultiPoint = 'MultiPoint';

/**
 * Consolidate an array of [longitude, latitude] points or GeoJSON features
 * into a combined GeoJSON object. This transform is particularly useful for
 * combining geo data for a Projection's fit argument. The resulting GeoJSON
 * data is available as this transform's value. Input pulses are unchanged.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<function(object): *>} [params.fields] - A two-element array
 *   of field accessors for the longitude and latitude values.
 * @param {function(object): *} params.geojson - A field accessor for
 *   retrieving GeoJSON feature data.
 */

function GeoJSON(params) {
  Transform.call(this, null, params);
}
GeoJSON.Definition = {
  'type': 'GeoJSON',
  'metadata': {},
  'params': [{
    'name': 'fields',
    'type': 'field',
    'array': true,
    'length': 2
  }, {
    'name': 'geojson',
    'type': 'field'
  }]
};
Object(vega_util_module["z" /* inherits */])(GeoJSON, Transform, {
  transform(_, pulse) {
    var features = this._features,
        points = this._points,
        fields = _.fields,
        lon = fields && fields[0],
        lat = fields && fields[1],
        geojson = _.geojson || !fields && vega_util_module["y" /* identity */],
        flag = pulse.ADD,
        mod;
    mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified(Object(vega_util_module["g" /* accessorFields */])(geojson)) || lon && pulse.modified(Object(vega_util_module["g" /* accessorFields */])(lon)) || lat && pulse.modified(Object(vega_util_module["g" /* accessorFields */])(lat));

    if (!this.value || mod) {
      flag = pulse.SOURCE;
      this._features = features = [];
      this._points = points = [];
    }

    if (geojson) {
      pulse.visit(flag, t => features.push(geojson(t)));
    }

    if (lon && lat) {
      pulse.visit(flag, t => {
        var x = lon(t),
            y = lat(t);

        if (x != null && y != null && (x = +x) === x && (y = +y) === y) {
          points.push([x, y]);
        }
      });
      features = features.concat({
        type: Feature,
        geometry: {
          type: MultiPoint,
          coordinates: points
        }
      });
    }

    this.value = {
      type: FeatureCollection,
      features: features
    };
  }

});

/**
 * Map GeoJSON data to an SVG path string.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(number, number): *} params.projection - The cartographic
 *   projection to apply.
 * @param {function(object): *} [params.field] - The field with GeoJSON data,
 *   or null if the tuple itself is a GeoJSON feature.
 * @param {string} [params.as='path'] - The output field in which to store
 *   the generated path data (default 'path').
 */

function GeoPath(params) {
  Transform.call(this, null, params);
}
GeoPath.Definition = {
  'type': 'GeoPath',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'projection',
    'type': 'projection'
  }, {
    'name': 'field',
    'type': 'field'
  }, {
    'name': 'pointRadius',
    'type': 'number',
    'expr': true
  }, {
    'name': 'as',
    'type': 'string',
    'default': 'path'
  }]
};
Object(vega_util_module["z" /* inherits */])(GeoPath, Transform, {
  transform(_, pulse) {
    var out = pulse.fork(pulse.ALL),
        path = this.value,
        field = _.field || vega_util_module["y" /* identity */],
        as = _.as || 'path',
        flag = out.SOURCE;

    if (!path || _.modified()) {
      // parameters updated, reset and reflow
      this.value = path = getProjectionPath(_.projection);
      out.materialize().reflow();
    } else {
      flag = field === vega_util_module["y" /* identity */] || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD;
    }

    const prev = initPath(path, _.pointRadius);
    out.visit(flag, t => t[as] = path(field(t)));
    path.pointRadius(prev);
    return out.modifies(as);
  }

});

function initPath(path, pointRadius) {
  const prev = path.pointRadius();
  path.context(null);

  if (pointRadius != null) {
    path.pointRadius(pointRadius);
  }

  return prev;
}

/**
 * Geo-code a longitude/latitude point to an x/y coordinate.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(number, number): *} params.projection - The cartographic
 *   projection to apply.
 * @param {Array<function(object): *>} params.fields - A two-element array of
 *   field accessors for the longitude and latitude values.
 * @param {Array<string>} [params.as] - A two-element array of field names
 *   under which to store the result. Defaults to ['x','y'].
 */

function GeoPoint(params) {
  Transform.call(this, null, params);
}
GeoPoint.Definition = {
  'type': 'GeoPoint',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'projection',
    'type': 'projection',
    'required': true
  }, {
    'name': 'fields',
    'type': 'field',
    'array': true,
    'required': true,
    'length': 2
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': 2,
    'default': ['x', 'y']
  }]
};
Object(vega_util_module["z" /* inherits */])(GeoPoint, Transform, {
  transform(_, pulse) {
    var proj = _.projection,
        lon = _.fields[0],
        lat = _.fields[1],
        as = _.as || ['x', 'y'],
        x = as[0],
        y = as[1],
        mod;

    function set(t) {
      const xy = proj([lon(t), lat(t)]);

      if (xy) {
        t[x] = xy[0];
        t[y] = xy[1];
      } else {
        t[x] = undefined;
        t[y] = undefined;
      }
    }

    if (_.modified()) {
      // parameters updated, reflow
      pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set);
    } else {
      mod = pulse.modified(lon.fields) || pulse.modified(lat.fields);
      pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set);
    }

    return pulse.modifies(as);
  }

});

/**
 * Annotate items with a geopath shape generator.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(number, number): *} params.projection - The cartographic
 *   projection to apply.
 * @param {function(object): *} [params.field] - The field with GeoJSON data,
 *   or null if the tuple itself is a GeoJSON feature.
 * @param {string} [params.as='shape'] - The output field in which to store
 *   the generated path data (default 'shape').
 */

function GeoShape(params) {
  Transform.call(this, null, params);
}
GeoShape.Definition = {
  'type': 'GeoShape',
  'metadata': {
    'modifies': true,
    'nomod': true
  },
  'params': [{
    'name': 'projection',
    'type': 'projection'
  }, {
    'name': 'field',
    'type': 'field',
    'default': 'datum'
  }, {
    'name': 'pointRadius',
    'type': 'number',
    'expr': true
  }, {
    'name': 'as',
    'type': 'string',
    'default': 'shape'
  }]
};
Object(vega_util_module["z" /* inherits */])(GeoShape, Transform, {
  transform(_, pulse) {
    var out = pulse.fork(pulse.ALL),
        shape = this.value,
        as = _.as || 'shape',
        flag = out.ADD;

    if (!shape || _.modified()) {
      // parameters updated, reset and reflow
      this.value = shape = shapeGenerator(getProjectionPath(_.projection), _.field || Object(vega_util_module["u" /* field */])('datum'), _.pointRadius);
      out.materialize().reflow();
      flag = out.SOURCE;
    }

    out.visit(flag, t => t[as] = shape);
    return out.modifies(as);
  }

});

function shapeGenerator(path, field, pointRadius) {
  const shape = pointRadius == null ? _ => path(field(_)) : _ => {
    var prev = path.pointRadius(),
        value = path.pointRadius(pointRadius)(field(_));
    path.pointRadius(prev);
    return value;
  };

  shape.context = _ => {
    path.context(_);
    return shape;
  };

  return shape;
}

/**
 * GeoJSON feature generator for creating graticules.
 * @constructor
 */

function Graticule(params) {
  Transform.call(this, [], params);
  this.generator = graticule_graticule();
}
Graticule.Definition = {
  'type': 'Graticule',
  'metadata': {
    'changes': true,
    'generates': true
  },
  'params': [{
    'name': 'extent',
    'type': 'array',
    'array': true,
    'length': 2,
    'content': {
      'type': 'number',
      'array': true,
      'length': 2
    }
  }, {
    'name': 'extentMajor',
    'type': 'array',
    'array': true,
    'length': 2,
    'content': {
      'type': 'number',
      'array': true,
      'length': 2
    }
  }, {
    'name': 'extentMinor',
    'type': 'array',
    'array': true,
    'length': 2,
    'content': {
      'type': 'number',
      'array': true,
      'length': 2
    }
  }, {
    'name': 'step',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'stepMajor',
    'type': 'number',
    'array': true,
    'length': 2,
    'default': [90, 360]
  }, {
    'name': 'stepMinor',
    'type': 'number',
    'array': true,
    'length': 2,
    'default': [10, 10]
  }, {
    'name': 'precision',
    'type': 'number',
    'default': 2.5
  }]
};
Object(vega_util_module["z" /* inherits */])(Graticule, Transform, {
  transform(_, pulse) {
    var src = this.value,
        gen = this.generator,
        t;

    if (!src.length || _.modified()) {
      for (const prop in _) {
        if (Object(vega_util_module["E" /* isFunction */])(gen[prop])) {
          gen[prop](_[prop]);
        }
      }
    }

    t = gen();

    if (src.length) {
      pulse.mod.push(replace(src[0], t));
    } else {
      pulse.add.push(ingest$1(t));
    }

    src[0] = t;
    return pulse;
  }

});

/**
 * Render a heatmap image for input raster grid data.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} [params.field] - The field with raster grid
 *   data. If unspecified, the tuple itself is interpreted as a raster grid.
 * @param {string} [params.color] - A constant color value or function for
 *   individual pixel color. If a function, it will be invoked with an input
 *   object that includes $x, $y, $value, and $max fields for the grid.
 * @param {number} [params.opacity] - A constant opacity value or function for
 *   individual pixel opacity. If a function, it will be invoked with an input
 *   object that includes $x, $y, $value, and $max fields for the grid.
 * @param {string} [params.resolve] - The method for resolving maximum values
 *   across multiple input grids. If 'independent' (the default), maximum
 *   calculation will be performed separately for each grid. If 'shared',
 *   a single global maximum will be used for all input grids.
 * @param {string} [params.as='image'] - The output field in which to store
 *   the generated bitmap canvas images (default 'image').
 */

function Heatmap(params) {
  Transform.call(this, null, params);
}
Heatmap.Definition = {
  'type': 'heatmap',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field'
  }, {
    'name': 'color',
    'type': 'string',
    'expr': true
  }, {
    'name': 'opacity',
    'type': 'number',
    'expr': true
  }, {
    'name': 'resolve',
    'type': 'enum',
    'values': ['shared', 'independent'],
    'default': 'independent'
  }, {
    'name': 'as',
    'type': 'string',
    'default': 'image'
  }]
};
Object(vega_util_module["z" /* inherits */])(Heatmap, Transform, {
  transform(_, pulse) {
    if (!pulse.changed() && !_.modified()) {
      return pulse.StopPropagation;
    }

    var source = pulse.materialize(pulse.SOURCE).source,
        shared = _.resolve === 'shared',
        field = _.field || vega_util_module["y" /* identity */],
        opacity = opacity_(_.opacity, _),
        color = color_(_.color, _),
        as = _.as || 'image',
        obj = {
      $x: 0,
      $y: 0,
      $value: 0,
      $max: shared ? max_max(source.map(t => max_max(field(t).values))) : 0
    };
    source.forEach(t => {
      const v = field(t); // build proxy data object

      const o = Object(vega_util_module["p" /* extend */])({}, t, obj); // set maximum value if not globally shared

      if (!shared) o.$max = max_max(v.values || []); // generate canvas image
      // optimize color/opacity if not pixel-dependent

      t[as] = toCanvas(v, o, color.dep ? color : Object(vega_util_module["m" /* constant */])(color(o)), opacity.dep ? opacity : Object(vega_util_module["m" /* constant */])(opacity(o)));
    });
    return pulse.reflow(true).modifies(as);
  }

}); // get image color function

function color_(color, _) {
  let f;

  if (Object(vega_util_module["E" /* isFunction */])(color)) {
    f = obj => color_rgb(color(obj, _));

    f.dep = dependency(color);
  } else {
    // default to mid-grey
    f = Object(vega_util_module["m" /* constant */])(color_rgb(color || '#888'));
  }

  return f;
} // get image opacity function


function opacity_(opacity, _) {
  let f;

  if (Object(vega_util_module["E" /* isFunction */])(opacity)) {
    f = obj => opacity(obj, _);

    f.dep = dependency(opacity);
  } else if (opacity) {
    f = Object(vega_util_module["m" /* constant */])(opacity);
  } else {
    // default to [0, max] opacity gradient
    f = obj => obj.$value / obj.$max || 0;

    f.dep = true;
  }

  return f;
} // check if function depends on individual pixel data


function dependency(f) {
  if (!Object(vega_util_module["E" /* isFunction */])(f)) return false;
  const set = Object(vega_util_module["fb" /* toSet */])(Object(vega_util_module["g" /* accessorFields */])(f));
  return set.$x || set.$y || set.$value || set.$max;
} // render raster grid to canvas


function toCanvas(grid, obj, color, opacity) {
  const n = grid.width,
        m = grid.height,
        x1 = grid.x1 || 0,
        y1 = grid.y1 || 0,
        x2 = grid.x2 || n,
        y2 = grid.y2 || m,
        val = grid.values,
        value = val ? i => val[i] : vega_util_module["mb" /* zero */],
        can = domCanvas(x2 - x1, y2 - y1),
        ctx = can.getContext('2d'),
        img = ctx.getImageData(0, 0, x2 - x1, y2 - y1),
        pix = img.data;

  for (let j = y1, k = 0; j < y2; ++j) {
    obj.$y = j - y1;

    for (let i = x1, r = j * n; i < x2; ++i, k += 4) {
      obj.$x = i - x1;
      obj.$value = value(i + r);
      const v = color(obj);
      pix[k + 0] = v.r;
      pix[k + 1] = v.g;
      pix[k + 2] = v.b;
      pix[k + 3] = ~~(255 * opacity(obj));
    }
  }

  ctx.putImageData(img, 0, 0);
  return can;
}

/**
 * Maintains a cartographic projection.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */

function Projection(params) {
  Transform.call(this, null, params);
  this.modified(true); // always treat as modified
}
Object(vega_util_module["z" /* inherits */])(Projection, Transform, {
  transform(_, pulse) {
    let proj = this.value;

    if (!proj || _.modified('type')) {
      this.value = proj = vega_geo_module_create(_.type);
      projectionProperties.forEach(prop => {
        if (_[prop] != null) vega_geo_module_set(proj, prop, _[prop]);
      });
    } else {
      projectionProperties.forEach(prop => {
        if (_.modified(prop)) vega_geo_module_set(proj, prop, _[prop]);
      });
    }

    if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius);
    if (_.fit) vega_geo_module_fit(proj, _);
    return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
  }

});

function vega_geo_module_fit(proj, _) {
  const data = collectGeoJSON(_.fit);
  _.extent ? proj.fitExtent(_.extent, data) : _.size ? proj.fitSize(_.size, data) : 0;
}

function vega_geo_module_create(type) {
  const constructor = vega_projection_module_projection((type || 'mercator').toLowerCase());
  if (!constructor) Object(vega_util_module["o" /* error */])('Unrecognized projection type: ' + type);
  return constructor();
}

function vega_geo_module_set(proj, key, value) {
  if (Object(vega_util_module["E" /* isFunction */])(proj[key])) proj[key](value);
}

function collectGeoJSON(data) {
  data = Object(vega_util_module["i" /* array */])(data);
  return data.length === 1 ? data[0] : {
    type: FeatureCollection,
    features: data.reduce((a, f) => a.concat(featurize(f)), [])
  };
}

function featurize(f) {
  return f.type === FeatureCollection ? f.features : Object(vega_util_module["i" /* array */])(f).filter(d => d != null).map(d => d.type === Feature ? d : {
    type: Feature,
    geometry: d
  });
}



// CONCATENATED MODULE: ./node_modules/d3-force/src/center.js
/* harmony default export */ var src_center = (function(x, y) {
  var nodes, strength = 1;

  if (x == null) x = 0;
  if (y == null) y = 0;

  function force() {
    var i,
        n = nodes.length,
        node,
        sx = 0,
        sy = 0;

    for (i = 0; i < n; ++i) {
      node = nodes[i], sx += node.x, sy += node.y;
    }

    for (sx = (sx / n - x) * strength, sy = (sy / n - y) * strength, i = 0; i < n; ++i) {
      node = nodes[i], node.x -= sx, node.y -= sy;
    }
  }

  force.initialize = function(_) {
    nodes = _;
  };

  force.x = function(_) {
    return arguments.length ? (x = +_, force) : x;
  };

  force.y = function(_) {
    return arguments.length ? (y = +_, force) : y;
  };

  force.strength = function(_) {
    return arguments.length ? (strength = +_, force) : strength;
  };

  return force;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/add.js
/* harmony default export */ var src_add = (function(d) {
  const x = +this._x.call(null, d),
      y = +this._y.call(null, d);
  return add_add(this.cover(x, y), x, y, d);
});

function add_add(tree, x, y, d) {
  if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points

  var parent,
      node = tree._root,
      leaf = {data: d},
      x0 = tree._x0,
      y0 = tree._y0,
      x1 = tree._x1,
      y1 = tree._y1,
      xm,
      ym,
      xp,
      yp,
      right,
      bottom,
      i,
      j;

  // If the tree is empty, initialize the root as a leaf.
  if (!node) return tree._root = leaf, tree;

  // Find the existing leaf for the new point, or add it.
  while (node.length) {
    if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
    if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
    if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;
  }

  // Is the new point is exactly coincident with the existing point?
  xp = +tree._x.call(null, node.data);
  yp = +tree._y.call(null, node.data);
  if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;

  // Otherwise, split the leaf node until the old and new point are separated.
  do {
    parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
    if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
    if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
  } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm)));
  return parent[j] = node, parent[i] = leaf, tree;
}

function addAll(data) {
  var d, i, n = data.length,
      x,
      y,
      xz = new Array(n),
      yz = new Array(n),
      x0 = Infinity,
      y0 = Infinity,
      x1 = -Infinity,
      y1 = -Infinity;

  // Compute the points and their extent.
  for (i = 0; i < n; ++i) {
    if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;
    xz[i] = x;
    yz[i] = y;
    if (x < x0) x0 = x;
    if (x > x1) x1 = x;
    if (y < y0) y0 = y;
    if (y > y1) y1 = y;
  }

  // If there were no (valid) points, abort.
  if (x0 > x1 || y0 > y1) return this;

  // Expand the tree to cover the new points.
  this.cover(x0, y0).cover(x1, y1);

  // Add the new points.
  for (i = 0; i < n; ++i) {
    add_add(this, xz[i], yz[i], data[i]);
  }

  return this;
}

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/cover.js
/* harmony default export */ var cover = (function(x, y) {
  if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points

  var x0 = this._x0,
      y0 = this._y0,
      x1 = this._x1,
      y1 = this._y1;

  // If the quadtree has no extent, initialize them.
  // Integer extent are necessary so that if we later double the extent,
  // the existing quadrant boundaries don’t change due to floating point error!
  if (isNaN(x0)) {
    x1 = (x0 = Math.floor(x)) + 1;
    y1 = (y0 = Math.floor(y)) + 1;
  }

  // Otherwise, double repeatedly to cover.
  else {
    var z = x1 - x0 || 1,
        node = this._root,
        parent,
        i;

    while (x0 > x || x >= x1 || y0 > y || y >= y1) {
      i = (y < y0) << 1 | (x < x0);
      parent = new Array(4), parent[i] = node, node = parent, z *= 2;
      switch (i) {
        case 0: x1 = x0 + z, y1 = y0 + z; break;
        case 1: x0 = x1 - z, y1 = y0 + z; break;
        case 2: x1 = x0 + z, y0 = y1 - z; break;
        case 3: x0 = x1 - z, y0 = y1 - z; break;
      }
    }

    if (this._root && this._root.length) this._root = node;
  }

  this._x0 = x0;
  this._y0 = y0;
  this._x1 = x1;
  this._y1 = y1;
  return this;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/data.js
/* harmony default export */ var src_data = (function() {
  var data = [];
  this.visit(function(node) {
    if (!node.length) do data.push(node.data); while (node = node.next)
  });
  return data;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/extent.js
/* harmony default export */ var src_extent = (function(_) {
  return arguments.length
      ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])
      : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/quad.js
/* harmony default export */ var src_quad = (function(node, x0, y0, x1, y1) {
  this.node = node;
  this.x0 = x0;
  this.y0 = y0;
  this.x1 = x1;
  this.y1 = y1;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/find.js


/* harmony default export */ var src_find = (function(x, y, radius) {
  var data,
      x0 = this._x0,
      y0 = this._y0,
      x1,
      y1,
      x2,
      y2,
      x3 = this._x1,
      y3 = this._y1,
      quads = [],
      node = this._root,
      q,
      i;

  if (node) quads.push(new src_quad(node, x0, y0, x3, y3));
  if (radius == null) radius = Infinity;
  else {
    x0 = x - radius, y0 = y - radius;
    x3 = x + radius, y3 = y + radius;
    radius *= radius;
  }

  while (q = quads.pop()) {

    // Stop searching if this quadrant can’t contain a closer node.
    if (!(node = q.node)
        || (x1 = q.x0) > x3
        || (y1 = q.y0) > y3
        || (x2 = q.x1) < x0
        || (y2 = q.y1) < y0) continue;

    // Bisect the current quadrant.
    if (node.length) {
      var xm = (x1 + x2) / 2,
          ym = (y1 + y2) / 2;

      quads.push(
        new src_quad(node[3], xm, ym, x2, y2),
        new src_quad(node[2], x1, ym, xm, y2),
        new src_quad(node[1], xm, y1, x2, ym),
        new src_quad(node[0], x1, y1, xm, ym)
      );

      // Visit the closest quadrant first.
      if (i = (y >= ym) << 1 | (x >= xm)) {
        q = quads[quads.length - 1];
        quads[quads.length - 1] = quads[quads.length - 1 - i];
        quads[quads.length - 1 - i] = q;
      }
    }

    // Visit this point. (Visiting coincident points isn’t necessary!)
    else {
      var dx = x - +this._x.call(null, node.data),
          dy = y - +this._y.call(null, node.data),
          d2 = dx * dx + dy * dy;
      if (d2 < radius) {
        var d = Math.sqrt(radius = d2);
        x0 = x - d, y0 = y - d;
        x3 = x + d, y3 = y + d;
        data = node.data;
      }
    }
  }

  return data;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/remove.js
/* harmony default export */ var src_remove = (function(d) {
  if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points

  var parent,
      node = this._root,
      retainer,
      previous,
      next,
      x0 = this._x0,
      y0 = this._y0,
      x1 = this._x1,
      y1 = this._y1,
      x,
      y,
      xm,
      ym,
      right,
      bottom,
      i,
      j;

  // If the tree is empty, initialize the root as a leaf.
  if (!node) return this;

  // Find the leaf node for the point.
  // While descending, also retain the deepest parent with a non-removed sibling.
  if (node.length) while (true) {
    if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
    if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
    if (!(parent = node, node = node[i = bottom << 1 | right])) return this;
    if (!node.length) break;
    if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i;
  }

  // Find the point to remove.
  while (node.data !== d) if (!(previous = node, node = node.next)) return this;
  if (next = node.next) delete node.next;

  // If there are multiple coincident points, remove just the point.
  if (previous) return (next ? previous.next = next : delete previous.next), this;

  // If this is the root point, remove it.
  if (!parent) return this._root = next, this;

  // Remove this leaf.
  next ? parent[i] = next : delete parent[i];

  // If the parent now contains exactly one leaf, collapse superfluous parents.
  if ((node = parent[0] || parent[1] || parent[2] || parent[3])
      && node === (parent[3] || parent[2] || parent[1] || parent[0])
      && !node.length) {
    if (retainer) retainer[j] = node;
    else this._root = node;
  }

  return this;
});

function removeAll(data) {
  for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
  return this;
}

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/root.js
/* harmony default export */ var src_root = (function() {
  return this._root;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/size.js
/* harmony default export */ var src_size = (function() {
  var size = 0;
  this.visit(function(node) {
    if (!node.length) do ++size; while (node = node.next)
  });
  return size;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/visit.js


/* harmony default export */ var src_visit = (function(callback) {
  var quads = [], q, node = this._root, child, x0, y0, x1, y1;
  if (node) quads.push(new src_quad(node, this._x0, this._y0, this._x1, this._y1));
  while (q = quads.pop()) {
    if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
      var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
      if (child = node[3]) quads.push(new src_quad(child, xm, ym, x1, y1));
      if (child = node[2]) quads.push(new src_quad(child, x0, ym, xm, y1));
      if (child = node[1]) quads.push(new src_quad(child, xm, y0, x1, ym));
      if (child = node[0]) quads.push(new src_quad(child, x0, y0, xm, ym));
    }
  }
  return this;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/visitAfter.js


/* harmony default export */ var visitAfter = (function(callback) {
  var quads = [], next = [], q;
  if (this._root) quads.push(new src_quad(this._root, this._x0, this._y0, this._x1, this._y1));
  while (q = quads.pop()) {
    var node = q.node;
    if (node.length) {
      var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
      if (child = node[0]) quads.push(new src_quad(child, x0, y0, xm, ym));
      if (child = node[1]) quads.push(new src_quad(child, xm, y0, x1, ym));
      if (child = node[2]) quads.push(new src_quad(child, x0, ym, xm, y1));
      if (child = node[3]) quads.push(new src_quad(child, xm, ym, x1, y1));
    }
    next.push(q);
  }
  while (q = next.pop()) {
    callback(q.node, q.x0, q.y0, q.x1, q.y1);
  }
  return this;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/x.js
function defaultX(d) {
  return d[0];
}

/* harmony default export */ var src_x = (function(_) {
  return arguments.length ? (this._x = _, this) : this._x;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/y.js
function defaultY(d) {
  return d[1];
}

/* harmony default export */ var src_y = (function(_) {
  return arguments.length ? (this._y = _, this) : this._y;
});

// CONCATENATED MODULE: ./node_modules/d3-quadtree/src/quadtree.js













function quadtree(nodes, x, y) {
  var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);
  return nodes == null ? tree : tree.addAll(nodes);
}

function Quadtree(x, y, x0, y0, x1, y1) {
  this._x = x;
  this._y = y;
  this._x0 = x0;
  this._y0 = y0;
  this._x1 = x1;
  this._y1 = y1;
  this._root = undefined;
}

function leaf_copy(leaf) {
  var copy = {data: leaf.data}, next = copy;
  while (leaf = leaf.next) next = next.next = {data: leaf.data};
  return copy;
}

var treeProto = quadtree.prototype = Quadtree.prototype;

treeProto.copy = function() {
  var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),
      node = this._root,
      nodes,
      child;

  if (!node) return copy;

  if (!node.length) return copy._root = leaf_copy(node), copy;

  nodes = [{source: node, target: copy._root = new Array(4)}];
  while (node = nodes.pop()) {
    for (var i = 0; i < 4; ++i) {
      if (child = node.source[i]) {
        if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)});
        else node.target[i] = leaf_copy(child);
      }
    }
  }

  return copy;
};

treeProto.add = src_add;
treeProto.addAll = addAll;
treeProto.cover = cover;
treeProto.data = src_data;
treeProto.extent = src_extent;
treeProto.find = src_find;
treeProto.remove = src_remove;
treeProto.removeAll = removeAll;
treeProto.root = src_root;
treeProto.size = src_size;
treeProto.visit = src_visit;
treeProto.visitAfter = visitAfter;
treeProto.x = src_x;
treeProto.y = src_y;

// CONCATENATED MODULE: ./node_modules/d3-force/src/constant.js
/* harmony default export */ var d3_force_src_constant = (function(x) {
  return function() {
    return x;
  };
});

// CONCATENATED MODULE: ./node_modules/d3-force/src/jiggle.js
/* harmony default export */ var jiggle = (function(random) {
  return (random() - 0.5) * 1e-6;
});

// CONCATENATED MODULE: ./node_modules/d3-force/src/collide.js




function collide_x(d) {
  return d.x + d.vx;
}

function collide_y(d) {
  return d.y + d.vy;
}

/* harmony default export */ var collide = (function(radius) {
  var nodes,
      radii,
      random,
      strength = 1,
      iterations = 1;

  if (typeof radius !== "function") radius = d3_force_src_constant(radius == null ? 1 : +radius);

  function force() {
    var i, n = nodes.length,
        tree,
        node,
        xi,
        yi,
        ri,
        ri2;

    for (var k = 0; k < iterations; ++k) {
      tree = quadtree(nodes, collide_x, collide_y).visitAfter(prepare);
      for (i = 0; i < n; ++i) {
        node = nodes[i];
        ri = radii[node.index], ri2 = ri * ri;
        xi = node.x + node.vx;
        yi = node.y + node.vy;
        tree.visit(apply);
      }
    }

    function apply(quad, x0, y0, x1, y1) {
      var data = quad.data, rj = quad.r, r = ri + rj;
      if (data) {
        if (data.index > node.index) {
          var x = xi - data.x - data.vx,
              y = yi - data.y - data.vy,
              l = x * x + y * y;
          if (l < r * r) {
            if (x === 0) x = jiggle(random), l += x * x;
            if (y === 0) y = jiggle(random), l += y * y;
            l = (r - (l = Math.sqrt(l))) / l * strength;
            node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));
            node.vy += (y *= l) * r;
            data.vx -= x * (r = 1 - r);
            data.vy -= y * r;
          }
        }
        return;
      }
      return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
    }
  }

  function prepare(quad) {
    if (quad.data) return quad.r = radii[quad.data.index];
    for (var i = quad.r = 0; i < 4; ++i) {
      if (quad[i] && quad[i].r > quad.r) {
        quad.r = quad[i].r;
      }
    }
  }

  function initialize() {
    if (!nodes) return;
    var i, n = nodes.length, node;
    radii = new Array(n);
    for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
  }

  force.initialize = function(_nodes, _random) {
    nodes = _nodes;
    random = _random;
    initialize();
  };

  force.iterations = function(_) {
    return arguments.length ? (iterations = +_, force) : iterations;
  };

  force.strength = function(_) {
    return arguments.length ? (strength = +_, force) : strength;
  };

  force.radius = function(_) {
    return arguments.length ? (radius = typeof _ === "function" ? _ : d3_force_src_constant(+_), initialize(), force) : radius;
  };

  return force;
});

// CONCATENATED MODULE: ./node_modules/d3-dispatch/src/dispatch.js
var dispatch_noop = {value: () => {}};

function dispatch() {
  for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
    if (!(t = arguments[i] + "") || (t in _) || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
    _[t] = [];
  }
  return new Dispatch(_);
}

function Dispatch(_) {
  this._ = _;
}

function parseTypenames(typenames, types) {
  return typenames.trim().split(/^|\s+/).map(function(t) {
    var name = "", i = t.indexOf(".");
    if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
    if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
    return {type: t, name: name};
  });
}

Dispatch.prototype = dispatch.prototype = {
  constructor: Dispatch,
  on: function(typename, callback) {
    var _ = this._,
        T = parseTypenames(typename + "", _),
        t,
        i = -1,
        n = T.length;

    // If no callback was specified, return the callback of the given type and name.
    if (arguments.length < 2) {
      while (++i < n) if ((t = (typename = T[i]).type) && (t = dispatch_get(_[t], typename.name))) return t;
      return;
    }

    // If a type was specified, set the callback for the given type and name.
    // Otherwise, if a null callback was specified, remove callbacks of the given name.
    if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
    while (++i < n) {
      if (t = (typename = T[i]).type) _[t] = dispatch_set(_[t], typename.name, callback);
      else if (callback == null) for (t in _) _[t] = dispatch_set(_[t], typename.name, null);
    }

    return this;
  },
  copy: function() {
    var copy = {}, _ = this._;
    for (var t in _) copy[t] = _[t].slice();
    return new Dispatch(copy);
  },
  call: function(type, that) {
    if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
    if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
    for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
  },
  apply: function(type, that, args) {
    if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
    for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
  }
};

function dispatch_get(type, name) {
  for (var i = 0, n = type.length, c; i < n; ++i) {
    if ((c = type[i]).name === name) {
      return c.value;
    }
  }
}

function dispatch_set(type, name, callback) {
  for (var i = 0, n = type.length; i < n; ++i) {
    if (type[i].name === name) {
      type[i] = dispatch_noop, type = type.slice(0, i).concat(type.slice(i + 1));
      break;
    }
  }
  if (callback != null) type.push({name: name, value: callback});
  return type;
}

/* harmony default export */ var src_dispatch = (dispatch);

// CONCATENATED MODULE: ./node_modules/d3-timer/src/timer.js
var timer_frame = 0, // is an animation frame pending?
    timeout = 0, // is a timeout pending?
    timer_interval = 0, // are any timers active?
    pokeDelay = 1000, // how frequently we check for clock skew
    taskHead,
    taskTail,
    clockLast = 0,
    clockNow = 0,
    clockSkew = 0,
    clock = typeof performance === "object" && performance.now ? performance : Date,
    setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };

function now() {
  return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
}

function clearNow() {
  clockNow = 0;
}

function Timer() {
  this._call =
  this._time =
  this._next = null;
}

Timer.prototype = timer.prototype = {
  constructor: Timer,
  restart: function(callback, delay, time) {
    if (typeof callback !== "function") throw new TypeError("callback is not a function");
    time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
    if (!this._next && taskTail !== this) {
      if (taskTail) taskTail._next = this;
      else taskHead = this;
      taskTail = this;
    }
    this._call = callback;
    this._time = time;
    sleep();
  },
  stop: function() {
    if (this._call) {
      this._call = null;
      this._time = Infinity;
      sleep();
    }
  }
};

function timer(callback, delay, time) {
  var t = new Timer;
  t.restart(callback, delay, time);
  return t;
}

function timerFlush() {
  now(); // Get the current time, if not already set.
  ++timer_frame; // Pretend we’ve set an alarm, if we haven’t already.
  var t = taskHead, e;
  while (t) {
    if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
    t = t._next;
  }
  --timer_frame;
}

function wake() {
  clockNow = (clockLast = clock.now()) + clockSkew;
  timer_frame = timeout = 0;
  try {
    timerFlush();
  } finally {
    timer_frame = 0;
    nap();
    clockNow = 0;
  }
}

function poke() {
  var now = clock.now(), delay = now - clockLast;
  if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
}

function nap() {
  var t0, t1 = taskHead, t2, time = Infinity;
  while (t1) {
    if (t1._call) {
      if (time > t1._time) time = t1._time;
      t0 = t1, t1 = t1._next;
    } else {
      t2 = t1._next, t1._next = null;
      t1 = t0 ? t0._next = t2 : taskHead = t2;
    }
  }
  taskTail = t0;
  sleep(time);
}

function sleep(time) {
  if (timer_frame) return; // Soonest alarm already set, or will be.
  if (timeout) timeout = clearTimeout(timeout);
  var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
  if (delay > 24) {
    if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
    if (timer_interval) timer_interval = clearInterval(timer_interval);
  } else {
    if (!timer_interval) clockLast = clock.now(), timer_interval = setInterval(poke, pokeDelay);
    timer_frame = 1, setFrame(wake);
  }
}

// CONCATENATED MODULE: ./node_modules/d3-force/src/lcg.js
// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
const lcg_a = 1664525;
const lcg_c = 1013904223;
const lcg_m = 4294967296; // 2^32

/* harmony default export */ var src_lcg = (function() {
  let s = 1;
  return () => (s = (lcg_a * s + lcg_c) % lcg_m) / lcg_m;
});

// CONCATENATED MODULE: ./node_modules/d3-force/src/simulation.js




function simulation_x(d) {
  return d.x;
}

function simulation_y(d) {
  return d.y;
}

var initialRadius = 10,
    initialAngle = Math.PI * (3 - Math.sqrt(5));

/* harmony default export */ var src_simulation = (function(nodes) {
  var simulation,
      alpha = 1,
      alphaMin = 0.001,
      alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
      alphaTarget = 0,
      velocityDecay = 0.6,
      forces = new Map(),
      stepper = timer(step),
      event = src_dispatch("tick", "end"),
      random = src_lcg();

  if (nodes == null) nodes = [];

  function step() {
    tick();
    event.call("tick", simulation);
    if (alpha < alphaMin) {
      stepper.stop();
      event.call("end", simulation);
    }
  }

  function tick(iterations) {
    var i, n = nodes.length, node;

    if (iterations === undefined) iterations = 1;

    for (var k = 0; k < iterations; ++k) {
      alpha += (alphaTarget - alpha) * alphaDecay;

      forces.forEach(function(force) {
        force(alpha);
      });

      for (i = 0; i < n; ++i) {
        node = nodes[i];
        if (node.fx == null) node.x += node.vx *= velocityDecay;
        else node.x = node.fx, node.vx = 0;
        if (node.fy == null) node.y += node.vy *= velocityDecay;
        else node.y = node.fy, node.vy = 0;
      }
    }

    return simulation;
  }

  function initializeNodes() {
    for (var i = 0, n = nodes.length, node; i < n; ++i) {
      node = nodes[i], node.index = i;
      if (node.fx != null) node.x = node.fx;
      if (node.fy != null) node.y = node.fy;
      if (isNaN(node.x) || isNaN(node.y)) {
        var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle;
        node.x = radius * Math.cos(angle);
        node.y = radius * Math.sin(angle);
      }
      if (isNaN(node.vx) || isNaN(node.vy)) {
        node.vx = node.vy = 0;
      }
    }
  }

  function initializeForce(force) {
    if (force.initialize) force.initialize(nodes, random);
    return force;
  }

  initializeNodes();

  return simulation = {
    tick: tick,

    restart: function() {
      return stepper.restart(step), simulation;
    },

    stop: function() {
      return stepper.stop(), simulation;
    },

    nodes: function(_) {
      return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes;
    },

    alpha: function(_) {
      return arguments.length ? (alpha = +_, simulation) : alpha;
    },

    alphaMin: function(_) {
      return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
    },

    alphaDecay: function(_) {
      return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
    },

    alphaTarget: function(_) {
      return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
    },

    velocityDecay: function(_) {
      return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
    },

    randomSource: function(_) {
      return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random;
    },

    force: function(name, _) {
      return arguments.length > 1 ? ((_ == null ? forces.delete(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);
    },

    find: function(x, y, radius) {
      var i = 0,
          n = nodes.length,
          dx,
          dy,
          d2,
          node,
          closest;

      if (radius == null) radius = Infinity;
      else radius *= radius;

      for (i = 0; i < n; ++i) {
        node = nodes[i];
        dx = x - node.x;
        dy = y - node.y;
        d2 = dx * dx + dy * dy;
        if (d2 < radius) closest = node, radius = d2;
      }

      return closest;
    },

    on: function(name, _) {
      return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
    }
  };
});

// CONCATENATED MODULE: ./node_modules/d3-force/src/manyBody.js





/* harmony default export */ var manyBody = (function() {
  var nodes,
      node,
      random,
      alpha,
      strength = d3_force_src_constant(-30),
      strengths,
      distanceMin2 = 1,
      distanceMax2 = Infinity,
      theta2 = 0.81;

  function force(_) {
    var i, n = nodes.length, tree = quadtree(nodes, simulation_x, simulation_y).visitAfter(accumulate);
    for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
  }

  function initialize() {
    if (!nodes) return;
    var i, n = nodes.length, node;
    strengths = new Array(n);
    for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);
  }

  function accumulate(quad) {
    var strength = 0, q, c, weight = 0, x, y, i;

    // For internal nodes, accumulate forces from child quadrants.
    if (quad.length) {
      for (x = y = i = 0; i < 4; ++i) {
        if ((q = quad[i]) && (c = Math.abs(q.value))) {
          strength += q.value, weight += c, x += c * q.x, y += c * q.y;
        }
      }
      quad.x = x / weight;
      quad.y = y / weight;
    }

    // For leaf nodes, accumulate forces from coincident quadrants.
    else {
      q = quad;
      q.x = q.data.x;
      q.y = q.data.y;
      do strength += strengths[q.data.index];
      while (q = q.next);
    }

    quad.value = strength;
  }

  function apply(quad, x1, _, x2) {
    if (!quad.value) return true;

    var x = quad.x - node.x,
        y = quad.y - node.y,
        w = x2 - x1,
        l = x * x + y * y;

    // Apply the Barnes-Hut approximation if possible.
    // Limit forces for very close nodes; randomize direction if coincident.
    if (w * w / theta2 < l) {
      if (l < distanceMax2) {
        if (x === 0) x = jiggle(random), l += x * x;
        if (y === 0) y = jiggle(random), l += y * y;
        if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
        node.vx += x * quad.value * alpha / l;
        node.vy += y * quad.value * alpha / l;
      }
      return true;
    }

    // Otherwise, process points directly.
    else if (quad.length || l >= distanceMax2) return;

    // Limit forces for very close nodes; randomize direction if coincident.
    if (quad.data !== node || quad.next) {
      if (x === 0) x = jiggle(random), l += x * x;
      if (y === 0) y = jiggle(random), l += y * y;
      if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
    }

    do if (quad.data !== node) {
      w = strengths[quad.data.index] * alpha / l;
      node.vx += x * w;
      node.vy += y * w;
    } while (quad = quad.next);
  }

  force.initialize = function(_nodes, _random) {
    nodes = _nodes;
    random = _random;
    initialize();
  };

  force.strength = function(_) {
    return arguments.length ? (strength = typeof _ === "function" ? _ : d3_force_src_constant(+_), initialize(), force) : strength;
  };

  force.distanceMin = function(_) {
    return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
  };

  force.distanceMax = function(_) {
    return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
  };

  force.theta = function(_) {
    return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
  };

  return force;
});

// CONCATENATED MODULE: ./node_modules/d3-force/src/link.js



function link_index(d) {
  return d.index;
}

function link_find(nodeById, nodeId) {
  var node = nodeById.get(nodeId);
  if (!node) throw new Error("node not found: " + nodeId);
  return node;
}

/* harmony default export */ var src_link = (function(links) {
  var id = link_index,
      strength = defaultStrength,
      strengths,
      distance = d3_force_src_constant(30),
      distances,
      nodes,
      count,
      bias,
      random,
      iterations = 1;

  if (links == null) links = [];

  function defaultStrength(link) {
    return 1 / Math.min(count[link.source.index], count[link.target.index]);
  }

  function force(alpha) {
    for (var k = 0, n = links.length; k < iterations; ++k) {
      for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {
        link = links[i], source = link.source, target = link.target;
        x = target.x + target.vx - source.x - source.vx || jiggle(random);
        y = target.y + target.vy - source.y - source.vy || jiggle(random);
        l = Math.sqrt(x * x + y * y);
        l = (l - distances[i]) / l * alpha * strengths[i];
        x *= l, y *= l;
        target.vx -= x * (b = bias[i]);
        target.vy -= y * b;
        source.vx += x * (b = 1 - b);
        source.vy += y * b;
      }
    }
  }

  function initialize() {
    if (!nodes) return;

    var i,
        n = nodes.length,
        m = links.length,
        nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d])),
        link;

    for (i = 0, count = new Array(n); i < m; ++i) {
      link = links[i], link.index = i;
      if (typeof link.source !== "object") link.source = link_find(nodeById, link.source);
      if (typeof link.target !== "object") link.target = link_find(nodeById, link.target);
      count[link.source.index] = (count[link.source.index] || 0) + 1;
      count[link.target.index] = (count[link.target.index] || 0) + 1;
    }

    for (i = 0, bias = new Array(m); i < m; ++i) {
      link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
    }

    strengths = new Array(m), initializeStrength();
    distances = new Array(m), initializeDistance();
  }

  function initializeStrength() {
    if (!nodes) return;

    for (var i = 0, n = links.length; i < n; ++i) {
      strengths[i] = +strength(links[i], i, links);
    }
  }

  function initializeDistance() {
    if (!nodes) return;

    for (var i = 0, n = links.length; i < n; ++i) {
      distances[i] = +distance(links[i], i, links);
    }
  }

  force.initialize = function(_nodes, _random) {
    nodes = _nodes;
    random = _random;
    initialize();
  };

  force.links = function(_) {
    return arguments.length ? (links = _, initialize(), force) : links;
  };

  force.id = function(_) {
    return arguments.length ? (id = _, force) : id;
  };

  force.iterations = function(_) {
    return arguments.length ? (iterations = +_, force) : iterations;
  };

  force.strength = function(_) {
    return arguments.length ? (strength = typeof _ === "function" ? _ : d3_force_src_constant(+_), initializeStrength(), force) : strength;
  };

  force.distance = function(_) {
    return arguments.length ? (distance = typeof _ === "function" ? _ : d3_force_src_constant(+_), initializeDistance(), force) : distance;
  };

  return force;
});

// CONCATENATED MODULE: ./node_modules/d3-force/src/x.js


/* harmony default export */ var d3_force_src_x = (function(x) {
  var strength = d3_force_src_constant(0.1),
      nodes,
      strengths,
      xz;

  if (typeof x !== "function") x = d3_force_src_constant(x == null ? 0 : +x);

  function force(alpha) {
    for (var i = 0, n = nodes.length, node; i < n; ++i) {
      node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;
    }
  }

  function initialize() {
    if (!nodes) return;
    var i, n = nodes.length;
    strengths = new Array(n);
    xz = new Array(n);
    for (i = 0; i < n; ++i) {
      strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
    }
  }

  force.initialize = function(_) {
    nodes = _;
    initialize();
  };

  force.strength = function(_) {
    return arguments.length ? (strength = typeof _ === "function" ? _ : d3_force_src_constant(+_), initialize(), force) : strength;
  };

  force.x = function(_) {
    return arguments.length ? (x = typeof _ === "function" ? _ : d3_force_src_constant(+_), initialize(), force) : x;
  };

  return force;
});

// CONCATENATED MODULE: ./node_modules/d3-force/src/y.js


/* harmony default export */ var d3_force_src_y = (function(y) {
  var strength = d3_force_src_constant(0.1),
      nodes,
      strengths,
      yz;

  if (typeof y !== "function") y = d3_force_src_constant(y == null ? 0 : +y);

  function force(alpha) {
    for (var i = 0, n = nodes.length, node; i < n; ++i) {
      node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;
    }
  }

  function initialize() {
    if (!nodes) return;
    var i, n = nodes.length;
    strengths = new Array(n);
    yz = new Array(n);
    for (i = 0; i < n; ++i) {
      strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
    }
  }

  force.initialize = function(_) {
    nodes = _;
    initialize();
  };

  force.strength = function(_) {
    return arguments.length ? (strength = typeof _ === "function" ? _ : d3_force_src_constant(+_), initialize(), force) : strength;
  };

  force.y = function(_) {
    return arguments.length ? (y = typeof _ === "function" ? _ : d3_force_src_constant(+_), initialize(), force) : y;
  };

  return force;
});

// CONCATENATED MODULE: ./node_modules/vega-force/build/vega-force.module.js




const ForceMap = {
  center: src_center,
  collide: collide,
  nbody: manyBody,
  link: src_link,
  x: d3_force_src_x,
  y: d3_force_src_y
};
const Forces = 'forces',
      ForceParams = ['alpha', 'alphaMin', 'alphaTarget', 'velocityDecay', 'forces'],
      ForceConfig = ['static', 'iterations'],
      ForceOutput = ['x', 'y', 'vx', 'vy'];
/**
 * Force simulation layout.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<object>} params.forces - The forces to apply.
 */

function Force(params) {
  Transform.call(this, null, params);
}
Force.Definition = {
  'type': 'Force',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'static',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'restart',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'iterations',
    'type': 'number',
    'default': 300
  }, {
    'name': 'alpha',
    'type': 'number',
    'default': 1
  }, {
    'name': 'alphaMin',
    'type': 'number',
    'default': 0.001
  }, {
    'name': 'alphaTarget',
    'type': 'number',
    'default': 0
  }, {
    'name': 'velocityDecay',
    'type': 'number',
    'default': 0.4
  }, {
    'name': 'forces',
    'type': 'param',
    'array': true,
    'params': [{
      'key': {
        'force': 'center'
      },
      'params': [{
        'name': 'x',
        'type': 'number',
        'default': 0
      }, {
        'name': 'y',
        'type': 'number',
        'default': 0
      }]
    }, {
      'key': {
        'force': 'collide'
      },
      'params': [{
        'name': 'radius',
        'type': 'number',
        'expr': true
      }, {
        'name': 'strength',
        'type': 'number',
        'default': 0.7
      }, {
        'name': 'iterations',
        'type': 'number',
        'default': 1
      }]
    }, {
      'key': {
        'force': 'nbody'
      },
      'params': [{
        'name': 'strength',
        'type': 'number',
        'default': -30
      }, {
        'name': 'theta',
        'type': 'number',
        'default': 0.9
      }, {
        'name': 'distanceMin',
        'type': 'number',
        'default': 1
      }, {
        'name': 'distanceMax',
        'type': 'number'
      }]
    }, {
      'key': {
        'force': 'link'
      },
      'params': [{
        'name': 'links',
        'type': 'data'
      }, {
        'name': 'id',
        'type': 'field'
      }, {
        'name': 'distance',
        'type': 'number',
        'default': 30,
        'expr': true
      }, {
        'name': 'strength',
        'type': 'number',
        'expr': true
      }, {
        'name': 'iterations',
        'type': 'number',
        'default': 1
      }]
    }, {
      'key': {
        'force': 'x'
      },
      'params': [{
        'name': 'strength',
        'type': 'number',
        'default': 0.1
      }, {
        'name': 'x',
        'type': 'field'
      }]
    }, {
      'key': {
        'force': 'y'
      },
      'params': [{
        'name': 'strength',
        'type': 'number',
        'default': 0.1
      }, {
        'name': 'y',
        'type': 'field'
      }]
    }]
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'modify': false,
    'default': ForceOutput
  }]
};
Object(vega_util_module["z" /* inherits */])(Force, Transform, {
  transform(_, pulse) {
    var sim = this.value,
        change = pulse.changed(pulse.ADD_REM),
        params = _.modified(ForceParams),
        iters = _.iterations || 300; // configure simulation


    if (!sim) {
      this.value = sim = vega_force_module_simulation(pulse.source, _);
      sim.on('tick', rerun(pulse.dataflow, this));

      if (!_.static) {
        change = true;
        sim.tick(); // ensure we run on init
      }

      pulse.modifies('index');
    } else {
      if (change) {
        pulse.modifies('index');
        sim.nodes(pulse.source);
      }

      if (params || pulse.changed(pulse.MOD)) {
        setup(sim, _, 0, pulse);
      }
    } // run simulation


    if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) {
      sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters));

      if (_.static) {
        for (sim.stop(); --iters >= 0;) sim.tick();
      } else {
        if (sim.stopped()) sim.restart();
        if (!change) return pulse.StopPropagation; // defer to sim ticks
      }
    }

    return this.finish(_, pulse);
  },

  finish(_, pulse) {
    const dataflow = pulse.dataflow; // inspect dependencies, touch link source data

    for (let args = this._argops, j = 0, m = args.length, arg; j < m; ++j) {
      arg = args[j];

      if (arg.name !== Forces || arg.op._argval.force !== 'link') {
        continue;
      }

      for (var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i) {
        if (ops[i].name === 'links' && (op = ops[i].op.source)) {
          dataflow.pulse(op, dataflow.changeset().reflow());
          break;
        }
      }
    } // reflow all nodes


    return pulse.reflow(_.modified()).modifies(ForceOutput);
  }

});

function rerun(df, op) {
  return () => df.touch(op).run();
}

function vega_force_module_simulation(nodes, _) {
  const sim = src_simulation(nodes),
        stop = sim.stop,
        restart = sim.restart;
  let stopped = false;

  sim.stopped = () => stopped;

  sim.restart = () => (stopped = false, restart());

  sim.stop = () => (stopped = true, stop());

  return setup(sim, _, true).on('end', () => stopped = true);
}

function setup(sim, _, init, pulse) {
  var f = Object(vega_util_module["i" /* array */])(_.forces),
      i,
      n,
      p,
      name;

  for (i = 0, n = ForceParams.length; i < n; ++i) {
    p = ForceParams[i];
    if (p !== Forces && _.modified(p)) sim[p](_[p]);
  }

  for (i = 0, n = f.length; i < n; ++i) {
    name = Forces + i;
    p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null;
    if (p) sim.force(name, p);
  }

  for (n = sim.numForces || 0; i < n; ++i) {
    sim.force(Forces + i, null); // remove
  }

  sim.numForces = f.length;
  return sim;
}

function modified(f, pulse) {
  var k, v;

  for (k in f) {
    if (Object(vega_util_module["E" /* isFunction */])(v = f[k]) && pulse.modified(Object(vega_util_module["g" /* accessorFields */])(v))) return 1;
  }

  return 0;
}

function getForce(_) {
  var f, p;

  if (!Object(vega_util_module["w" /* hasOwnProperty */])(ForceMap, _.force)) {
    Object(vega_util_module["o" /* error */])('Unrecognized force: ' + _.force);
  }

  f = ForceMap[_.force]();

  for (p in _) {
    if (Object(vega_util_module["E" /* isFunction */])(f[p])) setForceParam(f[p], _[p], _);
  }

  return f;
}

function setForceParam(f, v, _) {
  f(Object(vega_util_module["E" /* isFunction */])(v) ? d => v(d, _) : v);
}



// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/count.js
function count_count(node) {
  var sum = 0,
      children = node.children,
      i = children && children.length;
  if (!i) sum = 1;
  else while (--i >= 0) sum += children[i].value;
  node.value = sum;
}

/* harmony default export */ var hierarchy_count = (function() {
  return this.eachAfter(count_count);
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/each.js
/* harmony default export */ var each = (function(callback, that) {
  let index = -1;
  for (const node of this) {
    callback.call(that, node, ++index, this);
  }
  return this;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/eachBefore.js
/* harmony default export */ var eachBefore = (function(callback, that) {
  var node = this, nodes = [node], children, i, index = -1;
  while (node = nodes.pop()) {
    callback.call(that, node, ++index, this);
    if (children = node.children) {
      for (i = children.length - 1; i >= 0; --i) {
        nodes.push(children[i]);
      }
    }
  }
  return this;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/eachAfter.js
/* harmony default export */ var eachAfter = (function(callback, that) {
  var node = this, nodes = [node], next = [], children, i, n, index = -1;
  while (node = nodes.pop()) {
    next.push(node);
    if (children = node.children) {
      for (i = 0, n = children.length; i < n; ++i) {
        nodes.push(children[i]);
      }
    }
  }
  while (node = next.pop()) {
    callback.call(that, node, ++index, this);
  }
  return this;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/find.js
/* harmony default export */ var hierarchy_find = (function(callback, that) {
  let index = -1;
  for (const node of this) {
    if (callback.call(that, node, ++index, this)) {
      return node;
    }
  }
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/sum.js
/* harmony default export */ var hierarchy_sum = (function(value) {
  return this.eachAfter(function(node) {
    var sum = +value(node.data) || 0,
        children = node.children,
        i = children && children.length;
    while (--i >= 0) sum += children[i].value;
    node.value = sum;
  });
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/sort.js
/* harmony default export */ var hierarchy_sort = (function(compare) {
  return this.eachBefore(function(node) {
    if (node.children) {
      node.children.sort(compare);
    }
  });
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/path.js
/* harmony default export */ var hierarchy_path = (function(end) {
  var start = this,
      ancestor = leastCommonAncestor(start, end),
      nodes = [start];
  while (start !== ancestor) {
    start = start.parent;
    nodes.push(start);
  }
  var k = nodes.length;
  while (end !== ancestor) {
    nodes.splice(k, 0, end);
    end = end.parent;
  }
  return nodes;
});

function leastCommonAncestor(a, b) {
  if (a === b) return a;
  var aNodes = a.ancestors(),
      bNodes = b.ancestors(),
      c = null;
  a = aNodes.pop();
  b = bNodes.pop();
  while (a === b) {
    c = a;
    a = aNodes.pop();
    b = bNodes.pop();
  }
  return c;
}

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/ancestors.js
/* harmony default export */ var ancestors = (function() {
  var node = this, nodes = [node];
  while (node = node.parent) {
    nodes.push(node);
  }
  return nodes;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/descendants.js
/* harmony default export */ var descendants = (function() {
  return Array.from(this);
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/leaves.js
/* harmony default export */ var leaves = (function() {
  var leaves = [];
  this.eachBefore(function(node) {
    if (!node.children) {
      leaves.push(node);
    }
  });
  return leaves;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/links.js
/* harmony default export */ var hierarchy_links = (function() {
  var root = this, links = [];
  root.each(function(node) {
    if (node !== root) { // Don’t include the root’s parent, if any.
      links.push({source: node.parent, target: node});
    }
  });
  return links;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/iterator.js
/* harmony default export */ var iterator = (function*() {
  var node = this, current, next = [node], children, i, n;
  do {
    current = next.reverse(), next = [];
    while (node = current.pop()) {
      yield node;
      if (children = node.children) {
        for (i = 0, n = children.length; i < n; ++i) {
          next.push(children[i]);
        }
      }
    }
  } while (next.length);
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/index.js














function hierarchy(data, children) {
  if (data instanceof Map) {
    data = [undefined, data];
    if (children === undefined) children = mapChildren;
  } else if (children === undefined) {
    children = objectChildren;
  }

  var root = new Node(data),
      node,
      nodes = [root],
      child,
      childs,
      i,
      n;

  while (node = nodes.pop()) {
    if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {
      node.children = childs;
      for (i = n - 1; i >= 0; --i) {
        nodes.push(child = childs[i] = new Node(childs[i]));
        child.parent = node;
        child.depth = node.depth + 1;
      }
    }
  }

  return root.eachBefore(computeHeight);
}

function node_copy() {
  return hierarchy(this).eachBefore(copyData);
}

function objectChildren(d) {
  return d.children;
}

function mapChildren(d) {
  return Array.isArray(d) ? d[1] : null;
}

function copyData(node) {
  if (node.data.value !== undefined) node.value = node.data.value;
  node.data = node.data.data;
}

function computeHeight(node) {
  var height = 0;
  do node.height = height;
  while ((node = node.parent) && (node.height < ++height));
}

function Node(data) {
  this.data = data;
  this.depth =
  this.height = 0;
  this.parent = null;
}

Node.prototype = hierarchy.prototype = {
  constructor: Node,
  count: hierarchy_count,
  each: each,
  eachAfter: eachAfter,
  eachBefore: eachBefore,
  find: hierarchy_find,
  sum: hierarchy_sum,
  sort: hierarchy_sort,
  path: hierarchy_path,
  ancestors: ancestors,
  descendants: descendants,
  leaves: leaves,
  links: hierarchy_links,
  copy: node_copy,
  [Symbol.iterator]: iterator
};

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/array.js
/* harmony default export */ var d3_hierarchy_src_array = (function(x) {
  return typeof x === "object" && "length" in x
    ? x // Array, TypedArray, NodeList, array-like
    : Array.from(x); // Map, Set, iterable, string, or anything else
});

function shuffle(array) {
  var m = array.length,
      t,
      i;

  while (m) {
    i = Math.random() * m-- | 0;
    t = array[m];
    array[m] = array[i];
    array[i] = t;
  }

  return array;
}

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/pack/enclose.js


/* harmony default export */ var enclose = (function(circles) {
  var i = 0, n = (circles = shuffle(Array.from(circles))).length, B = [], p, e;

  while (i < n) {
    p = circles[i];
    if (e && enclosesWeak(e, p)) ++i;
    else e = encloseBasis(B = extendBasis(B, p)), i = 0;
  }

  return e;
});

function extendBasis(B, p) {
  var i, j;

  if (enclosesWeakAll(p, B)) return [p];

  // If we get here then B must have at least one element.
  for (i = 0; i < B.length; ++i) {
    if (enclosesNot(p, B[i])
        && enclosesWeakAll(encloseBasis2(B[i], p), B)) {
      return [B[i], p];
    }
  }

  // If we get here then B must have at least two elements.
  for (i = 0; i < B.length - 1; ++i) {
    for (j = i + 1; j < B.length; ++j) {
      if (enclosesNot(encloseBasis2(B[i], B[j]), p)
          && enclosesNot(encloseBasis2(B[i], p), B[j])
          && enclosesNot(encloseBasis2(B[j], p), B[i])
          && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) {
        return [B[i], B[j], p];
      }
    }
  }

  // If we get here then something is very wrong.
  throw new Error;
}

function enclosesNot(a, b) {
  var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y;
  return dr < 0 || dr * dr < dx * dx + dy * dy;
}

function enclosesWeak(a, b) {
  var dr = a.r - b.r + Math.max(a.r, b.r, 1) * 1e-9, dx = b.x - a.x, dy = b.y - a.y;
  return dr > 0 && dr * dr > dx * dx + dy * dy;
}

function enclosesWeakAll(a, B) {
  for (var i = 0; i < B.length; ++i) {
    if (!enclosesWeak(a, B[i])) {
      return false;
    }
  }
  return true;
}

function encloseBasis(B) {
  switch (B.length) {
    case 1: return encloseBasis1(B[0]);
    case 2: return encloseBasis2(B[0], B[1]);
    case 3: return encloseBasis3(B[0], B[1], B[2]);
  }
}

function encloseBasis1(a) {
  return {
    x: a.x,
    y: a.y,
    r: a.r
  };
}

function encloseBasis2(a, b) {
  var x1 = a.x, y1 = a.y, r1 = a.r,
      x2 = b.x, y2 = b.y, r2 = b.r,
      x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1,
      l = Math.sqrt(x21 * x21 + y21 * y21);
  return {
    x: (x1 + x2 + x21 / l * r21) / 2,
    y: (y1 + y2 + y21 / l * r21) / 2,
    r: (l + r1 + r2) / 2
  };
}

function encloseBasis3(a, b, c) {
  var x1 = a.x, y1 = a.y, r1 = a.r,
      x2 = b.x, y2 = b.y, r2 = b.r,
      x3 = c.x, y3 = c.y, r3 = c.r,
      a2 = x1 - x2,
      a3 = x1 - x3,
      b2 = y1 - y2,
      b3 = y1 - y3,
      c2 = r2 - r1,
      c3 = r3 - r1,
      d1 = x1 * x1 + y1 * y1 - r1 * r1,
      d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2,
      d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3,
      ab = a3 * b2 - a2 * b3,
      xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1,
      xb = (b3 * c2 - b2 * c3) / ab,
      ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1,
      yb = (a2 * c3 - a3 * c2) / ab,
      A = xb * xb + yb * yb - 1,
      B = 2 * (r1 + xa * xb + ya * yb),
      C = xa * xa + ya * ya - r1 * r1,
      r = -(A ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);
  return {
    x: x1 + xa + xb * r,
    y: y1 + ya + yb * r,
    r: r
  };
}

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/pack/siblings.js



function siblings_place(b, a, c) {
  var dx = b.x - a.x, x, a2,
      dy = b.y - a.y, y, b2,
      d2 = dx * dx + dy * dy;
  if (d2) {
    a2 = a.r + c.r, a2 *= a2;
    b2 = b.r + c.r, b2 *= b2;
    if (a2 > b2) {
      x = (d2 + b2 - a2) / (2 * d2);
      y = Math.sqrt(Math.max(0, b2 / d2 - x * x));
      c.x = b.x - x * dx - y * dy;
      c.y = b.y - x * dy + y * dx;
    } else {
      x = (d2 + a2 - b2) / (2 * d2);
      y = Math.sqrt(Math.max(0, a2 / d2 - x * x));
      c.x = a.x + x * dx - y * dy;
      c.y = a.y + x * dy + y * dx;
    }
  } else {
    c.x = a.x + c.r;
    c.y = a.y;
  }
}

function intersects(a, b) {
  var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y;
  return dr > 0 && dr * dr > dx * dx + dy * dy;
}

function score(node) {
  var a = node._,
      b = node.next._,
      ab = a.r + b.r,
      dx = (a.x * b.r + b.x * a.r) / ab,
      dy = (a.y * b.r + b.y * a.r) / ab;
  return dx * dx + dy * dy;
}

function siblings_Node(circle) {
  this._ = circle;
  this.next = null;
  this.previous = null;
}

function packEnclose(circles) {
  if (!(n = (circles = d3_hierarchy_src_array(circles)).length)) return 0;

  var a, b, c, n, aa, ca, i, j, k, sj, sk;

  // Place the first circle.
  a = circles[0], a.x = 0, a.y = 0;
  if (!(n > 1)) return a.r;

  // Place the second circle.
  b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;
  if (!(n > 2)) return a.r + b.r;

  // Place the third circle.
  siblings_place(b, a, c = circles[2]);

  // Initialize the front-chain using the first three circles a, b and c.
  a = new siblings_Node(a), b = new siblings_Node(b), c = new siblings_Node(c);
  a.next = c.previous = b;
  b.next = a.previous = c;
  c.next = b.previous = a;

  // Attempt to place each remaining circle…
  pack: for (i = 3; i < n; ++i) {
    siblings_place(a._, b._, c = circles[i]), c = new siblings_Node(c);

    // Find the closest intersecting circle on the front-chain, if any.
    // “Closeness” is determined by linear distance along the front-chain.
    // “Ahead” or “behind” is likewise determined by linear distance.
    j = b.next, k = a.previous, sj = b._.r, sk = a._.r;
    do {
      if (sj <= sk) {
        if (intersects(j._, c._)) {
          b = j, a.next = b, b.previous = a, --i;
          continue pack;
        }
        sj += j._.r, j = j.next;
      } else {
        if (intersects(k._, c._)) {
          a = k, a.next = b, b.previous = a, --i;
          continue pack;
        }
        sk += k._.r, k = k.previous;
      }
    } while (j !== k.next);

    // Success! Insert the new circle c between a and b.
    c.previous = a, c.next = b, a.next = b.previous = b = c;

    // Compute the new closest circle pair to the centroid.
    aa = score(a);
    while ((c = c.next) !== b) {
      if ((ca = score(c)) < aa) {
        a = c, aa = ca;
      }
    }
    b = a.next;
  }

  // Compute the enclosing circle of the front chain.
  a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a);

  // Translate the circles to put the enclosing circle around the origin.
  for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;

  return c.r;
}

/* harmony default export */ var siblings = (function(circles) {
  packEnclose(circles);
  return circles;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/accessors.js
function optional(f) {
  return f == null ? null : required(f);
}

function required(f) {
  if (typeof f !== "function") throw new Error;
  return f;
}

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/constant.js
function constantZero() {
  return 0;
}

/* harmony default export */ var d3_hierarchy_src_constant = (function(x) {
  return function() {
    return x;
  };
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/pack/index.js




function defaultRadius(d) {
  return Math.sqrt(d.value);
}

/* harmony default export */ var src_pack = (function() {
  var radius = null,
      dx = 1,
      dy = 1,
      padding = constantZero;

  function pack(root) {
    root.x = dx / 2, root.y = dy / 2;
    if (radius) {
      root.eachBefore(radiusLeaf(radius))
          .eachAfter(packChildren(padding, 0.5))
          .eachBefore(translateChild(1));
    } else {
      root.eachBefore(radiusLeaf(defaultRadius))
          .eachAfter(packChildren(constantZero, 1))
          .eachAfter(packChildren(padding, root.r / Math.min(dx, dy)))
          .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));
    }
    return root;
  }

  pack.radius = function(x) {
    return arguments.length ? (radius = optional(x), pack) : radius;
  };

  pack.size = function(x) {
    return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];
  };

  pack.padding = function(x) {
    return arguments.length ? (padding = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), pack) : padding;
  };

  return pack;
});

function radiusLeaf(radius) {
  return function(node) {
    if (!node.children) {
      node.r = Math.max(0, +radius(node) || 0);
    }
  };
}

function packChildren(padding, k) {
  return function(node) {
    if (children = node.children) {
      var children,
          i,
          n = children.length,
          r = padding(node) * k || 0,
          e;

      if (r) for (i = 0; i < n; ++i) children[i].r += r;
      e = packEnclose(children);
      if (r) for (i = 0; i < n; ++i) children[i].r -= r;
      node.r = e + r;
    }
  };
}

function translateChild(k) {
  return function(node) {
    var parent = node.parent;
    node.r *= k;
    if (parent) {
      node.x = parent.x + k * node.x;
      node.y = parent.y + k * node.y;
    }
  };
}

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/round.js
/* harmony default export */ var treemap_round = (function(node) {
  node.x0 = Math.round(node.x0);
  node.y0 = Math.round(node.y0);
  node.x1 = Math.round(node.x1);
  node.y1 = Math.round(node.y1);
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/dice.js
/* harmony default export */ var dice = (function(parent, x0, y0, x1, y1) {
  var nodes = parent.children,
      node,
      i = -1,
      n = nodes.length,
      k = parent.value && (x1 - x0) / parent.value;

  while (++i < n) {
    node = nodes[i], node.y0 = y0, node.y1 = y1;
    node.x0 = x0, node.x1 = x0 += node.value * k;
  }
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/partition.js



/* harmony default export */ var src_partition = (function() {
  var dx = 1,
      dy = 1,
      padding = 0,
      round = false;

  function partition(root) {
    var n = root.height + 1;
    root.x0 =
    root.y0 = padding;
    root.x1 = dx;
    root.y1 = dy / n;
    root.eachBefore(positionNode(dy, n));
    if (round) root.eachBefore(treemap_round);
    return root;
  }

  function positionNode(dy, n) {
    return function(node) {
      if (node.children) {
        dice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);
      }
      var x0 = node.x0,
          y0 = node.y0,
          x1 = node.x1 - padding,
          y1 = node.y1 - padding;
      if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
      if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
      node.x0 = x0;
      node.y0 = y0;
      node.x1 = x1;
      node.y1 = y1;
    };
  }

  partition.round = function(x) {
    return arguments.length ? (round = !!x, partition) : round;
  };

  partition.size = function(x) {
    return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy];
  };

  partition.padding = function(x) {
    return arguments.length ? (padding = +x, partition) : padding;
  };

  return partition;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/stratify.js



var preroot = {depth: -1},
    ambiguous = {};

function defaultId(d) {
  return d.id;
}

function defaultParentId(d) {
  return d.parentId;
}

/* harmony default export */ var src_stratify = (function() {
  var id = defaultId,
      parentId = defaultParentId;

  function stratify(data) {
    var nodes = Array.from(data),
        n = nodes.length,
        d,
        i,
        root,
        parent,
        node,
        nodeId,
        nodeKey,
        nodeByKey = new Map;

    for (i = 0; i < n; ++i) {
      d = nodes[i], node = nodes[i] = new Node(d);
      if ((nodeId = id(d, i, data)) != null && (nodeId += "")) {
        nodeKey = node.id = nodeId;
        nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);
      }
      if ((nodeId = parentId(d, i, data)) != null && (nodeId += "")) {
        node.parent = nodeId;
      }
    }

    for (i = 0; i < n; ++i) {
      node = nodes[i];
      if (nodeId = node.parent) {
        parent = nodeByKey.get(nodeId);
        if (!parent) throw new Error("missing: " + nodeId);
        if (parent === ambiguous) throw new Error("ambiguous: " + nodeId);
        if (parent.children) parent.children.push(node);
        else parent.children = [node];
        node.parent = parent;
      } else {
        if (root) throw new Error("multiple roots");
        root = node;
      }
    }

    if (!root) throw new Error("no root");
    root.parent = preroot;
    root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);
    root.parent = null;
    if (n > 0) throw new Error("cycle");

    return root;
  }

  stratify.id = function(x) {
    return arguments.length ? (id = required(x), stratify) : id;
  };

  stratify.parentId = function(x) {
    return arguments.length ? (parentId = required(x), stratify) : parentId;
  };

  return stratify;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/tree.js


function defaultSeparation(a, b) {
  return a.parent === b.parent ? 1 : 2;
}

// function radialSeparation(a, b) {
//   return (a.parent === b.parent ? 1 : 2) / a.depth;
// }

// This function is used to traverse the left contour of a subtree (or
// subforest). It returns the successor of v on this contour. This successor is
// either given by the leftmost child of v or by the thread of v. The function
// returns null if and only if v is on the highest level of its subtree.
function nextLeft(v) {
  var children = v.children;
  return children ? children[0] : v.t;
}

// This function works analogously to nextLeft.
function nextRight(v) {
  var children = v.children;
  return children ? children[children.length - 1] : v.t;
}

// Shifts the current subtree rooted at w+. This is done by increasing
// prelim(w+) and mod(w+) by shift.
function moveSubtree(wm, wp, shift) {
  var change = shift / (wp.i - wm.i);
  wp.c -= change;
  wp.s += shift;
  wm.c += change;
  wp.z += shift;
  wp.m += shift;
}

// All other shifts, applied to the smaller subtrees between w- and w+, are
// performed by this function. To prepare the shifts, we have to adjust
// change(w+), shift(w+), and change(w-).
function executeShifts(v) {
  var shift = 0,
      change = 0,
      children = v.children,
      i = children.length,
      w;
  while (--i >= 0) {
    w = children[i];
    w.z += shift;
    w.m += shift;
    shift += w.s + (change += w.c);
  }
}

// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise,
// returns the specified (default) ancestor.
function nextAncestor(vim, v, ancestor) {
  return vim.a.parent === v.parent ? vim.a : ancestor;
}

function TreeNode(node, i) {
  this._ = node;
  this.parent = null;
  this.children = null;
  this.A = null; // default ancestor
  this.a = this; // ancestor
  this.z = 0; // prelim
  this.m = 0; // mod
  this.c = 0; // change
  this.s = 0; // shift
  this.t = null; // thread
  this.i = i; // number
}

TreeNode.prototype = Object.create(Node.prototype);

function treeRoot(root) {
  var tree = new TreeNode(root, 0),
      node,
      nodes = [tree],
      child,
      children,
      i,
      n;

  while (node = nodes.pop()) {
    if (children = node._.children) {
      node.children = new Array(n = children.length);
      for (i = n - 1; i >= 0; --i) {
        nodes.push(child = node.children[i] = new TreeNode(children[i], i));
        child.parent = node;
      }
    }
  }

  (tree.parent = new TreeNode(null, 0)).children = [tree];
  return tree;
}

// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
/* harmony default export */ var src_tree = (function() {
  var separation = defaultSeparation,
      dx = 1,
      dy = 1,
      nodeSize = null;

  function tree(root) {
    var t = treeRoot(root);

    // Compute the layout using Buchheim et al.’s algorithm.
    t.eachAfter(firstWalk), t.parent.m = -t.z;
    t.eachBefore(secondWalk);

    // If a fixed node size is specified, scale x and y.
    if (nodeSize) root.eachBefore(sizeNode);

    // If a fixed tree size is specified, scale x and y based on the extent.
    // Compute the left-most, right-most, and depth-most nodes for extents.
    else {
      var left = root,
          right = root,
          bottom = root;
      root.eachBefore(function(node) {
        if (node.x < left.x) left = node;
        if (node.x > right.x) right = node;
        if (node.depth > bottom.depth) bottom = node;
      });
      var s = left === right ? 1 : separation(left, right) / 2,
          tx = s - left.x,
          kx = dx / (right.x + s + tx),
          ky = dy / (bottom.depth || 1);
      root.eachBefore(function(node) {
        node.x = (node.x + tx) * kx;
        node.y = node.depth * ky;
      });
    }

    return root;
  }

  // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is
  // applied recursively to the children of v, as well as the function
  // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the
  // node v is placed to the midpoint of its outermost children.
  function firstWalk(v) {
    var children = v.children,
        siblings = v.parent.children,
        w = v.i ? siblings[v.i - 1] : null;
    if (children) {
      executeShifts(v);
      var midpoint = (children[0].z + children[children.length - 1].z) / 2;
      if (w) {
        v.z = w.z + separation(v._, w._);
        v.m = v.z - midpoint;
      } else {
        v.z = midpoint;
      }
    } else if (w) {
      v.z = w.z + separation(v._, w._);
    }
    v.parent.A = apportion(v, w, v.parent.A || siblings[0]);
  }

  // Computes all real x-coordinates by summing up the modifiers recursively.
  function secondWalk(v) {
    v._.x = v.z + v.parent.m;
    v.m += v.parent.m;
  }

  // The core of the algorithm. Here, a new subtree is combined with the
  // previous subtrees. Threads are used to traverse the inside and outside
  // contours of the left and right subtree up to the highest common level. The
  // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the
  // superscript o means outside and i means inside, the subscript - means left
  // subtree and + means right subtree. For summing up the modifiers along the
  // contour, we use respective variables si+, si-, so-, and so+. Whenever two
  // nodes of the inside contours conflict, we compute the left one of the
  // greatest uncommon ancestors using the function ANCESTOR and call MOVE
  // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.
  // Finally, we add a new thread (if necessary).
  function apportion(v, w, ancestor) {
    if (w) {
      var vip = v,
          vop = v,
          vim = w,
          vom = vip.parent.children[0],
          sip = vip.m,
          sop = vop.m,
          sim = vim.m,
          som = vom.m,
          shift;
      while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {
        vom = nextLeft(vom);
        vop = nextRight(vop);
        vop.a = v;
        shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);
        if (shift > 0) {
          moveSubtree(nextAncestor(vim, v, ancestor), v, shift);
          sip += shift;
          sop += shift;
        }
        sim += vim.m;
        sip += vip.m;
        som += vom.m;
        sop += vop.m;
      }
      if (vim && !nextRight(vop)) {
        vop.t = vim;
        vop.m += sim - sop;
      }
      if (vip && !nextLeft(vom)) {
        vom.t = vip;
        vom.m += sip - som;
        ancestor = v;
      }
    }
    return ancestor;
  }

  function sizeNode(node) {
    node.x *= dx;
    node.y = node.depth * dy;
  }

  tree.separation = function(x) {
    return arguments.length ? (separation = x, tree) : separation;
  };

  tree.size = function(x) {
    return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);
  };

  tree.nodeSize = function(x) {
    return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);
  };

  return tree;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/cluster.js
function cluster_defaultSeparation(a, b) {
  return a.parent === b.parent ? 1 : 2;
}

function meanX(children) {
  return children.reduce(meanXReduce, 0) / children.length;
}

function meanXReduce(x, c) {
  return x + c.x;
}

function maxY(children) {
  return 1 + children.reduce(maxYReduce, 0);
}

function maxYReduce(y, c) {
  return Math.max(y, c.y);
}

function leafLeft(node) {
  var children;
  while (children = node.children) node = children[0];
  return node;
}

function leafRight(node) {
  var children;
  while (children = node.children) node = children[children.length - 1];
  return node;
}

/* harmony default export */ var cluster = (function() {
  var separation = cluster_defaultSeparation,
      dx = 1,
      dy = 1,
      nodeSize = false;

  function cluster(root) {
    var previousNode,
        x = 0;

    // First walk, computing the initial x & y values.
    root.eachAfter(function(node) {
      var children = node.children;
      if (children) {
        node.x = meanX(children);
        node.y = maxY(children);
      } else {
        node.x = previousNode ? x += separation(node, previousNode) : 0;
        node.y = 0;
        previousNode = node;
      }
    });

    var left = leafLeft(root),
        right = leafRight(root),
        x0 = left.x - separation(left, right) / 2,
        x1 = right.x + separation(right, left) / 2;

    // Second walk, normalizing x & y to the desired size.
    return root.eachAfter(nodeSize ? function(node) {
      node.x = (node.x - root.x) * dx;
      node.y = (root.y - node.y) * dy;
    } : function(node) {
      node.x = (node.x - x0) / (x1 - x0) * dx;
      node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;
    });
  }

  cluster.separation = function(x) {
    return arguments.length ? (separation = x, cluster) : separation;
  };

  cluster.size = function(x) {
    return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]);
  };

  cluster.nodeSize = function(x) {
    return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null);
  };

  return cluster;
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/binary.js
/* harmony default export */ var binary = (function(parent, x0, y0, x1, y1) {
  var nodes = parent.children,
      i, n = nodes.length,
      sum, sums = new Array(n + 1);

  for (sums[0] = sum = i = 0; i < n; ++i) {
    sums[i + 1] = sum += nodes[i].value;
  }

  partition(0, n, parent.value, x0, y0, x1, y1);

  function partition(i, j, value, x0, y0, x1, y1) {
    if (i >= j - 1) {
      var node = nodes[i];
      node.x0 = x0, node.y0 = y0;
      node.x1 = x1, node.y1 = y1;
      return;
    }

    var valueOffset = sums[i],
        valueTarget = (value / 2) + valueOffset,
        k = i + 1,
        hi = j - 1;

    while (k < hi) {
      var mid = k + hi >>> 1;
      if (sums[mid] < valueTarget) k = mid + 1;
      else hi = mid;
    }

    if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k;

    var valueLeft = sums[k] - valueOffset,
        valueRight = value - valueLeft;

    if ((x1 - x0) > (y1 - y0)) {
      var xk = value ? (x0 * valueRight + x1 * valueLeft) / value : x1;
      partition(i, k, valueLeft, x0, y0, xk, y1);
      partition(k, j, valueRight, xk, y0, x1, y1);
    } else {
      var yk = value ? (y0 * valueRight + y1 * valueLeft) / value : y1;
      partition(i, k, valueLeft, x0, y0, x1, yk);
      partition(k, j, valueRight, x0, yk, x1, y1);
    }
  }
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/slice.js
/* harmony default export */ var treemap_slice = (function(parent, x0, y0, x1, y1) {
  var nodes = parent.children,
      node,
      i = -1,
      n = nodes.length,
      k = parent.value && (y1 - y0) / parent.value;

  while (++i < n) {
    node = nodes[i], node.x0 = x0, node.x1 = x1;
    node.y0 = y0, node.y1 = y0 += node.value * k;
  }
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/sliceDice.js



/* harmony default export */ var sliceDice = (function(parent, x0, y0, x1, y1) {
  (parent.depth & 1 ? treemap_slice : dice)(parent, x0, y0, x1, y1);
});

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/squarify.js



var squarify_phi = (1 + Math.sqrt(5)) / 2;

function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
  var rows = [],
      nodes = parent.children,
      row,
      nodeValue,
      i0 = 0,
      i1 = 0,
      n = nodes.length,
      dx, dy,
      value = parent.value,
      sumValue,
      minValue,
      maxValue,
      newRatio,
      minRatio,
      alpha,
      beta;

  while (i0 < n) {
    dx = x1 - x0, dy = y1 - y0;

    // Find the next non-empty node.
    do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);
    minValue = maxValue = sumValue;
    alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
    beta = sumValue * sumValue * alpha;
    minRatio = Math.max(maxValue / beta, beta / minValue);

    // Keep adding nodes while the aspect ratio maintains or improves.
    for (; i1 < n; ++i1) {
      sumValue += nodeValue = nodes[i1].value;
      if (nodeValue < minValue) minValue = nodeValue;
      if (nodeValue > maxValue) maxValue = nodeValue;
      beta = sumValue * sumValue * alpha;
      newRatio = Math.max(maxValue / beta, beta / minValue);
      if (newRatio > minRatio) { sumValue -= nodeValue; break; }
      minRatio = newRatio;
    }

    // Position and record the row orientation.
    rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});
    if (row.dice) dice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
    else treemap_slice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
    value -= sumValue, i0 = i1;
  }

  return rows;
}

/* harmony default export */ var squarify = ((function custom(ratio) {

  function squarify(parent, x0, y0, x1, y1) {
    squarifyRatio(ratio, parent, x0, y0, x1, y1);
  }

  squarify.ratio = function(x) {
    return custom((x = +x) > 1 ? x : 1);
  };

  return squarify;
})(squarify_phi));

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/resquarify.js




/* harmony default export */ var treemap_resquarify = ((function custom(ratio) {

  function resquarify(parent, x0, y0, x1, y1) {
    if ((rows = parent._squarify) && (rows.ratio === ratio)) {
      var rows,
          row,
          nodes,
          i,
          j = -1,
          n,
          m = rows.length,
          value = parent.value;

      while (++j < m) {
        row = rows[j], nodes = row.children;
        for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;
        if (row.dice) dice(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1);
        else treemap_slice(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1);
        value -= row.value;
      }
    } else {
      parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);
      rows.ratio = ratio;
    }
  }

  resquarify.ratio = function(x) {
    return custom((x = +x) > 1 ? x : 1);
  };

  return resquarify;
})(squarify_phi));

// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/index.js





/* harmony default export */ var src_treemap = (function() {
  var tile = squarify,
      round = false,
      dx = 1,
      dy = 1,
      paddingStack = [0],
      paddingInner = constantZero,
      paddingTop = constantZero,
      paddingRight = constantZero,
      paddingBottom = constantZero,
      paddingLeft = constantZero;

  function treemap(root) {
    root.x0 =
    root.y0 = 0;
    root.x1 = dx;
    root.y1 = dy;
    root.eachBefore(positionNode);
    paddingStack = [0];
    if (round) root.eachBefore(treemap_round);
    return root;
  }

  function positionNode(node) {
    var p = paddingStack[node.depth],
        x0 = node.x0 + p,
        y0 = node.y0 + p,
        x1 = node.x1 - p,
        y1 = node.y1 - p;
    if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
    if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
    node.x0 = x0;
    node.y0 = y0;
    node.x1 = x1;
    node.y1 = y1;
    if (node.children) {
      p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
      x0 += paddingLeft(node) - p;
      y0 += paddingTop(node) - p;
      x1 -= paddingRight(node) - p;
      y1 -= paddingBottom(node) - p;
      if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
      if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
      tile(node, x0, y0, x1, y1);
    }
  }

  treemap.round = function(x) {
    return arguments.length ? (round = !!x, treemap) : round;
  };

  treemap.size = function(x) {
    return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];
  };

  treemap.tile = function(x) {
    return arguments.length ? (tile = required(x), treemap) : tile;
  };

  treemap.padding = function(x) {
    return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
  };

  treemap.paddingInner = function(x) {
    return arguments.length ? (paddingInner = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingInner;
  };

  treemap.paddingOuter = function(x) {
    return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
  };

  treemap.paddingTop = function(x) {
    return arguments.length ? (paddingTop = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingTop;
  };

  treemap.paddingRight = function(x) {
    return arguments.length ? (paddingRight = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingRight;
  };

  treemap.paddingBottom = function(x) {
    return arguments.length ? (paddingBottom = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingBottom;
  };

  treemap.paddingLeft = function(x) {
    return arguments.length ? (paddingLeft = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingLeft;
  };

  return treemap;
});

// CONCATENATED MODULE: ./node_modules/vega-hierarchy/build/vega-hierarchy.module.js




// Build lookup table mapping tuple keys to tree node instances
function vega_hierarchy_module_lookup (tree, key, filter) {
  const map = {};
  tree.each(node => {
    const t = node.data;
    if (filter(t)) map[key(t)] = node;
  });
  tree.lookup = map;
  return tree;
}

/**
 * Nest tuples into a tree structure, grouped by key values.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<function(object): *>} params.keys - The key fields to nest by, in order.
 * @param {boolean} [params.generate=false] - A boolean flag indicating if
 *   non-leaf nodes generated by this transform should be included in the
 *   output. The default (false) includes only the input data (leaf nodes)
 *   in the data stream.
 */

function Nest(params) {
  Transform.call(this, null, params);
}
Nest.Definition = {
  'type': 'Nest',
  'metadata': {
    'treesource': true,
    'changes': true
  },
  'params': [{
    'name': 'keys',
    'type': 'field',
    'array': true
  }, {
    'name': 'generate',
    'type': 'boolean'
  }]
};

const vega_hierarchy_module_children = n => n.values;

Object(vega_util_module["z" /* inherits */])(Nest, Transform, {
  transform(_, pulse) {
    if (!pulse.source) {
      Object(vega_util_module["o" /* error */])('Nest transform requires an upstream data source.');
    }

    var gen = _.generate,
        mod = _.modified(),
        out = pulse.clone(),
        tree = this.value;

    if (!tree || mod || pulse.changed()) {
      // collect nodes to remove
      if (tree) {
        tree.each(node => {
          if (node.children && isTuple(node.data)) {
            out.rem.push(node.data);
          }
        });
      } // generate new tree structure


      this.value = tree = hierarchy({
        values: Object(vega_util_module["i" /* array */])(_.keys).reduce((n, k) => {
          n.key(k);
          return n;
        }, nest()).entries(out.source)
      }, vega_hierarchy_module_children); // collect nodes to add

      if (gen) {
        tree.each(node => {
          if (node.children) {
            node = ingest$1(node.data);
            out.add.push(node);
            out.source.push(node);
          }
        });
      } // build lookup table


      vega_hierarchy_module_lookup(tree, tupleid, tupleid);
    }

    out.source.root = tree;
    return out;
  }

});

function nest() {
  const keys = [],
        nest = {
    entries: array => entries(apply(array, 0), 0),
    key: d => (keys.push(d), nest)
  };

  function apply(array, depth) {
    if (depth >= keys.length) {
      return array;
    }

    const n = array.length,
          key = keys[depth++],
          valuesByKey = {},
          result = {};
    let i = -1,
        keyValue,
        value,
        values;

    while (++i < n) {
      keyValue = key(value = array[i]) + '';

      if (values = valuesByKey[keyValue]) {
        values.push(value);
      } else {
        valuesByKey[keyValue] = [value];
      }
    }

    for (keyValue in valuesByKey) {
      result[keyValue] = apply(valuesByKey[keyValue], depth);
    }

    return result;
  }

  function entries(map, depth) {
    if (++depth > keys.length) return map;
    const array = [];

    for (const key in map) {
      array.push({
        key,
        values: entries(map[key], depth)
      });
    }

    return array;
  }

  return nest;
}

/**
 * Abstract class for tree layout.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */

function HierarchyLayout(params) {
  Transform.call(this, null, params);
}

const vega_hierarchy_module_defaultSeparation = (a, b) => a.parent === b.parent ? 1 : 2;

Object(vega_util_module["z" /* inherits */])(HierarchyLayout, Transform, {
  transform(_, pulse) {
    if (!pulse.source || !pulse.source.root) {
      Object(vega_util_module["o" /* error */])(this.constructor.name + ' transform requires a backing tree data source.');
    }

    const layout = this.layout(_.method),
          fields = this.fields,
          root = pulse.source.root,
          as = _.as || fields;
    if (_.field) root.sum(_.field);else root.count();
    if (_.sort) root.sort(stableCompare(_.sort, d => d.data));
    setParams(layout, this.params, _);

    if (layout.separation) {
      layout.separation(_.separation !== false ? vega_hierarchy_module_defaultSeparation : vega_util_module["Q" /* one */]);
    }

    try {
      this.value = layout(root);
    } catch (err) {
      Object(vega_util_module["o" /* error */])(err);
    }

    root.each(node => setFields(node, fields, as));
    return pulse.reflow(_.modified()).modifies(as).modifies('leaf');
  }

});

function setParams(layout, params, _) {
  for (let p, i = 0, n = params.length; i < n; ++i) {
    p = params[i];
    if (p in _) layout[p](_[p]);
  }
}

function setFields(node, fields, as) {
  const t = node.data,
        n = fields.length - 1;

  for (let i = 0; i < n; ++i) {
    t[as[i]] = node[fields[i]];
  }

  t[as[n]] = node.children ? node.children.length : 0;
}

const vega_hierarchy_module_Output = ['x', 'y', 'r', 'depth', 'children'];
/**
 * Packed circle tree layout.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The value field to size nodes.
 */

function Pack(params) {
  HierarchyLayout.call(this, params);
}
Pack.Definition = {
  'type': 'Pack',
  'metadata': {
    'tree': true,
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field'
  }, {
    'name': 'sort',
    'type': 'compare'
  }, {
    'name': 'padding',
    'type': 'number',
    'default': 0
  }, {
    'name': 'radius',
    'type': 'field',
    'default': null
  }, {
    'name': 'size',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': vega_hierarchy_module_Output.length,
    'default': vega_hierarchy_module_Output
  }]
};
Object(vega_util_module["z" /* inherits */])(Pack, HierarchyLayout, {
  layout: src_pack,
  params: ['radius', 'size', 'padding'],
  fields: vega_hierarchy_module_Output
});

const Output$1 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];
/**
 * Partition tree layout.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The value field to size nodes.
 */

function Partition(params) {
  HierarchyLayout.call(this, params);
}
Partition.Definition = {
  'type': 'Partition',
  'metadata': {
    'tree': true,
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field'
  }, {
    'name': 'sort',
    'type': 'compare'
  }, {
    'name': 'padding',
    'type': 'number',
    'default': 0
  }, {
    'name': 'round',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'size',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': Output$1.length,
    'default': Output$1
  }]
};
Object(vega_util_module["z" /* inherits */])(Partition, HierarchyLayout, {
  layout: src_partition,
  params: ['size', 'round', 'padding'],
  fields: Output$1
});

/**
 * Stratify a collection of tuples into a tree structure based on
 * id and parent id fields.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.key - Unique key field for each tuple.
 * @param {function(object): *} params.parentKey - Field with key for parent tuple.
 */

function Stratify(params) {
  Transform.call(this, null, params);
}
Stratify.Definition = {
  'type': 'Stratify',
  'metadata': {
    'treesource': true
  },
  'params': [{
    'name': 'key',
    'type': 'field',
    'required': true
  }, {
    'name': 'parentKey',
    'type': 'field',
    'required': true
  }]
};
Object(vega_util_module["z" /* inherits */])(Stratify, Transform, {
  transform(_, pulse) {
    if (!pulse.source) {
      Object(vega_util_module["o" /* error */])('Stratify transform requires an upstream data source.');
    }

    let tree = this.value;

    const mod = _.modified(),
          out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE),
          run = !tree || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields); // prevent upstream source pollution


    out.source = out.source.slice();

    if (run) {
      tree = out.source.length ? vega_hierarchy_module_lookup(src_stratify().id(_.key).parentId(_.parentKey)(out.source), _.key, vega_util_module["ib" /* truthy */]) : vega_hierarchy_module_lookup(src_stratify()([{}]), _.key, _.key);
    }

    out.source.root = this.value = tree;
    return out;
  }

});

const Layouts = {
  tidy: src_tree,
  cluster: cluster
};
const Output$2 = ['x', 'y', 'depth', 'children'];
/**
 * Tree layout. Depending on the method parameter, performs either
 * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */

function Tree(params) {
  HierarchyLayout.call(this, params);
}
Tree.Definition = {
  'type': 'Tree',
  'metadata': {
    'tree': true,
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field'
  }, {
    'name': 'sort',
    'type': 'compare'
  }, {
    'name': 'method',
    'type': 'enum',
    'default': 'tidy',
    'values': ['tidy', 'cluster']
  }, {
    'name': 'size',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'nodeSize',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'separation',
    'type': 'boolean',
    'default': true
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': Output$2.length,
    'default': Output$2
  }]
};
Object(vega_util_module["z" /* inherits */])(Tree, HierarchyLayout, {
  /**
   * Tree layout generator. Supports both 'tidy' and 'cluster' layouts.
   */
  layout(method) {
    const m = method || 'tidy';
    if (Object(vega_util_module["w" /* hasOwnProperty */])(Layouts, m)) return Layouts[m]();else Object(vega_util_module["o" /* error */])('Unrecognized Tree layout method: ' + m);
  },

  params: ['size', 'nodeSize'],
  fields: Output$2
});

/**
 * Generate tuples representing links between tree nodes.
 * The resulting tuples will contain 'source' and 'target' fields,
 * which point to parent and child node tuples, respectively.
 * @constructor
 * @param {object} params - The parameters for this operator.
 */

function TreeLinks(params) {
  Transform.call(this, [], params);
}
TreeLinks.Definition = {
  'type': 'TreeLinks',
  'metadata': {
    'tree': true,
    'generates': true,
    'changes': true
  },
  'params': []
};
Object(vega_util_module["z" /* inherits */])(TreeLinks, Transform, {
  transform(_, pulse) {
    const links = this.value,
          tree = pulse.source && pulse.source.root,
          out = pulse.fork(pulse.NO_SOURCE),
          lut = {};
    if (!tree) Object(vega_util_module["o" /* error */])('TreeLinks transform requires a tree data source.');

    if (pulse.changed(pulse.ADD_REM)) {
      // remove previous links
      out.rem = links; // build lookup table of valid tuples

      pulse.visit(pulse.SOURCE, t => lut[tupleid(t)] = 1); // generate links for all edges incident on valid tuples

      tree.each(node => {
        const t = node.data,
              p = node.parent && node.parent.data;

        if (p && lut[tupleid(t)] && lut[tupleid(p)]) {
          out.add.push(ingest$1({
            source: p,
            target: t
          }));
        }
      });
      this.value = out.add;
    } else if (pulse.changed(pulse.MOD)) {
      // build lookup table of modified tuples
      pulse.visit(pulse.MOD, t => lut[tupleid(t)] = 1); // gather links incident on modified tuples

      links.forEach(link => {
        if (lut[tupleid(link.source)] || lut[tupleid(link.target)]) {
          out.mod.push(link);
        }
      });
    }

    return out;
  }

});

const Tiles = {
  binary: binary,
  dice: dice,
  slice: treemap_slice,
  slicedice: sliceDice,
  squarify: squarify,
  resquarify: treemap_resquarify
};
const Output$3 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];
/**
 * Treemap layout.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.field - The value field to size nodes.
 */

function Treemap(params) {
  HierarchyLayout.call(this, params);
}
Treemap.Definition = {
  'type': 'Treemap',
  'metadata': {
    'tree': true,
    'modifies': true
  },
  'params': [{
    'name': 'field',
    'type': 'field'
  }, {
    'name': 'sort',
    'type': 'compare'
  }, {
    'name': 'method',
    'type': 'enum',
    'default': 'squarify',
    'values': ['squarify', 'resquarify', 'binary', 'dice', 'slice', 'slicedice']
  }, {
    'name': 'padding',
    'type': 'number',
    'default': 0
  }, {
    'name': 'paddingInner',
    'type': 'number',
    'default': 0
  }, {
    'name': 'paddingOuter',
    'type': 'number',
    'default': 0
  }, {
    'name': 'paddingTop',
    'type': 'number',
    'default': 0
  }, {
    'name': 'paddingRight',
    'type': 'number',
    'default': 0
  }, {
    'name': 'paddingBottom',
    'type': 'number',
    'default': 0
  }, {
    'name': 'paddingLeft',
    'type': 'number',
    'default': 0
  }, {
    'name': 'ratio',
    'type': 'number',
    'default': 1.618033988749895
  }, {
    'name': 'round',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'size',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': Output$3.length,
    'default': Output$3
  }]
};
Object(vega_util_module["z" /* inherits */])(Treemap, HierarchyLayout, {
  /**
   * Treemap layout generator. Adds 'method' and 'ratio' parameters
   * to configure the underlying tile method.
   */
  layout() {
    const x = src_treemap();

    x.ratio = _ => {
      const t = x.tile();
      if (t.ratio) x.tile(t.ratio(_));
    };

    x.method = _ => {
      if (Object(vega_util_module["w" /* hasOwnProperty */])(Tiles, _)) x.tile(Tiles[_]);else Object(vega_util_module["o" /* error */])('Unrecognized Treemap layout method: ' + _);
    };

    return x;
  },

  params: ['method', 'ratio', 'size', 'round', 'padding', 'paddingInner', 'paddingOuter', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],
  fields: Output$3
});



// CONCATENATED MODULE: ./node_modules/vega-label/build/vega-label.module.js





const ALPHA_MASK = 0xff000000; // alpha value equivalent to opacity 0.0625

const INSIDE_OPACITY_IN_ALPHA = 0x10000000;
const INSIDE_OPACITY = 0.0625;
function baseBitmaps($, data) {
  const bitmap = $.bitmap(); // when there is no base mark but data points are to be avoided

  (data || []).forEach(d => bitmap.set($(d.boundary[0]), $(d.boundary[3])));
  return [bitmap, undefined];
}
function markBitmaps($, avoidMarks, labelInside, isGroupArea) {
  // create canvas
  const width = $.width,
        height = $.height,
        border = labelInside || isGroupArea,
        context = domCanvas(width, height).getContext('2d'); // render all marks to be avoided into canvas

  avoidMarks.forEach(items => vega_label_module_draw(context, items, border)); // get canvas buffer, create bitmaps

  const buffer = new Uint32Array(context.getImageData(0, 0, width, height).data.buffer),
        layer1 = $.bitmap(),
        layer2 = border && $.bitmap(); // populate bitmap layers

  let x, y, u, v, alpha;

  for (y = 0; y < height; ++y) {
    for (x = 0; x < width; ++x) {
      alpha = buffer[y * width + x] & ALPHA_MASK;

      if (alpha) {
        u = $(x);
        v = $(y);
        if (!isGroupArea) layer1.set(u, v); // update interior bitmap

        if (border && alpha ^ INSIDE_OPACITY_IN_ALPHA) layer2.set(u, v); // update border bitmap
      }
    }
  }

  return [layer1, layer2];
}

function vega_label_module_draw(context, items, interior) {
  if (!items.length) return;
  const type = items[0].mark.marktype;

  if (type === 'group') {
    items.forEach(group => {
      group.items.forEach(mark => vega_label_module_draw(context, mark.items, interior));
    });
  } else {
    Marks[type].draw(context, {
      items: interior ? items.map(vega_label_module_prepare) : items
    });
  }
}
/**
 * Prepare item before drawing into canvas (setting stroke and opacity)
 * @param {object} source item to be prepared
 * @returns prepared item
 */


function vega_label_module_prepare(source) {
  const item = rederive(source, {});

  if (item.stroke) {
    item.strokeOpacity = 1;
  }

  if (item.fill) {
    item.fillOpacity = INSIDE_OPACITY;
    item.stroke = '#000';
    item.strokeOpacity = 1;
    item.strokeWidth = 2;
  }

  return item;
}

const DIV = 5,
      // bit shift from x, y index to bit vector array index
vega_label_module_MOD = 31,
      // bit mask for index lookup within a bit vector
SIZE = 32,
      // individual bit vector size
RIGHT0 = new Uint32Array(SIZE + 1),
      // left-anchored bit vectors, full -> 0
RIGHT1 = new Uint32Array(SIZE + 1); // right-anchored bit vectors, 0 -> full

RIGHT1[0] = 0;
RIGHT0[0] = ~RIGHT1[0];

for (let i = 1; i <= SIZE; ++i) {
  RIGHT1[i] = RIGHT1[i - 1] << 1 | 1;
  RIGHT0[i] = ~RIGHT1[i];
}

function Bitmap (w, h) {
  const array = new Uint32Array(~~((w * h + SIZE) / SIZE));

  function _set(index, mask) {
    array[index] |= mask;
  }

  function _clear(index, mask) {
    array[index] &= mask;
  }

  return {
    array: array,
    get: (x, y) => {
      const index = y * w + x;
      return array[index >>> DIV] & 1 << (index & vega_label_module_MOD);
    },
    set: (x, y) => {
      const index = y * w + x;

      _set(index >>> DIV, 1 << (index & vega_label_module_MOD));
    },
    clear: (x, y) => {
      const index = y * w + x;

      _clear(index >>> DIV, ~(1 << (index & vega_label_module_MOD)));
    },
    getRange: (x, y, x2, y2) => {
      let r = y2,
          start,
          end,
          indexStart,
          indexEnd;

      for (; r >= y; --r) {
        start = r * w + x;
        end = r * w + x2;
        indexStart = start >>> DIV;
        indexEnd = end >>> DIV;

        if (indexStart === indexEnd) {
          if (array[indexStart] & RIGHT0[start & vega_label_module_MOD] & RIGHT1[(end & vega_label_module_MOD) + 1]) {
            return true;
          }
        } else {
          if (array[indexStart] & RIGHT0[start & vega_label_module_MOD]) return true;
          if (array[indexEnd] & RIGHT1[(end & vega_label_module_MOD) + 1]) return true;

          for (let i = indexStart + 1; i < indexEnd; ++i) {
            if (array[i]) return true;
          }
        }
      }

      return false;
    },
    setRange: (x, y, x2, y2) => {
      let start, end, indexStart, indexEnd, i;

      for (; y <= y2; ++y) {
        start = y * w + x;
        end = y * w + x2;
        indexStart = start >>> DIV;
        indexEnd = end >>> DIV;

        if (indexStart === indexEnd) {
          _set(indexStart, RIGHT0[start & vega_label_module_MOD] & RIGHT1[(end & vega_label_module_MOD) + 1]);
        } else {
          _set(indexStart, RIGHT0[start & vega_label_module_MOD]);

          _set(indexEnd, RIGHT1[(end & vega_label_module_MOD) + 1]);

          for (i = indexStart + 1; i < indexEnd; ++i) _set(i, 0xffffffff);
        }
      }
    },
    clearRange: (x, y, x2, y2) => {
      let start, end, indexStart, indexEnd, i;

      for (; y <= y2; ++y) {
        start = y * w + x;
        end = y * w + x2;
        indexStart = start >>> DIV;
        indexEnd = end >>> DIV;

        if (indexStart === indexEnd) {
          _clear(indexStart, RIGHT1[start & vega_label_module_MOD] | RIGHT0[(end & vega_label_module_MOD) + 1]);
        } else {
          _clear(indexStart, RIGHT1[start & vega_label_module_MOD]);

          _clear(indexEnd, RIGHT0[(end & vega_label_module_MOD) + 1]);

          for (i = indexStart + 1; i < indexEnd; ++i) _clear(i, 0);
        }
      }
    },
    outOfBounds: (x, y, x2, y2) => x < 0 || y < 0 || y2 >= h || x2 >= w
  };
}

function scaler (width, height, padding) {
  const ratio = Math.max(1, Math.sqrt(width * height / 1e6)),
        w = ~~((width + 2 * padding + ratio) / ratio),
        h = ~~((height + 2 * padding + ratio) / ratio),
        scale = _ => ~~((_ + padding) / ratio);

  scale.invert = _ => _ * ratio - padding;

  scale.bitmap = () => Bitmap(w, h);

  scale.ratio = ratio;
  scale.padding = padding;
  scale.width = width;
  scale.height = height;
  return scale;
}

function placeAreaLabelNaive ($, bitmaps, avoidBaseMark, markIndex) {
  const width = $.width,
        height = $.height; // try to place a label within an input area mark

  return function (d) {
    const items = d.datum.datum.items[markIndex].items,
          // area points
    n = items.length,
          // number of points
    textHeight = d.datum.fontSize,
          // label width
    textWidth = textMetrics.width(d.datum, d.datum.text); // label height

    let maxAreaWidth = 0,
        x1,
        x2,
        y1,
        y2,
        x,
        y,
        areaWidth; // for each area sample point

    for (let i = 0; i < n; ++i) {
      x1 = items[i].x;
      y1 = items[i].y;
      x2 = items[i].x2 === undefined ? x1 : items[i].x2;
      y2 = items[i].y2 === undefined ? y1 : items[i].y2;
      x = (x1 + x2) / 2;
      y = (y1 + y2) / 2;
      areaWidth = Math.abs(x2 - x1 + y2 - y1);

      if (areaWidth >= maxAreaWidth) {
        maxAreaWidth = areaWidth;
        d.x = x;
        d.y = y;
      }
    }

    x = textWidth / 2;
    y = textHeight / 2;
    x1 = d.x - x;
    x2 = d.x + x;
    y1 = d.y - y;
    y2 = d.y + y;
    d.align = 'center';

    if (x1 < 0 && x2 <= width) {
      d.align = 'left';
    } else if (0 <= x1 && width < x2) {
      d.align = 'right';
    }

    d.baseline = 'middle';

    if (y1 < 0 && y2 <= height) {
      d.baseline = 'top';
    } else if (0 <= y1 && height < y2) {
      d.baseline = 'bottom';
    }

    return true;
  };
}

function outOfBounds(x, y, textWidth, textHeight, width, height) {
  let r = textWidth / 2;
  return x - r < 0 || x + r > width || y - (r = textHeight / 2) < 0 || y + r > height;
}
function collision($, x, y, textHeight, textWidth, h, bm0, bm1) {
  const w = textWidth * h / (textHeight * 2),
        x1 = $(x - w),
        x2 = $(x + w),
        y1 = $(y - (h = h / 2)),
        y2 = $(y + h);
  return bm0.outOfBounds(x1, y1, x2, y2) || bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2);
}

function placeAreaLabelReducedSearch ($, bitmaps, avoidBaseMark, markIndex) {
  const width = $.width,
        height = $.height,
        bm0 = bitmaps[0],
        // where labels have been placed
  bm1 = bitmaps[1]; // area outlines

  function tryLabel(_x, _y, maxSize, textWidth, textHeight) {
    const x = $.invert(_x),
          y = $.invert(_y);
    let lo = maxSize,
        hi = height,
        mid;

    if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {
      // if the label fits at the current sample point,
      // perform binary search to find the largest font size that fits
      while (hi - lo >= 1) {
        mid = (lo + hi) / 2;

        if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) {
          hi = mid;
        } else {
          lo = mid;
        }
      } // place label if current lower bound exceeds prior max font size


      if (lo > maxSize) {
        return [x, y, lo, true];
      }
    }
  } // try to place a label within an input area mark


  return function (d) {
    const items = d.datum.datum.items[markIndex].items,
          // area points
    n = items.length,
          // number of points
    textHeight = d.datum.fontSize,
          // label width
    textWidth = textMetrics.width(d.datum, d.datum.text); // label height

    let maxSize = avoidBaseMark ? textHeight : 0,
        labelPlaced = false,
        labelPlaced2 = false,
        maxAreaWidth = 0,
        x1,
        x2,
        y1,
        y2,
        x,
        y,
        _x,
        _y,
        _x1,
        _xMid,
        _x2,
        _y1,
        _yMid,
        _y2,
        areaWidth,
        result,
        swapTmp; // for each area sample point


    for (let i = 0; i < n; ++i) {
      x1 = items[i].x;
      y1 = items[i].y;
      x2 = items[i].x2 === undefined ? x1 : items[i].x2;
      y2 = items[i].y2 === undefined ? y1 : items[i].y2;

      if (x1 > x2) {
        swapTmp = x1;
        x1 = x2;
        x2 = swapTmp;
      }

      if (y1 > y2) {
        swapTmp = y1;
        y1 = y2;
        y2 = swapTmp;
      }

      _x1 = $(x1);
      _x2 = $(x2);
      _xMid = ~~((_x1 + _x2) / 2);
      _y1 = $(y1);
      _y2 = $(y2);
      _yMid = ~~((_y1 + _y2) / 2); // search along the line from mid point between the 2 border to lower border

      for (_x = _xMid; _x >= _x1; --_x) {
        for (_y = _yMid; _y >= _y1; --_y) {
          result = tryLabel(_x, _y, maxSize, textWidth, textHeight);

          if (result) {
            [d.x, d.y, maxSize, labelPlaced] = result;
          }
        }
      } // search along the line from mid point between the 2 border to upper border


      for (_x = _xMid; _x <= _x2; ++_x) {
        for (_y = _yMid; _y <= _y2; ++_y) {
          result = tryLabel(_x, _y, maxSize, textWidth, textHeight);

          if (result) {
            [d.x, d.y, maxSize, labelPlaced] = result;
          }
        }
      } // place label at slice center if not placed through other means
      // and if we're not avoiding overlap with other areas


      if (!labelPlaced && !avoidBaseMark) {
        // one span is zero, hence we can add
        areaWidth = Math.abs(x2 - x1 + y2 - y1);
        x = (x1 + x2) / 2;
        y = (y1 + y2) / 2; // place label if it fits and improves the max area width

        if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {
          maxAreaWidth = areaWidth;
          d.x = x;
          d.y = y;
          labelPlaced2 = true;
        }
      }
    } // record current label placement information, update label bitmap


    if (labelPlaced || labelPlaced2) {
      x = textWidth / 2;
      y = textHeight / 2;
      bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y));
      d.align = 'center';
      d.baseline = 'middle';
      return true;
    } else {
      return false;
    }
  };
}

const X_DIR = [-1, -1, 1, 1];
const Y_DIR = [-1, 1, -1, 1];
function placeAreaLabelFloodFill ($, bitmaps, avoidBaseMark, markIndex) {
  const width = $.width,
        height = $.height,
        bm0 = bitmaps[0],
        // where labels have been placed
  bm1 = bitmaps[1],
        // area outlines
  bm2 = $.bitmap(); // flood-fill visitations
  // try to place a label within an input area mark

  return function (d) {
    const items = d.datum.datum.items[markIndex].items,
          // area points
    n = items.length,
          // number of points
    textHeight = d.datum.fontSize,
          // label width
    textWidth = textMetrics.width(d.datum, d.datum.text),
          // label height
    stack = []; // flood fill stack

    let maxSize = avoidBaseMark ? textHeight : 0,
        labelPlaced = false,
        labelPlaced2 = false,
        maxAreaWidth = 0,
        x1,
        x2,
        y1,
        y2,
        x,
        y,
        _x,
        _y,
        lo,
        hi,
        mid,
        areaWidth; // for each area sample point


    for (let i = 0; i < n; ++i) {
      x1 = items[i].x;
      y1 = items[i].y;
      x2 = items[i].x2 === undefined ? x1 : items[i].x2;
      y2 = items[i].y2 === undefined ? y1 : items[i].y2; // add scaled center point to stack

      stack.push([$((x1 + x2) / 2), $((y1 + y2) / 2)]); // perform flood fill, visit points

      while (stack.length) {
        [_x, _y] = stack.pop(); // exit if point already marked

        if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue; // mark point in flood fill bitmap
        // add search points for all (in bound) directions

        bm2.set(_x, _y);

        for (let j = 0; j < 4; ++j) {
          x = _x + X_DIR[j];
          y = _y + Y_DIR[j];
          if (!bm2.outOfBounds(x, y, x, y)) stack.push([x, y]);
        } // unscale point back to x, y space


        x = $.invert(_x);
        y = $.invert(_y);
        lo = maxSize;
        hi = height; // TODO: make this bound smaller

        if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {
          // if the label fits at the current sample point,
          // perform binary search to find the largest font size that fits
          while (hi - lo >= 1) {
            mid = (lo + hi) / 2;

            if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) {
              hi = mid;
            } else {
              lo = mid;
            }
          } // place label if current lower bound exceeds prior max font size


          if (lo > maxSize) {
            d.x = x;
            d.y = y;
            maxSize = lo;
            labelPlaced = true;
          }
        }
      } // place label at slice center if not placed through other means
      // and if we're not avoiding overlap with other areas


      if (!labelPlaced && !avoidBaseMark) {
        // one span is zero, hence we can add
        areaWidth = Math.abs(x2 - x1 + y2 - y1);
        x = (x1 + x2) / 2;
        y = (y1 + y2) / 2; // place label if it fits and improves the max area width

        if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) {
          maxAreaWidth = areaWidth;
          d.x = x;
          d.y = y;
          labelPlaced2 = true;
        }
      }
    } // record current label placement information, update label bitmap


    if (labelPlaced || labelPlaced2) {
      x = textWidth / 2;
      y = textHeight / 2;
      bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y));
      d.align = 'center';
      d.baseline = 'middle';
      return true;
    } else {
      return false;
    }
  };
}

const Aligns = ['right', 'center', 'left'],
      Baselines = ['bottom', 'middle', 'top'];
function placeMarkLabel ($, bitmaps, anchors, offsets) {
  const width = $.width,
        height = $.height,
        bm0 = bitmaps[0],
        bm1 = bitmaps[1],
        n = offsets.length;
  return function (d) {
    const boundary = d.boundary,
          textHeight = d.datum.fontSize; // can not be placed if the mark is not visible in the graph bound

    if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height) {
      return false;
    }

    let textWidth = 0,
        dx,
        dy,
        isInside,
        sizeFactor,
        insideFactor,
        x1,
        x2,
        y1,
        y2,
        xc,
        yc,
        _x1,
        _x2,
        _y1,
        _y2; // for each anchor and offset


    for (let i = 0; i < n; ++i) {
      dx = (anchors[i] & 0x3) - 1;
      dy = (anchors[i] >>> 0x2 & 0x3) - 1;
      isInside = dx === 0 && dy === 0 || offsets[i] < 0;
      sizeFactor = dx && dy ? Math.SQRT1_2 : 1;
      insideFactor = offsets[i] < 0 ? -1 : 1;
      x1 = boundary[1 + dx] + offsets[i] * dx * sizeFactor;
      yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets[i] * dy * sizeFactor;
      y1 = yc - textHeight / 2;
      y2 = yc + textHeight / 2;
      _x1 = $(x1);
      _y1 = $(y1);
      _y2 = $(y2);

      if (!textWidth) {
        // to avoid finding width of text label,
        if (!vega_label_module_test(_x1, _x1, _y1, _y2, bm0, bm1, x1, x1, y1, y2, boundary, isInside)) {
          // skip this anchor/offset option if we fail to place a label with 1px width
          continue;
        } else {
          // Otherwise, find the label width
          textWidth = textMetrics.width(d.datum, d.datum.text);
        }
      }

      xc = x1 + insideFactor * textWidth * dx / 2;
      x1 = xc - textWidth / 2;
      x2 = xc + textWidth / 2;
      _x1 = $(x1);
      _x2 = $(x2);

      if (vega_label_module_test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside)) {
        // place label if the position is placeable
        d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x1;
        d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y1;
        d.align = Aligns[dx * insideFactor + 1];
        d.baseline = Baselines[dy * insideFactor + 1];
        bm0.setRange(_x1, _y1, _x2, _y2);
        return true;
      }
    }

    return false;
  };
} // Test if a label with the given dimensions can be added without overlap

function vega_label_module_test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside) {
  return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 ? bm1.getRange(_x1, _y1, _x2, _y2) || !isInMarkBound(x1, y1, x2, y2, boundary) : bm0.getRange(_x1, _y1, _x2, _y2)));
}

function isInMarkBound(x1, y1, x2, y2, boundary) {
  return boundary[0] <= x1 && x2 <= boundary[2] && boundary[3] <= y1 && y2 <= boundary[5];
}

const TOP = 0x0,
      MIDDLE = 0x4,
      BOTTOM = 0x8,
      LEFT = 0x0,
      CENTER = 0x1,
      RIGHT = 0x2; // Mapping from text anchor to number representation

const anchorCode = {
  'top-left': TOP + LEFT,
  'top': TOP + CENTER,
  'top-right': TOP + RIGHT,
  'left': MIDDLE + LEFT,
  'middle': MIDDLE + CENTER,
  'right': MIDDLE + RIGHT,
  'bottom-left': BOTTOM + LEFT,
  'bottom': BOTTOM + CENTER,
  'bottom-right': BOTTOM + RIGHT
};
const placeAreaLabel = {
  'naive': placeAreaLabelNaive,
  'reduced-search': placeAreaLabelReducedSearch,
  'floodfill': placeAreaLabelFloodFill
};
function labelLayout (texts, size, compare, offset, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding, method) {
  // early exit for empty data
  if (!texts.length) return texts;
  const positions = Math.max(offset.length, anchor.length),
        offsets = getOffsets(offset, positions),
        anchors = getAnchors(anchor, positions),
        marktype = vega_label_module_markType(texts[0].datum),
        grouptype = marktype === 'group' && texts[0].datum.items[markIndex].marktype,
        isGroupArea = grouptype === 'area',
        boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex),
        $ = scaler(size[0], size[1], padding),
        isNaiveGroupArea = isGroupArea && method === 'naive'; // prepare text mark data for placing

  const data = texts.map(d => ({
    datum: d,
    opacity: 0,
    x: undefined,
    y: undefined,
    align: undefined,
    baseline: undefined,
    boundary: boundary(d)
  }));
  let bitmaps;

  if (!isNaiveGroupArea) {
    // sort labels in priority order, if comparator is provided
    if (compare) {
      data.sort((a, b) => compare(a.datum, b.datum));
    } // flag indicating if label can be placed inside its base mark


    let labelInside = false;

    for (let i = 0; i < anchors.length && !labelInside; ++i) {
      // label inside if anchor is at center
      // label inside if offset to be inside the mark bound
      labelInside = anchors[i] === 0x5 || offsets[i] < 0;
    } // extract data information from base mark when base mark is to be avoided
    // base mark is implicitly avoided if it is a group area


    if (marktype && (avoidBaseMark || isGroupArea)) {
      avoidMarks = [texts.map(d => d.datum)].concat(avoidMarks);
    } // generate bitmaps for layout calculation


    bitmaps = avoidMarks.length ? markBitmaps($, avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data);
  } // generate label placement function


  const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($, bitmaps, anchors, offsets); // place all labels

  data.forEach(d => d.opacity = +place(d));
  return data;
}

function getOffsets(_, count) {
  const offsets = new Float64Array(count),
        n = _.length;

  for (let i = 0; i < n; ++i) offsets[i] = _[i] || 0;

  for (let i = n; i < count; ++i) offsets[i] = offsets[n - 1];

  return offsets;
}

function getAnchors(_, count) {
  const anchors = new Int8Array(count),
        n = _.length;

  for (let i = 0; i < n; ++i) anchors[i] |= anchorCode[_[i]];

  for (let i = n; i < count; ++i) anchors[i] = anchors[n - 1];

  return anchors;
}

function vega_label_module_markType(item) {
  return item && item.mark && item.mark.marktype;
}
/**
 * Factory function for function for getting base mark boundary, depending
 * on mark and group type. When mark type is undefined, line or area: boundary
 * is the coordinate of each data point. When base mark is grouped line,
 * boundary is either at the beginning or end of the line depending on the
 * value of lineAnchor. Otherwise, use bounds of base mark.
 */


function markBoundary(marktype, grouptype, lineAnchor, markIndex) {
  const xy = d => [d.x, d.x, d.x, d.y, d.y, d.y];

  if (!marktype) {
    return xy; // no reactive geometry
  } else if (marktype === 'line' || marktype === 'area') {
    return d => xy(d.datum);
  } else if (grouptype === 'line') {
    return d => {
      const items = d.datum.items[markIndex].items;
      return xy(items.length ? items[lineAnchor === 'start' ? 0 : items.length - 1] : {
        x: NaN,
        y: NaN
      });
    };
  } else {
    return d => {
      const b = d.datum.bounds;
      return [b.x1, (b.x1 + b.x2) / 2, b.x2, b.y1, (b.y1 + b.y2) / 2, b.y2];
    };
  }
}

const vega_label_module_Output = ['x', 'y', 'opacity', 'align', 'baseline'];
const Anchors = ['top-left', 'left', 'bottom-left', 'top', 'bottom', 'top-right', 'right', 'bottom-right'];
/**
 * Compute text label layout to annotate marks.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<number>} params.size - The size of the layout, provided as a [width, height] array.
 * @param {function(*,*): number} [params.sort] - An optional
 *   comparator function for sorting label data in priority order.
 * @param {Array<string>} [params.anchor] - Label anchor points relative to the base mark bounding box.
 *   The available options are 'top-left', 'left', 'bottom-left', 'top',
 *   'bottom', 'top-right', 'right', 'bottom-right', 'middle'.
 * @param {Array<number>} [params.offset] - Label offsets (in pixels) from the base mark bounding box.
 *   This parameter  is parallel to the list of anchor points.
 * @param {number} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size.
 * @param {string} [params.lineAnchor='end'] - For group line mark labels only, indicates the anchor
 *   position for labels. One of 'start' or 'end'.
 * @param {string} [params.markIndex=0] - For group mark labels only, an index indicating
 *   which mark within the group should be labeled.
 * @param {Array<number>} [params.avoidMarks] - A list of additional mark names for which the label
 *   layout should avoid overlap.
 * @param {boolean} [params.avoidBaseMark=true] - Boolean flag indicating if labels should avoid
 *   overlap with the underlying base mark being labeled.
 * @param {string} [params.method='naive'] - For area make labels only, a method for
 *   place labels. One of 'naive', 'reduced-search', or 'floodfill'.
 * @param {Array<string>} [params.as] - The output fields written by the transform.
 *   The default is ['x', 'y', 'opacity', 'align', 'baseline'].
 */

function Label(params) {
  Transform.call(this, null, params);
}
Label.Definition = {
  type: 'Label',
  metadata: {
    modifies: true
  },
  params: [{
    name: 'size',
    type: 'number',
    array: true,
    length: 2,
    required: true
  }, {
    name: 'sort',
    type: 'compare'
  }, {
    name: 'anchor',
    type: 'string',
    array: true,
    default: Anchors
  }, {
    name: 'offset',
    type: 'number',
    array: true,
    default: [1]
  }, {
    name: 'padding',
    type: 'number',
    default: 0
  }, {
    name: 'lineAnchor',
    type: 'string',
    values: ['start', 'end'],
    default: 'end'
  }, {
    name: 'markIndex',
    type: 'number',
    default: 0
  }, {
    name: 'avoidBaseMark',
    type: 'boolean',
    default: true
  }, {
    name: 'avoidMarks',
    type: 'data',
    array: true
  }, {
    name: 'method',
    type: 'string',
    default: 'naive'
  }, {
    name: 'as',
    type: 'string',
    array: true,
    length: vega_label_module_Output.length,
    default: vega_label_module_Output
  }]
};
Object(vega_util_module["z" /* inherits */])(Label, Transform, {
  transform(_, pulse) {
    function modp(param) {
      const p = _[param];
      return Object(vega_util_module["E" /* isFunction */])(p) && pulse.modified(p.fields);
    }

    const mod = _.modified();

    if (!(mod || pulse.changed(pulse.ADD_REM) || modp('sort'))) return;

    if (!_.size || _.size.length !== 2) {
      Object(vega_util_module["o" /* error */])('Size parameter should be specified as a [width, height] array.');
    }

    const as = _.as || vega_label_module_Output; // run label layout

    labelLayout(pulse.materialize(pulse.SOURCE).source, _.size, _.sort, Object(vega_util_module["i" /* array */])(_.offset || 1), Object(vega_util_module["i" /* array */])(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark === false ? false : true, _.lineAnchor || 'end', _.markIndex || 0, _.padding || 0, _.method || 'naive').forEach(l => {
      // write layout results to data stream
      const t = l.datum;
      t[as[0]] = l.x;
      t[as[1]] = l.y;
      t[as[2]] = l.opacity;
      t[as[3]] = l.align;
      t[as[4]] = l.baseline;
    });
    return pulse.reflow(mod).modifies(as);
  }

});



// CONCATENATED MODULE: ./node_modules/vega-regression/build/vega-regression.module.js




function vega_regression_module_partition (data, groupby) {
  var groups = [],
      get = function (f) {
    return f(t);
  },
      map,
      i,
      n,
      t,
      k,
      g; // partition data points into stack groups


  if (groupby == null) {
    groups.push(data);
  } else {
    for (map = {}, i = 0, n = data.length; i < n; ++i) {
      t = data[i];
      k = groupby.map(get);
      g = map[k];

      if (!g) {
        map[k] = g = [];
        g.dims = k;
        groups.push(g);
      }

      g.push(t);
    }
  }

  return groups;
}

/**
 * Compute locally-weighted regression fits for one or more data groups.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.x - An accessor for the predictor data field.
 * @param {function(object): *} params.y - An accessor for the predicted data field.
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby.
 * @param {number} [params.bandwidth=0.3] - The loess bandwidth.
 */

function Loess(params) {
  Transform.call(this, null, params);
}
Loess.Definition = {
  'type': 'Loess',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'x',
    'type': 'field',
    'required': true
  }, {
    'name': 'y',
    'type': 'field',
    'required': true
  }, {
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'bandwidth',
    'type': 'number',
    'default': 0.3
  }, {
    'name': 'as',
    'type': 'string',
    'array': true
  }]
};
Object(vega_util_module["z" /* inherits */])(Loess, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);

    if (!this.value || pulse.changed() || _.modified()) {
      const source = pulse.materialize(pulse.SOURCE).source,
            groups = vega_regression_module_partition(source, _.groupby),
            names = (_.groupby || []).map(vega_util_module["h" /* accessorName */]),
            m = names.length,
            as = _.as || [Object(vega_util_module["h" /* accessorName */])(_.x), Object(vega_util_module["h" /* accessorName */])(_.y)],
            values = [];
      groups.forEach(g => {
        vega_statistics_module_loess(g, _.x, _.y, _.bandwidth || 0.3).forEach(p => {
          const t = {};

          for (let i = 0; i < m; ++i) {
            t[names[i]] = g.dims[i];
          }

          t[as[0]] = p[0];
          t[as[1]] = p[1];
          values.push(ingest$1(t));
        });
      });
      if (this.value) out.rem = this.value;
      this.value = out.add = out.source = values;
    }

    return out;
  }

});

const vega_regression_module_Methods = {
  linear: linear,
  log: log,
  exp: exp,
  pow: pow,
  quad: vega_statistics_module_quad,
  poly: poly
};

const degreesOfFreedom = (method, order) => method === 'poly' ? order : method === 'quad' ? 2 : 1;
/**
 * Compute regression fits for one or more data groups.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): *} params.x - An accessor for the predictor data field.
 * @param {function(object): *} params.y - An accessor for the predicted data field.
 * @param {string} [params.method='linear'] - The regression method to apply.
 * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby.
 * @param {Array<number>} [params.extent] - The domain extent over which to plot the regression line.
 * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method.
 */


function Regression(params) {
  Transform.call(this, null, params);
}
Regression.Definition = {
  'type': 'Regression',
  'metadata': {
    'generates': true
  },
  'params': [{
    'name': 'x',
    'type': 'field',
    'required': true
  }, {
    'name': 'y',
    'type': 'field',
    'required': true
  }, {
    'name': 'groupby',
    'type': 'field',
    'array': true
  }, {
    'name': 'method',
    'type': 'string',
    'default': 'linear',
    'values': Object.keys(vega_regression_module_Methods)
  }, {
    'name': 'order',
    'type': 'number',
    'default': 3
  }, {
    'name': 'extent',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'params',
    'type': 'boolean',
    'default': false
  }, {
    'name': 'as',
    'type': 'string',
    'array': true
  }]
};
Object(vega_util_module["z" /* inherits */])(Regression, Transform, {
  transform(_, pulse) {
    const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);

    if (!this.value || pulse.changed() || _.modified()) {
      const source = pulse.materialize(pulse.SOURCE).source,
            groups = vega_regression_module_partition(source, _.groupby),
            names = (_.groupby || []).map(vega_util_module["h" /* accessorName */]),
            method = _.method || 'linear',
            order = _.order || 3,
            dof = degreesOfFreedom(method, order),
            as = _.as || [Object(vega_util_module["h" /* accessorName */])(_.x), Object(vega_util_module["h" /* accessorName */])(_.y)],
            fit = vega_regression_module_Methods[method],
            values = [];
      let domain = _.extent;

      if (!Object(vega_util_module["w" /* hasOwnProperty */])(vega_regression_module_Methods, method)) {
        Object(vega_util_module["o" /* error */])('Invalid regression method: ' + method);
      }

      if (domain != null) {
        if (method === 'log' && domain[0] <= 0) {
          pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.');
          domain = null;
        }
      }

      groups.forEach(g => {
        const n = g.length;

        if (n <= dof) {
          pulse.dataflow.warn('Skipping regression with more parameters than data points.');
          return;
        }

        const model = fit(g, _.x, _.y, order);

        if (_.params) {
          // if parameter vectors requested return those
          values.push(ingest$1({
            keys: g.dims,
            coef: model.coef,
            rSquared: model.rSquared
          }));
          return;
        }

        const dom = domain || Object(vega_util_module["q" /* extent */])(g, _.x),
              add = p => {
          const t = {};

          for (let i = 0; i < names.length; ++i) {
            t[names[i]] = g.dims[i];
          }

          t[as[0]] = p[0];
          t[as[1]] = p[1];
          values.push(ingest$1(t));
        };

        if (method === 'linear') {
          // for linear regression we only need the end points
          dom.forEach(x => add([x, model.predict(x)]));
        } else {
          // otherwise return trend line sample points
          sampleCurve(model.predict, dom, 25, 200).forEach(add);
        }
      });
      if (this.value) out.rem = this.value;
      this.value = out.add = out.source = values;
    }

    return out;
  }

});



// CONCATENATED MODULE: ./node_modules/delaunator/index.js

const delaunator_EPSILON = Math.pow(2, -52);
const EDGE_STACK = new Uint32Array(512);

class Delaunator {

    static from(points, getX = defaultGetX, getY = defaultGetY) {
        const n = points.length;
        const coords = new Float64Array(n * 2);

        for (let i = 0; i < n; i++) {
            const p = points[i];
            coords[2 * i] = getX(p);
            coords[2 * i + 1] = getY(p);
        }

        return new Delaunator(coords);
    }

    constructor(coords) {
        const n = coords.length >> 1;
        if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.');

        this.coords = coords;

        // arrays that will store the triangulation graph
        const maxTriangles = Math.max(2 * n - 5, 0);
        this._triangles = new Uint32Array(maxTriangles * 3);
        this._halfedges = new Int32Array(maxTriangles * 3);

        // temporary arrays for tracking the edges of the advancing convex hull
        this._hashSize = Math.ceil(Math.sqrt(n));
        this._hullPrev = new Uint32Array(n); // edge to prev edge
        this._hullNext = new Uint32Array(n); // edge to next edge
        this._hullTri = new Uint32Array(n); // edge to adjacent triangle
        this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash

        // temporary arrays for sorting points
        this._ids = new Uint32Array(n);
        this._dists = new Float64Array(n);

        this.update();
    }

    update() {
        const {coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash} =  this;
        const n = coords.length >> 1;

        // populate an array of point indices; calculate input data bbox
        let minX = Infinity;
        let minY = Infinity;
        let maxX = -Infinity;
        let maxY = -Infinity;

        for (let i = 0; i < n; i++) {
            const x = coords[2 * i];
            const y = coords[2 * i + 1];
            if (x < minX) minX = x;
            if (y < minY) minY = y;
            if (x > maxX) maxX = x;
            if (y > maxY) maxY = y;
            this._ids[i] = i;
        }
        const cx = (minX + maxX) / 2;
        const cy = (minY + maxY) / 2;

        let minDist = Infinity;
        let i0, i1, i2;

        // pick a seed point close to the center
        for (let i = 0; i < n; i++) {
            const d = delaunator_dist(cx, cy, coords[2 * i], coords[2 * i + 1]);
            if (d < minDist) {
                i0 = i;
                minDist = d;
            }
        }
        const i0x = coords[2 * i0];
        const i0y = coords[2 * i0 + 1];

        minDist = Infinity;

        // find the point closest to the seed
        for (let i = 0; i < n; i++) {
            if (i === i0) continue;
            const d = delaunator_dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]);
            if (d < minDist && d > 0) {
                i1 = i;
                minDist = d;
            }
        }
        let i1x = coords[2 * i1];
        let i1y = coords[2 * i1 + 1];

        let minRadius = Infinity;

        // find the third point which forms the smallest circumcircle with the first two
        for (let i = 0; i < n; i++) {
            if (i === i0 || i === i1) continue;
            const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]);
            if (r < minRadius) {
                i2 = i;
                minRadius = r;
            }
        }
        let i2x = coords[2 * i2];
        let i2y = coords[2 * i2 + 1];

        if (minRadius === Infinity) {
            // order collinear points by dx (or dy if all x are identical)
            // and return the list as a hull
            for (let i = 0; i < n; i++) {
                this._dists[i] = (coords[2 * i] - coords[0]) || (coords[2 * i + 1] - coords[1]);
            }
            quicksort(this._ids, this._dists, 0, n - 1);
            const hull = new Uint32Array(n);
            let j = 0;
            for (let i = 0, d0 = -Infinity; i < n; i++) {
                const id = this._ids[i];
                if (this._dists[id] > d0) {
                    hull[j++] = id;
                    d0 = this._dists[id];
                }
            }
            this.hull = hull.subarray(0, j);
            this.triangles = new Uint32Array(0);
            this.halfedges = new Uint32Array(0);
            return;
        }

        // swap the order of the seed points for counter-clockwise orientation
        if (delaunator_orient(i0x, i0y, i1x, i1y, i2x, i2y)) {
            const i = i1;
            const x = i1x;
            const y = i1y;
            i1 = i2;
            i1x = i2x;
            i1y = i2y;
            i2 = i;
            i2x = x;
            i2y = y;
        }

        const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y);
        this._cx = center.x;
        this._cy = center.y;

        for (let i = 0; i < n; i++) {
            this._dists[i] = delaunator_dist(coords[2 * i], coords[2 * i + 1], center.x, center.y);
        }

        // sort the points by distance from the seed triangle circumcenter
        quicksort(this._ids, this._dists, 0, n - 1);

        // set up the seed triangle as the starting hull
        this._hullStart = i0;
        let hullSize = 3;

        hullNext[i0] = hullPrev[i2] = i1;
        hullNext[i1] = hullPrev[i0] = i2;
        hullNext[i2] = hullPrev[i1] = i0;

        hullTri[i0] = 0;
        hullTri[i1] = 1;
        hullTri[i2] = 2;

        hullHash.fill(-1);
        hullHash[this._hashKey(i0x, i0y)] = i0;
        hullHash[this._hashKey(i1x, i1y)] = i1;
        hullHash[this._hashKey(i2x, i2y)] = i2;

        this.trianglesLen = 0;
        this._addTriangle(i0, i1, i2, -1, -1, -1);

        for (let k = 0, xp, yp; k < this._ids.length; k++) {
            const i = this._ids[k];
            const x = coords[2 * i];
            const y = coords[2 * i + 1];

            // skip near-duplicate points
            if (k > 0 && Math.abs(x - xp) <= delaunator_EPSILON && Math.abs(y - yp) <= delaunator_EPSILON) continue;
            xp = x;
            yp = y;

            // skip seed triangle points
            if (i === i0 || i === i1 || i === i2) continue;

            // find a visible edge on the convex hull using edge hash
            let start = 0;
            for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) {
                start = hullHash[(key + j) % this._hashSize];
                if (start !== -1 && start !== hullNext[start]) break;
            }

            start = hullPrev[start];
            let e = start, q;
            while (q = hullNext[e], !delaunator_orient(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1])) {
                e = q;
                if (e === start) {
                    e = -1;
                    break;
                }
            }
            if (e === -1) continue; // likely a near-duplicate point; skip it

            // add the first triangle from the point
            let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]);

            // recursively flip triangles from the point until they satisfy the Delaunay condition
            hullTri[i] = this._legalize(t + 2);
            hullTri[e] = t; // keep track of boundary triangles on the hull
            hullSize++;

            // walk forward through the hull, adding more triangles and flipping recursively
            let n = hullNext[e];
            while (q = hullNext[n], delaunator_orient(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1])) {
                t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]);
                hullTri[i] = this._legalize(t + 2);
                hullNext[n] = n; // mark as removed
                hullSize--;
                n = q;
            }

            // walk backward from the other side, adding more triangles and flipping
            if (e === start) {
                while (q = hullPrev[e], delaunator_orient(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1])) {
                    t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]);
                    this._legalize(t + 2);
                    hullTri[q] = t;
                    hullNext[e] = e; // mark as removed
                    hullSize--;
                    e = q;
                }
            }

            // update the hull indices
            this._hullStart = hullPrev[i] = e;
            hullNext[e] = hullPrev[n] = i;
            hullNext[i] = n;

            // save the two new edges in the hash table
            hullHash[this._hashKey(x, y)] = i;
            hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e;
        }

        this.hull = new Uint32Array(hullSize);
        for (let i = 0, e = this._hullStart; i < hullSize; i++) {
            this.hull[i] = e;
            e = hullNext[e];
        }

        // trim typed triangle mesh arrays
        this.triangles = this._triangles.subarray(0, this.trianglesLen);
        this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
    }

    _hashKey(x, y) {
        return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize;
    }

    _legalize(a) {
        const {_triangles: triangles, _halfedges: halfedges, coords} = this;

        let i = 0;
        let ar = 0;

        // recursion eliminated with a fixed-size stack
        while (true) {
            const b = halfedges[a];

            /* if the pair of triangles doesn't satisfy the Delaunay condition
             * (p1 is inside the circumcircle of [p0, pl, pr]), flip them,
             * then do the same check/flip recursively for the new pair of triangles
             *
             *           pl                    pl
             *          /||\                  /  \
             *       al/ || \bl            al/    \a
             *        /  ||  \              /      \
             *       /  a||b  \    flip    /___ar___\
             *     p0\   ||   /p1   =>   p0\---bl---/p1
             *        \  ||  /              \      /
             *       ar\ || /br             b\    /br
             *          \||/                  \  /
             *           pr                    pr
             */
            const a0 = a - a % 3;
            ar = a0 + (a + 2) % 3;

            if (b === -1) { // convex hull edge
                if (i === 0) break;
                a = EDGE_STACK[--i];
                continue;
            }

            const b0 = b - b % 3;
            const al = a0 + (a + 1) % 3;
            const bl = b0 + (b + 2) % 3;

            const p0 = triangles[ar];
            const pr = triangles[a];
            const pl = triangles[al];
            const p1 = triangles[bl];

            const illegal = inCircle(
                coords[2 * p0], coords[2 * p0 + 1],
                coords[2 * pr], coords[2 * pr + 1],
                coords[2 * pl], coords[2 * pl + 1],
                coords[2 * p1], coords[2 * p1 + 1]);

            if (illegal) {
                triangles[a] = p1;
                triangles[b] = p0;

                const hbl = halfedges[bl];

                // edge swapped on the other side of the hull (rare); fix the halfedge reference
                if (hbl === -1) {
                    let e = this._hullStart;
                    do {
                        if (this._hullTri[e] === bl) {
                            this._hullTri[e] = a;
                            break;
                        }
                        e = this._hullPrev[e];
                    } while (e !== this._hullStart);
                }
                this._link(a, hbl);
                this._link(b, halfedges[ar]);
                this._link(ar, bl);

                const br = b0 + (b + 1) % 3;

                // don't worry about hitting the cap: it can only happen on extremely degenerate input
                if (i < EDGE_STACK.length) {
                    EDGE_STACK[i++] = br;
                }
            } else {
                if (i === 0) break;
                a = EDGE_STACK[--i];
            }
        }

        return ar;
    }

    _link(a, b) {
        this._halfedges[a] = b;
        if (b !== -1) this._halfedges[b] = a;
    }

    // add a new triangle given vertex indices and adjacent half-edge ids
    _addTriangle(i0, i1, i2, a, b, c) {
        const t = this.trianglesLen;

        this._triangles[t] = i0;
        this._triangles[t + 1] = i1;
        this._triangles[t + 2] = i2;

        this._link(t, a);
        this._link(t + 1, b);
        this._link(t + 2, c);

        this.trianglesLen += 3;

        return t;
    }
}

// monotonically increases with real angle, but doesn't need expensive trigonometry
function pseudoAngle(dx, dy) {
    const p = dx / (Math.abs(dx) + Math.abs(dy));
    return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1]
}

function delaunator_dist(ax, ay, bx, by) {
    const dx = ax - bx;
    const dy = ay - by;
    return dx * dx + dy * dy;
}

// return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check
function orientIfSure(px, py, rx, ry, qx, qy) {
    const l = (ry - py) * (qx - px);
    const r = (rx - px) * (qy - py);
    return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0;
}

// a more robust orientation test that's stable in a given triangle (to fix robustness issues)
function delaunator_orient(rx, ry, qx, qy, px, py) {
    const sign = orientIfSure(px, py, rx, ry, qx, qy) ||
    orientIfSure(rx, ry, qx, qy, px, py) ||
    orientIfSure(qx, qy, px, py, rx, ry);
    return sign < 0;
}

function inCircle(ax, ay, bx, by, cx, cy, px, py) {
    const dx = ax - px;
    const dy = ay - py;
    const ex = bx - px;
    const ey = by - py;
    const fx = cx - px;
    const fy = cy - py;

    const ap = dx * dx + dy * dy;
    const bp = ex * ex + ey * ey;
    const cp = fx * fx + fy * fy;

    return dx * (ey * cp - bp * fy) -
           dy * (ex * cp - bp * fx) +
           ap * (ex * fy - ey * fx) < 0;
}

function circumradius(ax, ay, bx, by, cx, cy) {
    const dx = bx - ax;
    const dy = by - ay;
    const ex = cx - ax;
    const ey = cy - ay;

    const bl = dx * dx + dy * dy;
    const cl = ex * ex + ey * ey;
    const d = 0.5 / (dx * ey - dy * ex);

    const x = (ey * bl - dy * cl) * d;
    const y = (dx * cl - ex * bl) * d;

    return x * x + y * y;
}

function circumcenter(ax, ay, bx, by, cx, cy) {
    const dx = bx - ax;
    const dy = by - ay;
    const ex = cx - ax;
    const ey = cy - ay;

    const bl = dx * dx + dy * dy;
    const cl = ex * ex + ey * ey;
    const d = 0.5 / (dx * ey - dy * ex);

    const x = ax + (ey * bl - dy * cl) * d;
    const y = ay + (dx * cl - ex * bl) * d;

    return {x, y};
}

function quicksort(ids, dists, left, right) {
    if (right - left <= 20) {
        for (let i = left + 1; i <= right; i++) {
            const temp = ids[i];
            const tempDist = dists[temp];
            let j = i - 1;
            while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--];
            ids[j + 1] = temp;
        }
    } else {
        const median = (left + right) >> 1;
        let i = left + 1;
        let j = right;
        delaunator_swap(ids, median, i);
        if (dists[ids[left]] > dists[ids[right]]) delaunator_swap(ids, left, right);
        if (dists[ids[i]] > dists[ids[right]]) delaunator_swap(ids, i, right);
        if (dists[ids[left]] > dists[ids[i]]) delaunator_swap(ids, left, i);

        const temp = ids[i];
        const tempDist = dists[temp];
        while (true) {
            do i++; while (dists[ids[i]] < tempDist);
            do j--; while (dists[ids[j]] > tempDist);
            if (j < i) break;
            delaunator_swap(ids, i, j);
        }
        ids[left + 1] = ids[j];
        ids[j] = temp;

        if (right - i + 1 >= j - left) {
            quicksort(ids, dists, i, right);
            quicksort(ids, dists, left, j - 1);
        } else {
            quicksort(ids, dists, left, j - 1);
            quicksort(ids, dists, i, right);
        }
    }
}

function delaunator_swap(arr, i, j) {
    const tmp = arr[i];
    arr[i] = arr[j];
    arr[j] = tmp;
}

function defaultGetX(p) {
    return p[0];
}
function defaultGetY(p) {
    return p[1];
}

// CONCATENATED MODULE: ./node_modules/d3-delaunay/src/path.js
const src_path_epsilon = 1e-6;

class path_Path {
  constructor() {
    this._x0 = this._y0 = // start of current subpath
    this._x1 = this._y1 = null; // end of current subpath
    this._ = "";
  }
  moveTo(x, y) {
    this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
  }
  closePath() {
    if (this._x1 !== null) {
      this._x1 = this._x0, this._y1 = this._y0;
      this._ += "Z";
    }
  }
  lineTo(x, y) {
    this._ += `L${this._x1 = +x},${this._y1 = +y}`;
  }
  arc(x, y, r) {
    x = +x, y = +y, r = +r;
    const x0 = x + r;
    const y0 = y;
    if (r < 0) throw new Error("negative radius");
    if (this._x1 === null) this._ += `M${x0},${y0}`;
    else if (Math.abs(this._x1 - x0) > src_path_epsilon || Math.abs(this._y1 - y0) > src_path_epsilon) this._ += "L" + x0 + "," + y0;
    if (!r) return;
    this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`;
  }
  rect(x, y, w, h) {
    this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`;
  }
  value() {
    return this._ || null;
  }
}

// CONCATENATED MODULE: ./node_modules/d3-delaunay/src/polygon.js
class Polygon {
  constructor() {
    this._ = [];
  }
  moveTo(x, y) {
    this._.push([x, y]);
  }
  closePath() {
    this._.push(this._[0].slice());
  }
  lineTo(x, y) {
    this._.push([x, y]);
  }
  value() {
    return this._.length ? this._ : null;
  }
}

// CONCATENATED MODULE: ./node_modules/d3-delaunay/src/voronoi.js



class voronoi_Voronoi {
  constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) {
    if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds");
    this.delaunay = delaunay;
    this._circumcenters = new Float64Array(delaunay.points.length * 2);
    this.vectors = new Float64Array(delaunay.points.length * 2);
    this.xmax = xmax, this.xmin = xmin;
    this.ymax = ymax, this.ymin = ymin;
    this._init();
  }
  update() {
    this.delaunay.update();
    this._init();
    return this;
  }
  _init() {
    const {delaunay: {points, hull, triangles}, vectors} = this;

    // Compute circumcenters.
    const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2);
    for (let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2) {
      const t1 = triangles[i] * 2;
      const t2 = triangles[i + 1] * 2;
      const t3 = triangles[i + 2] * 2;
      const x1 = points[t1];
      const y1 = points[t1 + 1];
      const x2 = points[t2];
      const y2 = points[t2 + 1];
      const x3 = points[t3];
      const y3 = points[t3 + 1];

      const dx = x2 - x1;
      const dy = y2 - y1;
      const ex = x3 - x1;
      const ey = y3 - y1;
      const bl = dx * dx + dy * dy;
      const cl = ex * ex + ey * ey;
      const ab = (dx * ey - dy * ex) * 2;

      if (!ab) {
        // degenerate case (collinear diagram)
        x = (x1 + x3) / 2 - 1e8 * ey;
        y = (y1 + y3) / 2 + 1e8 * ex;
      }
      else if (Math.abs(ab) < 1e-8) {
        // almost equal points (degenerate triangle)
        x = (x1 + x3) / 2;
        y = (y1 + y3) / 2;
      } else {
        const d = 1 / ab;
        x = x1 + (ey * bl - dy * cl) * d;
        y = y1 + (dx * cl - ex * bl) * d;
      }
      circumcenters[j] = x;
      circumcenters[j + 1] = y;
    }

    // Compute exterior cell rays.
    let h = hull[hull.length - 1];
    let p0, p1 = h * 4;
    let x0, x1 = points[2 * h];
    let y0, y1 = points[2 * h + 1];
    vectors.fill(0);
    for (let i = 0; i < hull.length; ++i) {
      h = hull[i];
      p0 = p1, x0 = x1, y0 = y1;
      p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1];
      vectors[p0 + 2] = vectors[p1] = y0 - y1;
      vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0;
    }
  }
  render(context) {
    const buffer = context == null ? context = new path_Path : undefined;
    const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this;
    if (hull.length <= 1) return null;
    for (let i = 0, n = halfedges.length; i < n; ++i) {
      const j = halfedges[i];
      if (j < i) continue;
      const ti = Math.floor(i / 3) * 2;
      const tj = Math.floor(j / 3) * 2;
      const xi = circumcenters[ti];
      const yi = circumcenters[ti + 1];
      const xj = circumcenters[tj];
      const yj = circumcenters[tj + 1];
      this._renderSegment(xi, yi, xj, yj, context);
    }
    let h0, h1 = hull[hull.length - 1];
    for (let i = 0; i < hull.length; ++i) {
      h0 = h1, h1 = hull[i];
      const t = Math.floor(inedges[h1] / 3) * 2;
      const x = circumcenters[t];
      const y = circumcenters[t + 1];
      const v = h0 * 4;
      const p = this._project(x, y, vectors[v + 2], vectors[v + 3]);
      if (p) this._renderSegment(x, y, p[0], p[1], context);
    }
    return buffer && buffer.value();
  }
  renderBounds(context) {
    const buffer = context == null ? context = new path_Path : undefined;
    context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin);
    return buffer && buffer.value();
  }
  renderCell(i, context) {
    const buffer = context == null ? context = new path_Path : undefined;
    const points = this._clip(i);
    if (points === null || !points.length) return;
    context.moveTo(points[0], points[1]);
    let n = points.length;
    while (points[0] === points[n-2] && points[1] === points[n-1] && n > 1) n -= 2;
    for (let i = 2; i < n; i += 2) {
      if (points[i] !== points[i-2] || points[i+1] !== points[i-1])
        context.lineTo(points[i], points[i + 1]);
    }
    context.closePath();
    return buffer && buffer.value();
  }
  *cellPolygons() {
    const {delaunay: {points}} = this;
    for (let i = 0, n = points.length / 2; i < n; ++i) {
      const cell = this.cellPolygon(i);
      if (cell) cell.index = i, yield cell;
    }
  }
  cellPolygon(i) {
    const polygon = new Polygon;
    this.renderCell(i, polygon);
    return polygon.value();
  }
  _renderSegment(x0, y0, x1, y1, context) {
    let S;
    const c0 = this._regioncode(x0, y0);
    const c1 = this._regioncode(x1, y1);
    if (c0 === 0 && c1 === 0) {
      context.moveTo(x0, y0);
      context.lineTo(x1, y1);
    } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) {
      context.moveTo(S[0], S[1]);
      context.lineTo(S[2], S[3]);
    }
  }
  contains(i, x, y) {
    if ((x = +x, x !== x) || (y = +y, y !== y)) return false;
    return this.delaunay._step(i, x, y) === i;
  }
  *neighbors(i) {
    const ci = this._clip(i);
    if (ci) for (const j of this.delaunay.neighbors(i)) {
      const cj = this._clip(j);
      // find the common edge
      if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) {
        for (let aj = 0, lj = cj.length; aj < lj; aj += 2) {
          if (ci[ai] == cj[aj]
          && ci[ai + 1] == cj[aj + 1]
          && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj]
          && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj]
          ) {
            yield j;
            break loop;
          }
        }
      }
    }
  }
  _cell(i) {
    const {circumcenters, delaunay: {inedges, halfedges, triangles}} = this;
    const e0 = inedges[i];
    if (e0 === -1) return null; // coincident point
    const points = [];
    let e = e0;
    do {
      const t = Math.floor(e / 3);
      points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]);
      e = e % 3 === 2 ? e - 2 : e + 1;
      if (triangles[e] !== i) break; // bad triangulation
      e = halfedges[e];
    } while (e !== e0 && e !== -1);
    return points;
  }
  _clip(i) {
    // degenerate case (1 valid point: return the box)
    if (i === 0 && this.delaunay.hull.length === 1) {
      return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];
    }
    const points = this._cell(i);
    if (points === null) return null;
    const {vectors: V} = this;
    const v = i * 4;
    return V[v] || V[v + 1]
        ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3])
        : this._clipFinite(i, points);
  }
  _clipFinite(i, points) {
    const n = points.length;
    let P = null;
    let x0, y0, x1 = points[n - 2], y1 = points[n - 1];
    let c0, c1 = this._regioncode(x1, y1);
    let e0, e1;
    for (let j = 0; j < n; j += 2) {
      x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1];
      c0 = c1, c1 = this._regioncode(x1, y1);
      if (c0 === 0 && c1 === 0) {
        e0 = e1, e1 = 0;
        if (P) P.push(x1, y1);
        else P = [x1, y1];
      } else {
        let S, sx0, sy0, sx1, sy1;
        if (c0 === 0) {
          if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue;
          [sx0, sy0, sx1, sy1] = S;
        } else {
          if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue;
          [sx1, sy1, sx0, sy0] = S;
          e0 = e1, e1 = this._edgecode(sx0, sy0);
          if (e0 && e1) this._edge(i, e0, e1, P, P.length);
          if (P) P.push(sx0, sy0);
          else P = [sx0, sy0];
        }
        e0 = e1, e1 = this._edgecode(sx1, sy1);
        if (e0 && e1) this._edge(i, e0, e1, P, P.length);
        if (P) P.push(sx1, sy1);
        else P = [sx1, sy1];
      }
    }
    if (P) {
      e0 = e1, e1 = this._edgecode(P[0], P[1]);
      if (e0 && e1) this._edge(i, e0, e1, P, P.length);
    } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) {
      return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];
    }
    return P;
  }
  _clipSegment(x0, y0, x1, y1, c0, c1) {
    while (true) {
      if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1];
      if (c0 & c1) return null;
      let x, y, c = c0 || c1;
      if (c & 0b1000) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax;
      else if (c & 0b0100) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin;
      else if (c & 0b0010) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax;
      else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin;
      if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0);
      else x1 = x, y1 = y, c1 = this._regioncode(x1, y1);
    }
  }
  _clipInfinite(i, points, vx0, vy0, vxn, vyn) {
    let P = Array.from(points), p;
    if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]);
    if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]);
    if (P = this._clipFinite(i, P)) {
      for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) {
        c0 = c1, c1 = this._edgecode(P[j], P[j + 1]);
        if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length;
      }
    } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) {
      P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax];
    }
    return P;
  }
  _edge(i, e0, e1, P, j) {
    while (e0 !== e1) {
      let x, y;
      switch (e0) {
        case 0b0101: e0 = 0b0100; continue; // top-left
        case 0b0100: e0 = 0b0110, x = this.xmax, y = this.ymin; break; // top
        case 0b0110: e0 = 0b0010; continue; // top-right
        case 0b0010: e0 = 0b1010, x = this.xmax, y = this.ymax; break; // right
        case 0b1010: e0 = 0b1000; continue; // bottom-right
        case 0b1000: e0 = 0b1001, x = this.xmin, y = this.ymax; break; // bottom
        case 0b1001: e0 = 0b0001; continue; // bottom-left
        case 0b0001: e0 = 0b0101, x = this.xmin, y = this.ymin; break; // left
      }
      if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) {
        P.splice(j, 0, x, y), j += 2;
      }
    }
    if (P.length > 4) {
      for (let i = 0; i < P.length; i+= 2) {
        const j = (i + 2) % P.length, k = (i + 4) % P.length;
        if (P[i] === P[j] && P[j] === P[k]
        || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1])
          P.splice(j, 2), i -= 2;
      }
    }
    return j;
  }
  _project(x0, y0, vx, vy) {
    let t = Infinity, c, x, y;
    if (vy < 0) { // top
      if (y0 <= this.ymin) return null;
      if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx;
    } else if (vy > 0) { // bottom
      if (y0 >= this.ymax) return null;
      if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx;
    }
    if (vx > 0) { // right
      if (x0 >= this.xmax) return null;
      if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy;
    } else if (vx < 0) { // left
      if (x0 <= this.xmin) return null;
      if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy;
    }
    return [x, y];
  }
  _edgecode(x, y) {
    return (x === this.xmin ? 0b0001
        : x === this.xmax ? 0b0010 : 0b0000)
        | (y === this.ymin ? 0b0100
        : y === this.ymax ? 0b1000 : 0b0000);
  }
  _regioncode(x, y) {
    return (x < this.xmin ? 0b0001
        : x > this.xmax ? 0b0010 : 0b0000)
        | (y < this.ymin ? 0b0100
        : y > this.ymax ? 0b1000 : 0b0000);
  }
}

// CONCATENATED MODULE: ./node_modules/d3-delaunay/src/delaunay.js





const delaunay_tau = 2 * Math.PI, delaunay_pow = Math.pow;

function pointX(p) {
  return p[0];
}

function pointY(p) {
  return p[1];
}

// A triangulation is collinear if all its triangles have a non-null area
function delaunay_collinear(d) {
  const {triangles, coords} = d;
  for (let i = 0; i < triangles.length; i += 3) {
    const a = 2 * triangles[i],
          b = 2 * triangles[i + 1],
          c = 2 * triangles[i + 2],
          cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1])
                - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]);
    if (cross > 1e-10) return false;
  }
  return true;
}

function jitter(x, y, r) {
  return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r];
}

class delaunay_Delaunay {
  static from(points, fx = pointX, fy = pointY, that) {
    return new delaunay_Delaunay("length" in points
        ? flatArray(points, fx, fy, that)
        : Float64Array.from(flatIterable(points, fx, fy, that)));
  }
  constructor(points) {
    this._delaunator = new Delaunator(points);
    this.inedges = new Int32Array(points.length / 2);
    this._hullIndex = new Int32Array(points.length / 2);
    this.points = this._delaunator.coords;
    this._init();
  }
  update() {
    this._delaunator.update();
    this._init();
    return this;
  }
  _init() {
    const d = this._delaunator, points = this.points;

    // check for collinear
    if (d.hull && d.hull.length > 2 && delaunay_collinear(d)) {
      this.collinear = Int32Array.from({length: points.length/2}, (_,i) => i)
        .sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors
      const e = this.collinear[0], f = this.collinear[this.collinear.length - 1],
        bounds = [ points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1] ],
        r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]);
      for (let i = 0, n = points.length / 2; i < n; ++i) {
        const p = jitter(points[2 * i], points[2 * i + 1], r);
        points[2 * i] = p[0];
        points[2 * i + 1] = p[1];
      }
      this._delaunator = new Delaunator(points);
    } else {
      delete this.collinear;
    }

    const halfedges = this.halfedges = this._delaunator.halfedges;
    const hull = this.hull = this._delaunator.hull;
    const triangles = this.triangles = this._delaunator.triangles;
    const inedges = this.inedges.fill(-1);
    const hullIndex = this._hullIndex.fill(-1);

    // Compute an index from each point to an (arbitrary) incoming halfedge
    // Used to give the first neighbor of each point; for this reason,
    // on the hull we give priority to exterior halfedges
    for (let e = 0, n = halfedges.length; e < n; ++e) {
      const p = triangles[e % 3 === 2 ? e - 2 : e + 1];
      if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e;
    }
    for (let i = 0, n = hull.length; i < n; ++i) {
      hullIndex[hull[i]] = i;
    }

    // degenerate case: 1 or 2 (distinct) points
    if (hull.length <= 2 && hull.length > 0) {
      this.triangles = new Int32Array(3).fill(-1);
      this.halfedges = new Int32Array(3).fill(-1);
      this.triangles[0] = hull[0];
      this.triangles[1] = hull[1];
      this.triangles[2] = hull[1];
      inedges[hull[0]] = 1;
      if (hull.length === 2) inedges[hull[1]] = 0;
    }
  }
  voronoi(bounds) {
    return new voronoi_Voronoi(this, bounds);
  }
  *neighbors(i) {
    const {inedges, hull, _hullIndex, halfedges, triangles, collinear} = this;

    // degenerate case with several collinear points
    if (collinear) {
      const l = collinear.indexOf(i);
      if (l > 0) yield collinear[l - 1];
      if (l < collinear.length - 1) yield collinear[l + 1];
      return;
    }

    const e0 = inedges[i];
    if (e0 === -1) return; // coincident point
    let e = e0, p0 = -1;
    do {
      yield p0 = triangles[e];
      e = e % 3 === 2 ? e - 2 : e + 1;
      if (triangles[e] !== i) return; // bad triangulation
      e = halfedges[e];
      if (e === -1) {
        const p = hull[(_hullIndex[i] + 1) % hull.length];
        if (p !== p0) yield p;
        return;
      }
    } while (e !== e0);
  }
  find(x, y, i = 0) {
    if ((x = +x, x !== x) || (y = +y, y !== y)) return -1;
    const i0 = i;
    let c;
    while ((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0) i = c;
    return c;
  }
  _step(i, x, y) {
    const {inedges, hull, _hullIndex, halfedges, triangles, points} = this;
    if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1);
    let c = i;
    let dc = delaunay_pow(x - points[i * 2], 2) + delaunay_pow(y - points[i * 2 + 1], 2);
    const e0 = inedges[i];
    let e = e0;
    do {
      let t = triangles[e];
      const dt = delaunay_pow(x - points[t * 2], 2) + delaunay_pow(y - points[t * 2 + 1], 2);
      if (dt < dc) dc = dt, c = t;
      e = e % 3 === 2 ? e - 2 : e + 1;
      if (triangles[e] !== i) break; // bad triangulation
      e = halfedges[e];
      if (e === -1) {
        e = hull[(_hullIndex[i] + 1) % hull.length];
        if (e !== t) {
          if (delaunay_pow(x - points[e * 2], 2) + delaunay_pow(y - points[e * 2 + 1], 2) < dc) return e;
        }
        break;
      }
    } while (e !== e0);
    return c;
  }
  render(context) {
    const buffer = context == null ? context = new path_Path : undefined;
    const {points, halfedges, triangles} = this;
    for (let i = 0, n = halfedges.length; i < n; ++i) {
      const j = halfedges[i];
      if (j < i) continue;
      const ti = triangles[i] * 2;
      const tj = triangles[j] * 2;
      context.moveTo(points[ti], points[ti + 1]);
      context.lineTo(points[tj], points[tj + 1]);
    }
    this.renderHull(context);
    return buffer && buffer.value();
  }
  renderPoints(context, r = 2) {
    const buffer = context == null ? context = new path_Path : undefined;
    const {points} = this;
    for (let i = 0, n = points.length; i < n; i += 2) {
      const x = points[i], y = points[i + 1];
      context.moveTo(x + r, y);
      context.arc(x, y, r, 0, delaunay_tau);
    }
    return buffer && buffer.value();
  }
  renderHull(context) {
    const buffer = context == null ? context = new path_Path : undefined;
    const {hull, points} = this;
    const h = hull[0] * 2, n = hull.length;
    context.moveTo(points[h], points[h + 1]);
    for (let i = 1; i < n; ++i) {
      const h = 2 * hull[i];
      context.lineTo(points[h], points[h + 1]);
    }
    context.closePath();
    return buffer && buffer.value();
  }
  hullPolygon() {
    const polygon = new Polygon;
    this.renderHull(polygon);
    return polygon.value();
  }
  renderTriangle(i, context) {
    const buffer = context == null ? context = new path_Path : undefined;
    const {points, triangles} = this;
    const t0 = triangles[i *= 3] * 2;
    const t1 = triangles[i + 1] * 2;
    const t2 = triangles[i + 2] * 2;
    context.moveTo(points[t0], points[t0 + 1]);
    context.lineTo(points[t1], points[t1 + 1]);
    context.lineTo(points[t2], points[t2 + 1]);
    context.closePath();
    return buffer && buffer.value();
  }
  *trianglePolygons() {
    const {triangles} = this;
    for (let i = 0, n = triangles.length / 3; i < n; ++i) {
      yield this.trianglePolygon(i);
    }
  }
  trianglePolygon(i) {
    const polygon = new Polygon;
    this.renderTriangle(i, polygon);
    return polygon.value();
  }
}

function flatArray(points, fx, fy, that) {
  const n = points.length;
  const array = new Float64Array(n * 2);
  for (let i = 0; i < n; ++i) {
    const p = points[i];
    array[i * 2] = fx.call(that, p, i, points);
    array[i * 2 + 1] = fy.call(that, p, i, points);
  }
  return array;
}

function* flatIterable(points, fx, fy, that) {
  let i = 0;
  for (const p of points) {
    yield fx.call(that, p, i, points);
    yield fy.call(that, p, i, points);
    ++i;
  }
}

// CONCATENATED MODULE: ./node_modules/vega-voronoi/build/vega-voronoi.module.js




function vega_voronoi_module_Voronoi(params) {
  Transform.call(this, null, params);
}
vega_voronoi_module_Voronoi.Definition = {
  'type': 'Voronoi',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'x',
    'type': 'field',
    'required': true
  }, {
    'name': 'y',
    'type': 'field',
    'required': true
  }, {
    'name': 'size',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'extent',
    'type': 'array',
    'array': true,
    'length': 2,
    'default': [[-1e5, -1e5], [1e5, 1e5]],
    'content': {
      'type': 'number',
      'array': true,
      'length': 2
    }
  }, {
    'name': 'as',
    'type': 'string',
    'default': 'path'
  }]
};
const defaultExtent = [-1e5, -1e5, 1e5, 1e5];
Object(vega_util_module["z" /* inherits */])(vega_voronoi_module_Voronoi, Transform, {
  transform(_, pulse) {
    const as = _.as || 'path',
          data = pulse.source; // nothing to do if no data

    if (!data || !data.length) return pulse; // configure and construct voronoi diagram

    let s = _.size;
    s = s ? [0, 0, s[0], s[1]] : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] : defaultExtent;
    const voronoi = this.value = delaunay_Delaunay.from(data, _.x, _.y).voronoi(s); // map polygons to paths

    for (let i = 0, n = data.length; i < n; ++i) {
      const polygon = voronoi.cellPolygon(i);
      data[i][as] = polygon ? toPathString(polygon) : null;
    }

    return pulse.reflow(_.modified()).modifies(as);
  }

}); // suppress duplicated end point vertices

function toPathString(p) {
  const x = p[0][0],
        y = p[0][1];
  let n = p.length - 1;

  for (; p[n][0] === x && p[n][1] === y; --n);

  return 'M' + p.slice(0, n + 1).join('L') + 'Z';
}



// CONCATENATED MODULE: ./node_modules/vega-wordcloud/build/vega-wordcloud.module.js






/*
Copyright (c) 2013, Jason Davies.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this
    list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

  * The name Jason Davies may not be used to endorse or promote products
    derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL JASON DAVIES BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/
// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf

var cloudRadians = Math.PI / 180,
    vega_wordcloud_module_cw = 1 << 11 >> 5,
    ch = 1 << 11;
function vega_wordcloud_module_cloud () {
  var size = [256, 256],
      text,
      font,
      fontSize,
      fontStyle,
      fontWeight,
      rotate,
      padding,
      spiral = archimedeanSpiral,
      words = [],
      random = Math.random,
      cloud = {};

  cloud.layout = function () {
    var contextAndRatio = getContext(domCanvas()),
        board = zeroArray((size[0] >> 5) * size[1]),
        bounds = null,
        n = words.length,
        i = -1,
        tags = [],
        data = words.map(d => ({
      text: text(d),
      font: font(d),
      style: fontStyle(d),
      weight: fontWeight(d),
      rotate: rotate(d),
      size: ~~(fontSize(d) + 1e-14),
      padding: padding(d),
      xoff: 0,
      yoff: 0,
      x1: 0,
      y1: 0,
      x0: 0,
      y0: 0,
      hasText: false,
      sprite: null,
      datum: d
    })).sort((a, b) => b.size - a.size);

    while (++i < n) {
      var d = data[i];
      d.x = size[0] * (random() + .5) >> 1;
      d.y = size[1] * (random() + .5) >> 1;
      cloudSprite(contextAndRatio, d, data, i);

      if (d.hasText && place(board, d, bounds)) {
        tags.push(d);
        if (bounds) cloudBounds(bounds, d);else bounds = [{
          x: d.x + d.x0,
          y: d.y + d.y0
        }, {
          x: d.x + d.x1,
          y: d.y + d.y1
        }]; // Temporary hack

        d.x -= size[0] >> 1;
        d.y -= size[1] >> 1;
      }
    }

    return tags;
  };

  function getContext(canvas) {
    canvas.width = canvas.height = 1;
    var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2);
    canvas.width = (vega_wordcloud_module_cw << 5) / ratio;
    canvas.height = ch / ratio;
    var context = canvas.getContext('2d');
    context.fillStyle = context.strokeStyle = 'red';
    context.textAlign = 'center';
    return {
      context: context,
      ratio: ratio
    };
  }

  function place(board, tag, bounds) {
    var startX = tag.x,
        startY = tag.y,
        maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),
        s = spiral(size),
        dt = random() < .5 ? 1 : -1,
        t = -dt,
        dxdy,
        dx,
        dy;

    while (dxdy = s(t += dt)) {
      dx = ~~dxdy[0];
      dy = ~~dxdy[1];
      if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break;
      tag.x = startX + dx;
      tag.y = startY + dy;
      if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; // TODO only check for collisions within current bounds.

      if (!bounds || !cloudCollide(tag, board, size[0])) {
        if (!bounds || collideRects(tag, bounds)) {
          var sprite = tag.sprite,
              w = tag.width >> 5,
              sw = size[0] >> 5,
              lx = tag.x - (w << 4),
              sx = lx & 0x7f,
              msx = 32 - sx,
              h = tag.y1 - tag.y0,
              x = (tag.y + tag.y0) * sw + (lx >> 5),
              last;

          for (var j = 0; j < h; j++) {
            last = 0;

            for (var i = 0; i <= w; i++) {
              board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);
            }

            x += sw;
          }

          tag.sprite = null;
          return true;
        }
      }
    }

    return false;
  }

  cloud.words = function (_) {
    if (arguments.length) {
      words = _;
      return cloud;
    } else {
      return words;
    }
  };

  cloud.size = function (_) {
    if (arguments.length) {
      size = [+_[0], +_[1]];
      return cloud;
    } else {
      return size;
    }
  };

  cloud.font = function (_) {
    if (arguments.length) {
      font = functor(_);
      return cloud;
    } else {
      return font;
    }
  };

  cloud.fontStyle = function (_) {
    if (arguments.length) {
      fontStyle = functor(_);
      return cloud;
    } else {
      return fontStyle;
    }
  };

  cloud.fontWeight = function (_) {
    if (arguments.length) {
      fontWeight = functor(_);
      return cloud;
    } else {
      return fontWeight;
    }
  };

  cloud.rotate = function (_) {
    if (arguments.length) {
      rotate = functor(_);
      return cloud;
    } else {
      return rotate;
    }
  };

  cloud.text = function (_) {
    if (arguments.length) {
      text = functor(_);
      return cloud;
    } else {
      return text;
    }
  };

  cloud.spiral = function (_) {
    if (arguments.length) {
      spiral = spirals[_] || _;
      return cloud;
    } else {
      return spiral;
    }
  };

  cloud.fontSize = function (_) {
    if (arguments.length) {
      fontSize = functor(_);
      return cloud;
    } else {
      return fontSize;
    }
  };

  cloud.padding = function (_) {
    if (arguments.length) {
      padding = functor(_);
      return cloud;
    } else {
      return padding;
    }
  };

  cloud.random = function (_) {
    if (arguments.length) {
      random = _;
      return cloud;
    } else {
      return random;
    }
  };

  return cloud;
} // Fetches a monochrome sprite bitmap for the specified text.
// Load in batches for speed.

function cloudSprite(contextAndRatio, d, data, di) {
  if (d.sprite) return;
  var c = contextAndRatio.context,
      ratio = contextAndRatio.ratio;
  c.clearRect(0, 0, (vega_wordcloud_module_cw << 5) / ratio, ch / ratio);
  var x = 0,
      y = 0,
      maxh = 0,
      n = data.length,
      w,
      w32,
      h,
      i,
      j;
  --di;

  while (++di < n) {
    d = data[di];
    c.save();
    c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font;
    w = c.measureText(d.text + 'm').width * ratio;
    h = d.size << 1;

    if (d.rotate) {
      var sr = Math.sin(d.rotate * cloudRadians),
          cr = Math.cos(d.rotate * cloudRadians),
          wcr = w * cr,
          wsr = w * sr,
          hcr = h * cr,
          hsr = h * sr;
      w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5;
      h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));
    } else {
      w = w + 0x1f >> 5 << 5;
    }

    if (h > maxh) maxh = h;

    if (x + w >= vega_wordcloud_module_cw << 5) {
      x = 0;
      y += maxh;
      maxh = 0;
    }

    if (y + h >= ch) break;
    c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);
    if (d.rotate) c.rotate(d.rotate * cloudRadians);
    c.fillText(d.text, 0, 0);

    if (d.padding) {
      c.lineWidth = 2 * d.padding;
      c.strokeText(d.text, 0, 0);
    }

    c.restore();
    d.width = w;
    d.height = h;
    d.xoff = x;
    d.yoff = y;
    d.x1 = w >> 1;
    d.y1 = h >> 1;
    d.x0 = -d.x1;
    d.y0 = -d.y1;
    d.hasText = true;
    x += w;
  }

  var pixels = c.getImageData(0, 0, (vega_wordcloud_module_cw << 5) / ratio, ch / ratio).data,
      sprite = [];

  while (--di >= 0) {
    d = data[di];
    if (!d.hasText) continue;
    w = d.width;
    w32 = w >> 5;
    h = d.y1 - d.y0; // Zero the buffer

    for (i = 0; i < h * w32; i++) sprite[i] = 0;

    x = d.xoff;
    if (x == null) return;
    y = d.yoff;
    var seen = 0,
        seenRow = -1;

    for (j = 0; j < h; j++) {
      for (i = 0; i < w; i++) {
        var k = w32 * j + (i >> 5),
            m = pixels[(y + j) * (vega_wordcloud_module_cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0;
        sprite[k] |= m;
        seen |= m;
      }

      if (seen) seenRow = j;else {
        d.y0++;
        h--;
        j--;
        y++;
      }
    }

    d.y1 = d.y0 + seenRow;
    d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);
  }
} // Use mask-based collision detection.


function cloudCollide(tag, board, sw) {
  sw >>= 5;
  var sprite = tag.sprite,
      w = tag.width >> 5,
      lx = tag.x - (w << 4),
      sx = lx & 0x7f,
      msx = 32 - sx,
      h = tag.y1 - tag.y0,
      x = (tag.y + tag.y0) * sw + (lx >> 5),
      last;

  for (var j = 0; j < h; j++) {
    last = 0;

    for (var i = 0; i <= w; i++) {
      if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true;
    }

    x += sw;
  }

  return false;
}

function cloudBounds(bounds, d) {
  var b0 = bounds[0],
      b1 = bounds[1];
  if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;
  if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;
  if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;
  if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;
}

function collideRects(a, b) {
  return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;
}

function archimedeanSpiral(size) {
  var e = size[0] / size[1];
  return function (t) {
    return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)];
  };
}

function rectangularSpiral(size) {
  var dy = 4,
      dx = dy * size[0] / size[1],
      x = 0,
      y = 0;
  return function (t) {
    var sign = t < 0 ? -1 : 1; // See triangular numbers: T_n = n * (n + 1) / 2.

    switch (Math.sqrt(1 + 4 * sign * t) - sign & 3) {
      case 0:
        x += dx;
        break;

      case 1:
        y += dy;
        break;

      case 2:
        x -= dx;
        break;

      default:
        y -= dy;
        break;
    }

    return [x, y];
  };
} // TODO reuse arrays?


function zeroArray(n) {
  var a = [],
      i = -1;

  while (++i < n) a[i] = 0;

  return a;
}

function functor(d) {
  return typeof d === 'function' ? d : function () {
    return d;
  };
}

var spirals = {
  archimedean: archimedeanSpiral,
  rectangular: rectangularSpiral
};

const vega_wordcloud_module_Output = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle'];
const vega_wordcloud_module_Params = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight'];
function Wordcloud(params) {
  Transform.call(this, vega_wordcloud_module_cloud(), params);
}
Wordcloud.Definition = {
  'type': 'Wordcloud',
  'metadata': {
    'modifies': true
  },
  'params': [{
    'name': 'size',
    'type': 'number',
    'array': true,
    'length': 2
  }, {
    'name': 'font',
    'type': 'string',
    'expr': true,
    'default': 'sans-serif'
  }, {
    'name': 'fontStyle',
    'type': 'string',
    'expr': true,
    'default': 'normal'
  }, {
    'name': 'fontWeight',
    'type': 'string',
    'expr': true,
    'default': 'normal'
  }, {
    'name': 'fontSize',
    'type': 'number',
    'expr': true,
    'default': 14
  }, {
    'name': 'fontSizeRange',
    'type': 'number',
    'array': 'nullable',
    'default': [10, 50]
  }, {
    'name': 'rotate',
    'type': 'number',
    'expr': true,
    'default': 0
  }, {
    'name': 'text',
    'type': 'field'
  }, {
    'name': 'spiral',
    'type': 'string',
    'values': ['archimedean', 'rectangular']
  }, {
    'name': 'padding',
    'type': 'number',
    'expr': true
  }, {
    'name': 'as',
    'type': 'string',
    'array': true,
    'length': 7,
    'default': vega_wordcloud_module_Output
  }]
};
Object(vega_util_module["z" /* inherits */])(Wordcloud, Transform, {
  transform(_, pulse) {
    if (_.size && !(_.size[0] && _.size[1])) {
      Object(vega_util_module["o" /* error */])('Wordcloud size dimensions must be non-zero.');
    }

    function modp(param) {
      const p = _[param];
      return Object(vega_util_module["E" /* isFunction */])(p) && pulse.modified(p.fields);
    }

    const mod = _.modified();

    if (!(mod || pulse.changed(pulse.ADD_REM) || vega_wordcloud_module_Params.some(modp))) return;
    const data = pulse.materialize(pulse.SOURCE).source,
          layout = this.value,
          as = _.as || vega_wordcloud_module_Output;
    let fontSize = _.fontSize || 14,
        range;
    Object(vega_util_module["E" /* isFunction */])(fontSize) ? range = _.fontSizeRange : fontSize = Object(vega_util_module["m" /* constant */])(fontSize); // create font size scaling function as needed

    if (range) {
      const fsize = fontSize,
            sizeScale = vega_scale_module_scale('sqrt')().domain(Object(vega_util_module["q" /* extent */])(data, fsize)).range(range);

      fontSize = x => sizeScale(fsize(x));
    }

    data.forEach(t => {
      t[as[0]] = NaN;
      t[as[1]] = NaN;
      t[as[3]] = 0;
    }); // configure layout

    const words = layout.words(data).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random(vega_statistics_module_random).layout();
    const size = layout.size(),
          dx = size[0] >> 1,
          dy = size[1] >> 1,
          n = words.length;

    for (let i = 0, w, t; i < n; ++i) {
      w = words[i];
      t = w.datum;
      t[as[0]] = w.x + dx;
      t[as[1]] = w.y + dy;
      t[as[2]] = w.font;
      t[as[3]] = w.size;
      t[as[4]] = w.style;
      t[as[5]] = w.weight;
      t[as[6]] = w.rotate;
    }

    return pulse.reflow(mod).modifies(as);
  }

});



// CONCATENATED MODULE: ./node_modules/d3-array/src/permute.js
/* harmony default export */ var permute = (function(source, keys) {
  return Array.from(keys, key => source[key]);
});

// CONCATENATED MODULE: ./node_modules/vega-crossfilter/build/vega-crossfilter.module.js




const array8 = n => new Uint8Array(n);
const array16 = n => new Uint16Array(n);
const array32 = n => new Uint32Array(n);

/**
 * Maintains CrossFilter state.
 */

function Bitmaps() {
  let width = 8,
      data = [],
      seen = array32(0),
      curr = vega_crossfilter_module_array(0, width),
      prev = vega_crossfilter_module_array(0, width);
  return {
    data: () => data,
    seen: () => seen = lengthen(seen, data.length),

    add(array) {
      for (let i = 0, j = data.length, n = array.length, t; i < n; ++i) {
        t = array[i];
        t._index = j++;
        data.push(t);
      }
    },

    remove(num, map) {
      // map: index -> boolean (true => remove)
      const n = data.length,
            copy = Array(n - num),
            reindex = data; // reuse old data array for index map

      let t, i, j; // seek forward to first removal

      for (i = 0; !map[i] && i < n; ++i) {
        copy[i] = data[i];
        reindex[i] = i;
      } // condense arrays


      for (j = i; i < n; ++i) {
        t = data[i];

        if (!map[i]) {
          reindex[i] = j;
          curr[j] = curr[i];
          prev[j] = prev[i];
          copy[j] = t;
          t._index = j++;
        } else {
          reindex[i] = -1;
        }

        curr[i] = 0; // clear unused bits
      }

      data = copy;
      return reindex;
    },

    size: () => data.length,
    curr: () => curr,
    prev: () => prev,
    reset: k => prev[k] = curr[k],
    all: () => width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff,

    set(k, one) {
      curr[k] |= one;
    },

    clear(k, one) {
      curr[k] &= ~one;
    },

    resize(n, m) {
      const k = curr.length;

      if (n > k || m > width) {
        width = Math.max(m, width);
        curr = vega_crossfilter_module_array(n, width, curr);
        prev = vega_crossfilter_module_array(n, width);
      }
    }

  };
}

function lengthen(array, length, copy) {
  if (array.length >= length) return array;
  copy = copy || new array.constructor(length);
  copy.set(array);
  return copy;
}

function vega_crossfilter_module_array(n, m, array) {
  const copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n);
  if (array) copy.set(array);
  return copy;
}

function Dimension (index, i, query) {
  const bit = 1 << i;
  return {
    one: bit,
    zero: ~bit,
    range: query.slice(),
    bisect: index.bisect,
    index: index.index,
    size: index.size,

    onAdd(added, curr) {
      const dim = this,
            range = dim.bisect(dim.range, added.value),
            idx = added.index,
            lo = range[0],
            hi = range[1],
            n1 = idx.length;
      let i;

      for (i = 0; i < lo; ++i) curr[idx[i]] |= bit;

      for (i = hi; i < n1; ++i) curr[idx[i]] |= bit;

      return dim;
    }

  };
}

/**
 * Maintains a list of values, sorted by key.
 */

function SortedIndex() {
  let index = array32(0),
      value = [],
      size = 0;

  function insert(key, data, base) {
    if (!data.length) return [];
    const n0 = size,
          n1 = data.length,
          addi = array32(n1);
    let addv = Array(n1),
        oldv,
        oldi,
        i;

    for (i = 0; i < n1; ++i) {
      addv[i] = key(data[i]);
      addi[i] = i;
    }

    addv = vega_crossfilter_module_sort(addv, addi);

    if (n0) {
      oldv = value;
      oldi = index;
      value = Array(n0 + n1);
      index = array32(n0 + n1);
      vega_crossfilter_module_merge(base, oldv, oldi, n0, addv, addi, n1, value, index);
    } else {
      if (base > 0) for (i = 0; i < n1; ++i) {
        addi[i] += base;
      }
      value = addv;
      index = addi;
    }

    size = n0 + n1;
    return {
      index: addi,
      value: addv
    };
  }

  function remove(num, map) {
    // map: index -> remove
    const n = size;
    let idx, i, j; // seek forward to first removal

    for (i = 0; !map[index[i]] && i < n; ++i); // condense index and value arrays


    for (j = i; i < n; ++i) {
      if (!map[idx = index[i]]) {
        index[j] = idx;
        value[j] = value[i];
        ++j;
      }
    }

    size = n - num;
  }

  function reindex(map) {
    for (let i = 0, n = size; i < n; ++i) {
      index[i] = map[index[i]];
    }
  }

  function bisect(range, array) {
    let n;

    if (array) {
      n = array.length;
    } else {
      array = value;
      n = size;
    }

    return [bisectLeft(array, range[0], 0, n), bisectRight(array, range[1], 0, n)];
  }

  return {
    insert: insert,
    remove: remove,
    bisect: bisect,
    reindex: reindex,
    index: () => index,
    size: () => size
  };
}

function vega_crossfilter_module_sort(values, index) {
  values.sort.call(index, (a, b) => {
    const x = values[a],
          y = values[b];
    return x < y ? -1 : x > y ? 1 : 0;
  });
  return permute(values, index);
}

function vega_crossfilter_module_merge(base, value0, index0, n0, value1, index1, n1, value, index) {
  let i0 = 0,
      i1 = 0,
      i;

  for (i = 0; i0 < n0 && i1 < n1; ++i) {
    if (value0[i0] < value1[i1]) {
      value[i] = value0[i0];
      index[i] = index0[i0++];
    } else {
      value[i] = value1[i1];
      index[i] = index1[i1++] + base;
    }
  }

  for (; i0 < n0; ++i0, ++i) {
    value[i] = value0[i0];
    index[i] = index0[i0];
  }

  for (; i1 < n1; ++i1, ++i) {
    value[i] = value1[i1];
    index[i] = index1[i1] + base;
  }
}

/**
 * An indexed multi-dimensional filter.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {Array<function(object): *>} params.fields - An array of dimension accessors to filter.
 * @param {Array} params.query - An array of per-dimension range queries.
 */

function CrossFilter(params) {
  Transform.call(this, Bitmaps(), params);
  this._indices = null;
  this._dims = null;
}
CrossFilter.Definition = {
  'type': 'CrossFilter',
  'metadata': {},
  'params': [{
    'name': 'fields',
    'type': 'field',
    'array': true,
    'required': true
  }, {
    'name': 'query',
    'type': 'array',
    'array': true,
    'required': true,
    'content': {
      'type': 'number',
      'array': true,
      'length': 2
    }
  }]
};
Object(vega_util_module["z" /* inherits */])(CrossFilter, Transform, {
  transform(_, pulse) {
    if (!this._dims) {
      return this.init(_, pulse);
    } else {
      var init = _.modified('fields') || _.fields.some(f => pulse.modified(f.fields));

      return init ? this.reinit(_, pulse) : this.eval(_, pulse);
    }
  },

  init(_, pulse) {
    const fields = _.fields,
          query = _.query,
          indices = this._indices = {},
          dims = this._dims = [],
          m = query.length;
    let i = 0,
        key,
        index; // instantiate indices and dimensions

    for (; i < m; ++i) {
      key = fields[i].fname;
      index = indices[key] || (indices[key] = SortedIndex());
      dims.push(Dimension(index, i, query[i]));
    }

    return this.eval(_, pulse);
  },

  reinit(_, pulse) {
    const output = pulse.materialize().fork(),
          fields = _.fields,
          query = _.query,
          indices = this._indices,
          dims = this._dims,
          bits = this.value,
          curr = bits.curr(),
          prev = bits.prev(),
          all = bits.all(),
          out = output.rem = output.add,
          mod = output.mod,
          m = query.length,
          adds = {};
    let add, index, key, mods, remMap, modMap, i, n, f; // set prev to current state

    prev.set(curr); // if pulse has remove tuples, process them first

    if (pulse.rem.length) {
      remMap = this.remove(_, pulse, output);
    } // if pulse has added tuples, add them to state


    if (pulse.add.length) {
      bits.add(pulse.add);
    } // if pulse has modified tuples, create an index map


    if (pulse.mod.length) {
      modMap = {};

      for (mods = pulse.mod, i = 0, n = mods.length; i < n; ++i) {
        modMap[mods[i]._index] = 1;
      }
    } // re-initialize indices as needed, update curr bitmap


    for (i = 0; i < m; ++i) {
      f = fields[i];

      if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) {
        key = f.fname;

        if (!(add = adds[key])) {
          indices[key] = index = SortedIndex();
          adds[key] = add = index.insert(f, pulse.source, 0);
        }

        dims[i] = Dimension(index, i, query[i]).onAdd(add, curr);
      }
    } // visit each tuple
    // if filter state changed, push index to add/rem
    // else if in mod and passes a filter, push index to mod


    for (i = 0, n = bits.data().length; i < n; ++i) {
      if (remMap[i]) {
        // skip if removed tuple
        continue;
      } else if (prev[i] !== curr[i]) {
        // add if state changed
        out.push(i);
      } else if (modMap[i] && curr[i] !== all) {
        // otherwise, pass mods through
        mod.push(i);
      }
    }

    bits.mask = (1 << m) - 1;
    return output;
  },

  eval(_, pulse) {
    const output = pulse.materialize().fork(),
          m = this._dims.length;
    let mask = 0;

    if (pulse.rem.length) {
      this.remove(_, pulse, output);
      mask |= (1 << m) - 1;
    }

    if (_.modified('query') && !_.modified('fields')) {
      mask |= this.update(_, pulse, output);
    }

    if (pulse.add.length) {
      this.insert(_, pulse, output);
      mask |= (1 << m) - 1;
    }

    if (pulse.mod.length) {
      this.modify(pulse, output);
      mask |= (1 << m) - 1;
    }

    this.value.mask = mask;
    return output;
  },

  insert(_, pulse, output) {
    const tuples = pulse.add,
          bits = this.value,
          dims = this._dims,
          indices = this._indices,
          fields = _.fields,
          adds = {},
          out = output.add,
          n = bits.size() + tuples.length,
          m = dims.length;
    let k = bits.size(),
        j,
        key,
        add; // resize bitmaps and add tuples as needed

    bits.resize(n, m);
    bits.add(tuples);
    const curr = bits.curr(),
          prev = bits.prev(),
          all = bits.all(); // add to dimensional indices

    for (j = 0; j < m; ++j) {
      key = fields[j].fname;
      add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k));
      dims[j].onAdd(add, curr);
    } // set previous filters, output if passes at least one filter


    for (; k < n; ++k) {
      prev[k] = all;
      if (curr[k] !== all) out.push(k);
    }
  },

  modify(pulse, output) {
    const out = output.mod,
          bits = this.value,
          curr = bits.curr(),
          all = bits.all(),
          tuples = pulse.mod;
    let i, n, k;

    for (i = 0, n = tuples.length; i < n; ++i) {
      k = tuples[i]._index;
      if (curr[k] !== all) out.push(k);
    }
  },

  remove(_, pulse, output) {
    const indices = this._indices,
          bits = this.value,
          curr = bits.curr(),
          prev = bits.prev(),
          all = bits.all(),
          map = {},
          out = output.rem,
          tuples = pulse.rem;
    let i, n, k, f; // process tuples, output if passes at least one filter

    for (i = 0, n = tuples.length; i < n; ++i) {
      k = tuples[i]._index;
      map[k] = 1; // build index map

      prev[k] = f = curr[k];
      curr[k] = all;
      if (f !== all) out.push(k);
    } // remove from dimensional indices


    for (k in indices) {
      indices[k].remove(n, map);
    }

    this.reindex(pulse, n, map);
    return map;
  },

  // reindex filters and indices after propagation completes
  reindex(pulse, num, map) {
    const indices = this._indices,
          bits = this.value;
    pulse.runAfter(() => {
      const indexMap = bits.remove(num, map);

      for (const key in indices) indices[key].reindex(indexMap);
    });
  },

  update(_, pulse, output) {
    const dims = this._dims,
          query = _.query,
          stamp = pulse.stamp,
          m = dims.length;
    let mask = 0,
        i,
        q; // survey how many queries have changed

    output.filters = 0;

    for (q = 0; q < m; ++q) {
      if (_.modified('query', q)) {
        i = q;
        ++mask;
      }
    }

    if (mask === 1) {
      // only one query changed, use more efficient update
      mask = dims[i].one;
      this.incrementOne(dims[i], query[i], output.add, output.rem);
    } else {
      // multiple queries changed, perform full record keeping
      for (q = 0, mask = 0; q < m; ++q) {
        if (!_.modified('query', q)) continue;
        mask |= dims[q].one;
        this.incrementAll(dims[q], query[q], stamp, output.add);
        output.rem = output.add; // duplicate add/rem for downstream resolve
      }
    }

    return mask;
  },

  incrementAll(dim, query, stamp, out) {
    const bits = this.value,
          seen = bits.seen(),
          curr = bits.curr(),
          prev = bits.prev(),
          index = dim.index(),
          old = dim.bisect(dim.range),
          range = dim.bisect(query),
          lo1 = range[0],
          hi1 = range[1],
          lo0 = old[0],
          hi0 = old[1],
          one = dim.one;
    let i, j, k; // Fast incremental update based on previous lo index.

    if (lo1 < lo0) {
      for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
        k = index[i];

        if (seen[k] !== stamp) {
          prev[k] = curr[k];
          seen[k] = stamp;
          out.push(k);
        }

        curr[k] ^= one;
      }
    } else if (lo1 > lo0) {
      for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
        k = index[i];

        if (seen[k] !== stamp) {
          prev[k] = curr[k];
          seen[k] = stamp;
          out.push(k);
        }

        curr[k] ^= one;
      }
    } // Fast incremental update based on previous hi index.


    if (hi1 > hi0) {
      for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
        k = index[i];

        if (seen[k] !== stamp) {
          prev[k] = curr[k];
          seen[k] = stamp;
          out.push(k);
        }

        curr[k] ^= one;
      }
    } else if (hi1 < hi0) {
      for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
        k = index[i];

        if (seen[k] !== stamp) {
          prev[k] = curr[k];
          seen[k] = stamp;
          out.push(k);
        }

        curr[k] ^= one;
      }
    }

    dim.range = query.slice();
  },

  incrementOne(dim, query, add, rem) {
    const bits = this.value,
          curr = bits.curr(),
          index = dim.index(),
          old = dim.bisect(dim.range),
          range = dim.bisect(query),
          lo1 = range[0],
          hi1 = range[1],
          lo0 = old[0],
          hi0 = old[1],
          one = dim.one;
    let i, j, k; // Fast incremental update based on previous lo index.

    if (lo1 < lo0) {
      for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
        k = index[i];
        curr[k] ^= one;
        add.push(k);
      }
    } else if (lo1 > lo0) {
      for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
        k = index[i];
        curr[k] ^= one;
        rem.push(k);
      }
    } // Fast incremental update based on previous hi index.


    if (hi1 > hi0) {
      for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
        k = index[i];
        curr[k] ^= one;
        add.push(k);
      }
    } else if (hi1 < hi0) {
      for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
        k = index[i];
        curr[k] ^= one;
        rem.push(k);
      }
    }

    dim.range = query.slice();
  }

});

/**
 * Selectively filters tuples by resolving against a filter bitmap.
 * Useful for processing the output of a cross-filter transform.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {object} params.ignore - A bit mask indicating which filters to ignore.
 * @param {object} params.filter - The per-tuple filter bitmaps. Typically this
 *   parameter value is a reference to a {@link CrossFilter} transform.
 */

function ResolveFilter(params) {
  Transform.call(this, null, params);
}
ResolveFilter.Definition = {
  'type': 'ResolveFilter',
  'metadata': {},
  'params': [{
    'name': 'ignore',
    'type': 'number',
    'required': true,
    'description': 'A bit mask indicating which filters to ignore.'
  }, {
    'name': 'filter',
    'type': 'object',
    'required': true,
    'description': 'Per-tuple filter bitmaps from a CrossFilter transform.'
  }]
};
Object(vega_util_module["z" /* inherits */])(ResolveFilter, Transform, {
  transform(_, pulse) {
    const ignore = ~(_.ignore || 0),
          // bit mask where zeros -> dims to ignore
    bitmap = _.filter,
          mask = bitmap.mask; // exit early if no relevant filter changes

    if ((mask & ignore) === 0) return pulse.StopPropagation;

    const output = pulse.fork(pulse.ALL),
          data = bitmap.data(),
          curr = bitmap.curr(),
          prev = bitmap.prev(),
          pass = k => !(curr[k] & ignore) ? data[k] : null; // propagate all mod tuples that pass the filter


    output.filter(output.MOD, pass); // determine add & rem tuples via filter functions
    // for efficiency, we do *not* populate new arrays,
    // instead we add filter functions applied downstream

    if (!(mask & mask - 1)) {
      // only one filter changed
      output.filter(output.ADD, pass);
      output.filter(output.REM, k => (curr[k] & ignore) === mask ? data[k] : null);
    } else {
      // multiple filters changed
      output.filter(output.ADD, k => {
        const c = curr[k] & ignore,
              f = !c && c ^ prev[k] & ignore;
        return f ? data[k] : null;
      });
      output.filter(output.REM, k => {
        const c = curr[k] & ignore,
              f = c && !(c ^ (c ^ prev[k] & ignore));
        return f ? data[k] : null;
      });
    } // add filter to source data in case of reflow...


    return output.filter(output.SOURCE, t => pass(t._index));
  }

});



// CONCATENATED MODULE: ./node_modules/vega-functions/node_modules/vega-expression/build/vega-expression.module.js


const RawCode = 'RawCode';
const Literal = 'Literal';
const Property = 'Property';
const vega_expression_module_Identifier = 'Identifier';
const ArrayExpression = 'ArrayExpression';
const BinaryExpression = 'BinaryExpression';
const vega_expression_module_CallExpression = 'CallExpression';
const ConditionalExpression = 'ConditionalExpression';
const LogicalExpression = 'LogicalExpression';
const MemberExpression = 'MemberExpression';
const ObjectExpression = 'ObjectExpression';
const UnaryExpression = 'UnaryExpression';
function ASTNode(type) {
  this.type = type;
}

ASTNode.prototype.visit = function (visitor) {
  let c, i, n;
  if (visitor(this)) return 1;

  for (c = vega_expression_module_children(this), i = 0, n = c.length; i < n; ++i) {
    if (c[i].visit(visitor)) return 1;
  }
};

function vega_expression_module_children(node) {
  switch (node.type) {
    case ArrayExpression:
      return node.elements;

    case BinaryExpression:
    case LogicalExpression:
      return [node.left, node.right];

    case vega_expression_module_CallExpression:
      return [node.callee].concat(node.arguments);

    case ConditionalExpression:
      return [node.test, node.consequent, node.alternate];

    case MemberExpression:
      return [node.object, node.property];

    case ObjectExpression:
      return node.properties;

    case Property:
      return [node.key, node.value];

    case UnaryExpression:
      return [node.argument];

    case vega_expression_module_Identifier:
    case Literal:
    case RawCode:
    default:
      return [];
  }
}

/*
  The following expression parser is based on Esprima (http://esprima.org/).
  Original header comment and license for Esprima is included here:

  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
  Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be>
  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
  Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
  Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
  Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
  Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
  Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var TokenName, vega_expression_module_source, vega_expression_module_index, vega_expression_module_length, lookahead;
var TokenBooleanLiteral = 1,
    TokenEOF = 2,
    TokenIdentifier = 3,
    TokenKeyword = 4,
    TokenNullLiteral = 5,
    TokenNumericLiteral = 6,
    TokenPunctuator = 7,
    TokenStringLiteral = 8,
    TokenRegularExpression = 9;
TokenName = {};
TokenName[TokenBooleanLiteral] = 'Boolean';
TokenName[TokenEOF] = '<end>';
TokenName[TokenIdentifier] = 'Identifier';
TokenName[TokenKeyword] = 'Keyword';
TokenName[TokenNullLiteral] = 'Null';
TokenName[TokenNumericLiteral] = 'Numeric';
TokenName[TokenPunctuator] = 'Punctuator';
TokenName[TokenStringLiteral] = 'String';
TokenName[TokenRegularExpression] = 'RegularExpression';
var SyntaxArrayExpression = 'ArrayExpression',
    SyntaxBinaryExpression = 'BinaryExpression',
    SyntaxCallExpression = 'CallExpression',
    SyntaxConditionalExpression = 'ConditionalExpression',
    SyntaxIdentifier = 'Identifier',
    SyntaxLiteral = 'Literal',
    SyntaxLogicalExpression = 'LogicalExpression',
    SyntaxMemberExpression = 'MemberExpression',
    SyntaxObjectExpression = 'ObjectExpression',
    SyntaxProperty = 'Property',
    SyntaxUnaryExpression = 'UnaryExpression'; // Error messages should be identical to V8.

var MessageUnexpectedToken = 'Unexpected token %0',
    MessageUnexpectedNumber = 'Unexpected number',
    MessageUnexpectedString = 'Unexpected string',
    MessageUnexpectedIdentifier = 'Unexpected identifier',
    MessageUnexpectedReserved = 'Unexpected reserved word',
    MessageUnexpectedEOS = 'Unexpected end of input',
    MessageInvalidRegExp = 'Invalid regular expression',
    MessageUnterminatedRegExp = 'Invalid regular expression: missing /',
    MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.',
    MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';
var ILLEGAL = 'ILLEGAL',
    DISABLED = 'Disabled.'; // See also tools/generate-unicode-regex.py.

var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'),
    // eslint-disable-next-line no-misleading-character-class
RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); // Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.

function assert(condition, message) {
  /* istanbul ignore next */
  if (!condition) {
    throw new Error('ASSERT: ' + message);
  }
}

function isDecimalDigit(ch) {
  return ch >= 0x30 && ch <= 0x39; // 0..9
}

function isHexDigit(ch) {
  return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
}

function isOctalDigit(ch) {
  return '01234567'.indexOf(ch) >= 0;
} // 7.2 White Space


function isWhiteSpace(ch) {
  return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0;
} // 7.3 Line Terminators


function isLineTerminator(ch) {
  return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
} // 7.6 Identifier Names and Identifiers


function isIdentifierStart(ch) {
  return ch === 0x24 || ch === 0x5F || ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A || ch === 0x5C || ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));
}

function isIdentifierPart(ch) {
  return ch === 0x24 || ch === 0x5F || ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A || ch >= 0x30 && ch <= 0x39 || ch === 0x5C || ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));
} // 7.6.1.1 Keywords


const keywords = {
  'if': 1,
  'in': 1,
  'do': 1,
  'var': 1,
  'for': 1,
  'new': 1,
  'try': 1,
  'let': 1,
  'this': 1,
  'else': 1,
  'case': 1,
  'void': 1,
  'with': 1,
  'enum': 1,
  'while': 1,
  'break': 1,
  'catch': 1,
  'throw': 1,
  'const': 1,
  'yield': 1,
  'class': 1,
  'super': 1,
  'return': 1,
  'typeof': 1,
  'delete': 1,
  'switch': 1,
  'export': 1,
  'import': 1,
  'public': 1,
  'static': 1,
  'default': 1,
  'finally': 1,
  'extends': 1,
  'package': 1,
  'private': 1,
  'function': 1,
  'continue': 1,
  'debugger': 1,
  'interface': 1,
  'protected': 1,
  'instanceof': 1,
  'implements': 1
};

function skipComment() {
  while (vega_expression_module_index < vega_expression_module_length) {
    const ch = vega_expression_module_source.charCodeAt(vega_expression_module_index);

    if (isWhiteSpace(ch) || isLineTerminator(ch)) {
      ++vega_expression_module_index;
    } else {
      break;
    }
  }
}

function scanHexEscape(prefix) {
  var i,
      len,
      ch,
      code = 0;
  len = prefix === 'u' ? 4 : 2;

  for (i = 0; i < len; ++i) {
    if (vega_expression_module_index < vega_expression_module_length && isHexDigit(vega_expression_module_source[vega_expression_module_index])) {
      ch = vega_expression_module_source[vega_expression_module_index++];
      code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
    } else {
      throwError({}, MessageUnexpectedToken, ILLEGAL);
    }
  }

  return String.fromCharCode(code);
}

function scanUnicodeCodePointEscape() {
  var ch, code, cu1, cu2;
  ch = vega_expression_module_source[vega_expression_module_index];
  code = 0; // At least, one hex digit is required.

  if (ch === '}') {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  while (vega_expression_module_index < vega_expression_module_length) {
    ch = vega_expression_module_source[vega_expression_module_index++];

    if (!isHexDigit(ch)) {
      break;
    }

    code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
  }

  if (code > 0x10FFFF || ch !== '}') {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  } // UTF-16 Encoding


  if (code <= 0xFFFF) {
    return String.fromCharCode(code);
  }

  cu1 = (code - 0x10000 >> 10) + 0xD800;
  cu2 = (code - 0x10000 & 1023) + 0xDC00;
  return String.fromCharCode(cu1, cu2);
}

function getEscapedIdentifier() {
  var ch, id;
  ch = vega_expression_module_source.charCodeAt(vega_expression_module_index++);
  id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.

  if (ch === 0x5C) {
    if (vega_expression_module_source.charCodeAt(vega_expression_module_index) !== 0x75) {
      throwError({}, MessageUnexpectedToken, ILLEGAL);
    }

    ++vega_expression_module_index;
    ch = scanHexEscape('u');

    if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
      throwError({}, MessageUnexpectedToken, ILLEGAL);
    }

    id = ch;
  }

  while (vega_expression_module_index < vega_expression_module_length) {
    ch = vega_expression_module_source.charCodeAt(vega_expression_module_index);

    if (!isIdentifierPart(ch)) {
      break;
    }

    ++vega_expression_module_index;
    id += String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.

    if (ch === 0x5C) {
      id = id.substr(0, id.length - 1);

      if (vega_expression_module_source.charCodeAt(vega_expression_module_index) !== 0x75) {
        throwError({}, MessageUnexpectedToken, ILLEGAL);
      }

      ++vega_expression_module_index;
      ch = scanHexEscape('u');

      if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
        throwError({}, MessageUnexpectedToken, ILLEGAL);
      }

      id += ch;
    }
  }

  return id;
}

function getIdentifier() {
  var start, ch;
  start = vega_expression_module_index++;

  while (vega_expression_module_index < vega_expression_module_length) {
    ch = vega_expression_module_source.charCodeAt(vega_expression_module_index);

    if (ch === 0x5C) {
      // Blackslash (U+005C) marks Unicode escape sequence.
      vega_expression_module_index = start;
      return getEscapedIdentifier();
    }

    if (isIdentifierPart(ch)) {
      ++vega_expression_module_index;
    } else {
      break;
    }
  }

  return vega_expression_module_source.slice(start, vega_expression_module_index);
}

function scanIdentifier() {
  var start, id, type;
  start = vega_expression_module_index; // Backslash (U+005C) starts an escaped character.

  id = vega_expression_module_source.charCodeAt(vega_expression_module_index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); // There is no keyword or literal with only one character.
  // Thus, it must be an identifier.

  if (id.length === 1) {
    type = TokenIdentifier;
  } else if (keywords.hasOwnProperty(id)) {
    // eslint-disable-line no-prototype-builtins
    type = TokenKeyword;
  } else if (id === 'null') {
    type = TokenNullLiteral;
  } else if (id === 'true' || id === 'false') {
    type = TokenBooleanLiteral;
  } else {
    type = TokenIdentifier;
  }

  return {
    type: type,
    value: id,
    start: start,
    end: vega_expression_module_index
  };
} // 7.7 Punctuators


function scanPunctuator() {
  var start = vega_expression_module_index,
      code = vega_expression_module_source.charCodeAt(vega_expression_module_index),
      code2,
      ch1 = vega_expression_module_source[vega_expression_module_index],
      ch2,
      ch3,
      ch4;

  switch (code) {
    // Check for most common single-character punctuators.
    case 0x2E: // . dot

    case 0x28: // ( open bracket

    case 0x29: // ) close bracket

    case 0x3B: // ; semicolon

    case 0x2C: // , comma

    case 0x7B: // { open curly brace

    case 0x7D: // } close curly brace

    case 0x5B: // [

    case 0x5D: // ]

    case 0x3A: // :

    case 0x3F: // ?

    case 0x7E:
      // ~
      ++vega_expression_module_index;
      return {
        type: TokenPunctuator,
        value: String.fromCharCode(code),
        start: start,
        end: vega_expression_module_index
      };

    default:
      code2 = vega_expression_module_source.charCodeAt(vega_expression_module_index + 1); // '=' (U+003D) marks an assignment or comparison operator.

      if (code2 === 0x3D) {
        switch (code) {
          case 0x2B: // +

          case 0x2D: // -

          case 0x2F: // /

          case 0x3C: // <

          case 0x3E: // >

          case 0x5E: // ^

          case 0x7C: // |

          case 0x25: // %

          case 0x26: // &

          case 0x2A:
            // *
            vega_expression_module_index += 2;
            return {
              type: TokenPunctuator,
              value: String.fromCharCode(code) + String.fromCharCode(code2),
              start: start,
              end: vega_expression_module_index
            };

          case 0x21: // !

          case 0x3D:
            // =
            vega_expression_module_index += 2; // !== and ===

            if (vega_expression_module_source.charCodeAt(vega_expression_module_index) === 0x3D) {
              ++vega_expression_module_index;
            }

            return {
              type: TokenPunctuator,
              value: vega_expression_module_source.slice(start, vega_expression_module_index),
              start: start,
              end: vega_expression_module_index
            };
        }
      }

  } // 4-character punctuator: >>>=


  ch4 = vega_expression_module_source.substr(vega_expression_module_index, 4);

  if (ch4 === '>>>=') {
    vega_expression_module_index += 4;
    return {
      type: TokenPunctuator,
      value: ch4,
      start: start,
      end: vega_expression_module_index
    };
  } // 3-character punctuators: === !== >>> <<= >>=


  ch3 = ch4.substr(0, 3);

  if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {
    vega_expression_module_index += 3;
    return {
      type: TokenPunctuator,
      value: ch3,
      start: start,
      end: vega_expression_module_index
    };
  } // Other 2-character punctuators: ++ -- << >> && ||


  ch2 = ch3.substr(0, 2);

  if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') {
    vega_expression_module_index += 2;
    return {
      type: TokenPunctuator,
      value: ch2,
      start: start,
      end: vega_expression_module_index
    };
  }

  if (ch2 === '//') {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  } // 1-character punctuators: < > = ! + - * % & | ^ /


  if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
    ++vega_expression_module_index;
    return {
      type: TokenPunctuator,
      value: ch1,
      start: start,
      end: vega_expression_module_index
    };
  }

  throwError({}, MessageUnexpectedToken, ILLEGAL);
} // 7.8.3 Numeric Literals


function scanHexLiteral(start) {
  let number = '';

  while (vega_expression_module_index < vega_expression_module_length) {
    if (!isHexDigit(vega_expression_module_source[vega_expression_module_index])) {
      break;
    }

    number += vega_expression_module_source[vega_expression_module_index++];
  }

  if (number.length === 0) {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  if (isIdentifierStart(vega_expression_module_source.charCodeAt(vega_expression_module_index))) {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  return {
    type: TokenNumericLiteral,
    value: parseInt('0x' + number, 16),
    start: start,
    end: vega_expression_module_index
  };
}

function scanOctalLiteral(start) {
  let number = '0' + vega_expression_module_source[vega_expression_module_index++];

  while (vega_expression_module_index < vega_expression_module_length) {
    if (!isOctalDigit(vega_expression_module_source[vega_expression_module_index])) {
      break;
    }

    number += vega_expression_module_source[vega_expression_module_index++];
  }

  if (isIdentifierStart(vega_expression_module_source.charCodeAt(vega_expression_module_index)) || isDecimalDigit(vega_expression_module_source.charCodeAt(vega_expression_module_index))) {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  return {
    type: TokenNumericLiteral,
    value: parseInt(number, 8),
    octal: true,
    start: start,
    end: vega_expression_module_index
  };
}

function scanNumericLiteral() {
  var number, start, ch;
  ch = vega_expression_module_source[vega_expression_module_index];
  assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point');
  start = vega_expression_module_index;
  number = '';

  if (ch !== '.') {
    number = vega_expression_module_source[vega_expression_module_index++];
    ch = vega_expression_module_source[vega_expression_module_index]; // Hex number starts with '0x'.
    // Octal number starts with '0'.

    if (number === '0') {
      if (ch === 'x' || ch === 'X') {
        ++vega_expression_module_index;
        return scanHexLiteral(start);
      }

      if (isOctalDigit(ch)) {
        return scanOctalLiteral(start);
      } // decimal number starts with '0' such as '09' is illegal.


      if (ch && isDecimalDigit(ch.charCodeAt(0))) {
        throwError({}, MessageUnexpectedToken, ILLEGAL);
      }
    }

    while (isDecimalDigit(vega_expression_module_source.charCodeAt(vega_expression_module_index))) {
      number += vega_expression_module_source[vega_expression_module_index++];
    }

    ch = vega_expression_module_source[vega_expression_module_index];
  }

  if (ch === '.') {
    number += vega_expression_module_source[vega_expression_module_index++];

    while (isDecimalDigit(vega_expression_module_source.charCodeAt(vega_expression_module_index))) {
      number += vega_expression_module_source[vega_expression_module_index++];
    }

    ch = vega_expression_module_source[vega_expression_module_index];
  }

  if (ch === 'e' || ch === 'E') {
    number += vega_expression_module_source[vega_expression_module_index++];
    ch = vega_expression_module_source[vega_expression_module_index];

    if (ch === '+' || ch === '-') {
      number += vega_expression_module_source[vega_expression_module_index++];
    }

    if (isDecimalDigit(vega_expression_module_source.charCodeAt(vega_expression_module_index))) {
      while (isDecimalDigit(vega_expression_module_source.charCodeAt(vega_expression_module_index))) {
        number += vega_expression_module_source[vega_expression_module_index++];
      }
    } else {
      throwError({}, MessageUnexpectedToken, ILLEGAL);
    }
  }

  if (isIdentifierStart(vega_expression_module_source.charCodeAt(vega_expression_module_index))) {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  return {
    type: TokenNumericLiteral,
    value: parseFloat(number),
    start: start,
    end: vega_expression_module_index
  };
} // 7.8.4 String Literals


function scanStringLiteral() {
  var str = '',
      quote,
      start,
      ch,
      code,
      octal = false;
  quote = vega_expression_module_source[vega_expression_module_index];
  assert(quote === '\'' || quote === '"', 'String literal must starts with a quote');
  start = vega_expression_module_index;
  ++vega_expression_module_index;

  while (vega_expression_module_index < vega_expression_module_length) {
    ch = vega_expression_module_source[vega_expression_module_index++];

    if (ch === quote) {
      quote = '';
      break;
    } else if (ch === '\\') {
      ch = vega_expression_module_source[vega_expression_module_index++];

      if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
        switch (ch) {
          case 'u':
          case 'x':
            if (vega_expression_module_source[vega_expression_module_index] === '{') {
              ++vega_expression_module_index;
              str += scanUnicodeCodePointEscape();
            } else {
              str += scanHexEscape(ch);
            }

            break;

          case 'n':
            str += '\n';
            break;

          case 'r':
            str += '\r';
            break;

          case 't':
            str += '\t';
            break;

          case 'b':
            str += '\b';
            break;

          case 'f':
            str += '\f';
            break;

          case 'v':
            str += '\x0B';
            break;

          default:
            if (isOctalDigit(ch)) {
              code = '01234567'.indexOf(ch); // \0 is not octal escape sequence

              if (code !== 0) {
                octal = true;
              }

              if (vega_expression_module_index < vega_expression_module_length && isOctalDigit(vega_expression_module_source[vega_expression_module_index])) {
                octal = true;
                code = code * 8 + '01234567'.indexOf(vega_expression_module_source[vega_expression_module_index++]); // 3 digits are only allowed when string starts
                // with 0, 1, 2, 3

                if ('0123'.indexOf(ch) >= 0 && vega_expression_module_index < vega_expression_module_length && isOctalDigit(vega_expression_module_source[vega_expression_module_index])) {
                  code = code * 8 + '01234567'.indexOf(vega_expression_module_source[vega_expression_module_index++]);
                }
              }

              str += String.fromCharCode(code);
            } else {
              str += ch;
            }

            break;
        }
      } else {
        if (ch === '\r' && vega_expression_module_source[vega_expression_module_index] === '\n') {
          ++vega_expression_module_index;
        }
      }
    } else if (isLineTerminator(ch.charCodeAt(0))) {
      break;
    } else {
      str += ch;
    }
  }

  if (quote !== '') {
    throwError({}, MessageUnexpectedToken, ILLEGAL);
  }

  return {
    type: TokenStringLiteral,
    value: str,
    octal: octal,
    start: start,
    end: vega_expression_module_index
  };
}

function testRegExp(pattern, flags) {
  let tmp = pattern;

  if (flags.indexOf('u') >= 0) {
    // Replace each astral symbol and every Unicode code point
    // escape sequence with a single ASCII symbol to avoid throwing on
    // regular expressions that are only valid in combination with the
    // `/u` flag.
    // Note: replacing with the ASCII symbol `x` might cause false
    // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
    // perfectly valid pattern that is equivalent to `[a-b]`, but it
    // would be replaced by `[x-b]` which throws an error.
    tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1) => {
      if (parseInt($1, 16) <= 0x10FFFF) {
        return 'x';
      }

      throwError({}, MessageInvalidRegExp);
    }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
  } // First, detect invalid regular expressions.


  try {
    new RegExp(tmp);
  } catch (e) {
    throwError({}, MessageInvalidRegExp);
  } // Return a regular expression object for this pattern-flag pair, or
  // `null` in case the current environment doesn't support the flags it
  // uses.


  try {
    return new RegExp(pattern, flags);
  } catch (exception) {
    return null;
  }
}

function scanRegExpBody() {
  var ch, str, classMarker, terminated, body;
  ch = vega_expression_module_source[vega_expression_module_index];
  assert(ch === '/', 'Regular expression literal must start with a slash');
  str = vega_expression_module_source[vega_expression_module_index++];
  classMarker = false;
  terminated = false;

  while (vega_expression_module_index < vega_expression_module_length) {
    ch = vega_expression_module_source[vega_expression_module_index++];
    str += ch;

    if (ch === '\\') {
      ch = vega_expression_module_source[vega_expression_module_index++]; // ECMA-262 7.8.5

      if (isLineTerminator(ch.charCodeAt(0))) {
        throwError({}, MessageUnterminatedRegExp);
      }

      str += ch;
    } else if (isLineTerminator(ch.charCodeAt(0))) {
      throwError({}, MessageUnterminatedRegExp);
    } else if (classMarker) {
      if (ch === ']') {
        classMarker = false;
      }
    } else {
      if (ch === '/') {
        terminated = true;
        break;
      } else if (ch === '[') {
        classMarker = true;
      }
    }
  }

  if (!terminated) {
    throwError({}, MessageUnterminatedRegExp);
  } // Exclude leading and trailing slash.


  body = str.substr(1, str.length - 2);
  return {
    value: body,
    literal: str
  };
}

function scanRegExpFlags() {
  var ch, str, flags;
  str = '';
  flags = '';

  while (vega_expression_module_index < vega_expression_module_length) {
    ch = vega_expression_module_source[vega_expression_module_index];

    if (!isIdentifierPart(ch.charCodeAt(0))) {
      break;
    }

    ++vega_expression_module_index;

    if (ch === '\\' && vega_expression_module_index < vega_expression_module_length) {
      throwError({}, MessageUnexpectedToken, ILLEGAL);
    } else {
      flags += ch;
      str += ch;
    }
  }

  if (flags.search(/[^gimuy]/g) >= 0) {
    throwError({}, MessageInvalidRegExp, flags);
  }

  return {
    value: flags,
    literal: str
  };
}

function scanRegExp() {
  var start, body, flags, value;
  lookahead = null;
  skipComment();
  start = vega_expression_module_index;
  body = scanRegExpBody();
  flags = scanRegExpFlags();
  value = testRegExp(body.value, flags.value);
  return {
    literal: body.literal + flags.literal,
    value: value,
    regex: {
      pattern: body.value,
      flags: flags.value
    },
    start: start,
    end: vega_expression_module_index
  };
}

function isIdentifierName(token) {
  return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral;
}

function advance() {
  skipComment();

  if (vega_expression_module_index >= vega_expression_module_length) {
    return {
      type: TokenEOF,
      start: vega_expression_module_index,
      end: vega_expression_module_index
    };
  }

  const ch = vega_expression_module_source.charCodeAt(vega_expression_module_index);

  if (isIdentifierStart(ch)) {
    return scanIdentifier();
  } // Very common: ( and ) and ;


  if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {
    return scanPunctuator();
  } // String literal starts with single quote (U+0027) or double quote (U+0022).


  if (ch === 0x27 || ch === 0x22) {
    return scanStringLiteral();
  } // Dot (.) U+002E can also start a floating-point number, hence the need
  // to check the next character.


  if (ch === 0x2E) {
    if (isDecimalDigit(vega_expression_module_source.charCodeAt(vega_expression_module_index + 1))) {
      return scanNumericLiteral();
    }

    return scanPunctuator();
  }

  if (isDecimalDigit(ch)) {
    return scanNumericLiteral();
  }

  return scanPunctuator();
}

function lex() {
  const token = lookahead;
  vega_expression_module_index = token.end;
  lookahead = advance();
  vega_expression_module_index = token.end;
  return token;
}

function peek() {
  const pos = vega_expression_module_index;
  lookahead = advance();
  vega_expression_module_index = pos;
}

function finishArrayExpression(elements) {
  const node = new ASTNode(SyntaxArrayExpression);
  node.elements = elements;
  return node;
}

function finishBinaryExpression(operator, left, right) {
  const node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression);
  node.operator = operator;
  node.left = left;
  node.right = right;
  return node;
}

function finishCallExpression(callee, args) {
  const node = new ASTNode(SyntaxCallExpression);
  node.callee = callee;
  node.arguments = args;
  return node;
}

function finishConditionalExpression(test, consequent, alternate) {
  const node = new ASTNode(SyntaxConditionalExpression);
  node.test = test;
  node.consequent = consequent;
  node.alternate = alternate;
  return node;
}

function finishIdentifier(name) {
  const node = new ASTNode(SyntaxIdentifier);
  node.name = name;
  return node;
}

function finishLiteral(token) {
  const node = new ASTNode(SyntaxLiteral);
  node.value = token.value;
  node.raw = vega_expression_module_source.slice(token.start, token.end);

  if (token.regex) {
    if (node.raw === '//') {
      node.raw = '/(?:)/';
    }

    node.regex = token.regex;
  }

  return node;
}

function finishMemberExpression(accessor, object, property) {
  const node = new ASTNode(SyntaxMemberExpression);
  node.computed = accessor === '[';
  node.object = object;
  node.property = property;
  if (!node.computed) property.member = true;
  return node;
}

function finishObjectExpression(properties) {
  const node = new ASTNode(SyntaxObjectExpression);
  node.properties = properties;
  return node;
}

function finishProperty(kind, key, value) {
  const node = new ASTNode(SyntaxProperty);
  node.key = key;
  node.value = value;
  node.kind = kind;
  return node;
}

function finishUnaryExpression(operator, argument) {
  const node = new ASTNode(SyntaxUnaryExpression);
  node.operator = operator;
  node.argument = argument;
  node.prefix = true;
  return node;
} // Throw an exception


function throwError(token, messageFormat) {
  var error,
      args = Array.prototype.slice.call(arguments, 2),
      msg = messageFormat.replace(/%(\d)/g, (whole, index) => {
    assert(index < args.length, 'Message reference must be in range');
    return args[index];
  });
  error = new Error(msg);
  error.index = vega_expression_module_index;
  error.description = msg;
  throw error;
} // Throw an exception because of the token.


function throwUnexpected(token) {
  if (token.type === TokenEOF) {
    throwError(token, MessageUnexpectedEOS);
  }

  if (token.type === TokenNumericLiteral) {
    throwError(token, MessageUnexpectedNumber);
  }

  if (token.type === TokenStringLiteral) {
    throwError(token, MessageUnexpectedString);
  }

  if (token.type === TokenIdentifier) {
    throwError(token, MessageUnexpectedIdentifier);
  }

  if (token.type === TokenKeyword) {
    throwError(token, MessageUnexpectedReserved);
  } // BooleanLiteral, NullLiteral, or Punctuator.


  throwError(token, MessageUnexpectedToken, token.value);
} // Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.


function expect(value) {
  const token = lex();

  if (token.type !== TokenPunctuator || token.value !== value) {
    throwUnexpected(token);
  }
} // Return true if the next token matches the specified punctuator.


function match(value) {
  return lookahead.type === TokenPunctuator && lookahead.value === value;
} // Return true if the next token matches the specified keyword


function matchKeyword(keyword) {
  return lookahead.type === TokenKeyword && lookahead.value === keyword;
} // 11.1.4 Array Initialiser


function parseArrayInitialiser() {
  const elements = [];
  vega_expression_module_index = lookahead.start;
  expect('[');

  while (!match(']')) {
    if (match(',')) {
      lex();
      elements.push(null);
    } else {
      elements.push(parseConditionalExpression());

      if (!match(']')) {
        expect(',');
      }
    }
  }

  lex();
  return finishArrayExpression(elements);
} // 11.1.5 Object Initialiser


function parseObjectPropertyKey() {
  vega_expression_module_index = lookahead.start;
  const token = lex(); // Note: This function is called only from parseObjectProperty(), where
  // EOF and Punctuator tokens are already filtered out.

  if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) {
    if (token.octal) {
      throwError(token, MessageStrictOctalLiteral);
    }

    return finishLiteral(token);
  }

  return finishIdentifier(token.value);
}

function parseObjectProperty() {
  var token, key, id, value;
  vega_expression_module_index = lookahead.start;
  token = lookahead;

  if (token.type === TokenIdentifier) {
    id = parseObjectPropertyKey();
    expect(':');
    value = parseConditionalExpression();
    return finishProperty('init', id, value);
  }

  if (token.type === TokenEOF || token.type === TokenPunctuator) {
    throwUnexpected(token);
  } else {
    key = parseObjectPropertyKey();
    expect(':');
    value = parseConditionalExpression();
    return finishProperty('init', key, value);
  }
}

function parseObjectInitialiser() {
  var properties = [],
      property,
      name,
      key,
      map = {},
      toString = String;
  vega_expression_module_index = lookahead.start;
  expect('{');

  while (!match('}')) {
    property = parseObjectProperty();

    if (property.key.type === SyntaxIdentifier) {
      name = property.key.name;
    } else {
      name = toString(property.key.value);
    }

    key = '$' + name;

    if (Object.prototype.hasOwnProperty.call(map, key)) {
      throwError({}, MessageStrictDuplicateProperty);
    } else {
      map[key] = true;
    }

    properties.push(property);

    if (!match('}')) {
      expect(',');
    }
  }

  expect('}');
  return finishObjectExpression(properties);
} // 11.1.6 The Grouping Operator


function parseGroupExpression() {
  expect('(');
  const expr = parseExpression();
  expect(')');
  return expr;
} // 11.1 Primary Expressions


const legalKeywords = {
  'if': 1
};

function parsePrimaryExpression() {
  var type, token, expr;

  if (match('(')) {
    return parseGroupExpression();
  }

  if (match('[')) {
    return parseArrayInitialiser();
  }

  if (match('{')) {
    return parseObjectInitialiser();
  }

  type = lookahead.type;
  vega_expression_module_index = lookahead.start;

  if (type === TokenIdentifier || legalKeywords[lookahead.value]) {
    expr = finishIdentifier(lex().value);
  } else if (type === TokenStringLiteral || type === TokenNumericLiteral) {
    if (lookahead.octal) {
      throwError(lookahead, MessageStrictOctalLiteral);
    }

    expr = finishLiteral(lex());
  } else if (type === TokenKeyword) {
    throw new Error(DISABLED);
  } else if (type === TokenBooleanLiteral) {
    token = lex();
    token.value = token.value === 'true';
    expr = finishLiteral(token);
  } else if (type === TokenNullLiteral) {
    token = lex();
    token.value = null;
    expr = finishLiteral(token);
  } else if (match('/') || match('/=')) {
    expr = finishLiteral(scanRegExp());
    peek();
  } else {
    throwUnexpected(lex());
  }

  return expr;
} // 11.2 Left-Hand-Side Expressions


function parseArguments() {
  const args = [];
  expect('(');

  if (!match(')')) {
    while (vega_expression_module_index < vega_expression_module_length) {
      args.push(parseConditionalExpression());

      if (match(')')) {
        break;
      }

      expect(',');
    }
  }

  expect(')');
  return args;
}

function parseNonComputedProperty() {
  vega_expression_module_index = lookahead.start;
  const token = lex();

  if (!isIdentifierName(token)) {
    throwUnexpected(token);
  }

  return finishIdentifier(token.value);
}

function parseNonComputedMember() {
  expect('.');
  return parseNonComputedProperty();
}

function parseComputedMember() {
  expect('[');
  const expr = parseExpression();
  expect(']');
  return expr;
}

function parseLeftHandSideExpressionAllowCall() {
  var expr, args, property;
  expr = parsePrimaryExpression();

  for (;;) {
    if (match('.')) {
      property = parseNonComputedMember();
      expr = finishMemberExpression('.', expr, property);
    } else if (match('(')) {
      args = parseArguments();
      expr = finishCallExpression(expr, args);
    } else if (match('[')) {
      property = parseComputedMember();
      expr = finishMemberExpression('[', expr, property);
    } else {
      break;
    }
  }

  return expr;
} // 11.3 Postfix Expressions


function parsePostfixExpression() {
  const expr = parseLeftHandSideExpressionAllowCall();

  if (lookahead.type === TokenPunctuator) {
    if (match('++') || match('--')) {
      throw new Error(DISABLED);
    }
  }

  return expr;
} // 11.4 Unary Operators


function parseUnaryExpression() {
  var token, expr;

  if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) {
    expr = parsePostfixExpression();
  } else if (match('++') || match('--')) {
    throw new Error(DISABLED);
  } else if (match('+') || match('-') || match('~') || match('!')) {
    token = lex();
    expr = parseUnaryExpression();
    expr = finishUnaryExpression(token.value, expr);
  } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
    throw new Error(DISABLED);
  } else {
    expr = parsePostfixExpression();
  }

  return expr;
}

function binaryPrecedence(token) {
  let prec = 0;

  if (token.type !== TokenPunctuator && token.type !== TokenKeyword) {
    return 0;
  }

  switch (token.value) {
    case '||':
      prec = 1;
      break;

    case '&&':
      prec = 2;
      break;

    case '|':
      prec = 3;
      break;

    case '^':
      prec = 4;
      break;

    case '&':
      prec = 5;
      break;

    case '==':
    case '!=':
    case '===':
    case '!==':
      prec = 6;
      break;

    case '<':
    case '>':
    case '<=':
    case '>=':
    case 'instanceof':
    case 'in':
      prec = 7;
      break;

    case '<<':
    case '>>':
    case '>>>':
      prec = 8;
      break;

    case '+':
    case '-':
      prec = 9;
      break;

    case '*':
    case '/':
    case '%':
      prec = 11;
      break;
  }

  return prec;
} // 11.5 Multiplicative Operators
// 11.6 Additive Operators
// 11.7 Bitwise Shift Operators
// 11.8 Relational Operators
// 11.9 Equality Operators
// 11.10 Binary Bitwise Operators
// 11.11 Binary Logical Operators


function parseBinaryExpression() {
  var marker, markers, expr, token, prec, stack, right, operator, left, i;
  marker = lookahead;
  left = parseUnaryExpression();
  token = lookahead;
  prec = binaryPrecedence(token);

  if (prec === 0) {
    return left;
  }

  token.prec = prec;
  lex();
  markers = [marker, lookahead];
  right = parseUnaryExpression();
  stack = [left, token, right];

  while ((prec = binaryPrecedence(lookahead)) > 0) {
    // Reduce: make a binary expression from the three topmost entries.
    while (stack.length > 2 && prec <= stack[stack.length - 2].prec) {
      right = stack.pop();
      operator = stack.pop().value;
      left = stack.pop();
      markers.pop();
      expr = finishBinaryExpression(operator, left, right);
      stack.push(expr);
    } // Shift.


    token = lex();
    token.prec = prec;
    stack.push(token);
    markers.push(lookahead);
    expr = parseUnaryExpression();
    stack.push(expr);
  } // Final reduce to clean-up the stack.


  i = stack.length - 1;
  expr = stack[i];
  markers.pop();

  while (i > 1) {
    markers.pop();
    expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
    i -= 2;
  }

  return expr;
} // 11.12 Conditional Operator


function parseConditionalExpression() {
  var expr, consequent, alternate;
  expr = parseBinaryExpression();

  if (match('?')) {
    lex();
    consequent = parseConditionalExpression();
    expect(':');
    alternate = parseConditionalExpression();
    expr = finishConditionalExpression(expr, consequent, alternate);
  }

  return expr;
} // 11.14 Comma Operator


function parseExpression() {
  const expr = parseConditionalExpression();

  if (match(',')) {
    throw new Error(DISABLED); // no sequence expressions
  }

  return expr;
}

function parser (code) {
  vega_expression_module_source = code;
  vega_expression_module_index = 0;
  vega_expression_module_length = vega_expression_module_source.length;
  lookahead = null;
  peek();
  const expr = parseExpression();

  if (lookahead.type !== TokenEOF) {
    throw new Error('Unexpect token after expression.');
  }

  return expr;
}

var Constants = {
  NaN: 'NaN',
  E: 'Math.E',
  LN2: 'Math.LN2',
  LN10: 'Math.LN10',
  LOG2E: 'Math.LOG2E',
  LOG10E: 'Math.LOG10E',
  PI: 'Math.PI',
  SQRT1_2: 'Math.SQRT1_2',
  SQRT2: 'Math.SQRT2',
  MIN_VALUE: 'Number.MIN_VALUE',
  MAX_VALUE: 'Number.MAX_VALUE'
};

function Functions (codegen) {
  function fncall(name, args, cast, type) {
    let obj = codegen(args[0]);

    if (cast) {
      obj = cast + '(' + obj + ')';
      if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';
    }

    return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')');
  }

  function fn(name, cast, type) {
    return args => fncall(name, args, cast, type);
  }

  const DATE = 'new Date',
        STRING = 'String',
        REGEXP = 'RegExp';
  return {
    // MATH functions
    isNaN: 'Number.isNaN',
    isFinite: 'Number.isFinite',
    abs: 'Math.abs',
    acos: 'Math.acos',
    asin: 'Math.asin',
    atan: 'Math.atan',
    atan2: 'Math.atan2',
    ceil: 'Math.ceil',
    cos: 'Math.cos',
    exp: 'Math.exp',
    floor: 'Math.floor',
    log: 'Math.log',
    max: 'Math.max',
    min: 'Math.min',
    pow: 'Math.pow',
    random: 'Math.random',
    round: 'Math.round',
    sin: 'Math.sin',
    sqrt: 'Math.sqrt',
    tan: 'Math.tan',
    clamp: function (args) {
      if (args.length < 3) Object(vega_util_module["o" /* error */])('Missing arguments to clamp function.');
      if (args.length > 3) Object(vega_util_module["o" /* error */])('Too many arguments to clamp function.');
      const a = args.map(codegen);
      return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))';
    },
    // DATE functions
    now: 'Date.now',
    utc: 'Date.UTC',
    datetime: DATE,
    date: fn('getDate', DATE, 0),
    day: fn('getDay', DATE, 0),
    year: fn('getFullYear', DATE, 0),
    month: fn('getMonth', DATE, 0),
    hours: fn('getHours', DATE, 0),
    minutes: fn('getMinutes', DATE, 0),
    seconds: fn('getSeconds', DATE, 0),
    milliseconds: fn('getMilliseconds', DATE, 0),
    time: fn('getTime', DATE, 0),
    timezoneoffset: fn('getTimezoneOffset', DATE, 0),
    utcdate: fn('getUTCDate', DATE, 0),
    utcday: fn('getUTCDay', DATE, 0),
    utcyear: fn('getUTCFullYear', DATE, 0),
    utcmonth: fn('getUTCMonth', DATE, 0),
    utchours: fn('getUTCHours', DATE, 0),
    utcminutes: fn('getUTCMinutes', DATE, 0),
    utcseconds: fn('getUTCSeconds', DATE, 0),
    utcmilliseconds: fn('getUTCMilliseconds', DATE, 0),
    // sequence functions
    length: fn('length', null, -1),
    // STRING functions
    parseFloat: 'parseFloat',
    parseInt: 'parseInt',
    upper: fn('toUpperCase', STRING, 0),
    lower: fn('toLowerCase', STRING, 0),
    substring: fn('substring', STRING),
    split: fn('split', STRING),
    trim: fn('trim', STRING, 0),
    // REGEXP functions
    regexp: REGEXP,
    test: fn('test', REGEXP),
    // Control Flow functions
    if: function (args) {
      if (args.length < 3) Object(vega_util_module["o" /* error */])('Missing arguments to if function.');
      if (args.length > 3) Object(vega_util_module["o" /* error */])('Too many arguments to if function.');
      const a = args.map(codegen);
      return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')';
    }
  };
}

function stripQuotes(s) {
  const n = s && s.length - 1;
  return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s;
}

function vega_expression_module_codegen (opt) {
  opt = opt || {};
  const allowed = opt.allowed ? Object(vega_util_module["fb" /* toSet */])(opt.allowed) : {},
        forbidden = opt.forbidden ? Object(vega_util_module["fb" /* toSet */])(opt.forbidden) : {},
        constants = opt.constants || Constants,
        functions = (opt.functions || Functions)(visit),
        globalvar = opt.globalvar,
        fieldvar = opt.fieldvar,
        outputGlobal = Object(vega_util_module["E" /* isFunction */])(globalvar) ? globalvar : id => `${globalvar}["${id}"]`;
  let globals = {},
      fields = {},
      memberDepth = 0;

  function visit(ast) {
    if (Object(vega_util_module["J" /* isString */])(ast)) return ast;
    const generator = Generators[ast.type];
    if (generator == null) Object(vega_util_module["o" /* error */])('Unsupported type: ' + ast.type);
    return generator(ast);
  }

  const Generators = {
    Literal: n => n.raw,
    Identifier: n => {
      const id = n.name;

      if (memberDepth > 0) {
        return id;
      } else if (Object(vega_util_module["w" /* hasOwnProperty */])(forbidden, id)) {
        return Object(vega_util_module["o" /* error */])('Illegal identifier: ' + id);
      } else if (Object(vega_util_module["w" /* hasOwnProperty */])(constants, id)) {
        return constants[id];
      } else if (Object(vega_util_module["w" /* hasOwnProperty */])(allowed, id)) {
        return id;
      } else {
        globals[id] = 1;
        return outputGlobal(id);
      }
    },
    MemberExpression: n => {
      const d = !n.computed,
            o = visit(n.object);
      if (d) memberDepth += 1;
      const p = visit(n.property);

      if (o === fieldvar) {
        // strip quotes to sanitize field name (#1653)
        fields[stripQuotes(p)] = 1;
      }

      if (d) memberDepth -= 1;
      return o + (d ? '.' + p : '[' + p + ']');
    },
    CallExpression: n => {
      if (n.callee.type !== 'Identifier') {
        Object(vega_util_module["o" /* error */])('Illegal callee type: ' + n.callee.type);
      }

      const callee = n.callee.name,
            args = n.arguments,
            fn = Object(vega_util_module["w" /* hasOwnProperty */])(functions, callee) && functions[callee];
      if (!fn) Object(vega_util_module["o" /* error */])('Unrecognized function: ' + callee);
      return Object(vega_util_module["E" /* isFunction */])(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')';
    },
    ArrayExpression: n => '[' + n.elements.map(visit).join(',') + ']',
    BinaryExpression: n => '(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')',
    UnaryExpression: n => '(' + n.operator + visit(n.argument) + ')',
    ConditionalExpression: n => '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')',
    LogicalExpression: n => '(' + visit(n.left) + n.operator + visit(n.right) + ')',
    ObjectExpression: n => '{' + n.properties.map(visit).join(',') + '}',
    Property: n => {
      memberDepth += 1;
      const k = visit(n.key);
      memberDepth -= 1;
      return k + ':' + visit(n.value);
    }
  };

  function codegen(ast) {
    const result = {
      code: visit(ast),
      globals: Object.keys(globals),
      fields: Object.keys(fields)
    };
    globals = {};
    fields = {};
    return result;
  }

  codegen.functions = functions;
  codegen.constants = constants;
  return codegen;
}



// CONCATENATED MODULE: ./node_modules/d3-geo/src/area.js





var area_areaRingSum = new Adder();

// hello?

var area_areaSum = new Adder(),
    area_lambda00,
    phi00,
    area_lambda0,
    area_cosPhi0,
    area_sinPhi0;

var area_areaStream = {
  point: noop_noop,
  lineStart: noop_noop,
  lineEnd: noop_noop,
  polygonStart: function() {
    area_areaRingSum = new Adder();
    area_areaStream.lineStart = area_areaRingStart;
    area_areaStream.lineEnd = area_areaRingEnd;
  },
  polygonEnd: function() {
    var areaRing = +area_areaRingSum;
    area_areaSum.add(areaRing < 0 ? math_tau + areaRing : areaRing);
    this.lineStart = this.lineEnd = this.point = noop_noop;
  },
  sphere: function() {
    area_areaSum.add(math_tau);
  }
};

function area_areaRingStart() {
  area_areaStream.point = area_areaPointFirst;
}

function area_areaRingEnd() {
  area_areaPoint(area_lambda00, phi00);
}

function area_areaPointFirst(lambda, phi) {
  area_areaStream.point = area_areaPoint;
  area_lambda00 = lambda, phi00 = phi;
  lambda *= math_radians, phi *= math_radians;
  area_lambda0 = lambda, area_cosPhi0 = math_cos(phi = phi / 2 + quarterPi), area_sinPhi0 = math_sin(phi);
}

function area_areaPoint(lambda, phi) {
  lambda *= math_radians, phi *= math_radians;
  phi = phi / 2 + quarterPi; // half the angular distance from south pole

  // Spherical excess E for a spherical triangle with vertices: south pole,
  // previous point, current point.  Uses a formula derived from Cagnoli’s
  // theorem.  See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).
  var dLambda = lambda - area_lambda0,
      sdLambda = dLambda >= 0 ? 1 : -1,
      adLambda = sdLambda * dLambda,
      cosPhi = math_cos(phi),
      sinPhi = math_sin(phi),
      k = area_sinPhi0 * sinPhi,
      u = area_cosPhi0 * cosPhi + k * math_cos(adLambda),
      v = k * sdLambda * math_sin(adLambda);
  area_areaRingSum.add(math_atan2(v, u));

  // Advance the previous points.
  area_lambda0 = lambda, area_cosPhi0 = cosPhi, area_sinPhi0 = sinPhi;
}

/* harmony default export */ var d3_geo_src_area = (function(object) {
  area_areaSum = new Adder();
  src_stream(object, area_areaStream);
  return area_areaSum * 2;
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/bounds.js






var bounds_lambda0, bounds_phi0, bounds_lambda1, bounds_phi1, // bounds
    bounds_lambda2, // previous lambda-coordinate
    bounds_lambda00, bounds_phi00, // first point
    bounds_p0, // previous 3D point
    deltaSum,
    ranges,
    bounds_range;

var bounds_boundsStream = {
  point: bounds_boundsPoint,
  lineStart: boundsLineStart,
  lineEnd: boundsLineEnd,
  polygonStart: function() {
    bounds_boundsStream.point = boundsRingPoint;
    bounds_boundsStream.lineStart = boundsRingStart;
    bounds_boundsStream.lineEnd = boundsRingEnd;
    deltaSum = new Adder();
    area_areaStream.polygonStart();
  },
  polygonEnd: function() {
    area_areaStream.polygonEnd();
    bounds_boundsStream.point = bounds_boundsPoint;
    bounds_boundsStream.lineStart = boundsLineStart;
    bounds_boundsStream.lineEnd = boundsLineEnd;
    if (area_areaRingSum < 0) bounds_lambda0 = -(bounds_lambda1 = 180), bounds_phi0 = -(bounds_phi1 = 90);
    else if (deltaSum > src_math_epsilon) bounds_phi1 = 90;
    else if (deltaSum < -src_math_epsilon) bounds_phi0 = -90;
    bounds_range[0] = bounds_lambda0, bounds_range[1] = bounds_lambda1;
  },
  sphere: function() {
    bounds_lambda0 = -(bounds_lambda1 = 180), bounds_phi0 = -(bounds_phi1 = 90);
  }
};

function bounds_boundsPoint(lambda, phi) {
  ranges.push(bounds_range = [bounds_lambda0 = lambda, bounds_lambda1 = lambda]);
  if (phi < bounds_phi0) bounds_phi0 = phi;
  if (phi > bounds_phi1) bounds_phi1 = phi;
}

function bounds_linePoint(lambda, phi) {
  var p = cartesian_cartesian([lambda * math_radians, phi * math_radians]);
  if (bounds_p0) {
    var normal = cartesianCross(bounds_p0, p),
        equatorial = [normal[1], -normal[0], 0],
        inflection = cartesianCross(equatorial, normal);
    cartesianNormalizeInPlace(inflection);
    inflection = cartesian_spherical(inflection);
    var delta = lambda - bounds_lambda2,
        sign = delta > 0 ? 1 : -1,
        lambdai = inflection[0] * src_math_degrees * sign,
        phii,
        antimeridian = math_abs(delta) > 180;
    if (antimeridian ^ (sign * bounds_lambda2 < lambdai && lambdai < sign * lambda)) {
      phii = inflection[1] * src_math_degrees;
      if (phii > bounds_phi1) bounds_phi1 = phii;
    } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * bounds_lambda2 < lambdai && lambdai < sign * lambda)) {
      phii = -inflection[1] * src_math_degrees;
      if (phii < bounds_phi0) bounds_phi0 = phii;
    } else {
      if (phi < bounds_phi0) bounds_phi0 = phi;
      if (phi > bounds_phi1) bounds_phi1 = phi;
    }
    if (antimeridian) {
      if (lambda < bounds_lambda2) {
        if (bounds_angle(bounds_lambda0, lambda) > bounds_angle(bounds_lambda0, bounds_lambda1)) bounds_lambda1 = lambda;
      } else {
        if (bounds_angle(lambda, bounds_lambda1) > bounds_angle(bounds_lambda0, bounds_lambda1)) bounds_lambda0 = lambda;
      }
    } else {
      if (bounds_lambda1 >= bounds_lambda0) {
        if (lambda < bounds_lambda0) bounds_lambda0 = lambda;
        if (lambda > bounds_lambda1) bounds_lambda1 = lambda;
      } else {
        if (lambda > bounds_lambda2) {
          if (bounds_angle(bounds_lambda0, lambda) > bounds_angle(bounds_lambda0, bounds_lambda1)) bounds_lambda1 = lambda;
        } else {
          if (bounds_angle(lambda, bounds_lambda1) > bounds_angle(bounds_lambda0, bounds_lambda1)) bounds_lambda0 = lambda;
        }
      }
    }
  } else {
    ranges.push(bounds_range = [bounds_lambda0 = lambda, bounds_lambda1 = lambda]);
  }
  if (phi < bounds_phi0) bounds_phi0 = phi;
  if (phi > bounds_phi1) bounds_phi1 = phi;
  bounds_p0 = p, bounds_lambda2 = lambda;
}

function boundsLineStart() {
  bounds_boundsStream.point = bounds_linePoint;
}

function boundsLineEnd() {
  bounds_range[0] = bounds_lambda0, bounds_range[1] = bounds_lambda1;
  bounds_boundsStream.point = bounds_boundsPoint;
  bounds_p0 = null;
}

function boundsRingPoint(lambda, phi) {
  if (bounds_p0) {
    var delta = lambda - bounds_lambda2;
    deltaSum.add(math_abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
  } else {
    bounds_lambda00 = lambda, bounds_phi00 = phi;
  }
  area_areaStream.point(lambda, phi);
  bounds_linePoint(lambda, phi);
}

function boundsRingStart() {
  area_areaStream.lineStart();
}

function boundsRingEnd() {
  boundsRingPoint(bounds_lambda00, bounds_phi00);
  area_areaStream.lineEnd();
  if (math_abs(deltaSum) > src_math_epsilon) bounds_lambda0 = -(bounds_lambda1 = 180);
  bounds_range[0] = bounds_lambda0, bounds_range[1] = bounds_lambda1;
  bounds_p0 = null;
}

// Finds the left-right distance between two longitudes.
// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want
// the distance between ±180° to be 360°.
function bounds_angle(lambda0, lambda1) {
  return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1;
}

function rangeCompare(a, b) {
  return a[0] - b[0];
}

function rangeContains(range, x) {
  return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
}

/* harmony default export */ var src_bounds = (function(feature) {
  var i, n, a, b, merged, deltaMax, delta;

  bounds_phi1 = bounds_lambda1 = -(bounds_lambda0 = bounds_phi0 = Infinity);
  ranges = [];
  src_stream(feature, bounds_boundsStream);

  // First, sort ranges by their minimum longitudes.
  if (n = ranges.length) {
    ranges.sort(rangeCompare);

    // Then, merge any ranges that overlap.
    for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) {
      b = ranges[i];
      if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {
        if (bounds_angle(a[0], b[1]) > bounds_angle(a[0], a[1])) a[1] = b[1];
        if (bounds_angle(b[0], a[1]) > bounds_angle(a[0], a[1])) a[0] = b[0];
      } else {
        merged.push(a = b);
      }
    }

    // Finally, find the largest gap between the merged ranges.
    // The final bounding box will be the inverse of this gap.
    for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) {
      b = merged[i];
      if ((delta = bounds_angle(a[1], b[0])) > deltaMax) deltaMax = delta, bounds_lambda0 = b[0], bounds_lambda1 = a[1];
    }
  }

  ranges = bounds_range = null;

  return bounds_lambda0 === Infinity || bounds_phi0 === Infinity
      ? [[NaN, NaN], [NaN, NaN]]
      : [[bounds_lambda0, bounds_phi0], [bounds_lambda1, bounds_phi1]];
});

// CONCATENATED MODULE: ./node_modules/d3-geo/src/centroid.js





var W0, W1,
    src_centroid_X0, src_centroid_Y0, centroid_Z0,
    src_centroid_X1, src_centroid_Y1, centroid_Z1,
    centroid_X2, centroid_Y2, centroid_Z2,
    centroid_lambda00, centroid_phi00, // first point
    src_centroid_x0, src_centroid_y0, z0; // previous point

var centroid_centroidStream = {
  sphere: noop_noop,
  point: centroid_centroidPoint,
  lineStart: centroid_centroidLineStart,
  lineEnd: centroid_centroidLineEnd,
  polygonStart: function() {
    centroid_centroidStream.lineStart = centroid_centroidRingStart;
    centroid_centroidStream.lineEnd = centroid_centroidRingEnd;
  },
  polygonEnd: function() {
    centroid_centroidStream.lineStart = centroid_centroidLineStart;
    centroid_centroidStream.lineEnd = centroid_centroidLineEnd;
  }
};

// Arithmetic mean of Cartesian vectors.
function centroid_centroidPoint(lambda, phi) {
  lambda *= math_radians, phi *= math_radians;
  var cosPhi = math_cos(phi);
  centroidPointCartesian(cosPhi * math_cos(lambda), cosPhi * math_sin(lambda), math_sin(phi));
}

function centroidPointCartesian(x, y, z) {
  ++W0;
  src_centroid_X0 += (x - src_centroid_X0) / W0;
  src_centroid_Y0 += (y - src_centroid_Y0) / W0;
  centroid_Z0 += (z - centroid_Z0) / W0;
}

function centroid_centroidLineStart() {
  centroid_centroidStream.point = centroidLinePointFirst;
}

function centroidLinePointFirst(lambda, phi) {
  lambda *= math_radians, phi *= math_radians;
  var cosPhi = math_cos(phi);
  src_centroid_x0 = cosPhi * math_cos(lambda);
  src_centroid_y0 = cosPhi * math_sin(lambda);
  z0 = math_sin(phi);
  centroid_centroidStream.point = centroidLinePoint;
  centroidPointCartesian(src_centroid_x0, src_centroid_y0, z0);
}

function centroidLinePoint(lambda, phi) {
  lambda *= math_radians, phi *= math_radians;
  var cosPhi = math_cos(phi),
      x = cosPhi * math_cos(lambda),
      y = cosPhi * math_sin(lambda),
      z = math_sin(phi),
      w = math_atan2(math_sqrt((w = src_centroid_y0 * z - z0 * y) * w + (w = z0 * x - src_centroid_x0 * z) * w + (w = src_centroid_x0 * y - src_centroid_y0 * x) * w), src_centroid_x0 * x + src_centroid_y0 * y + z0 * z);
  W1 += w;
  src_centroid_X1 += w * (src_centroid_x0 + (src_centroid_x0 = x));
  src_centroid_Y1 += w * (src_centroid_y0 + (src_centroid_y0 = y));
  centroid_Z1 += w * (z0 + (z0 = z));
  centroidPointCartesian(src_centroid_x0, src_centroid_y0, z0);
}

function centroid_centroidLineEnd() {
  centroid_centroidStream.point = centroid_centroidPoint;
}

// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,
// J. Applied Mechanics 42, 239 (1975).
function centroid_centroidRingStart() {
  centroid_centroidStream.point = centroidRingPointFirst;
}

function centroid_centroidRingEnd() {
  centroidRingPoint(centroid_lambda00, centroid_phi00);
  centroid_centroidStream.point = centroid_centroidPoint;
}

function centroidRingPointFirst(lambda, phi) {
  centroid_lambda00 = lambda, centroid_phi00 = phi;
  lambda *= math_radians, phi *= math_radians;
  centroid_centroidStream.point = centroidRingPoint;
  var cosPhi = math_cos(phi);
  src_centroid_x0 = cosPhi * math_cos(lambda);
  src_centroid_y0 = cosPhi * math_sin(lambda);
  z0 = math_sin(phi);
  centroidPointCartesian(src_centroid_x0, src_centroid_y0, z0);
}

function centroidRingPoint(lambda, phi) {
  lambda *= math_radians, phi *= math_radians;
  var cosPhi = math_cos(phi),
      x = cosPhi * math_cos(lambda),
      y = cosPhi * math_sin(lambda),
      z = math_sin(phi),
      cx = src_centroid_y0 * z - z0 * y,
      cy = z0 * x - src_centroid_x0 * z,
      cz = src_centroid_x0 * y - src_centroid_y0 * x,
      m = hypot(cx, cy, cz),
      w = math_asin(m), // line weight = angle
      v = m && -w / m; // area weight multiplier
  centroid_X2.add(v * cx);
  centroid_Y2.add(v * cy);
  centroid_Z2.add(v * cz);
  W1 += w;
  src_centroid_X1 += w * (src_centroid_x0 + (src_centroid_x0 = x));
  src_centroid_Y1 += w * (src_centroid_y0 + (src_centroid_y0 = y));
  centroid_Z1 += w * (z0 + (z0 = z));
  centroidPointCartesian(src_centroid_x0, src_centroid_y0, z0);
}

/* harmony default export */ var src_centroid = (function(object) {
  W0 = W1 =
  src_centroid_X0 = src_centroid_Y0 = centroid_Z0 =
  src_centroid_X1 = src_centroid_Y1 = centroid_Z1 = 0;
  centroid_X2 = new Adder();
  centroid_Y2 = new Adder();
  centroid_Z2 = new Adder();
  src_stream(object, centroid_centroidStream);

  var x = +centroid_X2,
      y = +centroid_Y2,
      z = +centroid_Z2,
      m = hypot(x, y, z);

  // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid.
  if (m < math_epsilon2) {
    x = src_centroid_X1, y = src_centroid_Y1, z = centroid_Z1;
    // If the feature has zero length, fall back to arithmetic mean of point vectors.
    if (W1 < src_math_epsilon) x = src_centroid_X0, y = src_centroid_Y0, z = centroid_Z0;
    m = hypot(x, y, z);
    // If the feature still has an undefined ccentroid, then return.
    if (m < math_epsilon2) return [NaN, NaN];
  }

  return [math_atan2(y, x) * src_math_degrees, math_asin(z / m) * src_math_degrees];
});

// CONCATENATED MODULE: ./node_modules/vega-selections/node_modules/vega-expression/build/vega-expression.module.js


const vega_expression_module_RawCode = 'RawCode';
const vega_expression_module_Literal = 'Literal';
const vega_expression_module_Property = 'Property';
const build_vega_expression_module_Identifier = 'Identifier';
const vega_expression_module_ArrayExpression = 'ArrayExpression';
const vega_expression_module_BinaryExpression = 'BinaryExpression';
const build_vega_expression_module_CallExpression = 'CallExpression';
const vega_expression_module_ConditionalExpression = 'ConditionalExpression';
const vega_expression_module_LogicalExpression = 'LogicalExpression';
const vega_expression_module_MemberExpression = 'MemberExpression';
const vega_expression_module_ObjectExpression = 'ObjectExpression';
const vega_expression_module_UnaryExpression = 'UnaryExpression';
function vega_expression_module_ASTNode(type) {
  this.type = type;
}

vega_expression_module_ASTNode.prototype.visit = function (visitor) {
  let c, i, n;
  if (visitor(this)) return 1;

  for (c = build_vega_expression_module_children(this), i = 0, n = c.length; i < n; ++i) {
    if (c[i].visit(visitor)) return 1;
  }
};

function build_vega_expression_module_children(node) {
  switch (node.type) {
    case vega_expression_module_ArrayExpression:
      return node.elements;

    case vega_expression_module_BinaryExpression:
    case vega_expression_module_LogicalExpression:
      return [node.left, node.right];

    case build_vega_expression_module_CallExpression:
      return [node.callee].concat(node.arguments);

    case vega_expression_module_ConditionalExpression:
      return [node.test, node.consequent, node.alternate];

    case vega_expression_module_MemberExpression:
      return [node.object, node.property];

    case vega_expression_module_ObjectExpression:
      return node.properties;

    case vega_expression_module_Property:
      return [node.key, node.value];

    case vega_expression_module_UnaryExpression:
      return [node.argument];

    case build_vega_expression_module_Identifier:
    case vega_expression_module_Literal:
    case vega_expression_module_RawCode:
    default:
      return [];
  }
}

/*
  The following expression parser is based on Esprima (http://esprima.org/).
  Original header comment and license for Esprima is included here:

  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
  Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be>
  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
  Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
  Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
  Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
  Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
  Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var vega_expression_module_TokenName, build_vega_expression_module_source, build_vega_expression_module_index, build_vega_expression_module_length, vega_expression_module_lookahead;
var vega_expression_module_TokenBooleanLiteral = 1,
    vega_expression_module_TokenEOF = 2,
    vega_expression_module_TokenIdentifier = 3,
    vega_expression_module_TokenKeyword = 4,
    vega_expression_module_TokenNullLiteral = 5,
    vega_expression_module_TokenNumericLiteral = 6,
    vega_expression_module_TokenPunctuator = 7,
    vega_expression_module_TokenStringLiteral = 8,
    vega_expression_module_TokenRegularExpression = 9;
vega_expression_module_TokenName = {};
vega_expression_module_TokenName[vega_expression_module_TokenBooleanLiteral] = 'Boolean';
vega_expression_module_TokenName[vega_expression_module_TokenEOF] = '<end>';
vega_expression_module_TokenName[vega_expression_module_TokenIdentifier] = 'Identifier';
vega_expression_module_TokenName[vega_expression_module_TokenKeyword] = 'Keyword';
vega_expression_module_TokenName[vega_expression_module_TokenNullLiteral] = 'Null';
vega_expression_module_TokenName[vega_expression_module_TokenNumericLiteral] = 'Numeric';
vega_expression_module_TokenName[vega_expression_module_TokenPunctuator] = 'Punctuator';
vega_expression_module_TokenName[vega_expression_module_TokenStringLiteral] = 'String';
vega_expression_module_TokenName[vega_expression_module_TokenRegularExpression] = 'RegularExpression';
var vega_expression_module_SyntaxArrayExpression = 'ArrayExpression',
    vega_expression_module_SyntaxBinaryExpression = 'BinaryExpression',
    vega_expression_module_SyntaxCallExpression = 'CallExpression',
    vega_expression_module_SyntaxConditionalExpression = 'ConditionalExpression',
    vega_expression_module_SyntaxIdentifier = 'Identifier',
    vega_expression_module_SyntaxLiteral = 'Literal',
    vega_expression_module_SyntaxLogicalExpression = 'LogicalExpression',
    vega_expression_module_SyntaxMemberExpression = 'MemberExpression',
    vega_expression_module_SyntaxObjectExpression = 'ObjectExpression',
    vega_expression_module_SyntaxProperty = 'Property',
    vega_expression_module_SyntaxUnaryExpression = 'UnaryExpression'; // Error messages should be identical to V8.

var vega_expression_module_MessageUnexpectedToken = 'Unexpected token %0',
    vega_expression_module_MessageUnexpectedNumber = 'Unexpected number',
    vega_expression_module_MessageUnexpectedString = 'Unexpected string',
    vega_expression_module_MessageUnexpectedIdentifier = 'Unexpected identifier',
    vega_expression_module_MessageUnexpectedReserved = 'Unexpected reserved word',
    vega_expression_module_MessageUnexpectedEOS = 'Unexpected end of input',
    vega_expression_module_MessageInvalidRegExp = 'Invalid regular expression',
    vega_expression_module_MessageUnterminatedRegExp = 'Invalid regular expression: missing /',
    vega_expression_module_MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.',
    vega_expression_module_MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';
var vega_expression_module_ILLEGAL = 'ILLEGAL',
    vega_expression_module_DISABLED = 'Disabled.'; // See also tools/generate-unicode-regex.py.

var vega_expression_module_RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'),
    // eslint-disable-next-line no-misleading-character-class
vega_expression_module_RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); // Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.

function vega_expression_module_assert(condition, message) {
  /* istanbul ignore next */
  if (!condition) {
    throw new Error('ASSERT: ' + message);
  }
}

function vega_expression_module_isDecimalDigit(ch) {
  return ch >= 0x30 && ch <= 0x39; // 0..9
}

function vega_expression_module_isHexDigit(ch) {
  return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
}

function vega_expression_module_isOctalDigit(ch) {
  return '01234567'.indexOf(ch) >= 0;
} // 7.2 White Space


function vega_expression_module_isWhiteSpace(ch) {
  return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0;
} // 7.3 Line Terminators


function vega_expression_module_isLineTerminator(ch) {
  return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
} // 7.6 Identifier Names and Identifiers


function vega_expression_module_isIdentifierStart(ch) {
  return ch === 0x24 || ch === 0x5F || ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A || ch === 0x5C || ch >= 0x80 && vega_expression_module_RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));
}

function vega_expression_module_isIdentifierPart(ch) {
  return ch === 0x24 || ch === 0x5F || ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A || ch >= 0x30 && ch <= 0x39 || ch === 0x5C || ch >= 0x80 && vega_expression_module_RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));
} // 7.6.1.1 Keywords


const vega_expression_module_keywords = {
  'if': 1,
  'in': 1,
  'do': 1,
  'var': 1,
  'for': 1,
  'new': 1,
  'try': 1,
  'let': 1,
  'this': 1,
  'else': 1,
  'case': 1,
  'void': 1,
  'with': 1,
  'enum': 1,
  'while': 1,
  'break': 1,
  'catch': 1,
  'throw': 1,
  'const': 1,
  'yield': 1,
  'class': 1,
  'super': 1,
  'return': 1,
  'typeof': 1,
  'delete': 1,
  'switch': 1,
  'export': 1,
  'import': 1,
  'public': 1,
  'static': 1,
  'default': 1,
  'finally': 1,
  'extends': 1,
  'package': 1,
  'private': 1,
  'function': 1,
  'continue': 1,
  'debugger': 1,
  'interface': 1,
  'protected': 1,
  'instanceof': 1,
  'implements': 1
};

function vega_expression_module_skipComment() {
  while (build_vega_expression_module_index < build_vega_expression_module_length) {
    const ch = build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index);

    if (vega_expression_module_isWhiteSpace(ch) || vega_expression_module_isLineTerminator(ch)) {
      ++build_vega_expression_module_index;
    } else {
      break;
    }
  }
}

function vega_expression_module_scanHexEscape(prefix) {
  var i,
      len,
      ch,
      code = 0;
  len = prefix === 'u' ? 4 : 2;

  for (i = 0; i < len; ++i) {
    if (build_vega_expression_module_index < build_vega_expression_module_length && vega_expression_module_isHexDigit(build_vega_expression_module_source[build_vega_expression_module_index])) {
      ch = build_vega_expression_module_source[build_vega_expression_module_index++];
      code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
    } else {
      vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
    }
  }

  return String.fromCharCode(code);
}

function vega_expression_module_scanUnicodeCodePointEscape() {
  var ch, code, cu1, cu2;
  ch = build_vega_expression_module_source[build_vega_expression_module_index];
  code = 0; // At least, one hex digit is required.

  if (ch === '}') {
    vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
  }

  while (build_vega_expression_module_index < build_vega_expression_module_length) {
    ch = build_vega_expression_module_source[build_vega_expression_module_index++];

    if (!vega_expression_module_isHexDigit(ch)) {
      break;
    }

    code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
  }

  if (code > 0x10FFFF || ch !== '}') {
    vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
  } // UTF-16 Encoding


  if (code <= 0xFFFF) {
    return String.fromCharCode(code);
  }

  cu1 = (code - 0x10000 >> 10) + 0xD800;
  cu2 = (code - 0x10000 & 1023) + 0xDC00;
  return String.fromCharCode(cu1, cu2);
}

function vega_expression_module_getEscapedIdentifier() {
  var ch, id;
  ch = build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index++);
  id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.

  if (ch === 0x5C) {
    if (build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index) !== 0x75) {
      vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
    }

    ++build_vega_expression_module_index;
    ch = vega_expression_module_scanHexEscape('u');

    if (!ch || ch === '\\' || !vega_expression_module_isIdentifierStart(ch.charCodeAt(0))) {
      vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
    }

    id = ch;
  }

  while (build_vega_expression_module_index < build_vega_expression_module_length) {
    ch = build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index);

    if (!vega_expression_module_isIdentifierPart(ch)) {
      break;
    }

    ++build_vega_expression_module_index;
    id += String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.

    if (ch === 0x5C) {
      id = id.substr(0, id.length - 1);

      if (build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index) !== 0x75) {
        vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
      }

      ++build_vega_expression_module_index;
      ch = vega_expression_module_scanHexEscape('u');

      if (!ch || ch === '\\' || !vega_expression_module_isIdentifierPart(ch.charCodeAt(0))) {
        vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
      }

      id += ch;
    }
  }

  return id;
}

function vega_expression_module_getIdentifier() {
  var start, ch;
  start = build_vega_expression_module_index++;

  while (build_vega_expression_module_index < build_vega_expression_module_length) {
    ch = build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index);

    if (ch === 0x5C) {
      // Blackslash (U+005C) marks Unicode escape sequence.
      build_vega_expression_module_index = start;
      return vega_expression_module_getEscapedIdentifier();
    }

    if (vega_expression_module_isIdentifierPart(ch)) {
      ++build_vega_expression_module_index;
    } else {
      break;
    }
  }

  return build_vega_expression_module_source.slice(start, build_vega_expression_module_index);
}

function vega_expression_module_scanIdentifier() {
  var start, id, type;
  start = build_vega_expression_module_index; // Backslash (U+005C) starts an escaped character.

  id = build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index) === 0x5C ? vega_expression_module_getEscapedIdentifier() : vega_expression_module_getIdentifier(); // There is no keyword or literal with only one character.
  // Thus, it must be an identifier.

  if (id.length === 1) {
    type = vega_expression_module_TokenIdentifier;
  } else if (vega_expression_module_keywords.hasOwnProperty(id)) {
    // eslint-disable-line no-prototype-builtins
    type = vega_expression_module_TokenKeyword;
  } else if (id === 'null') {
    type = vega_expression_module_TokenNullLiteral;
  } else if (id === 'true' || id === 'false') {
    type = vega_expression_module_TokenBooleanLiteral;
  } else {
    type = vega_expression_module_TokenIdentifier;
  }

  return {
    type: type,
    value: id,
    start: start,
    end: build_vega_expression_module_index
  };
} // 7.7 Punctuators


function vega_expression_module_scanPunctuator() {
  var start = build_vega_expression_module_index,
      code = build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index),
      code2,
      ch1 = build_vega_expression_module_source[build_vega_expression_module_index],
      ch2,
      ch3,
      ch4;

  switch (code) {
    // Check for most common single-character punctuators.
    case 0x2E: // . dot

    case 0x28: // ( open bracket

    case 0x29: // ) close bracket

    case 0x3B: // ; semicolon

    case 0x2C: // , comma

    case 0x7B: // { open curly brace

    case 0x7D: // } close curly brace

    case 0x5B: // [

    case 0x5D: // ]

    case 0x3A: // :

    case 0x3F: // ?

    case 0x7E:
      // ~
      ++build_vega_expression_module_index;
      return {
        type: vega_expression_module_TokenPunctuator,
        value: String.fromCharCode(code),
        start: start,
        end: build_vega_expression_module_index
      };

    default:
      code2 = build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index + 1); // '=' (U+003D) marks an assignment or comparison operator.

      if (code2 === 0x3D) {
        switch (code) {
          case 0x2B: // +

          case 0x2D: // -

          case 0x2F: // /

          case 0x3C: // <

          case 0x3E: // >

          case 0x5E: // ^

          case 0x7C: // |

          case 0x25: // %

          case 0x26: // &

          case 0x2A:
            // *
            build_vega_expression_module_index += 2;
            return {
              type: vega_expression_module_TokenPunctuator,
              value: String.fromCharCode(code) + String.fromCharCode(code2),
              start: start,
              end: build_vega_expression_module_index
            };

          case 0x21: // !

          case 0x3D:
            // =
            build_vega_expression_module_index += 2; // !== and ===

            if (build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index) === 0x3D) {
              ++build_vega_expression_module_index;
            }

            return {
              type: vega_expression_module_TokenPunctuator,
              value: build_vega_expression_module_source.slice(start, build_vega_expression_module_index),
              start: start,
              end: build_vega_expression_module_index
            };
        }
      }

  } // 4-character punctuator: >>>=


  ch4 = build_vega_expression_module_source.substr(build_vega_expression_module_index, 4);

  if (ch4 === '>>>=') {
    build_vega_expression_module_index += 4;
    return {
      type: vega_expression_module_TokenPunctuator,
      value: ch4,
      start: start,
      end: build_vega_expression_module_index
    };
  } // 3-character punctuators: === !== >>> <<= >>=


  ch3 = ch4.substr(0, 3);

  if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {
    build_vega_expression_module_index += 3;
    return {
      type: vega_expression_module_TokenPunctuator,
      value: ch3,
      start: start,
      end: build_vega_expression_module_index
    };
  } // Other 2-character punctuators: ++ -- << >> && ||


  ch2 = ch3.substr(0, 2);

  if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') {
    build_vega_expression_module_index += 2;
    return {
      type: vega_expression_module_TokenPunctuator,
      value: ch2,
      start: start,
      end: build_vega_expression_module_index
    };
  }

  if (ch2 === '//') {
    vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
  } // 1-character punctuators: < > = ! + - * % & | ^ /


  if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
    ++build_vega_expression_module_index;
    return {
      type: vega_expression_module_TokenPunctuator,
      value: ch1,
      start: start,
      end: build_vega_expression_module_index
    };
  }

  vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
} // 7.8.3 Numeric Literals


function vega_expression_module_scanHexLiteral(start) {
  let number = '';

  while (build_vega_expression_module_index < build_vega_expression_module_length) {
    if (!vega_expression_module_isHexDigit(build_vega_expression_module_source[build_vega_expression_module_index])) {
      break;
    }

    number += build_vega_expression_module_source[build_vega_expression_module_index++];
  }

  if (number.length === 0) {
    vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
  }

  if (vega_expression_module_isIdentifierStart(build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index))) {
    vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
  }

  return {
    type: vega_expression_module_TokenNumericLiteral,
    value: parseInt('0x' + number, 16),
    start: start,
    end: build_vega_expression_module_index
  };
}

function vega_expression_module_scanOctalLiteral(start) {
  let number = '0' + build_vega_expression_module_source[build_vega_expression_module_index++];

  while (build_vega_expression_module_index < build_vega_expression_module_length) {
    if (!vega_expression_module_isOctalDigit(build_vega_expression_module_source[build_vega_expression_module_index])) {
      break;
    }

    number += build_vega_expression_module_source[build_vega_expression_module_index++];
  }

  if (vega_expression_module_isIdentifierStart(build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index)) || vega_expression_module_isDecimalDigit(build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index))) {
    vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
  }

  return {
    type: vega_expression_module_TokenNumericLiteral,
    value: parseInt(number, 8),
    octal: true,
    start: start,
    end: build_vega_expression_module_index
  };
}

function vega_expression_module_scanNumericLiteral() {
  var number, start, ch;
  ch = build_vega_expression_module_source[build_vega_expression_module_index];
  vega_expression_module_assert(vega_expression_module_isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point');
  start = build_vega_expression_module_index;
  number = '';

  if (ch !== '.') {
    number = build_vega_expression_module_source[build_vega_expression_module_index++];
    ch = build_vega_expression_module_source[build_vega_expression_module_index]; // Hex number starts with '0x'.
    // Octal number starts with '0'.

    if (number === '0') {
      if (ch === 'x' || ch === 'X') {
        ++build_vega_expression_module_index;
        return vega_expression_module_scanHexLiteral(start);
      }

      if (vega_expression_module_isOctalDigit(ch)) {
        return vega_expression_module_scanOctalLiteral(start);
      } // decimal number starts with '0' such as '09' is illegal.


      if (ch && vega_expression_module_isDecimalDigit(ch.charCodeAt(0))) {
        vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
      }
    }

    while (vega_expression_module_isDecimalDigit(build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index))) {
      number += build_vega_expression_module_source[build_vega_expression_module_index++];
    }

    ch = build_vega_expression_module_source[build_vega_expression_module_index];
  }

  if (ch === '.') {
    number += build_vega_expression_module_source[build_vega_expression_module_index++];

    while (vega_expression_module_isDecimalDigit(build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index))) {
      number += build_vega_expression_module_source[build_vega_expression_module_index++];
    }

    ch = build_vega_expression_module_source[build_vega_expression_module_index];
  }

  if (ch === 'e' || ch === 'E') {
    number += build_vega_expression_module_source[build_vega_expression_module_index++];
    ch = build_vega_expression_module_source[build_vega_expression_module_index];

    if (ch === '+' || ch === '-') {
      number += build_vega_expression_module_source[build_vega_expression_module_index++];
    }

    if (vega_expression_module_isDecimalDigit(build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index))) {
      while (vega_expression_module_isDecimalDigit(build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index))) {
        number += build_vega_expression_module_source[build_vega_expression_module_index++];
      }
    } else {
      vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
    }
  }

  if (vega_expression_module_isIdentifierStart(build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index))) {
    vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
  }

  return {
    type: vega_expression_module_TokenNumericLiteral,
    value: parseFloat(number),
    start: start,
    end: build_vega_expression_module_index
  };
} // 7.8.4 String Literals


function vega_expression_module_scanStringLiteral() {
  var str = '',
      quote,
      start,
      ch,
      code,
      octal = false;
  quote = build_vega_expression_module_source[build_vega_expression_module_index];
  vega_expression_module_assert(quote === '\'' || quote === '"', 'String literal must starts with a quote');
  start = build_vega_expression_module_index;
  ++build_vega_expression_module_index;

  while (build_vega_expression_module_index < build_vega_expression_module_length) {
    ch = build_vega_expression_module_source[build_vega_expression_module_index++];

    if (ch === quote) {
      quote = '';
      break;
    } else if (ch === '\\') {
      ch = build_vega_expression_module_source[build_vega_expression_module_index++];

      if (!ch || !vega_expression_module_isLineTerminator(ch.charCodeAt(0))) {
        switch (ch) {
          case 'u':
          case 'x':
            if (build_vega_expression_module_source[build_vega_expression_module_index] === '{') {
              ++build_vega_expression_module_index;
              str += vega_expression_module_scanUnicodeCodePointEscape();
            } else {
              str += vega_expression_module_scanHexEscape(ch);
            }

            break;

          case 'n':
            str += '\n';
            break;

          case 'r':
            str += '\r';
            break;

          case 't':
            str += '\t';
            break;

          case 'b':
            str += '\b';
            break;

          case 'f':
            str += '\f';
            break;

          case 'v':
            str += '\x0B';
            break;

          default:
            if (vega_expression_module_isOctalDigit(ch)) {
              code = '01234567'.indexOf(ch); // \0 is not octal escape sequence

              if (code !== 0) {
                octal = true;
              }

              if (build_vega_expression_module_index < build_vega_expression_module_length && vega_expression_module_isOctalDigit(build_vega_expression_module_source[build_vega_expression_module_index])) {
                octal = true;
                code = code * 8 + '01234567'.indexOf(build_vega_expression_module_source[build_vega_expression_module_index++]); // 3 digits are only allowed when string starts
                // with 0, 1, 2, 3

                if ('0123'.indexOf(ch) >= 0 && build_vega_expression_module_index < build_vega_expression_module_length && vega_expression_module_isOctalDigit(build_vega_expression_module_source[build_vega_expression_module_index])) {
                  code = code * 8 + '01234567'.indexOf(build_vega_expression_module_source[build_vega_expression_module_index++]);
                }
              }

              str += String.fromCharCode(code);
            } else {
              str += ch;
            }

            break;
        }
      } else {
        if (ch === '\r' && build_vega_expression_module_source[build_vega_expression_module_index] === '\n') {
          ++build_vega_expression_module_index;
        }
      }
    } else if (vega_expression_module_isLineTerminator(ch.charCodeAt(0))) {
      break;
    } else {
      str += ch;
    }
  }

  if (quote !== '') {
    vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
  }

  return {
    type: vega_expression_module_TokenStringLiteral,
    value: str,
    octal: octal,
    start: start,
    end: build_vega_expression_module_index
  };
}

function vega_expression_module_testRegExp(pattern, flags) {
  let tmp = pattern;

  if (flags.indexOf('u') >= 0) {
    // Replace each astral symbol and every Unicode code point
    // escape sequence with a single ASCII symbol to avoid throwing on
    // regular expressions that are only valid in combination with the
    // `/u` flag.
    // Note: replacing with the ASCII symbol `x` might cause false
    // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
    // perfectly valid pattern that is equivalent to `[a-b]`, but it
    // would be replaced by `[x-b]` which throws an error.
    tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1) => {
      if (parseInt($1, 16) <= 0x10FFFF) {
        return 'x';
      }

      vega_expression_module_throwError({}, vega_expression_module_MessageInvalidRegExp);
    }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
  } // First, detect invalid regular expressions.


  try {
    new RegExp(tmp);
  } catch (e) {
    vega_expression_module_throwError({}, vega_expression_module_MessageInvalidRegExp);
  } // Return a regular expression object for this pattern-flag pair, or
  // `null` in case the current environment doesn't support the flags it
  // uses.


  try {
    return new RegExp(pattern, flags);
  } catch (exception) {
    return null;
  }
}

function vega_expression_module_scanRegExpBody() {
  var ch, str, classMarker, terminated, body;
  ch = build_vega_expression_module_source[build_vega_expression_module_index];
  vega_expression_module_assert(ch === '/', 'Regular expression literal must start with a slash');
  str = build_vega_expression_module_source[build_vega_expression_module_index++];
  classMarker = false;
  terminated = false;

  while (build_vega_expression_module_index < build_vega_expression_module_length) {
    ch = build_vega_expression_module_source[build_vega_expression_module_index++];
    str += ch;

    if (ch === '\\') {
      ch = build_vega_expression_module_source[build_vega_expression_module_index++]; // ECMA-262 7.8.5

      if (vega_expression_module_isLineTerminator(ch.charCodeAt(0))) {
        vega_expression_module_throwError({}, vega_expression_module_MessageUnterminatedRegExp);
      }

      str += ch;
    } else if (vega_expression_module_isLineTerminator(ch.charCodeAt(0))) {
      vega_expression_module_throwError({}, vega_expression_module_MessageUnterminatedRegExp);
    } else if (classMarker) {
      if (ch === ']') {
        classMarker = false;
      }
    } else {
      if (ch === '/') {
        terminated = true;
        break;
      } else if (ch === '[') {
        classMarker = true;
      }
    }
  }

  if (!terminated) {
    vega_expression_module_throwError({}, vega_expression_module_MessageUnterminatedRegExp);
  } // Exclude leading and trailing slash.


  body = str.substr(1, str.length - 2);
  return {
    value: body,
    literal: str
  };
}

function vega_expression_module_scanRegExpFlags() {
  var ch, str, flags;
  str = '';
  flags = '';

  while (build_vega_expression_module_index < build_vega_expression_module_length) {
    ch = build_vega_expression_module_source[build_vega_expression_module_index];

    if (!vega_expression_module_isIdentifierPart(ch.charCodeAt(0))) {
      break;
    }

    ++build_vega_expression_module_index;

    if (ch === '\\' && build_vega_expression_module_index < build_vega_expression_module_length) {
      vega_expression_module_throwError({}, vega_expression_module_MessageUnexpectedToken, vega_expression_module_ILLEGAL);
    } else {
      flags += ch;
      str += ch;
    }
  }

  if (flags.search(/[^gimuy]/g) >= 0) {
    vega_expression_module_throwError({}, vega_expression_module_MessageInvalidRegExp, flags);
  }

  return {
    value: flags,
    literal: str
  };
}

function vega_expression_module_scanRegExp() {
  var start, body, flags, value;
  vega_expression_module_lookahead = null;
  vega_expression_module_skipComment();
  start = build_vega_expression_module_index;
  body = vega_expression_module_scanRegExpBody();
  flags = vega_expression_module_scanRegExpFlags();
  value = vega_expression_module_testRegExp(body.value, flags.value);
  return {
    literal: body.literal + flags.literal,
    value: value,
    regex: {
      pattern: body.value,
      flags: flags.value
    },
    start: start,
    end: build_vega_expression_module_index
  };
}

function vega_expression_module_isIdentifierName(token) {
  return token.type === vega_expression_module_TokenIdentifier || token.type === vega_expression_module_TokenKeyword || token.type === vega_expression_module_TokenBooleanLiteral || token.type === vega_expression_module_TokenNullLiteral;
}

function vega_expression_module_advance() {
  vega_expression_module_skipComment();

  if (build_vega_expression_module_index >= build_vega_expression_module_length) {
    return {
      type: vega_expression_module_TokenEOF,
      start: build_vega_expression_module_index,
      end: build_vega_expression_module_index
    };
  }

  const ch = build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index);

  if (vega_expression_module_isIdentifierStart(ch)) {
    return vega_expression_module_scanIdentifier();
  } // Very common: ( and ) and ;


  if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {
    return vega_expression_module_scanPunctuator();
  } // String literal starts with single quote (U+0027) or double quote (U+0022).


  if (ch === 0x27 || ch === 0x22) {
    return vega_expression_module_scanStringLiteral();
  } // Dot (.) U+002E can also start a floating-point number, hence the need
  // to check the next character.


  if (ch === 0x2E) {
    if (vega_expression_module_isDecimalDigit(build_vega_expression_module_source.charCodeAt(build_vega_expression_module_index + 1))) {
      return vega_expression_module_scanNumericLiteral();
    }

    return vega_expression_module_scanPunctuator();
  }

  if (vega_expression_module_isDecimalDigit(ch)) {
    return vega_expression_module_scanNumericLiteral();
  }

  return vega_expression_module_scanPunctuator();
}

function vega_expression_module_lex() {
  const token = vega_expression_module_lookahead;
  build_vega_expression_module_index = token.end;
  vega_expression_module_lookahead = vega_expression_module_advance();
  build_vega_expression_module_index = token.end;
  return token;
}

function vega_expression_module_peek() {
  const pos = build_vega_expression_module_index;
  vega_expression_module_lookahead = vega_expression_module_advance();
  build_vega_expression_module_index = pos;
}

function vega_expression_module_finishArrayExpression(elements) {
  const node = new vega_expression_module_ASTNode(vega_expression_module_SyntaxArrayExpression);
  node.elements = elements;
  return node;
}

function vega_expression_module_finishBinaryExpression(operator, left, right) {
  const node = new vega_expression_module_ASTNode(operator === '||' || operator === '&&' ? vega_expression_module_SyntaxLogicalExpression : vega_expression_module_SyntaxBinaryExpression);
  node.operator = operator;
  node.left = left;
  node.right = right;
  return node;
}

function vega_expression_module_finishCallExpression(callee, args) {
  const node = new vega_expression_module_ASTNode(vega_expression_module_SyntaxCallExpression);
  node.callee = callee;
  node.arguments = args;
  return node;
}

function vega_expression_module_finishConditionalExpression(test, consequent, alternate) {
  const node = new vega_expression_module_ASTNode(vega_expression_module_SyntaxConditionalExpression);
  node.test = test;
  node.consequent = consequent;
  node.alternate = alternate;
  return node;
}

function vega_expression_module_finishIdentifier(name) {
  const node = new vega_expression_module_ASTNode(vega_expression_module_SyntaxIdentifier);
  node.name = name;
  return node;
}

function vega_expression_module_finishLiteral(token) {
  const node = new vega_expression_module_ASTNode(vega_expression_module_SyntaxLiteral);
  node.value = token.value;
  node.raw = build_vega_expression_module_source.slice(token.start, token.end);

  if (token.regex) {
    if (node.raw === '//') {
      node.raw = '/(?:)/';
    }

    node.regex = token.regex;
  }

  return node;
}

function vega_expression_module_finishMemberExpression(accessor, object, property) {
  const node = new vega_expression_module_ASTNode(vega_expression_module_SyntaxMemberExpression);
  node.computed = accessor === '[';
  node.object = object;
  node.property = property;
  if (!node.computed) property.member = true;
  return node;
}

function vega_expression_module_finishObjectExpression(properties) {
  const node = new vega_expression_module_ASTNode(vega_expression_module_SyntaxObjectExpression);
  node.properties = properties;
  return node;
}

function vega_expression_module_finishProperty(kind, key, value) {
  const node = new vega_expression_module_ASTNode(vega_expression_module_SyntaxProperty);
  node.key = key;
  node.value = value;
  node.kind = kind;
  return node;
}

function vega_expression_module_finishUnaryExpression(operator, argument) {
  const node = new vega_expression_module_ASTNode(vega_expression_module_SyntaxUnaryExpression);
  node.operator = operator;
  node.argument = argument;
  node.prefix = true;
  return node;
} // Throw an exception


function vega_expression_module_throwError(token, messageFormat) {
  var error,
      args = Array.prototype.slice.call(arguments, 2),
      msg = messageFormat.replace(/%(\d)/g, (whole, index) => {
    vega_expression_module_assert(index < args.length, 'Message reference must be in range');
    return args[index];
  });
  error = new Error(msg);
  error.index = build_vega_expression_module_index;
  error.description = msg;
  throw error;
} // Throw an exception because of the token.


function vega_expression_module_throwUnexpected(token) {
  if (token.type === vega_expression_module_TokenEOF) {
    vega_expression_module_throwError(token, vega_expression_module_MessageUnexpectedEOS);
  }

  if (token.type === vega_expression_module_TokenNumericLiteral) {
    vega_expression_module_throwError(token, vega_expression_module_MessageUnexpectedNumber);
  }

  if (token.type === vega_expression_module_TokenStringLiteral) {
    vega_expression_module_throwError(token, vega_expression_module_MessageUnexpectedString);
  }

  if (token.type === vega_expression_module_TokenIdentifier) {
    vega_expression_module_throwError(token, vega_expression_module_MessageUnexpectedIdentifier);
  }

  if (token.type === vega_expression_module_TokenKeyword) {
    vega_expression_module_throwError(token, vega_expression_module_MessageUnexpectedReserved);
  } // BooleanLiteral, NullLiteral, or Punctuator.


  vega_expression_module_throwError(token, vega_expression_module_MessageUnexpectedToken, token.value);
} // Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.


function vega_expression_module_expect(value) {
  const token = vega_expression_module_lex();

  if (token.type !== vega_expression_module_TokenPunctuator || token.value !== value) {
    vega_expression_module_throwUnexpected(token);
  }
} // Return true if the next token matches the specified punctuator.


function vega_expression_module_match(value) {
  return vega_expression_module_lookahead.type === vega_expression_module_TokenPunctuator && vega_expression_module_lookahead.value === value;
} // Return true if the next token matches the specified keyword


function vega_expression_module_matchKeyword(keyword) {
  return vega_expression_module_lookahead.type === vega_expression_module_TokenKeyword && vega_expression_module_lookahead.value === keyword;
} // 11.1.4 Array Initialiser


function vega_expression_module_parseArrayInitialiser() {
  const elements = [];
  build_vega_expression_module_index = vega_expression_module_lookahead.start;
  vega_expression_module_expect('[');

  while (!vega_expression_module_match(']')) {
    if (vega_expression_module_match(',')) {
      vega_expression_module_lex();
      elements.push(null);
    } else {
      elements.push(vega_expression_module_parseConditionalExpression());

      if (!vega_expression_module_match(']')) {
        vega_expression_module_expect(',');
      }
    }
  }

  vega_expression_module_lex();
  return vega_expression_module_finishArrayExpression(elements);
} // 11.1.5 Object Initialiser


function vega_expression_module_parseObjectPropertyKey() {
  build_vega_expression_module_index = vega_expression_module_lookahead.start;
  const token = vega_expression_module_lex(); // Note: This function is called only from parseObjectProperty(), where
  // EOF and Punctuator tokens are already filtered out.

  if (token.type === vega_expression_module_TokenStringLiteral || token.type === vega_expression_module_TokenNumericLiteral) {
    if (token.octal) {
      vega_expression_module_throwError(token, vega_expression_module_MessageStrictOctalLiteral);
    }

    return vega_expression_module_finishLiteral(token);
  }

  return vega_expression_module_finishIdentifier(token.value);
}

function vega_expression_module_parseObjectProperty() {
  var token, key, id, value;
  build_vega_expression_module_index = vega_expression_module_lookahead.start;
  token = vega_expression_module_lookahead;

  if (token.type === vega_expression_module_TokenIdentifier) {
    id = vega_expression_module_parseObjectPropertyKey();
    vega_expression_module_expect(':');
    value = vega_expression_module_parseConditionalExpression();
    return vega_expression_module_finishProperty('init', id, value);
  }

  if (token.type === vega_expression_module_TokenEOF || token.type === vega_expression_module_TokenPunctuator) {
    vega_expression_module_throwUnexpected(token);
  } else {
    key = vega_expression_module_parseObjectPropertyKey();
    vega_expression_module_expect(':');
    value = vega_expression_module_parseConditionalExpression();
    return vega_expression_module_finishProperty('init', key, value);
  }
}

function vega_expression_module_parseObjectInitialiser() {
  var properties = [],
      property,
      name,
      key,
      map = {},
      toString = String;
  build_vega_expression_module_index = vega_expression_module_lookahead.start;
  vega_expression_module_expect('{');

  while (!vega_expression_module_match('}')) {
    property = vega_expression_module_parseObjectProperty();

    if (property.key.type === vega_expression_module_SyntaxIdentifier) {
      name = property.key.name;
    } else {
      name = toString(property.key.value);
    }

    key = '$' + name;

    if (Object.prototype.hasOwnProperty.call(map, key)) {
      vega_expression_module_throwError({}, vega_expression_module_MessageStrictDuplicateProperty);
    } else {
      map[key] = true;
    }

    properties.push(property);

    if (!vega_expression_module_match('}')) {
      vega_expression_module_expect(',');
    }
  }

  vega_expression_module_expect('}');
  return vega_expression_module_finishObjectExpression(properties);
} // 11.1.6 The Grouping Operator


function vega_expression_module_parseGroupExpression() {
  vega_expression_module_expect('(');
  const expr = vega_expression_module_parseExpression();
  vega_expression_module_expect(')');
  return expr;
} // 11.1 Primary Expressions


const vega_expression_module_legalKeywords = {
  'if': 1
};

function vega_expression_module_parsePrimaryExpression() {
  var type, token, expr;

  if (vega_expression_module_match('(')) {
    return vega_expression_module_parseGroupExpression();
  }

  if (vega_expression_module_match('[')) {
    return vega_expression_module_parseArrayInitialiser();
  }

  if (vega_expression_module_match('{')) {
    return vega_expression_module_parseObjectInitialiser();
  }

  type = vega_expression_module_lookahead.type;
  build_vega_expression_module_index = vega_expression_module_lookahead.start;

  if (type === vega_expression_module_TokenIdentifier || vega_expression_module_legalKeywords[vega_expression_module_lookahead.value]) {
    expr = vega_expression_module_finishIdentifier(vega_expression_module_lex().value);
  } else if (type === vega_expression_module_TokenStringLiteral || type === vega_expression_module_TokenNumericLiteral) {
    if (vega_expression_module_lookahead.octal) {
      vega_expression_module_throwError(vega_expression_module_lookahead, vega_expression_module_MessageStrictOctalLiteral);
    }

    expr = vega_expression_module_finishLiteral(vega_expression_module_lex());
  } else if (type === vega_expression_module_TokenKeyword) {
    throw new Error(vega_expression_module_DISABLED);
  } else if (type === vega_expression_module_TokenBooleanLiteral) {
    token = vega_expression_module_lex();
    token.value = token.value === 'true';
    expr = vega_expression_module_finishLiteral(token);
  } else if (type === vega_expression_module_TokenNullLiteral) {
    token = vega_expression_module_lex();
    token.value = null;
    expr = vega_expression_module_finishLiteral(token);
  } else if (vega_expression_module_match('/') || vega_expression_module_match('/=')) {
    expr = vega_expression_module_finishLiteral(vega_expression_module_scanRegExp());
    vega_expression_module_peek();
  } else {
    vega_expression_module_throwUnexpected(vega_expression_module_lex());
  }

  return expr;
} // 11.2 Left-Hand-Side Expressions


function vega_expression_module_parseArguments() {
  const args = [];
  vega_expression_module_expect('(');

  if (!vega_expression_module_match(')')) {
    while (build_vega_expression_module_index < build_vega_expression_module_length) {
      args.push(vega_expression_module_parseConditionalExpression());

      if (vega_expression_module_match(')')) {
        break;
      }

      vega_expression_module_expect(',');
    }
  }

  vega_expression_module_expect(')');
  return args;
}

function vega_expression_module_parseNonComputedProperty() {
  build_vega_expression_module_index = vega_expression_module_lookahead.start;
  const token = vega_expression_module_lex();

  if (!vega_expression_module_isIdentifierName(token)) {
    vega_expression_module_throwUnexpected(token);
  }

  return vega_expression_module_finishIdentifier(token.value);
}

function vega_expression_module_parseNonComputedMember() {
  vega_expression_module_expect('.');
  return vega_expression_module_parseNonComputedProperty();
}

function vega_expression_module_parseComputedMember() {
  vega_expression_module_expect('[');
  const expr = vega_expression_module_parseExpression();
  vega_expression_module_expect(']');
  return expr;
}

function vega_expression_module_parseLeftHandSideExpressionAllowCall() {
  var expr, args, property;
  expr = vega_expression_module_parsePrimaryExpression();

  for (;;) {
    if (vega_expression_module_match('.')) {
      property = vega_expression_module_parseNonComputedMember();
      expr = vega_expression_module_finishMemberExpression('.', expr, property);
    } else if (vega_expression_module_match('(')) {
      args = vega_expression_module_parseArguments();
      expr = vega_expression_module_finishCallExpression(expr, args);
    } else if (vega_expression_module_match('[')) {
      property = vega_expression_module_parseComputedMember();
      expr = vega_expression_module_finishMemberExpression('[', expr, property);
    } else {
      break;
    }
  }

  return expr;
} // 11.3 Postfix Expressions


function vega_expression_module_parsePostfixExpression() {
  const expr = vega_expression_module_parseLeftHandSideExpressionAllowCall();

  if (vega_expression_module_lookahead.type === vega_expression_module_TokenPunctuator) {
    if (vega_expression_module_match('++') || vega_expression_module_match('--')) {
      throw new Error(vega_expression_module_DISABLED);
    }
  }

  return expr;
} // 11.4 Unary Operators


function vega_expression_module_parseUnaryExpression() {
  var token, expr;

  if (vega_expression_module_lookahead.type !== vega_expression_module_TokenPunctuator && vega_expression_module_lookahead.type !== vega_expression_module_TokenKeyword) {
    expr = vega_expression_module_parsePostfixExpression();
  } else if (vega_expression_module_match('++') || vega_expression_module_match('--')) {
    throw new Error(vega_expression_module_DISABLED);
  } else if (vega_expression_module_match('+') || vega_expression_module_match('-') || vega_expression_module_match('~') || vega_expression_module_match('!')) {
    token = vega_expression_module_lex();
    expr = vega_expression_module_parseUnaryExpression();
    expr = vega_expression_module_finishUnaryExpression(token.value, expr);
  } else if (vega_expression_module_matchKeyword('delete') || vega_expression_module_matchKeyword('void') || vega_expression_module_matchKeyword('typeof')) {
    throw new Error(vega_expression_module_DISABLED);
  } else {
    expr = vega_expression_module_parsePostfixExpression();
  }

  return expr;
}

function vega_expression_module_binaryPrecedence(token) {
  let prec = 0;

  if (token.type !== vega_expression_module_TokenPunctuator && token.type !== vega_expression_module_TokenKeyword) {
    return 0;
  }

  switch (token.value) {
    case '||':
      prec = 1;
      break;

    case '&&':
      prec = 2;
      break;

    case '|':
      prec = 3;
      break;

    case '^':
      prec = 4;
      break;

    case '&':
      prec = 5;
      break;

    case '==':
    case '!=':
    case '===':
    case '!==':
      prec = 6;
      break;

    case '<':
    case '>':
    case '<=':
    case '>=':
    case 'instanceof':
    case 'in':
      prec = 7;
      break;

    case '<<':
    case '>>':
    case '>>>':
      prec = 8;
      break;

    case '+':
    case '-':
      prec = 9;
      break;

    case '*':
    case '/':
    case '%':
      prec = 11;
      break;
  }

  return prec;
} // 11.5 Multiplicative Operators
// 11.6 Additive Operators
// 11.7 Bitwise Shift Operators
// 11.8 Relational Operators
// 11.9 Equality Operators
// 11.10 Binary Bitwise Operators
// 11.11 Binary Logical Operators


function vega_expression_module_parseBinaryExpression() {
  var marker, markers, expr, token, prec, stack, right, operator, left, i;
  marker = vega_expression_module_lookahead;
  left = vega_expression_module_parseUnaryExpression();
  token = vega_expression_module_lookahead;
  prec = vega_expression_module_binaryPrecedence(token);

  if (prec === 0) {
    return left;
  }

  token.prec = prec;
  vega_expression_module_lex();
  markers = [marker, vega_expression_module_lookahead];
  right = vega_expression_module_parseUnaryExpression();
  stack = [left, token, right];

  while ((prec = vega_expression_module_binaryPrecedence(vega_expression_module_lookahead)) > 0) {
    // Reduce: make a binary expression from the three topmost entries.
    while (stack.length > 2 && prec <= stack[stack.length - 2].prec) {
      right = stack.pop();
      operator = stack.pop().value;
      left = stack.pop();
      markers.pop();
      expr = vega_expression_module_finishBinaryExpression(operator, left, right);
      stack.push(expr);
    } // Shift.


    token = vega_expression_module_lex();
    token.prec = prec;
    stack.push(token);
    markers.push(vega_expression_module_lookahead);
    expr = vega_expression_module_parseUnaryExpression();
    stack.push(expr);
  } // Final reduce to clean-up the stack.


  i = stack.length - 1;
  expr = stack[i];
  markers.pop();

  while (i > 1) {
    markers.pop();
    expr = vega_expression_module_finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
    i -= 2;
  }

  return expr;
} // 11.12 Conditional Operator


function vega_expression_module_parseConditionalExpression() {
  var expr, consequent, alternate;
  expr = vega_expression_module_parseBinaryExpression();

  if (vega_expression_module_match('?')) {
    vega_expression_module_lex();
    consequent = vega_expression_module_parseConditionalExpression();
    vega_expression_module_expect(':');
    alternate = vega_expression_module_parseConditionalExpression();
    expr = vega_expression_module_finishConditionalExpression(expr, consequent, alternate);
  }

  return expr;
} // 11.14 Comma Operator


function vega_expression_module_parseExpression() {
  const expr = vega_expression_module_parseConditionalExpression();

  if (vega_expression_module_match(',')) {
    throw new Error(vega_expression_module_DISABLED); // no sequence expressions
  }

  return expr;
}

function vega_expression_module_parser (code) {
  build_vega_expression_module_source = code;
  build_vega_expression_module_index = 0;
  build_vega_expression_module_length = build_vega_expression_module_source.length;
  vega_expression_module_lookahead = null;
  vega_expression_module_peek();
  const expr = vega_expression_module_parseExpression();

  if (vega_expression_module_lookahead.type !== vega_expression_module_TokenEOF) {
    throw new Error('Unexpect token after expression.');
  }

  return expr;
}

var vega_expression_module_Constants = {
  NaN: 'NaN',
  E: 'Math.E',
  LN2: 'Math.LN2',
  LN10: 'Math.LN10',
  LOG2E: 'Math.LOG2E',
  LOG10E: 'Math.LOG10E',
  PI: 'Math.PI',
  SQRT1_2: 'Math.SQRT1_2',
  SQRT2: 'Math.SQRT2',
  MIN_VALUE: 'Number.MIN_VALUE',
  MAX_VALUE: 'Number.MAX_VALUE'
};

function vega_expression_module_Functions (codegen) {
  function fncall(name, args, cast, type) {
    let obj = codegen(args[0]);

    if (cast) {
      obj = cast + '(' + obj + ')';
      if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';
    }

    return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')');
  }

  function fn(name, cast, type) {
    return args => fncall(name, args, cast, type);
  }

  const DATE = 'new Date',
        STRING = 'String',
        REGEXP = 'RegExp';
  return {
    // MATH functions
    isNaN: 'Number.isNaN',
    isFinite: 'Number.isFinite',
    abs: 'Math.abs',
    acos: 'Math.acos',
    asin: 'Math.asin',
    atan: 'Math.atan',
    atan2: 'Math.atan2',
    ceil: 'Math.ceil',
    cos: 'Math.cos',
    exp: 'Math.exp',
    floor: 'Math.floor',
    log: 'Math.log',
    max: 'Math.max',
    min: 'Math.min',
    pow: 'Math.pow',
    random: 'Math.random',
    round: 'Math.round',
    sin: 'Math.sin',
    sqrt: 'Math.sqrt',
    tan: 'Math.tan',
    clamp: function (args) {
      if (args.length < 3) Object(vega_util_module["o" /* error */])('Missing arguments to clamp function.');
      if (args.length > 3) Object(vega_util_module["o" /* error */])('Too many arguments to clamp function.');
      const a = args.map(codegen);
      return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))';
    },
    // DATE functions
    now: 'Date.now',
    utc: 'Date.UTC',
    datetime: DATE,
    date: fn('getDate', DATE, 0),
    day: fn('getDay', DATE, 0),
    year: fn('getFullYear', DATE, 0),
    month: fn('getMonth', DATE, 0),
    hours: fn('getHours', DATE, 0),
    minutes: fn('getMinutes', DATE, 0),
    seconds: fn('getSeconds', DATE, 0),
    milliseconds: fn('getMilliseconds', DATE, 0),
    time: fn('getTime', DATE, 0),
    timezoneoffset: fn('getTimezoneOffset', DATE, 0),
    utcdate: fn('getUTCDate', DATE, 0),
    utcday: fn('getUTCDay', DATE, 0),
    utcyear: fn('getUTCFullYear', DATE, 0),
    utcmonth: fn('getUTCMonth', DATE, 0),
    utchours: fn('getUTCHours', DATE, 0),
    utcminutes: fn('getUTCMinutes', DATE, 0),
    utcseconds: fn('getUTCSeconds', DATE, 0),
    utcmilliseconds: fn('getUTCMilliseconds', DATE, 0),
    // sequence functions
    length: fn('length', null, -1),
    // STRING functions
    parseFloat: 'parseFloat',
    parseInt: 'parseInt',
    upper: fn('toUpperCase', STRING, 0),
    lower: fn('toLowerCase', STRING, 0),
    substring: fn('substring', STRING),
    split: fn('split', STRING),
    trim: fn('trim', STRING, 0),
    // REGEXP functions
    regexp: REGEXP,
    test: fn('test', REGEXP),
    // Control Flow functions
    if: function (args) {
      if (args.length < 3) Object(vega_util_module["o" /* error */])('Missing arguments to if function.');
      if (args.length > 3) Object(vega_util_module["o" /* error */])('Too many arguments to if function.');
      const a = args.map(codegen);
      return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')';
    }
  };
}

function vega_expression_module_stripQuotes(s) {
  const n = s && s.length - 1;
  return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s;
}

function build_vega_expression_module_codegen (opt) {
  opt = opt || {};
  const allowed = opt.allowed ? Object(vega_util_module["fb" /* toSet */])(opt.allowed) : {},
        forbidden = opt.forbidden ? Object(vega_util_module["fb" /* toSet */])(opt.forbidden) : {},
        constants = opt.constants || vega_expression_module_Constants,
        functions = (opt.functions || vega_expression_module_Functions)(visit),
        globalvar = opt.globalvar,
        fieldvar = opt.fieldvar,
        outputGlobal = Object(vega_util_module["E" /* isFunction */])(globalvar) ? globalvar : id => `${globalvar}["${id}"]`;
  let globals = {},
      fields = {},
      memberDepth = 0;

  function visit(ast) {
    if (Object(vega_util_module["J" /* isString */])(ast)) return ast;
    const generator = Generators[ast.type];
    if (generator == null) Object(vega_util_module["o" /* error */])('Unsupported type: ' + ast.type);
    return generator(ast);
  }

  const Generators = {
    Literal: n => n.raw,
    Identifier: n => {
      const id = n.name;

      if (memberDepth > 0) {
        return id;
      } else if (Object(vega_util_module["w" /* hasOwnProperty */])(forbidden, id)) {
        return Object(vega_util_module["o" /* error */])('Illegal identifier: ' + id);
      } else if (Object(vega_util_module["w" /* hasOwnProperty */])(constants, id)) {
        return constants[id];
      } else if (Object(vega_util_module["w" /* hasOwnProperty */])(allowed, id)) {
        return id;
      } else {
        globals[id] = 1;
        return outputGlobal(id);
      }
    },
    MemberExpression: n => {
      const d = !n.computed,
            o = visit(n.object);
      if (d) memberDepth += 1;
      const p = visit(n.property);

      if (o === fieldvar) {
        // strip quotes to sanitize field name (#1653)
        fields[vega_expression_module_stripQuotes(p)] = 1;
      }

      if (d) memberDepth -= 1;
      return o + (d ? '.' + p : '[' + p + ']');
    },
    CallExpression: n => {
      if (n.callee.type !== 'Identifier') {
        Object(vega_util_module["o" /* error */])('Illegal callee type: ' + n.callee.type);
      }

      const callee = n.callee.name,
            args = n.arguments,
            fn = Object(vega_util_module["w" /* hasOwnProperty */])(functions, callee) && functions[callee];
      if (!fn) Object(vega_util_module["o" /* error */])('Unrecognized function: ' + callee);
      return Object(vega_util_module["E" /* isFunction */])(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')';
    },
    ArrayExpression: n => '[' + n.elements.map(visit).join(',') + ']',
    BinaryExpression: n => '(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')',
    UnaryExpression: n => '(' + n.operator + visit(n.argument) + ')',
    ConditionalExpression: n => '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')',
    LogicalExpression: n => '(' + visit(n.left) + n.operator + visit(n.right) + ')',
    ObjectExpression: n => '{' + n.properties.map(visit).join(',') + '}',
    Property: n => {
      memberDepth += 1;
      const k = visit(n.key);
      memberDepth -= 1;
      return k + ':' + visit(n.value);
    }
  };

  function codegen(ast) {
    const result = {
      code: visit(ast),
      globals: Object.keys(globals),
      fields: Object.keys(fields)
    };
    globals = {};
    fields = {};
    return result;
  }

  codegen.functions = functions;
  codegen.constants = constants;
  return codegen;
}



// CONCATENATED MODULE: ./node_modules/vega-selections/build/vega-selection.module.js



function vega_selection_module_ascending (a, b) {
  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}

function vega_selection_module_bisector (f) {
  let delta = f;
  let compare = f;

  if (f.length === 1) {
    delta = (d, x) => f(d) - x;

    compare = ascendingComparator(f);
  }

  function left(a, x, lo, hi) {
    if (lo == null) lo = 0;
    if (hi == null) hi = a.length;

    while (lo < hi) {
      const mid = lo + hi >>> 1;
      if (compare(a[mid], x) < 0) lo = mid + 1;else hi = mid;
    }

    return lo;
  }

  function right(a, x, lo, hi) {
    if (lo == null) lo = 0;
    if (hi == null) hi = a.length;

    while (lo < hi) {
      const mid = lo + hi >>> 1;
      if (compare(a[mid], x) > 0) hi = mid;else lo = mid + 1;
    }

    return lo;
  }

  function center(a, x, lo, hi) {
    if (lo == null) lo = 0;
    if (hi == null) hi = a.length;
    const i = left(a, x, lo, hi - 1);
    return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
  }

  return {
    left,
    center,
    right
  };
}

function ascendingComparator(f) {
  return (d, x) => vega_selection_module_ascending(f(d), x);
}

const Intersect = 'intersect';
const Union = 'union';
const VlMulti = 'vlMulti';
const VlPoint = 'vlPoint';
const Or = 'or';
const And = 'and';

const SELECTION_ID = '_vgsid_',
      TYPE_ENUM = 'E',
      TYPE_RANGE_INC = 'R',
      TYPE_RANGE_EXC = 'R-E',
      TYPE_RANGE_LE = 'R-LE',
      TYPE_RANGE_RE = 'R-RE',
      UNIT_INDEX = 'index:unit'; // TODO: revisit date coercion?

function testPoint(datum, entry) {
  var fields = entry.fields,
      values = entry.values,
      n = fields.length,
      i = 0,
      dval,
      f;

  for (; i < n; ++i) {
    f = fields[i];
    f.getter = vega_util_module["u" /* field */].getter || Object(vega_util_module["u" /* field */])(f.field);
    dval = f.getter(datum);
    if (Object(vega_util_module["D" /* isDate */])(dval)) dval = Object(vega_util_module["eb" /* toNumber */])(dval);
    if (Object(vega_util_module["D" /* isDate */])(values[i])) values[i] = Object(vega_util_module["eb" /* toNumber */])(values[i]);
    if (Object(vega_util_module["D" /* isDate */])(values[i][0])) values[i] = values[i].map(vega_util_module["eb" /* toNumber */]);

    if (f.type === TYPE_ENUM) {
      // Enumerated fields can either specify individual values (single/multi selections)
      // or an array of values (interval selections).
      if (Object(vega_util_module["B" /* isArray */])(values[i]) ? values[i].indexOf(dval) < 0 : dval !== values[i]) {
        return false;
      }
    } else {
      if (f.type === TYPE_RANGE_INC) {
        if (!Object(vega_util_module["A" /* inrange */])(dval, values[i])) return false;
      } else if (f.type === TYPE_RANGE_RE) {
        // Discrete selection of bins test within the range [bin_start, bin_end).
        if (!Object(vega_util_module["A" /* inrange */])(dval, values[i], true, false)) return false;
      } else if (f.type === TYPE_RANGE_EXC) {
        // 'R-E'/'R-LE' included for completeness.
        if (!Object(vega_util_module["A" /* inrange */])(dval, values[i], false, false)) return false;
      } else if (f.type === TYPE_RANGE_LE) {
        if (!Object(vega_util_module["A" /* inrange */])(dval, values[i], false, true)) return false;
      }
    }
  }

  return true;
}
/**
 * Tests if a tuple is contained within an interactive selection.
 * @param {string} name - The name of the data set representing the selection.
 *  Tuples in the dataset are of the form
 *  {unit: string, fields: array<fielddef>, values: array<*>}.
 *  Fielddef is of the form
 *  {field: string, channel: string, type: 'E' | 'R'} where
 *  'type' identifies whether tuples in the dataset enumerate
 *  values for the field, or specify a continuous range.
 * @param {object} datum - The tuple to test for inclusion.
 * @param {string} op - The set operation for combining selections.
 *   One of 'intersect' or 'union' (default).
 * @return {boolean} - True if the datum is in the selection, false otherwise.
 */


function selectionTest(name, datum, op) {
  var data = this.context.data[name],
      entries = data ? data.values.value : [],
      unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined,
      intersect = op === Intersect,
      n = entries.length,
      i = 0,
      entry,
      miss,
      count,
      unit,
      b;

  for (; i < n; ++i) {
    entry = entries[i];

    if (unitIdx && intersect) {
      // multi selections union within the same unit and intersect across units.
      miss = miss || {};
      count = miss[unit = entry.unit] || 0; // if we've already matched this unit, skip.

      if (count === -1) continue;
      b = testPoint(datum, entry);
      miss[unit] = b ? -1 : ++count; // if we match and there are no other units return true
      // if we've missed against all tuples in this unit return false

      if (b && unitIdx.size === 1) return true;
      if (!b && count === unitIdx.get(unit).count) return false;
    } else {
      b = testPoint(datum, entry); // if we find a miss and we do require intersection return false
      // if we find a match and we don't require intersection return true

      if (intersect ^ b) return b;
    }
  } // if intersecting and we made it here, then we saw no misses
  // if not intersecting, then we saw no matches
  // if no active selections, return false


  return n && intersect;
}
const selectionId = Object(vega_util_module["u" /* field */])(SELECTION_ID),
      vega_selection_module_bisect = vega_selection_module_bisector(selectionId),
      vega_selection_module_bisectLeft = vega_selection_module_bisect.left,
      vega_selection_module_bisectRight = vega_selection_module_bisect.right;
function selectionIdTest(name, datum, op) {
  const data = this.context.data[name],
        entries = data ? data.values.value : [],
        unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined,
        intersect = op === Intersect,
        value = selectionId(datum),
        index = vega_selection_module_bisectLeft(entries, value);
  if (index === entries.length) return false;
  if (selectionId(entries[index]) !== value) return false;

  if (unitIdx && intersect) {
    if (unitIdx.size === 1) return true;
    if (vega_selection_module_bisectRight(entries, value) - index < unitIdx.size) return false;
  }

  return true;
}

/**
 * Maps an array of scene graph items to an array of selection tuples.
 * @param {string} name  - The name of the dataset representing the selection.
 * @param {string} unit  - The name of the unit view.
 *
 * @returns {array} An array of selection entries for the given unit.
 */

function selectionTuples(array, base) {
  return array.map(x => Object(vega_util_module["p" /* extend */])({
    values: base.fields.map(f => (f.getter || (f.getter = Object(vega_util_module["u" /* field */])(f.field)))(x.datum))
  }, base));
}

/**
 * Resolves selection for use as a scale domain or reads via the API.
 * @param {string} name - The name of the dataset representing the selection
 * @param {string} [op='union'] - The set operation for combining selections.
 *                 One of 'intersect' or 'union' (default).
 * @param {boolean} isMulti - Identifies a "multi" selection to perform more
 *                 expensive resolution computation.
 * @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point"
 *                 selections, and thus the resolved tuple should reflect this name.
 *                 This parameter allows us to reflect this change without triggering
 *                 a major version bump for Vega.
 * @returns {object} An object of selected fields and values.
 */

function selectionResolve(name, op, isMulti, vl5) {
  var data = this.context.data[name],
      entries = data ? data.values.value : [],
      resolved = {},
      multiRes = {},
      types = {},
      entry,
      fields,
      values,
      unit,
      field,
      res,
      resUnit,
      type,
      union,
      n = entries.length,
      i = 0,
      j,
      m; // First union all entries within the same unit.

  for (; i < n; ++i) {
    entry = entries[i];
    unit = entry.unit;
    fields = entry.fields;
    values = entry.values;

    for (j = 0, m = fields.length; j < m; ++j) {
      field = fields[j];
      res = resolved[field.field] || (resolved[field.field] = {});
      resUnit = res[unit] || (res[unit] = []);
      types[field.field] = type = field.type.charAt(0);
      union = vega_selection_module_ops[type + '_union'];
      res[unit] = union(resUnit, Object(vega_util_module["i" /* array */])(values[j]));
    } // If the same multi-selection is repeated over views and projected over
    // an encoding, it may operate over different fields making it especially
    // tricky to reliably resolve it. At best, we can de-dupe identical entries
    // but doing so may be more computationally expensive than it is worth.
    // Instead, for now, we simply transform our store representation into
    // a more human-friendly one.


    if (isMulti) {
      resUnit = multiRes[unit] || (multiRes[unit] = []);
      resUnit.push(Object(vega_util_module["i" /* array */])(values).reduce((obj, curr, j) => (obj[fields[j].field] = curr, obj), {}));
    }
  } // Then resolve fields across units as per the op.


  op = op || Union;
  Object.keys(resolved).forEach(field => {
    resolved[field] = Object.keys(resolved[field]).map(unit => resolved[field][unit]).reduce((acc, curr) => acc === undefined ? curr : vega_selection_module_ops[types[field] + '_' + op](acc, curr));
  });
  entries = Object.keys(multiRes);

  if (isMulti && entries.length) {
    const key = vl5 ? VlPoint : VlMulti;
    resolved[key] = op === Union ? {
      [Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), [])
    } : {
      [And]: entries.map(k => ({
        [Or]: multiRes[k]
      }))
    };
  }

  return resolved;
}
var vega_selection_module_ops = {
  E_union: function (base, value) {
    if (!base.length) return value;
    var i = 0,
        n = value.length;

    for (; i < n; ++i) if (base.indexOf(value[i]) < 0) base.push(value[i]);

    return base;
  },
  E_intersect: function (base, value) {
    return !base.length ? value : base.filter(v => value.indexOf(v) >= 0);
  },
  R_union: function (base, value) {
    var lo = Object(vega_util_module["eb" /* toNumber */])(value[0]),
        hi = Object(vega_util_module["eb" /* toNumber */])(value[1]);

    if (lo > hi) {
      lo = value[1];
      hi = value[0];
    }

    if (!base.length) return [lo, hi];
    if (base[0] > lo) base[0] = lo;
    if (base[1] < hi) base[1] = hi;
    return base;
  },
  R_intersect: function (base, value) {
    var lo = Object(vega_util_module["eb" /* toNumber */])(value[0]),
        hi = Object(vega_util_module["eb" /* toNumber */])(value[1]);

    if (lo > hi) {
      lo = value[1];
      hi = value[0];
    }

    if (!base.length) return [lo, hi];

    if (hi < base[0] || base[1] < lo) {
      return [];
    } else {
      if (base[0] < lo) base[0] = lo;
      if (base[1] > hi) base[1] = hi;
    }

    return base;
  }
};

const DataPrefix = ':',
      IndexPrefix = '@';
function selectionVisitor(name, args, scope, params) {
  if (args[0].type !== vega_expression_module_Literal) Object(vega_util_module["o" /* error */])('First argument to selection functions must be a string literal.');
  const data = args[0].value,
        op = args.length >= 2 && Object(vega_util_module["W" /* peek */])(args).value,
        field = 'unit',
        indexName = IndexPrefix + field,
        dataName = DataPrefix + data; // eslint-disable-next-line no-prototype-builtins

  if (op === Intersect && !Object(vega_util_module["w" /* hasOwnProperty */])(params, indexName)) {
    params[indexName] = scope.getData(data).indataRef(scope, field);
  } // eslint-disable-next-line no-prototype-builtins


  if (!Object(vega_util_module["w" /* hasOwnProperty */])(params, dataName)) {
    params[dataName] = scope.getData(data).tuplesRef();
  }
}



// CONCATENATED MODULE: ./node_modules/vega-functions/build/vega-functions.module.js












function vega_functions_module_data(name) {
  const data = this.context.data[name];
  return data ? data.values.value : [];
}
function indata(name, field, value) {
  const index = this.context.data[name]['index:' + field],
        entry = index ? index.value.get(value) : undefined;
  return entry ? entry.count : entry;
}
function setdata(name, tuples) {
  const df = this.context.dataflow,
        data = this.context.data[name],
        input = data.input;
  df.pulse(input, df.changeset().remove(vega_util_module["ib" /* truthy */]).insert(tuples));
  return 1;
}

function vega_functions_module_encode (item, name, retval) {
  if (item) {
    const df = this.context.dataflow,
          target = item.mark.source;
    df.pulse(target, df.changeset().encode(item, name));
  }

  return retval !== undefined ? retval : item;
}

const vega_functions_module_wrap = method => function (value, spec) {
  const locale = this.context.dataflow.locale();
  return locale[method](spec)(value);
};

const vega_functions_module_format = vega_functions_module_wrap('format');
const timeFormat = vega_functions_module_wrap('timeFormat');
const utcFormat = vega_functions_module_wrap('utcFormat');
const timeParse = vega_functions_module_wrap('timeParse');
const utcParse = vega_functions_module_wrap('utcParse');
const dateObj = new Date(2000, 0, 1);

function vega_functions_module_time(month, day, specifier) {
  if (!Number.isInteger(month) || !Number.isInteger(day)) return '';
  dateObj.setYear(2000);
  dateObj.setMonth(month);
  dateObj.setDate(day);
  return timeFormat.call(this, dateObj, specifier);
}

function monthFormat(month) {
  return vega_functions_module_time.call(this, month, 1, '%B');
}
function monthAbbrevFormat(month) {
  return vega_functions_module_time.call(this, month, 1, '%b');
}
function dayFormat(day) {
  return vega_functions_module_time.call(this, 0, 2 + day, '%A');
}
function dayAbbrevFormat(day) {
  return vega_functions_module_time.call(this, 0, 2 + day, '%a');
}

const vega_functions_module_DataPrefix = ':';
const vega_functions_module_IndexPrefix = '@';
const ScalePrefix = '%';
const SignalPrefix = '$';

function dataVisitor(name, args, scope, params) {
  if (args[0].type !== Literal) {
    Object(vega_util_module["o" /* error */])('First argument to data functions must be a string literal.');
  }

  const data = args[0].value,
        dataName = vega_functions_module_DataPrefix + data;

  if (!Object(vega_util_module["w" /* hasOwnProperty */])(dataName, params)) {
    try {
      params[dataName] = scope.getData(data).tuplesRef();
    } catch (err) {// if data set does not exist, there's nothing to track
    }
  }
}
function indataVisitor(name, args, scope, params) {
  if (args[0].type !== Literal) Object(vega_util_module["o" /* error */])('First argument to indata must be a string literal.');
  if (args[1].type !== Literal) Object(vega_util_module["o" /* error */])('Second argument to indata must be a string literal.');
  const data = args[0].value,
        field = args[1].value,
        indexName = vega_functions_module_IndexPrefix + field;

  if (!Object(vega_util_module["w" /* hasOwnProperty */])(indexName, params)) {
    params[indexName] = scope.getData(data).indataRef(scope, field);
  }
}
function scaleVisitor(name, args, scope, params) {
  if (args[0].type === Literal) {
    // add scale dependency
    addScaleDependency(scope, params, args[0].value);
  } else {
    // indirect scale lookup; add all scales as parameters
    for (name in scope.scales) {
      addScaleDependency(scope, params, name);
    }
  }
}

function addScaleDependency(scope, params, name) {
  const scaleName = ScalePrefix + name;

  if (!Object(vega_util_module["w" /* hasOwnProperty */])(params, scaleName)) {
    try {
      params[scaleName] = scope.scaleRef(name);
    } catch (err) {// TODO: error handling? warning?
    }
  }
}

function getScale(name, ctx) {
  let s;
  return Object(vega_util_module["E" /* isFunction */])(name) ? name : Object(vega_util_module["J" /* isString */])(name) ? (s = ctx.scales[name]) && s.value : undefined;
}
function internalScaleFunctions(codegen, fnctx, visitors) {
  // add helper method to the 'this' expression function context
  fnctx.__bandwidth = s => s && s.bandwidth ? s.bandwidth() : 0; // register AST visitors for internal scale functions


  visitors._bandwidth = scaleVisitor;
  visitors._range = scaleVisitor;
  visitors._scale = scaleVisitor; // resolve scale reference directly to the signal hash argument

  const ref = arg => '_[' + (arg.type === Literal ? Object(vega_util_module["bb" /* stringValue */])(ScalePrefix + arg.value) : Object(vega_util_module["bb" /* stringValue */])(ScalePrefix) + '+' + codegen(arg)) + ']'; // define and return internal scale function code generators
  // these internal functions are called by mark encoders


  return {
    _bandwidth: args => `this.__bandwidth(${ref(args[0])})`,
    _range: args => `${ref(args[0])}.range()`,
    _scale: args => `${ref(args[0])}(${codegen(args[1])})`
  };
}

function geoMethod(methodName, globalMethod) {
  return function (projection, geojson, group) {
    if (projection) {
      // projection defined, use it
      const p = getScale(projection, (group || this).context);
      return p && p.path[methodName](geojson);
    } else {
      // projection undefined, use global method
      return globalMethod(geojson);
    }
  };
}

const geoArea = geoMethod('area', d3_geo_src_area);
const geoBounds = geoMethod('bounds', src_bounds);
const geoCentroid = geoMethod('centroid', src_centroid);

function inScope (item) {
  const group = this.context.group;
  let value = false;
  if (group) while (item) {
    if (item === group) {
      value = true;
      break;
    }

    item = item.mark.group;
  }
  return value;
}

function vega_functions_module_log(df, method, args) {
  try {
    df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args)));
  } catch (err) {
    df.warn(err);
  }

  return args[args.length - 1];
}

function warn() {
  return vega_functions_module_log(this.context.dataflow, 'warn', arguments);
}
function info() {
  return vega_functions_module_log(this.context.dataflow, 'info', arguments);
}
function debug() {
  return vega_functions_module_log(this.context.dataflow, 'debug', arguments);
}

function channel_luminance_value(channelValue) {
  const val = channelValue / 255;

  if (val <= 0.03928) {
    return val / 12.92;
  }

  return Math.pow((val + 0.055) / 1.055, 2.4);
}

function luminance(color) {
  const c = color_rgb(color),
        r = channel_luminance_value(c.r),
        g = channel_luminance_value(c.g),
        b = channel_luminance_value(c.b);
  return 0.2126 * r + 0.7152 * g + 0.0722 * b;
} // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef

function contrast(color1, color2) {
  const lum1 = luminance(color1),
        lum2 = luminance(color2),
        lumL = Math.max(lum1, lum2),
        lumD = Math.min(lum1, lum2);
  return (lumL + 0.05) / (lumD + 0.05);
}

function vega_functions_module_merge () {
  const args = [].slice.call(arguments);
  args.unshift({});
  return Object(vega_util_module["p" /* extend */])(...args);
}

function equal(a, b) {
  return a === b || a !== a && b !== b ? true : Object(vega_util_module["B" /* isArray */])(a) ? Object(vega_util_module["B" /* isArray */])(b) && a.length === b.length ? equalArray(a, b) : false : Object(vega_util_module["H" /* isObject */])(a) && Object(vega_util_module["H" /* isObject */])(b) ? equalObject(a, b) : false;
}

function equalArray(a, b) {
  for (let i = 0, n = a.length; i < n; ++i) {
    if (!equal(a[i], b[i])) return false;
  }

  return true;
}

function equalObject(a, b) {
  for (const key in a) {
    if (!equal(a[key], b[key])) return false;
  }

  return true;
}

function removePredicate(props) {
  return _ => equalObject(props, _);
}

function vega_functions_module_modify (name, insert, remove, toggle, modify, values) {
  const df = this.context.dataflow,
        data = this.context.data[name],
        input = data.input,
        stamp = df.stamp();
  let changes = data.changes,
      predicate,
      key;

  if (df._trigger === false || !(input.value.length || insert || toggle)) {
    // nothing to do!
    return 0;
  }

  if (!changes || changes.stamp < stamp) {
    data.changes = changes = df.changeset();
    changes.stamp = stamp;
    df.runAfter(() => {
      data.modified = true;
      df.pulse(input, changes).run();
    }, true, 1);
  }

  if (remove) {
    predicate = remove === true ? vega_util_module["ib" /* truthy */] : Object(vega_util_module["B" /* isArray */])(remove) || isTuple(remove) ? remove : removePredicate(remove);
    changes.remove(predicate);
  }

  if (insert) {
    changes.insert(insert);
  }

  if (toggle) {
    predicate = removePredicate(toggle);

    if (input.value.some(predicate)) {
      changes.remove(predicate);
    } else {
      changes.insert(toggle);
    }
  }

  if (modify) {
    for (key in values) {
      changes.modify(modify, key, values[key]);
    }
  }

  return 1;
}

function pinchDistance(event) {
  const t = event.touches,
        dx = t[0].clientX - t[1].clientX,
        dy = t[0].clientY - t[1].clientY;
  return Math.sqrt(dx * dx + dy * dy);
}
function pinchAngle(event) {
  const t = event.touches;
  return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX);
}

const accessors = {};
function pluck (data, name) {
  const accessor = accessors[name] || (accessors[name] = Object(vega_util_module["u" /* field */])(name));
  return Object(vega_util_module["B" /* isArray */])(data) ? data.map(accessor) : accessor(data);
}

function vega_functions_module_array(seq) {
  return Object(vega_util_module["B" /* isArray */])(seq) || ArrayBuffer.isView(seq) ? seq : null;
}

function vega_functions_module_sequence(seq) {
  return vega_functions_module_array(seq) || (Object(vega_util_module["J" /* isString */])(seq) ? seq : null);
}

function vega_functions_module_join(seq, ...args) {
  return vega_functions_module_array(seq).join(...args);
}
function indexof(seq, ...args) {
  return vega_functions_module_sequence(seq).indexOf(...args);
}
function lastindexof(seq, ...args) {
  return vega_functions_module_sequence(seq).lastIndexOf(...args);
}
function vega_functions_module_slice(seq, ...args) {
  return vega_functions_module_sequence(seq).slice(...args);
}
function vega_functions_module_replace(str, pattern, repl) {
  if (Object(vega_util_module["E" /* isFunction */])(repl)) Object(vega_util_module["o" /* error */])('Function argument passed to replace.');
  return String(str).replace(pattern, repl);
}
function vega_functions_module_reverse(seq) {
  return vega_functions_module_array(seq).slice().reverse();
}

function bandspace(count, paddingInner, paddingOuter) {
  return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0);
}
function vega_functions_module_bandwidth(name, group) {
  const s = getScale(name, (group || this).context);
  return s && s.bandwidth ? s.bandwidth() : 0;
}
function vega_functions_module_copy(name, group) {
  const s = getScale(name, (group || this).context);
  return s ? s.copy() : undefined;
}
function vega_functions_module_domain(name, group) {
  const s = getScale(name, (group || this).context);
  return s ? s.domain() : [];
}
function vega_functions_module_invert(name, range, group) {
  const s = getScale(name, (group || this).context);
  return !s ? undefined : Object(vega_util_module["B" /* isArray */])(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range);
}
function vega_functions_module_range(name, group) {
  const s = getScale(name, (group || this).context);
  return s && s.range ? s.range() : [];
}
function vega_functions_module_scale(name, value, group) {
  const s = getScale(name, (group || this).context);
  return s ? s(value) : undefined;
}

function scaleGradient (scale, p0, p1, count, group) {
  scale = getScale(scale, (group || this).context);
  const gradient = Gradient(p0, p1);
  let stops = scale.domain(),
      min = stops[0],
      max = Object(vega_util_module["W" /* peek */])(stops),
      fraction = vega_util_module["y" /* identity */];

  if (!(max - min)) {
    // expand scale if domain has zero span, fix #1479
    scale = (scale.interpolator ? vega_scale_module_scale('sequential')().interpolator(scale.interpolator()) : vega_scale_module_scale('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([min = 0, max = 1]);
  } else {
    fraction = scaleFraction(scale, min, max);
  }

  if (scale.ticks) {
    stops = scale.ticks(+count || 15);
    if (min !== stops[0]) stops.unshift(min);
    if (max !== Object(vega_util_module["W" /* peek */])(stops)) stops.push(max);
  }

  stops.forEach(_ => gradient.stop(fraction(_), scale(_)));
  return gradient;
}

function geoShape(projection, geojson, group) {
  const p = getScale(projection, (group || this).context);
  return function (context) {
    return p ? p.path.context(context)(geojson) : '';
  };
}
function pathShape(path) {
  let p = null;
  return function (context) {
    return context ? pathRender(context, p = p || pathParse(path)) : path;
  };
}

const vega_functions_module_datum = d => d.data;

function treeNodes(name, context) {
  const tree = vega_functions_module_data.call(context, name);
  return tree.root && tree.root.lookup || {};
}

function treePath(name, source, target) {
  const nodes = treeNodes(name, this),
        s = nodes[source],
        t = nodes[target];
  return s && t ? s.path(t).map(vega_functions_module_datum) : undefined;
}
function treeAncestors(name, node) {
  const n = treeNodes(name, this)[node];
  return n ? n.ancestors().map(vega_functions_module_datum) : undefined;
}

const _window = () => typeof window !== 'undefined' && window || null;

function screen() {
  const w = _window();

  return w ? w.screen : {};
}
function windowSize() {
  const w = _window();

  return w ? [w.innerWidth, w.innerHeight] : [undefined, undefined];
}
function containerSize() {
  const view = this.context.dataflow,
        el = view.container && view.container();
  return el ? [el.clientWidth, el.clientHeight] : [undefined, undefined];
}

function vega_functions_module_intersect (b, opt, group) {
  if (!b) return [];
  const [u, v] = b,
        box = new Bounds().set(u[0], u[1], v[0], v[1]),
        scene = group || this.context.dataflow.scenegraph().root;
  return vega_scenegraph_module_intersect(scene, box, vega_functions_module_filter(opt));
}

function vega_functions_module_filter(opt) {
  let p = null;

  if (opt) {
    const types = Object(vega_util_module["i" /* array */])(opt.marktype),
          names = Object(vega_util_module["i" /* array */])(opt.markname);

    p = _ => (!types.length || types.some(t => _.marktype === t)) && (!names.length || names.some(s => _.name === s));
  }

  return p;
}

const functionContext = {
  random() {
    return vega_statistics_module_random();
  },

  // override default
  cumulativeNormal: cumulativeNormal,
  cumulativeLogNormal: cumulativeLogNormal,
  cumulativeUniform: cumulativeUniform,
  densityNormal: densityNormal,
  densityLogNormal: densityLogNormal,
  densityUniform: densityUniform,
  quantileNormal: quantileNormal,
  quantileLogNormal: quantileLogNormal,
  quantileUniform: quantileUniform,
  sampleNormal: sampleNormal,
  sampleLogNormal: sampleLogNormal,
  sampleUniform: sampleUniform,
  isArray: vega_util_module["B" /* isArray */],
  isBoolean: vega_util_module["C" /* isBoolean */],
  isDate: vega_util_module["D" /* isDate */],

  isDefined(_) {
    return _ !== undefined;
  },

  isNumber: vega_util_module["G" /* isNumber */],
  isObject: vega_util_module["H" /* isObject */],
  isRegExp: vega_util_module["I" /* isRegExp */],
  isString: vega_util_module["J" /* isString */],
  isTuple: isTuple,

  isValid(_) {
    return _ != null && _ === _;
  },

  toBoolean: vega_util_module["cb" /* toBoolean */],
  toDate: vega_util_module["db" /* toDate */],
  toNumber: vega_util_module["eb" /* toNumber */],
  toString: vega_util_module["gb" /* toString */],
  indexof,
  join: vega_functions_module_join,
  lastindexof,
  replace: vega_functions_module_replace,
  reverse: vega_functions_module_reverse,
  slice: vega_functions_module_slice,
  flush: vega_util_module["v" /* flush */],
  lerp: vega_util_module["L" /* lerp */],
  merge: vega_functions_module_merge,
  pad: vega_util_module["R" /* pad */],
  peek: vega_util_module["W" /* peek */],
  pluck,
  span: vega_util_module["Z" /* span */],
  inrange: vega_util_module["A" /* inrange */],
  truncate: vega_util_module["hb" /* truncate */],
  rgb: color_rgb,
  lab: lab,
  hcl: hcl,
  hsl: hsl,
  luminance,
  contrast,
  sequence: src_range,
  format: vega_functions_module_format,
  utcFormat,
  utcParse,
  utcOffset: vega_time_module["w" /* utcOffset */],
  utcSequence: vega_time_module["x" /* utcSequence */],
  timeFormat,
  timeParse,
  timeOffset: vega_time_module["q" /* timeOffset */],
  timeSequence: vega_time_module["r" /* timeSequence */],
  timeUnitSpecifier: vega_time_module["s" /* timeUnitSpecifier */],
  monthFormat,
  monthAbbrevFormat,
  dayFormat,
  dayAbbrevFormat,
  quarter: vega_util_module["X" /* quarter */],
  utcquarter: vega_util_module["jb" /* utcquarter */],
  week: vega_time_module["A" /* week */],
  utcweek: vega_time_module["z" /* utcweek */],
  dayofyear: vega_time_module["m" /* dayofyear */],
  utcdayofyear: vega_time_module["y" /* utcdayofyear */],
  warn,
  info,
  debug,
  extent: vega_util_module["q" /* extent */],
  inScope,
  intersect: vega_functions_module_intersect,
  clampRange: vega_util_module["k" /* clampRange */],
  pinchDistance,
  pinchAngle,
  screen,
  containerSize,
  windowSize,
  bandspace,
  setdata,
  pathShape,
  panLinear: vega_util_module["S" /* panLinear */],
  panLog: vega_util_module["T" /* panLog */],
  panPow: vega_util_module["U" /* panPow */],
  panSymlog: vega_util_module["V" /* panSymlog */],
  zoomLinear: vega_util_module["nb" /* zoomLinear */],
  zoomLog: vega_util_module["ob" /* zoomLog */],
  zoomPow: vega_util_module["pb" /* zoomPow */],
  zoomSymlog: vega_util_module["qb" /* zoomSymlog */],
  encode: vega_functions_module_encode,
  modify: vega_functions_module_modify
};
const eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'],
      // event functions
eventPrefix = 'event.vega.',
      // event function prefix
thisPrefix = 'this.',
      // function context prefix
astVisitors = {}; // AST visitors for dependency analysis
// export code generator parameters

const codegenParams = {
  forbidden: ['_'],
  allowed: ['datum', 'event', 'item'],
  fieldvar: 'datum',
  globalvar: id => `_[${Object(vega_util_module["bb" /* stringValue */])(SignalPrefix + id)}]`,
  functions: buildFunctions,
  constants: Constants,
  visitors: astVisitors
}; // export code generator

const codeGenerator = vega_expression_module_codegen(codegenParams); // Build expression function registry

function buildFunctions(codegen) {
  const fn = Functions(codegen);
  eventFunctions.forEach(name => fn[name] = eventPrefix + name);

  for (const name in functionContext) {
    fn[name] = thisPrefix + name;
  }

  Object(vega_util_module["p" /* extend */])(fn, internalScaleFunctions(codegen, functionContext, astVisitors));
  return fn;
} // Register an expression function


function expressionFunction(name, fn, visitor) {
  if (arguments.length === 1) {
    return functionContext[name];
  } // register with the functionContext


  functionContext[name] = fn; // if there is an astVisitor register that, too

  if (visitor) astVisitors[name] = visitor; // if the code generator has already been initialized,
  // we need to also register the function with it

  if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name;
  return this;
} // register expression functions with ast visitors

expressionFunction('bandwidth', vega_functions_module_bandwidth, scaleVisitor);
expressionFunction('copy', vega_functions_module_copy, scaleVisitor);
expressionFunction('domain', vega_functions_module_domain, scaleVisitor);
expressionFunction('range', vega_functions_module_range, scaleVisitor);
expressionFunction('invert', vega_functions_module_invert, scaleVisitor);
expressionFunction('scale', vega_functions_module_scale, scaleVisitor);
expressionFunction('gradient', scaleGradient, scaleVisitor);
expressionFunction('geoArea', geoArea, scaleVisitor);
expressionFunction('geoBounds', geoBounds, scaleVisitor);
expressionFunction('geoCentroid', geoCentroid, scaleVisitor);
expressionFunction('geoShape', geoShape, scaleVisitor);
expressionFunction('indata', indata, indataVisitor);
expressionFunction('data', vega_functions_module_data, dataVisitor);
expressionFunction('treePath', treePath, dataVisitor);
expressionFunction('treeAncestors', treeAncestors, dataVisitor); // register Vega-Lite selection functions

expressionFunction('vlSelectionTest', selectionTest, selectionVisitor);
expressionFunction('vlSelectionIdTest', selectionIdTest, selectionVisitor);
expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor);
expressionFunction('vlSelectionTuples', selectionTuples);

function vega_functions_module_parser (expr, scope) {
  const params = {}; // parse the expression to an abstract syntax tree (ast)

  let ast;

  try {
    expr = Object(vega_util_module["J" /* isString */])(expr) ? expr : Object(vega_util_module["bb" /* stringValue */])(expr) + '';
    ast = parser(expr);
  } catch (err) {
    Object(vega_util_module["o" /* error */])('Expression parse error: ' + expr);
  } // analyze ast function calls for dependencies


  ast.visit(node => {
    if (node.type !== vega_expression_module_CallExpression) return;
    const name = node.callee.name,
          visit = codegenParams.visitors[name];
    if (visit) visit(name, node.arguments, scope, params);
  }); // perform code generation

  const gen = codeGenerator(ast); // collect signal dependencies

  gen.globals.forEach(name => {
    const signalName = SignalPrefix + name;

    if (!Object(vega_util_module["w" /* hasOwnProperty */])(params, signalName) && scope.getSignal(name)) {
      params[signalName] = scope.signalRef(name);
    }
  }); // return generated expression code and dependencies

  return {
    $expr: Object(vega_util_module["p" /* extend */])({
      code: gen.code
    }, scope.options.ast ? {
      ast
    } : null),
    $fields: gen.fields,
    $params: params
  };
}



// CONCATENATED MODULE: ./node_modules/vega-runtime/build/vega-runtime.module.js



/**
 * Parse a serialized dataflow specification.
 */
function vega_runtime_module_parse (spec) {
  const ctx = this,
        operators = spec.operators || []; // parse background

  if (spec.background) {
    ctx.background = spec.background;
  } // parse event configuration


  if (spec.eventConfig) {
    ctx.eventConfig = spec.eventConfig;
  } // parse locale configuration


  if (spec.locale) {
    ctx.locale = spec.locale;
  } // parse operators


  operators.forEach(entry => ctx.parseOperator(entry)); // parse operator parameters

  operators.forEach(entry => ctx.parseOperatorParameters(entry)); // parse streams

  (spec.streams || []).forEach(entry => ctx.parseStream(entry)); // parse updates

  (spec.updates || []).forEach(entry => ctx.parseUpdate(entry));
  return ctx.resolve();
}

const Skip = Object(vega_util_module["fb" /* toSet */])(['rule']),
      Swap = Object(vega_util_module["fb" /* toSet */])(['group', 'image', 'rect']);
function adjustSpatial(encode, marktype) {
  let code = '';
  if (Skip[marktype]) return code;

  if (encode.x2) {
    if (encode.x) {
      if (Swap[marktype]) {
        code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;';
      }

      code += 'o.width=o.x2-o.x;';
    } else {
      code += 'o.x=o.x2-(o.width||0);';
    }
  }

  if (encode.xc) {
    code += 'o.x=o.xc-(o.width||0)/2;';
  }

  if (encode.y2) {
    if (encode.y) {
      if (Swap[marktype]) {
        code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;';
      }

      code += 'o.height=o.y2-o.y;';
    } else {
      code += 'o.y=o.y2-(o.height||0);';
    }
  }

  if (encode.yc) {
    code += 'o.y=o.yc-(o.height||0)/2;';
  }

  return code;
}
function canonicalType(type) {
  return (type + '').toLowerCase();
}
function isOperator(type) {
  return canonicalType(type) === 'operator';
}
function isCollect(type) {
  return canonicalType(type) === 'collect';
}

function vega_runtime_module_expression(ctx, args, code) {
  // wrap code in return statement if expression does not terminate
  if (code[code.length - 1] !== ';') {
    code = 'return(' + code + ');';
  }

  const fn = Function(...args.concat(code));
  return ctx && ctx.functions ? fn.bind(ctx.functions) : fn;
} // generate code for comparing a single field


function _compare(u, v, lt, gt) {
  return "((u = ".concat(u, ") < (v = ").concat(v, ") || u == null) && v != null ? ").concat(lt, "\n  : (u > v || v == null) && u != null ? ").concat(gt, "\n  : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(lt, "\n  : v !== v && u === u ? ").concat(gt, " : ");
}

var expressionCodegen = {
  /**
   * Parse an expression used to update an operator value.
   */
  operator: (ctx, expr) => vega_runtime_module_expression(ctx, ['_'], expr.code),

  /**
   * Parse an expression provided as an operator parameter value.
   */
  parameter: (ctx, expr) => vega_runtime_module_expression(ctx, ['datum', '_'], expr.code),

  /**
   * Parse an expression applied to an event stream.
   */
  event: (ctx, expr) => vega_runtime_module_expression(ctx, ['event'], expr.code),

  /**
   * Parse an expression used to handle an event-driven operator update.
   */
  handler: (ctx, expr) => {
    const code = "var datum=event.item&&event.item.datum;return ".concat(expr.code, ";");
    return vega_runtime_module_expression(ctx, ['_', 'event'], code);
  },

  /**
   * Parse an expression that performs visual encoding.
   */
  encode: (ctx, encode) => {
    const {
      marktype,
      channels
    } = encode;
    let code = 'var o=item,datum=o.datum,m=0,$;';

    for (const name in channels) {
      const o = 'o[' + Object(vega_util_module["bb" /* stringValue */])(name) + ']';
      code += "$=".concat(channels[name].code, ";if(").concat(o, "!==$)").concat(o, "=$,m=1;");
    }

    code += adjustSpatial(channels, marktype);
    code += 'return m;';
    return vega_runtime_module_expression(ctx, ['item', '_'], code);
  },

  /**
   * Optimized code generators for access and comparison.
   */
  codegen: {
    get(path) {
      const ref = "[".concat(path.map(vega_util_module["bb" /* stringValue */]).join(']['), "]");
      const get = Function('_', "return _".concat(ref, ";"));
      get.path = ref;
      return get;
    },

    comparator(fields, orders) {
      let t;

      const map = (f, i) => {
        const o = orders[i];
        let u, v;

        if (f.path) {
          u = "a".concat(f.path);
          v = "b".concat(f.path);
        } else {
          (t = t || {})['f' + i] = f;
          u = "this.f".concat(i, "(a)");
          v = "this.f".concat(i, "(b)");
        }

        return _compare(u, v, -o, o);
      };

      const fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;');
      return t ? fn.bind(t) : fn;
    }

  }
};

/**
 * Parse a dataflow operator.
 */

function parseOperator(spec) {
  const ctx = this;

  if (isOperator(spec.type) || !spec.type) {
    ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null);
  } else {
    ctx.transform(spec, spec.type);
  }
}
/**
 * Parse and assign operator parameters.
 */

function parseOperatorParameters(spec) {
  const ctx = this;

  if (spec.params) {
    const op = ctx.get(spec.id);
    if (!op) Object(vega_util_module["o" /* error */])('Invalid operator id: ' + spec.id);
    ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly));
  }
}

/**
 * Parse a set of operator parameters.
 */

function parseParameters(spec, params) {
  params = params || {};
  const ctx = this;

  for (const key in spec) {
    const value = spec[key];
    params[key] = Object(vega_util_module["B" /* isArray */])(value) ? value.map(v => parseParameter(v, ctx, params)) : parseParameter(value, ctx, params);
  }

  return params;
}
/**
 * Parse a single parameter.
 */

function parseParameter(spec, ctx, params) {
  if (!spec || !Object(vega_util_module["H" /* isObject */])(spec)) return spec;

  for (let i = 0, n = PARSERS.length, p; i < n; ++i) {
    p = PARSERS[i];

    if (Object(vega_util_module["w" /* hasOwnProperty */])(spec, p.key)) {
      return p.parse(spec, ctx, params);
    }
  }

  return spec;
}
/** Reference parsers. */


var PARSERS = [{
  key: '$ref',
  parse: getOperator
}, {
  key: '$key',
  parse: getKey
}, {
  key: '$expr',
  parse: getExpression
}, {
  key: '$field',
  parse: vega_runtime_module_getField
}, {
  key: '$encode',
  parse: getEncode
}, {
  key: '$compare',
  parse: getCompare
}, {
  key: '$context',
  parse: vega_runtime_module_getContext
}, {
  key: '$subflow',
  parse: getSubflow
}, {
  key: '$tupleid',
  parse: getTupleId
}];
/**
 * Resolve an operator reference.
 */

function getOperator(_, ctx) {
  return ctx.get(_.$ref) || Object(vega_util_module["o" /* error */])('Operator not defined: ' + _.$ref);
}
/**
 * Resolve an expression reference.
 */


function getExpression(_, ctx, params) {
  if (_.$params) {
    // parse expression parameters
    ctx.parseParameters(_.$params, params);
  }

  const k = 'e:' + _.$expr.code + '_' + _.$name;
  return ctx.fn[k] || (ctx.fn[k] = Object(vega_util_module["f" /* accessor */])(ctx.parameterExpression(_.$expr), _.$fields, _.$name));
}
/**
 * Resolve a key accessor reference.
 */


function getKey(_, ctx) {
  const k = 'k:' + _.$key + '_' + !!_.$flat;
  return ctx.fn[k] || (ctx.fn[k] = Object(vega_util_module["K" /* key */])(_.$key, _.$flat, ctx.expr.codegen));
}
/**
 * Resolve a field accessor reference.
 */


function vega_runtime_module_getField(_, ctx) {
  if (!_.$field) return null;
  const k = 'f:' + _.$field + '_' + _.$name;
  return ctx.fn[k] || (ctx.fn[k] = Object(vega_util_module["u" /* field */])(_.$field, _.$name, ctx.expr.codegen));
}
/**
 * Resolve a comparator function reference.
 */


function getCompare(_, ctx) {
  // As of Vega 5.5.3, $tupleid sort is no longer used.
  // Keep here for now for backwards compatibility.
  const k = 'c:' + _.$compare + '_' + _.$order,
        c = Object(vega_util_module["i" /* array */])(_.$compare).map(_ => _ && _.$tupleid ? tupleid : _);
  return ctx.fn[k] || (ctx.fn[k] = Object(vega_util_module["l" /* compare */])(c, _.$order, ctx.expr.codegen));
}
/**
 * Resolve an encode operator reference.
 */


function getEncode(_, ctx) {
  const spec = _.$encode,
        encode = {};

  for (const name in spec) {
    const enc = spec[name];
    encode[name] = Object(vega_util_module["f" /* accessor */])(ctx.encodeExpression(enc.$expr), enc.$fields);
    encode[name].output = enc.$output;
  }

  return encode;
}
/**
 * Resolve a context reference.
 */


function vega_runtime_module_getContext(_, ctx) {
  return ctx;
}
/**
 * Resolve a recursive subflow specification.
 */


function getSubflow(_, ctx) {
  const spec = _.$subflow;
  return function (dataflow, key, parent) {
    const subctx = ctx.fork().parse(spec),
          op = subctx.get(spec.operators[0].id),
          p = subctx.signals.parent;
    if (p) p.set(parent);

    op.detachSubflow = () => ctx.detach(subctx);

    return op;
  };
}
/**
 * Resolve a tuple id reference.
 */


function getTupleId() {
  return tupleid;
}

/**
 * Parse an event stream specification.
 */

function parseStream (spec) {
  var ctx = this,
      filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined,
      stream = spec.stream != null ? ctx.get(spec.stream) : undefined,
      args;

  if (spec.source) {
    stream = ctx.events(spec.source, spec.type, filter);
  } else if (spec.merge) {
    args = spec.merge.map(_ => ctx.get(_));
    stream = args[0].merge.apply(args[0], args.slice(1));
  }

  if (spec.between) {
    args = spec.between.map(_ => ctx.get(_));
    stream = stream.between(args[0], args[1]);
  }

  if (spec.filter) {
    stream = stream.filter(filter);
  }

  if (spec.throttle != null) {
    stream = stream.throttle(+spec.throttle);
  }

  if (spec.debounce != null) {
    stream = stream.debounce(+spec.debounce);
  }

  if (stream == null) {
    Object(vega_util_module["o" /* error */])('Invalid stream definition: ' + JSON.stringify(spec));
  }

  if (spec.consume) stream.consume(true);
  ctx.stream(spec, stream);
}

/**
 * Parse an event-driven operator update.
 */

function parseUpdate (spec) {
  var ctx = this,
      srcid = Object(vega_util_module["H" /* isObject */])(srcid = spec.source) ? srcid.$ref : srcid,
      source = ctx.get(srcid),
      target = null,
      update = spec.update,
      params = undefined;
  if (!source) Object(vega_util_module["o" /* error */])('Source not defined: ' + spec.source);
  target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target);

  if (update && update.$expr) {
    if (update.$params) {
      params = ctx.parseParameters(update.$params);
    }

    update = ctx.handlerExpression(update.$expr);
  }

  ctx.update(spec, source, target, update, params);
}

const vega_runtime_module_SKIP = {
  skip: true
};
function getState(options) {
  var ctx = this,
      state = {};

  if (options.signals) {
    var signals = state.signals = {};
    Object.keys(ctx.signals).forEach(key => {
      const op = ctx.signals[key];

      if (options.signals(key, op)) {
        signals[key] = op.value;
      }
    });
  }

  if (options.data) {
    var data = state.data = {};
    Object.keys(ctx.data).forEach(key => {
      const dataset = ctx.data[key];

      if (options.data(key, dataset)) {
        data[key] = dataset.input.value;
      }
    });
  }

  if (ctx.subcontext && options.recurse !== false) {
    state.subcontext = ctx.subcontext.map(ctx => ctx.getState(options));
  }

  return state;
}
function setState(state) {
  var ctx = this,
      df = ctx.dataflow,
      data = state.data,
      signals = state.signals;
  Object.keys(signals || {}).forEach(key => {
    df.update(ctx.signals[key], signals[key], vega_runtime_module_SKIP);
  });
  Object.keys(data || {}).forEach(key => {
    df.pulse(ctx.data[key].input, df.changeset().remove(vega_util_module["ib" /* truthy */]).insert(data[key]));
  });
  (state.subcontext || []).forEach((substate, i) => {
    const subctx = ctx.subcontext[i];
    if (subctx) subctx.setState(substate);
  });
}

/**
 * Context objects store the current parse state.
 * Enables lookup of parsed operators, event streams, accessors, etc.
 * Provides a 'fork' method for creating child contexts for subflows.
 */

function vega_runtime_module_context (df, transforms, functions, expr) {
  return new Context(df, transforms, functions, expr);
}

function Context(df, transforms, functions, expr) {
  this.dataflow = df;
  this.transforms = transforms;
  this.events = df.events.bind(df);
  this.expr = expr || expressionCodegen, this.signals = {};
  this.scales = {};
  this.nodes = {};
  this.data = {};
  this.fn = {};

  if (functions) {
    this.functions = Object.create(functions);
    this.functions.context = this;
  }
}

function Subcontext(ctx) {
  this.dataflow = ctx.dataflow;
  this.transforms = ctx.transforms;
  this.events = ctx.events;
  this.expr = ctx.expr;
  this.signals = Object.create(ctx.signals);
  this.scales = Object.create(ctx.scales);
  this.nodes = Object.create(ctx.nodes);
  this.data = Object.create(ctx.data);
  this.fn = Object.create(ctx.fn);

  if (ctx.functions) {
    this.functions = Object.create(ctx.functions);
    this.functions.context = this;
  }
}

Context.prototype = Subcontext.prototype = {
  fork() {
    const ctx = new Subcontext(this);
    (this.subcontext || (this.subcontext = [])).push(ctx);
    return ctx;
  },

  detach(ctx) {
    this.subcontext = this.subcontext.filter(c => c !== ctx); // disconnect all nodes in the subcontext
    // wipe out targets first for better efficiency

    const keys = Object.keys(ctx.nodes);

    for (const key of keys) ctx.nodes[key]._targets = null;

    for (const key of keys) ctx.nodes[key].detach();

    ctx.nodes = null;
  },

  get(id) {
    return this.nodes[id];
  },

  set(id, node) {
    return this.nodes[id] = node;
  },

  add(spec, op) {
    const ctx = this,
          df = ctx.dataflow,
          data = spec.value;
    ctx.set(spec.id, op);

    if (isCollect(spec.type) && data) {
      if (data.$ingest) {
        df.ingest(op, data.$ingest, data.$format);
      } else if (data.$request) {
        df.preload(op, data.$request, data.$format);
      } else {
        df.pulse(op, df.changeset().insert(data));
      }
    }

    if (spec.root) {
      ctx.root = op;
    }

    if (spec.parent) {
      let p = ctx.get(spec.parent.$ref);

      if (p) {
        df.connect(p, [op]);
        op.targets().add(p);
      } else {
        (ctx.unresolved = ctx.unresolved || []).push(() => {
          p = ctx.get(spec.parent.$ref);
          df.connect(p, [op]);
          op.targets().add(p);
        });
      }
    }

    if (spec.signal) {
      ctx.signals[spec.signal] = op;
    }

    if (spec.scale) {
      ctx.scales[spec.scale] = op;
    }

    if (spec.data) {
      for (const name in spec.data) {
        const data = ctx.data[name] || (ctx.data[name] = {});
        spec.data[name].forEach(role => data[role] = op);
      }
    }
  },

  resolve() {
    (this.unresolved || []).forEach(fn => fn());
    delete this.unresolved;
    return this;
  },

  operator(spec, update) {
    this.add(spec, this.dataflow.add(spec.value, update));
  },

  transform(spec, type) {
    this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)]));
  },

  stream(spec, stream) {
    this.set(spec.id, stream);
  },

  update(spec, stream, target, update, params) {
    this.dataflow.on(stream, target, update, params, spec.options);
  },

  // expression parsing
  operatorExpression(expr) {
    return this.expr.operator(this, expr);
  },

  parameterExpression(expr) {
    return this.expr.parameter(this, expr);
  },

  eventExpression(expr) {
    return this.expr.event(this, expr);
  },

  handlerExpression(expr) {
    return this.expr.handler(this, expr);
  },

  encodeExpression(encode) {
    return this.expr.encode(this, encode);
  },

  // parse methods
  parse: vega_runtime_module_parse,
  parseOperator,
  parseOperatorParameters,
  parseParameters,
  parseStream,
  parseUpdate,
  // state methods
  getState,
  setState
};



// CONCATENATED MODULE: ./node_modules/d3-timer/src/interval.js


/* harmony default export */ var src_interval = (function(callback, delay, time) {
  var t = new Timer, total = delay;
  if (delay == null) return t.restart(callback, delay, time), t;
  t._restart = t.restart;
  t.restart = function(callback, delay, time) {
    delay = +delay, time = time == null ? now() : +time;
    t._restart(function tick(elapsed) {
      elapsed += total;
      t._restart(tick, total += delay, time);
      callback(elapsed);
    }, delay, time);
  }
  t.restart(callback, delay, time);
  return t;
});

// CONCATENATED MODULE: ./node_modules/vega-view/build/vega-view.module.js









// initialize aria role and label attributes
function initializeAria(view) {
  const el = view.container();

  if (el) {
    el.setAttribute('role', 'graphics-document');
    el.setAttribute('aria-roleDescription', 'visualization');
    ariaLabel(el, view.description());
  }
} // update aria-label if we have a DOM container element

function ariaLabel(el, desc) {
  if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc);
}

function vega_view_module_background (view) {
  // respond to background signal
  view.add(null, _ => {
    view._background = _.bg;
    view._resize = 1;
    return _.bg;
  }, {
    bg: view._signals.background
  });
}

const Default = 'default';
function vega_view_module_cursor (view) {
  // get cursor signal, add to dataflow if needed
  const cursor = view._signals.cursor || (view._signals.cursor = view.add({
    user: Default,
    item: null
  })); // evaluate cursor on each mousemove event

  view.on(view.events('view', 'mousemove'), cursor, (_, event) => {
    const value = cursor.value,
          user = value ? Object(vega_util_module["J" /* isString */])(value) ? value : value.user : Default,
          item = event.item && event.item.cursor || null;
    return value && user === value.user && item == value.item ? value : {
      user: user,
      item: item
    };
  }); // when cursor signal updates, set visible cursor

  view.add(null, function (_) {
    let user = _.cursor,
        item = this.value;

    if (!Object(vega_util_module["J" /* isString */])(user)) {
      item = user.item;
      user = user.user;
    }

    setCursor(view, user && user !== Default ? user : item || user);
    return item;
  }, {
    cursor: cursor
  });
}
function setCursor(view, cursor) {
  const el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container();

  if (el) {
    return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor;
  }
}

function dataref(view, name) {
  var data = view._runtime.data;

  if (!Object(vega_util_module["w" /* hasOwnProperty */])(data, name)) {
    Object(vega_util_module["o" /* error */])('Unrecognized data set: ' + name);
  }

  return data[name];
}
function vega_view_module_data(name, values) {
  return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(vega_util_module["ib" /* truthy */]).insert(values));
}
function change(name, changes) {
  if (!isChangeSet(changes)) {
    Object(vega_util_module["o" /* error */])('Second argument to changes must be a changeset.');
  }

  const dataset = dataref(this, name);
  dataset.modified = true;
  return this.pulse(dataset.input, changes);
}
function vega_view_module_insert(name, _) {
  return change.call(this, name, changeset().insert(_));
}
function vega_view_module_remove(name, _) {
  return change.call(this, name, changeset().remove(_));
}

function vega_view_module_width(view) {
  var padding = view.padding();
  return Math.max(0, view._viewWidth + padding.left + padding.right);
}
function vega_view_module_height(view) {
  var padding = view.padding();
  return Math.max(0, view._viewHeight + padding.top + padding.bottom);
}
function vega_view_module_offset(view) {
  var padding = view.padding(),
      origin = view._origin;
  return [padding.left + origin[0], padding.top + origin[1]];
}
function resizeRenderer(view) {
  var origin = vega_view_module_offset(view),
      w = vega_view_module_width(view),
      h = vega_view_module_height(view);

  view._renderer.background(view.background());

  view._renderer.resize(w, h, origin);

  view._handler.origin(origin);

  view._resizeListeners.forEach(handler => {
    try {
      handler(w, h);
    } catch (error) {
      view.error(error);
    }
  });
}

/**
 * Extend an event with additional view-specific methods.
 * Adds a new property ('vega') to an event that provides a number
 * of methods for querying information about the current interaction.
 * The vega object provides the following methods:
 *   view - Returns the backing View instance.
 *   item - Returns the currently active scenegraph item (if any).
 *   group - Returns the currently active scenegraph group (if any).
 *     This method accepts a single string-typed argument indicating the name
 *     of the desired parent group. The scenegraph will be traversed from
 *     the item up towards the root to search for a matching group. If no
 *     argument is provided the enclosing group for the active item is
 *     returned, unless the item it itself a group, in which case it is
 *     returned directly.
 *   xy - Returns a two-element array containing the x and y coordinates for
 *     mouse or touch events. For touch events, this is based on the first
 *     elements in the changedTouches array. This method accepts a single
 *     argument: either an item instance or mark name that should serve as
 *     the reference coordinate system. If no argument is provided the
 *     top-level view coordinate system is assumed.
 *   x - Returns the current x-coordinate, accepts the same arguments as xy.
 *   y - Returns the current y-coordinate, accepts the same arguments as xy.
 * @param {Event} event - The input event to extend.
 * @param {Item} item - The currently active scenegraph item (if any).
 * @return {Event} - The extended input event.
 */

function eventExtend (view, event, item) {
  var r = view._renderer,
      el = r && r.canvas(),
      p,
      e,
      translate;

  if (el) {
    translate = vega_view_module_offset(view);
    e = event.changedTouches ? event.changedTouches[0] : event;
    p = vega_scenegraph_module_point(e, el);
    p[0] -= translate[0];
    p[1] -= translate[1];
  }

  event.dataflow = view;
  event.item = item;
  event.vega = extension(view, item, p);
  return event;
}

function extension(view, item, point) {
  const itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null;

  function group(name) {
    var g = itemGroup,
        i;
    if (name) for (i = item; i; i = i.mark.group) {
      if (i.mark.name === name) {
        g = i;
        break;
      }
    }
    return g && g.mark && g.mark.interactive ? g : {};
  }

  function xy(item) {
    if (!item) return point;
    if (Object(vega_util_module["J" /* isString */])(item)) item = group(item);
    const p = point.slice();

    while (item) {
      p[0] -= item.x || 0;
      p[1] -= item.y || 0;
      item = item.mark && item.mark.group;
    }

    return p;
  }

  return {
    view: Object(vega_util_module["m" /* constant */])(view),
    item: Object(vega_util_module["m" /* constant */])(item || {}),
    group: group,
    xy: xy,
    x: item => xy(item)[0],
    y: item => xy(item)[1]
  };
}

const VIEW = 'view',
      TIMER = 'timer',
      WINDOW = 'window',
      NO_TRAP = {
  trap: false
};
/**
 * Initialize event handling configuration.
 * @param {object} config - The configuration settings.
 * @return {object}
 */

function initializeEventConfig(config) {
  const events = Object(vega_util_module["p" /* extend */])({
    defaults: {}
  }, config);

  const unpack = (obj, keys) => {
    keys.forEach(k => {
      if (Object(vega_util_module["B" /* isArray */])(obj[k])) obj[k] = Object(vega_util_module["fb" /* toSet */])(obj[k]);
    });
  };

  unpack(events.defaults, ['prevent', 'allow']);
  unpack(events, ['view', 'window', 'selector']);
  return events;
}
function trackEventListener(view, sources, type, handler) {
  view._eventListeners.push({
    type: type,
    sources: Object(vega_util_module["i" /* array */])(sources),
    handler: handler
  });
}

function prevent(view, type) {
  var def = view._eventConfig.defaults,
      prevent = def.prevent,
      allow = def.allow;
  return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault();
}

function permit(view, key, type) {
  const rule = view._eventConfig && view._eventConfig[key];

  if (rule === false || Object(vega_util_module["H" /* isObject */])(rule) && !rule[type]) {
    view.warn(`Blocked ${key} ${type} event listener.`);
    return false;
  }

  return true;
}
/**
 * Create a new event stream from an event source.
 * @param {object} source - The event source to monitor.
 * @param {string} type - The event type.
 * @param {function(object): boolean} [filter] - Event filter function.
 * @return {EventStream}
 */


function vega_view_module_events(source, type, filter) {
  var view = this,
      s = new EventStream(filter),
      send = function (e, item) {
    view.runAsync(null, () => {
      if (source === VIEW && prevent(view, type)) {
        e.preventDefault();
      }

      s.receive(eventExtend(view, e, item));
    });
  },
      sources;

  if (source === TIMER) {
    if (permit(view, 'timer', type)) {
      view.timer(send, type);
    }
  } else if (source === VIEW) {
    if (permit(view, 'view', type)) {
      // send traps errors, so use {trap: false} option
      view.addEventListener(type, send, NO_TRAP);
    }
  } else {
    if (source === WINDOW) {
      if (permit(view, 'window', type) && typeof window !== 'undefined') {
        sources = [window];
      }
    } else if (typeof document !== 'undefined') {
      if (permit(view, 'selector', type)) {
        sources = document.querySelectorAll(source);
      }
    }

    if (!sources) {
      view.warn('Can not resolve event source: ' + source);
    } else {
      for (var i = 0, n = sources.length; i < n; ++i) {
        sources[i].addEventListener(type, send);
      }

      trackEventListener(view, sources, type, send);
    }
  }

  return s;
}

function itemFilter(event) {
  return event.item;
}

function markTarget(event) {
  // grab upstream collector feeding the mark operator
  return event.item.mark.source;
}

function invoke(name) {
  return function (_, event) {
    return event.vega.view().changeset().encode(event.item, name);
  };
}

function vega_view_module_hover (hoverSet, leaveSet) {
  hoverSet = [hoverSet || 'hover'];
  leaveSet = [leaveSet || 'update', hoverSet[0]]; // invoke hover set upon mouseover

  this.on(this.events('view', 'mouseover', itemFilter), markTarget, invoke(hoverSet)); // invoke leave set upon mouseout

  this.on(this.events('view', 'mouseout', itemFilter), markTarget, invoke(leaveSet));
  return this;
}

/**
 * Finalize a View instance that is being removed.
 * Cancel any running timers.
 * Remove all external event listeners.
 * Remove any currently displayed tooltip.
 */
function vega_view_module_finalize () {
  var tooltip = this._tooltip,
      timers = this._timers,
      listeners = this._eventListeners,
      n,
      m,
      e;
  n = timers.length;

  while (--n >= 0) {
    timers[n].stop();
  }

  n = listeners.length;

  while (--n >= 0) {
    e = listeners[n];
    m = e.sources.length;

    while (--m >= 0) {
      e.sources[m].removeEventListener(e.type, e.handler);
    }
  }

  if (tooltip) {
    tooltip.call(this, this._handler, null, null, null);
  }

  return this;
}

function vega_view_module_element (tag, attr, text) {
  const el = document.createElement(tag);

  for (const key in attr) el.setAttribute(key, attr[key]);

  if (text != null) el.textContent = text;
  return el;
}

const BindClass = 'vega-bind',
      NameClass = 'vega-bind-name',
      RadioClass = 'vega-bind-radio';
/**
 * Bind a signal to an external HTML input element. The resulting two-way
 * binding will propagate input changes to signals, and propagate signal
 * changes to the input element state. If this view instance has no parent
 * element, we assume the view is headless and no bindings are created.
 * @param {Element|string} el - The parent DOM element to which the input
 *   element should be appended as a child. If string-valued, this argument
 *   will be treated as a CSS selector. If null or undefined, the parent
 *   element of this view will be used as the element.
 * @param {object} param - The binding parameters which specify the signal
 *   to bind to, the input element type, and type-specific configuration.
 * @return {View} - This view instance.
 */

function vega_view_module_bind (view, el, binding) {
  if (!el) return;
  const param = binding.param;
  let bind = binding.state;

  if (!bind) {
    bind = binding.state = {
      elements: null,
      active: false,
      set: null,
      update: value => {
        if (value != view.signal(param.signal)) {
          view.runAsync(null, () => {
            bind.source = true;
            view.signal(param.signal, value);
          });
        }
      }
    };

    if (param.debounce) {
      bind.update = Object(vega_util_module["n" /* debounce */])(param.debounce, bind.update);
    }
  }

  const create = param.input == null && param.element ? vega_view_module_target : vega_view_module_generate;
  create(bind, el, param, view);

  if (!bind.active) {
    view.on(view._signals[param.signal], null, () => {
      bind.source ? bind.source = false : bind.set(view.signal(param.signal));
    });
    bind.active = true;
  }

  return bind;
}
/**
 * Bind the signal to an external EventTarget.
 */

function vega_view_module_target(bind, node, param, view) {
  const type = param.event || 'input';

  const handler = () => bind.update(node.value); // initialize signal value to external input value


  view.signal(param.signal, node.value); // listen for changes on the element

  node.addEventListener(type, handler); // register with view, so we can remove it upon finalization

  trackEventListener(view, node, type, handler); // propagate change to element

  bind.set = value => {
    node.value = value;
    node.dispatchEvent(vega_view_module_event(type));
  };
}

function vega_view_module_event(type) {
  return typeof Event !== 'undefined' ? new Event(type) : {
    type
  };
}
/**
 * Generate an HTML input form element and bind it to a signal.
 */


function vega_view_module_generate(bind, el, param, view) {
  const value = view.signal(param.signal);
  const div = vega_view_module_element('div', {
    'class': BindClass
  });
  const wrapper = param.input === 'radio' ? div : div.appendChild(vega_view_module_element('label'));
  wrapper.appendChild(vega_view_module_element('span', {
    'class': NameClass
  }, param.name || param.signal));
  el.appendChild(div);
  let input = vega_view_module_form;

  switch (param.input) {
    case 'checkbox':
      input = vega_view_module_checkbox;
      break;

    case 'select':
      input = vega_view_module_select;
      break;

    case 'radio':
      input = vega_view_module_radio;
      break;

    case 'range':
      input = vega_view_module_range;
      break;
  }

  input(bind, wrapper, param, value);
}
/**
 * Generates an arbitrary input form element.
 * The input type is controlled via user-provided parameters.
 */


function vega_view_module_form(bind, el, param, value) {
  const node = vega_view_module_element('input');

  for (const key in param) {
    if (key !== 'signal' && key !== 'element') {
      node.setAttribute(key === 'input' ? 'type' : key, param[key]);
    }
  }

  node.setAttribute('name', param.signal);
  node.value = value;
  el.appendChild(node);
  node.addEventListener('input', () => bind.update(node.value));
  bind.elements = [node];

  bind.set = value => node.value = value;
}
/**
 * Generates a checkbox input element.
 */


function vega_view_module_checkbox(bind, el, param, value) {
  const attr = {
    type: 'checkbox',
    name: param.signal
  };
  if (value) attr.checked = true;
  const node = vega_view_module_element('input', attr);
  el.appendChild(node);
  node.addEventListener('change', () => bind.update(node.checked));
  bind.elements = [node];

  bind.set = value => node.checked = !!value || null;
}
/**
 * Generates a selection list input element.
 */


function vega_view_module_select(bind, el, param, value) {
  const node = vega_view_module_element('select', {
    name: param.signal
  }),
        labels = param.labels || [];
  param.options.forEach((option, i) => {
    const attr = {
      value: option
    };
    if (valuesEqual(option, value)) attr.selected = true;
    node.appendChild(vega_view_module_element('option', attr, (labels[i] || option) + ''));
  });
  el.appendChild(node);
  node.addEventListener('change', () => {
    bind.update(param.options[node.selectedIndex]);
  });
  bind.elements = [node];

  bind.set = value => {
    for (let i = 0, n = param.options.length; i < n; ++i) {
      if (valuesEqual(param.options[i], value)) {
        node.selectedIndex = i;
        return;
      }
    }
  };
}
/**
 * Generates a radio button group.
 */


function vega_view_module_radio(bind, el, param, value) {
  const group = vega_view_module_element('span', {
    'class': RadioClass
  }),
        labels = param.labels || [];
  el.appendChild(group);
  bind.elements = param.options.map((option, i) => {
    const attr = {
      type: 'radio',
      name: param.signal,
      value: option
    };
    if (valuesEqual(option, value)) attr.checked = true;
    const input = vega_view_module_element('input', attr);
    input.addEventListener('change', () => bind.update(option));
    const label = vega_view_module_element('label', {}, (labels[i] || option) + '');
    label.prepend(input);
    group.appendChild(label);
    return input;
  });

  bind.set = value => {
    const nodes = bind.elements,
          n = nodes.length;

    for (let i = 0; i < n; ++i) {
      if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true;
    }
  };
}
/**
 * Generates a slider input element.
 */


function vega_view_module_range(bind, el, param, value) {
  value = value !== undefined ? value : (+param.max + +param.min) / 2;
  const max = param.max != null ? param.max : Math.max(100, +value) || 100,
        min = param.min || Math.min(0, max, +value) || 0,
        step = param.step || Object(src_ticks["c" /* tickStep */])(min, max, 100);
  const node = vega_view_module_element('input', {
    type: 'range',
    name: param.signal,
    min: min,
    max: max,
    step: step
  });
  node.value = value;
  const span = vega_view_module_element('span', {}, +value);
  el.appendChild(node);
  el.appendChild(span);

  const update = () => {
    span.textContent = node.value;
    bind.update(+node.value);
  }; // subscribe to both input and change


  node.addEventListener('input', update);
  node.addEventListener('change', update);
  bind.elements = [node];

  bind.set = value => {
    node.value = value;
    span.textContent = value;
  };
}

function valuesEqual(a, b) {
  return a === b || a + '' === b + '';
}

function initializeRenderer (view, r, el, constructor, scaleFactor, opt) {
  r = r || new constructor(view.loader());
  return r.initialize(el, vega_view_module_width(view), vega_view_module_height(view), vega_view_module_offset(view), scaleFactor, opt).background(view.background());
}

function trap (view, fn) {
  return !fn ? null : function () {
    try {
      fn.apply(this, arguments);
    } catch (error) {
      view.error(error);
    }
  };
}

function initializeHandler (view, prevHandler, el, constructor) {
  // instantiate scenegraph handler
  const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, vega_view_module_offset(view), view); // transfer event handlers

  if (prevHandler) {
    prevHandler.handlers().forEach(h => {
      handler.on(h.type, h.handler);
    });
  }

  return handler;
}

function vega_view_module_initialize (el, elBind) {
  const view = this,
        type = view._renderType,
        config = view._eventConfig.bind,
        module = renderModule(type); // containing dom element

  el = view._el = el ? vega_view_module_lookup(view, el, true) : null; // initialize aria attributes

  initializeAria(view); // select appropriate renderer & handler

  if (!module) view.error('Unrecognized renderer type: ' + type);
  const Handler = module.handler || CanvasHandler,
        Renderer = el ? module.renderer : module.headless; // initialize renderer and input handler

  view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer);
  view._handler = initializeHandler(view, view._handler, el, Handler);
  view._redraw = true; // initialize signal bindings

  if (el && config !== 'none') {
    elBind = elBind ? view._elBind = vega_view_module_lookup(view, elBind, true) : el.appendChild(vega_view_module_element('form', {
      'class': 'vega-bindings'
    }));

    view._bind.forEach(_ => {
      if (_.param.element && config !== 'container') {
        _.element = vega_view_module_lookup(view, _.param.element, !!_.param.input);
      }
    });

    view._bind.forEach(_ => {
      vega_view_module_bind(view, _.element || elBind, _);
    });
  }

  return view;
}

function vega_view_module_lookup(view, el, clear) {
  if (typeof el === 'string') {
    if (typeof document !== 'undefined') {
      el = document.querySelector(el);

      if (!el) {
        view.error('Signal bind element not found: ' + el);
        return null;
      }
    } else {
      view.error('DOM document instance not found.');
      return null;
    }
  }

  if (el && clear) {
    try {
      el.innerHTML = '';
    } catch (e) {
      el = null;
      view.error(e);
    }
  }

  return el;
}

const vega_view_module_number = _ => +_ || 0;

const paddingObject = _ => ({
  top: _,
  bottom: _,
  left: _,
  right: _
});

function vega_view_module_padding (_) {
  return Object(vega_util_module["H" /* isObject */])(_) ? {
    top: vega_view_module_number(_.top),
    bottom: vega_view_module_number(_.bottom),
    left: vega_view_module_number(_.left),
    right: vega_view_module_number(_.right)
  } : paddingObject(vega_view_module_number(_));
}

/**
 * Render the current scene in a headless fashion.
 * This method is asynchronous, returning a Promise instance.
 * @return {Promise} - A Promise that resolves to a renderer.
 */

async function renderHeadless (view, type, scaleFactor, opt) {
  const module = renderModule(type),
        ctr = module && module.headless;
  if (!ctr) Object(vega_util_module["o" /* error */])('Unrecognized renderer type: ' + type);
  await view.runAsync();
  return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root);
}

/**
 * Produce an image URL for the visualization. Depending on the type
 * parameter, the generated URL contains data for either a PNG or SVG image.
 * The URL can be used (for example) to download images of the visualization.
 * This method is asynchronous, returning a Promise instance.
 * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'.
 *   The 'canvas' and 'png' types are synonyms for a PNG image.
 * @return {Promise} - A promise that resolves to an image URL.
 */

async function renderToImageURL (type, scaleFactor) {
  if (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG) {
    Object(vega_util_module["o" /* error */])('Unrecognized image type: ' + type);
  }

  const r = await renderHeadless(this, type, scaleFactor);
  return type === RenderType.SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png');
}

function toBlobURL(data, mime) {
  const blob = new Blob([data], {
    type: mime
  });
  return window.URL.createObjectURL(blob);
}

/**
 * Produce a Canvas instance containing a rendered visualization.
 * This method is asynchronous, returning a Promise instance.
 * @return {Promise} - A promise that resolves to a Canvas instance.
 */

async function renderToCanvas (scaleFactor, opt) {
  const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt);
  return r.canvas();
}

/**
 * Produce a rendered SVG string of the visualization.
 * This method is asynchronous, returning a Promise instance.
 * @return {Promise} - A promise that resolves to an SVG string.
 */

async function renderToSVG (scaleFactor) {
  const r = await renderHeadless(this, RenderType.SVG, scaleFactor);
  return r.svg();
}

function vega_view_module_runtime (view, spec, expr) {
  return vega_runtime_module_context(view, vega_dataflow_module_transforms, functionContext, expr).parse(spec);
}

function vega_view_module_scale(name) {
  var scales = this._runtime.scales;

  if (!Object(vega_util_module["w" /* hasOwnProperty */])(scales, name)) {
    Object(vega_util_module["o" /* error */])('Unrecognized scale or projection: ' + name);
  }

  return scales[name].value;
}

var Width = 'width',
    Height = 'height',
    vega_view_module_Padding = 'padding',
    vega_view_module_Skip = {
  skip: true
};
function viewWidth(view, width) {
  var a = view.autosize(),
      p = view.padding();
  return width - (a && a.contains === vega_view_module_Padding ? p.left + p.right : 0);
}
function viewHeight(view, height) {
  var a = view.autosize(),
      p = view.padding();
  return height - (a && a.contains === vega_view_module_Padding ? p.top + p.bottom : 0);
}
function initializeResize(view) {
  var s = view._signals,
      w = s[Width],
      h = s[Height],
      p = s[vega_view_module_Padding];

  function resetSize() {
    view._autosize = view._resize = 1;
  } // respond to width signal


  view._resizeWidth = view.add(null, _ => {
    view._width = _.size;
    view._viewWidth = viewWidth(view, _.size);
    resetSize();
  }, {
    size: w
  }); // respond to height signal

  view._resizeHeight = view.add(null, _ => {
    view._height = _.size;
    view._viewHeight = viewHeight(view, _.size);
    resetSize();
  }, {
    size: h
  }); // respond to padding signal

  const resizePadding = view.add(null, resetSize, {
    pad: p
  }); // set rank to run immediately after source signal

  view._resizeWidth.rank = w.rank + 1;
  view._resizeHeight.rank = h.rank + 1;
  resizePadding.rank = p.rank + 1;
}
function resizeView(viewWidth, viewHeight, width, height, origin, auto) {
  this.runAfter(view => {
    let rerun = 0; // reset autosize flag

    view._autosize = 0; // width value changed: update signal, skip resize op

    if (view.width() !== width) {
      rerun = 1;
      view.signal(Width, width, vega_view_module_Skip); // set width, skip update calc

      view._resizeWidth.skip(true); // skip width resize handler

    } // height value changed: update signal, skip resize op


    if (view.height() !== height) {
      rerun = 1;
      view.signal(Height, height, vega_view_module_Skip); // set height, skip update calc

      view._resizeHeight.skip(true); // skip height resize handler

    } // view width changed: update view property, set resize flag


    if (view._viewWidth !== viewWidth) {
      view._resize = 1;
      view._viewWidth = viewWidth;
    } // view height changed: update view property, set resize flag


    if (view._viewHeight !== viewHeight) {
      view._resize = 1;
      view._viewHeight = viewHeight;
    } // origin changed: update view property, set resize flag


    if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) {
      view._resize = 1;
      view._origin = origin;
    } // run dataflow on width/height signal change


    if (rerun) view.run('enter');
    if (auto) view.runAfter(v => v.resize());
  }, false, 1);
}

/**
 * Get the current view state, consisting of signal values and/or data sets.
 * @param {object} [options] - Options flags indicating which state to export.
 *   If unspecified, all signals and data sets will be exported.
 * @param {function(string, Operator):boolean} [options.signals] - Optional
 *   predicate function for testing if a signal should be included in the
 *   exported state. If unspecified, all signals will be included, except for
 *   those named 'parent' or those which refer to a Transform value.
 * @param {function(string, object):boolean} [options.data] - Optional
 *   predicate function for testing if a data set's input should be included
 *   in the exported state. If unspecified, all data sets that have been
 *   explicitly modified will be included.
 * @param {boolean} [options.recurse=true] - Flag indicating if the exported
 *   state should recursively include state from group mark sub-contexts.
 * @return {object} - An object containing the exported state values.
 */

function vega_view_module_getState(options) {
  return this._runtime.getState(options || {
    data: dataTest,
    signals: signalTest,
    recurse: true
  });
}

function dataTest(name, data) {
  return data.modified && Object(vega_util_module["B" /* isArray */])(data.input.value) && name.indexOf('_:vega:_');
}

function signalTest(name, op) {
  return !(name === 'parent' || op instanceof vega_dataflow_module_transforms.proxy);
}
/**
 * Sets the current view state and updates the view by invoking run.
 * @param {object} state - A state object containing signal and/or
 *   data set values, following the format used by the getState method.
 * @return {View} - This view instance.
 */


function vega_view_module_setState(state) {
  this.runAsync(null, v => {
    v._trigger = false;

    v._runtime.setState(state);
  }, v => {
    v._trigger = true;
  });
  return this;
}

function vega_view_module_timer (callback, delay) {
  function tick(elapsed) {
    callback({
      timestamp: Date.now(),
      elapsed: elapsed
    });
  }

  this._timers.push(src_interval(tick, delay));
}

function vega_view_module_defaultTooltip (handler, event, item, value) {
  const el = handler.element();
  if (el) el.setAttribute('title', formatTooltip(value));
}

function formatTooltip(value) {
  return value == null ? '' : Object(vega_util_module["B" /* isArray */])(value) ? formatArray(value) : Object(vega_util_module["H" /* isObject */])(value) && !Object(vega_util_module["D" /* isDate */])(value) ? formatObject(value) : value + '';
}

function formatObject(obj) {
  return Object.keys(obj).map(key => {
    const v = obj[key];
    return key + ': ' + (Object(vega_util_module["B" /* isArray */])(v) ? formatArray(v) : vega_view_module_formatValue(v));
  }).join('\n');
}

function formatArray(value) {
  return '[' + value.map(vega_view_module_formatValue).join(', ') + ']';
}

function vega_view_module_formatValue(value) {
  return Object(vega_util_module["B" /* isArray */])(value) ? '[\u2026]' : Object(vega_util_module["H" /* isObject */])(value) && !Object(vega_util_module["D" /* isDate */])(value) ? '{\u2026}' : value;
}

/**
 * Create a new View instance from a Vega dataflow runtime specification.
 * The generated View will not immediately be ready for display. Callers
 * should also invoke the initialize method (e.g., to set the parent
 * DOM element in browser-based deployment) and then invoke the run
 * method to evaluate the dataflow graph. Rendering will automatically
 * be performed upon dataflow runs.
 * @constructor
 * @param {object} spec - The Vega dataflow runtime specification.
 */

function View(spec, options) {
  const view = this;
  options = options || {};
  Dataflow.call(view);
  if (options.loader) view.loader(options.loader);
  if (options.logger) view.logger(options.logger);
  if (options.logLevel != null) view.logLevel(options.logLevel);

  if (options.locale || spec.locale) {
    const loc = Object(vega_util_module["p" /* extend */])({}, spec.locale, options.locale);
    view.locale(Object(vega_format_module["b" /* locale */])(loc.number, loc.time));
  }

  view._el = null;
  view._elBind = null;
  view._renderType = options.renderer || RenderType.Canvas;
  view._scenegraph = new Scenegraph();
  const root = view._scenegraph.root; // initialize renderer, handler and event management

  view._renderer = null;
  view._tooltip = options.tooltip || vega_view_module_defaultTooltip, view._redraw = true;
  view._handler = new CanvasHandler().scene(root);
  view._globalCursor = false;
  view._preventDefault = false;
  view._timers = [];
  view._eventListeners = [];
  view._resizeListeners = []; // initialize event configuration

  view._eventConfig = initializeEventConfig(spec.eventConfig);
  view.globalCursor(view._eventConfig.globalCursor); // initialize dataflow graph

  const ctx = vega_view_module_runtime(view, spec, options.expr);
  view._runtime = ctx;
  view._signals = ctx.signals;
  view._bind = (spec.bindings || []).map(_ => ({
    state: null,
    param: Object(vega_util_module["p" /* extend */])({}, _)
  })); // initialize scenegraph

  if (ctx.root) ctx.root.set(root);
  root.source = ctx.data.root.input;
  view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); // initialize view size

  view._width = view.width();
  view._height = view.height();
  view._viewWidth = viewWidth(view, view._width);
  view._viewHeight = viewHeight(view, view._height);
  view._origin = [0, 0];
  view._resize = 0;
  view._autosize = 1;
  initializeResize(view); // initialize background color

  vega_view_module_background(view); // initialize cursor

  vega_view_module_cursor(view); // initialize view description

  view.description(spec.description); // initialize hover proessing, if requested

  if (options.hover) view.hover(); // initialize DOM container(s) and renderer

  if (options.container) view.initialize(options.container, options.bind);
}

function lookupSignal(view, name) {
  return Object(vega_util_module["w" /* hasOwnProperty */])(view._signals, name) ? view._signals[name] : Object(vega_util_module["o" /* error */])('Unrecognized signal name: ' + Object(vega_util_module["bb" /* stringValue */])(name));
}

function findOperatorHandler(op, handler) {
  const h = (op._targets || []).filter(op => op._update && op._update.handler === handler);
  return h.length ? h[0] : null;
}

function addOperatorListener(view, name, op, handler) {
  let h = findOperatorHandler(op, handler);

  if (!h) {
    h = trap(view, () => handler(name, op.value));
    h.handler = handler;
    view.on(op, null, h);
  }

  return view;
}

function removeOperatorListener(view, op, handler) {
  const h = findOperatorHandler(op, handler);
  if (h) op._targets.remove(h);
  return view;
}

Object(vega_util_module["z" /* inherits */])(View, Dataflow, {
  // -- DATAFLOW / RENDERING ----
  async evaluate(encode, prerun, postrun) {
    // evaluate dataflow and prerun
    await Dataflow.prototype.evaluate.call(this, encode, prerun); // render as needed

    if (this._redraw || this._resize) {
      try {
        if (this._renderer) {
          if (this._resize) {
            this._resize = 0;
            resizeRenderer(this);
          }

          await this._renderer.renderAsync(this._scenegraph.root);
        }

        this._redraw = false;
      } catch (e) {
        this.error(e);
      }
    } // evaluate postrun


    if (postrun) asyncCallback(this, postrun);
    return this;
  },

  dirty(item) {
    this._redraw = true;
    this._renderer && this._renderer.dirty(item);
  },

  // -- GET / SET ----
  description(text) {
    if (arguments.length) {
      const desc = text != null ? text + '' : null;
      if (desc !== this._desc) ariaLabel(this._el, this._desc = desc);
      return this;
    }

    return this._desc;
  },

  container() {
    return this._el;
  },

  scenegraph() {
    return this._scenegraph;
  },

  origin() {
    return this._origin.slice();
  },

  signal(name, value, options) {
    const op = lookupSignal(this, name);
    return arguments.length === 1 ? op.value : this.update(op, value, options);
  },

  width(_) {
    return arguments.length ? this.signal('width', _) : this.signal('width');
  },

  height(_) {
    return arguments.length ? this.signal('height', _) : this.signal('height');
  },

  padding(_) {
    return arguments.length ? this.signal('padding', vega_view_module_padding(_)) : vega_view_module_padding(this.signal('padding'));
  },

  autosize(_) {
    return arguments.length ? this.signal('autosize', _) : this.signal('autosize');
  },

  background(_) {
    return arguments.length ? this.signal('background', _) : this.signal('background');
  },

  renderer(type) {
    if (!arguments.length) return this._renderType;
    if (!renderModule(type)) Object(vega_util_module["o" /* error */])('Unrecognized renderer type: ' + type);

    if (type !== this._renderType) {
      this._renderType = type;

      this._resetRenderer();
    }

    return this;
  },

  tooltip(handler) {
    if (!arguments.length) return this._tooltip;

    if (handler !== this._tooltip) {
      this._tooltip = handler;

      this._resetRenderer();
    }

    return this;
  },

  loader(loader) {
    if (!arguments.length) return this._loader;

    if (loader !== this._loader) {
      Dataflow.prototype.loader.call(this, loader);

      this._resetRenderer();
    }

    return this;
  },

  resize() {
    // set flag to perform autosize
    this._autosize = 1; // touch autosize signal to ensure top-level ViewLayout runs

    return this.touch(lookupSignal(this, 'autosize'));
  },

  _resetRenderer() {
    if (this._renderer) {
      this._renderer = null;
      this.initialize(this._el, this._elBind);
    }
  },

  // -- SIZING ----
  _resizeView: resizeView,

  // -- EVENT HANDLING ----
  addEventListener(type, handler, options) {
    let callback = handler;

    if (!(options && options.trap === false)) {
      // wrap callback in error handler
      callback = trap(this, handler);
      callback.raw = handler;
    }

    this._handler.on(type, callback);

    return this;
  },

  removeEventListener(type, handler) {
    var handlers = this._handler.handlers(type),
        i = handlers.length,
        h,
        t; // search registered handlers, remove if match found


    while (--i >= 0) {
      t = handlers[i].type;
      h = handlers[i].handler;

      if (type === t && (handler === h || handler === h.raw)) {
        this._handler.off(t, h);

        break;
      }
    }

    return this;
  },

  addResizeListener(handler) {
    const l = this._resizeListeners;

    if (l.indexOf(handler) < 0) {
      // add handler if it isn't already registered
      // note: error trapping handled elsewhere, so
      // no need to wrap handlers here
      l.push(handler);
    }

    return this;
  },

  removeResizeListener(handler) {
    var l = this._resizeListeners,
        i = l.indexOf(handler);

    if (i >= 0) {
      l.splice(i, 1);
    }

    return this;
  },

  addSignalListener(name, handler) {
    return addOperatorListener(this, name, lookupSignal(this, name), handler);
  },

  removeSignalListener(name, handler) {
    return removeOperatorListener(this, lookupSignal(this, name), handler);
  },

  addDataListener(name, handler) {
    return addOperatorListener(this, name, dataref(this, name).values, handler);
  },

  removeDataListener(name, handler) {
    return removeOperatorListener(this, dataref(this, name).values, handler);
  },

  globalCursor(_) {
    if (arguments.length) {
      if (this._globalCursor !== !!_) {
        const prev = setCursor(this, null); // clear previous cursor

        this._globalCursor = !!_;
        if (prev) setCursor(this, prev); // swap cursor
      }

      return this;
    } else {
      return this._globalCursor;
    }
  },

  preventDefault(_) {
    if (arguments.length) {
      this._preventDefault = _;
      return this;
    } else {
      return this._preventDefault;
    }
  },

  timer: vega_view_module_timer,
  events: vega_view_module_events,
  finalize: vega_view_module_finalize,
  hover: vega_view_module_hover,
  // -- DATA ----
  data: vega_view_module_data,
  change,
  insert: vega_view_module_insert,
  remove: vega_view_module_remove,
  // -- SCALES --
  scale: vega_view_module_scale,
  // -- INITIALIZATION ----
  initialize: vega_view_module_initialize,
  // -- HEADLESS RENDERING ----
  toImageURL: renderToImageURL,
  toCanvas: renderToCanvas,
  toSVG: renderToSVG,
  // -- SAVE / RESTORE STATE ----
  getState: vega_view_module_getState,
  setState: vega_view_module_setState
});



// CONCATENATED MODULE: ./node_modules/vega-parser/node_modules/vega-event-selector/build/vega-event-selector.module.js
const vega_event_selector_module_VIEW = 'view',
      LBRACK = '[',
      RBRACK = ']',
      LBRACE = '{',
      RBRACE = '}',
      COLON = ':',
      COMMA = ',',
      NAME = '@',
      GT = '>',
      vega_event_selector_module_ILLEGAL = /[[\]{}]/,
      DEFAULT_MARKS = {
  '*': 1,
  arc: 1,
  area: 1,
  group: 1,
  image: 1,
  line: 1,
  path: 1,
  rect: 1,
  rule: 1,
  shape: 1,
  symbol: 1,
  text: 1,
  trail: 1
};
let DEFAULT_SOURCE, MARKS;
/**
 * Parse an event selector string.
 * Returns an array of event stream definitions.
 */

function eventSelector (selector, source, marks) {
  DEFAULT_SOURCE = source || vega_event_selector_module_VIEW;
  MARKS = marks || DEFAULT_MARKS;
  return parseMerge(selector.trim()).map(parseSelector);
}

function isMarkType(type) {
  return MARKS[type];
}

function vega_event_selector_module_find(s, i, endChar, pushChar, popChar) {
  const n = s.length;
  let count = 0,
      c;

  for (; i < n; ++i) {
    c = s[i];
    if (!count && c === endChar) return i;else if (popChar && popChar.indexOf(c) >= 0) --count;else if (pushChar && pushChar.indexOf(c) >= 0) ++count;
  }

  return i;
}

function parseMerge(s) {
  const output = [],
        n = s.length;
  let start = 0,
      i = 0;

  while (i < n) {
    i = vega_event_selector_module_find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE);
    output.push(s.substring(start, i).trim());
    start = ++i;
  }

  if (output.length === 0) {
    throw 'Empty event selector: ' + s;
  }

  return output;
}

function parseSelector(s) {
  return s[0] === '[' ? parseBetween(s) : vega_event_selector_module_parseStream(s);
}

function parseBetween(s) {
  const n = s.length;
  let i = 1,
      b;
  i = vega_event_selector_module_find(s, i, RBRACK, LBRACK, RBRACK);

  if (i === n) {
    throw 'Empty between selector: ' + s;
  }

  b = parseMerge(s.substring(1, i));

  if (b.length !== 2) {
    throw 'Between selector must have two elements: ' + s;
  }

  s = s.slice(i + 1).trim();

  if (s[0] !== GT) {
    throw 'Expected \'>\' after between selector: ' + s;
  }

  b = b.map(parseSelector);
  const stream = parseSelector(s.slice(1).trim());

  if (stream.between) {
    return {
      between: b,
      stream: stream
    };
  } else {
    stream.between = b;
  }

  return stream;
}

function vega_event_selector_module_parseStream(s) {
  const stream = {
    source: DEFAULT_SOURCE
  },
        source = [];
  let throttle = [0, 0],
      markname = 0,
      start = 0,
      n = s.length,
      i = 0,
      j,
      filter; // extract throttle from end

  if (s[n - 1] === RBRACE) {
    i = s.lastIndexOf(LBRACE);

    if (i >= 0) {
      try {
        throttle = parseThrottle(s.substring(i + 1, n - 1));
      } catch (e) {
        throw 'Invalid throttle specification: ' + s;
      }

      s = s.slice(0, i).trim();
      n = s.length;
    } else throw 'Unmatched right brace: ' + s;

    i = 0;
  }

  if (!n) throw s; // set name flag based on first char

  if (s[0] === NAME) markname = ++i; // extract first part of multi-part stream selector

  j = vega_event_selector_module_find(s, i, COLON);

  if (j < n) {
    source.push(s.substring(start, j).trim());
    start = i = ++j;
  } // extract remaining part of stream selector


  i = vega_event_selector_module_find(s, i, LBRACK);

  if (i === n) {
    source.push(s.substring(start, n).trim());
  } else {
    source.push(s.substring(start, i).trim());
    filter = [];
    start = ++i;
    if (start === n) throw 'Unmatched left bracket: ' + s;
  } // extract filters


  while (i < n) {
    i = vega_event_selector_module_find(s, i, RBRACK);
    if (i === n) throw 'Unmatched left bracket: ' + s;
    filter.push(s.substring(start, i).trim());
    if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s;
    start = ++i;
  } // marshall event stream specification


  if (!(n = source.length) || vega_event_selector_module_ILLEGAL.test(source[n - 1])) {
    throw 'Invalid event selector: ' + s;
  }

  if (n > 1) {
    stream.type = source[1];

    if (markname) {
      stream.markname = source[0].slice(1);
    } else if (isMarkType(source[0])) {
      stream.marktype = source[0];
    } else {
      stream.source = source[0];
    }
  } else {
    stream.type = source[0];
  }

  if (stream.type.slice(-1) === '!') {
    stream.consume = true;
    stream.type = stream.type.slice(0, -1);
  }

  if (filter != null) stream.filter = filter;
  if (throttle[0]) stream.throttle = throttle[0];
  if (throttle[1]) stream.debounce = throttle[1];
  return stream;
}

function parseThrottle(s) {
  const a = s.split(COMMA);
  if (!s.length || a.length > 2) throw s;
  return a.map(_ => {
    const x = +_;
    if (x !== x) throw s;
    return x;
  });
}



// CONCATENATED MODULE: ./node_modules/vega-parser/build/vega-parser.module.js






function parseAutosize (spec) {
  return Object(vega_util_module["H" /* isObject */])(spec) ? spec : {
    type: spec || 'pad'
  };
}

const vega_parser_module_number = _ => +_ || 0;

const vega_parser_module_paddingObject = _ => ({
  top: _,
  bottom: _,
  left: _,
  right: _
});

function parsePadding (spec) {
  return !Object(vega_util_module["H" /* isObject */])(spec) ? vega_parser_module_paddingObject(vega_parser_module_number(spec)) : spec.signal ? spec : {
    top: vega_parser_module_number(spec.top),
    bottom: vega_parser_module_number(spec.bottom),
    left: vega_parser_module_number(spec.left),
    right: vega_parser_module_number(spec.right)
  };
}

const encoder = _ => Object(vega_util_module["H" /* isObject */])(_) && !Object(vega_util_module["B" /* isArray */])(_) ? Object(vega_util_module["p" /* extend */])({}, _) : {
  value: _
};
function addEncode(object, name, value, set) {
  if (value != null) {
    const isEncoder = Object(vega_util_module["H" /* isObject */])(value) && !Object(vega_util_module["B" /* isArray */])(value) || Object(vega_util_module["B" /* isArray */])(value) && value.length && Object(vega_util_module["H" /* isObject */])(value[0]); // Always assign signal to update, even if the signal is from the enter block

    if (isEncoder) {
      object.update[name] = value;
    } else {
      object[set || 'enter'][name] = {
        value: value
      };
    }

    return 1;
  } else {
    return 0;
  }
}
function addEncoders(object, enter, update) {
  for (const name in enter) {
    addEncode(object, name, enter[name]);
  }

  for (const name in update) {
    addEncode(object, name, update[name], 'update');
  }
}
function extendEncode(encode, extra, skip) {
  for (const name in extra) {
    if (skip && Object(vega_util_module["w" /* hasOwnProperty */])(skip, name)) continue;
    encode[name] = Object(vega_util_module["p" /* extend */])(encode[name] || {}, extra[name]);
  }

  return encode;
}
function vega_parser_module_has(key, encode) {
  return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]);
}

const MarkRole = 'mark';
const vega_parser_module_FrameRole = 'frame';
const vega_parser_module_ScopeRole = 'scope';
const vega_parser_module_AxisRole = 'axis';
const AxisDomainRole = 'axis-domain';
const AxisGridRole = 'axis-grid';
const AxisLabelRole = 'axis-label';
const AxisTickRole = 'axis-tick';
const AxisTitleRole = 'axis-title';
const vega_parser_module_LegendRole = 'legend';
const LegendBandRole = 'legend-band';
const LegendEntryRole = 'legend-entry';
const LegendGradientRole = 'legend-gradient';
const LegendLabelRole = 'legend-label';
const LegendSymbolRole = 'legend-symbol';
const LegendTitleRole = 'legend-title';
const vega_parser_module_TitleRole = 'title';
const TitleTextRole = 'title-text';
const TitleSubtitleRole = 'title-subtitle';

function applyDefaults (encode, type, role, style, config) {
  const defaults = {},
        enter = {};
  let update, key, skip, props; // if text mark, apply global lineBreak settings (#2370)

  key = 'lineBreak';

  if (type === 'text' && config[key] != null && !vega_parser_module_has(key, encode)) {
    applyDefault(defaults, key, config[key]);
  } // ignore legend and axis roles


  if (role == 'legend' || String(role).startsWith('axis')) {
    role = null;
  } // resolve mark config


  props = role === vega_parser_module_FrameRole ? config.group : role === MarkRole ? Object(vega_util_module["p" /* extend */])({}, config.mark, config[type]) : null;

  for (key in props) {
    // do not apply defaults if relevant fields are defined
    skip = vega_parser_module_has(key, encode) || (key === 'fill' || key === 'stroke') && (vega_parser_module_has('fill', encode) || vega_parser_module_has('stroke', encode));
    if (!skip) applyDefault(defaults, key, props[key]);
  } // resolve styles, apply with increasing precedence


  Object(vega_util_module["i" /* array */])(style).forEach(name => {
    const props = config.style && config.style[name];

    for (const key in props) {
      if (!vega_parser_module_has(key, encode)) {
        applyDefault(defaults, key, props[key]);
      }
    }
  });
  encode = Object(vega_util_module["p" /* extend */])({}, encode); // defensive copy

  for (key in defaults) {
    props = defaults[key];

    if (props.signal) {
      (update = update || {})[key] = props;
    } else {
      enter[key] = props;
    }
  }

  encode.enter = Object(vega_util_module["p" /* extend */])(enter, encode.enter);
  if (update) encode.update = Object(vega_util_module["p" /* extend */])(update, encode.update);
  return encode;
}

function applyDefault(defaults, key, value) {
  defaults[key] = value && value.signal ? {
    signal: value.signal
  } : {
    value: value
  };
}

const scaleRef = scale => Object(vega_util_module["J" /* isString */])(scale) ? Object(vega_util_module["bb" /* stringValue */])(scale) : scale.signal ? `(${scale.signal})` : vega_parser_module_field(scale);

function entry$1(enc) {
  if (enc.gradient != null) {
    return vega_parser_module_gradient(enc);
  }

  let value = enc.signal ? `(${enc.signal})` : enc.color ? vega_parser_module_color(enc.color) : enc.field != null ? vega_parser_module_field(enc.field) : enc.value !== undefined ? Object(vega_util_module["bb" /* stringValue */])(enc.value) : undefined;

  if (enc.scale != null) {
    value = vega_parser_module_scale(enc, value);
  }

  if (value === undefined) {
    value = null;
  }

  if (enc.exponent != null) {
    value = `pow(${value},${vega_parser_module_property(enc.exponent)})`;
  }

  if (enc.mult != null) {
    value += `*${vega_parser_module_property(enc.mult)}`;
  }

  if (enc.offset != null) {
    value += `+${vega_parser_module_property(enc.offset)}`;
  }

  if (enc.round) {
    value = `round(${value})`;
  }

  return value;
}

const _color = (type, x, y, z) => `(${type}(${[x, y, z].map(entry$1).join(',')})+'')`;

function vega_parser_module_color(enc) {
  return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null;
}

function vega_parser_module_gradient(enc) {
  // map undefined to null; expression lang does not allow undefined
  const args = [enc.start, enc.stop, enc.count].map(_ => _ == null ? null : Object(vega_util_module["bb" /* stringValue */])(_)); // trim null inputs from the end

  while (args.length && Object(vega_util_module["W" /* peek */])(args) == null) args.pop();

  args.unshift(scaleRef(enc.gradient));
  return `gradient(${args.join(',')})`;
}

function vega_parser_module_property(property) {
  return Object(vega_util_module["H" /* isObject */])(property) ? '(' + entry$1(property) + ')' : property;
}

function vega_parser_module_field(ref) {
  return resolveField(Object(vega_util_module["H" /* isObject */])(ref) ? ref : {
    datum: ref
  });
}

function resolveField(ref) {
  let object, level, field;

  if (ref.signal) {
    object = 'datum';
    field = ref.signal;
  } else if (ref.group || ref.parent) {
    level = Math.max(1, ref.level || 1);
    object = 'item';

    while (level-- > 0) {
      object += '.mark.group';
    }

    if (ref.parent) {
      field = ref.parent;
      object += '.datum';
    } else {
      field = ref.group;
    }
  } else if (ref.datum) {
    object = 'datum';
    field = ref.datum;
  } else {
    Object(vega_util_module["o" /* error */])('Invalid field reference: ' + Object(vega_util_module["bb" /* stringValue */])(ref));
  }

  if (!ref.signal) {
    field = Object(vega_util_module["J" /* isString */])(field) ? Object(vega_util_module["ab" /* splitAccessPath */])(field).map(vega_util_module["bb" /* stringValue */]).join('][') : resolveField(field);
  }

  return object + '[' + field + ']';
}

function vega_parser_module_scale(enc, value) {
  const scale = scaleRef(enc.scale);

  if (enc.range != null) {
    // pull value from scale range
    value = `lerp(_range(${scale}), ${+enc.range})`;
  } else {
    // run value through scale and/or pull scale bandwidth
    if (value !== undefined) value = `_scale(${scale}, ${value})`;

    if (enc.band) {
      value = (value ? value + '+' : '') + `_bandwidth(${scale})` + (+enc.band === 1 ? '' : '*' + vega_parser_module_property(enc.band));

      if (enc.extra) {
        // include logic to handle extraneous elements
        value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`;
      }
    }

    if (value == null) value = '0';
  }

  return value;
}

function vega_parser_module_rule (enc) {
  let code = '';
  enc.forEach(rule => {
    const value = entry$1(rule);
    code += rule.test ? `(${rule.test})?${value}:` : value;
  }); // if no else clause, terminate with null (#1366)

  if (Object(vega_util_module["W" /* peek */])(code) === ':') {
    code += 'null';
  }

  return code;
}

function parseEncode (encode, type, role, style, scope, params) {
  const enc = {};
  params = params || {};
  params.encoders = {
    $encode: enc
  };
  encode = applyDefaults(encode, type, role, style, scope.config);

  for (const key in encode) {
    enc[key] = parseBlock(encode[key], type, params, scope);
  }

  return params;
}

function parseBlock(block, marktype, params, scope) {
  const channels = {},
        fields = {};

  for (const name in block) {
    if (block[name] != null) {
      // skip any null entries
      channels[name] = parse$1(vega_parser_module_expr(block[name]), scope, params, fields);
    }
  }

  return {
    $expr: {
      marktype,
      channels
    },
    $fields: Object.keys(fields),
    $output: Object.keys(block)
  };
}

function vega_parser_module_expr(enc) {
  return Object(vega_util_module["B" /* isArray */])(enc) ? vega_parser_module_rule(enc) : entry$1(enc);
}

function parse$1(code, scope, params, fields) {
  const expr = vega_functions_module_parser(code, scope);
  expr.$fields.forEach(name => fields[name] = 1);
  Object(vega_util_module["p" /* extend */])(params, expr.$params);
  return expr.$expr;
}

const OUTER = 'outer',
      OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind'];

function outerError(prefix, name) {
  Object(vega_util_module["o" /* error */])(prefix + ' for "outer" push: ' + Object(vega_util_module["bb" /* stringValue */])(name));
}

function parseSignal (signal, scope) {
  const name = signal.name;

  if (signal.push === OUTER) {
    // signal must already be defined, raise error if not
    if (!scope.signals[name]) outerError('No prior signal definition', name); // signal push must not use properties reserved for standard definition

    OUTER_INVALID.forEach(prop => {
      if (signal[prop] !== undefined) outerError('Invalid property ', prop);
    });
  } else {
    // define a new signal in the current scope
    const op = scope.addSignal(name, signal.value);
    if (signal.react === false) op.react = false;
    if (signal.bind) scope.addBinding(name, signal.bind);
  }
}

function Entry(type, value, params, parent) {
  this.id = -1;
  this.type = type;
  this.value = value;
  this.params = params;
  if (parent) this.parent = parent;
}
function vega_parser_module_entry(type, value, params, parent) {
  return new Entry(type, value, params, parent);
}
function vega_parser_module_operator(value, params) {
  return vega_parser_module_entry('operator', value, params);
} // -----

function vega_parser_module_ref(op) {
  const ref = {
    $ref: op.id
  }; // if operator not yet registered, cache ref to resolve later

  if (op.id < 0) (op.refs = op.refs || []).push(ref);
  return ref;
}
function fieldRef$1(field, name) {
  return name ? {
    $field: field,
    $name: name
  } : {
    $field: field
  };
}
const keyFieldRef = fieldRef$1('key');
function compareRef(fields, orders) {
  return {
    $compare: fields,
    $order: orders
  };
}
function keyRef(fields, flat) {
  const ref = {
    $key: fields
  };
  if (flat) ref.$flat = true;
  return ref;
} // -----

const Ascending = 'ascending';
const Descending = 'descending';
function sortKey(sort) {
  return !Object(vega_util_module["H" /* isObject */])(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field);
}
function aggrField(op, field) {
  return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || '');
} // -----

const Scope$1 = 'scope';
const vega_parser_module_View = 'view';
function isSignal(_) {
  return _ && _.signal;
}
function isExpr$1(_) {
  return _ && _.expr;
}
function vega_parser_module_hasSignal(_) {
  if (isSignal(_)) return true;
  if (Object(vega_util_module["H" /* isObject */])(_)) for (const key in _) {
    if (vega_parser_module_hasSignal(_[key])) return true;
  }
  return false;
}
function vega_parser_module_value(specValue, defaultValue) {
  return specValue != null ? specValue : defaultValue;
}
function deref(v) {
  return v && v.signal || v;
}

const vega_parser_module_Timer = 'timer';
function vega_parser_module_parseStream(stream, scope) {
  const method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : Object(vega_util_module["o" /* error */])('Invalid stream specification: ' + Object(vega_util_module["bb" /* stringValue */])(stream));
  return method(stream, scope);
}

function eventSource(source) {
  return source === Scope$1 ? vega_parser_module_View : source || vega_parser_module_View;
}

function mergeStream(stream, scope) {
  const list = stream.merge.map(s => vega_parser_module_parseStream(s, scope)),
        entry = streamParameters({
    merge: list
  }, stream, scope);
  return scope.addStream(entry).id;
}

function nestedStream(stream, scope) {
  const id = vega_parser_module_parseStream(stream.stream, scope),
        entry = streamParameters({
    stream: id
  }, stream, scope);
  return scope.addStream(entry).id;
}

function eventStream(stream, scope) {
  let id;

  if (stream.type === vega_parser_module_Timer) {
    id = scope.event(vega_parser_module_Timer, stream.throttle);
    stream = {
      between: stream.between,
      filter: stream.filter
    };
  } else {
    id = scope.event(eventSource(stream.source), stream.type);
  }

  const entry = streamParameters({
    stream: id
  }, stream, scope);
  return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id;
}

function streamParameters(entry, stream, scope) {
  let param = stream.between;

  if (param) {
    if (param.length !== 2) {
      Object(vega_util_module["o" /* error */])('Stream "between" parameter must have 2 entries: ' + Object(vega_util_module["bb" /* stringValue */])(stream));
    }

    entry.between = [vega_parser_module_parseStream(param[0], scope), vega_parser_module_parseStream(param[1], scope)];
  }

  param = stream.filter ? [].concat(stream.filter) : [];

  if (stream.marktype || stream.markname || stream.markrole) {
    // add filter for mark type, name and/or role
    param.push(filterMark(stream.marktype, stream.markname, stream.markrole));
  }

  if (stream.source === Scope$1) {
    // add filter to limit events from sub-scope only
    param.push('inScope(event.item)');
  }

  if (param.length) {
    entry.filter = vega_functions_module_parser('(' + param.join(')&&(') + ')', scope).$expr;
  }

  if ((param = stream.throttle) != null) {
    entry.throttle = +param;
  }

  if ((param = stream.debounce) != null) {
    entry.debounce = +param;
  }

  if (stream.consume) {
    entry.consume = true;
  }

  return entry;
}

function filterMark(type, name, role) {
  const item = 'event.item';
  return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : '');
}

const OP_VALUE_EXPR = {
  code: '_.$value',
  ast: {
    type: 'Identifier',
    value: 'value'
  }
};
function vega_parser_module_parseUpdate (spec, scope, target) {
  const encode = spec.encode,
        entry = {
    target: target
  };
  let events = spec.events,
      update = spec.update,
      sources = [];

  if (!events) {
    Object(vega_util_module["o" /* error */])('Signal update missing events specification.');
  } // interpret as an event selector string


  if (Object(vega_util_module["J" /* isString */])(events)) {
    events = eventSelector(events, scope.isSubscope() ? Scope$1 : vega_parser_module_View);
  } // separate event streams from signal updates


  events = Object(vega_util_module["i" /* array */])(events).filter(s => s.signal || s.scale ? (sources.push(s), 0) : 1); // merge internal operator listeners

  if (sources.length > 1) {
    sources = [mergeSources(sources)];
  } // merge event streams, include as source


  if (events.length) {
    sources.push(events.length > 1 ? {
      merge: events
    } : events[0]);
  }

  if (encode != null) {
    if (update) Object(vega_util_module["o" /* error */])('Signal encode and update are mutually exclusive.');
    update = 'encode(item(),' + Object(vega_util_module["bb" /* stringValue */])(encode) + ')';
  } // resolve update value


  entry.update = Object(vega_util_module["J" /* isString */])(update) ? vega_functions_module_parser(update, scope) : update.expr != null ? vega_functions_module_parser(update.expr, scope) : update.value != null ? update.value : update.signal != null ? {
    $expr: OP_VALUE_EXPR,
    $params: {
      $value: scope.signalRef(update.signal)
    }
  } : Object(vega_util_module["o" /* error */])('Invalid signal update specification.');

  if (spec.force) {
    entry.options = {
      force: true
    };
  }

  sources.forEach(source => scope.addUpdate(Object(vega_util_module["p" /* extend */])(streamSource(source, scope), entry)));
}

function streamSource(stream, scope) {
  return {
    source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : vega_parser_module_parseStream(stream, scope)
  };
}

function mergeSources(sources) {
  return {
    signal: '[' + sources.map(s => s.scale ? 'scale("' + s.scale + '")' : s.signal) + ']'
  };
}

function parseSignalUpdates (signal, scope) {
  const op = scope.getSignal(signal.name);
  let expr = signal.update;

  if (signal.init) {
    if (expr) {
      Object(vega_util_module["o" /* error */])('Signals can not include both init and update expressions.');
    } else {
      expr = signal.init;
      op.initonly = true;
    }
  }

  if (expr) {
    expr = vega_functions_module_parser(expr, scope);
    op.update = expr.$expr;
    op.params = expr.$params;
  }

  if (signal.on) {
    signal.on.forEach(_ => vega_parser_module_parseUpdate(_, scope, op.id));
  }
}

const vega_parser_module_transform = name => (params, value, parent) => vega_parser_module_entry(name, value, params || undefined, parent);

const vega_parser_module_Aggregate = vega_parser_module_transform('aggregate');
const vega_parser_module_AxisTicks = vega_parser_module_transform('axisticks');
const vega_parser_module_Bound = vega_parser_module_transform('bound');
const vega_parser_module_Collect = vega_parser_module_transform('collect');
const vega_parser_module_Compare = vega_parser_module_transform('compare');
const vega_parser_module_DataJoin = vega_parser_module_transform('datajoin');
const vega_parser_module_Encode = vega_parser_module_transform('encode');
const vega_parser_module_Expression = vega_parser_module_transform('expression');
const vega_parser_module_Facet = vega_parser_module_transform('facet');
const vega_parser_module_Field = vega_parser_module_transform('field');
const vega_parser_module_Key = vega_parser_module_transform('key');
const vega_parser_module_LegendEntries = vega_parser_module_transform('legendentries');
const vega_parser_module_Load = vega_parser_module_transform('load');
const vega_parser_module_Mark = vega_parser_module_transform('mark');
const vega_parser_module_MultiExtent = vega_parser_module_transform('multiextent');
const vega_parser_module_MultiValues = vega_parser_module_transform('multivalues');
const vega_parser_module_Overlap = vega_parser_module_transform('overlap');
const vega_parser_module_Params = vega_parser_module_transform('params');
const vega_parser_module_PreFacet = vega_parser_module_transform('prefacet');
const vega_parser_module_Projection = vega_parser_module_transform('projection');
const vega_parser_module_Proxy = vega_parser_module_transform('proxy');
const vega_parser_module_Relay = vega_parser_module_transform('relay');
const vega_parser_module_Render = vega_parser_module_transform('render');
const vega_parser_module_Scale = vega_parser_module_transform('scale');
const vega_parser_module_Sieve = vega_parser_module_transform('sieve');
const vega_parser_module_SortItems = vega_parser_module_transform('sortitems');
const vega_parser_module_ViewLayout = vega_parser_module_transform('viewlayout');
const vega_parser_module_Values = vega_parser_module_transform('values');

let FIELD_REF_ID = 0;
const MULTIDOMAIN_SORT_OPS = {
  min: 'min',
  max: 'max',
  count: 'sum'
};
function initScale(spec, scope) {
  const type = spec.type || 'linear';

  if (!isValidScaleType(type)) {
    Object(vega_util_module["o" /* error */])('Unrecognized scale type: ' + Object(vega_util_module["bb" /* stringValue */])(type));
  }

  scope.addScale(spec.name, {
    type,
    domain: undefined
  });
}
function vega_parser_module_parseScale(spec, scope) {
  const params = scope.getScale(spec.name).params;
  let key;
  params.domain = parseScaleDomain(spec.domain, spec, scope);

  if (spec.range != null) {
    params.range = parseScaleRange(spec, scope, params);
  }

  if (spec.interpolate != null) {
    parseScaleInterpolate(spec.interpolate, params);
  }

  if (spec.nice != null) {
    params.nice = parseScaleNice(spec.nice);
  }

  if (spec.bins != null) {
    params.bins = parseScaleBins(spec.bins, scope);
  }

  for (key in spec) {
    if (Object(vega_util_module["w" /* hasOwnProperty */])(params, key) || key === 'name') continue;
    params[key] = parseLiteral(spec[key], scope);
  }
}

function parseLiteral(v, scope) {
  return !Object(vega_util_module["H" /* isObject */])(v) ? v : v.signal ? scope.signalRef(v.signal) : Object(vega_util_module["o" /* error */])('Unsupported object: ' + Object(vega_util_module["bb" /* stringValue */])(v));
}

function parseArray(v, scope) {
  return v.signal ? scope.signalRef(v.signal) : v.map(v => parseLiteral(v, scope));
}

function dataLookupError(name) {
  Object(vega_util_module["o" /* error */])('Can not find data set: ' + Object(vega_util_module["bb" /* stringValue */])(name));
} // -- SCALE DOMAIN ----


function parseScaleDomain(domain, spec, scope) {
  if (!domain) {
    if (spec.domainMin != null || spec.domainMax != null) {
      Object(vega_util_module["o" /* error */])('No scale domain defined for domainMin/domainMax to override.');
    }

    return; // default domain
  }

  return domain.signal ? scope.signalRef(domain.signal) : (Object(vega_util_module["B" /* isArray */])(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope);
}

function explicitDomain(domain, spec, scope) {
  return domain.map(v => parseLiteral(v, scope));
}

function singularDomain(domain, spec, scope) {
  const data = scope.getData(domain.data);
  if (!data) dataLookupError(domain.data);
  return isDiscrete(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : isQuantile(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field);
}

function multipleDomain(domain, spec, scope) {
  const data = domain.data,
        fields = domain.fields.reduce((dom, d) => {
    d = Object(vega_util_module["J" /* isString */])(d) ? {
      data: data,
      field: d
    } : Object(vega_util_module["B" /* isArray */])(d) || d.signal ? vega_parser_module_fieldRef(d, scope) : d;
    dom.push(d);
    return dom;
  }, []);
  return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields);
}

function vega_parser_module_fieldRef(data, scope) {
  const name = '_:vega:_' + FIELD_REF_ID++,
        coll = vega_parser_module_Collect({});

  if (Object(vega_util_module["B" /* isArray */])(data)) {
    coll.value = {
      $ingest: data
    };
  } else if (data.signal) {
    const code = 'setdata(' + Object(vega_util_module["bb" /* stringValue */])(name) + ',' + data.signal + ')';
    coll.params.input = scope.signalRef(code);
  }

  scope.addDataPipeline(name, [coll, vega_parser_module_Sieve({})]);
  return {
    data: name,
    field: 'data'
  };
}

function ordinalMultipleDomain(domain, scope, fields) {
  const sort = parseSort(domain.sort, true);
  let a, v; // get value counts for each domain field

  const counts = fields.map(f => {
    const data = scope.getData(f.data);
    if (!data) dataLookupError(f.data);
    return data.countsRef(scope, f.field, sort);
  }); // aggregate the results from each domain field

  const p = {
    groupby: keyFieldRef,
    pulse: counts
  };

  if (sort) {
    a = sort.op || 'count';
    v = sort.field ? aggrField(a, sort.field) : 'count';
    p.ops = [MULTIDOMAIN_SORT_OPS[a]];
    p.fields = [scope.fieldRef(v)];
    p.as = [v];
  }

  a = scope.add(vega_parser_module_Aggregate(p)); // collect aggregate output

  const c = scope.add(vega_parser_module_Collect({
    pulse: vega_parser_module_ref(a)
  })); // extract values for combined domain

  v = scope.add(vega_parser_module_Values({
    field: keyFieldRef,
    sort: scope.sortRef(sort),
    pulse: vega_parser_module_ref(c)
  }));
  return vega_parser_module_ref(v);
}

function parseSort(sort, multidomain) {
  if (sort) {
    if (!sort.field && !sort.op) {
      if (Object(vega_util_module["H" /* isObject */])(sort)) sort.field = 'key';else sort = {
        field: 'key'
      };
    } else if (!sort.field && sort.op !== 'count') {
      Object(vega_util_module["o" /* error */])('No field provided for sort aggregate op: ' + sort.op);
    } else if (multidomain && sort.field) {
      if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) {
        Object(vega_util_module["o" /* error */])('Multiple domain scales can not be sorted using ' + sort.op);
      }
    }
  }

  return sort;
}

function quantileMultipleDomain(domain, scope, fields) {
  // get value arrays for each domain field
  const values = fields.map(f => {
    const data = scope.getData(f.data);
    if (!data) dataLookupError(f.data);
    return data.domainRef(scope, f.field);
  }); // combine value arrays

  return vega_parser_module_ref(scope.add(vega_parser_module_MultiValues({
    values: values
  })));
}

function numericMultipleDomain(domain, scope, fields) {
  // get extents for each domain field
  const extents = fields.map(f => {
    const data = scope.getData(f.data);
    if (!data) dataLookupError(f.data);
    return data.extentRef(scope, f.field);
  }); // combine extents

  return vega_parser_module_ref(scope.add(vega_parser_module_MultiExtent({
    extents: extents
  })));
} // -- SCALE BINS -----


function parseScaleBins(v, scope) {
  return v.signal || Object(vega_util_module["B" /* isArray */])(v) ? parseArray(v, scope) : scope.objectProperty(v);
} // -- SCALE NICE -----


function parseScaleNice(nice) {
  return Object(vega_util_module["H" /* isObject */])(nice) ? {
    interval: parseLiteral(nice.interval),
    step: parseLiteral(nice.step)
  } : parseLiteral(nice);
} // -- SCALE INTERPOLATION -----


function parseScaleInterpolate(interpolate, params) {
  params.interpolate = parseLiteral(interpolate.type || interpolate);

  if (interpolate.gamma != null) {
    params.interpolateGamma = parseLiteral(interpolate.gamma);
  }
} // -- SCALE RANGE -----


function parseScaleRange(spec, scope, params) {
  const config = scope.config.range;
  let range = spec.range;

  if (range.signal) {
    return scope.signalRef(range.signal);
  } else if (Object(vega_util_module["J" /* isString */])(range)) {
    if (config && Object(vega_util_module["w" /* hasOwnProperty */])(config, range)) {
      spec = Object(vega_util_module["p" /* extend */])({}, spec, {
        range: config[range]
      });
      return parseScaleRange(spec, scope, params);
    } else if (range === 'width') {
      range = [0, {
        signal: 'width'
      }];
    } else if (range === 'height') {
      range = isDiscrete(spec.type) ? [0, {
        signal: 'height'
      }] : [{
        signal: 'height'
      }, 0];
    } else {
      Object(vega_util_module["o" /* error */])('Unrecognized scale range value: ' + Object(vega_util_module["bb" /* stringValue */])(range));
    }
  } else if (range.scheme) {
    params.scheme = Object(vega_util_module["B" /* isArray */])(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope);
    if (range.extent) params.schemeExtent = parseArray(range.extent, scope);
    if (range.count) params.schemeCount = parseLiteral(range.count, scope);
    return;
  } else if (range.step) {
    params.rangeStep = parseLiteral(range.step, scope);
    return;
  } else if (isDiscrete(spec.type) && !Object(vega_util_module["B" /* isArray */])(range)) {
    return parseScaleDomain(range, spec, scope);
  } else if (!Object(vega_util_module["B" /* isArray */])(range)) {
    Object(vega_util_module["o" /* error */])('Unsupported range type: ' + Object(vega_util_module["bb" /* stringValue */])(range));
  }

  return range.map(v => (Object(vega_util_module["B" /* isArray */])(v) ? parseArray : parseLiteral)(v, scope));
}

function vega_parser_module_parseProjection (proj, scope) {
  const config = scope.config.projection || {},
        params = {};

  for (const name in proj) {
    if (name === 'name') continue;
    params[name] = parseParameter$1(proj[name], name, scope);
  } // apply projection defaults from config


  for (const name in config) {
    if (params[name] == null) {
      params[name] = parseParameter$1(config[name], name, scope);
    }
  }

  scope.addProjection(proj.name, params);
}

function parseParameter$1(_, name, scope) {
  return Object(vega_util_module["B" /* isArray */])(_) ? _.map(_ => parseParameter$1(_, name, scope)) : !Object(vega_util_module["H" /* isObject */])(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : Object(vega_util_module["o" /* error */])('Unsupported parameter object: ' + Object(vega_util_module["bb" /* stringValue */])(_));
}

const vega_parser_module_Top = 'top';
const vega_parser_module_Left = 'left';
const vega_parser_module_Right = 'right';
const vega_parser_module_Bottom = 'bottom';
const vega_parser_module_Center = 'center';
const Vertical = 'vertical';
const vega_parser_module_Start = 'start';
const vega_parser_module_Middle = 'middle';
const vega_parser_module_End = 'end';
const Index = 'index';
const vega_parser_module_Label = 'label';
const Offset = 'offset';
const Perc = 'perc';
const Perc2 = 'perc2';
const Value = 'value';
const GuideLabelStyle = 'guide-label';
const GuideTitleStyle = 'guide-title';
const GroupTitleStyle = 'group-title';
const GroupSubtitleStyle = 'group-subtitle';
const vega_parser_module_Symbols = 'symbol';
const vega_parser_module_Gradient = 'gradient';
const vega_parser_module_Discrete = 'discrete';
const Size = 'size';
const Shape = 'shape';
const Fill = 'fill';
const Stroke = 'stroke';
const StrokeWidth = 'strokeWidth';
const StrokeDash = 'strokeDash';
const Opacity = 'opacity'; // Encoding channels supported by legends
// In priority order of 'canonical' scale

const LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity];
const vega_parser_module_Skip = {
  name: 1,
  style: 1,
  interactive: 1
};
const vega_parser_module_zero = {
  value: 0
};
const vega_parser_module_one = {
  value: 1
};

const GroupMark = 'group';
const RectMark = 'rect';
const RuleMark = 'rule';
const SymbolMark = 'symbol';
const TextMark = 'text';

function guideGroup (mark) {
  mark.type = GroupMark;
  mark.interactive = mark.interactive || false;
  return mark;
}

function vega_parser_module_lookup(spec, config) {
  const _ = (name, dflt) => vega_parser_module_value(spec[name], vega_parser_module_value(config[name], dflt));

  _.isVertical = s => Vertical === vega_parser_module_value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection));

  _.gradientLength = () => vega_parser_module_value(spec.gradientLength, config.gradientLength || config.gradientWidth);

  _.gradientThickness = () => vega_parser_module_value(spec.gradientThickness, config.gradientThickness || config.gradientHeight);

  _.entryColumns = () => vega_parser_module_value(spec.columns, vega_parser_module_value(config.columns, +_.isVertical(true)));

  return _;
}
function getEncoding(name, encode) {
  const v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]);
  return v && v.signal ? v : v ? v.value : null;
}
function getStyle(name, scope, style) {
  const s = scope.config.style[style];
  return s && s[name];
}
function anchorExpr(s, e, m) {
  return `item.anchor === '${vega_parser_module_Start}' ? ${s} : item.anchor === '${vega_parser_module_End}' ? ${e} : ${m}`;
}
const alignExpr$1 = anchorExpr(Object(vega_util_module["bb" /* stringValue */])(vega_parser_module_Left), Object(vega_util_module["bb" /* stringValue */])(vega_parser_module_Right), Object(vega_util_module["bb" /* stringValue */])(vega_parser_module_Center));
function tickBand(_) {
  const v = _('tickBand');

  let offset = _('tickOffset'),
      band,
      extra;

  if (!v) {
    // if no tick band entry, fall back on other properties
    band = _('bandPosition');
    extra = _('tickExtra');
  } else if (v.signal) {
    // if signal, augment code to interpret values
    band = {
      signal: `(${v.signal}) === 'extent' ? 1 : 0.5`
    };
    extra = {
      signal: `(${v.signal}) === 'extent'`
    };

    if (!Object(vega_util_module["H" /* isObject */])(offset)) {
      offset = {
        signal: `(${v.signal}) === 'extent' ? 0 : ${offset}`
      };
    }
  } else if (v === 'extent') {
    // if constant, simply set values
    band = 1;
    extra = true;
    offset = 0;
  } else {
    band = 0.5;
    extra = false;
  }

  return {
    extra,
    band,
    offset
  };
}
function extendOffset(value, offset) {
  return !offset ? value : !value ? offset : !Object(vega_util_module["H" /* isObject */])(value) ? {
    value,
    offset
  } : Object.assign({}, value, {
    offset: extendOffset(value.offset, offset)
  });
}

function guideMark (mark, extras) {
  if (extras) {
    mark.name = extras.name;
    mark.style = extras.style || mark.style;
    mark.interactive = !!extras.interactive;
    mark.encode = extendEncode(mark.encode, extras, vega_parser_module_Skip);
  } else {
    mark.interactive = false;
  }

  return mark;
}

function legendGradient (spec, scale, config, userEncode) {
  const _ = vega_parser_module_lookup(spec, config),
        vertical = _.isVertical(),
        thickness = _.gradientThickness(),
        length = _.gradientLength();

  let enter, start, stop, width, height;

  if (vertical) {
    start = [0, 1];
    stop = [0, 0];
    width = thickness;
    height = length;
  } else {
    start = [0, 0];
    stop = [1, 0];
    width = length;
    height = thickness;
  }

  const encode = {
    enter: enter = {
      opacity: vega_parser_module_zero,
      x: vega_parser_module_zero,
      y: vega_parser_module_zero,
      width: encoder(width),
      height: encoder(height)
    },
    update: Object(vega_util_module["p" /* extend */])({}, enter, {
      opacity: vega_parser_module_one,
      fill: {
        gradient: scale,
        start: start,
        stop: stop
      }
    }),
    exit: {
      opacity: vega_parser_module_zero
    }
  };
  addEncoders(encode, {
    stroke: _('gradientStrokeColor'),
    strokeWidth: _('gradientStrokeWidth')
  }, {
    // update
    opacity: _('gradientOpacity')
  });
  return guideMark({
    type: RectMark,
    role: LegendGradientRole,
    encode
  }, userEncode);
}

function legendGradientDiscrete (spec, scale, config, userEncode, dataRef) {
  const _ = vega_parser_module_lookup(spec, config),
        vertical = _.isVertical(),
        thickness = _.gradientThickness(),
        length = _.gradientLength();

  let u,
      v,
      uu,
      vv,
      adjust = '';
  vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height');
  const enter = {
    opacity: vega_parser_module_zero,
    fill: {
      scale: scale,
      field: Value
    }
  };
  enter[u] = {
    signal: adjust + 'datum.' + Perc,
    mult: length
  };
  enter[v] = vega_parser_module_zero;
  enter[uu] = {
    signal: adjust + 'datum.' + Perc2,
    mult: length
  };
  enter[vv] = encoder(thickness);
  const encode = {
    enter: enter,
    update: Object(vega_util_module["p" /* extend */])({}, enter, {
      opacity: vega_parser_module_one
    }),
    exit: {
      opacity: vega_parser_module_zero
    }
  };
  addEncoders(encode, {
    stroke: _('gradientStrokeColor'),
    strokeWidth: _('gradientStrokeWidth')
  }, {
    // update
    opacity: _('gradientOpacity')
  });
  return guideMark({
    type: RectMark,
    role: LegendBandRole,
    key: Value,
    from: dataRef,
    encode
  }, userEncode);
}

const alignExpr = `datum.${Perc}<=0?"${vega_parser_module_Left}":datum.${Perc}>=1?"${vega_parser_module_Right}":"${vega_parser_module_Center}"`,
      baselineExpr = `datum.${Perc}<=0?"${vega_parser_module_Bottom}":datum.${Perc}>=1?"${vega_parser_module_Top}":"${vega_parser_module_Middle}"`;
function legendGradientLabels (spec, config, userEncode, dataRef) {
  const _ = vega_parser_module_lookup(spec, config),
        vertical = _.isVertical(),
        thickness = encoder(_.gradientThickness()),
        length = _.gradientLength();

  let overlap = _('labelOverlap'),
      enter,
      update,
      u,
      v,
      adjust = '';

  const encode = {
    enter: enter = {
      opacity: vega_parser_module_zero
    },
    update: update = {
      opacity: vega_parser_module_one,
      text: {
        field: vega_parser_module_Label
      }
    },
    exit: {
      opacity: vega_parser_module_zero
    }
  };
  addEncoders(encode, {
    fill: _('labelColor'),
    fillOpacity: _('labelOpacity'),
    font: _('labelFont'),
    fontSize: _('labelFontSize'),
    fontStyle: _('labelFontStyle'),
    fontWeight: _('labelFontWeight'),
    limit: vega_parser_module_value(spec.labelLimit, config.gradientLabelLimit)
  });

  if (vertical) {
    enter.align = {
      value: 'left'
    };
    enter.baseline = update.baseline = {
      signal: baselineExpr
    };
    u = 'y';
    v = 'x';
    adjust = '1-';
  } else {
    enter.align = update.align = {
      signal: alignExpr
    };
    enter.baseline = {
      value: 'top'
    };
    u = 'x';
    v = 'y';
  }

  enter[u] = update[u] = {
    signal: adjust + 'datum.' + Perc,
    mult: length
  };
  enter[v] = update[v] = thickness;
  thickness.offset = vega_parser_module_value(spec.labelOffset, config.gradientLabelOffset) || 0;
  overlap = overlap ? {
    separation: _('labelSeparation'),
    method: overlap,
    order: 'datum.' + Index
  } : undefined; // type, role, style, key, dataRef, encode, extras

  return guideMark({
    type: TextMark,
    role: LegendLabelRole,
    style: GuideLabelStyle,
    key: Value,
    from: dataRef,
    encode,
    overlap
  }, userEncode);
}

function legendSymbolGroups (spec, config, userEncode, dataRef, columns) {
  const _ = vega_parser_module_lookup(spec, config),
        entries = userEncode.entries,
        interactive = !!(entries && entries.interactive),
        name = entries ? entries.name : undefined,
        height = _('clipHeight'),
        symbolOffset = _('symbolOffset'),
        valueRef = {
    data: 'value'
  },
        xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`,
        yEncode = height ? encoder(height) : {
    field: Size
  },
        index = `datum.${Index}`,
        ncols = `max(1, ${columns})`;

  let encode, enter, update, nrows, sort;
  yEncode.mult = 0.5; // -- LEGEND SYMBOLS --

  encode = {
    enter: enter = {
      opacity: vega_parser_module_zero,
      x: {
        signal: xSignal,
        mult: 0.5,
        offset: symbolOffset
      },
      y: yEncode
    },
    update: update = {
      opacity: vega_parser_module_one,
      x: enter.x,
      y: enter.y
    },
    exit: {
      opacity: vega_parser_module_zero
    }
  };
  let baseFill = null,
      baseStroke = null;

  if (!spec.fill) {
    baseFill = config.symbolBaseFillColor;
    baseStroke = config.symbolBaseStrokeColor;
  }

  addEncoders(encode, {
    fill: _('symbolFillColor', baseFill),
    shape: _('symbolType'),
    size: _('symbolSize'),
    stroke: _('symbolStrokeColor', baseStroke),
    strokeDash: _('symbolDash'),
    strokeDashOffset: _('symbolDashOffset'),
    strokeWidth: _('symbolStrokeWidth')
  }, {
    // update
    opacity: _('symbolOpacity')
  });
  LegendScales.forEach(scale => {
    if (spec[scale]) {
      update[scale] = enter[scale] = {
        scale: spec[scale],
        field: Value
      };
    }
  });
  const symbols = guideMark({
    type: SymbolMark,
    role: LegendSymbolRole,
    key: Value,
    from: valueRef,
    clip: height ? true : undefined,
    encode
  }, userEncode.symbols); // -- LEGEND LABELS --

  const labelOffset = encoder(symbolOffset);
  labelOffset.offset = _('labelOffset');
  encode = {
    enter: enter = {
      opacity: vega_parser_module_zero,
      x: {
        signal: xSignal,
        offset: labelOffset
      },
      y: yEncode
    },
    update: update = {
      opacity: vega_parser_module_one,
      text: {
        field: vega_parser_module_Label
      },
      x: enter.x,
      y: enter.y
    },
    exit: {
      opacity: vega_parser_module_zero
    }
  };
  addEncoders(encode, {
    align: _('labelAlign'),
    baseline: _('labelBaseline'),
    fill: _('labelColor'),
    fillOpacity: _('labelOpacity'),
    font: _('labelFont'),
    fontSize: _('labelFontSize'),
    fontStyle: _('labelFontStyle'),
    fontWeight: _('labelFontWeight'),
    limit: _('labelLimit')
  });
  const labels = guideMark({
    type: TextMark,
    role: LegendLabelRole,
    style: GuideLabelStyle,
    key: Value,
    from: valueRef,
    encode
  }, userEncode.labels); // -- LEGEND ENTRY GROUPS --

  encode = {
    enter: {
      noBound: {
        value: !height
      },
      // ignore width/height in bounds calc
      width: vega_parser_module_zero,
      height: height ? encoder(height) : vega_parser_module_zero,
      opacity: vega_parser_module_zero
    },
    exit: {
      opacity: vega_parser_module_zero
    },
    update: update = {
      opacity: vega_parser_module_one,
      row: {
        signal: null
      },
      column: {
        signal: null
      }
    }
  }; // annotate and sort groups to ensure correct ordering

  if (_.isVertical(true)) {
    nrows = `ceil(item.mark.items.length / ${ncols})`;
    update.row.signal = `${index}%${nrows}`;
    update.column.signal = `floor(${index} / ${nrows})`;
    sort = {
      field: ['row', index]
    };
  } else {
    update.row.signal = `floor(${index} / ${ncols})`;
    update.column.signal = `${index} % ${ncols}`;
    sort = {
      field: index
    };
  } // handle zero column case (implies infinite columns)


  update.column.signal = `(${columns})?${update.column.signal}:${index}`; // facet legend entries into sub-groups

  dataRef = {
    facet: {
      data: dataRef,
      name: 'value',
      groupby: Index
    }
  };
  return guideGroup({
    role: vega_parser_module_ScopeRole,
    from: dataRef,
    encode: extendEncode(encode, entries, vega_parser_module_Skip),
    marks: [symbols, labels],
    name,
    interactive,
    sort
  });
}
function legendSymbolLayout(spec, config) {
  const _ = vega_parser_module_lookup(spec, config); // layout parameters for legend entries


  return {
    align: _('gridAlign'),
    columns: _.entryColumns(),
    center: {
      row: true,
      column: false
    },
    padding: {
      row: _('rowPadding'),
      column: _('columnPadding')
    }
  };
}

const isL = 'item.orient === "left"',
      isR = 'item.orient === "right"',
      isLR = `(${isL} || ${isR})`,
      isVG = `datum.vgrad && ${isLR}`,
      vega_parser_module_baseline = anchorExpr('"top"', '"bottom"', '"middle"'),
      alignFlip = anchorExpr('"right"', '"left"', '"center"'),
      exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`,
      exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`,
      exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`,
      exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${vega_parser_module_baseline}) : "top"`;
function legendTitle (spec, config, userEncode, dataRef) {
  const _ = vega_parser_module_lookup(spec, config);

  const encode = {
    enter: {
      opacity: vega_parser_module_zero
    },
    update: {
      opacity: vega_parser_module_one,
      x: {
        field: {
          group: 'padding'
        }
      },
      y: {
        field: {
          group: 'padding'
        }
      }
    },
    exit: {
      opacity: vega_parser_module_zero
    }
  };
  addEncoders(encode, {
    orient: _('titleOrient'),
    _anchor: _('titleAnchor'),
    anchor: {
      signal: exprAnchor
    },
    angle: {
      signal: exprAngle
    },
    align: {
      signal: exprAlign
    },
    baseline: {
      signal: exprBaseline
    },
    text: spec.title,
    fill: _('titleColor'),
    fillOpacity: _('titleOpacity'),
    font: _('titleFont'),
    fontSize: _('titleFontSize'),
    fontStyle: _('titleFontStyle'),
    fontWeight: _('titleFontWeight'),
    limit: _('titleLimit'),
    lineHeight: _('titleLineHeight')
  }, {
    // require update
    align: _('titleAlign'),
    baseline: _('titleBaseline')
  });
  return guideMark({
    type: TextMark,
    role: LegendTitleRole,
    style: GuideTitleStyle,
    from: dataRef,
    encode
  }, userEncode);
}

function vega_parser_module_clip (clip, scope) {
  let expr;

  if (Object(vega_util_module["H" /* isObject */])(clip)) {
    if (clip.signal) {
      expr = clip.signal;
    } else if (clip.path) {
      expr = 'pathShape(' + vega_parser_module_param(clip.path) + ')';
    } else if (clip.sphere) {
      expr = 'geoShape(' + vega_parser_module_param(clip.sphere) + ', {type: "Sphere"})';
    }
  }

  return expr ? scope.signalRef(expr) : !!clip;
}

function vega_parser_module_param(value) {
  return Object(vega_util_module["H" /* isObject */])(value) && value.signal ? value.signal : Object(vega_util_module["bb" /* stringValue */])(value);
}

function getRole (spec) {
  const role = spec.role || '';
  return !role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title') ? role : spec.type === GroupMark ? vega_parser_module_ScopeRole : role || MarkRole;
}

function vega_parser_module_definition (spec) {
  return {
    marktype: spec.type,
    name: spec.name || undefined,
    role: spec.role || getRole(spec),
    zindex: +spec.zindex || undefined,
    aria: spec.aria,
    description: spec.description
  };
}

function vega_parser_module_interactive (spec, scope) {
  return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true;
}

/**
 * Parse a data transform specification.
 */

function parseTransform (spec, scope) {
  const def = vega_dataflow_module_definition(spec.type);
  if (!def) Object(vega_util_module["o" /* error */])('Unrecognized transform type: ' + Object(vega_util_module["bb" /* stringValue */])(spec.type));
  const t = vega_parser_module_entry(def.type.toLowerCase(), null, vega_parser_module_parseParameters(def, spec, scope));
  if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t));
  t.metadata = def.metadata || {};
  return t;
}
/**
 * Parse all parameters of a data transform.
 */

function vega_parser_module_parseParameters(def, spec, scope) {
  const params = {},
        n = def.params.length;

  for (let i = 0; i < n; ++i) {
    const pdef = def.params[i];
    params[pdef.name] = vega_parser_module_parseParameter(pdef, spec, scope);
  }

  return params;
}
/**
 * Parse a data transform parameter.
 */


function vega_parser_module_parseParameter(def, spec, scope) {
  const type = def.type,
        value = spec[def.name];

  if (type === 'index') {
    return parseIndexParameter(def, spec, scope);
  } else if (value === undefined) {
    if (def.required) {
      Object(vega_util_module["o" /* error */])('Missing required ' + Object(vega_util_module["bb" /* stringValue */])(spec.type) + ' parameter: ' + Object(vega_util_module["bb" /* stringValue */])(def.name));
    }

    return;
  } else if (type === 'param') {
    return parseSubParameters(def, spec, scope);
  } else if (type === 'projection') {
    return scope.projectionRef(spec[def.name]);
  }

  return def.array && !isSignal(value) ? value.map(v => parameterValue(def, v, scope)) : parameterValue(def, value, scope);
}
/**
 * Parse a single parameter value.
 */


function parameterValue(def, value, scope) {
  const type = def.type;

  if (isSignal(value)) {
    return vega_parser_module_isExpr(type) ? Object(vega_util_module["o" /* error */])('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal);
  } else {
    const expr = def.expr || isField(type);
    return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef$1(value.field, value.as) : vega_parser_module_isExpr(type) ? vega_functions_module_parser(value, scope) : isData(type) ? vega_parser_module_ref(scope.getData(value).values) : isField(type) ? fieldRef$1(value) : isCompare(type) ? scope.compareRef(value) : value;
  }
}
/**
 * Parse parameter for accessing an index of another data set.
 */


function parseIndexParameter(def, spec, scope) {
  if (!Object(vega_util_module["J" /* isString */])(spec.from)) {
    Object(vega_util_module["o" /* error */])('Lookup "from" parameter must be a string literal.');
  }

  return scope.getData(spec.from).lookupRef(scope, spec.key);
}
/**
 * Parse a parameter that contains one or more sub-parameter objects.
 */


function parseSubParameters(def, spec, scope) {
  const value = spec[def.name];

  if (def.array) {
    if (!Object(vega_util_module["B" /* isArray */])(value)) {
      // signals not allowed!
      Object(vega_util_module["o" /* error */])('Expected an array of sub-parameters. Instead: ' + Object(vega_util_module["bb" /* stringValue */])(value));
    }

    return value.map(v => parseSubParameter(def, v, scope));
  } else {
    return parseSubParameter(def, value, scope);
  }
}
/**
 * Parse a sub-parameter object.
 */


function parseSubParameter(def, value, scope) {
  const n = def.params.length;
  let pdef; // loop over defs to find matching key

  for (let i = 0; i < n; ++i) {
    pdef = def.params[i];

    for (const k in pdef.key) {
      if (pdef.key[k] !== value[k]) {
        pdef = null;
        break;
      }
    }

    if (pdef) break;
  } // raise error if matching key not found


  if (!pdef) Object(vega_util_module["o" /* error */])('Unsupported parameter: ' + Object(vega_util_module["bb" /* stringValue */])(value)); // parse params, create Params transform, return ref

  const params = Object(vega_util_module["p" /* extend */])(vega_parser_module_parseParameters(pdef, value, scope), pdef.key);
  return vega_parser_module_ref(scope.add(vega_parser_module_Params(params)));
} // -- Utilities -----


const outerExpr = _ => _ && _.expr;
const outerField = _ => _ && _.field;
const isData = _ => _ === 'data';
const vega_parser_module_isExpr = _ => _ === 'expr';
const isField = _ => _ === 'field';
const isCompare = _ => _ === 'compare';

function parseData$1 (from, group, scope) {
  let facet, key, op, dataRef, parent; // if no source data, generate singleton datum

  if (!from) {
    dataRef = vega_parser_module_ref(scope.add(vega_parser_module_Collect(null, [{}])));
  } // if faceted, process facet specification
  else if (facet = from.facet) {
    if (!group) Object(vega_util_module["o" /* error */])('Only group marks can be faceted.'); // use pre-faceted source data, if available

    if (facet.field != null) {
      dataRef = parent = getDataRef(facet, scope);
    } else {
      // generate facet aggregates if no direct data specification
      if (!from.data) {
        op = parseTransform(Object(vega_util_module["p" /* extend */])({
          type: 'aggregate',
          groupby: Object(vega_util_module["i" /* array */])(facet.groupby)
        }, facet.aggregate), scope);
        op.params.key = scope.keyRef(facet.groupby);
        op.params.pulse = getDataRef(facet, scope);
        dataRef = parent = vega_parser_module_ref(scope.add(op));
      } else {
        parent = vega_parser_module_ref(scope.getData(from.data).aggregate);
      }

      key = scope.keyRef(facet.groupby, true);
    }
  } // if not yet defined, get source data reference


  if (!dataRef) {
    dataRef = getDataRef(from, scope);
  }

  return {
    key: key,
    pulse: dataRef,
    parent: parent
  };
}
function getDataRef(from, scope) {
  return from.$ref ? from : from.data && from.data.$ref ? from.data : vega_parser_module_ref(scope.getData(from.data).output);
}

function DataScope(scope, input, output, values, aggr) {
  this.scope = scope; // parent scope object

  this.input = input; // first operator in pipeline (tuple input)

  this.output = output; // last operator in pipeline (tuple output)

  this.values = values; // operator for accessing tuples (but not tuple flow)
  // last aggregate in transform pipeline

  this.aggregate = aggr; // lookup table of field indices

  this.index = {};
}

DataScope.fromEntries = function (scope, entries) {
  const n = entries.length,
        values = entries[n - 1],
        output = entries[n - 2];
  let input = entries[0],
      aggr = null,
      i = 1;

  if (input && input.type === 'load') {
    input = entries[1];
  } // add operator entries to this scope, wire up pulse chain


  scope.add(entries[0]);

  for (; i < n; ++i) {
    entries[i].params.pulse = vega_parser_module_ref(entries[i - 1]);
    scope.add(entries[i]);
    if (entries[i].type === 'aggregate') aggr = entries[i];
  }

  return new DataScope(scope, input, output, values, aggr);
};

function fieldKey(field) {
  return Object(vega_util_module["J" /* isString */])(field) ? field : null;
}

function addSortField(scope, p, sort) {
  const as = aggrField(sort.op, sort.field);
  let s;

  if (p.ops) {
    for (let i = 0, n = p.as.length; i < n; ++i) {
      if (p.as[i] === as) return;
    }
  } else {
    p.ops = ['count'];
    p.fields = [null];
    p.as = ['count'];
  }

  if (sort.op) {
    p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op);
    p.fields.push(scope.fieldRef(sort.field));
    p.as.push(as);
  }
}

function vega_parser_module_cache(scope, ds, name, optype, field, counts, index) {
  const cache = ds[name] || (ds[name] = {}),
        sort = sortKey(counts);
  let k = fieldKey(field),
      v,
      op;

  if (k != null) {
    scope = ds.scope;
    k = k + (sort ? '|' + sort : '');
    v = cache[k];
  }

  if (!v) {
    const params = counts ? {
      field: keyFieldRef,
      pulse: ds.countsRef(scope, field, counts)
    } : {
      field: scope.fieldRef(field),
      pulse: vega_parser_module_ref(ds.output)
    };
    if (sort) params.sort = scope.sortRef(counts);
    op = scope.add(vega_parser_module_entry(optype, undefined, params));
    if (index) ds.index[field] = op;
    v = vega_parser_module_ref(op);
    if (k != null) cache[k] = v;
  }

  return v;
}

DataScope.prototype = {
  countsRef(scope, field, sort) {
    const ds = this,
          cache = ds.counts || (ds.counts = {}),
          k = fieldKey(field);
    let v, a, p;

    if (k != null) {
      scope = ds.scope;
      v = cache[k];
    }

    if (!v) {
      p = {
        groupby: scope.fieldRef(field, 'key'),
        pulse: vega_parser_module_ref(ds.output)
      };
      if (sort && sort.field) addSortField(scope, p, sort);
      a = scope.add(vega_parser_module_Aggregate(p));
      v = scope.add(vega_parser_module_Collect({
        pulse: vega_parser_module_ref(a)
      }));
      v = {
        agg: a,
        ref: vega_parser_module_ref(v)
      };
      if (k != null) cache[k] = v;
    } else if (sort && sort.field) {
      addSortField(scope, v.agg.params, sort);
    }

    return v.ref;
  },

  tuplesRef() {
    return vega_parser_module_ref(this.values);
  },

  extentRef(scope, field) {
    return vega_parser_module_cache(scope, this, 'extent', 'extent', field, false);
  },

  domainRef(scope, field) {
    return vega_parser_module_cache(scope, this, 'domain', 'values', field, false);
  },

  valuesRef(scope, field, sort) {
    return vega_parser_module_cache(scope, this, 'vals', 'values', field, sort || true);
  },

  lookupRef(scope, field) {
    return vega_parser_module_cache(scope, this, 'lookup', 'tupleindex', field, false);
  },

  indataRef(scope, field) {
    return vega_parser_module_cache(scope, this, 'indata', 'tupleindex', field, true, true);
  }

};

function parseFacet (spec, scope, group) {
  const facet = spec.from.facet,
        name = facet.name,
        data = getDataRef(facet, scope);
  let op;

  if (!facet.name) {
    Object(vega_util_module["o" /* error */])('Facet must have a name: ' + Object(vega_util_module["bb" /* stringValue */])(facet));
  }

  if (!facet.data) {
    Object(vega_util_module["o" /* error */])('Facet must reference a data set: ' + Object(vega_util_module["bb" /* stringValue */])(facet));
  }

  if (facet.field) {
    op = scope.add(vega_parser_module_PreFacet({
      field: scope.fieldRef(facet.field),
      pulse: data
    }));
  } else if (facet.groupby) {
    op = scope.add(vega_parser_module_Facet({
      key: scope.keyRef(facet.groupby),
      group: vega_parser_module_ref(scope.proxy(group.parent)),
      pulse: data
    }));
  } else {
    Object(vega_util_module["o" /* error */])('Facet must specify groupby or field: ' + Object(vega_util_module["bb" /* stringValue */])(facet));
  } // initialize facet subscope


  const subscope = scope.fork(),
        source = subscope.add(vega_parser_module_Collect()),
        values = subscope.add(vega_parser_module_Sieve({
    pulse: vega_parser_module_ref(source)
  }));
  subscope.addData(name, new DataScope(subscope, source, source, values));
  subscope.addSignal('parent', null); // parse faceted subflow

  op.params.subflow = {
    $subflow: subscope.parse(spec).toRuntime()
  };
}

function parseSubflow (spec, scope, input) {
  const op = scope.add(vega_parser_module_PreFacet({
    pulse: input.pulse
  })),
        subscope = scope.fork();
  subscope.add(vega_parser_module_Sieve());
  subscope.addSignal('parent', null); // parse group mark subflow

  op.params.subflow = {
    $subflow: subscope.parse(spec).toRuntime()
  };
}

function parseTrigger (spec, scope, name) {
  const remove = spec.remove,
        insert = spec.insert,
        toggle = spec.toggle,
        modify = spec.modify,
        values = spec.values,
        op = scope.add(vega_parser_module_operator());
  const update = 'if(' + spec.trigger + ',modify("' + name + '",' + [insert, remove, toggle, modify, values].map(_ => _ == null ? 'null' : _).join(',') + '),0)';
  const expr = vega_functions_module_parser(update, scope);
  op.update = expr.$expr;
  op.params = expr.$params;
}

function parseMark (spec, scope) {
  const role = getRole(spec),
        group = spec.type === GroupMark,
        facet = spec.from && spec.from.facet,
        overlap = spec.overlap;
  let layout = spec.layout || role === vega_parser_module_ScopeRole || role === vega_parser_module_FrameRole,
      ops,
      op,
      store,
      enc,
      name,
      layoutRef,
      boundRef;
  const nested = role === MarkRole || layout || facet; // resolve input data

  const input = parseData$1(spec.from, group, scope); // data join to map tuples to visual items

  op = scope.add(vega_parser_module_DataJoin({
    key: input.key || (spec.key ? fieldRef$1(spec.key) : undefined),
    pulse: input.pulse,
    clean: !group
  }));
  const joinRef = vega_parser_module_ref(op); // collect visual items

  op = store = scope.add(vega_parser_module_Collect({
    pulse: joinRef
  })); // connect visual items to scenegraph

  op = scope.add(vega_parser_module_Mark({
    markdef: vega_parser_module_definition(spec),
    interactive: vega_parser_module_interactive(spec.interactive, scope),
    clip: vega_parser_module_clip(spec.clip, scope),
    context: {
      $context: true
    },
    groups: scope.lookup(),
    parent: scope.signals.parent ? scope.signalRef('parent') : null,
    index: scope.markpath(),
    pulse: vega_parser_module_ref(op)
  }));
  const markRef = vega_parser_module_ref(op); // add visual encoders

  op = enc = scope.add(vega_parser_module_Encode(parseEncode(spec.encode, spec.type, role, spec.style, scope, {
    mod: false,
    pulse: markRef
  }))); // monitor parent marks to propagate changes

  op.params.parent = scope.encode(); // add post-encoding transforms, if defined

  if (spec.transform) {
    spec.transform.forEach(_ => {
      const tx = parseTransform(_, scope),
            md = tx.metadata;

      if (md.generates || md.changes) {
        Object(vega_util_module["o" /* error */])('Mark transforms should not generate new data.');
      }

      if (!md.nomod) enc.params.mod = true; // update encode mod handling

      tx.params.pulse = vega_parser_module_ref(op);
      scope.add(op = tx);
    });
  } // if item sort specified, perform post-encoding


  if (spec.sort) {
    op = scope.add(vega_parser_module_SortItems({
      sort: scope.compareRef(spec.sort),
      pulse: vega_parser_module_ref(op)
    }));
  }

  const encodeRef = vega_parser_module_ref(op); // add view layout operator if needed

  if (facet || layout) {
    layout = scope.add(vega_parser_module_ViewLayout({
      layout: scope.objectProperty(spec.layout),
      legends: scope.legends,
      mark: markRef,
      pulse: encodeRef
    }));
    layoutRef = vega_parser_module_ref(layout);
  } // compute bounding boxes


  const bound = scope.add(vega_parser_module_Bound({
    mark: markRef,
    pulse: layoutRef || encodeRef
  }));
  boundRef = vega_parser_module_ref(bound); // if group mark, recurse to parse nested content

  if (group) {
    // juggle layout & bounds to ensure they run *after* any faceting transforms
    if (nested) {
      ops = scope.operators;
      ops.pop();
      if (layout) ops.pop();
    }

    scope.pushState(encodeRef, layoutRef || boundRef, joinRef);
    facet ? parseFacet(spec, scope, input) // explicit facet
    : nested ? parseSubflow(spec, scope, input) // standard mark group
    : scope.parse(spec); // guide group, we can avoid nested scopes

    scope.popState();

    if (nested) {
      if (layout) ops.push(layout);
      ops.push(bound);
    }
  } // if requested, add overlap removal transform


  if (overlap) {
    boundRef = parseOverlap(overlap, boundRef, scope);
  } // render / sieve items


  const render = scope.add(vega_parser_module_Render({
    pulse: boundRef
  })),
        sieve = scope.add(vega_parser_module_Sieve({
    pulse: vega_parser_module_ref(render)
  }, undefined, scope.parent())); // if mark is named, make accessible as reactive geometry
  // add trigger updates if defined

  if (spec.name != null) {
    name = spec.name;
    scope.addData(name, new DataScope(scope, store, render, sieve));
    if (spec.on) spec.on.forEach(on => {
      if (on.insert || on.remove || on.toggle) {
        Object(vega_util_module["o" /* error */])('Marks only support modify triggers.');
      }

      parseTrigger(on, scope, name);
    });
  }
}

function parseOverlap(overlap, source, scope) {
  const method = overlap.method,
        bound = overlap.bound,
        sep = overlap.separation;
  const params = {
    separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep,
    method: isSignal(method) ? scope.signalRef(method.signal) : method,
    pulse: source
  };

  if (overlap.order) {
    params.sort = scope.compareRef({
      field: overlap.order
    });
  }

  if (bound) {
    const tol = bound.tolerance;
    params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol;
    params.boundScale = scope.scaleRef(bound.scale);
    params.boundOrient = bound.orient;
  }

  return vega_parser_module_ref(scope.add(vega_parser_module_Overlap(params)));
}

function parseLegend (spec, scope) {
  const config = scope.config.legend,
        encode = spec.encode || {},
        _ = vega_parser_module_lookup(spec, config),
        legendEncode = encode.legend || {},
        name = legendEncode.name || undefined,
        interactive = legendEncode.interactive,
        style = legendEncode.style,
        scales = {};

  let scale = 0,
      entryLayout,
      params,
      children; // resolve scales and 'canonical' scale name

  LegendScales.forEach(s => spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0);
  if (!scale) Object(vega_util_module["o" /* error */])('Missing valid scale for legend.'); // resolve legend type (symbol, gradient, or discrete gradient)

  const type = vega_parser_module_legendType(spec, scope.scaleType(scale)); // single-element data source for legend group

  const datum = {
    title: spec.title != null,
    scales: scales,
    type: type,
    vgrad: type !== 'symbol' && _.isVertical()
  };
  const dataRef = vega_parser_module_ref(scope.add(vega_parser_module_Collect(null, [datum]))); // encoding properties for legend entry sub-group

  const entryEncode = {
    enter: {
      x: {
        value: 0
      },
      y: {
        value: 0
      }
    }
  }; // data source for legend values

  const entryRef = vega_parser_module_ref(scope.add(vega_parser_module_LegendEntries(params = {
    type: type,
    scale: scope.scaleRef(scale),
    count: scope.objectProperty(_('tickCount')),
    limit: scope.property(_('symbolLimit')),
    values: scope.objectProperty(spec.values),
    minstep: scope.property(spec.tickMinStep),
    formatType: scope.property(spec.formatType),
    formatSpecifier: scope.property(spec.format)
  }))); // continuous gradient legend

  if (type === vega_parser_module_Gradient) {
    children = [legendGradient(spec, scale, config, encode.gradient), legendGradientLabels(spec, config, encode.labels, entryRef)]; // adjust default tick count based on the gradient length

    params.count = params.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`);
  } // discrete gradient legend
  else if (type === vega_parser_module_Discrete) {
    children = [legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), legendGradientLabels(spec, config, encode.labels, entryRef)];
  } // symbol legend
  else {
    // determine legend symbol group layout
    entryLayout = legendSymbolLayout(spec, config);
    children = [legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns))]; // pass symbol size information to legend entry generator

    params.size = sizeExpression(spec, scope, children[0].marks);
  } // generate legend marks


  children = [guideGroup({
    role: LegendEntryRole,
    from: dataRef,
    encode: entryEncode,
    marks: children,
    layout: entryLayout,
    interactive
  })]; // include legend title if defined

  if (datum.title) {
    children.push(legendTitle(spec, config, encode.title, dataRef));
  } // parse legend specification


  return parseMark(guideGroup({
    role: vega_parser_module_LegendRole,
    from: dataRef,
    encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, vega_parser_module_Skip),
    marks: children,
    aria: _('aria'),
    description: _('description'),
    zindex: _('zindex'),
    name,
    interactive,
    style
  }), scope);
}

function vega_parser_module_legendType(spec, scaleType) {
  let type = spec.type || vega_parser_module_Symbols;

  if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) {
    type = isContinuous(scaleType) ? vega_parser_module_Gradient : isDiscretizing(scaleType) ? vega_parser_module_Discrete : vega_parser_module_Symbols;
  }

  return type !== vega_parser_module_Gradient ? type : isDiscretizing(scaleType) ? vega_parser_module_Discrete : vega_parser_module_Gradient;
}

function scaleCount(spec) {
  return LegendScales.reduce((count, type) => count + (spec[type] ? 1 : 0), 0);
}

function buildLegendEncode(_, spec, config) {
  const encode = {
    enter: {},
    update: {}
  };
  addEncoders(encode, {
    orient: _('orient'),
    offset: _('offset'),
    padding: _('padding'),
    titlePadding: _('titlePadding'),
    cornerRadius: _('cornerRadius'),
    fill: _('fillColor'),
    stroke: _('strokeColor'),
    strokeWidth: config.strokeWidth,
    strokeDash: config.strokeDash,
    x: _('legendX'),
    y: _('legendY'),
    // accessibility support
    format: spec.format,
    formatType: spec.formatType
  });
  return encode;
}

function sizeExpression(spec, scope, marks) {
  const size = deref(getChannel('size', spec, marks)),
        strokeWidth = deref(getChannel('strokeWidth', spec, marks)),
        fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle));
  return vega_functions_module_parser(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope);
}

function getChannel(name, spec, marks) {
  return spec[name] ? `scale("${spec[name]}",datum)` : getEncoding(name, marks[0].encode);
}

function getFontSize(encode, scope, style) {
  return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style);
}

const angleExpr = `item.orient==="${vega_parser_module_Left}"?-90:item.orient==="${vega_parser_module_Right}"?90:0`;
function parseTitle (spec, scope) {
  spec = Object(vega_util_module["J" /* isString */])(spec) ? {
    text: spec
  } : spec;

  const _ = vega_parser_module_lookup(spec, scope.config.title),
        encode = spec.encode || {},
        userEncode = encode.group || {},
        name = userEncode.name || undefined,
        interactive = userEncode.interactive,
        style = userEncode.style,
        children = []; // single-element data source for group title


  const datum = {},
        dataRef = vega_parser_module_ref(scope.add(vega_parser_module_Collect(null, [datum]))); // include title text

  children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); // include subtitle text

  if (spec.subtitle) {
    children.push(buildSubTitle(spec, _, encode.subtitle, dataRef));
  } // parse title specification


  return parseMark(guideGroup({
    role: vega_parser_module_TitleRole,
    from: dataRef,
    encode: groupEncode(_, userEncode),
    marks: children,
    aria: _('aria'),
    description: _('description'),
    zindex: _('zindex'),
    name,
    interactive,
    style
  }), scope);
} // provide backwards-compatibility for title custom encode;
// the top-level encode block has been *deprecated*.

function titleEncode(spec) {
  const encode = spec.encode;
  return encode && encode.title || Object(vega_util_module["p" /* extend */])({
    name: spec.name,
    interactive: spec.interactive,
    style: spec.style
  }, encode);
}

function groupEncode(_, userEncode) {
  const encode = {
    enter: {},
    update: {}
  };
  addEncoders(encode, {
    orient: _('orient'),
    anchor: _('anchor'),
    align: {
      signal: alignExpr$1
    },
    angle: {
      signal: angleExpr
    },
    limit: _('limit'),
    frame: _('frame'),
    offset: _('offset') || 0,
    padding: _('subtitlePadding')
  });
  return extendEncode(encode, userEncode, vega_parser_module_Skip);
}

function buildTitle(spec, _, userEncode, dataRef) {
  const zero = {
    value: 0
  },
        text = spec.text,
        encode = {
    enter: {
      opacity: zero
    },
    update: {
      opacity: {
        value: 1
      }
    },
    exit: {
      opacity: zero
    }
  };
  addEncoders(encode, {
    text: text,
    align: {
      signal: 'item.mark.group.align'
    },
    angle: {
      signal: 'item.mark.group.angle'
    },
    limit: {
      signal: 'item.mark.group.limit'
    },
    baseline: 'top',
    dx: _('dx'),
    dy: _('dy'),
    fill: _('color'),
    font: _('font'),
    fontSize: _('fontSize'),
    fontStyle: _('fontStyle'),
    fontWeight: _('fontWeight'),
    lineHeight: _('lineHeight')
  }, {
    // update
    align: _('align'),
    angle: _('angle'),
    baseline: _('baseline')
  });
  return guideMark({
    type: TextMark,
    role: TitleTextRole,
    style: GroupTitleStyle,
    from: dataRef,
    encode
  }, userEncode);
}

function buildSubTitle(spec, _, userEncode, dataRef) {
  const zero = {
    value: 0
  },
        text = spec.subtitle,
        encode = {
    enter: {
      opacity: zero
    },
    update: {
      opacity: {
        value: 1
      }
    },
    exit: {
      opacity: zero
    }
  };
  addEncoders(encode, {
    text: text,
    align: {
      signal: 'item.mark.group.align'
    },
    angle: {
      signal: 'item.mark.group.angle'
    },
    limit: {
      signal: 'item.mark.group.limit'
    },
    baseline: 'top',
    dx: _('dx'),
    dy: _('dy'),
    fill: _('subtitleColor'),
    font: _('subtitleFont'),
    fontSize: _('subtitleFontSize'),
    fontStyle: _('subtitleFontStyle'),
    fontWeight: _('subtitleFontWeight'),
    lineHeight: _('subtitleLineHeight')
  }, {
    // update
    align: _('align'),
    angle: _('angle'),
    baseline: _('baseline')
  });
  return guideMark({
    type: TextMark,
    role: TitleSubtitleRole,
    style: GroupSubtitleStyle,
    from: dataRef,
    encode
  }, userEncode);
}

function vega_parser_module_parseData(data, scope) {
  const transforms = [];

  if (data.transform) {
    data.transform.forEach(tx => {
      transforms.push(parseTransform(tx, scope));
    });
  }

  if (data.on) {
    data.on.forEach(on => {
      parseTrigger(on, scope, data.name);
    });
  }

  scope.addDataPipeline(data.name, analyze(data, scope, transforms));
}
/**
 * Analyze a data pipeline, add needed operators.
 */

function analyze(data, scope, ops) {
  const output = [];
  let source = null,
      modify = false,
      generate = false,
      upstream,
      i,
      n,
      t,
      m;

  if (data.values) {
    // hard-wired input data set
    if (isSignal(data.values) || vega_parser_module_hasSignal(data.format)) {
      // if either values is signal or format has signal, use dynamic loader
      output.push(load(scope, data));
      output.push(source = collect());
    } else {
      // otherwise, ingest upon dataflow init
      output.push(source = collect({
        $ingest: data.values,
        $format: data.format
      }));
    }
  } else if (data.url) {
    // load data from external source
    if (vega_parser_module_hasSignal(data.url) || vega_parser_module_hasSignal(data.format)) {
      // if either url or format has signal, use dynamic loader
      output.push(load(scope, data));
      output.push(source = collect());
    } else {
      // otherwise, request load upon dataflow init
      output.push(source = collect({
        $request: data.url,
        $format: data.format
      }));
    }
  } else if (data.source) {
    // derives from one or more other data sets
    source = upstream = Object(vega_util_module["i" /* array */])(data.source).map(d => vega_parser_module_ref(scope.getData(d).output));
    output.push(null); // populate later
  } // scan data transforms, add collectors as needed


  for (i = 0, n = ops.length; i < n; ++i) {
    t = ops[i];
    m = t.metadata;

    if (!source && !m.source) {
      output.push(source = collect());
    }

    output.push(t);
    if (m.generates) generate = true;
    if (m.modifies && !generate) modify = true;
    if (m.source) source = t;else if (m.changes) source = null;
  }

  if (upstream) {
    n = upstream.length - 1;
    output[0] = vega_parser_module_Relay({
      derive: modify,
      pulse: n ? upstream : upstream[0]
    });

    if (modify || n) {
      // collect derived and multi-pulse tuples
      output.splice(1, 0, collect());
    }
  }

  if (!source) output.push(collect());
  output.push(vega_parser_module_Sieve({}));
  return output;
}

function collect(values) {
  const s = vega_parser_module_Collect({}, values);
  s.metadata = {
    source: true
  };
  return s;
}

function load(scope, data) {
  return vega_parser_module_Load({
    url: data.url ? scope.property(data.url) : undefined,
    async: data.async ? scope.property(data.async) : undefined,
    values: data.values ? scope.property(data.values) : undefined,
    format: scope.objectProperty(data.format)
  });
}

const isX = orient => orient === vega_parser_module_Bottom || orient === vega_parser_module_Top; // get sign coefficient based on axis orient


const getSign = (orient, a, b) => isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === vega_parser_module_Left || orient === vega_parser_module_Top ? a : b; // condition on axis x-direction

const ifX = (orient, a, b) => isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b; // condition on axis y-direction

const ifY = (orient, a, b) => isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a;
const ifTop = (orient, a, b) => isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === vega_parser_module_Top ? {
  value: a
} : {
  value: b
};
const ifRight = (orient, a, b) => isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === vega_parser_module_Right ? {
  value: a
} : {
  value: b
};

const ifXEnc = ($orient, a, b) => ifEnc(`${$orient} === '${vega_parser_module_Top}' || ${$orient} === '${vega_parser_module_Bottom}'`, a, b);

const ifYEnc = ($orient, a, b) => ifEnc(`${$orient} !== '${vega_parser_module_Top}' && ${$orient} !== '${vega_parser_module_Bottom}'`, a, b);

const ifLeftTopExpr = ($orient, a, b) => ifExpr(`${$orient} === '${vega_parser_module_Left}' || ${$orient} === '${vega_parser_module_Top}'`, a, b);

const ifTopExpr = ($orient, a, b) => ifExpr(`${$orient} === '${vega_parser_module_Top}'`, a, b);

const ifRightExpr = ($orient, a, b) => ifExpr(`${$orient} === '${vega_parser_module_Right}'`, a, b);

const ifEnc = (test, a, b) => {
  // ensure inputs are encoder objects (or null)
  a = a != null ? encoder(a) : a;
  b = b != null ? encoder(b) : b;

  if (isSimple(a) && isSimple(b)) {
    // if possible generate simple signal expression
    a = a ? a.signal || Object(vega_util_module["bb" /* stringValue */])(a.value) : null;
    b = b ? b.signal || Object(vega_util_module["bb" /* stringValue */])(b.value) : null;
    return {
      signal: `${test} ? (${a}) : (${b})`
    };
  } else {
    // otherwise generate rule set
    return [Object(vega_util_module["p" /* extend */])({
      test
    }, a)].concat(b || []);
  }
};

const isSimple = enc => enc == null || Object.keys(enc).length === 1;

const ifExpr = (test, a, b) => ({
  signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})`
});

const ifOrient = ($orient, t, b, l, r) => ({
  signal: (l != null ? `${$orient} === '${vega_parser_module_Left}' ? (${toExpr(l)}) : ` : '') + (b != null ? `${$orient} === '${vega_parser_module_Bottom}' ? (${toExpr(b)}) : ` : '') + (r != null ? `${$orient} === '${vega_parser_module_Right}' ? (${toExpr(r)}) : ` : '') + (t != null ? `${$orient} === '${vega_parser_module_Top}' ? (${toExpr(t)}) : ` : '') + '(null)'
});

const toExpr = v => isSignal(v) ? v.signal : v == null ? null : Object(vega_util_module["bb" /* stringValue */])(v);

const mult = (sign, value) => value === 0 ? 0 : isSignal(sign) ? {
  signal: `(${sign.signal}) * ${value}`
} : {
  value: sign * value
};
const vega_parser_module_patch = (value, base) => {
  const s = value.signal;
  return s && s.endsWith('(null)') ? {
    signal: s.slice(0, -6) + base.signal
  } : value;
};

function fallback(prop, config, axisConfig, style) {
  let styleProp;

  if (config && Object(vega_util_module["w" /* hasOwnProperty */])(config, prop)) {
    return config[prop];
  } else if (Object(vega_util_module["w" /* hasOwnProperty */])(axisConfig, prop)) {
    return axisConfig[prop];
  } else if (prop.startsWith('title')) {
    switch (prop) {
      case 'titleColor':
        styleProp = 'fill';
        break;

      case 'titleFont':
      case 'titleFontSize':
      case 'titleFontWeight':
        styleProp = prop[5].toLowerCase() + prop.slice(6);
    }

    return style[GuideTitleStyle][styleProp];
  } else if (prop.startsWith('label')) {
    switch (prop) {
      case 'labelColor':
        styleProp = 'fill';
        break;

      case 'labelFont':
      case 'labelFontSize':
        styleProp = prop[5].toLowerCase() + prop.slice(6);
    }

    return style[GuideLabelStyle][styleProp];
  }

  return null;
}

function vega_parser_module_keys(objects) {
  const map = {};

  for (const obj of objects) {
    if (!obj) continue;

    for (const key in obj) map[key] = 1;
  }

  return Object.keys(map);
}

function vega_parser_module_axisConfig (spec, scope) {
  var config = scope.config,
      style = config.style,
      axis = config.axis,
      band = scope.scaleType(spec.scale) === 'band' && config.axisBand,
      orient = spec.orient,
      xy,
      or,
      key;

  if (isSignal(orient)) {
    const xyKeys = vega_parser_module_keys([config.axisX, config.axisY]),
          orientKeys = vega_parser_module_keys([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]);
    xy = {};

    for (key of xyKeys) {
      xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style));
    }

    or = {};

    for (key of orientKeys) {
      or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style));
    }
  } else {
    xy = orient === vega_parser_module_Top || orient === vega_parser_module_Bottom ? config.axisX : config.axisY;
    or = config['axis' + orient[0].toUpperCase() + orient.slice(1)];
  }

  const result = xy || or || band ? Object(vega_util_module["p" /* extend */])({}, axis, xy, or, band) : axis;
  return result;
}

function axisDomain (spec, config, userEncode, dataRef) {
  const _ = vega_parser_module_lookup(spec, config),
        orient = spec.orient;

  let enter, update;
  const encode = {
    enter: enter = {
      opacity: vega_parser_module_zero
    },
    update: update = {
      opacity: vega_parser_module_one
    },
    exit: {
      opacity: vega_parser_module_zero
    }
  };
  addEncoders(encode, {
    stroke: _('domainColor'),
    strokeCap: _('domainCap'),
    strokeDash: _('domainDash'),
    strokeDashOffset: _('domainDashOffset'),
    strokeWidth: _('domainWidth'),
    strokeOpacity: _('domainOpacity')
  });
  const pos0 = vega_parser_module_position(spec, 0);
  const pos1 = vega_parser_module_position(spec, 1);
  enter.x = update.x = ifX(orient, pos0, vega_parser_module_zero);
  enter.x2 = update.x2 = ifX(orient, pos1);
  enter.y = update.y = ifY(orient, pos0, vega_parser_module_zero);
  enter.y2 = update.y2 = ifY(orient, pos1);
  return guideMark({
    type: RuleMark,
    role: AxisDomainRole,
    from: dataRef,
    encode
  }, userEncode);
}

function vega_parser_module_position(spec, pos) {
  return {
    scale: spec.scale,
    range: pos
  };
}

function axisGrid (spec, config, userEncode, dataRef, band) {
  const _ = vega_parser_module_lookup(spec, config),
        orient = spec.orient,
        vscale = spec.gridScale,
        sign = getSign(orient, 1, -1),
        offset = vega_parser_module_offsetValue(spec.offset, sign);

  let enter, exit, update;
  const encode = {
    enter: enter = {
      opacity: vega_parser_module_zero
    },
    update: update = {
      opacity: vega_parser_module_one
    },
    exit: exit = {
      opacity: vega_parser_module_zero
    }
  };
  addEncoders(encode, {
    stroke: _('gridColor'),
    strokeCap: _('gridCap'),
    strokeDash: _('gridDash'),
    strokeDashOffset: _('gridDashOffset'),
    strokeOpacity: _('gridOpacity'),
    strokeWidth: _('gridWidth')
  });
  const tickPos = {
    scale: spec.scale,
    field: Value,
    band: band.band,
    extra: band.extra,
    offset: band.offset,
    round: _('tickRound')
  };
  const sz = ifX(orient, {
    signal: 'height'
  }, {
    signal: 'width'
  });
  const gridStart = vscale ? {
    scale: vscale,
    range: 0,
    mult: sign,
    offset: offset
  } : {
    value: 0,
    offset: offset
  };
  const gridEnd = vscale ? {
    scale: vscale,
    range: 1,
    mult: sign,
    offset: offset
  } : Object(vega_util_module["p" /* extend */])(sz, {
    mult: sign,
    offset: offset
  });
  enter.x = update.x = ifX(orient, tickPos, gridStart);
  enter.y = update.y = ifY(orient, tickPos, gridStart);
  enter.x2 = update.x2 = ifY(orient, gridEnd);
  enter.y2 = update.y2 = ifX(orient, gridEnd);
  exit.x = ifX(orient, tickPos);
  exit.y = ifY(orient, tickPos);
  return guideMark({
    type: RuleMark,
    role: AxisGridRole,
    key: Value,
    from: dataRef,
    encode
  }, userEncode);
}

function vega_parser_module_offsetValue(offset, sign) {
  if (sign === 1) ; else if (!Object(vega_util_module["H" /* isObject */])(offset)) {
    offset = isSignal(sign) ? {
      signal: `(${sign.signal}) * (${offset || 0})`
    } : sign * (offset || 0);
  } else {
    let entry = offset = Object(vega_util_module["p" /* extend */])({}, offset);

    while (entry.mult != null) {
      if (!Object(vega_util_module["H" /* isObject */])(entry.mult)) {
        entry.mult = isSignal(sign) // no offset if sign === 1
        ? {
          signal: `(${entry.mult}) * (${sign.signal})`
        } : entry.mult * sign;
        return offset;
      } else {
        entry = entry.mult = Object(vega_util_module["p" /* extend */])({}, entry.mult);
      }
    }

    entry.mult = sign;
  }

  return offset;
}

function axisTicks (spec, config, userEncode, dataRef, size, band) {
  const _ = vega_parser_module_lookup(spec, config),
        orient = spec.orient,
        sign = getSign(orient, -1, 1);

  let enter, exit, update;
  const encode = {
    enter: enter = {
      opacity: vega_parser_module_zero
    },
    update: update = {
      opacity: vega_parser_module_one
    },
    exit: exit = {
      opacity: vega_parser_module_zero
    }
  };
  addEncoders(encode, {
    stroke: _('tickColor'),
    strokeCap: _('tickCap'),
    strokeDash: _('tickDash'),
    strokeDashOffset: _('tickDashOffset'),
    strokeOpacity: _('tickOpacity'),
    strokeWidth: _('tickWidth')
  });
  const tickSize = encoder(size);
  tickSize.mult = sign;
  const tickPos = {
    scale: spec.scale,
    field: Value,
    band: band.band,
    extra: band.extra,
    offset: band.offset,
    round: _('tickRound')
  };
  update.y = enter.y = ifX(orient, vega_parser_module_zero, tickPos);
  update.y2 = enter.y2 = ifX(orient, tickSize);
  exit.x = ifX(orient, tickPos);
  update.x = enter.x = ifY(orient, vega_parser_module_zero, tickPos);
  update.x2 = enter.x2 = ifY(orient, tickSize);
  exit.y = ifY(orient, tickPos);
  return guideMark({
    type: RuleMark,
    role: AxisTickRole,
    key: Value,
    from: dataRef,
    encode
  }, userEncode);
}

function flushExpr(scale, threshold, a, b, c) {
  return {
    signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')'
  };
}

function axisLabels (spec, config, userEncode, dataRef, size, band) {
  const _ = vega_parser_module_lookup(spec, config),
        orient = spec.orient,
        scale = spec.scale,
        sign = getSign(orient, -1, 1),
        flush = deref(_('labelFlush')),
        flushOffset = deref(_('labelFlushOffset')),
        labelAlign = _('labelAlign'),
        labelBaseline = _('labelBaseline');

  let flushOn = flush === 0 || !!flush,
      update;
  const tickSize = encoder(size);
  tickSize.mult = sign;
  tickSize.offset = encoder(_('labelPadding') || 0);
  tickSize.offset.mult = sign;
  const tickPos = {
    scale: scale,
    field: Value,
    band: 0.5,
    offset: extendOffset(band.offset, _('labelOffset'))
  };
  const align = ifX(orient, flushOn ? flushExpr(scale, flush, '"left"', '"right"', '"center"') : {
    value: 'center'
  }, ifRight(orient, 'left', 'right'));
  const baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : {
    value: 'middle'
  });
  const offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0);
  flushOn = flushOn && flushOffset;
  const enter = {
    opacity: vega_parser_module_zero,
    x: ifX(orient, tickPos, tickSize),
    y: ifY(orient, tickPos, tickSize)
  };
  const encode = {
    enter: enter,
    update: update = {
      opacity: vega_parser_module_one,
      text: {
        field: vega_parser_module_Label
      },
      x: enter.x,
      y: enter.y,
      align,
      baseline
    },
    exit: {
      opacity: vega_parser_module_zero,
      x: enter.x,
      y: enter.y
    }
  };
  addEncoders(encode, {
    dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null,
    dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null
  });
  addEncoders(encode, {
    angle: _('labelAngle'),
    fill: _('labelColor'),
    fillOpacity: _('labelOpacity'),
    font: _('labelFont'),
    fontSize: _('labelFontSize'),
    fontWeight: _('labelFontWeight'),
    fontStyle: _('labelFontStyle'),
    limit: _('labelLimit'),
    lineHeight: _('labelLineHeight')
  }, {
    align: labelAlign,
    baseline: labelBaseline
  });

  const bound = _('labelBound');

  let overlap = _('labelOverlap'); // if overlap method or bound defined, request label overlap removal


  overlap = overlap || bound ? {
    separation: _('labelSeparation'),
    method: overlap,
    order: 'datum.index',
    bound: bound ? {
      scale,
      orient,
      tolerance: bound
    } : null
  } : undefined;

  if (update.align !== align) {
    update.align = vega_parser_module_patch(update.align, align);
  }

  if (update.baseline !== baseline) {
    update.baseline = vega_parser_module_patch(update.baseline, baseline);
  }

  return guideMark({
    type: TextMark,
    role: AxisLabelRole,
    style: GuideLabelStyle,
    key: Value,
    from: dataRef,
    encode,
    overlap
  }, userEncode);
}

function axisTitle (spec, config, userEncode, dataRef) {
  const _ = vega_parser_module_lookup(spec, config),
        orient = spec.orient,
        sign = getSign(orient, -1, 1);

  let enter, update;
  const encode = {
    enter: enter = {
      opacity: vega_parser_module_zero,
      anchor: encoder(_('titleAnchor', null)),
      align: {
        signal: alignExpr$1
      }
    },
    update: update = Object(vega_util_module["p" /* extend */])({}, enter, {
      opacity: vega_parser_module_one,
      text: encoder(spec.title)
    }),
    exit: {
      opacity: vega_parser_module_zero
    }
  };
  const titlePos = {
    signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})`
  };
  update.x = ifX(orient, titlePos);
  update.y = ifY(orient, titlePos);
  enter.angle = ifX(orient, vega_parser_module_zero, mult(sign, 90));
  enter.baseline = ifX(orient, ifTop(orient, vega_parser_module_Bottom, vega_parser_module_Top), {
    value: vega_parser_module_Bottom
  });
  update.angle = enter.angle;
  update.baseline = enter.baseline;
  addEncoders(encode, {
    fill: _('titleColor'),
    fillOpacity: _('titleOpacity'),
    font: _('titleFont'),
    fontSize: _('titleFontSize'),
    fontStyle: _('titleFontStyle'),
    fontWeight: _('titleFontWeight'),
    limit: _('titleLimit'),
    lineHeight: _('titleLineHeight')
  }, {
    // require update
    align: _('titleAlign'),
    angle: _('titleAngle'),
    baseline: _('titleBaseline')
  });
  autoLayout(_, orient, encode, userEncode);
  encode.update.align = vega_parser_module_patch(encode.update.align, enter.align);
  encode.update.angle = vega_parser_module_patch(encode.update.angle, enter.angle);
  encode.update.baseline = vega_parser_module_patch(encode.update.baseline, enter.baseline);
  return guideMark({
    type: TextMark,
    role: AxisTitleRole,
    style: GuideTitleStyle,
    from: dataRef,
    encode
  }, userEncode);
}

function autoLayout(_, orient, encode, userEncode) {
  const auto = (value, dim) => value != null ? (encode.update[dim] = vega_parser_module_patch(encoder(value), encode.update[dim]), false) : !vega_parser_module_has(dim, userEncode) ? true : false;

  const autoY = auto(_('titleX'), 'x'),
        autoX = auto(_('titleY'), 'y');
  encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY));
}

function parseAxis (spec, scope) {
  const config = vega_parser_module_axisConfig(spec, scope),
        encode = spec.encode || {},
        axisEncode = encode.axis || {},
        name = axisEncode.name || undefined,
        interactive = axisEncode.interactive,
        style = axisEncode.style,
        _ = vega_parser_module_lookup(spec, config),
        band = tickBand(_); // single-element data source for axis group


  const datum = {
    scale: spec.scale,
    ticks: !!_('ticks'),
    labels: !!_('labels'),
    grid: !!_('grid'),
    domain: !!_('domain'),
    title: spec.title != null
  };
  const dataRef = vega_parser_module_ref(scope.add(vega_parser_module_Collect({}, [datum]))); // data source for axis ticks

  const ticksRef = vega_parser_module_ref(scope.add(vega_parser_module_AxisTicks({
    scale: scope.scaleRef(spec.scale),
    extra: scope.property(band.extra),
    count: scope.objectProperty(spec.tickCount),
    values: scope.objectProperty(spec.values),
    minstep: scope.property(spec.tickMinStep),
    formatType: scope.property(spec.formatType),
    formatSpecifier: scope.property(spec.format)
  }))); // generate axis marks

  const children = [];
  let size; // include axis gridlines if requested

  if (datum.grid) {
    children.push(axisGrid(spec, config, encode.grid, ticksRef, band));
  } // include axis ticks if requested


  if (datum.ticks) {
    size = _('tickSize');
    children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band));
  } // include axis labels if requested


  if (datum.labels) {
    size = datum.ticks ? size : 0;
    children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band));
  } // include axis domain path if requested


  if (datum.domain) {
    children.push(axisDomain(spec, config, encode.domain, dataRef));
  } // include axis title if defined


  if (datum.title) {
    children.push(axisTitle(spec, config, encode.title, dataRef));
  } // parse axis specification


  return parseMark(guideGroup({
    role: vega_parser_module_AxisRole,
    from: dataRef,
    encode: extendEncode(buildAxisEncode(_, spec), axisEncode, vega_parser_module_Skip),
    marks: children,
    aria: _('aria'),
    description: _('description'),
    zindex: _('zindex'),
    name,
    interactive,
    style
  }), scope);
}

function buildAxisEncode(_, spec) {
  const encode = {
    enter: {},
    update: {}
  };
  addEncoders(encode, {
    orient: _('orient'),
    offset: _('offset') || 0,
    position: vega_parser_module_value(spec.position, 0),
    titlePadding: _('titlePadding'),
    minExtent: _('minExtent'),
    maxExtent: _('maxExtent'),
    range: {
      signal: `abs(span(range("${spec.scale}")))`
    },
    translate: _('translate'),
    // accessibility support
    format: spec.format,
    formatType: spec.formatType
  });
  return encode;
}

function parseScope (spec, scope, preprocessed) {
  const signals = Object(vega_util_module["i" /* array */])(spec.signals),
        scales = Object(vega_util_module["i" /* array */])(spec.scales); // parse signal definitions, if not already preprocessed

  if (!preprocessed) signals.forEach(_ => parseSignal(_, scope)); // parse cartographic projection definitions

  Object(vega_util_module["i" /* array */])(spec.projections).forEach(_ => vega_parser_module_parseProjection(_, scope)); // initialize scale references

  scales.forEach(_ => initScale(_, scope)); // parse data sources

  Object(vega_util_module["i" /* array */])(spec.data).forEach(_ => vega_parser_module_parseData(_, scope)); // parse scale definitions

  scales.forEach(_ => vega_parser_module_parseScale(_, scope)); // parse signal updates

  (preprocessed || signals).forEach(_ => parseSignalUpdates(_, scope)); // parse axis definitions

  Object(vega_util_module["i" /* array */])(spec.axes).forEach(_ => parseAxis(_, scope)); // parse mark definitions

  Object(vega_util_module["i" /* array */])(spec.marks).forEach(_ => parseMark(_, scope)); // parse legend definitions

  Object(vega_util_module["i" /* array */])(spec.legends).forEach(_ => parseLegend(_, scope)); // parse title, if defined

  if (spec.title) parseTitle(spec.title, scope); // parse collected lambda (anonymous) expressions

  scope.parseLambdas();
  return scope;
}

const rootEncode = spec => extendEncode({
  enter: {
    x: {
      value: 0
    },
    y: {
      value: 0
    }
  },
  update: {
    width: {
      signal: 'width'
    },
    height: {
      signal: 'height'
    }
  }
}, spec);

function parseView(spec, scope) {
  const config = scope.config; // add scenegraph root

  const root = vega_parser_module_ref(scope.root = scope.add(vega_parser_module_operator())); // parse top-level signal definitions

  const signals = collectSignals(spec, config);
  signals.forEach(_ => parseSignal(_, scope)); // assign description, event, legend, and locale configuration

  scope.description = spec.description || config.description;
  scope.eventConfig = config.events;
  scope.legends = scope.objectProperty(config.legend && config.legend.layout);
  scope.locale = config.locale; // store root group item

  const input = scope.add(vega_parser_module_Collect()); // encode root group item

  const encode = scope.add(vega_parser_module_Encode(parseEncode(rootEncode(spec.encode), GroupMark, vega_parser_module_FrameRole, spec.style, scope, {
    pulse: vega_parser_module_ref(input)
  }))); // perform view layout

  const parent = scope.add(vega_parser_module_ViewLayout({
    layout: scope.objectProperty(spec.layout),
    legends: scope.legends,
    autosize: scope.signalRef('autosize'),
    mark: root,
    pulse: vega_parser_module_ref(encode)
  }));
  scope.operators.pop(); // parse remainder of specification

  scope.pushState(vega_parser_module_ref(encode), vega_parser_module_ref(parent), null);
  parseScope(spec, scope, signals);
  scope.operators.push(parent); // bound / render / sieve root item

  let op = scope.add(vega_parser_module_Bound({
    mark: root,
    pulse: vega_parser_module_ref(parent)
  }));
  op = scope.add(vega_parser_module_Render({
    pulse: vega_parser_module_ref(op)
  }));
  op = scope.add(vega_parser_module_Sieve({
    pulse: vega_parser_module_ref(op)
  })); // track metadata for root item

  scope.addData('root', new DataScope(scope, input, input, op));
  return scope;
}

function signalObject(name, value) {
  return value && value.signal ? {
    name,
    update: value.signal
  } : {
    name,
    value
  };
}
/**
 * Collect top-level signals, merging values as needed. Signals
 * defined in the config signals arrays are added only if that
 * signal is not explicitly defined in the specification.
 * Built-in signals (autosize, background, padding, width, height)
 * receive special treatment. They are initialized using the
 * top-level spec property, or, if undefined in the spec, using
 * the corresponding top-level config property. If this property
 * is a signal reference object, the signal expression maps to the
 * signal 'update' property. If the spec's top-level signal array
 * contains an entry that matches a built-in signal, that entry
 * will be merged with the built-in specification, potentially
 * overwriting existing 'value' or 'update' properties.
 */


function collectSignals(spec, config) {
  const _ = name => vega_parser_module_value(spec[name], config[name]),
        signals = [signalObject('background', _('background')), signalObject('autosize', parseAutosize(_('autosize'))), signalObject('padding', parsePadding(_('padding'))), signalObject('width', _('width') || 0), signalObject('height', _('height') || 0)],
        pre = signals.reduce((p, s) => (p[s.name] = s, p), {}),
        map = {}; // add spec signal array


  Object(vega_util_module["i" /* array */])(spec.signals).forEach(s => {
    if (Object(vega_util_module["w" /* hasOwnProperty */])(pre, s.name)) {
      // merge if built-in signal
      s = Object(vega_util_module["p" /* extend */])(pre[s.name], s);
    } else {
      // otherwise add to signal list
      signals.push(s);
    }

    map[s.name] = s;
  }); // add config signal array

  Object(vega_util_module["i" /* array */])(config.signals).forEach(s => {
    if (!Object(vega_util_module["w" /* hasOwnProperty */])(map, s.name) && !Object(vega_util_module["w" /* hasOwnProperty */])(pre, s.name)) {
      // add to signal list if not already defined
      signals.push(s);
    }
  });
  return signals;
}

function Scope(config, options) {
  this.config = config || {};
  this.options = options || {};
  this.bindings = [];
  this.field = {};
  this.signals = {};
  this.lambdas = {};
  this.scales = {};
  this.events = {};
  this.data = {};
  this.streams = [];
  this.updates = [];
  this.operators = [];
  this.eventConfig = null;
  this.locale = null;
  this._id = 0;
  this._subid = 0;
  this._nextsub = [0];
  this._parent = [];
  this._encode = [];
  this._lookup = [];
  this._markpath = [];
}

function Subscope(scope) {
  this.config = scope.config;
  this.options = scope.options;
  this.legends = scope.legends;
  this.field = Object.create(scope.field);
  this.signals = Object.create(scope.signals);
  this.lambdas = Object.create(scope.lambdas);
  this.scales = Object.create(scope.scales);
  this.events = Object.create(scope.events);
  this.data = Object.create(scope.data);
  this.streams = [];
  this.updates = [];
  this.operators = [];
  this._id = 0;
  this._subid = ++scope._nextsub[0];
  this._nextsub = scope._nextsub;
  this._parent = scope._parent.slice();
  this._encode = scope._encode.slice();
  this._lookup = scope._lookup.slice();
  this._markpath = scope._markpath;
}

Scope.prototype = Subscope.prototype = {
  parse(spec) {
    return parseScope(spec, this);
  },

  fork() {
    return new Subscope(this);
  },

  isSubscope() {
    return this._subid > 0;
  },

  toRuntime() {
    this.finish();
    return {
      description: this.description,
      operators: this.operators,
      streams: this.streams,
      updates: this.updates,
      bindings: this.bindings,
      eventConfig: this.eventConfig,
      locale: this.locale
    };
  },

  id() {
    return (this._subid ? this._subid + ':' : 0) + this._id++;
  },

  add(op) {
    this.operators.push(op);
    op.id = this.id(); // if pre-registration references exist, resolve them now

    if (op.refs) {
      op.refs.forEach(ref => {
        ref.$ref = op.id;
      });
      op.refs = null;
    }

    return op;
  },

  proxy(op) {
    const vref = op instanceof Entry ? vega_parser_module_ref(op) : op;
    return this.add(vega_parser_module_Proxy({
      value: vref
    }));
  },

  addStream(stream) {
    this.streams.push(stream);
    stream.id = this.id();
    return stream;
  },

  addUpdate(update) {
    this.updates.push(update);
    return update;
  },

  // Apply metadata
  finish() {
    let name, ds; // annotate root

    if (this.root) this.root.root = true; // annotate signals

    for (name in this.signals) {
      this.signals[name].signal = name;
    } // annotate scales


    for (name in this.scales) {
      this.scales[name].scale = name;
    } // annotate data sets


    function annotate(op, name, type) {
      let data, list;

      if (op) {
        data = op.data || (op.data = {});
        list = data[name] || (data[name] = []);
        list.push(type);
      }
    }

    for (name in this.data) {
      ds = this.data[name];
      annotate(ds.input, name, 'input');
      annotate(ds.output, name, 'output');
      annotate(ds.values, name, 'values');

      for (const field in ds.index) {
        annotate(ds.index[field], name, 'index:' + field);
      }
    }

    return this;
  },

  // ----
  pushState(encode, parent, lookup) {
    this._encode.push(vega_parser_module_ref(this.add(vega_parser_module_Sieve({
      pulse: encode
    }))));

    this._parent.push(parent);

    this._lookup.push(lookup ? vega_parser_module_ref(this.proxy(lookup)) : null);

    this._markpath.push(-1);
  },

  popState() {
    this._encode.pop();

    this._parent.pop();

    this._lookup.pop();

    this._markpath.pop();
  },

  parent() {
    return Object(vega_util_module["W" /* peek */])(this._parent);
  },

  encode() {
    return Object(vega_util_module["W" /* peek */])(this._encode);
  },

  lookup() {
    return Object(vega_util_module["W" /* peek */])(this._lookup);
  },

  markpath() {
    const p = this._markpath;
    return ++p[p.length - 1];
  },

  // ----
  fieldRef(field, name) {
    if (Object(vega_util_module["J" /* isString */])(field)) return fieldRef$1(field, name);

    if (!field.signal) {
      Object(vega_util_module["o" /* error */])('Unsupported field reference: ' + Object(vega_util_module["bb" /* stringValue */])(field));
    }

    const s = field.signal;
    let f = this.field[s];

    if (!f) {
      const params = {
        name: this.signalRef(s)
      };
      if (name) params.as = name;
      this.field[s] = f = vega_parser_module_ref(this.add(vega_parser_module_Field(params)));
    }

    return f;
  },

  compareRef(cmp) {
    let signal = false;

    const check = _ => isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _;

    const fields = Object(vega_util_module["i" /* array */])(cmp.field).map(check),
          orders = Object(vega_util_module["i" /* array */])(cmp.order).map(check);
    return signal ? vega_parser_module_ref(this.add(vega_parser_module_Compare({
      fields: fields,
      orders: orders
    }))) : compareRef(fields, orders);
  },

  keyRef(fields, flat) {
    let signal = false;

    const check = _ => isSignal(_) ? (signal = true, vega_parser_module_ref(sig[_.signal])) : _;

    const sig = this.signals;
    fields = Object(vega_util_module["i" /* array */])(fields).map(check);
    return signal ? vega_parser_module_ref(this.add(vega_parser_module_Key({
      fields: fields,
      flat: flat
    }))) : keyRef(fields, flat);
  },

  sortRef(sort) {
    if (!sort) return sort; // including id ensures stable sorting

    const a = aggrField(sort.op, sort.field),
          o = sort.order || Ascending;
    return o.signal ? vega_parser_module_ref(this.add(vega_parser_module_Compare({
      fields: a,
      orders: this.signalRef(o.signal)
    }))) : compareRef(a, o);
  },

  // ----
  event(source, type) {
    const key = source + ':' + type;

    if (!this.events[key]) {
      const id = this.id();
      this.streams.push({
        id: id,
        source: source,
        type: type
      });
      this.events[key] = id;
    }

    return this.events[key];
  },

  // ----
  hasOwnSignal(name) {
    return Object(vega_util_module["w" /* hasOwnProperty */])(this.signals, name);
  },

  addSignal(name, value) {
    if (this.hasOwnSignal(name)) {
      Object(vega_util_module["o" /* error */])('Duplicate signal name: ' + Object(vega_util_module["bb" /* stringValue */])(name));
    }

    const op = value instanceof Entry ? value : this.add(vega_parser_module_operator(value));
    return this.signals[name] = op;
  },

  getSignal(name) {
    if (!this.signals[name]) {
      Object(vega_util_module["o" /* error */])('Unrecognized signal name: ' + Object(vega_util_module["bb" /* stringValue */])(name));
    }

    return this.signals[name];
  },

  signalRef(s) {
    if (this.signals[s]) {
      return vega_parser_module_ref(this.signals[s]);
    } else if (!Object(vega_util_module["w" /* hasOwnProperty */])(this.lambdas, s)) {
      this.lambdas[s] = this.add(vega_parser_module_operator(null));
    }

    return vega_parser_module_ref(this.lambdas[s]);
  },

  parseLambdas() {
    const code = Object.keys(this.lambdas);

    for (let i = 0, n = code.length; i < n; ++i) {
      const s = code[i],
            e = vega_functions_module_parser(s, this),
            op = this.lambdas[s];
      op.params = e.$params;
      op.update = e.$expr;
    }
  },

  property(spec) {
    return spec && spec.signal ? this.signalRef(spec.signal) : spec;
  },

  objectProperty(spec) {
    return !spec || !Object(vega_util_module["H" /* isObject */])(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec));
  },

  exprRef(code, name) {
    const params = {
      expr: vega_functions_module_parser(code, this)
    };
    if (name) params.expr.$name = name;
    return vega_parser_module_ref(this.add(vega_parser_module_Expression(params)));
  },

  addBinding(name, bind) {
    if (!this.bindings) {
      Object(vega_util_module["o" /* error */])('Nested signals do not support binding: ' + Object(vega_util_module["bb" /* stringValue */])(name));
    }

    this.bindings.push(Object(vega_util_module["p" /* extend */])({
      signal: name
    }, bind));
  },

  // ----
  addScaleProj(name, transform) {
    if (Object(vega_util_module["w" /* hasOwnProperty */])(this.scales, name)) {
      Object(vega_util_module["o" /* error */])('Duplicate scale or projection name: ' + Object(vega_util_module["bb" /* stringValue */])(name));
    }

    this.scales[name] = this.add(transform);
  },

  addScale(name, params) {
    this.addScaleProj(name, vega_parser_module_Scale(params));
  },

  addProjection(name, params) {
    this.addScaleProj(name, vega_parser_module_Projection(params));
  },

  getScale(name) {
    if (!this.scales[name]) {
      Object(vega_util_module["o" /* error */])('Unrecognized scale name: ' + Object(vega_util_module["bb" /* stringValue */])(name));
    }

    return this.scales[name];
  },

  scaleRef(name) {
    return vega_parser_module_ref(this.getScale(name));
  },

  scaleType(name) {
    return this.getScale(name).params.type;
  },

  projectionRef(name) {
    return this.scaleRef(name);
  },

  projectionType(name) {
    return this.scaleType(name);
  },

  // ----
  addData(name, dataScope) {
    if (Object(vega_util_module["w" /* hasOwnProperty */])(this.data, name)) {
      Object(vega_util_module["o" /* error */])('Duplicate data set name: ' + Object(vega_util_module["bb" /* stringValue */])(name));
    }

    return this.data[name] = dataScope;
  },

  getData(name) {
    if (!this.data[name]) {
      Object(vega_util_module["o" /* error */])('Undefined data set name: ' + Object(vega_util_module["bb" /* stringValue */])(name));
    }

    return this.data[name];
  },

  addDataPipeline(name, entries) {
    if (Object(vega_util_module["w" /* hasOwnProperty */])(this.data, name)) {
      Object(vega_util_module["o" /* error */])('Duplicate data set name: ' + Object(vega_util_module["bb" /* stringValue */])(name));
    }

    return this.addData(name, DataScope.fromEntries(this, entries));
  }

};

function propertyLambda(spec) {
  return (Object(vega_util_module["B" /* isArray */])(spec) ? arrayLambda : objectLambda)(spec);
}

function arrayLambda(array) {
  const n = array.length;
  let code = '[';

  for (let i = 0; i < n; ++i) {
    const value = array[i];
    code += (i > 0 ? ',' : '') + (Object(vega_util_module["H" /* isObject */])(value) ? value.signal || propertyLambda(value) : Object(vega_util_module["bb" /* stringValue */])(value));
  }

  return code + ']';
}

function objectLambda(obj) {
  let code = '{',
      i = 0,
      key,
      value;

  for (key in obj) {
    value = obj[key];
    code += (++i > 1 ? ',' : '') + Object(vega_util_module["bb" /* stringValue */])(key) + ':' + (Object(vega_util_module["H" /* isObject */])(value) ? value.signal || propertyLambda(value) : Object(vega_util_module["bb" /* stringValue */])(value));
  }

  return code + '}';
}

/**
 * Standard configuration defaults for Vega specification parsing.
 * Users can provide their own (sub-)set of these default values
 * by passing in a config object to the top-level parse method.
 */
function vega_parser_module_defaults () {
  const defaultFont = 'sans-serif',
        defaultSymbolSize = 30,
        defaultStrokeWidth = 2,
        defaultColor = '#4c78a8',
        black = '#000',
        gray = '#888',
        lightGray = '#ddd';
  return {
    // default visualization description
    description: 'Vega visualization',
    // default padding around visualization
    padding: 0,
    // default for automatic sizing; options: 'none', 'pad', 'fit'
    // or provide an object (e.g., {'type': 'pad', 'resize': true})
    autosize: 'pad',
    // default view background color
    // covers the entire view component
    background: null,
    // default event handling configuration
    // preventDefault for view-sourced event types except 'wheel'
    events: {
      defaults: {
        allow: ['wheel']
      }
    },
    // defaults for top-level group marks
    // accepts mark properties (fill, stroke, etc)
    // covers the data rectangle within group width/height
    group: null,
    // defaults for basic mark types
    // each subset accepts mark properties (fill, stroke, etc)
    mark: null,
    arc: {
      fill: defaultColor
    },
    area: {
      fill: defaultColor
    },
    image: null,
    line: {
      stroke: defaultColor,
      strokeWidth: defaultStrokeWidth
    },
    path: {
      stroke: defaultColor
    },
    rect: {
      fill: defaultColor
    },
    rule: {
      stroke: black
    },
    shape: {
      stroke: defaultColor
    },
    symbol: {
      fill: defaultColor,
      size: 64
    },
    text: {
      fill: black,
      font: defaultFont,
      fontSize: 11
    },
    trail: {
      fill: defaultColor,
      size: defaultStrokeWidth
    },
    // style definitions
    style: {
      // axis & legend labels
      'guide-label': {
        fill: black,
        font: defaultFont,
        fontSize: 10
      },
      // axis & legend titles
      'guide-title': {
        fill: black,
        font: defaultFont,
        fontSize: 11,
        fontWeight: 'bold'
      },
      // headers, including chart title
      'group-title': {
        fill: black,
        font: defaultFont,
        fontSize: 13,
        fontWeight: 'bold'
      },
      // chart subtitle
      'group-subtitle': {
        fill: black,
        font: defaultFont,
        fontSize: 12
      },
      // defaults for styled point marks in Vega-Lite
      point: {
        size: defaultSymbolSize,
        strokeWidth: defaultStrokeWidth,
        shape: 'circle'
      },
      circle: {
        size: defaultSymbolSize,
        strokeWidth: defaultStrokeWidth
      },
      square: {
        size: defaultSymbolSize,
        strokeWidth: defaultStrokeWidth,
        shape: 'square'
      },
      // defaults for styled group marks in Vega-Lite
      cell: {
        fill: 'transparent',
        stroke: lightGray
      }
    },
    // defaults for title
    title: {
      orient: 'top',
      anchor: 'middle',
      offset: 4,
      subtitlePadding: 3
    },
    // defaults for axes
    axis: {
      minExtent: 0,
      maxExtent: 200,
      bandPosition: 0.5,
      domain: true,
      domainWidth: 1,
      domainColor: gray,
      grid: false,
      gridWidth: 1,
      gridColor: lightGray,
      labels: true,
      labelAngle: 0,
      labelLimit: 180,
      labelOffset: 0,
      labelPadding: 2,
      ticks: true,
      tickColor: gray,
      tickOffset: 0,
      tickRound: true,
      tickSize: 5,
      tickWidth: 1,
      titlePadding: 4
    },
    // correction for centering bias
    axisBand: {
      tickOffset: -0.5
    },
    // defaults for cartographic projection
    projection: {
      type: 'mercator'
    },
    // defaults for legends
    legend: {
      orient: 'right',
      padding: 0,
      gridAlign: 'each',
      columnPadding: 10,
      rowPadding: 2,
      symbolDirection: 'vertical',
      gradientDirection: 'vertical',
      gradientLength: 200,
      gradientThickness: 16,
      gradientStrokeColor: lightGray,
      gradientStrokeWidth: 0,
      gradientLabelOffset: 2,
      labelAlign: 'left',
      labelBaseline: 'middle',
      labelLimit: 160,
      labelOffset: 4,
      labelOverlap: true,
      symbolLimit: 30,
      symbolType: 'circle',
      symbolSize: 100,
      symbolOffset: 0,
      symbolStrokeWidth: 1.5,
      symbolBaseFillColor: 'transparent',
      symbolBaseStrokeColor: gray,
      titleLimit: 180,
      titleOrient: 'top',
      titlePadding: 5,
      layout: {
        offset: 18,
        direction: 'horizontal',
        left: {
          direction: 'vertical'
        },
        right: {
          direction: 'vertical'
        }
      }
    },
    // defaults for scale ranges
    range: {
      category: {
        scheme: 'tableau10'
      },
      ordinal: {
        scheme: 'blues'
      },
      heatmap: {
        scheme: 'yellowgreenblue'
      },
      ramp: {
        scheme: 'blues'
      },
      diverging: {
        scheme: 'blueorange',
        extent: [1, 0]
      },
      symbol: ['circle', 'square', 'triangle-up', 'cross', 'diamond', 'triangle-right', 'triangle-down', 'triangle-left']
    }
  };
}

function vega_parser_module_parse (spec, config, options) {
  if (!Object(vega_util_module["H" /* isObject */])(spec)) {
    Object(vega_util_module["o" /* error */])('Input Vega specification must be an object.');
  }

  config = Object(vega_util_module["P" /* mergeConfig */])(vega_parser_module_defaults(), config, spec.config);
  return parseView(spec, new Scope(config, options)).toRuntime();
}



// CONCATENATED MODULE: ./node_modules/vega-expression/build/vega-expression.module.js


const build_vega_expression_module_RawCode = 'RawCode';
const build_vega_expression_module_Literal = 'Literal';
const build_vega_expression_module_Property = 'Property';
const vega_expression_build_vega_expression_module_Identifier = 'Identifier';
const build_vega_expression_module_ArrayExpression = 'ArrayExpression';
const build_vega_expression_module_BinaryExpression = 'BinaryExpression';
const vega_expression_build_vega_expression_module_CallExpression = 'CallExpression';
const build_vega_expression_module_ConditionalExpression = 'ConditionalExpression';
const build_vega_expression_module_LogicalExpression = 'LogicalExpression';
const build_vega_expression_module_MemberExpression = 'MemberExpression';
const build_vega_expression_module_ObjectExpression = 'ObjectExpression';
const build_vega_expression_module_UnaryExpression = 'UnaryExpression';
function build_vega_expression_module_ASTNode(type) {
  this.type = type;
}

build_vega_expression_module_ASTNode.prototype.visit = function (visitor) {
  let c, i, n;
  if (visitor(this)) return 1;

  for (c = vega_expression_build_vega_expression_module_children(this), i = 0, n = c.length; i < n; ++i) {
    if (c[i].visit(visitor)) return 1;
  }
};

function vega_expression_build_vega_expression_module_children(node) {
  switch (node.type) {
    case build_vega_expression_module_ArrayExpression:
      return node.elements;

    case build_vega_expression_module_BinaryExpression:
    case build_vega_expression_module_LogicalExpression:
      return [node.left, node.right];

    case vega_expression_build_vega_expression_module_CallExpression:
      return [node.callee].concat(node.arguments);

    case build_vega_expression_module_ConditionalExpression:
      return [node.test, node.consequent, node.alternate];

    case build_vega_expression_module_MemberExpression:
      return [node.object, node.property];

    case build_vega_expression_module_ObjectExpression:
      return node.properties;

    case build_vega_expression_module_Property:
      return [node.key, node.value];

    case build_vega_expression_module_UnaryExpression:
      return [node.argument];

    case vega_expression_build_vega_expression_module_Identifier:
    case build_vega_expression_module_Literal:
    case build_vega_expression_module_RawCode:
    default:
      return [];
  }
}

/*
  The following expression parser is based on Esprima (http://esprima.org/).
  Original header comment and license for Esprima is included here:

  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
  Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be>
  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
  Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
  Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
  Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
  Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
  Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var build_vega_expression_module_TokenName, vega_expression_build_vega_expression_module_source, vega_expression_build_vega_expression_module_index, vega_expression_build_vega_expression_module_length, build_vega_expression_module_lookahead;
var build_vega_expression_module_TokenBooleanLiteral = 1,
    build_vega_expression_module_TokenEOF = 2,
    build_vega_expression_module_TokenIdentifier = 3,
    build_vega_expression_module_TokenKeyword = 4,
    build_vega_expression_module_TokenNullLiteral = 5,
    build_vega_expression_module_TokenNumericLiteral = 6,
    build_vega_expression_module_TokenPunctuator = 7,
    build_vega_expression_module_TokenStringLiteral = 8,
    build_vega_expression_module_TokenRegularExpression = 9;
build_vega_expression_module_TokenName = {};
build_vega_expression_module_TokenName[build_vega_expression_module_TokenBooleanLiteral] = 'Boolean';
build_vega_expression_module_TokenName[build_vega_expression_module_TokenEOF] = '<end>';
build_vega_expression_module_TokenName[build_vega_expression_module_TokenIdentifier] = 'Identifier';
build_vega_expression_module_TokenName[build_vega_expression_module_TokenKeyword] = 'Keyword';
build_vega_expression_module_TokenName[build_vega_expression_module_TokenNullLiteral] = 'Null';
build_vega_expression_module_TokenName[build_vega_expression_module_TokenNumericLiteral] = 'Numeric';
build_vega_expression_module_TokenName[build_vega_expression_module_TokenPunctuator] = 'Punctuator';
build_vega_expression_module_TokenName[build_vega_expression_module_TokenStringLiteral] = 'String';
build_vega_expression_module_TokenName[build_vega_expression_module_TokenRegularExpression] = 'RegularExpression';
var build_vega_expression_module_SyntaxArrayExpression = 'ArrayExpression',
    build_vega_expression_module_SyntaxBinaryExpression = 'BinaryExpression',
    build_vega_expression_module_SyntaxCallExpression = 'CallExpression',
    build_vega_expression_module_SyntaxConditionalExpression = 'ConditionalExpression',
    build_vega_expression_module_SyntaxIdentifier = 'Identifier',
    build_vega_expression_module_SyntaxLiteral = 'Literal',
    build_vega_expression_module_SyntaxLogicalExpression = 'LogicalExpression',
    build_vega_expression_module_SyntaxMemberExpression = 'MemberExpression',
    build_vega_expression_module_SyntaxObjectExpression = 'ObjectExpression',
    build_vega_expression_module_SyntaxProperty = 'Property',
    build_vega_expression_module_SyntaxUnaryExpression = 'UnaryExpression'; // Error messages should be identical to V8.

var build_vega_expression_module_MessageUnexpectedToken = 'Unexpected token %0',
    build_vega_expression_module_MessageUnexpectedNumber = 'Unexpected number',
    build_vega_expression_module_MessageUnexpectedString = 'Unexpected string',
    build_vega_expression_module_MessageUnexpectedIdentifier = 'Unexpected identifier',
    build_vega_expression_module_MessageUnexpectedReserved = 'Unexpected reserved word',
    build_vega_expression_module_MessageUnexpectedEOS = 'Unexpected end of input',
    build_vega_expression_module_MessageInvalidRegExp = 'Invalid regular expression',
    build_vega_expression_module_MessageUnterminatedRegExp = 'Invalid regular expression: missing /',
    build_vega_expression_module_MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.',
    build_vega_expression_module_MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';
var build_vega_expression_module_ILLEGAL = 'ILLEGAL',
    build_vega_expression_module_DISABLED = 'Disabled.'; // See also tools/generate-unicode-regex.py.

var build_vega_expression_module_RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'),
    // eslint-disable-next-line no-misleading-character-class
build_vega_expression_module_RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); // Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.

function build_vega_expression_module_assert(condition, message) {
  /* istanbul ignore next */
  if (!condition) {
    throw new Error('ASSERT: ' + message);
  }
}

function build_vega_expression_module_isDecimalDigit(ch) {
  return ch >= 0x30 && ch <= 0x39; // 0..9
}

function build_vega_expression_module_isHexDigit(ch) {
  return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
}

function build_vega_expression_module_isOctalDigit(ch) {
  return '01234567'.indexOf(ch) >= 0;
} // 7.2 White Space


function build_vega_expression_module_isWhiteSpace(ch) {
  return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0;
} // 7.3 Line Terminators


function build_vega_expression_module_isLineTerminator(ch) {
  return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
} // 7.6 Identifier Names and Identifiers


function build_vega_expression_module_isIdentifierStart(ch) {
  return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore)
  ch >= 0x41 && ch <= 0x5A || // A..Z
  ch >= 0x61 && ch <= 0x7A || // a..z
  ch === 0x5C || // \ (backslash)
  ch >= 0x80 && build_vega_expression_module_RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));
}

function build_vega_expression_module_isIdentifierPart(ch) {
  return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore)
  ch >= 0x41 && ch <= 0x5A || // A..Z
  ch >= 0x61 && ch <= 0x7A || // a..z
  ch >= 0x30 && ch <= 0x39 || // 0..9
  ch === 0x5C || // \ (backslash)
  ch >= 0x80 && build_vega_expression_module_RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));
} // 7.6.1.1 Keywords


const build_vega_expression_module_keywords = {
  'if': 1,
  'in': 1,
  'do': 1,
  'var': 1,
  'for': 1,
  'new': 1,
  'try': 1,
  'let': 1,
  'this': 1,
  'else': 1,
  'case': 1,
  'void': 1,
  'with': 1,
  'enum': 1,
  'while': 1,
  'break': 1,
  'catch': 1,
  'throw': 1,
  'const': 1,
  'yield': 1,
  'class': 1,
  'super': 1,
  'return': 1,
  'typeof': 1,
  'delete': 1,
  'switch': 1,
  'export': 1,
  'import': 1,
  'public': 1,
  'static': 1,
  'default': 1,
  'finally': 1,
  'extends': 1,
  'package': 1,
  'private': 1,
  'function': 1,
  'continue': 1,
  'debugger': 1,
  'interface': 1,
  'protected': 1,
  'instanceof': 1,
  'implements': 1
};

function build_vega_expression_module_skipComment() {
  while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
    const ch = vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index);

    if (build_vega_expression_module_isWhiteSpace(ch) || build_vega_expression_module_isLineTerminator(ch)) {
      ++vega_expression_build_vega_expression_module_index;
    } else {
      break;
    }
  }
}

function build_vega_expression_module_scanHexEscape(prefix) {
  var i,
      len,
      ch,
      code = 0;
  len = prefix === 'u' ? 4 : 2;

  for (i = 0; i < len; ++i) {
    if (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length && build_vega_expression_module_isHexDigit(vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index])) {
      ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
      code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
    } else {
      build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
    }
  }

  return String.fromCharCode(code);
}

function build_vega_expression_module_scanUnicodeCodePointEscape() {
  var ch, code, cu1, cu2;
  ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index];
  code = 0; // At least, one hex digit is required.

  if (ch === '}') {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
  }

  while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
    ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];

    if (!build_vega_expression_module_isHexDigit(ch)) {
      break;
    }

    code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
  }

  if (code > 0x10FFFF || ch !== '}') {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
  } // UTF-16 Encoding


  if (code <= 0xFFFF) {
    return String.fromCharCode(code);
  }

  cu1 = (code - 0x10000 >> 10) + 0xD800;
  cu2 = (code - 0x10000 & 1023) + 0xDC00;
  return String.fromCharCode(cu1, cu2);
}

function build_vega_expression_module_getEscapedIdentifier() {
  var ch, id;
  ch = vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index++);
  id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.

  if (ch === 0x5C) {
    if (vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index) !== 0x75) {
      build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
    }

    ++vega_expression_build_vega_expression_module_index;
    ch = build_vega_expression_module_scanHexEscape('u');

    if (!ch || ch === '\\' || !build_vega_expression_module_isIdentifierStart(ch.charCodeAt(0))) {
      build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
    }

    id = ch;
  }

  while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
    ch = vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index);

    if (!build_vega_expression_module_isIdentifierPart(ch)) {
      break;
    }

    ++vega_expression_build_vega_expression_module_index;
    id += String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.

    if (ch === 0x5C) {
      id = id.substr(0, id.length - 1);

      if (vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index) !== 0x75) {
        build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
      }

      ++vega_expression_build_vega_expression_module_index;
      ch = build_vega_expression_module_scanHexEscape('u');

      if (!ch || ch === '\\' || !build_vega_expression_module_isIdentifierPart(ch.charCodeAt(0))) {
        build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
      }

      id += ch;
    }
  }

  return id;
}

function build_vega_expression_module_getIdentifier() {
  var start, ch;
  start = vega_expression_build_vega_expression_module_index++;

  while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
    ch = vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index);

    if (ch === 0x5C) {
      // Blackslash (U+005C) marks Unicode escape sequence.
      vega_expression_build_vega_expression_module_index = start;
      return build_vega_expression_module_getEscapedIdentifier();
    }

    if (build_vega_expression_module_isIdentifierPart(ch)) {
      ++vega_expression_build_vega_expression_module_index;
    } else {
      break;
    }
  }

  return vega_expression_build_vega_expression_module_source.slice(start, vega_expression_build_vega_expression_module_index);
}

function build_vega_expression_module_scanIdentifier() {
  var start, id, type;
  start = vega_expression_build_vega_expression_module_index; // Backslash (U+005C) starts an escaped character.

  id = vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index) === 0x5C ? build_vega_expression_module_getEscapedIdentifier() : build_vega_expression_module_getIdentifier(); // There is no keyword or literal with only one character.
  // Thus, it must be an identifier.

  if (id.length === 1) {
    type = build_vega_expression_module_TokenIdentifier;
  } else if (build_vega_expression_module_keywords.hasOwnProperty(id)) {
    // eslint-disable-line no-prototype-builtins
    type = build_vega_expression_module_TokenKeyword;
  } else if (id === 'null') {
    type = build_vega_expression_module_TokenNullLiteral;
  } else if (id === 'true' || id === 'false') {
    type = build_vega_expression_module_TokenBooleanLiteral;
  } else {
    type = build_vega_expression_module_TokenIdentifier;
  }

  return {
    type: type,
    value: id,
    start: start,
    end: vega_expression_build_vega_expression_module_index
  };
} // 7.7 Punctuators


function build_vega_expression_module_scanPunctuator() {
  var start = vega_expression_build_vega_expression_module_index,
      code = vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index),
      code2,
      ch1 = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index],
      ch2,
      ch3,
      ch4;

  switch (code) {
    // Check for most common single-character punctuators.
    case 0x2E: // . dot

    case 0x28: // ( open bracket

    case 0x29: // ) close bracket

    case 0x3B: // ; semicolon

    case 0x2C: // , comma

    case 0x7B: // { open curly brace

    case 0x7D: // } close curly brace

    case 0x5B: // [

    case 0x5D: // ]

    case 0x3A: // :

    case 0x3F: // ?

    case 0x7E:
      // ~
      ++vega_expression_build_vega_expression_module_index;
      return {
        type: build_vega_expression_module_TokenPunctuator,
        value: String.fromCharCode(code),
        start: start,
        end: vega_expression_build_vega_expression_module_index
      };

    default:
      code2 = vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index + 1); // '=' (U+003D) marks an assignment or comparison operator.

      if (code2 === 0x3D) {
        switch (code) {
          case 0x2B: // +

          case 0x2D: // -

          case 0x2F: // /

          case 0x3C: // <

          case 0x3E: // >

          case 0x5E: // ^

          case 0x7C: // |

          case 0x25: // %

          case 0x26: // &

          case 0x2A:
            // *
            vega_expression_build_vega_expression_module_index += 2;
            return {
              type: build_vega_expression_module_TokenPunctuator,
              value: String.fromCharCode(code) + String.fromCharCode(code2),
              start: start,
              end: vega_expression_build_vega_expression_module_index
            };

          case 0x21: // !

          case 0x3D:
            // =
            vega_expression_build_vega_expression_module_index += 2; // !== and ===

            if (vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index) === 0x3D) {
              ++vega_expression_build_vega_expression_module_index;
            }

            return {
              type: build_vega_expression_module_TokenPunctuator,
              value: vega_expression_build_vega_expression_module_source.slice(start, vega_expression_build_vega_expression_module_index),
              start: start,
              end: vega_expression_build_vega_expression_module_index
            };
        }
      }

  } // 4-character punctuator: >>>=


  ch4 = vega_expression_build_vega_expression_module_source.substr(vega_expression_build_vega_expression_module_index, 4);

  if (ch4 === '>>>=') {
    vega_expression_build_vega_expression_module_index += 4;
    return {
      type: build_vega_expression_module_TokenPunctuator,
      value: ch4,
      start: start,
      end: vega_expression_build_vega_expression_module_index
    };
  } // 3-character punctuators: === !== >>> <<= >>=


  ch3 = ch4.substr(0, 3);

  if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {
    vega_expression_build_vega_expression_module_index += 3;
    return {
      type: build_vega_expression_module_TokenPunctuator,
      value: ch3,
      start: start,
      end: vega_expression_build_vega_expression_module_index
    };
  } // Other 2-character punctuators: ++ -- << >> && ||


  ch2 = ch3.substr(0, 2);

  if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') {
    vega_expression_build_vega_expression_module_index += 2;
    return {
      type: build_vega_expression_module_TokenPunctuator,
      value: ch2,
      start: start,
      end: vega_expression_build_vega_expression_module_index
    };
  }

  if (ch2 === '//') {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
  } // 1-character punctuators: < > = ! + - * % & | ^ /


  if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
    ++vega_expression_build_vega_expression_module_index;
    return {
      type: build_vega_expression_module_TokenPunctuator,
      value: ch1,
      start: start,
      end: vega_expression_build_vega_expression_module_index
    };
  }

  build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
} // 7.8.3 Numeric Literals


function build_vega_expression_module_scanHexLiteral(start) {
  let number = '';

  while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
    if (!build_vega_expression_module_isHexDigit(vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index])) {
      break;
    }

    number += vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
  }

  if (number.length === 0) {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
  }

  if (build_vega_expression_module_isIdentifierStart(vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index))) {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
  }

  return {
    type: build_vega_expression_module_TokenNumericLiteral,
    value: parseInt('0x' + number, 16),
    start: start,
    end: vega_expression_build_vega_expression_module_index
  };
}

function build_vega_expression_module_scanOctalLiteral(start) {
  let number = '0' + vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];

  while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
    if (!build_vega_expression_module_isOctalDigit(vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index])) {
      break;
    }

    number += vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
  }

  if (build_vega_expression_module_isIdentifierStart(vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index)) || build_vega_expression_module_isDecimalDigit(vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index))) {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
  }

  return {
    type: build_vega_expression_module_TokenNumericLiteral,
    value: parseInt(number, 8),
    octal: true,
    start: start,
    end: vega_expression_build_vega_expression_module_index
  };
}

function build_vega_expression_module_scanNumericLiteral() {
  var number, start, ch;
  ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index];
  build_vega_expression_module_assert(build_vega_expression_module_isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point');
  start = vega_expression_build_vega_expression_module_index;
  number = '';

  if (ch !== '.') {
    number = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
    ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index]; // Hex number starts with '0x'.
    // Octal number starts with '0'.

    if (number === '0') {
      if (ch === 'x' || ch === 'X') {
        ++vega_expression_build_vega_expression_module_index;
        return build_vega_expression_module_scanHexLiteral(start);
      }

      if (build_vega_expression_module_isOctalDigit(ch)) {
        return build_vega_expression_module_scanOctalLiteral(start);
      } // decimal number starts with '0' such as '09' is illegal.


      if (ch && build_vega_expression_module_isDecimalDigit(ch.charCodeAt(0))) {
        build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
      }
    }

    while (build_vega_expression_module_isDecimalDigit(vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index))) {
      number += vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
    }

    ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index];
  }

  if (ch === '.') {
    number += vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];

    while (build_vega_expression_module_isDecimalDigit(vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index))) {
      number += vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
    }

    ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index];
  }

  if (ch === 'e' || ch === 'E') {
    number += vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
    ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index];

    if (ch === '+' || ch === '-') {
      number += vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
    }

    if (build_vega_expression_module_isDecimalDigit(vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index))) {
      while (build_vega_expression_module_isDecimalDigit(vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index))) {
        number += vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
      }
    } else {
      build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
    }
  }

  if (build_vega_expression_module_isIdentifierStart(vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index))) {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
  }

  return {
    type: build_vega_expression_module_TokenNumericLiteral,
    value: parseFloat(number),
    start: start,
    end: vega_expression_build_vega_expression_module_index
  };
} // 7.8.4 String Literals


function build_vega_expression_module_scanStringLiteral() {
  var str = '',
      quote,
      start,
      ch,
      code,
      octal = false;
  quote = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index];
  build_vega_expression_module_assert(quote === '\'' || quote === '"', 'String literal must starts with a quote');
  start = vega_expression_build_vega_expression_module_index;
  ++vega_expression_build_vega_expression_module_index;

  while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
    ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];

    if (ch === quote) {
      quote = '';
      break;
    } else if (ch === '\\') {
      ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];

      if (!ch || !build_vega_expression_module_isLineTerminator(ch.charCodeAt(0))) {
        switch (ch) {
          case 'u':
          case 'x':
            if (vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index] === '{') {
              ++vega_expression_build_vega_expression_module_index;
              str += build_vega_expression_module_scanUnicodeCodePointEscape();
            } else {
              str += build_vega_expression_module_scanHexEscape(ch);
            }

            break;

          case 'n':
            str += '\n';
            break;

          case 'r':
            str += '\r';
            break;

          case 't':
            str += '\t';
            break;

          case 'b':
            str += '\b';
            break;

          case 'f':
            str += '\f';
            break;

          case 'v':
            str += '\x0B';
            break;

          default:
            if (build_vega_expression_module_isOctalDigit(ch)) {
              code = '01234567'.indexOf(ch); // \0 is not octal escape sequence

              if (code !== 0) {
                octal = true;
              }

              if (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length && build_vega_expression_module_isOctalDigit(vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index])) {
                octal = true;
                code = code * 8 + '01234567'.indexOf(vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++]); // 3 digits are only allowed when string starts
                // with 0, 1, 2, 3

                if ('0123'.indexOf(ch) >= 0 && vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length && build_vega_expression_module_isOctalDigit(vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index])) {
                  code = code * 8 + '01234567'.indexOf(vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++]);
                }
              }

              str += String.fromCharCode(code);
            } else {
              str += ch;
            }

            break;
        }
      } else {
        if (ch === '\r' && vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index] === '\n') {
          ++vega_expression_build_vega_expression_module_index;
        }
      }
    } else if (build_vega_expression_module_isLineTerminator(ch.charCodeAt(0))) {
      break;
    } else {
      str += ch;
    }
  }

  if (quote !== '') {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
  }

  return {
    type: build_vega_expression_module_TokenStringLiteral,
    value: str,
    octal: octal,
    start: start,
    end: vega_expression_build_vega_expression_module_index
  };
}

function build_vega_expression_module_testRegExp(pattern, flags) {
  let tmp = pattern;

  if (flags.indexOf('u') >= 0) {
    // Replace each astral symbol and every Unicode code point
    // escape sequence with a single ASCII symbol to avoid throwing on
    // regular expressions that are only valid in combination with the
    // `/u` flag.
    // Note: replacing with the ASCII symbol `x` might cause false
    // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
    // perfectly valid pattern that is equivalent to `[a-b]`, but it
    // would be replaced by `[x-b]` which throws an error.
    tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1) => {
      if (parseInt($1, 16) <= 0x10FFFF) {
        return 'x';
      }

      build_vega_expression_module_throwError({}, build_vega_expression_module_MessageInvalidRegExp);
    }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
  } // First, detect invalid regular expressions.


  try {
    new RegExp(tmp);
  } catch (e) {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageInvalidRegExp);
  } // Return a regular expression object for this pattern-flag pair, or
  // `null` in case the current environment doesn't support the flags it
  // uses.


  try {
    return new RegExp(pattern, flags);
  } catch (exception) {
    return null;
  }
}

function build_vega_expression_module_scanRegExpBody() {
  var ch, str, classMarker, terminated, body;
  ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index];
  build_vega_expression_module_assert(ch === '/', 'Regular expression literal must start with a slash');
  str = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
  classMarker = false;
  terminated = false;

  while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
    ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++];
    str += ch;

    if (ch === '\\') {
      ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index++]; // ECMA-262 7.8.5

      if (build_vega_expression_module_isLineTerminator(ch.charCodeAt(0))) {
        build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnterminatedRegExp);
      }

      str += ch;
    } else if (build_vega_expression_module_isLineTerminator(ch.charCodeAt(0))) {
      build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnterminatedRegExp);
    } else if (classMarker) {
      if (ch === ']') {
        classMarker = false;
      }
    } else {
      if (ch === '/') {
        terminated = true;
        break;
      } else if (ch === '[') {
        classMarker = true;
      }
    }
  }

  if (!terminated) {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnterminatedRegExp);
  } // Exclude leading and trailing slash.


  body = str.substr(1, str.length - 2);
  return {
    value: body,
    literal: str
  };
}

function build_vega_expression_module_scanRegExpFlags() {
  var ch, str, flags;
  str = '';
  flags = '';

  while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
    ch = vega_expression_build_vega_expression_module_source[vega_expression_build_vega_expression_module_index];

    if (!build_vega_expression_module_isIdentifierPart(ch.charCodeAt(0))) {
      break;
    }

    ++vega_expression_build_vega_expression_module_index;

    if (ch === '\\' && vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
      build_vega_expression_module_throwError({}, build_vega_expression_module_MessageUnexpectedToken, build_vega_expression_module_ILLEGAL);
    } else {
      flags += ch;
      str += ch;
    }
  }

  if (flags.search(/[^gimuy]/g) >= 0) {
    build_vega_expression_module_throwError({}, build_vega_expression_module_MessageInvalidRegExp, flags);
  }

  return {
    value: flags,
    literal: str
  };
}

function build_vega_expression_module_scanRegExp() {
  var start, body, flags, value;
  build_vega_expression_module_lookahead = null;
  build_vega_expression_module_skipComment();
  start = vega_expression_build_vega_expression_module_index;
  body = build_vega_expression_module_scanRegExpBody();
  flags = build_vega_expression_module_scanRegExpFlags();
  value = build_vega_expression_module_testRegExp(body.value, flags.value);
  return {
    literal: body.literal + flags.literal,
    value: value,
    regex: {
      pattern: body.value,
      flags: flags.value
    },
    start: start,
    end: vega_expression_build_vega_expression_module_index
  };
}

function build_vega_expression_module_isIdentifierName(token) {
  return token.type === build_vega_expression_module_TokenIdentifier || token.type === build_vega_expression_module_TokenKeyword || token.type === build_vega_expression_module_TokenBooleanLiteral || token.type === build_vega_expression_module_TokenNullLiteral;
}

function build_vega_expression_module_advance() {
  build_vega_expression_module_skipComment();

  if (vega_expression_build_vega_expression_module_index >= vega_expression_build_vega_expression_module_length) {
    return {
      type: build_vega_expression_module_TokenEOF,
      start: vega_expression_build_vega_expression_module_index,
      end: vega_expression_build_vega_expression_module_index
    };
  }

  const ch = vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index);

  if (build_vega_expression_module_isIdentifierStart(ch)) {
    return build_vega_expression_module_scanIdentifier();
  } // Very common: ( and ) and ;


  if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {
    return build_vega_expression_module_scanPunctuator();
  } // String literal starts with single quote (U+0027) or double quote (U+0022).


  if (ch === 0x27 || ch === 0x22) {
    return build_vega_expression_module_scanStringLiteral();
  } // Dot (.) U+002E can also start a floating-point number, hence the need
  // to check the next character.


  if (ch === 0x2E) {
    if (build_vega_expression_module_isDecimalDigit(vega_expression_build_vega_expression_module_source.charCodeAt(vega_expression_build_vega_expression_module_index + 1))) {
      return build_vega_expression_module_scanNumericLiteral();
    }

    return build_vega_expression_module_scanPunctuator();
  }

  if (build_vega_expression_module_isDecimalDigit(ch)) {
    return build_vega_expression_module_scanNumericLiteral();
  }

  return build_vega_expression_module_scanPunctuator();
}

function build_vega_expression_module_lex() {
  const token = build_vega_expression_module_lookahead;
  vega_expression_build_vega_expression_module_index = token.end;
  build_vega_expression_module_lookahead = build_vega_expression_module_advance();
  vega_expression_build_vega_expression_module_index = token.end;
  return token;
}

function build_vega_expression_module_peek() {
  const pos = vega_expression_build_vega_expression_module_index;
  build_vega_expression_module_lookahead = build_vega_expression_module_advance();
  vega_expression_build_vega_expression_module_index = pos;
}

function build_vega_expression_module_finishArrayExpression(elements) {
  const node = new build_vega_expression_module_ASTNode(build_vega_expression_module_SyntaxArrayExpression);
  node.elements = elements;
  return node;
}

function build_vega_expression_module_finishBinaryExpression(operator, left, right) {
  const node = new build_vega_expression_module_ASTNode(operator === '||' || operator === '&&' ? build_vega_expression_module_SyntaxLogicalExpression : build_vega_expression_module_SyntaxBinaryExpression);
  node.operator = operator;
  node.left = left;
  node.right = right;
  return node;
}

function build_vega_expression_module_finishCallExpression(callee, args) {
  const node = new build_vega_expression_module_ASTNode(build_vega_expression_module_SyntaxCallExpression);
  node.callee = callee;
  node.arguments = args;
  return node;
}

function build_vega_expression_module_finishConditionalExpression(test, consequent, alternate) {
  const node = new build_vega_expression_module_ASTNode(build_vega_expression_module_SyntaxConditionalExpression);
  node.test = test;
  node.consequent = consequent;
  node.alternate = alternate;
  return node;
}

function build_vega_expression_module_finishIdentifier(name) {
  const node = new build_vega_expression_module_ASTNode(build_vega_expression_module_SyntaxIdentifier);
  node.name = name;
  return node;
}

function build_vega_expression_module_finishLiteral(token) {
  const node = new build_vega_expression_module_ASTNode(build_vega_expression_module_SyntaxLiteral);
  node.value = token.value;
  node.raw = vega_expression_build_vega_expression_module_source.slice(token.start, token.end);

  if (token.regex) {
    if (node.raw === '//') {
      node.raw = '/(?:)/';
    }

    node.regex = token.regex;
  }

  return node;
}

function build_vega_expression_module_finishMemberExpression(accessor, object, property) {
  const node = new build_vega_expression_module_ASTNode(build_vega_expression_module_SyntaxMemberExpression);
  node.computed = accessor === '[';
  node.object = object;
  node.property = property;
  if (!node.computed) property.member = true;
  return node;
}

function build_vega_expression_module_finishObjectExpression(properties) {
  const node = new build_vega_expression_module_ASTNode(build_vega_expression_module_SyntaxObjectExpression);
  node.properties = properties;
  return node;
}

function build_vega_expression_module_finishProperty(kind, key, value) {
  const node = new build_vega_expression_module_ASTNode(build_vega_expression_module_SyntaxProperty);
  node.key = key;
  node.value = value;
  node.kind = kind;
  return node;
}

function build_vega_expression_module_finishUnaryExpression(operator, argument) {
  const node = new build_vega_expression_module_ASTNode(build_vega_expression_module_SyntaxUnaryExpression);
  node.operator = operator;
  node.argument = argument;
  node.prefix = true;
  return node;
} // Throw an exception


function build_vega_expression_module_throwError(token, messageFormat) {
  var error,
      args = Array.prototype.slice.call(arguments, 2),
      msg = messageFormat.replace(/%(\d)/g, (whole, index) => {
    build_vega_expression_module_assert(index < args.length, 'Message reference must be in range');
    return args[index];
  });
  error = new Error(msg);
  error.index = vega_expression_build_vega_expression_module_index;
  error.description = msg;
  throw error;
} // Throw an exception because of the token.


function build_vega_expression_module_throwUnexpected(token) {
  if (token.type === build_vega_expression_module_TokenEOF) {
    build_vega_expression_module_throwError(token, build_vega_expression_module_MessageUnexpectedEOS);
  }

  if (token.type === build_vega_expression_module_TokenNumericLiteral) {
    build_vega_expression_module_throwError(token, build_vega_expression_module_MessageUnexpectedNumber);
  }

  if (token.type === build_vega_expression_module_TokenStringLiteral) {
    build_vega_expression_module_throwError(token, build_vega_expression_module_MessageUnexpectedString);
  }

  if (token.type === build_vega_expression_module_TokenIdentifier) {
    build_vega_expression_module_throwError(token, build_vega_expression_module_MessageUnexpectedIdentifier);
  }

  if (token.type === build_vega_expression_module_TokenKeyword) {
    build_vega_expression_module_throwError(token, build_vega_expression_module_MessageUnexpectedReserved);
  } // BooleanLiteral, NullLiteral, or Punctuator.


  build_vega_expression_module_throwError(token, build_vega_expression_module_MessageUnexpectedToken, token.value);
} // Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.


function build_vega_expression_module_expect(value) {
  const token = build_vega_expression_module_lex();

  if (token.type !== build_vega_expression_module_TokenPunctuator || token.value !== value) {
    build_vega_expression_module_throwUnexpected(token);
  }
} // Return true if the next token matches the specified punctuator.


function build_vega_expression_module_match(value) {
  return build_vega_expression_module_lookahead.type === build_vega_expression_module_TokenPunctuator && build_vega_expression_module_lookahead.value === value;
} // Return true if the next token matches the specified keyword


function build_vega_expression_module_matchKeyword(keyword) {
  return build_vega_expression_module_lookahead.type === build_vega_expression_module_TokenKeyword && build_vega_expression_module_lookahead.value === keyword;
} // 11.1.4 Array Initialiser


function build_vega_expression_module_parseArrayInitialiser() {
  const elements = [];
  vega_expression_build_vega_expression_module_index = build_vega_expression_module_lookahead.start;
  build_vega_expression_module_expect('[');

  while (!build_vega_expression_module_match(']')) {
    if (build_vega_expression_module_match(',')) {
      build_vega_expression_module_lex();
      elements.push(null);
    } else {
      elements.push(build_vega_expression_module_parseConditionalExpression());

      if (!build_vega_expression_module_match(']')) {
        build_vega_expression_module_expect(',');
      }
    }
  }

  build_vega_expression_module_lex();
  return build_vega_expression_module_finishArrayExpression(elements);
} // 11.1.5 Object Initialiser


function build_vega_expression_module_parseObjectPropertyKey() {
  vega_expression_build_vega_expression_module_index = build_vega_expression_module_lookahead.start;
  const token = build_vega_expression_module_lex(); // Note: This function is called only from parseObjectProperty(), where
  // EOF and Punctuator tokens are already filtered out.

  if (token.type === build_vega_expression_module_TokenStringLiteral || token.type === build_vega_expression_module_TokenNumericLiteral) {
    if (token.octal) {
      build_vega_expression_module_throwError(token, build_vega_expression_module_MessageStrictOctalLiteral);
    }

    return build_vega_expression_module_finishLiteral(token);
  }

  return build_vega_expression_module_finishIdentifier(token.value);
}

function build_vega_expression_module_parseObjectProperty() {
  var token, key, id, value;
  vega_expression_build_vega_expression_module_index = build_vega_expression_module_lookahead.start;
  token = build_vega_expression_module_lookahead;

  if (token.type === build_vega_expression_module_TokenIdentifier) {
    id = build_vega_expression_module_parseObjectPropertyKey();
    build_vega_expression_module_expect(':');
    value = build_vega_expression_module_parseConditionalExpression();
    return build_vega_expression_module_finishProperty('init', id, value);
  }

  if (token.type === build_vega_expression_module_TokenEOF || token.type === build_vega_expression_module_TokenPunctuator) {
    build_vega_expression_module_throwUnexpected(token);
  } else {
    key = build_vega_expression_module_parseObjectPropertyKey();
    build_vega_expression_module_expect(':');
    value = build_vega_expression_module_parseConditionalExpression();
    return build_vega_expression_module_finishProperty('init', key, value);
  }
}

function build_vega_expression_module_parseObjectInitialiser() {
  var properties = [],
      property,
      name,
      key,
      map = {},
      toString = String;
  vega_expression_build_vega_expression_module_index = build_vega_expression_module_lookahead.start;
  build_vega_expression_module_expect('{');

  while (!build_vega_expression_module_match('}')) {
    property = build_vega_expression_module_parseObjectProperty();

    if (property.key.type === build_vega_expression_module_SyntaxIdentifier) {
      name = property.key.name;
    } else {
      name = toString(property.key.value);
    }

    key = '$' + name;

    if (Object.prototype.hasOwnProperty.call(map, key)) {
      build_vega_expression_module_throwError({}, build_vega_expression_module_MessageStrictDuplicateProperty);
    } else {
      map[key] = true;
    }

    properties.push(property);

    if (!build_vega_expression_module_match('}')) {
      build_vega_expression_module_expect(',');
    }
  }

  build_vega_expression_module_expect('}');
  return build_vega_expression_module_finishObjectExpression(properties);
} // 11.1.6 The Grouping Operator


function build_vega_expression_module_parseGroupExpression() {
  build_vega_expression_module_expect('(');
  const expr = build_vega_expression_module_parseExpression();
  build_vega_expression_module_expect(')');
  return expr;
} // 11.1 Primary Expressions


const build_vega_expression_module_legalKeywords = {
  'if': 1
};

function build_vega_expression_module_parsePrimaryExpression() {
  var type, token, expr;

  if (build_vega_expression_module_match('(')) {
    return build_vega_expression_module_parseGroupExpression();
  }

  if (build_vega_expression_module_match('[')) {
    return build_vega_expression_module_parseArrayInitialiser();
  }

  if (build_vega_expression_module_match('{')) {
    return build_vega_expression_module_parseObjectInitialiser();
  }

  type = build_vega_expression_module_lookahead.type;
  vega_expression_build_vega_expression_module_index = build_vega_expression_module_lookahead.start;

  if (type === build_vega_expression_module_TokenIdentifier || build_vega_expression_module_legalKeywords[build_vega_expression_module_lookahead.value]) {
    expr = build_vega_expression_module_finishIdentifier(build_vega_expression_module_lex().value);
  } else if (type === build_vega_expression_module_TokenStringLiteral || type === build_vega_expression_module_TokenNumericLiteral) {
    if (build_vega_expression_module_lookahead.octal) {
      build_vega_expression_module_throwError(build_vega_expression_module_lookahead, build_vega_expression_module_MessageStrictOctalLiteral);
    }

    expr = build_vega_expression_module_finishLiteral(build_vega_expression_module_lex());
  } else if (type === build_vega_expression_module_TokenKeyword) {
    throw new Error(build_vega_expression_module_DISABLED);
  } else if (type === build_vega_expression_module_TokenBooleanLiteral) {
    token = build_vega_expression_module_lex();
    token.value = token.value === 'true';
    expr = build_vega_expression_module_finishLiteral(token);
  } else if (type === build_vega_expression_module_TokenNullLiteral) {
    token = build_vega_expression_module_lex();
    token.value = null;
    expr = build_vega_expression_module_finishLiteral(token);
  } else if (build_vega_expression_module_match('/') || build_vega_expression_module_match('/=')) {
    expr = build_vega_expression_module_finishLiteral(build_vega_expression_module_scanRegExp());
    build_vega_expression_module_peek();
  } else {
    build_vega_expression_module_throwUnexpected(build_vega_expression_module_lex());
  }

  return expr;
} // 11.2 Left-Hand-Side Expressions


function build_vega_expression_module_parseArguments() {
  const args = [];
  build_vega_expression_module_expect('(');

  if (!build_vega_expression_module_match(')')) {
    while (vega_expression_build_vega_expression_module_index < vega_expression_build_vega_expression_module_length) {
      args.push(build_vega_expression_module_parseConditionalExpression());

      if (build_vega_expression_module_match(')')) {
        break;
      }

      build_vega_expression_module_expect(',');
    }
  }

  build_vega_expression_module_expect(')');
  return args;
}

function build_vega_expression_module_parseNonComputedProperty() {
  vega_expression_build_vega_expression_module_index = build_vega_expression_module_lookahead.start;
  const token = build_vega_expression_module_lex();

  if (!build_vega_expression_module_isIdentifierName(token)) {
    build_vega_expression_module_throwUnexpected(token);
  }

  return build_vega_expression_module_finishIdentifier(token.value);
}

function build_vega_expression_module_parseNonComputedMember() {
  build_vega_expression_module_expect('.');
  return build_vega_expression_module_parseNonComputedProperty();
}

function build_vega_expression_module_parseComputedMember() {
  build_vega_expression_module_expect('[');
  const expr = build_vega_expression_module_parseExpression();
  build_vega_expression_module_expect(']');
  return expr;
}

function build_vega_expression_module_parseLeftHandSideExpressionAllowCall() {
  var expr, args, property;
  expr = build_vega_expression_module_parsePrimaryExpression();

  for (;;) {
    if (build_vega_expression_module_match('.')) {
      property = build_vega_expression_module_parseNonComputedMember();
      expr = build_vega_expression_module_finishMemberExpression('.', expr, property);
    } else if (build_vega_expression_module_match('(')) {
      args = build_vega_expression_module_parseArguments();
      expr = build_vega_expression_module_finishCallExpression(expr, args);
    } else if (build_vega_expression_module_match('[')) {
      property = build_vega_expression_module_parseComputedMember();
      expr = build_vega_expression_module_finishMemberExpression('[', expr, property);
    } else {
      break;
    }
  }

  return expr;
} // 11.3 Postfix Expressions


function build_vega_expression_module_parsePostfixExpression() {
  const expr = build_vega_expression_module_parseLeftHandSideExpressionAllowCall();

  if (build_vega_expression_module_lookahead.type === build_vega_expression_module_TokenPunctuator) {
    if (build_vega_expression_module_match('++') || build_vega_expression_module_match('--')) {
      throw new Error(build_vega_expression_module_DISABLED);
    }
  }

  return expr;
} // 11.4 Unary Operators


function build_vega_expression_module_parseUnaryExpression() {
  var token, expr;

  if (build_vega_expression_module_lookahead.type !== build_vega_expression_module_TokenPunctuator && build_vega_expression_module_lookahead.type !== build_vega_expression_module_TokenKeyword) {
    expr = build_vega_expression_module_parsePostfixExpression();
  } else if (build_vega_expression_module_match('++') || build_vega_expression_module_match('--')) {
    throw new Error(build_vega_expression_module_DISABLED);
  } else if (build_vega_expression_module_match('+') || build_vega_expression_module_match('-') || build_vega_expression_module_match('~') || build_vega_expression_module_match('!')) {
    token = build_vega_expression_module_lex();
    expr = build_vega_expression_module_parseUnaryExpression();
    expr = build_vega_expression_module_finishUnaryExpression(token.value, expr);
  } else if (build_vega_expression_module_matchKeyword('delete') || build_vega_expression_module_matchKeyword('void') || build_vega_expression_module_matchKeyword('typeof')) {
    throw new Error(build_vega_expression_module_DISABLED);
  } else {
    expr = build_vega_expression_module_parsePostfixExpression();
  }

  return expr;
}

function build_vega_expression_module_binaryPrecedence(token) {
  let prec = 0;

  if (token.type !== build_vega_expression_module_TokenPunctuator && token.type !== build_vega_expression_module_TokenKeyword) {
    return 0;
  }

  switch (token.value) {
    case '||':
      prec = 1;
      break;

    case '&&':
      prec = 2;
      break;

    case '|':
      prec = 3;
      break;

    case '^':
      prec = 4;
      break;

    case '&':
      prec = 5;
      break;

    case '==':
    case '!=':
    case '===':
    case '!==':
      prec = 6;
      break;

    case '<':
    case '>':
    case '<=':
    case '>=':
    case 'instanceof':
    case 'in':
      prec = 7;
      break;

    case '<<':
    case '>>':
    case '>>>':
      prec = 8;
      break;

    case '+':
    case '-':
      prec = 9;
      break;

    case '*':
    case '/':
    case '%':
      prec = 11;
      break;
  }

  return prec;
} // 11.5 Multiplicative Operators
// 11.6 Additive Operators
// 11.7 Bitwise Shift Operators
// 11.8 Relational Operators
// 11.9 Equality Operators
// 11.10 Binary Bitwise Operators
// 11.11 Binary Logical Operators


function build_vega_expression_module_parseBinaryExpression() {
  var marker, markers, expr, token, prec, stack, right, operator, left, i;
  marker = build_vega_expression_module_lookahead;
  left = build_vega_expression_module_parseUnaryExpression();
  token = build_vega_expression_module_lookahead;
  prec = build_vega_expression_module_binaryPrecedence(token);

  if (prec === 0) {
    return left;
  }

  token.prec = prec;
  build_vega_expression_module_lex();
  markers = [marker, build_vega_expression_module_lookahead];
  right = build_vega_expression_module_parseUnaryExpression();
  stack = [left, token, right];

  while ((prec = build_vega_expression_module_binaryPrecedence(build_vega_expression_module_lookahead)) > 0) {
    // Reduce: make a binary expression from the three topmost entries.
    while (stack.length > 2 && prec <= stack[stack.length - 2].prec) {
      right = stack.pop();
      operator = stack.pop().value;
      left = stack.pop();
      markers.pop();
      expr = build_vega_expression_module_finishBinaryExpression(operator, left, right);
      stack.push(expr);
    } // Shift.


    token = build_vega_expression_module_lex();
    token.prec = prec;
    stack.push(token);
    markers.push(build_vega_expression_module_lookahead);
    expr = build_vega_expression_module_parseUnaryExpression();
    stack.push(expr);
  } // Final reduce to clean-up the stack.


  i = stack.length - 1;
  expr = stack[i];
  markers.pop();

  while (i > 1) {
    markers.pop();
    expr = build_vega_expression_module_finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
    i -= 2;
  }

  return expr;
} // 11.12 Conditional Operator


function build_vega_expression_module_parseConditionalExpression() {
  var expr, consequent, alternate;
  expr = build_vega_expression_module_parseBinaryExpression();

  if (build_vega_expression_module_match('?')) {
    build_vega_expression_module_lex();
    consequent = build_vega_expression_module_parseConditionalExpression();
    build_vega_expression_module_expect(':');
    alternate = build_vega_expression_module_parseConditionalExpression();
    expr = build_vega_expression_module_finishConditionalExpression(expr, consequent, alternate);
  }

  return expr;
} // 11.14 Comma Operator


function build_vega_expression_module_parseExpression() {
  const expr = build_vega_expression_module_parseConditionalExpression();

  if (build_vega_expression_module_match(',')) {
    throw new Error(build_vega_expression_module_DISABLED); // no sequence expressions
  }

  return expr;
}

function build_vega_expression_module_parser (code) {
  vega_expression_build_vega_expression_module_source = code;
  vega_expression_build_vega_expression_module_index = 0;
  vega_expression_build_vega_expression_module_length = vega_expression_build_vega_expression_module_source.length;
  build_vega_expression_module_lookahead = null;
  build_vega_expression_module_peek();
  const expr = build_vega_expression_module_parseExpression();

  if (build_vega_expression_module_lookahead.type !== build_vega_expression_module_TokenEOF) {
    throw new Error('Unexpect token after expression.');
  }

  return expr;
}

var build_vega_expression_module_Constants = {
  NaN: 'NaN',
  E: 'Math.E',
  LN2: 'Math.LN2',
  LN10: 'Math.LN10',
  LOG2E: 'Math.LOG2E',
  LOG10E: 'Math.LOG10E',
  PI: 'Math.PI',
  SQRT1_2: 'Math.SQRT1_2',
  SQRT2: 'Math.SQRT2',
  MIN_VALUE: 'Number.MIN_VALUE',
  MAX_VALUE: 'Number.MAX_VALUE'
};

function build_vega_expression_module_Functions (codegen) {
  function fncall(name, args, cast, type) {
    let obj = codegen(args[0]);

    if (cast) {
      obj = cast + '(' + obj + ')';
      if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';
    }

    return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')');
  }

  function fn(name, cast, type) {
    return args => fncall(name, args, cast, type);
  }

  const DATE = 'new Date',
        STRING = 'String',
        REGEXP = 'RegExp';
  return {
    // MATH functions
    isNaN: 'Number.isNaN',
    isFinite: 'Number.isFinite',
    abs: 'Math.abs',
    acos: 'Math.acos',
    asin: 'Math.asin',
    atan: 'Math.atan',
    atan2: 'Math.atan2',
    ceil: 'Math.ceil',
    cos: 'Math.cos',
    exp: 'Math.exp',
    floor: 'Math.floor',
    log: 'Math.log',
    max: 'Math.max',
    min: 'Math.min',
    pow: 'Math.pow',
    random: 'Math.random',
    round: 'Math.round',
    sin: 'Math.sin',
    sqrt: 'Math.sqrt',
    tan: 'Math.tan',
    clamp: function (args) {
      if (args.length < 3) Object(vega_util_module["o" /* error */])('Missing arguments to clamp function.');
      if (args.length > 3) Object(vega_util_module["o" /* error */])('Too many arguments to clamp function.');
      const a = args.map(codegen);
      return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))';
    },
    // DATE functions
    now: 'Date.now',
    utc: 'Date.UTC',
    datetime: DATE,
    date: fn('getDate', DATE, 0),
    day: fn('getDay', DATE, 0),
    year: fn('getFullYear', DATE, 0),
    month: fn('getMonth', DATE, 0),
    hours: fn('getHours', DATE, 0),
    minutes: fn('getMinutes', DATE, 0),
    seconds: fn('getSeconds', DATE, 0),
    milliseconds: fn('getMilliseconds', DATE, 0),
    time: fn('getTime', DATE, 0),
    timezoneoffset: fn('getTimezoneOffset', DATE, 0),
    utcdate: fn('getUTCDate', DATE, 0),
    utcday: fn('getUTCDay', DATE, 0),
    utcyear: fn('getUTCFullYear', DATE, 0),
    utcmonth: fn('getUTCMonth', DATE, 0),
    utchours: fn('getUTCHours', DATE, 0),
    utcminutes: fn('getUTCMinutes', DATE, 0),
    utcseconds: fn('getUTCSeconds', DATE, 0),
    utcmilliseconds: fn('getUTCMilliseconds', DATE, 0),
    // sequence functions
    length: fn('length', null, -1),
    // STRING functions
    parseFloat: 'parseFloat',
    parseInt: 'parseInt',
    upper: fn('toUpperCase', STRING, 0),
    lower: fn('toLowerCase', STRING, 0),
    substring: fn('substring', STRING),
    split: fn('split', STRING),
    trim: fn('trim', STRING, 0),
    // REGEXP functions
    regexp: REGEXP,
    test: fn('test', REGEXP),
    // Control Flow functions
    if: function (args) {
      if (args.length < 3) Object(vega_util_module["o" /* error */])('Missing arguments to if function.');
      if (args.length > 3) Object(vega_util_module["o" /* error */])('Too many arguments to if function.');
      const a = args.map(codegen);
      return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')';
    }
  };
}

function build_vega_expression_module_stripQuotes(s) {
  const n = s && s.length - 1;
  return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s;
}

function vega_expression_build_vega_expression_module_codegen (opt) {
  opt = opt || {};
  const allowed = opt.allowed ? Object(vega_util_module["fb" /* toSet */])(opt.allowed) : {},
        forbidden = opt.forbidden ? Object(vega_util_module["fb" /* toSet */])(opt.forbidden) : {},
        constants = opt.constants || build_vega_expression_module_Constants,
        functions = (opt.functions || build_vega_expression_module_Functions)(visit),
        globalvar = opt.globalvar,
        fieldvar = opt.fieldvar,
        outputGlobal = Object(vega_util_module["E" /* isFunction */])(globalvar) ? globalvar : id => "".concat(globalvar, "[\"").concat(id, "\"]");
  let globals = {},
      fields = {},
      memberDepth = 0;

  function visit(ast) {
    if (Object(vega_util_module["J" /* isString */])(ast)) return ast;
    const generator = Generators[ast.type];
    if (generator == null) Object(vega_util_module["o" /* error */])('Unsupported type: ' + ast.type);
    return generator(ast);
  }

  const Generators = {
    Literal: n => n.raw,
    Identifier: n => {
      const id = n.name;

      if (memberDepth > 0) {
        return id;
      } else if (Object(vega_util_module["w" /* hasOwnProperty */])(forbidden, id)) {
        return Object(vega_util_module["o" /* error */])('Illegal identifier: ' + id);
      } else if (Object(vega_util_module["w" /* hasOwnProperty */])(constants, id)) {
        return constants[id];
      } else if (Object(vega_util_module["w" /* hasOwnProperty */])(allowed, id)) {
        return id;
      } else {
        globals[id] = 1;
        return outputGlobal(id);
      }
    },
    MemberExpression: n => {
      const d = !n.computed,
            o = visit(n.object);
      if (d) memberDepth += 1;
      const p = visit(n.property);

      if (o === fieldvar) {
        // strip quotes to sanitize field name (#1653)
        fields[build_vega_expression_module_stripQuotes(p)] = 1;
      }

      if (d) memberDepth -= 1;
      return o + (d ? '.' + p : '[' + p + ']');
    },
    CallExpression: n => {
      if (n.callee.type !== 'Identifier') {
        Object(vega_util_module["o" /* error */])('Illegal callee type: ' + n.callee.type);
      }

      const callee = n.callee.name,
            args = n.arguments,
            fn = Object(vega_util_module["w" /* hasOwnProperty */])(functions, callee) && functions[callee];
      if (!fn) Object(vega_util_module["o" /* error */])('Unrecognized function: ' + callee);
      return Object(vega_util_module["E" /* isFunction */])(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')';
    },
    ArrayExpression: n => '[' + n.elements.map(visit).join(',') + ']',
    BinaryExpression: n => '(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')',
    UnaryExpression: n => '(' + n.operator + visit(n.argument) + ')',
    ConditionalExpression: n => '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')',
    LogicalExpression: n => '(' + visit(n.left) + n.operator + visit(n.right) + ')',
    ObjectExpression: n => '{' + n.properties.map(visit).join(',') + '}',
    Property: n => {
      memberDepth += 1;
      const k = visit(n.key);
      memberDepth -= 1;
      return k + ':' + visit(n.value);
    }
  };

  function codegen(ast) {
    const result = {
      code: visit(ast),
      globals: Object.keys(globals),
      fields: Object.keys(fields)
    };
    globals = {};
    fields = {};
    return result;
  }

  codegen.functions = functions;
  codegen.constants = constants;
  return codegen;
}



// CONCATENATED MODULE: ./node_modules/vega-event-selector/build/vega-event-selector.module.js
const build_vega_event_selector_module_VIEW = 'view',
      vega_event_selector_module_LBRACK = '[',
      vega_event_selector_module_RBRACK = ']',
      vega_event_selector_module_LBRACE = '{',
      vega_event_selector_module_RBRACE = '}',
      vega_event_selector_module_COLON = ':',
      vega_event_selector_module_COMMA = ',',
      vega_event_selector_module_NAME = '@',
      vega_event_selector_module_GT = '>',
      build_vega_event_selector_module_ILLEGAL = /[[\]{}]/,
      vega_event_selector_module_DEFAULT_MARKS = {
  '*': 1,
  arc: 1,
  area: 1,
  group: 1,
  image: 1,
  line: 1,
  path: 1,
  rect: 1,
  rule: 1,
  shape: 1,
  symbol: 1,
  text: 1,
  trail: 1
};
let vega_event_selector_module_DEFAULT_SOURCE, vega_event_selector_module_MARKS;
/**
 * Parse an event selector string.
 * Returns an array of event stream definitions.
 */

function vega_event_selector_module_eventSelector (selector, source, marks) {
  vega_event_selector_module_DEFAULT_SOURCE = source || build_vega_event_selector_module_VIEW;
  vega_event_selector_module_MARKS = marks || vega_event_selector_module_DEFAULT_MARKS;
  return vega_event_selector_module_parseMerge(selector.trim()).map(vega_event_selector_module_parseSelector);
}

function vega_event_selector_module_isMarkType(type) {
  return vega_event_selector_module_MARKS[type];
}

function build_vega_event_selector_module_find(s, i, endChar, pushChar, popChar) {
  const n = s.length;
  let count = 0,
      c;

  for (; i < n; ++i) {
    c = s[i];
    if (!count && c === endChar) return i;else if (popChar && popChar.indexOf(c) >= 0) --count;else if (pushChar && pushChar.indexOf(c) >= 0) ++count;
  }

  return i;
}

function vega_event_selector_module_parseMerge(s) {
  const output = [],
        n = s.length;
  let start = 0,
      i = 0;

  while (i < n) {
    i = build_vega_event_selector_module_find(s, i, vega_event_selector_module_COMMA, vega_event_selector_module_LBRACK + vega_event_selector_module_LBRACE, vega_event_selector_module_RBRACK + vega_event_selector_module_RBRACE);
    output.push(s.substring(start, i).trim());
    start = ++i;
  }

  if (output.length === 0) {
    throw 'Empty event selector: ' + s;
  }

  return output;
}

function vega_event_selector_module_parseSelector(s) {
  return s[0] === '[' ? vega_event_selector_module_parseBetween(s) : build_vega_event_selector_module_parseStream(s);
}

function vega_event_selector_module_parseBetween(s) {
  const n = s.length;
  let i = 1,
      b;
  i = build_vega_event_selector_module_find(s, i, vega_event_selector_module_RBRACK, vega_event_selector_module_LBRACK, vega_event_selector_module_RBRACK);

  if (i === n) {
    throw 'Empty between selector: ' + s;
  }

  b = vega_event_selector_module_parseMerge(s.substring(1, i));

  if (b.length !== 2) {
    throw 'Between selector must have two elements: ' + s;
  }

  s = s.slice(i + 1).trim();

  if (s[0] !== vega_event_selector_module_GT) {
    throw 'Expected \'>\' after between selector: ' + s;
  }

  b = b.map(vega_event_selector_module_parseSelector);
  const stream = vega_event_selector_module_parseSelector(s.slice(1).trim());

  if (stream.between) {
    return {
      between: b,
      stream: stream
    };
  } else {
    stream.between = b;
  }

  return stream;
}

function build_vega_event_selector_module_parseStream(s) {
  const stream = {
    source: vega_event_selector_module_DEFAULT_SOURCE
  },
        source = [];
  let throttle = [0, 0],
      markname = 0,
      start = 0,
      n = s.length,
      i = 0,
      j,
      filter; // extract throttle from end

  if (s[n - 1] === vega_event_selector_module_RBRACE) {
    i = s.lastIndexOf(vega_event_selector_module_LBRACE);

    if (i >= 0) {
      try {
        throttle = vega_event_selector_module_parseThrottle(s.substring(i + 1, n - 1));
      } catch (e) {
        throw 'Invalid throttle specification: ' + s;
      }

      s = s.slice(0, i).trim();
      n = s.length;
    } else throw 'Unmatched right brace: ' + s;

    i = 0;
  }

  if (!n) throw s; // set name flag based on first char

  if (s[0] === vega_event_selector_module_NAME) markname = ++i; // extract first part of multi-part stream selector

  j = build_vega_event_selector_module_find(s, i, vega_event_selector_module_COLON);

  if (j < n) {
    source.push(s.substring(start, j).trim());
    start = i = ++j;
  } // extract remaining part of stream selector


  i = build_vega_event_selector_module_find(s, i, vega_event_selector_module_LBRACK);

  if (i === n) {
    source.push(s.substring(start, n).trim());
  } else {
    source.push(s.substring(start, i).trim());
    filter = [];
    start = ++i;
    if (start === n) throw 'Unmatched left bracket: ' + s;
  } // extract filters


  while (i < n) {
    i = build_vega_event_selector_module_find(s, i, vega_event_selector_module_RBRACK);
    if (i === n) throw 'Unmatched left bracket: ' + s;
    filter.push(s.substring(start, i).trim());
    if (i < n - 1 && s[++i] !== vega_event_selector_module_LBRACK) throw 'Expected left bracket: ' + s;
    start = ++i;
  } // marshall event stream specification


  if (!(n = source.length) || build_vega_event_selector_module_ILLEGAL.test(source[n - 1])) {
    throw 'Invalid event selector: ' + s;
  }

  if (n > 1) {
    stream.type = source[1];

    if (markname) {
      stream.markname = source[0].slice(1);
    } else if (vega_event_selector_module_isMarkType(source[0])) {
      stream.marktype = source[0];
    } else {
      stream.source = source[0];
    }
  } else {
    stream.type = source[0];
  }

  if (stream.type.slice(-1) === '!') {
    stream.consume = true;
    stream.type = stream.type.slice(0, -1);
  }

  if (filter != null) stream.filter = filter;
  if (throttle[0]) stream.throttle = throttle[0];
  if (throttle[1]) stream.debounce = throttle[1];
  return stream;
}

function vega_event_selector_module_parseThrottle(s) {
  const a = s.split(vega_event_selector_module_COMMA);
  if (!s.length || a.length > 2) throw s;
  return a.map(_ => {
    const x = +_;
    if (x !== x) throw s;
    return x;
  });
}



// CONCATENATED MODULE: ./node_modules/vega/build/vega.module.js




























var vega_module_name = "vega";
var version$1 = "5.20.2";
var description = "The Vega visualization grammar.";
var vega_module_keywords = ["vega", "visualization", "interaction", "dataflow", "library", "data", "d3"];
var license = "BSD-3-Clause";
var author = "UW Interactive Data Lab (http://idl.cs.washington.edu)";
var vega_module_main = "build/vega-node.js";
var vega_module_module = "build/vega.module.js";
var unpkg = "build/vega.min.js";
var jsdelivr = "build/vega.min.js";
var vega_module_types = "index.d.ts";
var repository = "vega/vega";
var scripts = {
  bundle: "rollup -c --config-bundle",
  prebuild: "rimraf build && rimraf build-es5",
  build: "rollup -c --config-core --config-bundle --config-ie",
  postbuild: "node schema-copy",
  pretest: "yarn build --config-test",
  test: "TZ=America/Los_Angeles tape 'test/**/*-test.js'",
  prepublishOnly: "yarn test && yarn build",
  postpublish: "./schema-deploy.sh"
};
var dependencies = {
  "vega-crossfilter": "~4.0.5",
  "vega-dataflow": "~5.7.4",
  "vega-encode": "~4.8.3",
  "vega-event-selector": "~2.0.6",
  "vega-expression": "~4.0.1",
  "vega-force": "~4.0.7",
  "vega-format": "~1.0.4",
  "vega-functions": "~5.12.0",
  "vega-geo": "~4.3.8",
  "vega-hierarchy": "~4.0.9",
  "vega-label": "~1.0.0",
  "vega-loader": "~4.4.0",
  "vega-parser": "~6.1.3",
  "vega-projection": "~1.4.5",
  "vega-regression": "~1.0.9",
  "vega-runtime": "~6.1.3",
  "vega-scale": "~7.1.1",
  "vega-scenegraph": "~4.9.4",
  "vega-statistics": "~1.7.9",
  "vega-time": "~2.0.4",
  "vega-transforms": "~4.9.4",
  "vega-typings": "~0.21.0",
  "vega-util": "~1.16.1",
  "vega-view": "~5.10.1",
  "vega-view-transforms": "~4.5.8",
  "vega-voronoi": "~4.1.5",
  "vega-wordcloud": "~4.1.3"
};
var devDependencies = {
  "vega-schema": "*"
};
var gitHead = "e251dbc61ab6645689d9f349e7dd9d15ddb85bce";
var pkg = {
  name: vega_module_name,
  version: version$1,
  description: description,
  keywords: vega_module_keywords,
  license: license,
  author: author,
  main: vega_module_main,
  module: vega_module_module,
  unpkg: unpkg,
  jsdelivr: jsdelivr,
  types: vega_module_types,
  repository: repository,
  scripts: scripts,
  dependencies: dependencies,
  devDependencies: devDependencies,
  gitHead: gitHead
}; // -- Transforms -----

Object(vega_util_module["p" /* extend */])(vega_dataflow_module_transforms, vega_transforms_module_namespaceObject, vega_view_transforms_module_namespaceObject, vega_encode_module_namespaceObject, vega_geo_module_namespaceObject, vega_force_module_namespaceObject, vega_label_module_namespaceObject, vega_hierarchy_module_namespaceObject, vega_regression_module_namespaceObject, vega_voronoi_module_namespaceObject, vega_wordcloud_module_namespaceObject, vega_crossfilter_module_namespaceObject); // -- Exports -----

var version = pkg.version;

// EXTERNAL MODULE: ./node_modules/vega-lite/build/package.json
var build_package = __webpack_require__("a87b");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.assign.js
var es_object_assign = __webpack_require__("cca6");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.map.js
var es_array_map = __webpack_require__("d81d");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/accessor.js
/* harmony default export */ var src_accessor = (function (fn, fields, name) {
  fn.fields = fields || [];
  fn.fname = name;
  return fn;
});
function accessorName(fn) {
  return fn == null ? null : fn.fname;
}
function accessorFields(fn) {
  return fn == null ? null : fn.fields;
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.join.js
var es_array_join = __webpack_require__("a15b");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/error.js
/* harmony default export */ var src_error = (function (message) {
  throw Error(message);
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/splitAccessPath.js

/* harmony default export */ var splitAccessPath = (function (p) {
  var path = [],
      q = null,
      b = 0,
      n = p.length,
      s = '',
      i,
      j,
      c;
  p = p + '';

  function push() {
    path.push(s + p.substring(i, j));
    s = '';
    i = j + 1;
  }

  for (i = j = 0; j < n; ++j) {
    c = p[j];

    if (c === '\\') {
      s += p.substring(i, j);
      s += p.substring(++j, ++j);
      i = j;
    } else if (c === q) {
      push();
      q = null;
      b = -1;
    } else if (q) {
      continue;
    } else if (i === b && c === '"') {
      i = j + 1;
      q = c;
    } else if (i === b && c === "'") {
      i = j + 1;
      q = c;
    } else if (c === '.' && !b) {
      if (j > i) {
        push();
      } else {
        i = j + 1;
      }
    } else if (c === '[') {
      if (j > i) push();
      b = i = j + 1;
    } else if (c === ']') {
      if (!b) src_error('Access path missing open bracket: ' + p);
      if (b > 0) push();
      b = 0;
      i = j + 1;
    }
  }

  if (b) src_error('Access path missing closing bracket: ' + p);
  if (q) src_error('Access path missing closing quote: ' + p);

  if (j > i) {
    j++;
    push();
  }

  return path;
});
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.exec.js
var es_regexp_exec = __webpack_require__("ac1f");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.replace.js
var es_string_replace = __webpack_require__("5319");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.is-array.js
var es_array_is_array = __webpack_require__("277d");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/isArray.js

/* harmony default export */ var isArray = (Array.isArray);
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/isObject.js
/* harmony default export */ var isObject = (function (_) {
  return _ === Object(_);
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/isString.js
/* harmony default export */ var isString = (function (_) {
  return typeof _ === 'string';
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/stringValue.js






function stringValue_$(x) {
  return isArray(x) ? '[' + x.map(stringValue_$) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings.
  // See http://timelessrepo.com/json-isnt-a-javascript-subset
  JSON.stringify(x).replace("\u2028", "\\u2028").replace("\u2029", "\\u2029") : x;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/field.js





/* harmony default export */ var src_field = (function (field, name) {
  var path = splitAccessPath(field),
      code = 'return _[' + path.map(stringValue_$).join('][') + '];';
  return src_accessor(Function('_', code), [field = path.length === 1 ? path[0] : field], name || field);
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/accessors.js


var empty = [];
var accessors_id = src_field('id');
var accessors_identity = src_accessor(function (_) {
  return _;
}, empty, 'identity');
var accessors_zero = src_accessor(function () {
  return 0;
}, empty, 'zero');
var accessors_one = src_accessor(function () {
  return 1;
}, empty, 'one');
var truthy = src_accessor(function () {
  return true;
}, empty, 'true');
var falsy = src_accessor(function () {
  return false;
}, empty, 'false');
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
var es_array_concat = __webpack_require__("99af");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.slice.js
var es_array_slice = __webpack_require__("fb6a");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/logger.js



function logger_log(method, level, input) {
  var args = [level].concat([].slice.call(input));
  console[method].apply(console, args); // eslint-disable-line no-console
}

var logger_None = 0;
var logger_Error = 1;
var Warn = 2;
var Info = 3;
var Debug = 4;
/* harmony default export */ var logger = (function (_, method) {
  var _level = _ || logger_None;

  return {
    level: function level(_) {
      if (arguments.length) {
        _level = +_;
        return this;
      } else {
        return _level;
      }
    },
    error: function error() {
      if (_level >= logger_Error) logger_log(method || 'error', 'ERROR', arguments);
      return this;
    },
    warn: function warn() {
      if (_level >= Warn) logger_log(method || 'warn', 'WARN', arguments);
      return this;
    },
    info: function info() {
      if (_level >= Info) logger_log(method || 'log', 'INFO', arguments);
      return this;
    },
    debug: function debug() {
      if (_level >= Debug) logger_log(method || 'log', 'DEBUG', arguments);
      return this;
    }
  };
});
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.reduce.js
var es_array_reduce = __webpack_require__("13d5");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.name.js
var es_function_name = __webpack_require__("b0c0");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/mergeConfig.js







var isLegalKey = function isLegalKey(key) {
  return key !== '__proto__';
};

function mergeConfig() {
  for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) {
    configs[_key] = arguments[_key];
  }

  return configs.reduce(function (out, source) {
    for (var key in source) {
      if (key === 'signals') {
        // for signals, we merge the signals arrays
        // source signals take precedence over
        // existing signals with the same name
        out.signals = mergeNamed(out.signals, source.signals);
      } else {
        // otherwise, merge objects subject to recursion constraints
        // for legend block, recurse for the layout entry only
        // for style block, recurse for all properties
        // otherwise, no recursion: objects overwrite, no merging
        var r = key === 'legend' ? {
          layout: 1
        } : key === 'style' ? true : null;
        writeConfig(out, key, source[key], r);
      }
    }

    return out;
  }, {});
}
function writeConfig(output, key, value, recurse) {
  if (!isLegalKey(key)) return;
  var k, o;

  if (isObject(value) && !isArray(value)) {
    o = isObject(output[key]) ? output[key] : output[key] = {};

    for (k in value) {
      if (recurse && (recurse === true || recurse[k])) {
        writeConfig(o, k, value[k]);
      } else if (isLegalKey(k)) {
        o[k] = value[k];
      }
    }
  } else {
    output[key] = value;
  }
}

function mergeNamed(a, b) {
  if (a == null) return b;
  var map = {},
      out = [];

  function add(_) {
    if (!map[_.name]) {
      map[_.name] = 1;
      out.push(_);
    }
  }

  b.forEach(add);
  a.forEach(add);
  return out;
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.math.sign.js
var es_math_sign = __webpack_require__("2af1");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.math.log1p.js
var es_math_log1p = __webpack_require__("ca21");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.math.expm1.js
var es_math_expm1 = __webpack_require__("0ac8");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/peek.js
/* harmony default export */ var src_peek = (function (array) {
  return array[array.length - 1];
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/toNumber.js
/* harmony default export */ var toNumber = (function (_) {
  return _ == null || _ === '' ? null : +_;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/transform.js







function transform_exp(sign) {
  return function (x) {
    return sign * Math.exp(x);
  };
}

function transform_log(sign) {
  return function (x) {
    return Math.log(sign * x);
  };
}

function transform_symlog(c) {
  return function (x) {
    return Math.sign(x) * Math.log1p(Math.abs(x / c));
  };
}

function symexp(c) {
  return function (x) {
    return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
  };
}

function transform_pow(exponent) {
  return function (x) {
    return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
  };
}

function pan(domain, delta, lift, ground) {
  var d0 = lift(domain[0]),
      d1 = lift(src_peek(domain)),
      dd = (d1 - d0) * delta;
  return [ground(d0 - dd), ground(d1 - dd)];
}

function panLinear(domain, delta) {
  return pan(domain, delta, toNumber, accessors_identity);
}
function panLog(domain, delta) {
  var sign = Math.sign(domain[0]);
  return pan(domain, delta, transform_log(sign), transform_exp(sign));
}
function panPow(domain, delta, exponent) {
  return pan(domain, delta, transform_pow(exponent), transform_pow(1 / exponent));
}
function panSymlog(domain, delta, constant) {
  return pan(domain, delta, transform_symlog(constant), symexp(constant));
}

function transform_zoom(domain, anchor, scale, lift, ground) {
  var d0 = lift(domain[0]),
      d1 = lift(src_peek(domain)),
      da = anchor != null ? lift(anchor) : (d0 + d1) / 2;
  return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)];
}

function zoomLinear(domain, anchor, scale) {
  return transform_zoom(domain, anchor, scale, toNumber, accessors_identity);
}
function zoomLog(domain, anchor, scale) {
  var sign = Math.sign(domain[0]);
  return transform_zoom(domain, anchor, scale, transform_log(sign), transform_exp(sign));
}
function zoomPow(domain, anchor, scale, exponent) {
  return transform_zoom(domain, anchor, scale, transform_pow(exponent), transform_pow(1 / exponent));
}
function zoomSymlog(domain, anchor, scale, constant) {
  return transform_zoom(domain, anchor, scale, transform_symlog(constant), symexp(constant));
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.date.to-string.js
var es_date_to_string = __webpack_require__("0d03");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/quarter.js

function quarter_quarter(date) {
  return 1 + ~~(new Date(date).getMonth() / 3);
}
function utcquarter(date) {
  return 1 + ~~(new Date(date).getUTCMonth() / 3);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/array.js

/* harmony default export */ var vega_util_src_array = (function (_) {
  return _ != null ? isArray(_) ? _ : [_] : [];
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/clampRange.js
/**
 * Span-preserving range clamp. If the span of the input range is less
 * than (max - min) and an endpoint exceeds either the min or max value,
 * the range is translated such that the span is preserved and one
 * endpoint touches the boundary of the min/max range.
 * If the span exceeds (max - min), the range [min, max] is returned.
 */
/* harmony default export */ var clampRange = (function (range, min, max) {
  var lo = range[0],
      hi = range[1],
      span;

  if (hi < lo) {
    span = hi;
    hi = lo;
    lo = span;
  }

  span = hi - lo;
  return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span];
});
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.bind.js
var es_function_bind = __webpack_require__("c0b6");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/isFunction.js
/* harmony default export */ var isFunction = (function (_) {
  return typeof _ === 'function';
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/compare.js












/* harmony default export */ var src_compare = (function (fields, orders) {
  var idx = [],
      cmp = (fields = vega_util_src_array(fields)).map(function (f, i) {
    if (f == null) {
      return null;
    } else {
      idx.push(i);
      return isFunction(f) ? f : splitAccessPath(f).map(stringValue_$).join('][');
    }
  }),
      n = idx.length - 1,
      ord = vega_util_src_array(orders),
      code = 'var u,v;return ',
      i,
      j,
      f,
      u,
      v,
      d,
      t,
      lt,
      gt;
  if (n < 0) return null;

  for (j = 0; j <= n; ++j) {
    i = idx[j];
    f = cmp[i];

    if (isFunction(f)) {
      d = 'f' + i;
      u = '(u=this.' + d + '(a))';
      v = '(v=this.' + d + '(b))';
      (t = t || {})[d] = f;
    } else {
      u = '(u=a[' + f + '])';
      v = '(v=b[' + f + '])';
    }

    d = '((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))';

    if (ord[i] !== 'descending') {
      gt = 1;
      lt = -1;
    } else {
      gt = -1;
      lt = 1;
    }

    code += '(' + u + '<' + v + '||u==null)&&v!=null?' + lt + ':(u>v||v==null)&&u!=null?' + gt + ':' + d + '!==u&&v===v?' + lt + ':v!==v&&u===u?' + gt + (i < n ? ':' : ':0');
  }

  f = Function('a', 'b', code + ';');
  if (t) f = f.bind(t);
  fields = fields.reduce(function (map, field) {
    if (isFunction(field)) {
      (accessorFields(field) || []).forEach(function (_) {
        map[_] = 1;
      });
    } else if (field != null) {
      map[field + ''] = 1;
    }

    return map;
  }, {});
  return src_accessor(f, Object.keys(fields));
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/constant.js

/* harmony default export */ var vega_util_src_constant = (function (_) {
  return isFunction(_) ? _ : function () {
    return _;
  };
});
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.timers.js
var web_timers = __webpack_require__("4795");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/debounce.js

/* harmony default export */ var debounce = (function (delay, handler) {
  var tid, evt;

  function callback() {
    handler(evt);
    tid = evt = null;
  }

  return function (e) {
    evt = e;
    if (tid) clearTimeout(tid);
    tid = setTimeout(callback, delay);
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/extend.js
/* harmony default export */ var src_extend = (function (_) {
  for (var x, k, i = 1, len = arguments.length; i < len; ++i) {
    x = arguments[i];

    for (k in x) {
      _[k] = x[k];
    }
  }

  return _;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/extent.js
/**
 * Return an array with minimum and maximum values, in the
 * form [min, max]. Ignores null, undefined, and NaN values.
 */
/* harmony default export */ var vega_util_src_extent = (function (array, f) {
  var i = 0,
      n,
      v,
      min,
      max;

  if (array && (n = array.length)) {
    if (f == null) {
      // find first valid value
      for (v = array[i]; i < n && (v == null || v !== v); v = array[++i]) {
        ;
      }

      min = max = v; // visit all other values

      for (; i < n; ++i) {
        v = array[i]; // skip null/undefined; NaN will fail all comparisons

        if (v != null) {
          if (v < min) min = v;
          if (v > max) max = v;
        }
      }
    } else {
      // find first valid value
      for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])) {
        ;
      }

      min = max = v; // visit all other values

      for (; i < n; ++i) {
        v = f(array[i]); // skip null/undefined; NaN will fail all comparisons

        if (v != null) {
          if (v < min) min = v;
          if (v > max) max = v;
        }
      }
    }
  }

  return [min, max];
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/extentIndex.js
/* harmony default export */ var extentIndex = (function (array, f) {
  var i = -1,
      n = array.length,
      a,
      b,
      c,
      u,
      v;

  if (f == null) {
    while (++i < n) {
      b = array[i];

      if (b != null && b >= b) {
        a = c = b;
        break;
      }
    }

    if (i === n) return [-1, -1];
    u = v = i;

    while (++i < n) {
      b = array[i];

      if (b != null) {
        if (a > b) {
          a = b;
          u = i;
        }

        if (c < b) {
          c = b;
          v = i;
        }
      }
    }
  } else {
    while (++i < n) {
      b = f(array[i], i, array);

      if (b != null && b >= b) {
        a = c = b;
        break;
      }
    }

    if (i === n) return [-1, -1];
    u = v = i;

    while (++i < n) {
      b = f(array[i], i, array);

      if (b != null) {
        if (a > b) {
          a = b;
          u = i;
        }

        if (c < b) {
          c = b;
          v = i;
        }
      }
    }
  }

  return [u, v];
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/hasOwnProperty.js
var hop = Object.prototype.hasOwnProperty;
/* harmony default export */ var src_hasOwnProperty = (function (object, property) {
  return hop.call(object, property);
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/fastmap.js




var NULL = {};
/* harmony default export */ var fastmap = (function (input) {
  var obj = {},
      map,
      _test;

  function has(key) {
    return src_hasOwnProperty(obj, key) && obj[key] !== NULL;
  }

  map = {
    size: 0,
    empty: 0,
    object: obj,
    has: has,
    get: function get(key) {
      return has(key) ? obj[key] : undefined;
    },
    set: function set(key, value) {
      if (!has(key)) {
        ++map.size;
        if (obj[key] === NULL) --map.empty;
      }

      obj[key] = value;
      return this;
    },
    "delete": function _delete(key) {
      if (has(key)) {
        --map.size;
        ++map.empty;
        obj[key] = NULL;
      }

      return this;
    },
    clear: function clear() {
      map.size = map.empty = 0;
      map.object = obj = {};
    },
    test: function test(_) {
      if (arguments.length) {
        _test = _;
        return map;
      } else {
        return _test;
      }
    },
    clean: function clean() {
      var next = {},
          size = 0,
          key,
          value;

      for (key in obj) {
        value = obj[key];

        if (value !== NULL && (!_test || !_test(value))) {
          next[key] = value;
          ++size;
        }
      }

      map.size = size;
      map.empty = 0;
      map.object = obj = next;
    }
  };
  if (input) Object.keys(input).forEach(function (key) {
    map.set(key, input[key]);
  });
  return map;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/flush.js

/* harmony default export */ var flush = (function (range, value, threshold, left, right, center) {
  if (!threshold && threshold !== 0) return center;
  var a = range[0],
      b = src_peek(range),
      t = +threshold,
      l,
      r; // swap endpoints if range is reversed

  if (b < a) {
    l = a;
    a = b;
    b = l;
  } // compare value to endpoints


  l = Math.abs(value - a);
  r = Math.abs(b - value); // adjust if value is within threshold distance of endpoint

  return l < r && l <= t ? left : r <= t ? right : center;
});
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.create.js
var es_object_create = __webpack_require__("b8bf");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/inherits.js

/* harmony default export */ var inherits = (function (child, parent) {
  var proto = child.prototype = Object.create(parent.prototype);
  proto.constructor = child;
  return proto;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/inrange.js
/**
 * Predicate that returns true if the value lies within the span
 * of the given range. The left and right flags control the use
 * of inclusive (true) or exclusive (false) comparisons.
 */
/* harmony default export */ var inrange = (function (value, range, left, right) {
  var r0 = range[0],
      r1 = range[range.length - 1],
      t;

  if (r0 > r1) {
    t = r0;
    r0 = r1;
    r1 = t;
  }

  left = left === undefined || left;
  right = right === undefined || right;
  return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1);
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/isBoolean.js
/* harmony default export */ var isBoolean = (function (_) {
  return typeof _ === 'boolean';
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/isDate.js

/* harmony default export */ var isDate = (function (_) {
  return Object.prototype.toString.call(_) === '[object Date]';
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/isNumber.js
/* harmony default export */ var isNumber = (function (_) {
  return typeof _ === 'number';
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/isRegExp.js

/* harmony default export */ var isRegExp = (function (_) {
  return Object.prototype.toString.call(_) === '[object RegExp]';
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/key.js








/* harmony default export */ var src_key = (function (fields, flat) {
  if (fields) {
    fields = flat ? vega_util_src_array(fields).map(function (f) {
      return f.replace(/\\(.)/g, '$1');
    }) : vega_util_src_array(fields);
  }

  var fn = !(fields && fields.length) ? function () {
    return '';
  } : Function('_', 'return \'\'+' + fields.map(function (f) {
    return '_[' + (flat ? stringValue_$(f) : splitAccessPath(f).map(stringValue_$).join('][')) + ']';
  }).join('+\'|\'+') + ';');
  return src_accessor(fn, fields, 'key');
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/lerp.js

/* harmony default export */ var lerp = (function (array, frac) {
  var lo = array[0],
      hi = src_peek(array),
      f = +frac;
  return !f ? lo : f === 1 ? hi : lo + f * (hi - lo);
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/lruCache.js

var DEFAULT_MAX_SIZE = 10000; // adapted from https://github.com/dominictarr/hashlru/ (MIT License)

/* harmony default export */ var lruCache = (function (maxsize) {
  maxsize = +maxsize || DEFAULT_MAX_SIZE;
  var curr, prev, size;

  var clear = function clear() {
    curr = {};
    prev = {};
    size = 0;
  };

  var update = function update(key, value) {
    if (++size > maxsize) {
      prev = curr;
      curr = {};
      size = 1;
    }

    return curr[key] = value;
  };

  clear();
  return {
    clear: clear,
    has: function has(key) {
      return src_hasOwnProperty(curr, key) || src_hasOwnProperty(prev, key);
    },
    get: function get(key) {
      return src_hasOwnProperty(curr, key) ? curr[key] : src_hasOwnProperty(prev, key) ? update(key, prev[key]) : undefined;
    },
    set: function set(key, value) {
      return src_hasOwnProperty(curr, key) ? curr[key] = value : update(key, value);
    }
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/merge.js
/* harmony default export */ var src_merge = (function (compare, array0, array1, output) {
  var n0 = array0.length,
      n1 = array1.length;
  if (!n1) return array0;
  if (!n0) return array1;
  var merged = output || new array0.constructor(n0 + n1),
      i0 = 0,
      i1 = 0,
      i = 0;

  for (; i0 < n0 && i1 < n1; ++i) {
    merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++];
  }

  for (; i0 < n0; ++i0, ++i) {
    merged[i] = array0[i0];
  }

  for (; i1 < n1; ++i1, ++i) {
    merged[i] = array1[i1];
  }

  return merged;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/repeat.js
/* harmony default export */ var src_repeat = (function (str, reps) {
  var s = '';

  while (--reps >= 0) {
    s += str;
  }

  return s;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/pad.js

/* harmony default export */ var src_pad = (function (str, length, padchar, align) {
  var c = padchar || ' ',
      s = str + '',
      n = length - s.length;
  return n <= 0 ? s : align === 'left' ? src_repeat(c, n) + s : align === 'center' ? src_repeat(c, ~~(n / 2)) + s + src_repeat(c, Math.ceil(n / 2)) : s + src_repeat(c, n);
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/span.js

/**
 * Return the numerical span of an array: the difference between
 * the last and first values.
 */

/* harmony default export */ var src_span = (function (array) {
  return array && src_peek(array) - array[0] || 0;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/toBoolean.js
/* harmony default export */ var toBoolean = (function (_) {
  return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/toDate.js




function defaultParser(_) {
  return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_);
}

/* harmony default export */ var toDate = (function (_, parser) {
  parser = parser || defaultParser;
  return _ == null || _ === '' ? null : parser(_);
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/toString.js
/* harmony default export */ var src_toString = (function (_) {
  return _ == null || _ === '' ? null : _ + '';
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/toSet.js
/* harmony default export */ var toSet = (function (_) {
  for (var s = {}, i = 0, n = _.length; i < n; ++i) {
    s[_[i]] = true;
  }

  return s;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/truncate.js

/* harmony default export */ var src_truncate = (function (str, length, align, ellipsis) {
  var e = ellipsis != null ? ellipsis : "\u2026",
      s = str + '',
      n = s.length,
      l = Math.max(0, length - e.length);
  return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/src/visitArray.js


/* harmony default export */ var visitArray = (function (array, filter, visitor) {
  if (array) {
    var i = 0,
        n = array.length,
        t;

    if (filter) {
      for (; i < n; ++i) {
        if (t = filter(array[i])) visitor(t, i, array);
      }
    } else {
      array.forEach(visitor);
    }
  }
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-util/index.js














































// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.js
var es_symbol = __webpack_require__("a4d3");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.description.js
var es_symbol_description = __webpack_require__("e01a");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.iterator.js
var es_symbol_iterator = __webpack_require__("d28b");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.iterator.js
var es_array_iterator = __webpack_require__("e260");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
var es_string_iterator = __webpack_require__("3ca3");

// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
var web_dom_collections_iterator = __webpack_require__("ddb0");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.from.js
var es_array_from = __webpack_require__("a630");

// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
function _arrayLikeToArray(arr, len) {
  if (len == null || len > arr.length) len = arr.length;

  for (var i = 0, arr2 = new Array(len); i < len; i++) {
    arr2[i] = arr[i];
  }

  return arr2;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js






function _unsupportedIterableToArray(o, minLen) {
  if (!o) return;
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor) n = o.constructor.name;
  if (n === "Map" || n === "Set") return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js









function _createForOfIteratorHelper(o, allowArrayLike) {
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];

  if (!it) {
    if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
      if (it) o = it;
      var i = 0;

      var F = function F() {};

      return {
        s: F,
        n: function n() {
          if (i >= o.length) return {
            done: true
          };
          return {
            done: false,
            value: o[i++]
          };
        },
        e: function e(_e) {
          throw _e;
        },
        f: F
      };
    }

    throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }

  var normalCompletion = true,
      didErr = false,
      err;
  return {
    s: function s() {
      it = it.call(o);
    },
    n: function n() {
      var step = it.next();
      normalCompletion = step.done;
      return step;
    },
    e: function e(_e2) {
      didErr = true;
      err = _e2;
    },
    f: function f() {
      try {
        if (!normalCompletion && it["return"] != null) it["return"]();
      } finally {
        if (didErr) throw err;
      }
    }
  };
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js


function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js








function _iterableToArray(iter) {
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js




function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */

var extendStatics = function(d, b) {
    extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return extendStatics(d, b);
};

function tslib_es6_extends(d, b) {
    extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    }
    return __assign.apply(this, arguments);
}

function __rest(s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
}

function __decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
}

function __param(paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
}

function __metadata(metadataKey, metadataValue) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}

function __awaiter(thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
}

function __generator(thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
}

function __exportStar(m, exports) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}

function __values(o) {
    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
    if (m) return m.call(o);
    if (o && typeof o.length === "number") return {
        next: function () {
            if (o && i >= o.length) o = void 0;
            return { value: o && o[i++], done: !o };
        }
    };
    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}

function __read(o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
}

function __spread() {
    for (var ar = [], i = 0; i < arguments.length; i++)
        ar = ar.concat(__read(arguments[i]));
    return ar;
}

function __spreadArrays() {
    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
    for (var r = Array(s), k = 0, i = 0; i < il; i++)
        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
    return r;
};

function __await(v) {
    return this instanceof __await ? (this.v = v, this) : new __await(v);
}

function __asyncGenerator(thisArg, _arguments, generator) {
    if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
    var g = generator.apply(thisArg, _arguments || []), i, q = [];
    return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
    function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
    function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
    function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
    function fulfill(value) { resume("next", value); }
    function reject(value) { resume("throw", value); }
    function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}

function __asyncDelegator(o) {
    var i, p;
    return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
    function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}

function __asyncValues(o) {
    if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
    var m = o[Symbol.asyncIterator], i;
    return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
    function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
    function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}

function __makeTemplateObject(cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};

function __importStar(mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result.default = mod;
    return result;
}

function __importDefault(mod) {
    return (mod && mod.__esModule) ? mod : { default: mod };
}

function __classPrivateFieldGet(receiver, privateMap) {
    if (!privateMap.has(receiver)) {
        throw new TypeError("attempted to get private field on non-instance");
    }
    return privateMap.get(receiver);
}

function __classPrivateFieldSet(receiver, privateMap, value) {
    if (!privateMap.has(receiver)) {
        throw new TypeError("attempted to set private field on non-instance");
    }
    privateMap.set(receiver, value);
    return value;
}

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/scales/bandSpace.js
/* harmony default export */ var scales_bandSpace = (function (count, paddingInner, paddingOuter) {
  var space = count - paddingInner + paddingOuter * 2;
  return count ? space > 0 ? space : 1 : 0;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/scales/types.js
var types_Identity = 'identity';
var types_Linear = 'linear';
var types_Log = 'log';
var types_Pow = 'pow';
var types_Sqrt = 'sqrt';
var types_Symlog = 'symlog';
var types_Time = 'time';
var types_UTC = 'utc';
var types_Sequential = 'sequential';
var types_Diverging = 'diverging';
var types_Quantile = 'quantile';
var types_Quantize = 'quantize';
var types_Threshold = 'threshold';
var types_Ordinal = 'ordinal';
var types_Point = 'point';
var types_Band = 'band';
var types_BinOrdinal = 'bin-ordinal'; // categories

var types_Continuous = 'continuous';
var types_Discrete = 'discrete';
var types_Discretizing = 'discretizing';
var types_Interpolating = 'interpolating';
var types_Temporal = 'temporal';
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.number.is-finite.js
var es_number_is_finite = __webpack_require__("f00c");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.number.constructor.js
var es_number_constructor = __webpack_require__("a9e3");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.index-of.js
var es_array_index_of = __webpack_require__("c975");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.split.js
var es_string_split = __webpack_require__("1276");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/scales/invertRange.js
/* harmony default export */ var scales_invertRange = (function (scale) {
  return function (_) {
    var lo = _[0],
        hi = _[1],
        t;

    if (hi < lo) {
      t = lo;
      lo = hi;
      hi = t;
    }

    return [scale.invert(lo), scale.invert(hi)];
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/scales/invertRangeExtent.js
/* harmony default export */ var scales_invertRangeExtent = (function (scale) {
  return function (_) {
    var range = scale.range(),
        lo = _[0],
        hi = _[1],
        min = -1,
        max,
        t,
        i,
        n;

    if (hi < lo) {
      t = lo;
      lo = hi;
      hi = t;
    }

    for (i = 0, n = range.length; i < n; ++i) {
      if (range[i] >= lo && range[i] <= hi) {
        if (min < 0) min = i;
        max = i;
      }
    }

    if (min < 0) return undefined;
    lo = scale.invertExtent(range[min]);
    hi = scale.invertExtent(range[max]);
    return [lo[0] === undefined ? lo[1] : lo[0], hi[1] === undefined ? hi[0] : hi[1]];
  };
});
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.reverse.js
var es_array_reverse = __webpack_require__("26e9");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/scales/scaleBand.js






function scaleBand_band() {
  var scale = ordinal().unknown(undefined),
      domain = scale.domain,
      ordinalRange = scale.range,
      range = [0, 1],
      step,
      bandwidth,
      round = false,
      paddingInner = 0,
      paddingOuter = 0,
      align = 0.5;
  delete scale.unknown;

  function rescale() {
    var n = domain().length,
        reverse = range[1] < range[0],
        start = range[reverse - 0],
        stop = range[1 - reverse],
        space = scales_bandSpace(n, paddingInner, paddingOuter);
    step = (stop - start) / (space || 1);

    if (round) {
      step = Math.floor(step);
    }

    start += (stop - start - step * (n - paddingInner)) * align;
    bandwidth = step * (1 - paddingInner);

    if (round) {
      start = Math.round(start);
      bandwidth = Math.round(bandwidth);
    }

    var values = src_range(n).map(function (i) {
      return start + step * i;
    });
    return ordinalRange(reverse ? values.reverse() : values);
  }

  scale.domain = function (_) {
    if (arguments.length) {
      domain(_);
      return rescale();
    } else {
      return domain();
    }
  };

  scale.range = function (_) {
    if (arguments.length) {
      range = [+_[0], +_[1]];
      return rescale();
    } else {
      return range.slice();
    }
  };

  scale.rangeRound = function (_) {
    range = [+_[0], +_[1]];
    round = true;
    return rescale();
  };

  scale.bandwidth = function () {
    return bandwidth;
  };

  scale.step = function () {
    return step;
  };

  scale.round = function (_) {
    if (arguments.length) {
      round = !!_;
      return rescale();
    } else {
      return round;
    }
  };

  scale.padding = function (_) {
    if (arguments.length) {
      paddingOuter = Math.max(0, Math.min(1, _));
      paddingInner = paddingOuter;
      return rescale();
    } else {
      return paddingInner;
    }
  };

  scale.paddingInner = function (_) {
    if (arguments.length) {
      paddingInner = Math.max(0, Math.min(1, _));
      return rescale();
    } else {
      return paddingInner;
    }
  };

  scale.paddingOuter = function (_) {
    if (arguments.length) {
      paddingOuter = Math.max(0, Math.min(1, _));
      return rescale();
    } else {
      return paddingOuter;
    }
  };

  scale.align = function (_) {
    if (arguments.length) {
      align = Math.max(0, Math.min(1, _));
      return rescale();
    } else {
      return align;
    }
  };

  scale.invertRange = function (_) {
    // bail if range has null or undefined values
    if (_[0] == null || _[1] == null) return;
    var lo = +_[0],
        hi = +_[1],
        reverse = range[1] < range[0],
        values = reverse ? ordinalRange().reverse() : ordinalRange(),
        n = values.length - 1,
        a,
        b,
        t; // bail if either range endpoint is invalid

    if (lo !== lo || hi !== hi) return; // order range inputs, bail if outside of scale range

    if (hi < lo) {
      t = lo;
      lo = hi;
      hi = t;
    }

    if (hi < values[0] || lo > range[1 - reverse]) return; // binary search to index into scale range

    a = Math.max(0, bisectRight(values, lo) - 1);
    b = lo === hi ? a : bisectRight(values, hi) - 1; // increment index a if lo is within padding gap

    if (lo - values[a] > bandwidth + 1e-10) ++a;

    if (reverse) {
      // map + swap
      t = a;
      a = n - b;
      b = n - t;
    }

    return a > b ? undefined : domain().slice(a, b + 1);
  };

  scale.invert = function (_) {
    var value = scale.invertRange([_, _]);
    return value ? value[0] : value;
  };

  scale.copy = function () {
    return scaleBand_band().domain(domain()).range(range).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
  };

  return rescale();
}

function scaleBand_pointish(scale) {
  var copy = scale.copy;
  scale.padding = scale.paddingOuter;
  delete scale.paddingInner;

  scale.copy = function () {
    return scaleBand_pointish(copy());
  };

  return scale;
}

function scaleBand_point() {
  return scaleBand_pointish(scaleBand_band().paddingInner(1));
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/scales/numbers.js

var numbers_map = Array.prototype.map;
function numbers_numbers(_) {
  return numbers_map.call(_, function (x) {
    return +x;
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/scales/slice.js

var slice_slice = Array.prototype.slice;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/scales/scaleBinOrdinal.js






function scaleBinOrdinal_scaleBinOrdinal() {
  var domain = [],
      range = [];

  function scale(x) {
    return x == null || x !== x ? undefined : range[(src_bisect(domain, x) - 1) % range.length];
  }

  scale.domain = function (_) {
    if (arguments.length) {
      domain = numbers_numbers(_);
      return scale;
    } else {
      return domain.slice();
    }
  };

  scale.range = function (_) {
    if (arguments.length) {
      range = slice_slice.call(_);
      return scale;
    } else {
      return range.slice();
    }
  };

  scale.tickFormat = function (count, specifier) {
    return tickFormat_tickFormat(domain[0], src_peek(domain), count == null ? 10 : count, specifier);
  };

  scale.copy = function () {
    return scaleBinOrdinal_scaleBinOrdinal().domain(scale.domain()).range(scale.range());
  };

  return scale;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/scales.js







 // scale registry

var scales_scales = {};
/**
 * Augment scales with their type and needed inverse methods.
 */

function scales_create(type, constructor, metadata) {
  var ctr = function scale() {
    var s = constructor();

    if (!s.invertRange) {
      s.invertRange = s.invert ? scales_invertRange(s) : s.invertExtent ? scales_invertRangeExtent(s) : undefined;
    }

    s.type = type;
    return s;
  };

  ctr.metadata = toSet(vega_util_src_array(metadata));
  return ctr;
}

function scales_scale(type, scale, metadata) {
  if (arguments.length > 1) {
    scales_scales[type] = scales_create(type, scale, metadata);
    return this;
  } else {
    return scales_isValidScaleType(type) ? scales_scales[type] : undefined;
  }
} // identity scale

scales_scale(types_Identity, identity_identity); // continuous scales

scales_scale(types_Linear, linear_linear, types_Continuous);
scales_scale(types_Log, log_log, [types_Continuous, types_Log]);
scales_scale(types_Pow, pow_pow, types_Continuous);
scales_scale(types_Sqrt, pow_sqrt, types_Continuous);
scales_scale(types_Symlog, symlog, types_Continuous);
scales_scale(types_Time, time_time, [types_Continuous, types_Temporal]);
scales_scale(types_UTC, utcTime, [types_Continuous, types_Temporal]); // sequential scales

scales_scale(types_Sequential, sequential, [types_Continuous, types_Interpolating]); // backwards compat

scales_scale("".concat(types_Sequential, "-").concat(types_Linear), sequential, [types_Continuous, types_Interpolating]);
scales_scale("".concat(types_Sequential, "-").concat(types_Log), sequentialLog, [types_Continuous, types_Interpolating, types_Log]);
scales_scale("".concat(types_Sequential, "-").concat(types_Pow), sequentialPow, [types_Continuous, types_Interpolating]);
scales_scale("".concat(types_Sequential, "-").concat(types_Sqrt), sequentialSqrt, [types_Continuous, types_Interpolating]);
scales_scale("".concat(types_Sequential, "-").concat(types_Symlog), sequentialSymlog, [types_Continuous, types_Interpolating]); // diverging scales

scales_scale("".concat(types_Diverging, "-").concat(types_Linear), diverging, [types_Continuous, types_Interpolating]);
scales_scale("".concat(types_Diverging, "-").concat(types_Log), divergingLog, [types_Continuous, types_Interpolating, types_Log]);
scales_scale("".concat(types_Diverging, "-").concat(types_Pow), divergingPow, [types_Continuous, types_Interpolating]);
scales_scale("".concat(types_Diverging, "-").concat(types_Sqrt), divergingSqrt, [types_Continuous, types_Interpolating]);
scales_scale("".concat(types_Diverging, "-").concat(types_Symlog), divergingSymlog, [types_Continuous, types_Interpolating]); // discretizing scales

scales_scale(types_Quantile, src_quantile_quantile, [types_Discretizing, types_Quantile]);
scales_scale(types_Quantize, quantize, types_Discretizing);
scales_scale(types_Threshold, threshold_threshold, types_Discretizing); // discrete scales

scales_scale(types_BinOrdinal, scaleBinOrdinal_scaleBinOrdinal, [types_Discrete, types_Discretizing]);
scales_scale(types_Ordinal, ordinal, types_Discrete);
scales_scale(types_Band, scaleBand_band, types_Discrete);
scales_scale(types_Point, scaleBand_point, types_Discrete);
function scales_isValidScaleType(type) {
  return src_hasOwnProperty(scales_scales, type);
}

function scales_hasType(key, type) {
  var s = scales_scales[key];
  return s && s.metadata[type];
}

function scales_isContinuous(key) {
  return scales_hasType(key, types_Continuous);
}
function scales_isDiscrete(key) {
  return scales_hasType(key, types_Discrete);
}
function scales_isDiscretizing(key) {
  return scales_hasType(key, types_Discretizing);
}
function scales_isLogarithmic(key) {
  return scales_hasType(key, types_Log);
}
function scales_isTemporal(key) {
  return scales_hasType(key, types_Temporal);
}
function scales_isInterpolating(key) {
  return scales_hasType(key, types_Interpolating);
}
function scales_isQuantile(key) {
  return scales_hasType(key, types_Quantile);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/piecewise.js
function src_piecewise_piecewise(interpolate, values) {
  var i = 0,
      n = values.length - 1,
      v = values[0],
      I = new Array(n < 0 ? 0 : n);

  while (i < n) {
    I[i] = interpolate(v, v = values[++i]);
  }

  return function (t) {
    var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
    return I[i](t - i);
  };
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js







function _typeof(obj) {
  "@babel/helpers - typeof";

  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function _typeof(obj) {
      return typeof obj;
    };
  } else {
    _typeof = function _typeof(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }

  return _typeof(obj);
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.to-string.js
var es_regexp_to_string = __webpack_require__("25f0");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.constructor.js
var es_regexp_constructor = __webpack_require__("4d63");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.trim.js
var es_string_trim = __webpack_require__("498a");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.parse-int.js
var es_parse_int = __webpack_require__("e25e");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-color/src/define.js

/* harmony default export */ var src_define = (function (constructor, factory, prototype) {
  constructor.prototype = factory.prototype = prototype;
  prototype.constructor = constructor;
});
function define_extend(parent, definition) {
  var prototype = Object.create(parent.prototype);

  for (var key in definition) {
    prototype[key] = definition[key];
  }

  return prototype;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-color/src/color.js









function color_Color() {}
var _darker = 0.7;


var _brighter = 1 / _darker;


var color_reI = "\\s*([+-]?\\d+)\\s*",
    color_reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
    color_reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
    color_reHex = /^#([0-9a-f]{3,8})$/,
    color_reRgbInteger = new RegExp("^rgb\\(" + [color_reI, color_reI, color_reI] + "\\)$"),
    color_reRgbPercent = new RegExp("^rgb\\(" + [color_reP, color_reP, color_reP] + "\\)$"),
    color_reRgbaInteger = new RegExp("^rgba\\(" + [color_reI, color_reI, color_reI, color_reN] + "\\)$"),
    color_reRgbaPercent = new RegExp("^rgba\\(" + [color_reP, color_reP, color_reP, color_reN] + "\\)$"),
    color_reHslPercent = new RegExp("^hsl\\(" + [color_reN, color_reP, color_reP] + "\\)$"),
    color_reHslaPercent = new RegExp("^hsla\\(" + [color_reN, color_reP, color_reP, color_reN] + "\\)$");
var color_named = {
  aliceblue: 0xf0f8ff,
  antiquewhite: 0xfaebd7,
  aqua: 0x00ffff,
  aquamarine: 0x7fffd4,
  azure: 0xf0ffff,
  beige: 0xf5f5dc,
  bisque: 0xffe4c4,
  black: 0x000000,
  blanchedalmond: 0xffebcd,
  blue: 0x0000ff,
  blueviolet: 0x8a2be2,
  brown: 0xa52a2a,
  burlywood: 0xdeb887,
  cadetblue: 0x5f9ea0,
  chartreuse: 0x7fff00,
  chocolate: 0xd2691e,
  coral: 0xff7f50,
  cornflowerblue: 0x6495ed,
  cornsilk: 0xfff8dc,
  crimson: 0xdc143c,
  cyan: 0x00ffff,
  darkblue: 0x00008b,
  darkcyan: 0x008b8b,
  darkgoldenrod: 0xb8860b,
  darkgray: 0xa9a9a9,
  darkgreen: 0x006400,
  darkgrey: 0xa9a9a9,
  darkkhaki: 0xbdb76b,
  darkmagenta: 0x8b008b,
  darkolivegreen: 0x556b2f,
  darkorange: 0xff8c00,
  darkorchid: 0x9932cc,
  darkred: 0x8b0000,
  darksalmon: 0xe9967a,
  darkseagreen: 0x8fbc8f,
  darkslateblue: 0x483d8b,
  darkslategray: 0x2f4f4f,
  darkslategrey: 0x2f4f4f,
  darkturquoise: 0x00ced1,
  darkviolet: 0x9400d3,
  deeppink: 0xff1493,
  deepskyblue: 0x00bfff,
  dimgray: 0x696969,
  dimgrey: 0x696969,
  dodgerblue: 0x1e90ff,
  firebrick: 0xb22222,
  floralwhite: 0xfffaf0,
  forestgreen: 0x228b22,
  fuchsia: 0xff00ff,
  gainsboro: 0xdcdcdc,
  ghostwhite: 0xf8f8ff,
  gold: 0xffd700,
  goldenrod: 0xdaa520,
  gray: 0x808080,
  green: 0x008000,
  greenyellow: 0xadff2f,
  grey: 0x808080,
  honeydew: 0xf0fff0,
  hotpink: 0xff69b4,
  indianred: 0xcd5c5c,
  indigo: 0x4b0082,
  ivory: 0xfffff0,
  khaki: 0xf0e68c,
  lavender: 0xe6e6fa,
  lavenderblush: 0xfff0f5,
  lawngreen: 0x7cfc00,
  lemonchiffon: 0xfffacd,
  lightblue: 0xadd8e6,
  lightcoral: 0xf08080,
  lightcyan: 0xe0ffff,
  lightgoldenrodyellow: 0xfafad2,
  lightgray: 0xd3d3d3,
  lightgreen: 0x90ee90,
  lightgrey: 0xd3d3d3,
  lightpink: 0xffb6c1,
  lightsalmon: 0xffa07a,
  lightseagreen: 0x20b2aa,
  lightskyblue: 0x87cefa,
  lightslategray: 0x778899,
  lightslategrey: 0x778899,
  lightsteelblue: 0xb0c4de,
  lightyellow: 0xffffe0,
  lime: 0x00ff00,
  limegreen: 0x32cd32,
  linen: 0xfaf0e6,
  magenta: 0xff00ff,
  maroon: 0x800000,
  mediumaquamarine: 0x66cdaa,
  mediumblue: 0x0000cd,
  mediumorchid: 0xba55d3,
  mediumpurple: 0x9370db,
  mediumseagreen: 0x3cb371,
  mediumslateblue: 0x7b68ee,
  mediumspringgreen: 0x00fa9a,
  mediumturquoise: 0x48d1cc,
  mediumvioletred: 0xc71585,
  midnightblue: 0x191970,
  mintcream: 0xf5fffa,
  mistyrose: 0xffe4e1,
  moccasin: 0xffe4b5,
  navajowhite: 0xffdead,
  navy: 0x000080,
  oldlace: 0xfdf5e6,
  olive: 0x808000,
  olivedrab: 0x6b8e23,
  orange: 0xffa500,
  orangered: 0xff4500,
  orchid: 0xda70d6,
  palegoldenrod: 0xeee8aa,
  palegreen: 0x98fb98,
  paleturquoise: 0xafeeee,
  palevioletred: 0xdb7093,
  papayawhip: 0xffefd5,
  peachpuff: 0xffdab9,
  peru: 0xcd853f,
  pink: 0xffc0cb,
  plum: 0xdda0dd,
  powderblue: 0xb0e0e6,
  purple: 0x800080,
  rebeccapurple: 0x663399,
  red: 0xff0000,
  rosybrown: 0xbc8f8f,
  royalblue: 0x4169e1,
  saddlebrown: 0x8b4513,
  salmon: 0xfa8072,
  sandybrown: 0xf4a460,
  seagreen: 0x2e8b57,
  seashell: 0xfff5ee,
  sienna: 0xa0522d,
  silver: 0xc0c0c0,
  skyblue: 0x87ceeb,
  slateblue: 0x6a5acd,
  slategray: 0x708090,
  slategrey: 0x708090,
  snow: 0xfffafa,
  springgreen: 0x00ff7f,
  steelblue: 0x4682b4,
  tan: 0xd2b48c,
  teal: 0x008080,
  thistle: 0xd8bfd8,
  tomato: 0xff6347,
  turquoise: 0x40e0d0,
  violet: 0xee82ee,
  wheat: 0xf5deb3,
  white: 0xffffff,
  whitesmoke: 0xf5f5f5,
  yellow: 0xffff00,
  yellowgreen: 0x9acd32
};
src_define(color_Color, src_color_color, {
  copy: function copy(channels) {
    return Object.assign(new this.constructor(), this, channels);
  },
  displayable: function displayable() {
    return this.rgb().displayable();
  },
  hex: color_color_formatHex,
  // Deprecated! Use color.formatHex.
  formatHex: color_color_formatHex,
  formatHsl: color_color_formatHsl,
  formatRgb: color_color_formatRgb,
  toString: color_color_formatRgb
});

function color_color_formatHex() {
  return this.rgb().formatHex();
}

function color_color_formatHsl() {
  return color_hslConvert(this).formatHsl();
}

function color_color_formatRgb() {
  return this.rgb().formatRgb();
}

function src_color_color(format) {
  var m, l;
  format = (format + "").trim().toLowerCase();
  return (m = color_reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? color_rgbn(m) // #ff0000
  : l === 3 ? new color_Rgb(m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1) // #f00
  : l === 8 ? color_rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
  : l === 4 ? color_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
  : null // invalid hex
  ) : (m = color_reRgbInteger.exec(format)) ? new color_Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
  : (m = color_reRgbPercent.exec(format)) ? new color_Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
  : (m = color_reRgbaInteger.exec(format)) ? color_rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
  : (m = color_reRgbaPercent.exec(format)) ? color_rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
  : (m = color_reHslPercent.exec(format)) ? color_hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
  : (m = color_reHslaPercent.exec(format)) ? color_hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
  : color_named.hasOwnProperty(format) ? color_rgbn(color_named[format]) // eslint-disable-line no-prototype-builtins
  : format === "transparent" ? new color_Rgb(NaN, NaN, NaN, 0) : null;
}

function color_rgbn(n) {
  return new color_Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
}

function color_rgba(r, g, b, a) {
  if (a <= 0) r = g = b = NaN;
  return new color_Rgb(r, g, b, a);
}

function color_rgbConvert(o) {
  if (!(o instanceof color_Color)) o = src_color_color(o);
  if (!o) return new color_Rgb();
  o = o.rgb();
  return new color_Rgb(o.r, o.g, o.b, o.opacity);
}
function src_color_rgb(r, g, b, opacity) {
  return arguments.length === 1 ? color_rgbConvert(r) : new color_Rgb(r, g, b, opacity == null ? 1 : opacity);
}
function color_Rgb(r, g, b, opacity) {
  this.r = +r;
  this.g = +g;
  this.b = +b;
  this.opacity = +opacity;
}
src_define(color_Rgb, src_color_rgb, define_extend(color_Color, {
  brighter: function brighter(k) {
    k = k == null ? _brighter : Math.pow(_brighter, k);
    return new color_Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  },
  darker: function darker(k) {
    k = k == null ? _darker : Math.pow(_darker, k);
    return new color_Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  },
  rgb: function rgb() {
    return this;
  },
  displayable: function displayable() {
    return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
  },
  hex: color_rgb_formatHex,
  // Deprecated! Use color.formatHex.
  formatHex: color_rgb_formatHex,
  formatRgb: color_rgb_formatRgb,
  toString: color_rgb_formatRgb
}));

function color_rgb_formatHex() {
  return "#" + color_hex(this.r) + color_hex(this.g) + color_hex(this.b);
}

function color_rgb_formatRgb() {
  var a = this.opacity;
  a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
  return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")");
}

function color_hex(value) {
  value = Math.max(0, Math.min(255, Math.round(value) || 0));
  return (value < 16 ? "0" : "") + value.toString(16);
}

function color_hsla(h, s, l, a) {
  if (a <= 0) h = s = l = NaN;else if (l <= 0 || l >= 1) h = s = NaN;else if (s <= 0) h = NaN;
  return new color_Hsl(h, s, l, a);
}

function color_hslConvert(o) {
  if (o instanceof color_Hsl) return new color_Hsl(o.h, o.s, o.l, o.opacity);
  if (!(o instanceof color_Color)) o = src_color_color(o);
  if (!o) return new color_Hsl();
  if (o instanceof color_Hsl) return o;
  o = o.rgb();
  var r = o.r / 255,
      g = o.g / 255,
      b = o.b / 255,
      min = Math.min(r, g, b),
      max = Math.max(r, g, b),
      h = NaN,
      s = max - min,
      l = (max + min) / 2;

  if (s) {
    if (r === max) h = (g - b) / s + (g < b) * 6;else if (g === max) h = (b - r) / s + 2;else h = (r - g) / s + 4;
    s /= l < 0.5 ? max + min : 2 - max - min;
    h *= 60;
  } else {
    s = l > 0 && l < 1 ? 0 : h;
  }

  return new color_Hsl(h, s, l, o.opacity);
}
function color_hsl(h, s, l, opacity) {
  return arguments.length === 1 ? color_hslConvert(h) : new color_Hsl(h, s, l, opacity == null ? 1 : opacity);
}

function color_Hsl(h, s, l, opacity) {
  this.h = +h;
  this.s = +s;
  this.l = +l;
  this.opacity = +opacity;
}

src_define(color_Hsl, color_hsl, define_extend(color_Color, {
  brighter: function brighter(k) {
    k = k == null ? _brighter : Math.pow(_brighter, k);
    return new color_Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  darker: function darker(k) {
    k = k == null ? _darker : Math.pow(_darker, k);
    return new color_Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  rgb: function rgb() {
    var h = this.h % 360 + (this.h < 0) * 360,
        s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
        l = this.l,
        m2 = l + (l < 0.5 ? l : 1 - l) * s,
        m1 = 2 * l - m2;
    return new color_Rgb(color_hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), color_hsl2rgb(h, m1, m2), color_hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
  },
  displayable: function displayable() {
    return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
  },
  formatHsl: function formatHsl() {
    var a = this.opacity;
    a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
    return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")");
  }
}));
/* From FvD 13.37, CSS Color Module Level 3 */

function color_hsl2rgb(h, m1, m2) {
  return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/basis.js
function src_basis_basis(t1, v0, v1, v2, v3) {
  var t2 = t1 * t1,
      t3 = t2 * t1;
  return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
}
/* harmony default export */ var d3_interpolate_src_basis = (function (values) {
  var n = values.length - 1;
  return function (t) {
    var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
        v1 = values[i],
        v2 = values[i + 1],
        v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
        v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
    return src_basis_basis((t - i / n) * n, v0, v1, v2, v3);
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/basisClosed.js

/* harmony default export */ var d3_interpolate_src_basisClosed = (function (values) {
  var n = values.length;
  return function (t) {
    var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
        v0 = values[(i + n - 1) % n],
        v1 = values[i % n],
        v2 = values[(i + 1) % n],
        v3 = values[(i + 2) % n];
    return src_basis_basis((t - i / n) * n, v0, v1, v2, v3);
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/constant.js
/* harmony default export */ var node_modules_d3_interpolate_src_constant = (function (x) {
  return function () {
    return x;
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/color.js


function src_color_linear(a, d) {
  return function (t) {
    return a + t * d;
  };
}

function color_exponential(a, b, y) {
  return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function (t) {
    return Math.pow(a + t * b, y);
  };
}

function src_color_hue(a, b) {
  var d = b - a;
  return d ? src_color_linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : node_modules_d3_interpolate_src_constant(isNaN(a) ? b : a);
}
function src_color_gamma(y) {
  return (y = +y) === 1 ? color_nogamma : function (a, b) {
    return b - a ? color_exponential(a, b, y) : node_modules_d3_interpolate_src_constant(isNaN(a) ? b : a);
  };
}
function color_nogamma(a, b) {
  var d = b - a;
  return d ? src_color_linear(a, d) : node_modules_d3_interpolate_src_constant(isNaN(a) ? b : a);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/rgb.js




/* harmony default export */ var d3_interpolate_src_rgb = ((function rgbGamma(y) {
  var color = src_color_gamma(y);

  function rgb(start, end) {
    var r = color((start = src_color_rgb(start)).r, (end = src_color_rgb(end)).r),
        g = color(start.g, end.g),
        b = color(start.b, end.b),
        opacity = color_nogamma(start.opacity, end.opacity);
    return function (t) {
      start.r = r(t);
      start.g = g(t);
      start.b = b(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }

  rgb.gamma = rgbGamma;
  return rgb;
})(1));

function rgb_rgbSpline(spline) {
  return function (colors) {
    var n = colors.length,
        r = new Array(n),
        g = new Array(n),
        b = new Array(n),
        i,
        color;

    for (i = 0; i < n; ++i) {
      color = src_color_rgb(colors[i]);
      r[i] = color.r || 0;
      g[i] = color.g || 0;
      b[i] = color.b || 0;
    }

    r = spline(r);
    g = spline(g);
    b = spline(b);
    color.opacity = 1;
    return function (t) {
      color.r = r(t);
      color.g = g(t);
      color.b = b(t);
      return color + "";
    };
  };
}

var rgb_rgbBasis = rgb_rgbSpline(d3_interpolate_src_basis);
var rgb_rgbBasisClosed = rgb_rgbSpline(d3_interpolate_src_basisClosed);
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.is-view.js
var es_array_buffer_is_view = __webpack_require__("82da");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.constructor.js
var es_array_buffer_constructor = __webpack_require__("c19f");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.slice.js
var es_array_buffer_slice = __webpack_require__("ace4");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.data-view.js
var es_data_view = __webpack_require__("b420");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/numberArray.js






/* harmony default export */ var src_numberArray = (function (a, b) {
  if (!b) b = [];
  var n = a ? Math.min(b.length, a.length) : 0,
      c = b.slice(),
      i;
  return function (t) {
    for (i = 0; i < n; ++i) {
      c[i] = a[i] * (1 - t) + b[i] * t;
    }

    return c;
  };
});
function numberArray_isNumberArray(x) {
  return ArrayBuffer.isView(x) && !(x instanceof DataView);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/array.js


/* harmony default export */ var node_modules_d3_interpolate_src_array = (function (a, b) {
  return (numberArray_isNumberArray(b) ? src_numberArray : array_genericArray)(a, b);
});
function array_genericArray(a, b) {
  var nb = b ? b.length : 0,
      na = a ? Math.min(nb, a.length) : 0,
      x = new Array(na),
      c = new Array(nb),
      i;

  for (i = 0; i < na; ++i) {
    x[i] = d3_interpolate_src_value(a[i], b[i]);
  }

  for (; i < nb; ++i) {
    c[i] = b[i];
  }

  return function (t) {
    for (i = 0; i < na; ++i) {
      c[i] = x[i](t);
    }

    return c;
  };
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/date.js

/* harmony default export */ var d3_interpolate_src_date = (function (a, b) {
  var d = new Date();
  return a = +a, b = +b, function (t) {
    return d.setTime(a * (1 - t) + b * t), d;
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/number.js
/* harmony default export */ var d3_interpolate_src_number = (function (a, b) {
  return a = +a, b = +b, function (t) {
    return a * (1 - t) + b * t;
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/object.js


/* harmony default export */ var d3_interpolate_src_object = (function (a, b) {
  var i = {},
      c = {},
      k;
  if (a === null || _typeof(a) !== "object") a = {};
  if (b === null || _typeof(b) !== "object") b = {};

  for (k in b) {
    if (k in a) {
      i[k] = d3_interpolate_src_value(a[k], b[k]);
    } else {
      c[k] = b[k];
    }
  }

  return function (t) {
    for (k in i) {
      c[k] = i[k](t);
    }

    return c;
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/string.js






var string_reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
    string_reB = new RegExp(string_reA.source, "g");

function src_string_zero(b) {
  return function () {
    return b;
  };
}

function string_one(b) {
  return function (t) {
    return b(t) + "";
  };
}

/* harmony default export */ var d3_interpolate_src_string = (function (a, b) {
  var bi = string_reA.lastIndex = string_reB.lastIndex = 0,
      // scan index for next number in b
  am,
      // current match in a
  bm,
      // current match in b
  bs,
      // string preceding current number in b, if any
  i = -1,
      // index in s
  s = [],
      // string constants and placeholders
  q = []; // number interpolators
  // Coerce inputs to strings.

  a = a + "", b = b + ""; // Interpolate pairs of numbers in a & b.

  while ((am = string_reA.exec(a)) && (bm = string_reB.exec(b))) {
    if ((bs = bm.index) > bi) {
      // a string precedes the next number in b
      bs = b.slice(bi, bs);
      if (s[i]) s[i] += bs; // coalesce with previous string
      else s[++i] = bs;
    }

    if ((am = am[0]) === (bm = bm[0])) {
      // numbers in a & b match
      if (s[i]) s[i] += bm; // coalesce with previous string
      else s[++i] = bm;
    } else {
      // interpolate non-matching numbers
      s[++i] = null;
      q.push({
        i: i,
        x: d3_interpolate_src_number(am, bm)
      });
    }

    bi = string_reB.lastIndex;
  } // Add remains of b.


  if (bi < b.length) {
    bs = b.slice(bi);
    if (s[i]) s[i] += bs; // coalesce with previous string
    else s[++i] = bs;
  } // Special optimization for only a single match.
  // Otherwise, interpolate each of the numbers and rejoin the string.


  return s.length < 2 ? q[0] ? string_one(q[0].x) : src_string_zero(b) : (b = q.length, function (t) {
    for (var i = 0, o; i < b; ++i) {
      s[(o = q[i]).i] = o.x(t);
    }

    return s.join("");
  });
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/value.js














/* harmony default export */ var d3_interpolate_src_value = (function (a, b) {
  var t = _typeof(b),
      c;

  return b == null || t === "boolean" ? node_modules_d3_interpolate_src_constant(b) : (t === "number" ? d3_interpolate_src_number : t === "string" ? (c = src_color_color(b)) ? (b = c, d3_interpolate_src_rgb) : d3_interpolate_src_string : b instanceof src_color_color ? d3_interpolate_src_rgb : b instanceof Date ? d3_interpolate_src_date : numberArray_isNumberArray(b) ? src_numberArray : Array.isArray(b) ? array_genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? d3_interpolate_src_object : d3_interpolate_src_number)(a, b);
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/discrete.js
/* harmony default export */ var src_discrete = (function (range) {
  var n = range.length;
  return function (t) {
    return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/hue.js

/* harmony default export */ var d3_interpolate_src_hue = (function (a, b) {
  var i = src_color_hue(+a, +b);
  return function (t) {
    var x = i(t);
    return x - 360 * Math.floor(x / 360);
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/round.js
/* harmony default export */ var d3_interpolate_src_round = (function (a, b) {
  return a = +a, b = +b, function (t) {
    return Math.round(a * (1 - t) + b * t);
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/transform/decompose.js
var decompose_degrees = 180 / Math.PI;
var transform_decompose_identity = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};
/* harmony default export */ var transform_decompose = (function (a, b, c, d, e, f) {
  var scaleX, scaleY, skewX;
  if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
  if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
  if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
  if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
  return {
    translateX: e,
    translateY: f,
    rotate: Math.atan2(b, a) * decompose_degrees,
    skewX: Math.atan(skewX) * decompose_degrees,
    scaleX: scaleX,
    scaleY: scaleY
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/transform/parse.js




var cssNode, cssRoot, cssView, parse_svgNode;
function parse_parseCss(value) {
  if (value === "none") return transform_decompose_identity;
  if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
  cssNode.style.transform = value;
  value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
  cssRoot.removeChild(cssNode);
  value = value.slice(7, -1).split(",");
  return transform_decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
}
function parse_parseSvg(value) {
  if (value == null) return transform_decompose_identity;
  if (!parse_svgNode) parse_svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
  parse_svgNode.setAttribute("transform", value);
  if (!(value = parse_svgNode.transform.baseVal.consolidate())) return transform_decompose_identity;
  value = value.matrix;
  return transform_decompose(value.a, value.b, value.c, value.d, value.e, value.f);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/transform/index.js




function transform_interpolateTransform(parse, pxComma, pxParen, degParen) {
  function pop(s) {
    return s.length ? s.pop() + " " : "";
  }

  function translate(xa, ya, xb, yb, s, q) {
    if (xa !== xb || ya !== yb) {
      var i = s.push("translate(", null, pxComma, null, pxParen);
      q.push({
        i: i - 4,
        x: d3_interpolate_src_number(xa, xb)
      }, {
        i: i - 2,
        x: d3_interpolate_src_number(ya, yb)
      });
    } else if (xb || yb) {
      s.push("translate(" + xb + pxComma + yb + pxParen);
    }
  }

  function rotate(a, b, s, q) {
    if (a !== b) {
      if (a - b > 180) b += 360;else if (b - a > 180) a += 360; // shortest path

      q.push({
        i: s.push(pop(s) + "rotate(", null, degParen) - 2,
        x: d3_interpolate_src_number(a, b)
      });
    } else if (b) {
      s.push(pop(s) + "rotate(" + b + degParen);
    }
  }

  function skewX(a, b, s, q) {
    if (a !== b) {
      q.push({
        i: s.push(pop(s) + "skewX(", null, degParen) - 2,
        x: d3_interpolate_src_number(a, b)
      });
    } else if (b) {
      s.push(pop(s) + "skewX(" + b + degParen);
    }
  }

  function scale(xa, ya, xb, yb, s, q) {
    if (xa !== xb || ya !== yb) {
      var i = s.push(pop(s) + "scale(", null, ",", null, ")");
      q.push({
        i: i - 4,
        x: d3_interpolate_src_number(xa, xb)
      }, {
        i: i - 2,
        x: d3_interpolate_src_number(ya, yb)
      });
    } else if (xb !== 1 || yb !== 1) {
      s.push(pop(s) + "scale(" + xb + "," + yb + ")");
    }
  }

  return function (a, b) {
    var s = [],
        // string constants and placeholders
    q = []; // number interpolators

    a = parse(a), b = parse(b);
    translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
    rotate(a.rotate, b.rotate, s, q);
    skewX(a.skewX, b.skewX, s, q);
    scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
    a = b = null; // gc

    return function (t) {
      var i = -1,
          n = q.length,
          o;

      while (++i < n) {
        s[(o = q[i]).i] = o.x(t);
      }

      return s.join("");
    };
  };
}

var transform_interpolateTransformCss = transform_interpolateTransform(parse_parseCss, "px, ", "px)", "deg)");
var transform_interpolateTransformSvg = transform_interpolateTransform(parse_parseSvg, ", ", ")", ")");
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/zoom.js
var rho = Math.SQRT2,
    rho2 = 2,
    rho4 = 4,
    zoom_epsilon2 = 1e-12;

function src_zoom_cosh(x) {
  return ((x = Math.exp(x)) + 1 / x) / 2;
}

function src_zoom_sinh(x) {
  return ((x = Math.exp(x)) - 1 / x) / 2;
}

function zoom_tanh(x) {
  return ((x = Math.exp(2 * x)) - 1) / (x + 1);
} // p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]


/* harmony default export */ var src_zoom = (function (p0, p1) {
  var ux0 = p0[0],
      uy0 = p0[1],
      w0 = p0[2],
      ux1 = p1[0],
      uy1 = p1[1],
      w1 = p1[2],
      dx = ux1 - ux0,
      dy = uy1 - uy0,
      d2 = dx * dx + dy * dy,
      i,
      S; // Special case for u0 ≅ u1.

  if (d2 < zoom_epsilon2) {
    S = Math.log(w1 / w0) / rho;

    i = function i(t) {
      return [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S)];
    };
  } // General case.
  else {
    var d1 = Math.sqrt(d2),
        b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
        b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
        r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
        r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
    S = (r1 - r0) / rho;

    i = function i(t) {
      var s = t * S,
          coshr0 = src_zoom_cosh(r0),
          u = w0 / (rho2 * d1) * (coshr0 * zoom_tanh(rho * s + r0) - src_zoom_sinh(r0));
      return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / src_zoom_cosh(rho * s + r0)];
    };
  }

  i.duration = S * 1000;
  return i;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/hsl.js



function src_hsl_hsl(hue) {
  return function (start, end) {
    var h = hue((start = color_hsl(start)).h, (end = color_hsl(end)).h),
        s = color_nogamma(start.s, end.s),
        l = color_nogamma(start.l, end.l),
        opacity = color_nogamma(start.opacity, end.opacity);
    return function (t) {
      start.h = h(t);
      start.s = s(t);
      start.l = l(t);
      start.opacity = opacity(t);
      return start + "";
    };
  };
}

/* harmony default export */ var d3_interpolate_src_hsl = (src_hsl_hsl(src_color_hue));
var hsl_hslLong = src_hsl_hsl(color_nogamma);
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-color/src/math.js
var deg2rad = Math.PI / 180;
var rad2deg = 180 / Math.PI;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-color/src/lab.js


 // https://observablehq.com/@mbostock/lab-and-rgb

var lab_K = 18,
    lab_Xn = 0.96422,
    lab_Yn = 1,
    lab_Zn = 0.82521,
    src_lab_t0 = 4 / 29,
    src_lab_t1 = 6 / 29,
    src_lab_t2 = 3 * src_lab_t1 * src_lab_t1,
    lab_t3 = src_lab_t1 * src_lab_t1 * src_lab_t1;

function lab_labConvert(o) {
  if (o instanceof lab_Lab) return new lab_Lab(o.l, o.a, o.b, o.opacity);
  if (o instanceof lab_Hcl) return lab_hcl2lab(o);
  if (!(o instanceof color_Rgb)) o = color_rgbConvert(o);
  var r = lab_rgb2lrgb(o.r),
      g = lab_rgb2lrgb(o.g),
      b = lab_rgb2lrgb(o.b),
      y = lab_xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / lab_Yn),
      x,
      z;
  if (r === g && g === b) x = z = y;else {
    x = lab_xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / lab_Xn);
    z = lab_xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / lab_Zn);
  }
  return new lab_Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
}

function lab_gray(l, opacity) {
  return new lab_Lab(l, 0, 0, opacity == null ? 1 : opacity);
}
function src_lab_lab(l, a, b, opacity) {
  return arguments.length === 1 ? lab_labConvert(l) : new lab_Lab(l, a, b, opacity == null ? 1 : opacity);
}
function lab_Lab(l, a, b, opacity) {
  this.l = +l;
  this.a = +a;
  this.b = +b;
  this.opacity = +opacity;
}
src_define(lab_Lab, src_lab_lab, define_extend(color_Color, {
  brighter: function brighter(k) {
    return new lab_Lab(this.l + lab_K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  },
  darker: function darker(k) {
    return new lab_Lab(this.l - lab_K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  },
  rgb: function rgb() {
    var y = (this.l + 16) / 116,
        x = isNaN(this.a) ? y : y + this.a / 500,
        z = isNaN(this.b) ? y : y - this.b / 200;
    x = lab_Xn * lab_lab2xyz(x);
    y = lab_Yn * lab_lab2xyz(y);
    z = lab_Zn * lab_lab2xyz(z);
    return new color_Rgb(lab_lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lab_lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lab_lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity);
  }
}));

function lab_xyz2lab(t) {
  return t > lab_t3 ? Math.pow(t, 1 / 3) : t / src_lab_t2 + src_lab_t0;
}

function lab_lab2xyz(t) {
  return t > src_lab_t1 ? t * t * t : src_lab_t2 * (t - src_lab_t0);
}

function lab_lrgb2rgb(x) {
  return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}

function lab_rgb2lrgb(x) {
  return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
}

function lab_hclConvert(o) {
  if (o instanceof lab_Hcl) return new lab_Hcl(o.h, o.c, o.l, o.opacity);
  if (!(o instanceof lab_Lab)) o = lab_labConvert(o);
  if (o.a === 0 && o.b === 0) return new lab_Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
  var h = Math.atan2(o.b, o.a) * rad2deg;
  return new lab_Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
}

function lab_lch(l, c, h, opacity) {
  return arguments.length === 1 ? lab_hclConvert(l) : new lab_Hcl(h, c, l, opacity == null ? 1 : opacity);
}
function lab_hcl(h, c, l, opacity) {
  return arguments.length === 1 ? lab_hclConvert(h) : new lab_Hcl(h, c, l, opacity == null ? 1 : opacity);
}
function lab_Hcl(h, c, l, opacity) {
  this.h = +h;
  this.c = +c;
  this.l = +l;
  this.opacity = +opacity;
}

function lab_hcl2lab(o) {
  if (isNaN(o.h)) return new lab_Lab(o.l, 0, 0, o.opacity);
  var h = o.h * deg2rad;
  return new lab_Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}

src_define(lab_Hcl, lab_hcl, define_extend(color_Color, {
  brighter: function brighter(k) {
    return new lab_Hcl(this.h, this.c, this.l + lab_K * (k == null ? 1 : k), this.opacity);
  },
  darker: function darker(k) {
    return new lab_Hcl(this.h, this.c, this.l - lab_K * (k == null ? 1 : k), this.opacity);
  },
  rgb: function rgb() {
    return lab_hcl2lab(this).rgb();
  }
}));
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/lab.js


function d3_interpolate_src_lab_lab(start, end) {
  var l = color_nogamma((start = src_lab_lab(start)).l, (end = src_lab_lab(end)).l),
      a = color_nogamma(start.a, end.a),
      b = color_nogamma(start.b, end.b),
      opacity = color_nogamma(start.opacity, end.opacity);
  return function (t) {
    start.l = l(t);
    start.a = a(t);
    start.b = b(t);
    start.opacity = opacity(t);
    return start + "";
  };
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/hcl.js



function src_hcl_hcl(hue) {
  return function (start, end) {
    var h = hue((start = lab_hcl(start)).h, (end = lab_hcl(end)).h),
        c = color_nogamma(start.c, end.c),
        l = color_nogamma(start.l, end.l),
        opacity = color_nogamma(start.opacity, end.opacity);
    return function (t) {
      start.h = h(t);
      start.c = c(t);
      start.l = l(t);
      start.opacity = opacity(t);
      return start + "";
    };
  };
}

/* harmony default export */ var d3_interpolate_src_hcl = (src_hcl_hcl(src_color_hue));
var hcl_hclLong = src_hcl_hcl(color_nogamma);
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-color/src/cubehelix.js



var src_cubehelix_A = -0.14861,
    src_cubehelix_B = +1.78277,
    cubehelix_C = -0.29227,
    src_cubehelix_D = -0.90649,
    cubehelix_E = +1.97294,
    cubehelix_ED = cubehelix_E * src_cubehelix_D,
    cubehelix_EB = cubehelix_E * src_cubehelix_B,
    cubehelix_BC_DA = src_cubehelix_B * cubehelix_C - src_cubehelix_D * src_cubehelix_A;

function cubehelix_cubehelixConvert(o) {
  if (o instanceof cubehelix_Cubehelix) return new cubehelix_Cubehelix(o.h, o.s, o.l, o.opacity);
  if (!(o instanceof color_Rgb)) o = color_rgbConvert(o);
  var r = o.r / 255,
      g = o.g / 255,
      b = o.b / 255,
      l = (cubehelix_BC_DA * b + cubehelix_ED * r - cubehelix_EB * g) / (cubehelix_BC_DA + cubehelix_ED - cubehelix_EB),
      bl = b - l,
      k = (cubehelix_E * (g - l) - cubehelix_C * bl) / src_cubehelix_D,
      s = Math.sqrt(k * k + bl * bl) / (cubehelix_E * l * (1 - l)),
      // NaN if l=0 or l=1
  h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
  return new cubehelix_Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}

function d3_color_src_cubehelix_cubehelix(h, s, l, opacity) {
  return arguments.length === 1 ? cubehelix_cubehelixConvert(h) : new cubehelix_Cubehelix(h, s, l, opacity == null ? 1 : opacity);
}
function cubehelix_Cubehelix(h, s, l, opacity) {
  this.h = +h;
  this.s = +s;
  this.l = +l;
  this.opacity = +opacity;
}
src_define(cubehelix_Cubehelix, d3_color_src_cubehelix_cubehelix, define_extend(color_Color, {
  brighter: function brighter(k) {
    k = k == null ? _brighter : Math.pow(_brighter, k);
    return new cubehelix_Cubehelix(this.h, this.s, this.l * k, this.opacity);
  },
  darker: function darker(k) {
    k = k == null ? _darker : Math.pow(_darker, k);
    return new cubehelix_Cubehelix(this.h, this.s, this.l * k, this.opacity);
  },
  rgb: function rgb() {
    var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
        l = +this.l,
        a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
        cosh = Math.cos(h),
        sinh = Math.sin(h);
    return new color_Rgb(255 * (l + a * (src_cubehelix_A * cosh + src_cubehelix_B * sinh)), 255 * (l + a * (cubehelix_C * cosh + src_cubehelix_D * sinh)), 255 * (l + a * (cubehelix_E * cosh)), this.opacity);
  }
}));
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/cubehelix.js



function d3_interpolate_src_cubehelix_cubehelix(hue) {
  return function cubehelixGamma(y) {
    y = +y;

    function cubehelix(start, end) {
      var h = hue((start = d3_color_src_cubehelix_cubehelix(start)).h, (end = d3_color_src_cubehelix_cubehelix(end)).h),
          s = color_nogamma(start.s, end.s),
          l = color_nogamma(start.l, end.l),
          opacity = color_nogamma(start.opacity, end.opacity);
      return function (t) {
        start.h = h(t);
        start.s = s(t);
        start.l = l(Math.pow(t, y));
        start.opacity = opacity(t);
        return start + "";
      };
    }

    cubehelix.gamma = cubehelixGamma;
    return cubehelix;
  }(1);
}

/* harmony default export */ var d3_interpolate_src_cubehelix = (d3_interpolate_src_cubehelix_cubehelix(src_color_hue));
var cubehelix_cubehelixLong = d3_interpolate_src_cubehelix_cubehelix(color_nogamma);
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/quantize.js
/* harmony default export */ var d3_interpolate_src_quantize = (function (interpolator, n) {
  var samples = new Array(n);

  for (var i = 0; i < n; ++i) {
    samples[i] = interpolator(i / (n - 1));
  }

  return samples;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-interpolate/src/index.js





















// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/interpolate.js












var interpolate_scaleProps = ['clamp', 'base', 'constant', 'exponent'];
function interpolate_interpolateRange(interpolator, range) {
  var start = range[0],
      span = src_peek(range) - start;
  return function (i) {
    return interpolator(start + i * span);
  };
}
function interpolate_interpolateColors(colors, type, gamma) {
  return src_piecewise_piecewise(interpolate_interpolate(type || 'rgb', gamma), colors);
}
function interpolate_quantizeInterpolator(interpolator, count) {
  var samples = new Array(count),
      n = count + 1;

  for (var i = 0; i < count;) {
    samples[i] = interpolator(++i / n);
  }

  return samples;
}
function interpolate_scaleCopy(scale) {
  var t = scale.type,
      s = scale.copy();
  s.type = t;
  return s;
}
function interpolate_scaleFraction(scale, min, max) {
  var delta = max - min,
      i,
      t,
      s;

  if (!delta || !Number.isFinite(delta)) {
    return vega_util_src_constant(0.5);
  } else {
    i = (t = scale.type).indexOf('-');
    t = i < 0 ? t : t.slice(i + 1);
    s = scales_scale(t)().domain([min, max]).range([0, 1]);
    interpolate_scaleProps.forEach(function (m) {
      return scale[m] ? s[m](scale[m]()) : 0;
    });
    return s;
  }
}
function interpolate_interpolate(type, gamma) {
  var interp = d3_interpolate_src_namespaceObject[interpolate_method(type)];
  return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp;
}

function interpolate_method(type) {
  return 'interpolate' + type.toLowerCase().split('-').map(function (s) {
    return s[0].toUpperCase() + s.slice(1);
  }).join('');
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/palettes.js
var palettes_continuous = {
  blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90',
  greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429',
  greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e',
  oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303',
  purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c',
  reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13',
  blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429',
  bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71',
  greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1',
  orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403',
  purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281',
  purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353',
  purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a',
  redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174',
  yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034',
  yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204',
  yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225',
  blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07',
  brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147',
  purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29',
  purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07',
  redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85',
  redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434',
  yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185',
  redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695',
  redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837',
  pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419',
  spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2',
  viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725',
  magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf',
  inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4',
  plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921',
  rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa',
  sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040',
  browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632',
  tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985',
  teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667',
  warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e',
  goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36',
  goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26',
  goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e',
  lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b',
  lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc',
  lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c',
  lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b',
  lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988',
  darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff',
  darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff',
  darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa',
  darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff',
  darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c'
};
var palettes_discrete = {
  category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf',
  category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5',
  category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6',
  category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9',
  tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac',
  tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5',
  accent: '7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666',
  dark2: '1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666',
  paired: 'a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928',
  pastel1: 'fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2',
  pastel2: 'b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc',
  set1: 'e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999',
  set2: '66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3',
  set3: '8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f'
};
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/schemes.js




function schemes_colors(palette) {
  var n = palette.length / 6 | 0,
      c = new Array(n),
      i = 0;

  while (i < n) {
    c[i] = '#' + palette.slice(i * 6, ++i * 6);
  }

  return c;
}

function schemes_apply(_, f) {
  for (var k in _) {
    schemes_scheme(k, f(_[k]));
  }
}

var schemes_schemes = {};
schemes_apply(palettes_discrete, schemes_colors);
schemes_apply(palettes_continuous, function (_) {
  return interpolate_interpolateColors(schemes_colors(_));
});
function schemes_scheme(name, scheme) {
  name = name && name.toLowerCase();

  if (arguments.length > 1) {
    schemes_schemes[name] = scheme;
    return this;
  } else {
    return schemes_schemes[name];
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/legend-types.js
var legend_types_SymbolLegend = 'symbol';
var legend_types_DiscreteLegend = 'discrete';
var legend_types_GradientLegend = 'gradient';
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.every.js
var es_array_every = __webpack_require__("a623");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.filter.js
var es_array_filter = __webpack_require__("4de4");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.last-index-of.js
var es_array_last_index_of = __webpack_require__("baa5");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.sort.js
var es_array_sort = __webpack_require__("4e82");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-time/src/units.js






var YEAR = 'year';
var QUARTER = 'quarter';
var MONTH = 'month';
var WEEK = 'week';
var units_DATE = 'date';
var DAY = 'day';
var DAYOFYEAR = 'dayofyear';
var HOURS = 'hours';
var MINUTES = 'minutes';
var SECONDS = 'seconds';
var MILLISECONDS = 'milliseconds';
var TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, units_DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS];
var UNITS = TIME_UNITS.reduce(function (o, u, i) {
  return o[u] = 1 + i, o;
}, {});
function units_timeUnits(units) {
  var u = vega_util_src_array(units).slice(),
      m = {}; // check validity

  if (!u.length) src_error('Missing time unit.');
  u.forEach(function (unit) {
    if (src_hasOwnProperty(UNITS, unit)) {
      m[unit] = 1;
    } else {
      src_error("Invalid time unit: ".concat(unit, "."));
    }
  });
  var numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[units_DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0);

  if (numTypes > 1) {
    src_error("Incompatible time units: ".concat(units));
  } // ensure proper sort order


  u.sort(function (a, b) {
    return UNITS[a] - UNITS[b];
  });
  return u;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/interval.js



var interval_t0 = new Date(),
    interval_t1 = new Date();
function newInterval(floori, offseti, count, field) {
  function interval(date) {
    return floori(date = arguments.length === 0 ? new Date() : new Date(+date)), date;
  }

  interval.floor = function (date) {
    return floori(date = new Date(+date)), date;
  };

  interval.ceil = function (date) {
    return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
  };

  interval.round = function (date) {
    var d0 = interval(date),
        d1 = interval.ceil(date);
    return date - d0 < d1 - date ? d0 : d1;
  };

  interval.offset = function (date, step) {
    return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
  };

  interval.range = function (start, stop, step) {
    var range = [],
        previous;
    start = interval.ceil(start);
    step = step == null ? 1 : Math.floor(step);
    if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date

    do {
      range.push(previous = new Date(+start)), offseti(start, step), floori(start);
    } while (previous < start && start < stop);

    return range;
  };

  interval.filter = function (test) {
    return newInterval(function (date) {
      if (date >= date) while (floori(date), !test(date)) {
        date.setTime(date - 1);
      }
    }, function (date, step) {
      if (date >= date) {
        if (step < 0) while (++step <= 0) {
          while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty

        } else while (--step >= 0) {
          while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty

        }
      }
    });
  };

  if (count) {
    interval.count = function (start, end) {
      interval_t0.setTime(+start), interval_t1.setTime(+end);
      floori(interval_t0), floori(interval_t1);
      return Math.floor(count(interval_t0, interval_t1));
    };

    interval.every = function (step) {
      step = Math.floor(step);
      return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function (d) {
        return field(d) % step === 0;
      } : function (d) {
        return interval.count(0, d) % step === 0;
      });
    };
  }

  return interval;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/duration.js
var durationSecond = 1e3;
var durationMinute = 6e4;
var durationHour = 36e5;
var durationDay = 864e5;
var durationWeek = 6048e5;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/day.js


var day_day = newInterval(function (date) {
  date.setHours(0, 0, 0, 0);
}, function (date, step) {
  date.setDate(date.getDate() + step);
}, function (start, end) {
  return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay;
}, function (date) {
  return date.getDate() - 1;
});
/* harmony default export */ var d3_time_src_day = (day_day);
var days = day_day.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/week.js



function weekday(i) {
  return newInterval(function (date) {
    date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
    date.setHours(0, 0, 0, 0);
  }, function (date, step) {
    date.setDate(date.getDate() + step * 7);
  }, function (start, end) {
    return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
  });
}

var sunday = weekday(0);
var monday = weekday(1);
var tuesday = weekday(2);
var wednesday = weekday(3);
var thursday = weekday(4);
var friday = weekday(5);
var saturday = weekday(6);
var sundays = sunday.range;
var mondays = monday.range;
var tuesdays = tuesday.range;
var wednesdays = wednesday.range;
var thursdays = thursday.range;
var fridays = friday.range;
var saturdays = saturday.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/utcDay.js


var utcDay_utcDay = newInterval(function (date) {
  date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
  date.setUTCDate(date.getUTCDate() + step);
}, function (start, end) {
  return (end - start) / durationDay;
}, function (date) {
  return date.getUTCDate() - 1;
});
/* harmony default export */ var src_utcDay = (utcDay_utcDay);
var utcDays = utcDay_utcDay.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/utcWeek.js



function utcWeekday(i) {
  return newInterval(function (date) {
    date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
    date.setUTCHours(0, 0, 0, 0);
  }, function (date, step) {
    date.setUTCDate(date.getUTCDate() + step * 7);
  }, function (start, end) {
    return (end - start) / durationWeek;
  });
}

var utcSunday = utcWeekday(0);
var utcMonday = utcWeekday(1);
var utcTuesday = utcWeekday(2);
var utcWednesday = utcWeekday(3);
var utcThursday = utcWeekday(4);
var utcFriday = utcWeekday(5);
var utcSaturday = utcWeekday(6);
var utcSundays = utcSunday.range;
var utcMondays = utcMonday.range;
var utcTuesdays = utcTuesday.range;
var utcWednesdays = utcWednesday.range;
var utcThursdays = utcThursday.range;
var utcFridays = utcFriday.range;
var utcSaturdays = utcSaturday.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-time/src/util.js


var util_t0 = new Date();

function localYear(y) {
  util_t0.setFullYear(y);
  util_t0.setMonth(0);
  util_t0.setDate(1);
  util_t0.setHours(0, 0, 0, 0);
  return util_t0;
}

function dayofyear(d) {
  return localDayOfYear(new Date(d));
}
function util_week(d) {
  return localWeekNum(new Date(d));
}
function localDayOfYear(d) {
  return d3_time_src_day.count(localYear(d.getFullYear()) - 1, d);
}
function localWeekNum(d) {
  return sunday.count(localYear(d.getFullYear()) - 1, d);
}
function localFirst(y) {
  return localYear(y).getDay();
}
function localDate(y, m, d, H, M, S, L) {
  if (0 <= y && y < 100) {
    var date = new Date(-1, m, d, H, M, S, L);
    date.setFullYear(y);
    return date;
  }

  return new Date(y, m, d, H, M, S, L);
}
function utcdayofyear(d) {
  return utcDayOfYear(new Date(d));
}
function utcweek(d) {
  return utcWeekNum(new Date(d));
}
function utcDayOfYear(d) {
  var y = Date.UTC(d.getUTCFullYear(), 0, 1);
  return src_utcDay.count(y - 1, d);
}
function utcWeekNum(d) {
  var y = Date.UTC(d.getUTCFullYear(), 0, 1);
  return utcSunday.count(y - 1, d);
}
function utcFirst(y) {
  util_t0.setTime(Date.UTC(y, 0, 1));
  return util_t0.getUTCDay();
}
function utcDate(y, m, d, H, M, S, L) {
  if (0 <= y && y < 100) {
    var date = new Date(Date.UTC(-1, m, d, H, M, S, L));
    date.setUTCFullYear(d.y);
    return date;
  }

  return new Date(Date.UTC(y, m, d, H, M, S, L));
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.define-property.js
var es_object_define_property = __webpack_require__("7a82");

// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js

function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }

  return obj;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-time/src/floor.js


var _localGet, _localInv, _utcGet, _utcInv;






function floor_floor(units, step, get, inv, newDate) {
  var s = step || 1,
      b = src_peek(units),
      _ = function _(unit, p, key) {
    key = key || unit;
    return getUnit(get[key], inv[key], unit === b && s, p);
  };

  var t = new Date(),
      u = toSet(units),
      y = u[YEAR] ? _(YEAR) : vega_util_src_constant(2012),
      m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : accessors_zero,
      d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[units_DATE] ? _(units_DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : accessors_one,
      H = u[HOURS] ? _(HOURS) : accessors_zero,
      M = u[MINUTES] ? _(MINUTES) : accessors_zero,
      S = u[SECONDS] ? _(SECONDS) : accessors_zero,
      L = u[MILLISECONDS] ? _(MILLISECONDS) : accessors_zero;
  return function (v) {
    t.setTime(+v);
    var year = y(t);
    return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t));
  };
}

function getUnit(f, inv, step, phase) {
  var u = step <= 1 ? f : phase ? function (d, y) {
    return phase + step * Math.floor((f(d, y) - phase) / step);
  } : function (d, y) {
    return step * Math.floor(f(d, y) / step);
  };
  return inv ? function (d, y) {
    return inv(u(d, y), y);
  } : u;
} // returns the day of the year based on week number, day of week,
// and the day of the week for the first day of the year


function floor_weekday(week, day, firstDay) {
  return day + week * 7 - (firstDay + 6) % 7;
} // -- LOCAL TIME --


var localGet = (_localGet = {}, _defineProperty(_localGet, YEAR, function (d) {
  return d.getFullYear();
}), _defineProperty(_localGet, QUARTER, function (d) {
  return Math.floor(d.getMonth() / 3);
}), _defineProperty(_localGet, MONTH, function (d) {
  return d.getMonth();
}), _defineProperty(_localGet, units_DATE, function (d) {
  return d.getDate();
}), _defineProperty(_localGet, HOURS, function (d) {
  return d.getHours();
}), _defineProperty(_localGet, MINUTES, function (d) {
  return d.getMinutes();
}), _defineProperty(_localGet, SECONDS, function (d) {
  return d.getSeconds();
}), _defineProperty(_localGet, MILLISECONDS, function (d) {
  return d.getMilliseconds();
}), _defineProperty(_localGet, DAYOFYEAR, function (d) {
  return localDayOfYear(d);
}), _defineProperty(_localGet, WEEK, function (d) {
  return localWeekNum(d);
}), _defineProperty(_localGet, WEEK + DAY, function (d, y) {
  return floor_weekday(localWeekNum(d), d.getDay(), localFirst(y));
}), _defineProperty(_localGet, DAY, function (d, y) {
  return floor_weekday(1, d.getDay(), localFirst(y));
}), _localGet);
var localInv = (_localInv = {}, _defineProperty(_localInv, QUARTER, function (q) {
  return 3 * q;
}), _defineProperty(_localInv, WEEK, function (w, y) {
  return floor_weekday(w, 0, localFirst(y));
}), _localInv);
function timeFloor(units, step) {
  return floor_floor(units, step || 1, localGet, localInv, localDate);
} // -- UTC TIME --

var utcGet = (_utcGet = {}, _defineProperty(_utcGet, YEAR, function (d) {
  return d.getUTCFullYear();
}), _defineProperty(_utcGet, QUARTER, function (d) {
  return Math.floor(d.getUTCMonth() / 3);
}), _defineProperty(_utcGet, MONTH, function (d) {
  return d.getUTCMonth();
}), _defineProperty(_utcGet, units_DATE, function (d) {
  return d.getUTCDate();
}), _defineProperty(_utcGet, HOURS, function (d) {
  return d.getUTCHours();
}), _defineProperty(_utcGet, MINUTES, function (d) {
  return d.getUTCMinutes();
}), _defineProperty(_utcGet, SECONDS, function (d) {
  return d.getUTCSeconds();
}), _defineProperty(_utcGet, MILLISECONDS, function (d) {
  return d.getUTCMilliseconds();
}), _defineProperty(_utcGet, DAYOFYEAR, function (d) {
  return utcDayOfYear(d);
}), _defineProperty(_utcGet, WEEK, function (d) {
  return utcWeekNum(d);
}), _defineProperty(_utcGet, DAY, function (d, y) {
  return floor_weekday(1, d.getUTCDay(), utcFirst(y));
}), _defineProperty(_utcGet, WEEK + DAY, function (d, y) {
  return floor_weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y));
}), _utcGet);
var utcInv = (_utcInv = {}, _defineProperty(_utcInv, QUARTER, function (q) {
  return 3 * q;
}), _defineProperty(_utcInv, WEEK, function (w, y) {
  return floor_weekday(w, 0, utcFirst(y));
}), _utcInv);
function utcFloor(units, step) {
  return floor_floor(units, step || 1, utcGet, utcInv, utcDate);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/year.js


var year_year = newInterval(function (date) {
  date.setMonth(0, 1);
  date.setHours(0, 0, 0, 0);
}, function (date, step) {
  date.setFullYear(date.getFullYear() + step);
}, function (start, end) {
  return end.getFullYear() - start.getFullYear();
}, function (date) {
  return date.getFullYear();
}); // An optimized implementation for this simple case.

year_year.every = function (k) {
  return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function (date) {
    date.setFullYear(Math.floor(date.getFullYear() / k) * k);
    date.setMonth(0, 1);
    date.setHours(0, 0, 0, 0);
  }, function (date, step) {
    date.setFullYear(date.getFullYear() + step * k);
  });
};

/* harmony default export */ var d3_time_src_year = (year_year);
var years = year_year.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/month.js

var month_month = newInterval(function (date) {
  date.setDate(1);
  date.setHours(0, 0, 0, 0);
}, function (date, step) {
  date.setMonth(date.getMonth() + step);
}, function (start, end) {
  return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
}, function (date) {
  return date.getMonth();
});
/* harmony default export */ var d3_time_src_month = (month_month);
var months = month_month.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/hour.js


var hour_hour = newInterval(function (date) {
  date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
}, function (date, step) {
  date.setTime(+date + step * durationHour);
}, function (start, end) {
  return (end - start) / durationHour;
}, function (date) {
  return date.getHours();
});
/* harmony default export */ var d3_time_src_hour = (hour_hour);
var hours = hour_hour.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/minute.js


var minute_minute = newInterval(function (date) {
  date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
}, function (date, step) {
  date.setTime(+date + step * durationMinute);
}, function (start, end) {
  return (end - start) / durationMinute;
}, function (date) {
  return date.getMinutes();
});
/* harmony default export */ var d3_time_src_minute = (minute_minute);
var minutes = minute_minute.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/second.js


var second_second = newInterval(function (date) {
  date.setTime(date - date.getMilliseconds());
}, function (date, step) {
  date.setTime(+date + step * durationSecond);
}, function (start, end) {
  return (end - start) / durationSecond;
}, function (date) {
  return date.getUTCSeconds();
});
/* harmony default export */ var d3_time_src_second = (second_second);
var seconds = second_second.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/millisecond.js


var millisecond_millisecond = newInterval(function () {// noop
}, function (date, step) {
  date.setTime(+date + step);
}, function (start, end) {
  return end - start;
}); // An optimized implementation for this simple case.

millisecond_millisecond.every = function (k) {
  k = Math.floor(k);
  if (!isFinite(k) || !(k > 0)) return null;
  if (!(k > 1)) return millisecond_millisecond;
  return newInterval(function (date) {
    date.setTime(Math.floor(date / k) * k);
  }, function (date, step) {
    date.setTime(+date + step * k);
  }, function (start, end) {
    return (end - start) / k;
  });
};

/* harmony default export */ var src_millisecond = (millisecond_millisecond);
var milliseconds = millisecond_millisecond.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/utcYear.js


var utcYear_utcYear = newInterval(function (date) {
  date.setUTCMonth(0, 1);
  date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
  date.setUTCFullYear(date.getUTCFullYear() + step);
}, function (start, end) {
  return end.getUTCFullYear() - start.getUTCFullYear();
}, function (date) {
  return date.getUTCFullYear();
}); // An optimized implementation for this simple case.

utcYear_utcYear.every = function (k) {
  return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function (date) {
    date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
    date.setUTCMonth(0, 1);
    date.setUTCHours(0, 0, 0, 0);
  }, function (date, step) {
    date.setUTCFullYear(date.getUTCFullYear() + step * k);
  });
};

/* harmony default export */ var src_utcYear = (utcYear_utcYear);
var utcYears = utcYear_utcYear.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/utcMonth.js

var utcMonth_utcMonth = newInterval(function (date) {
  date.setUTCDate(1);
  date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
  date.setUTCMonth(date.getUTCMonth() + step);
}, function (start, end) {
  return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
}, function (date) {
  return date.getUTCMonth();
});
/* harmony default export */ var src_utcMonth = (utcMonth_utcMonth);
var utcMonths = utcMonth_utcMonth.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/utcHour.js


var utcHour_utcHour = newInterval(function (date) {
  date.setUTCMinutes(0, 0, 0);
}, function (date, step) {
  date.setTime(+date + step * durationHour);
}, function (start, end) {
  return (end - start) / durationHour;
}, function (date) {
  return date.getUTCHours();
});
/* harmony default export */ var src_utcHour = (utcHour_utcHour);
var utcHours = utcHour_utcHour.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time/src/utcMinute.js


var utcMinute_utcMinute = newInterval(function (date) {
  date.setUTCSeconds(0, 0);
}, function (date, step) {
  date.setTime(+date + step * durationMinute);
}, function (start, end) {
  return (end - start) / durationMinute;
}, function (date) {
  return date.getUTCMinutes();
});
/* harmony default export */ var src_utcMinute = (utcMinute_utcMinute);
var utcMinutes = utcMinute_utcMinute.range;
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-time/src/interval.js


var _timeIntervals, _utcIntervals;




var timeIntervals = (_timeIntervals = {}, _defineProperty(_timeIntervals, YEAR, d3_time_src_year), _defineProperty(_timeIntervals, QUARTER, d3_time_src_month.every(3)), _defineProperty(_timeIntervals, MONTH, d3_time_src_month), _defineProperty(_timeIntervals, WEEK, sunday), _defineProperty(_timeIntervals, units_DATE, d3_time_src_day), _defineProperty(_timeIntervals, DAY, d3_time_src_day), _defineProperty(_timeIntervals, DAYOFYEAR, d3_time_src_day), _defineProperty(_timeIntervals, HOURS, d3_time_src_hour), _defineProperty(_timeIntervals, MINUTES, d3_time_src_minute), _defineProperty(_timeIntervals, SECONDS, d3_time_src_second), _defineProperty(_timeIntervals, MILLISECONDS, src_millisecond), _timeIntervals);
var utcIntervals = (_utcIntervals = {}, _defineProperty(_utcIntervals, YEAR, src_utcYear), _defineProperty(_utcIntervals, QUARTER, src_utcMonth.every(3)), _defineProperty(_utcIntervals, MONTH, src_utcMonth), _defineProperty(_utcIntervals, WEEK, utcSunday), _defineProperty(_utcIntervals, units_DATE, src_utcDay), _defineProperty(_utcIntervals, DAY, src_utcDay), _defineProperty(_utcIntervals, DAYOFYEAR, src_utcDay), _defineProperty(_utcIntervals, HOURS, src_utcHour), _defineProperty(_utcIntervals, MINUTES, src_utcMinute), _defineProperty(_utcIntervals, SECONDS, d3_time_src_second), _defineProperty(_utcIntervals, MILLISECONDS, src_millisecond), _utcIntervals);
function timeInterval(unit) {
  return timeIntervals[unit];
}
function utcInterval(unit) {
  return utcIntervals[unit];
}

function interval_offset(ival, date, step) {
  return ival ? ival.offset(date, step) : undefined;
}

function timeOffset(unit, date, step) {
  return interval_offset(timeInterval(unit), date, step);
}
function utcOffset(unit, date, step) {
  return interval_offset(utcInterval(unit), date, step);
}

function interval_sequence(ival, start, stop, step) {
  return ival ? ival.range(start, stop, step) : undefined;
}

function timeSequence(unit, start, stop, step) {
  return interval_sequence(timeInterval(unit), start, stop, step);
}
function utcSequence(unit, start, stop, step) {
  return interval_sequence(utcInterval(unit), start, stop, step);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time-format/src/locale.js











function locale_localDate(d) {
  if (0 <= d.y && d.y < 100) {
    var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
    date.setFullYear(d.y);
    return date;
  }

  return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
}

function locale_utcDate(d) {
  if (0 <= d.y && d.y < 100) {
    var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
    date.setUTCFullYear(d.y);
    return date;
  }

  return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
}

function locale_newDate(y, m, d) {
  return {
    y: y,
    m: m,
    d: d,
    H: 0,
    M: 0,
    S: 0,
    L: 0
  };
}

function formatLocale(locale) {
  var locale_dateTime = locale.dateTime,
      locale_date = locale.date,
      locale_time = locale.time,
      locale_periods = locale.periods,
      locale_weekdays = locale.days,
      locale_shortWeekdays = locale.shortDays,
      locale_months = locale.months,
      locale_shortMonths = locale.shortMonths;
  var periodRe = formatRe(locale_periods),
      periodLookup = formatLookup(locale_periods),
      weekdayRe = formatRe(locale_weekdays),
      weekdayLookup = formatLookup(locale_weekdays),
      shortWeekdayRe = formatRe(locale_shortWeekdays),
      shortWeekdayLookup = formatLookup(locale_shortWeekdays),
      monthRe = formatRe(locale_months),
      monthLookup = formatLookup(locale_months),
      shortMonthRe = formatRe(locale_shortMonths),
      shortMonthLookup = formatLookup(locale_shortMonths);
  var formats = {
    "a": formatShortWeekday,
    "A": formatWeekday,
    "b": formatShortMonth,
    "B": formatMonth,
    "c": null,
    "d": formatDayOfMonth,
    "e": formatDayOfMonth,
    "f": formatMicroseconds,
    "g": formatYearISO,
    "G": formatFullYearISO,
    "H": formatHour24,
    "I": formatHour12,
    "j": formatDayOfYear,
    "L": formatMilliseconds,
    "m": formatMonthNumber,
    "M": formatMinutes,
    "p": formatPeriod,
    "q": formatQuarter,
    "Q": formatUnixTimestamp,
    "s": formatUnixTimestampSeconds,
    "S": formatSeconds,
    "u": formatWeekdayNumberMonday,
    "U": formatWeekNumberSunday,
    "V": formatWeekNumberISO,
    "w": formatWeekdayNumberSunday,
    "W": formatWeekNumberMonday,
    "x": null,
    "X": null,
    "y": locale_formatYear,
    "Y": formatFullYear,
    "Z": formatZone,
    "%": formatLiteralPercent
  };
  var utcFormats = {
    "a": formatUTCShortWeekday,
    "A": formatUTCWeekday,
    "b": formatUTCShortMonth,
    "B": formatUTCMonth,
    "c": null,
    "d": formatUTCDayOfMonth,
    "e": formatUTCDayOfMonth,
    "f": formatUTCMicroseconds,
    "g": formatUTCYearISO,
    "G": formatUTCFullYearISO,
    "H": formatUTCHour24,
    "I": formatUTCHour12,
    "j": formatUTCDayOfYear,
    "L": formatUTCMilliseconds,
    "m": formatUTCMonthNumber,
    "M": formatUTCMinutes,
    "p": formatUTCPeriod,
    "q": formatUTCQuarter,
    "Q": formatUnixTimestamp,
    "s": formatUnixTimestampSeconds,
    "S": formatUTCSeconds,
    "u": formatUTCWeekdayNumberMonday,
    "U": formatUTCWeekNumberSunday,
    "V": formatUTCWeekNumberISO,
    "w": formatUTCWeekdayNumberSunday,
    "W": formatUTCWeekNumberMonday,
    "x": null,
    "X": null,
    "y": formatUTCYear,
    "Y": formatUTCFullYear,
    "Z": formatUTCZone,
    "%": formatLiteralPercent
  };
  var parses = {
    "a": parseShortWeekday,
    "A": parseWeekday,
    "b": parseShortMonth,
    "B": parseMonth,
    "c": parseLocaleDateTime,
    "d": parseDayOfMonth,
    "e": parseDayOfMonth,
    "f": parseMicroseconds,
    "g": parseYear,
    "G": parseFullYear,
    "H": parseHour24,
    "I": parseHour24,
    "j": parseDayOfYear,
    "L": parseMilliseconds,
    "m": parseMonthNumber,
    "M": parseMinutes,
    "p": parsePeriod,
    "q": parseQuarter,
    "Q": parseUnixTimestamp,
    "s": parseUnixTimestampSeconds,
    "S": parseSeconds,
    "u": parseWeekdayNumberMonday,
    "U": parseWeekNumberSunday,
    "V": parseWeekNumberISO,
    "w": parseWeekdayNumberSunday,
    "W": parseWeekNumberMonday,
    "x": parseLocaleDate,
    "X": parseLocaleTime,
    "y": parseYear,
    "Y": parseFullYear,
    "Z": parseZone,
    "%": parseLiteralPercent
  }; // These recursive directive definitions must be deferred.

  formats.x = newFormat(locale_date, formats);
  formats.X = newFormat(locale_time, formats);
  formats.c = newFormat(locale_dateTime, formats);
  utcFormats.x = newFormat(locale_date, utcFormats);
  utcFormats.X = newFormat(locale_time, utcFormats);
  utcFormats.c = newFormat(locale_dateTime, utcFormats);

  function newFormat(specifier, formats) {
    return function (date) {
      var string = [],
          i = -1,
          j = 0,
          n = specifier.length,
          c,
          pad,
          format;
      if (!(date instanceof Date)) date = new Date(+date);

      while (++i < n) {
        if (specifier.charCodeAt(i) === 37) {
          string.push(specifier.slice(j, i));
          if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);else pad = c === "e" ? " " : "0";
          if (format = formats[c]) c = format(date, pad);
          string.push(c);
          j = i + 1;
        }
      }

      string.push(specifier.slice(j, i));
      return string.join("");
    };
  }

  function newParse(specifier, Z) {
    return function (string) {
      var d = locale_newDate(1900, undefined, 1),
          i = parseSpecifier(d, specifier, string += "", 0),
          week,
          day;
      if (i != string.length) return null; // If a UNIX timestamp is specified, return it.

      if ("Q" in d) return new Date(d.Q);
      if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); // If this is utcParse, never use the local timezone.

      if (Z && !("Z" in d)) d.Z = 0; // The am-pm flag is 0 for AM, and 1 for PM.

      if ("p" in d) d.H = d.H % 12 + d.p * 12; // If the month was not specified, inherit from the quarter.

      if (d.m === undefined) d.m = "q" in d ? d.q : 0; // Convert day-of-week and week-of-year to day-of-year.

      if ("V" in d) {
        if (d.V < 1 || d.V > 53) return null;
        if (!("w" in d)) d.w = 1;

        if ("Z" in d) {
          week = locale_utcDate(locale_newDate(d.y, 0, 1)), day = week.getUTCDay();
          week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
          week = src_utcDay.offset(week, (d.V - 1) * 7);
          d.y = week.getUTCFullYear();
          d.m = week.getUTCMonth();
          d.d = week.getUTCDate() + (d.w + 6) % 7;
        } else {
          week = locale_localDate(locale_newDate(d.y, 0, 1)), day = week.getDay();
          week = day > 4 || day === 0 ? monday.ceil(week) : monday(week);
          week = d3_time_src_day.offset(week, (d.V - 1) * 7);
          d.y = week.getFullYear();
          d.m = week.getMonth();
          d.d = week.getDate() + (d.w + 6) % 7;
        }
      } else if ("W" in d || "U" in d) {
        if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
        day = "Z" in d ? locale_utcDate(locale_newDate(d.y, 0, 1)).getUTCDay() : locale_localDate(locale_newDate(d.y, 0, 1)).getDay();
        d.m = 0;
        d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
      } // If a time zone is specified, all fields are interpreted as UTC and then
      // offset according to the specified time zone.


      if ("Z" in d) {
        d.H += d.Z / 100 | 0;
        d.M += d.Z % 100;
        return locale_utcDate(d);
      } // Otherwise, all fields are in local time.


      return locale_localDate(d);
    };
  }

  function parseSpecifier(d, specifier, string, j) {
    var i = 0,
        n = specifier.length,
        m = string.length,
        c,
        parse;

    while (i < n) {
      if (j >= m) return -1;
      c = specifier.charCodeAt(i++);

      if (c === 37) {
        c = specifier.charAt(i++);
        parse = parses[c in pads ? specifier.charAt(i++) : c];
        if (!parse || (j = parse(d, string, j)) < 0) return -1;
      } else if (c != string.charCodeAt(j++)) {
        return -1;
      }
    }

    return j;
  }

  function parsePeriod(d, string, i) {
    var n = periodRe.exec(string.slice(i));
    return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;
  }

  function parseShortWeekday(d, string, i) {
    var n = shortWeekdayRe.exec(string.slice(i));
    return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
  }

  function parseWeekday(d, string, i) {
    var n = weekdayRe.exec(string.slice(i));
    return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
  }

  function parseShortMonth(d, string, i) {
    var n = shortMonthRe.exec(string.slice(i));
    return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
  }

  function parseMonth(d, string, i) {
    var n = monthRe.exec(string.slice(i));
    return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
  }

  function parseLocaleDateTime(d, string, i) {
    return parseSpecifier(d, locale_dateTime, string, i);
  }

  function parseLocaleDate(d, string, i) {
    return parseSpecifier(d, locale_date, string, i);
  }

  function parseLocaleTime(d, string, i) {
    return parseSpecifier(d, locale_time, string, i);
  }

  function formatShortWeekday(d) {
    return locale_shortWeekdays[d.getDay()];
  }

  function formatWeekday(d) {
    return locale_weekdays[d.getDay()];
  }

  function formatShortMonth(d) {
    return locale_shortMonths[d.getMonth()];
  }

  function formatMonth(d) {
    return locale_months[d.getMonth()];
  }

  function formatPeriod(d) {
    return locale_periods[+(d.getHours() >= 12)];
  }

  function formatQuarter(d) {
    return 1 + ~~(d.getMonth() / 3);
  }

  function formatUTCShortWeekday(d) {
    return locale_shortWeekdays[d.getUTCDay()];
  }

  function formatUTCWeekday(d) {
    return locale_weekdays[d.getUTCDay()];
  }

  function formatUTCShortMonth(d) {
    return locale_shortMonths[d.getUTCMonth()];
  }

  function formatUTCMonth(d) {
    return locale_months[d.getUTCMonth()];
  }

  function formatUTCPeriod(d) {
    return locale_periods[+(d.getUTCHours() >= 12)];
  }

  function formatUTCQuarter(d) {
    return 1 + ~~(d.getUTCMonth() / 3);
  }

  return {
    format: function format(specifier) {
      var f = newFormat(specifier += "", formats);

      f.toString = function () {
        return specifier;
      };

      return f;
    },
    parse: function parse(specifier) {
      var p = newParse(specifier += "", false);

      p.toString = function () {
        return specifier;
      };

      return p;
    },
    utcFormat: function utcFormat(specifier) {
      var f = newFormat(specifier += "", utcFormats);

      f.toString = function () {
        return specifier;
      };

      return f;
    },
    utcParse: function utcParse(specifier) {
      var p = newParse(specifier += "", true);

      p.toString = function () {
        return specifier;
      };

      return p;
    }
  };
}
var pads = {
  "-": "",
  "_": " ",
  "0": "0"
},
    numberRe = /^\s*\d+/,
    // note: ignores next directive
percentRe = /^%/,
    requoteRe = /[\\^$*+?|[\]().{}]/g;

function locale_pad(value, fill, width) {
  var sign = value < 0 ? "-" : "",
      string = (sign ? -value : value) + "",
      length = string.length;
  return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
}

function requote(s) {
  return s.replace(requoteRe, "\\$&");
}

function formatRe(names) {
  return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
}

function formatLookup(names) {
  var map = {},
      i = -1,
      n = names.length;

  while (++i < n) {
    map[names[i].toLowerCase()] = i;
  }

  return map;
}

function parseWeekdayNumberSunday(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 1));
  return n ? (d.w = +n[0], i + n[0].length) : -1;
}

function parseWeekdayNumberMonday(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 1));
  return n ? (d.u = +n[0], i + n[0].length) : -1;
}

function parseWeekNumberSunday(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.U = +n[0], i + n[0].length) : -1;
}

function parseWeekNumberISO(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.V = +n[0], i + n[0].length) : -1;
}

function parseWeekNumberMonday(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.W = +n[0], i + n[0].length) : -1;
}

function parseFullYear(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 4));
  return n ? (d.y = +n[0], i + n[0].length) : -1;
}

function parseYear(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
}

function parseZone(d, string, i) {
  var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
  return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
}

function parseQuarter(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 1));
  return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
}

function parseMonthNumber(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
}

function parseDayOfMonth(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.d = +n[0], i + n[0].length) : -1;
}

function parseDayOfYear(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 3));
  return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
}

function parseHour24(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.H = +n[0], i + n[0].length) : -1;
}

function parseMinutes(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.M = +n[0], i + n[0].length) : -1;
}

function parseSeconds(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 2));
  return n ? (d.S = +n[0], i + n[0].length) : -1;
}

function parseMilliseconds(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 3));
  return n ? (d.L = +n[0], i + n[0].length) : -1;
}

function parseMicroseconds(d, string, i) {
  var n = numberRe.exec(string.slice(i, i + 6));
  return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
}

function parseLiteralPercent(d, string, i) {
  var n = percentRe.exec(string.slice(i, i + 1));
  return n ? i + n[0].length : -1;
}

function parseUnixTimestamp(d, string, i) {
  var n = numberRe.exec(string.slice(i));
  return n ? (d.Q = +n[0], i + n[0].length) : -1;
}

function parseUnixTimestampSeconds(d, string, i) {
  var n = numberRe.exec(string.slice(i));
  return n ? (d.s = +n[0], i + n[0].length) : -1;
}

function formatDayOfMonth(d, p) {
  return locale_pad(d.getDate(), p, 2);
}

function formatHour24(d, p) {
  return locale_pad(d.getHours(), p, 2);
}

function formatHour12(d, p) {
  return locale_pad(d.getHours() % 12 || 12, p, 2);
}

function formatDayOfYear(d, p) {
  return locale_pad(1 + d3_time_src_day.count(d3_time_src_year(d), d), p, 3);
}

function formatMilliseconds(d, p) {
  return locale_pad(d.getMilliseconds(), p, 3);
}

function formatMicroseconds(d, p) {
  return formatMilliseconds(d, p) + "000";
}

function formatMonthNumber(d, p) {
  return locale_pad(d.getMonth() + 1, p, 2);
}

function formatMinutes(d, p) {
  return locale_pad(d.getMinutes(), p, 2);
}

function formatSeconds(d, p) {
  return locale_pad(d.getSeconds(), p, 2);
}

function formatWeekdayNumberMonday(d) {
  var day = d.getDay();
  return day === 0 ? 7 : day;
}

function formatWeekNumberSunday(d, p) {
  return locale_pad(sunday.count(d3_time_src_year(d) - 1, d), p, 2);
}

function dISO(d) {
  var day = d.getDay();
  return day >= 4 || day === 0 ? thursday(d) : thursday.ceil(d);
}

function formatWeekNumberISO(d, p) {
  d = dISO(d);
  return locale_pad(thursday.count(d3_time_src_year(d), d) + (d3_time_src_year(d).getDay() === 4), p, 2);
}

function formatWeekdayNumberSunday(d) {
  return d.getDay();
}

function formatWeekNumberMonday(d, p) {
  return locale_pad(monday.count(d3_time_src_year(d) - 1, d), p, 2);
}

function locale_formatYear(d, p) {
  return locale_pad(d.getFullYear() % 100, p, 2);
}

function formatYearISO(d, p) {
  d = dISO(d);
  return locale_pad(d.getFullYear() % 100, p, 2);
}

function formatFullYear(d, p) {
  return locale_pad(d.getFullYear() % 10000, p, 4);
}

function formatFullYearISO(d, p) {
  var day = d.getDay();
  d = day >= 4 || day === 0 ? thursday(d) : thursday.ceil(d);
  return locale_pad(d.getFullYear() % 10000, p, 4);
}

function formatZone(d) {
  var z = d.getTimezoneOffset();
  return (z > 0 ? "-" : (z *= -1, "+")) + locale_pad(z / 60 | 0, "0", 2) + locale_pad(z % 60, "0", 2);
}

function formatUTCDayOfMonth(d, p) {
  return locale_pad(d.getUTCDate(), p, 2);
}

function formatUTCHour24(d, p) {
  return locale_pad(d.getUTCHours(), p, 2);
}

function formatUTCHour12(d, p) {
  return locale_pad(d.getUTCHours() % 12 || 12, p, 2);
}

function formatUTCDayOfYear(d, p) {
  return locale_pad(1 + src_utcDay.count(src_utcYear(d), d), p, 3);
}

function formatUTCMilliseconds(d, p) {
  return locale_pad(d.getUTCMilliseconds(), p, 3);
}

function formatUTCMicroseconds(d, p) {
  return formatUTCMilliseconds(d, p) + "000";
}

function formatUTCMonthNumber(d, p) {
  return locale_pad(d.getUTCMonth() + 1, p, 2);
}

function formatUTCMinutes(d, p) {
  return locale_pad(d.getUTCMinutes(), p, 2);
}

function formatUTCSeconds(d, p) {
  return locale_pad(d.getUTCSeconds(), p, 2);
}

function formatUTCWeekdayNumberMonday(d) {
  var dow = d.getUTCDay();
  return dow === 0 ? 7 : dow;
}

function formatUTCWeekNumberSunday(d, p) {
  return locale_pad(utcSunday.count(src_utcYear(d) - 1, d), p, 2);
}

function UTCdISO(d) {
  var day = d.getUTCDay();
  return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
}

function formatUTCWeekNumberISO(d, p) {
  d = UTCdISO(d);
  return locale_pad(utcThursday.count(src_utcYear(d), d) + (src_utcYear(d).getUTCDay() === 4), p, 2);
}

function formatUTCWeekdayNumberSunday(d) {
  return d.getUTCDay();
}

function formatUTCWeekNumberMonday(d, p) {
  return locale_pad(utcMonday.count(src_utcYear(d) - 1, d), p, 2);
}

function formatUTCYear(d, p) {
  return locale_pad(d.getUTCFullYear() % 100, p, 2);
}

function formatUTCYearISO(d, p) {
  d = UTCdISO(d);
  return locale_pad(d.getUTCFullYear() % 100, p, 2);
}

function formatUTCFullYear(d, p) {
  return locale_pad(d.getUTCFullYear() % 10000, p, 4);
}

function formatUTCFullYearISO(d, p) {
  var day = d.getUTCDay();
  d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
  return locale_pad(d.getUTCFullYear() % 10000, p, 4);
}

function formatUTCZone() {
  return "+0000";
}

function formatLiteralPercent() {
  return "%";
}

function formatUnixTimestamp(d) {
  return +d;
}

function formatUnixTimestampSeconds(d) {
  return Math.floor(+d / 1000);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-time-format/src/defaultLocale.js

var defaultLocale_locale;
var defaultLocale_timeFormat;
var defaultLocale_timeParse;
var defaultLocale_utcFormat;
var defaultLocale_utcParse;
defaultLocale_defaultLocale({
  dateTime: "%x, %X",
  date: "%-m/%-d/%Y",
  time: "%-I:%M:%S %p",
  periods: ["AM", "PM"],
  days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
});
function defaultLocale_defaultLocale(definition) {
  defaultLocale_locale = formatLocale(definition);
  defaultLocale_timeFormat = defaultLocale_locale.format;
  defaultLocale_timeParse = defaultLocale_locale.parse;
  defaultLocale_utcFormat = defaultLocale_locale.utcFormat;
  defaultLocale_utcParse = defaultLocale_locale.utcParse;
  return defaultLocale_locale;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-time/src/format.js


var _defaultSpecifiers;









var defaultSpecifiers = (_defaultSpecifiers = {}, _defineProperty(_defaultSpecifiers, YEAR, '%Y '), _defineProperty(_defaultSpecifiers, QUARTER, 'Q%q '), _defineProperty(_defaultSpecifiers, MONTH, '%b '), _defineProperty(_defaultSpecifiers, units_DATE, '%d '), _defineProperty(_defaultSpecifiers, WEEK, 'W%U '), _defineProperty(_defaultSpecifiers, DAY, '%a '), _defineProperty(_defaultSpecifiers, DAYOFYEAR, '%j '), _defineProperty(_defaultSpecifiers, HOURS, '%H:00'), _defineProperty(_defaultSpecifiers, MINUTES, '00:%M'), _defineProperty(_defaultSpecifiers, SECONDS, ':%S'), _defineProperty(_defaultSpecifiers, MILLISECONDS, '.%L'), _defineProperty(_defaultSpecifiers, "".concat(YEAR, "-").concat(MONTH), '%Y-%m '), _defineProperty(_defaultSpecifiers, "".concat(YEAR, "-").concat(MONTH, "-").concat(units_DATE), '%Y-%m-%d '), _defineProperty(_defaultSpecifiers, "".concat(HOURS, "-").concat(MINUTES), '%H:%M'), _defaultSpecifiers);
function timeUnitSpecifier(units, specifiers) {
  var s = src_extend({}, defaultSpecifiers, specifiers),
      u = units_timeUnits(units),
      n = u.length;
  var fmt = '',
      start = 0,
      end,
      key;

  for (start = 0; start < n;) {
    for (end = u.length; end > start; --end) {
      key = u.slice(start, end).join('-');

      if (s[key] != null) {
        fmt += s[key];
        start = end;
        break;
      }
    }
  }

  return fmt.trim();
}
function format_timeFormat(specifier) {
  return formatter(defaultLocale_timeFormat, timeInterval, specifier);
}
function format_utcFormat(specifier) {
  return formatter(defaultLocale_utcFormat, utcInterval, specifier);
}

function formatter(format, interval, specifier) {
  return isString(specifier) ? format(specifier) : multiFormat(format, interval, specifier);
}

function multiFormat(format, interval, spec) {
  spec = spec || {};

  if (!isObject(spec)) {
    src_error("Invalid time multi-format specifier: ".concat(spec));
  }

  var second = interval(SECONDS),
      minute = interval(MINUTES),
      hour = interval(HOURS),
      day = interval(units_DATE),
      week = interval(WEEK),
      month = interval(MONTH),
      quarter = interval(QUARTER),
      year = interval(YEAR),
      L = format(spec[MILLISECONDS] || '.%L'),
      S = format(spec[SECONDS] || ':%S'),
      M = format(spec[MINUTES] || '%I:%M'),
      H = format(spec[HOURS] || '%I %p'),
      d = format(spec[units_DATE] || spec[DAY] || '%a %d'),
      w = format(spec[WEEK] || '%b %d'),
      m = format(spec[MONTH] || '%B'),
      q = format(spec[QUARTER] || '%B'),
      y = format(spec[YEAR] || '%Y');
  return function (date) {
    return (second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date);
  };
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-time/src/bin.js




var bin_durationSecond = 1000,
    bin_durationMinute = bin_durationSecond * 60,
    bin_durationHour = bin_durationMinute * 60,
    bin_durationDay = bin_durationHour * 24,
    bin_durationWeek = bin_durationDay * 7,
    durationMonth = bin_durationDay * 30,
    durationYear = bin_durationDay * 365;
var Milli = [YEAR, MONTH, units_DATE, HOURS, MINUTES, SECONDS, MILLISECONDS],
    Seconds = Milli.slice(0, -1),
    Minutes = Seconds.slice(0, -1),
    Hours = Minutes.slice(0, -1),
    Day = Hours.slice(0, -1),
    Week = [YEAR, WEEK],
    Month = [YEAR, MONTH],
    Year = [YEAR];
var intervals = [[Seconds, 1, bin_durationSecond], [Seconds, 5, 5 * bin_durationSecond], [Seconds, 15, 15 * bin_durationSecond], [Seconds, 30, 30 * bin_durationSecond], [Minutes, 1, bin_durationMinute], [Minutes, 5, 5 * bin_durationMinute], [Minutes, 15, 15 * bin_durationMinute], [Minutes, 30, 30 * bin_durationMinute], [Hours, 1, bin_durationHour], [Hours, 3, 3 * bin_durationHour], [Hours, 6, 6 * bin_durationHour], [Hours, 12, 12 * bin_durationHour], [Day, 1, bin_durationDay], [Week, 1, bin_durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]];
/* harmony default export */ var src_bin = (function (opt) {
  var ext = opt.extent,
      max = opt.maxbins || 40,
      target = Math.abs(src_span(ext)) / max;
  var i = Object(bisector["a" /* default */])(function (i) {
    return i[2];
  }).right(intervals, target),
      units,
      step;

  if (i === intervals.length) {
    units = Year, step = Object(src_ticks["c" /* tickStep */])(ext[0] / durationYear, ext[1] / durationYear, max);
  } else if (i) {
    i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i];
    units = i[0];
    step = i[1];
  } else {
    units = Milli;
    step = Math.max(Object(src_ticks["c" /* tickStep */])(ext[0], ext[1], max), 1);
  }

  return {
    units: units,
    step: step
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-time/index.js






// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.fill.js
var es_array_fill = __webpack_require__("cb29");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/formatDecimal.js







/* harmony default export */ var formatDecimal = (function (x) {
  return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
}); // Computes the decimal coefficient and exponent of the specified number x with
// significant digits p, where x is positive and p is in [1, 21] or undefined.
// For example, formatDecimalParts(1.23) returns ["123", 0].

function formatDecimalParts(x, p) {
  if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity

  var i,
      coefficient = x.slice(0, i); // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
  // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).

  return [coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1)];
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/exponent.js

/* harmony default export */ var src_exponent = (function (x) {
  return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/formatGroup.js


/* harmony default export */ var formatGroup = (function (grouping, thousands) {
  return function (value, width) {
    var i = value.length,
        t = [],
        j = 0,
        g = grouping[0],
        length = 0;

    while (i > 0 && g > 0) {
      if (length + g + 1 > width) g = Math.max(1, width - length);
      t.push(value.substring(i -= g, i + g));
      if ((length += g + 1) > width) break;
      g = grouping[j = (j + 1) % grouping.length];
    }

    return t.reverse().join(thousands);
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/formatNumerals.js


/* harmony default export */ var formatNumerals = (function (numerals) {
  return function (value) {
    return value.replace(/[0-9]/g, function (i) {
      return numerals[+i];
    });
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/formatSpecifier.js







// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function formatSpecifier_formatSpecifier(specifier) {
  if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
  var match;
  return new FormatSpecifier({
    fill: match[1],
    align: match[2],
    sign: match[3],
    symbol: match[4],
    zero: match[5],
    width: match[6],
    comma: match[7],
    precision: match[8] && match[8].slice(1),
    trim: match[9],
    type: match[10]
  });
}
formatSpecifier_formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof

function FormatSpecifier(specifier) {
  this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
  this.align = specifier.align === undefined ? ">" : specifier.align + "";
  this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
  this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
  this.zero = !!specifier.zero;
  this.width = specifier.width === undefined ? undefined : +specifier.width;
  this.comma = !!specifier.comma;
  this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
  this.trim = !!specifier.trim;
  this.type = specifier.type === undefined ? "" : specifier.type + "";
}

FormatSpecifier.prototype.toString = function () {
  return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/formatTrim.js

// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
/* harmony default export */ var formatTrim = (function (s) {
  out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
    switch (s[i]) {
      case ".":
        i0 = i1 = i;
        break;

      case "0":
        if (i0 === 0) i0 = i;
        i1 = i;
        break;

      default:
        if (!+s[i]) break out;
        if (i0 > 0) i0 = 0;
        break;
    }
  }

  return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
});
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.number.to-fixed.js
var es_number_to_fixed = __webpack_require__("b680");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.number.to-precision.js
var es_number_to_precision = __webpack_require__("542d");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/formatPrefixAuto.js



var prefixExponent;
/* harmony default export */ var formatPrefixAuto = (function (x, p) {
  var d = formatDecimalParts(x, p);
  if (!d) return x + "";
  var coefficient = d[0],
      exponent = d[1],
      i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
      n = coefficient.length;
  return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/formatRounded.js



/* harmony default export */ var formatRounded = (function (x, p) {
  var d = formatDecimalParts(x, p);
  if (!d) return x + "";
  var coefficient = d[0],
      exponent = d[1];
  return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/formatTypes.js








/* harmony default export */ var formatTypes = ({
  "%": function _(x, p) {
    return (x * 100).toFixed(p);
  },
  "b": function b(x) {
    return Math.round(x).toString(2);
  },
  "c": function c(x) {
    return x + "";
  },
  "d": formatDecimal,
  "e": function e(x, p) {
    return x.toExponential(p);
  },
  "f": function f(x, p) {
    return x.toFixed(p);
  },
  "g": function g(x, p) {
    return x.toPrecision(p);
  },
  "o": function o(x) {
    return Math.round(x).toString(8);
  },
  "p": function p(x, _p) {
    return formatRounded(x * 100, _p);
  },
  "r": formatRounded,
  "s": formatPrefixAuto,
  "X": function X(x) {
    return Math.round(x).toString(16).toUpperCase();
  },
  "x": function x(_x) {
    return Math.round(_x).toString(16);
  }
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/identity.js
/* harmony default export */ var d3_format_src_identity = (function (x) {
  return x;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/locale.js

















var locale_map = Array.prototype.map,
    locale_prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
/* harmony default export */ var src_locale = (function (locale) {
  var group = locale.grouping === undefined || locale.thousands === undefined ? d3_format_src_identity : formatGroup(locale_map.call(locale.grouping, Number), locale.thousands + ""),
      currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
      currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
      decimal = locale.decimal === undefined ? "." : locale.decimal + "",
      numerals = locale.numerals === undefined ? d3_format_src_identity : formatNumerals(locale_map.call(locale.numerals, String)),
      percent = locale.percent === undefined ? "%" : locale.percent + "",
      minus = locale.minus === undefined ? "-" : locale.minus + "",
      nan = locale.nan === undefined ? "NaN" : locale.nan + "";

  function newFormat(specifier) {
    specifier = formatSpecifier_formatSpecifier(specifier);
    var fill = specifier.fill,
        align = specifier.align,
        sign = specifier.sign,
        symbol = specifier.symbol,
        zero = specifier.zero,
        width = specifier.width,
        comma = specifier.comma,
        precision = specifier.precision,
        trim = specifier.trim,
        type = specifier.type; // The "n" type is an alias for ",g".

    if (type === "n") comma = true, type = "g"; // The "" type, and any invalid type, is an alias for ".12~g".
    else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g"; // If zero fill is specified, padding goes after sign and before digits.

    if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; // Compute the prefix and suffix.
    // For SI-prefix, the suffix is lazily computed.

    var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
        suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; // What format function should we use?
    // Is this an integer type?
    // Can this type generate exponential notation?

    var formatType = formatTypes[type],
        maybeSuffix = /[defgprs%]/.test(type); // Set the default precision if not specified,
    // or clamp the specified precision to the supported range.
    // For significant precision, it must be in [1, 21].
    // For fixed precision, it must be in [0, 20].

    precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));

    function format(value) {
      var valuePrefix = prefix,
          valueSuffix = suffix,
          i,
          n,
          c;

      if (type === "c") {
        valueSuffix = formatType(value) + valueSuffix;
        value = "";
      } else {
        value = +value; // Determine the sign. -0 is not less than 0, but 1 / -0 is!

        var valueNegative = value < 0 || 1 / value < 0; // Perform the initial formatting.

        value = isNaN(value) ? nan : formatType(Math.abs(value), precision); // Trim insignificant zeros.

        if (trim) value = formatTrim(value); // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.

        if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; // Compute the prefix and suffix.

        valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
        valueSuffix = (type === "s" ? locale_prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); // Break the formatted value into the integer “value” part that can be
        // grouped, and fractional or exponential “suffix” part that is not.

        if (maybeSuffix) {
          i = -1, n = value.length;

          while (++i < n) {
            if (c = value.charCodeAt(i), 48 > c || c > 57) {
              valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
              value = value.slice(0, i);
              break;
            }
          }
        }
      } // If the fill character is not "0", grouping is applied before padding.


      if (comma && !zero) value = group(value, Infinity); // Compute the padding.

      var length = valuePrefix.length + value.length + valueSuffix.length,
          padding = length < width ? new Array(width - length + 1).join(fill) : ""; // If the fill character is "0", grouping is applied after padding.

      if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; // Reconstruct the final output based on the desired alignment.

      switch (align) {
        case "<":
          value = valuePrefix + value + valueSuffix + padding;
          break;

        case "=":
          value = valuePrefix + padding + value + valueSuffix;
          break;

        case "^":
          value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
          break;

        default:
          value = padding + valuePrefix + value + valueSuffix;
          break;
      }

      return numerals(value);
    }

    format.toString = function () {
      return specifier + "";
    };

    return format;
  }

  function formatPrefix(specifier, value) {
    var f = newFormat((specifier = formatSpecifier_formatSpecifier(specifier), specifier.type = "f", specifier)),
        e = Math.max(-8, Math.min(8, Math.floor(src_exponent(value) / 3))) * 3,
        k = Math.pow(10, -e),
        prefix = locale_prefixes[8 + e / 3];
    return function (value) {
      return f(k * value) + prefix;
    };
  }

  return {
    format: newFormat,
    formatPrefix: formatPrefix
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/d3-format/src/defaultLocale.js

var src_defaultLocale_locale;
var defaultLocale_format;
var defaultLocale_formatPrefix;
src_defaultLocale_defaultLocale({
  decimal: ".",
  thousands: ",",
  grouping: [3],
  currency: ["$", ""],
  minus: "-"
});
function src_defaultLocale_defaultLocale(definition) {
  src_defaultLocale_locale = src_locale(definition);
  defaultLocale_format = src_defaultLocale_locale.format;
  defaultLocale_formatPrefix = src_defaultLocale_locale.formatPrefix;
  return src_defaultLocale_locale;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/ticks.js












var ticks_defaultFormatter = function defaultFormatter(value) {
  return isArray(value) ? value.map(function (v) {
    return String(v);
  }) : String(value);
};
/**
 * Determine the tick count or interval function.
 * @param {Scale} scale - The scale for which to generate tick values.
 * @param {*} count - The desired tick count or interval specifier.
 * @param {number} minStep - The desired minimum step between tick values.
 * @return {*} - The tick count or interval function.
 */


function ticks_tickCount(scale, count, minStep) {
  var step;

  if (isNumber(count)) {
    if (scale.bins) {
      count = Math.max(count, scale.bins.length);
    }

    if (minStep != null) {
      count = Math.min(count, Math.floor(src_span(scale.domain()) / minStep || 1));
    }
  }

  if (isObject(count)) {
    step = count.step;
    count = count.interval;
  }

  if (isString(count)) {
    count = scale.type === types_Time ? timeInterval(count) : scale.type == types_UTC ? utcInterval(count) : src_error('Only time and utc scales accept interval strings.');
    if (step) count = count.every(step);
  }

  return count;
}
/**
 * Filter a set of candidate tick values, ensuring that only tick values
 * that lie within the scale range are included.
 * @param {Scale} scale - The scale for which to generate tick values.
 * @param {Array<*>} ticks - The candidate tick values.
 * @param {*} count - The tick count or interval function.
 * @return {Array<*>} - The filtered tick values.
 */

function ticks_validTicks(scale, ticks, count) {
  var range = scale.range(),
      lo = range[0],
      hi = src_peek(range);

  if (lo > hi) {
    range = hi;
    hi = lo;
    lo = range;
  }

  lo = Math.floor(lo);
  hi = Math.ceil(hi);
  ticks = ticks.filter(function (v) {
    v = scale(v);
    return lo <= v && v <= hi;
  });

  if (count > 0 && ticks.length > 1) {
    var endpoints = [ticks[0], src_peek(ticks)];

    while (ticks.length > count && ticks.length >= 3) {
      ticks = ticks.filter(function (_, i) {
        return !(i % 2);
      });
    }

    if (ticks.length < 3) {
      ticks = endpoints;
    }
  }

  return ticks;
}
/**
 * Generate tick values for the given scale and approximate tick count or
 * interval value. If the scale has a 'ticks' method, it will be used to
 * generate the ticks, with the count argument passed as a parameter. If the
 * scale lacks a 'ticks' method, the full scale domain will be returned.
 * @param {Scale} scale - The scale for which to generate tick values.
 * @param {*} [count] - The approximate number of desired ticks.
 * @return {Array<*>} - The generated tick values.
 */

function ticks_tickValues(scale, count) {
  return scale.bins ? ticks_validTicks(scale, scale.bins) : scale.ticks ? scale.ticks(count) : scale.domain();
}
/**
 * Generate a label format function for a scale. If the scale has a
 * 'tickFormat' method, it will be used to generate the formatter, with the
 * count and specifier arguments passed as parameters. If the scale lacks a
 * 'tickFormat' method, the returned formatter performs simple string coercion.
 * If the input scale is a logarithmic scale and the format specifier does not
 * indicate a desired decimal precision, a special variable precision formatter
 * that automatically trims trailing zeroes will be generated.
 * @param {Scale} scale - The scale for which to generate the label formatter.
 * @param {*} [count] - The approximate number of desired ticks.
 * @param {string} [specifier] - The format specifier. Must be a legal d3
 *   specifier string (see https://github.com/d3/d3-format#formatSpecifier) or
 *   time multi-format specifier object.
 * @return {function(*):string} - The generated label formatter.
 */

function ticks_tickFormat(scale, count, specifier, formatType, noSkip) {
  var type = scale.type,
      format = type === types_Time || formatType === types_Time ? format_timeFormat(specifier) : type === types_UTC || formatType === types_UTC ? format_utcFormat(specifier) : scale.tickFormat ? scale.tickFormat(count, specifier) : specifier ? defaultLocale_format(specifier) : ticks_defaultFormatter;

  if (scales_isLogarithmic(type)) {
    var logfmt = variablePrecision(specifier);
    format = noSkip || scale.bins ? logfmt : ticks_filter(format, logfmt);
  }

  return format;
}

function ticks_filter(sourceFormat, targetFormat) {
  return function (_) {
    return sourceFormat(_) ? targetFormat(_) : '';
  };
}

function variablePrecision(specifier) {
  var s = formatSpecifier_formatSpecifier(specifier || ',');

  if (s.precision == null) {
    s.precision = 12;

    switch (s.type) {
      case '%':
        s.precision -= 2;
        break;

      case 'e':
        s.precision -= 1;
        break;
    }

    return trimZeroes(defaultLocale_format(s), // number format
    defaultLocale_format('.1f')(1)[1] // decimal point character
    );
  } else {
    return defaultLocale_format(s);
  }
}

function trimZeroes(format, decimalChar) {
  return function (x) {
    var str = format(x),
        dec = str.indexOf(decimalChar),
        idx,
        end;
    if (dec < 0) return str;
    idx = rightmostDigit(str, dec);
    end = idx < str.length ? str.slice(idx) : '';

    while (--idx > dec) {
      if (str[idx] !== '0') {
        ++idx;
        break;
      }
    }

    return str.slice(0, idx) + end;
  };
}

function rightmostDigit(str, dec) {
  var i = str.lastIndexOf('e'),
      c;
  if (i > 0) return i;

  for (i = str.length; --i > dec;) {
    c = str.charCodeAt(i);
    if (c >= 48 && c <= 57) return i + 1; // is digit
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/labels.js


var _symbols, _formats;











var labels_symbols = (_symbols = {}, _defineProperty(_symbols, types_Quantile, 'quantiles'), _defineProperty(_symbols, types_Quantize, 'thresholds'), _defineProperty(_symbols, types_Threshold, 'domain'), _symbols);
var labels_formats = (_formats = {}, _defineProperty(_formats, types_Quantile, 'quantiles'), _defineProperty(_formats, types_Quantize, 'domain'), _formats);
function labels_labelValues(scale, count) {
  return scale.bins ? labels_binValues(scale.bins) : scale.type === types_Log ? logValues(scale, count) : labels_symbols[scale.type] ? labels_thresholdValues(scale[labels_symbols[scale.type]]()) : ticks_tickValues(scale, count);
}

function logValues(scale, count) {
  var ticks = ticks_tickValues(scale, count),
      base = scale.base(),
      logb = Math.log(base),
      k = Math.max(1, base * count / ticks.length); // apply d3-scale's log format filter criteria

  return ticks.filter(function (d) {
    var i = d / Math.pow(base, Math.round(Math.log(d) / logb));
    if (i * base < base - 0.5) i *= base;
    return i <= k;
  });
}

function labels_thresholdFormat(scale, specifier) {
  var _ = scale[labels_formats[scale.type]](),
      n = _.length,
      d = n > 1 ? _[1] - _[0] : _[0],
      i;

  for (i = 1; i < n; ++i) {
    d = Math.min(d, _[i] - _[i - 1]);
  } // tickCount = 3 ticks times 10 for increased resolution


  return tickFormat_tickFormat(0, d, 3 * 10, specifier);
}

function labels_thresholdValues(thresholds) {
  var values = [-Infinity].concat(thresholds);
  values.max = +Infinity;
  return values;
}

function labels_binValues(bins) {
  var values = bins.slice(0, -1);
  values.max = src_peek(bins);
  return values;
}

function labels_isDiscreteRange(scale) {
  return labels_symbols[scale.type] || scale.bins;
}

function labels_labelFormat(scale, count, type, specifier, formatType, noSkip) {
  var format = labels_formats[scale.type] && formatType !== types_Time && formatType !== types_UTC ? labels_thresholdFormat(scale, specifier) : ticks_tickFormat(scale, count, specifier, formatType, noSkip);
  return type === legend_types_SymbolLegend && labels_isDiscreteRange(scale) ? labels_formatRange(format) : type === legend_types_DiscreteLegend ? labels_formatDiscrete(format) : labels_formatPoint(format);
}

function labels_formatRange(format) {
  return function (value, index, array) {
    var limit = labels_get(array[index + 1], labels_get(array.max, +Infinity)),
        lo = labels_formatValue(value, format),
        hi = labels_formatValue(limit, format);
    return lo && hi ? lo + " \u2013 " + hi : hi ? '< ' + hi : "\u2265 " + lo;
  };
}

function labels_get(value, dflt) {
  return value != null ? value : dflt;
}

function labels_formatDiscrete(format) {
  return function (value, index) {
    return index ? format(value) : null;
  };
}

function labels_formatPoint(format) {
  return function (value) {
    return format(value);
  };
}

function labels_formatValue(value, format) {
  return Number.isFinite(value) ? format(value) : null;
}

function labels_labelFraction(scale) {
  var domain = scale.domain(),
      count = domain.length - 1,
      lo = +domain[0],
      hi = +src_peek(domain),
      span = hi - lo;

  if (scale.type === types_Threshold) {
    var adjust = count ? span / count : 0.1;
    lo -= adjust;
    hi += adjust;
    span = hi - lo;
  }

  return function (value) {
    return (value - lo) / span;
  };
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/src/caption.js












function caption_format(scale, specifier, formatType) {
  var type = formatType || scale.type; // replace abbreviated time specifiers to improve screen reader experience

  if (isString(specifier) && scales_isTemporal(type)) {
    specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B');
  }

  return !specifier && type === types_Time ? format_timeFormat('%A, %d %B %Y, %X') : !specifier && type === types_UTC ? format_utcFormat('%A, %d %B %Y, %X UTC') : labels_labelFormat(scale, 5, null, specifier, formatType, true);
}

function caption_domainCaption(scale, opt) {
  opt = opt || {};
  var max = Math.max(3, opt.maxlen || 7),
      fmt = caption_format(scale, opt.format, opt.formatType); // if scale breaks domain into bins, describe boundaries

  if (scales_isDiscretizing(scale.type)) {
    var v = labels_labelValues(scale).slice(1).map(fmt),
        n = v.length;
    return "".concat(n, " boundar").concat(n === 1 ? 'y' : 'ies', ": ").concat(v.join(', '));
  } // if scale domain is discrete, list values
  else if (scales_isDiscrete(scale.type)) {
    var d = scale.domain(),
        _n = d.length,
        _v = _n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', ');

    return "".concat(_n, " value").concat(_n === 1 ? '' : 's', ": ").concat(_v);
  } // if scale domain is continuous, describe value range
  else {
    var _d = scale.domain();

    return "values from ".concat(fmt(_d[0]), " to ").concat(fmt(src_peek(_d)));
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-scale/index.js










// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js







function _iterableToArrayLimit(arr, i) {
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];

  if (_i == null) return;
  var _arr = [];
  var _n = true;
  var _d = false;

  var _s, _e;

  try {
    for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
      _arr.push(_s.value);

      if (i && _arr.length === i) break;
    }
  } catch (err) {
    _d = true;
    _e = err;
  } finally {
    try {
      if (!_n && _i["return"] != null) _i["return"]();
    } finally {
      if (_d) throw _e;
    }
  }

  return _arr;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js




function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.js
var es_set = __webpack_require__("6062");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.values.js
var es_object_values = __webpack_require__("07ac");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.match.js
var es_string_match = __webpack_require__("466d");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.parse-float.js
var es_parse_float = __webpack_require__("acd8");

// CONCATENATED MODULE: ./node_modules/array-flat-polyfill/index.mjs
Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function r(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,function(a,e){return Array.isArray(e)?a.push.apply(a,r.call(e,t-1)):a.push(e),a},[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{configurable:!0,value:function(r){return Array.prototype.map.apply(this,arguments).flat()},writable:!0})

// EXTERNAL MODULE: ./node_modules/clone/clone.js
var clone_clone = __webpack_require__("2410");
var clone_default = /*#__PURE__*/__webpack_require__.n(clone_clone);

// EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js
var fast_deep_equal = __webpack_require__("694b");
var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal);

// EXTERNAL MODULE: ./node_modules/fast-json-stable-stringify/index.js
var fast_json_stable_stringify = __webpack_require__("f71e");
var fast_json_stable_stringify_default = /*#__PURE__*/__webpack_require__.n(fast_json_stable_stringify);

// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/logical.js


function isLogicalOr(op) {
  return !!op.or;
}
function isLogicalAnd(op) {
  return !!op.and;
}
function isLogicalNot(op) {
  return !!op.not;
}
function forEachLeaf(op, fn) {
  if (isLogicalNot(op)) {
    forEachLeaf(op.not, fn);
  } else if (isLogicalAnd(op)) {
    var _iterator = _createForOfIteratorHelper(op.and),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var subop = _step.value;
        forEachLeaf(subop, fn);
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
  } else if (isLogicalOr(op)) {
    var _iterator2 = _createForOfIteratorHelper(op.or),
        _step2;

    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _subop = _step2.value;
        forEachLeaf(_subop, fn);
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
  } else {
    fn(op);
  }
}
function normalizeLogicalComposition(op, normalizer) {
  if (isLogicalNot(op)) {
    return {
      not: normalizeLogicalComposition(op.not, normalizer)
    };
  } else if (isLogicalAnd(op)) {
    return {
      and: op.and.map(function (o) {
        return normalizeLogicalComposition(o, normalizer);
      })
    };
  } else if (isLogicalOr(op)) {
    return {
      or: op.or.map(function (o) {
        return normalizeLogicalComposition(o, normalizer);
      })
    };
  } else {
    return normalizer(op);
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/util.js































var deepEqual = fast_deep_equal_default.a;
var duplicate = clone_default.a;
/**
 * Creates an object composed of the picked object properties.
 *
 * var object = {'a': 1, 'b': '2', 'c': 3};
 * pick(object, ['a', 'c']);
 * // → {'a': 1, 'c': 3}
 */

function util_pick(obj, props) {
  var copy = {};

  var _iterator = _createForOfIteratorHelper(props),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var prop = _step.value;

      if (src_hasOwnProperty(obj, prop)) {
        copy[prop] = obj[prop];
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return copy;
}
/**
 * The opposite of _.pick; this method creates an object composed of the own
 * and inherited enumerable string keyed properties of object that are not omitted.
 */

function omit(obj, props) {
  var copy = Object.assign({}, obj);

  var _iterator2 = _createForOfIteratorHelper(props),
      _step2;

  try {
    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      var prop = _step2.value;
      delete copy[prop];
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }

  return copy;
}
/**
 * Monkey patch Set so that `stringify` produces a string representation of sets.
 */

Set.prototype['toJSON'] = function () {
  return "Set(".concat(_toConsumableArray(this).map(function (x) {
    return fast_json_stable_stringify_default()(x);
  }).join(','), ")");
};
/**
 * Converts any object to a string representation that can be consumed by humans.
 */


var stringify = fast_json_stable_stringify_default.a;
/**
 * Converts any object to a string of limited size, or a number.
 */

function util_hash(a) {
  if (isNumber(a)) {
    return a;
  }

  var str = isString(a) ? a : fast_json_stable_stringify_default()(a); // short strings can be used as hash directly, longer strings are hashed to reduce memory usage

  if (str.length < 250) {
    return str;
  } // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/


  var h = 0;

  for (var i = 0; i < str.length; i++) {
    var _char = str.charCodeAt(i);

    h = (h << 5) - h + _char;
    h = h & h; // Convert to 32bit integer
  }

  return h;
}
function isNullOrFalse(x) {
  return x === false || x === null;
}
function util_contains(array, item) {
  return array.indexOf(item) > -1;
}
/** Returns the array without the elements in item */

function without(array, excludedItems) {
  return array.filter(function (item) {
    return !util_contains(excludedItems, item);
  });
}
function util_union(array, other) {
  return array.concat(without(other, array));
}
/**
 * Returns true if any item returns true.
 */

function some(arr, f) {
  var i = 0;

  var _iterator3 = _createForOfIteratorHelper(arr.entries()),
      _step3;

  try {
    for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
      var _step3$value = _slicedToArray(_step3.value, 2),
          k = _step3$value[0],
          a = _step3$value[1];

      if (f(a, k, i++)) {
        return true;
      }
    }
  } catch (err) {
    _iterator3.e(err);
  } finally {
    _iterator3.f();
  }

  return false;
}
/**
 * Returns true if all items return true.
 */

function every(arr, f) {
  var i = 0;

  var _iterator4 = _createForOfIteratorHelper(arr.entries()),
      _step4;

  try {
    for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
      var _step4$value = _slicedToArray(_step4.value, 2),
          k = _step4$value[0],
          a = _step4$value[1];

      if (!f(a, k, i++)) {
        return false;
      }
    }
  } catch (err) {
    _iterator4.e(err);
  } finally {
    _iterator4.f();
  }

  return true;
}
/**
 * recursively merges src into dest
 */

function mergeDeep(dest) {
  for (var _len = arguments.length, src = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    src[_key - 1] = arguments[_key];
  }

  for (var _i = 0, _src = src; _i < _src.length; _i++) {
    var s = _src[_i];
    deepMerge_(dest, s !== null && s !== void 0 ? s : {});
  }

  return dest;
}

function deepMerge_(dest, src) {
  for (var _i2 = 0, _Object$keys = Object.keys(src); _i2 < _Object$keys.length; _i2++) {
    var property = _Object$keys[_i2];
    writeConfig(dest, property, src[property], true);
  }
}

function unique(values, f) {
  var results = [];
  var u = {};
  var v;

  var _iterator5 = _createForOfIteratorHelper(values),
      _step5;

  try {
    for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
      var val = _step5.value;
      v = f(val);

      if (v in u) {
        continue;
      }

      u[v] = 1;
      results.push(val);
    }
  } catch (err) {
    _iterator5.e(err);
  } finally {
    _iterator5.f();
  }

  return results;
}
/**
 * Returns true if the two dictionaries disagree. Applies only to defined values.
 */

function isEqual(dict, other) {
  var dictKeys = util_keys(dict);
  var otherKeys = util_keys(other);

  if (dictKeys.length !== otherKeys.length) {
    return false;
  }

  var _iterator6 = _createForOfIteratorHelper(dictKeys),
      _step6;

  try {
    for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
      var key = _step6.value;

      if (dict[key] !== other[key]) {
        return false;
      }
    }
  } catch (err) {
    _iterator6.e(err);
  } finally {
    _iterator6.f();
  }

  return true;
}
function setEqual(a, b) {
  if (a.size !== b.size) {
    return false;
  }

  var _iterator7 = _createForOfIteratorHelper(a),
      _step7;

  try {
    for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
      var e = _step7.value;

      if (!b.has(e)) {
        return false;
      }
    }
  } catch (err) {
    _iterator7.e(err);
  } finally {
    _iterator7.f();
  }

  return true;
}
function hasIntersection(a, b) {
  var _iterator8 = _createForOfIteratorHelper(a),
      _step8;

  try {
    for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
      var key = _step8.value;

      if (b.has(key)) {
        return true;
      }
    }
  } catch (err) {
    _iterator8.e(err);
  } finally {
    _iterator8.f();
  }

  return false;
}
function prefixGenerator(a) {
  var prefixes = new Set();

  var _iterator9 = _createForOfIteratorHelper(a),
      _step9;

  try {
    var _loop = function _loop() {
      var x = _step9.value;
      var splitField = splitAccessPath(x); // Wrap every element other than the first in `[]`

      var wrappedWithAccessors = splitField.map(function (y, i) {
        return i === 0 ? y : "[".concat(y, "]");
      });
      var computedPrefixes = wrappedWithAccessors.map(function (_, i) {
        return wrappedWithAccessors.slice(0, i + 1).join('');
      });
      computedPrefixes.forEach(function (y) {
        return prefixes.add(y);
      });
    };

    for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
      _loop();
    }
  } catch (err) {
    _iterator9.e(err);
  } finally {
    _iterator9.f();
  }

  return prefixes;
}
/**
 * Returns true if a and b have an intersection. Also return true if a or b are undefined
 * since this means we don't know what fields a node produces or depends on.
 */

function fieldIntersection(a, b) {
  if (a === undefined || b === undefined) {
    return true;
  }

  return hasIntersection(prefixGenerator(a), prefixGenerator(b));
} // This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208

var util_keys = Object.keys;
var util_vals = Object.values;
function util_entries(x) {
  var _entries = [];

  for (var k in x) {
    if (src_hasOwnProperty(x, k)) {
      _entries.push({
        key: k,
        value: x[k]
      });
    }
  }

  return _entries;
}
function util_isBoolean(b) {
  return b === true || b === false;
}
/**
 * Convert a string into a valid variable name
 */

function varName(s) {
  // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _
  var alphanumericS = s.replace(/\W/g, '_'); // Add _ if the string has leading numbers.

  return (s.match(/^\d+/) ? '_' : '') + alphanumericS;
}
function logicalExpr(op, cb) {
  if (isLogicalNot(op)) {
    return '!(' + logicalExpr(op.not, cb) + ')';
  } else if (isLogicalAnd(op)) {
    return '(' + op.and.map(function (and) {
      return logicalExpr(and, cb);
    }).join(') && (') + ')';
  } else if (isLogicalOr(op)) {
    return '(' + op.or.map(function (or) {
      return logicalExpr(or, cb);
    }).join(') || (') + ')';
  } else {
    return cb(op);
  }
}
/**
 * Delete nested property of an object, and delete the ancestors of the property if they become empty.
 */

function deleteNestedProperty(obj, orderedProps) {
  if (orderedProps.length === 0) {
    return true;
  }

  var prop = orderedProps.shift(); // eslint-disable-line @typescript-eslint/no-non-null-assertion

  if (deleteNestedProperty(obj[prop], orderedProps)) {
    delete obj[prop];
  }

  return util_keys(obj).length === 0;
}
function titlecase(s) {
  return s.charAt(0).toUpperCase() + s.substr(1);
}

function escapePathAccess(string) {
  return string.replace(/(\[|\]|\.|'|")/g, '\\$1');
}
/**
 * Converts a path to an access path with datum.
 * @param path The field name.
 * @param datum The string to use for `datum`.
 */


function accessPathWithDatum(path) {
  var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'datum';
  var pieces = splitAccessPath(path);
  var prefixes = [];

  for (var i = 1; i <= pieces.length; i++) {
    var prefix = "[".concat(pieces.slice(0, i).map(stringValue_$).join(']['), "]");
    prefixes.push("".concat(datum).concat(prefix));
  }

  return prefixes.join(' && ');
}
/**
 * Return access with datum to the flattened field.
 *
 * @param path The field name.
 * @param datum The string to use for `datum`.
 */

function flatAccessWithDatum(path) {
  var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'datum';
  return "".concat(datum, "[").concat(stringValue_$(splitAccessPath(path).join('.')), "]");
}
/**
 * Replaces path accesses with access to non-nested field.
 * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`.
 */

function replacePathInField(path) {
  return "".concat(splitAccessPath(path).map(escapePathAccess).join('\\.'));
}
/**
 * Replace all ocurrences of a string with another string.
 *
 * @param string the string to replace in
 * @param find the string to replace
 * @param replacement the replacement
 */

function replaceAll(string, find, replacement) {
  return string.replace(new RegExp(find.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replacement);
}
/**
 * Remove path accesses with access from field.
 * For example, `foo["bar"].baz` becomes `foo.bar.baz`.
 */

function removePathFromField(path) {
  return "".concat(splitAccessPath(path).join('.'));
}
/**
 * Count the depth of the path. Returns 1 for fields that are not nested.
 */

function accessPathDepth(path) {
  if (!path) {
    return 0;
  }

  return splitAccessPath(path).length;
}
/**
 * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included.
 */

function getFirstDefined() {
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
    args[_key2] = arguments[_key2];
  }

  for (var _i3 = 0, _args = args; _i3 < _args.length; _i3++) {
    var arg = _args[_i3];

    if (arg !== undefined) {
      return arg;
    }
  }

  return undefined;
} // variable used to generate id

var idCounter = 42;
/**
 * Returns a new random id every time it gets called.
 *
 * Has side effect!
 */

function uniqueId(prefix) {
  var id = ++idCounter;
  return prefix ? String(prefix) + id : id;
}
/**
 * Resets the id counter used in uniqueId. This can be useful for testing.
 */

function resetIdCounter() {
  idCounter = 42;
}
function internalField(name) {
  return isInternalField(name) ? name : "__".concat(name);
}
function isInternalField(name) {
  return name.indexOf('__') === 0;
}
/**
 * Normalize angle to be within [0,360).
 */

function normalizeAngle(angle) {
  return (angle % 360 + 360) % 360;
}
/**
 * Returns whether the passed in value is a valid number.
 */

function isNumeric(value) {
  if (isNumber(value)) {
    return true;
  }

  return !isNaN(value) && !isNaN(parseFloat(value));
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/axis.js


var CONDITIONAL_AXIS_PROP_INDEX = {
  domainColor: {
    part: 'domain',
    vgProp: 'stroke'
  },
  labelAlign: {
    part: 'labels',
    vgProp: 'align'
  },
  labelBaseline: {
    part: 'labels',
    vgProp: 'baseline'
  },
  labelColor: {
    part: 'labels',
    vgProp: 'fill'
  },
  labelFont: {
    part: 'labels',
    vgProp: 'font'
  },
  labelFontSize: {
    part: 'labels',
    vgProp: 'fontSize'
  },
  labelFontStyle: {
    part: 'labels',
    vgProp: 'fontStyle'
  },
  labelFontWeight: {
    part: 'labels',
    vgProp: 'fontWeight'
  },
  labelOpacity: {
    part: 'labels',
    vgProp: 'opacity'
  },
  labelOffset: null,
  labelPadding: null,
  gridColor: {
    part: 'grid',
    vgProp: 'stroke'
  },
  gridDash: {
    part: 'grid',
    vgProp: 'strokeDash'
  },
  gridDashOffset: {
    part: 'grid',
    vgProp: 'strokeDash'
  },
  gridOpacity: {
    part: 'grid',
    vgProp: 'opacity'
  },
  gridWidth: {
    part: 'grid',
    vgProp: 'strokeWidth'
  },
  tickColor: {
    part: 'ticks',
    vgProp: 'stroke'
  },
  tickDash: {
    part: 'ticks',
    vgProp: 'strokeDash'
  },
  tickDashOffset: {
    part: 'ticks',
    vgProp: 'strokeDash'
  },
  tickOpacity: {
    part: 'ticks',
    vgProp: 'opacity'
  },
  tickSize: null,
  tickWidth: {
    part: 'ticks',
    vgProp: 'strokeWidth'
  },
  titleColor: {
    part: 'title',
    vgProp: 'fill'
  },
  title: null // title supports signal, let's use it.

};
function isConditionalAxisValue(v) {
  return v && v['condition'];
}
var AXIS_PARTS = ['domain', 'grid', 'labels', 'ticks', 'title'];
/**
 * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes.
 */

var AXIS_PROPERTY_TYPE = {
  grid: 'grid',
  gridColor: 'grid',
  gridDash: 'grid',
  gridDashOffset: 'grid',
  gridOpacity: 'grid',
  gridScale: 'grid',
  gridWidth: 'grid',
  orient: 'main',
  bandPosition: 'both',
  domain: 'main',
  domainColor: 'main',
  domainDash: 'main',
  domainDashOffset: 'main',
  domainOpacity: 'main',
  domainWidth: 'main',
  format: 'main',
  formatType: 'main',
  labelAlign: 'main',
  labelAngle: 'main',
  labelBaseline: 'main',
  labelBound: 'main',
  labelColor: 'main',
  labelFlush: 'main',
  labelFlushOffset: 'main',
  labelFont: 'main',
  labelFontSize: 'main',
  labelFontStyle: 'main',
  labelFontWeight: 'main',
  labelLimit: 'main',
  labelLineHeight: 'main',
  labelOpacity: 'main',
  labelOffset: 'main',
  labelOverlap: 'main',
  labelPadding: 'main',
  labels: 'main',
  labelSeparation: 'main',
  maxExtent: 'main',
  minExtent: 'main',
  offset: 'both',
  position: 'main',
  tickColor: 'main',
  tickDash: 'main',
  tickDashOffset: 'main',
  tickMinStep: 'main',
  tickOffset: 'both',
  tickOpacity: 'main',
  tickRound: 'both',
  ticks: 'main',
  tickSize: 'main',
  tickWidth: 'both',
  title: 'main',
  titleAlign: 'main',
  titleAnchor: 'main',
  titleAngle: 'main',
  titleBaseline: 'main',
  titleColor: 'main',
  titleFont: 'main',
  titleFontSize: 'main',
  titleFontStyle: 'main',
  titleFontWeight: 'main',
  titleLimit: 'main',
  titleLineHeight: 'main',
  titleOpacity: 'main',
  titlePadding: 'main',
  titleX: 'main',
  titleY: 'main',
  encode: 'both',
  scale: 'both',
  tickBand: 'both',
  tickCount: 'both',
  tickExtra: 'both',
  translate: 'both',
  values: 'both',
  zindex: 'both' // this is actually set afterward, so it doesn't matter

};
var COMMON_AXIS_PROPERTIES_INDEX = {
  orient: 1,
  bandPosition: 1,
  domain: 1,
  domainColor: 1,
  domainDash: 1,
  domainDashOffset: 1,
  domainOpacity: 1,
  domainWidth: 1,
  format: 1,
  formatType: 1,
  grid: 1,
  gridColor: 1,
  gridDash: 1,
  gridDashOffset: 1,
  gridOpacity: 1,
  gridWidth: 1,
  labelAlign: 1,
  labelAngle: 1,
  labelBaseline: 1,
  labelBound: 1,
  labelColor: 1,
  labelFlush: 1,
  labelFlushOffset: 1,
  labelFont: 1,
  labelFontSize: 1,
  labelFontStyle: 1,
  labelFontWeight: 1,
  labelLimit: 1,
  labelLineHeight: 1,
  labelOffset: 1,
  labelOpacity: 1,
  labelOverlap: 1,
  labelPadding: 1,
  labels: 1,
  labelSeparation: 1,
  maxExtent: 1,
  minExtent: 1,
  offset: 1,
  position: 1,
  tickBand: 1,
  tickColor: 1,
  tickCount: 1,
  tickDash: 1,
  tickDashOffset: 1,
  tickExtra: 1,
  tickMinStep: 1,
  tickOffset: 1,
  tickOpacity: 1,
  tickRound: 1,
  ticks: 1,
  tickSize: 1,
  tickWidth: 1,
  title: 1,
  titleAlign: 1,
  titleAnchor: 1,
  titleAngle: 1,
  titleBaseline: 1,
  titleColor: 1,
  titleFont: 1,
  titleFontSize: 1,
  titleFontStyle: 1,
  titleFontWeight: 1,
  titleLimit: 1,
  titleLineHeight: 1,
  titleOpacity: 1,
  titlePadding: 1,
  titleX: 1,
  titleY: 1,
  values: 1,
  translate: 1,
  zindex: 1
};
var AXIS_PROPERTIES_INDEX = Object.assign(Object.assign({}, COMMON_AXIS_PROPERTIES_INDEX), {
  style: 1,
  labelExpr: 1,
  encoding: 1
});
function isAxisProperty(prop) {
  return !!AXIS_PROPERTIES_INDEX[prop];
} // Export for dependent projects

var AXIS_PROPERTIES = util_keys(AXIS_PROPERTIES_INDEX);
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js


function _defineProperties(target, props) {
  for (var i = 0; i < props.length; i++) {
    var descriptor = props[i];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor) descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}

function _createClass(Constructor, protoProps, staticProps) {
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  if (staticProps) _defineProperties(Constructor, staticProps);
  return Constructor;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/mark.js



var AREA = 'area';
var BAR = 'bar';
var IMAGE = 'image';
var LINE = 'line';
var POINT = 'point';
var RECT = 'rect';
var RULE = 'rule';
var TEXT = 'text';
var TICK = 'tick';
var TRAIL = 'trail';
var CIRCLE = 'circle';
var SQUARE = 'square';
var GEOSHAPE = 'geoshape'; // Using mapped type to declare index, ensuring we always have all marks when we add more.

var MARK_INDEX = {
  area: 1,
  bar: 1,
  image: 1,
  line: 1,
  point: 1,
  text: 1,
  tick: 1,
  trail: 1,
  rect: 1,
  geoshape: 1,
  rule: 1,
  circle: 1,
  square: 1
};
function isMark(m) {
  return !!MARK_INDEX[m];
}
function isPathMark(m) {
  return util_contains(['line', 'area', 'trail'], m);
}
function isRectBasedMark(m) {
  return util_contains(['rect', 'bar', 'image'], m);
}
var PRIMITIVE_MARKS = util_keys(MARK_INDEX);
function isMarkDef(mark) {
  return mark['type'];
}
var PRIMITIVE_MARK_INDEX = toSet(PRIMITIVE_MARKS);
function isPrimitiveMark(mark) {
  var markType = isMarkDef(mark) ? mark.type : mark;
  return markType in PRIMITIVE_MARK_INDEX;
}
var STROKE_CONFIG = ['stroke', 'strokeWidth', 'strokeDash', 'strokeDashOffset', 'strokeOpacity', 'strokeJoin', 'strokeMiterLimit'];
var FILL_CONFIG = ['fill', 'fillOpacity'];
var FILL_STROKE_CONFIG = [].concat(STROKE_CONFIG, FILL_CONFIG);
var VL_ONLY_MARK_CONFIG_PROPERTIES = ['filled', 'color', 'tooltip', 'invalid', 'timeUnitBandPosition', 'timeUnitBand'];
var VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {
  area: ['line', 'point'],
  bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize'],
  rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize'],
  line: ['point'],
  tick: ['bandSize', 'thickness']
};
var defaultMarkConfig = {
  color: '#4c78a8',
  invalid: 'filter',
  timeUnitBand: 1
};
var BAR_CORNER_RADIUS_INDEX = {
  horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'],
  vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight']
};
var DEFAULT_RECT_BAND_SIZE = 5;
var defaultBarConfig = {
  binSpacing: 1,
  continuousBandSize: DEFAULT_RECT_BAND_SIZE,
  timeUnitBandPosition: 0.5
};
var defaultRectConfig = {
  binSpacing: 0,
  continuousBandSize: DEFAULT_RECT_BAND_SIZE,
  timeUnitBandPosition: 0.5
};
var defaultTickConfig = {
  thickness: 1
};
function getMarkType(m) {
  return isMarkDef(m) ? m.type : m;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/spec/unit.js
function isUnitSpec(spec) {
  return !!spec['mark'];
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compositemark/base.js





var base_CompositeMarkNormalizer = /*#__PURE__*/function () {
  function CompositeMarkNormalizer(name, run) {
    _classCallCheck(this, CompositeMarkNormalizer);

    this.name = name;
    this.run = run;
  }

  _createClass(CompositeMarkNormalizer, [{
    key: "hasMatchingType",
    value: function hasMatchingType(spec) {
      if (isUnitSpec(spec)) {
        return getMarkType(spec.mark) === this.name;
      }

      return false;
    }
  }]);

  return CompositeMarkNormalizer;
}();
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/aggregate.js


var AGGREGATE_OP_INDEX = {
  argmax: 1,
  argmin: 1,
  average: 1,
  count: 1,
  distinct: 1,
  product: 1,
  max: 1,
  mean: 1,
  median: 1,
  min: 1,
  missing: 1,
  q1: 1,
  q3: 1,
  ci0: 1,
  ci1: 1,
  stderr: 1,
  stdev: 1,
  stdevp: 1,
  sum: 1,
  valid: 1,
  values: 1,
  variance: 1,
  variancep: 1
};
var MULTIDOMAIN_SORT_OP_INDEX = {
  count: 1,
  min: 1,
  max: 1
};
function isArgminDef(a) {
  return !!a && !!a['argmin'];
}
function isArgmaxDef(a) {
  return !!a && !!a['argmax'];
}
var AGGREGATE_OPS = util_keys(AGGREGATE_OP_INDEX);
function isAggregateOp(a) {
  return isString(a) && !!AGGREGATE_OP_INDEX[a];
}
var COUNTING_OPS = ['count', 'valid', 'missing', 'distinct'];
function isCountingAggregateOp(aggregate) {
  return isString(aggregate) && util_contains(COUNTING_OPS, aggregate);
}
function isMinMaxOp(aggregate) {
  return isString(aggregate) && util_contains(['min', 'max'], aggregate);
}
/** Additive-based aggregation operations. These can be applied to stack. */

var SUM_OPS = ['count', 'sum', 'distinct', 'valid', 'missing'];
/**
 * Aggregation operators that always produce values within the range [domainMin, domainMax].
 */

var SHARED_DOMAIN_OPS = ['mean', 'average', 'median', 'q1', 'q3', 'min', 'max'];
var SHARED_DOMAIN_OP_INDEX = toSet(SHARED_DOMAIN_OPS);
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.entries.js
var es_object_entries = __webpack_require__("4fad");

// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/channel.js


/*
 * Constants and utilities for encoding channels (Visual variables)
 * such as 'x', 'y', 'color'.
 */

 // Facet

var ROW = 'row';
var COLUMN = 'column';
var FACET = 'facet'; // Position

var channel_X = 'x';
var channel_Y = 'y';
var channel_X2 = 'x2';
var channel_Y2 = 'y2'; // Geo Position

var LATITUDE = 'latitude';
var LONGITUDE = 'longitude';
var LATITUDE2 = 'latitude2';
var LONGITUDE2 = 'longitude2'; // Mark property with scale

var COLOR = 'color';
var FILL = 'fill';
var STROKE = 'stroke';
var SHAPE = 'shape';
var channel_SIZE = 'size';
var OPACITY = 'opacity';
var FILLOPACITY = 'fillOpacity';
var STROKEOPACITY = 'strokeOpacity';
var STROKEWIDTH = 'strokeWidth';
var STROKEDASH = 'strokeDash'; // Non-scale channel

var channel_TEXT = 'text';
var ORDER = 'order';
var DETAIL = 'detail';
var KEY = 'key';
var TOOLTIP = 'tooltip';
var HREF = 'href';
var channel_URL = 'url';
var POSITION_CHANNEL_INDEX = {
  x: 1,
  y: 1,
  x2: 1,
  y2: 1
};
function channel_isPositionChannel(c) {
  return c in POSITION_CHANNEL_INDEX;
}
function getPositionChannelFromLatLong(channel) {
  switch (channel) {
    case LATITUDE:
      return 'y';

    case LATITUDE2:
      return 'y2';

    case LONGITUDE:
      return 'x';

    case LONGITUDE2:
      return 'x2';
  }
}
var GEOPOSITION_CHANNEL_INDEX = {
  longitude: 1,
  longitude2: 1,
  latitude: 1,
  latitude2: 1
};
function isGeoPositionChannel(c) {
  return c in GEOPOSITION_CHANNEL_INDEX;
}
var GEOPOSITION_CHANNELS = util_keys(GEOPOSITION_CHANNEL_INDEX);
var UNIT_CHANNEL_INDEX = Object.assign(Object.assign(Object.assign({}, POSITION_CHANNEL_INDEX), GEOPOSITION_CHANNEL_INDEX), {
  // color
  color: 1,
  fill: 1,
  stroke: 1,
  // other non-position with scale
  opacity: 1,
  fillOpacity: 1,
  strokeOpacity: 1,
  strokeWidth: 1,
  strokeDash: 1,
  size: 1,
  shape: 1,
  // channels without scales
  order: 1,
  text: 1,
  detail: 1,
  key: 1,
  tooltip: 1,
  href: 1,
  url: 1
});
function isColorChannel(channel) {
  return channel === 'color' || channel === 'fill' || channel === 'stroke';
}
var FACET_CHANNEL_INDEX = {
  row: 1,
  column: 1,
  facet: 1
};
var FACET_CHANNELS = util_keys(FACET_CHANNEL_INDEX);
var CHANNEL_INDEX = Object.assign(Object.assign({}, UNIT_CHANNEL_INDEX), FACET_CHANNEL_INDEX);
var CHANNELS = util_keys(CHANNEL_INDEX);

var _o = CHANNEL_INDEX.order,
    channel_d = CHANNEL_INDEX.detail,
    _tt1 = CHANNEL_INDEX.tooltip,
    SINGLE_DEF_CHANNEL_INDEX = __rest(CHANNEL_INDEX, ["order", "detail", "tooltip"]);

var channel_r = SINGLE_DEF_CHANNEL_INDEX.row,
    channel_c = SINGLE_DEF_CHANNEL_INDEX.column,
    channel_f = SINGLE_DEF_CHANNEL_INDEX.facet,
    SINGLE_DEF_UNIT_CHANNEL_INDEX = __rest(SINGLE_DEF_CHANNEL_INDEX, ["row", "column", "facet"]);
/**
 * Channels that cannot have an array of channelDef.
 * model.fieldDef, getFieldDef only work for these channels.
 *
 * (The only two channels that can have an array of channelDefs are "detail" and "order".
 * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef
 * are not applicable for them. Similarly, selection projection won't work with "detail" and "order".)
 */


var SINGLE_DEF_CHANNELS = util_keys(SINGLE_DEF_CHANNEL_INDEX);
var SINGLE_DEF_UNIT_CHANNELS = util_keys(SINGLE_DEF_UNIT_CHANNEL_INDEX);
function isSingleDefUnitChannel(str) {
  return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str];
}
function isChannel(str) {
  return !!CHANNEL_INDEX[str];
}
var SECONDARY_RANGE_CHANNEL = ['x2', 'y2', 'latitude2', 'longitude2'];
function isSecondaryRangeChannel(c) {
  var main = getMainRangeChannel(c);
  return main !== c;
}
/**
 * Get the main channel for a range channel. E.g. `x` for `x2`.
 */

function getMainRangeChannel(channel) {
  switch (channel) {
    case 'x2':
      return 'x';

    case 'y2':
      return 'y';

    case 'latitude2':
      return 'latitude';

    case 'longitude2':
      return 'longitude';
  }

  return channel;
}
/**
 * Get the main channel for a range channel. E.g. `x` for `x2`.
 */

function getSecondaryRangeChannel(channel) {
  switch (channel) {
    case 'x':
      return 'x2';

    case 'y':
      return 'y2';

    case 'latitude':
      return 'latitude2';

    case 'longitude':
      return 'longitude2';
  }

  return undefined;
} // CHANNELS without COLUMN, ROW

var UNIT_CHANNELS = util_keys(UNIT_CHANNEL_INDEX); // NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2;

var channel_x = UNIT_CHANNEL_INDEX.x,
    channel_y = UNIT_CHANNEL_INDEX.y,
    channel_x2 = UNIT_CHANNEL_INDEX.x2,
    channel_y2 = UNIT_CHANNEL_INDEX.y2,
    _latitude = UNIT_CHANNEL_INDEX.latitude,
    _longitude = UNIT_CHANNEL_INDEX.longitude,
    _latitude2 = UNIT_CHANNEL_INDEX.latitude2,
    _longitude2 = UNIT_CHANNEL_INDEX.longitude2,
    NONPOSITION_CHANNEL_INDEX = __rest(UNIT_CHANNEL_INDEX, ["x", "y", "x2", "y2", "latitude", "longitude", "latitude2", "longitude2"]);

var NONPOSITION_CHANNELS = util_keys(NONPOSITION_CHANNEL_INDEX); // POSITION_SCALE_CHANNELS = X and Y;

var POSITION_SCALE_CHANNEL_INDEX = {
  x: 1,
  y: 1
};
var POSITION_SCALE_CHANNELS = util_keys(POSITION_SCALE_CHANNEL_INDEX);
function getSizeType(channel) {
  return channel === 'x' ? 'width' : 'height';
}
function getPositionScaleChannel(sizeType) {
  return sizeType === 'width' ? 'x' : 'y';
} // NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without X, Y

var _t = NONPOSITION_CHANNEL_INDEX.text,
    _tt = NONPOSITION_CHANNEL_INDEX.tooltip,
    _hr = NONPOSITION_CHANNEL_INDEX.href,
    _u = NONPOSITION_CHANNEL_INDEX.url,
    _dd = NONPOSITION_CHANNEL_INDEX.detail,
    channel_k = NONPOSITION_CHANNEL_INDEX.key,
    _oo = NONPOSITION_CHANNEL_INDEX.order,
    NONPOSITION_SCALE_CHANNEL_INDEX = __rest(NONPOSITION_CHANNEL_INDEX, ["text", "tooltip", "href", "url", "detail", "key", "order"]);

var NONPOSITION_SCALE_CHANNELS = util_keys(NONPOSITION_SCALE_CHANNEL_INDEX);
function isNonPositionScaleChannel(channel) {
  return !!NONPOSITION_CHANNEL_INDEX[channel];
}
/**
 * @returns whether Vega supports legends for a particular channel
 */

function supportLegend(channel) {
  switch (channel) {
    case COLOR:
    case FILL:
    case STROKE:
    case channel_SIZE:
    case SHAPE:
    case OPACITY:
    case STROKEWIDTH:
    case STROKEDASH:
      return true;

    case FILLOPACITY:
    case STROKEOPACITY:
      return false;
  }
} // Declare SCALE_CHANNEL_INDEX

var SCALE_CHANNEL_INDEX = Object.assign(Object.assign({}, POSITION_SCALE_CHANNEL_INDEX), NONPOSITION_SCALE_CHANNEL_INDEX);
/** List of channels with scales */

var SCALE_CHANNELS = util_keys(SCALE_CHANNEL_INDEX);
function isScaleChannel(channel) {
  return !!SCALE_CHANNEL_INDEX[channel];
}
/**
 * Return whether a channel supports a particular mark type.
 * @param channel  channel name
 * @param mark the mark type
 * @return whether the mark supports the channel
 */

function supportMark(channel, mark) {
  return getSupportedMark(channel)[mark];
}
var ALL_MARKS = {
  area: 'always',
  bar: 'always',
  circle: 'always',
  geoshape: 'always',
  image: 'always',
  line: 'always',
  rule: 'always',
  point: 'always',
  rect: 'always',
  square: 'always',
  trail: 'always',
  text: 'always',
  tick: 'always'
};

var channel_g = ALL_MARKS.geoshape,
    ALL_MARKS_EXCEPT_GEOSHAPE = __rest(ALL_MARKS, ["geoshape"]);
/**
 * Return a dictionary showing whether a channel supports mark type.
 * @param channel
 * @return A dictionary mapping mark types to 'always', 'binned', or undefined
 */


function getSupportedMark(channel) {
  switch (channel) {
    case COLOR:
    case FILL:
    case STROKE: // falls through

    case DETAIL:
    case KEY:
    case TOOLTIP:
    case HREF:
    case ORDER: // TODO: revise (order might not support rect, which is not stackable?)

    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY:
    case STROKEWIDTH: // falls through

    case FACET:
    case ROW: // falls through

    case COLUMN:
      return ALL_MARKS;

    case channel_X:
    case channel_Y:
    case LATITUDE:
    case LONGITUDE:
      // all marks except geoshape. geoshape does not use X, Y -- it uses a projection
      return ALL_MARKS_EXCEPT_GEOSHAPE;

    case channel_X2:
    case channel_Y2:
    case LATITUDE2:
    case LONGITUDE2:
      return {
        area: 'always',
        bar: 'always',
        image: 'always',
        rect: 'always',
        rule: 'always',
        circle: 'binned',
        point: 'binned',
        square: 'binned',
        tick: 'binned',
        line: 'binned',
        trail: 'binned'
      };

    case channel_SIZE:
      return {
        point: 'always',
        tick: 'always',
        rule: 'always',
        circle: 'always',
        square: 'always',
        bar: 'always',
        text: 'always',
        line: 'always',
        trail: 'always'
      };

    case STROKEDASH:
      return {
        line: 'always',
        point: 'always',
        tick: 'always',
        rule: 'always',
        circle: 'always',
        square: 'always',
        bar: 'always',
        geoshape: 'always'
      };

    case SHAPE:
      return {
        point: 'always',
        geoshape: 'always'
      };

    case channel_TEXT:
      return {
        text: 'always'
      };

    case channel_URL:
      return {
        image: 'always'
      };
  }
}

function rangeType(channel) {
  switch (channel) {
    case channel_X:
    case channel_Y:
    case channel_SIZE:
    case STROKEWIDTH:
    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY: // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through]

    case channel_X2:
    case channel_Y2:
      return undefined;

    case FACET:
    case ROW:
    case COLUMN:
    case SHAPE:
    case STROKEDASH: // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through]

    case channel_TEXT:
    case TOOLTIP:
    case HREF:
    case channel_URL:
      return 'discrete';
    // Color can be either continuous or discrete, depending on scale type.

    case COLOR:
    case FILL:
    case STROKE:
      return 'flexible';
    // No scale, no range type.

    case LATITUDE:
    case LONGITUDE:
    case LATITUDE2:
    case LONGITUDE2:
    case DETAIL:
    case KEY:
    case ORDER:
      return undefined;
  }
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.repeat.js
var es_string_repeat = __webpack_require__("38cf");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.anchor.js
var es_string_anchor = __webpack_require__("18a5");

// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/title.js




function extractTitleConfig(titleConfig) {
  var anchor = titleConfig.anchor,
      frame = titleConfig.frame,
      offset = titleConfig.offset,
      orient = titleConfig.orient,
      color = titleConfig.color,
      subtitleColor = titleConfig.subtitleColor,
      subtitleFont = titleConfig.subtitleFont,
      subtitleFontSize = titleConfig.subtitleFontSize,
      subtitleFontStyle = titleConfig.subtitleFontStyle,
      subtitleFontWeight = titleConfig.subtitleFontWeight,
      subtitleLineHeight = titleConfig.subtitleLineHeight,
      subtitlePadding = titleConfig.subtitlePadding,
      titleMarkConfig = __rest(titleConfig, ["anchor", "frame", "offset", "orient", "color", "subtitleColor", "subtitleFont", "subtitleFontSize", "subtitleFontStyle", "subtitleFontWeight", "subtitleLineHeight", "subtitlePadding"]);

  var mark = Object.assign(Object.assign({}, titleMarkConfig), color ? {
    fill: color
  } : {});
  var nonMark = Object.assign(Object.assign(Object.assign(Object.assign({}, anchor ? {
    anchor: anchor
  } : {}), frame ? {
    frame: frame
  } : {}), offset ? {
    offset: offset
  } : {}), orient ? {
    orient: orient
  } : {});
  var subtitle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, subtitleColor ? {
    subtitleColor: subtitleColor
  } : {}), subtitleFont ? {
    subtitleFont: subtitleFont
  } : {}), subtitleFontSize ? {
    subtitleFontSize: subtitleFontSize
  } : {}), subtitleFontStyle ? {
    subtitleFontStyle: subtitleFontStyle
  } : {}), subtitleFontWeight ? {
    subtitleFontWeight: subtitleFontWeight
  } : {}), subtitleLineHeight ? {
    subtitleLineHeight: subtitleLineHeight
  } : {}), subtitlePadding ? {
    subtitlePadding: subtitlePadding
  } : {});
  return {
    mark: mark,
    nonMark: nonMark,
    subtitle: subtitle
  };
}
function isText(v) {
  return isString(v) || isArray(v) && isString(v[0]);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/vega.schema.js


function isSignalRef(o) {
  return o && !!o['signal'];
}
function isVgRangeStep(range) {
  return !!range['step'];
}
function isDataRefUnionedDomain(domain) {
  if (!isArray(domain)) {
    return 'fields' in domain && !('data' in domain);
  }

  return false;
}
function isFieldRefUnionDomain(domain) {
  if (!isArray(domain)) {
    return 'fields' in domain && 'data' in domain;
  }

  return false;
}
function isDataRefDomain(domain) {
  if (!isArray(domain)) {
    return 'field' in domain && 'data' in domain;
  }

  return false;
}
var VG_MARK_CONFIG_INDEX = {
  blend: 1,
  opacity: 1,
  fill: 1,
  fillOpacity: 1,
  stroke: 1,
  strokeCap: 1,
  strokeWidth: 1,
  strokeOpacity: 1,
  strokeDash: 1,
  strokeDashOffset: 1,
  strokeJoin: 1,
  strokeOffset: 1,
  strokeMiterLimit: 1,
  size: 1,
  shape: 1,
  interpolate: 1,
  tension: 1,
  orient: 1,
  align: 1,
  baseline: 1,
  text: 1,
  dir: 1,
  dx: 1,
  dy: 1,
  ellipsis: 1,
  limit: 1,
  radius: 1,
  theta: 1,
  angle: 1,
  font: 1,
  fontSize: 1,
  fontWeight: 1,
  fontStyle: 1,
  lineBreak: 1,
  lineHeight: 1,
  cursor: 1,
  href: 1,
  tooltip: 1,
  cornerRadius: 1,
  cornerRadiusTopLeft: 1,
  cornerRadiusTopRight: 1,
  cornerRadiusBottomLeft: 1,
  cornerRadiusBottomRight: 1,
  aspect: 1,
  width: 1,
  height: 1 // commented below are vg channel that do not have mark config.
  // x: 1,
  // y: 1,
  // x2: 1,
  // y2: 1,
  // xc'|'yc'
  // clip: 1,
  // endAngle: 1,
  // innerRadius: 1,
  // outerRadius: 1,
  // path: 1,
  // startAngle: 1,
  // url: 1,

};
var VG_MARK_CONFIGS = util_keys(VG_MARK_CONFIG_INDEX); // Vega's cornerRadius channels.

var VG_CORNERRADIUS_CHANNELS = ['cornerRadius', 'cornerRadiusTopLeft', 'cornerRadiusTopRight', 'cornerRadiusBottomLeft', 'cornerRadiusBottomRight'];
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/common.js













var BIN_RANGE_DELIMITER = " \u2013 ";
function signalOrValueRef(value) {
  if (isSignalRef(value)) {
    return value;
  }

  return {
    value: value
  };
}
function applyMarkConfig(e, model, propsList) {
  var _iterator = _createForOfIteratorHelper(propsList),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var property = _step.value;
      var value = getMarkConfig(property, model.markDef, model.config);

      if (value !== undefined) {
        e[property] = {
          value: value
        };
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return e;
}
function getStyles(mark) {
  var _a;

  return [].concat(mark.type, (_a = mark.style) !== null && _a !== void 0 ? _a : []);
}
function getMarkPropOrConfig(channel, mark, config) {
  return getFirstDefined(mark[channel], getMarkConfig(channel, mark, config));
}
/**
 * Return property value from style or mark specific config property if exists.
 * Otherwise, return general mark specific config.
 */

function getMarkConfig(channel, mark, config) {
  var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
      vgChannel = _ref.vgChannel;

  return getFirstDefined( // style config has highest precedence
  vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined, getMarkStyleConfig(channel, mark, config.style), // then mark-specific config
  vgChannel ? config[mark.type][vgChannel] : undefined, config[mark.type][channel], // If there is vgChannel, skip vl channel.
  // For example, vl size for text is vg fontSize, but config.mark.size is only for point size.
  vgChannel ? config.mark[vgChannel] : config.mark[channel]);
}
function getMarkStyleConfig(prop, mark, styleConfigIndex) {
  return getStyleConfig(prop, getStyles(mark), styleConfigIndex);
}
function getStyleConfig(p, styles, styleConfigIndex) {
  styles = vega_util_src_array(styles);
  var value;

  var _iterator2 = _createForOfIteratorHelper(styles),
      _step2;

  try {
    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      var style = _step2.value;
      var styleConfig = styleConfigIndex[style];

      if (styleConfig && styleConfig[p] !== undefined) {
        value = styleConfig[p];
      }
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }

  return value;
}
/**
 * Return Vega sort parameters (tuple of field and order).
 */

function sortParams(orderDef, fieldRefOption) {
  return vega_util_src_array(orderDef).reduce(function (s, orderChannelDef) {
    var _a;

    s.field.push(channeldef_vgField(orderChannelDef, fieldRefOption));
    s.order.push((_a = orderChannelDef.sort) !== null && _a !== void 0 ? _a : 'ascending');
    return s;
  }, {
    field: [],
    order: []
  });
}
function mergeTitleFieldDefs(f1, f2) {
  var merged = _toConsumableArray(f1);

  f2.forEach(function (fdToMerge) {
    var _iterator3 = _createForOfIteratorHelper(merged),
        _step3;

    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var fieldDef1 = _step3.value;

        // If already exists, no need to append to merged array
        if (deepEqual(fieldDef1, fdToMerge)) {
          return;
        }
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }

    merged.push(fdToMerge);
  });
  return merged;
}
function mergeTitle(title1, title2) {
  if (deepEqual(title1, title2) || !title2) {
    // if titles are the same or title2 is falsy
    return title1;
  } else if (!title1) {
    // if title1 is falsy
    return title2;
  } else {
    return [].concat(_toConsumableArray(vega_util_src_array(title1)), _toConsumableArray(vega_util_src_array(title2))).join(', ');
  }
}
function mergeTitleComponent(v1, v2) {
  var v1Val = v1.value;
  var v2Val = v2.value;

  if (v1Val == null || v2Val === null) {
    return {
      explicit: v1.explicit,
      value: null
    };
  } else if (isText(v1Val) && isText(v2Val)) {
    return {
      explicit: v1.explicit,
      value: mergeTitle(v1Val, v2Val)
    };
  } else if (!isText(v1Val) && !isText(v2Val)) {
    return {
      explicit: v1.explicit,
      value: mergeTitleFieldDefs(v1Val, v2Val)
    };
  }
  /* istanbul ignore next: Condition should not happen -- only for warning in development. */


  throw new Error('It should never reach here');
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.reflect.construct.js
var es_reflect_construct = __webpack_require__("4ae1");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.set-prototype-of.js
var es_object_set_prototype_of = __webpack_require__("131a");

// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js

function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };

  return _setPrototypeOf(o, p);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js

function _isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  if (Reflect.construct.sham) return false;
  if (typeof Proxy === "function") return true;

  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/construct.js




function construct_construct(Parent, args, Class) {
  if (_isNativeReflectConstruct()) {
    construct_construct = Reflect.construct;
  } else {
    construct_construct = function _construct(Parent, args, Class) {
      var a = [null];
      a.push.apply(a, args);
      var Constructor = Function.bind.apply(Parent, a);
      var instance = new Constructor();
      if (Class) _setPrototypeOf(instance, Class.prototype);
      return instance;
    };
  }

  return construct_construct.apply(null, arguments);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/log/message.js







/**
 * Collection of all Vega-Lite Error Messages
 */


function invalidSpec(spec) {
  return "Invalid specification ".concat(JSON.stringify(spec), ". Make sure the specification includes at least one of the following properties: \"mark\", \"layer\", \"facet\", \"hconcat\", \"vconcat\", \"concat\", or \"repeat\".");
} // FIT

var FIT_NON_SINGLE = 'Autosize "fit" only works for single views and layered views.';
function containerSizeNonSingle(name) {
  var uName = name == 'width' ? 'Width' : 'Height';
  return "".concat(uName, " \"container\" only works for single views and layered views.");
}
function containerSizeNotCompatibleWithAutosize(name) {
  var uName = name == 'width' ? 'Width' : 'Height';
  return "".concat(uName, " \"container\" only works well with autosize \"fit\" or \"fit-x\".");
}
function droppingFit(channel) {
  return channel ? "Dropping \"fit-".concat(channel, "\" because spec has discrete ").concat(getSizeType(channel), ".") : "Dropping \"fit\" because spec has discrete size.";
} // SELECTION

function cannotProjectOnChannelWithoutField(channel) {
  return "Cannot project a selection on encoding channel \"".concat(channel, "\", which has no field.");
}
function cannotProjectAggregate(channel, aggregate) {
  return "Cannot project a selection on encoding channel \"".concat(channel, "\" as it uses an aggregate function (\"").concat(aggregate, "\").");
}
function nearestNotSupportForContinuous(mark) {
  return "The \"nearest\" transform is not supported for ".concat(mark, " marks.");
}
function selectionNotSupported(mark) {
  return "Selection not supported for ".concat(mark, " yet.");
}
function selectionNotFound(name) {
  return "Cannot find a selection named \"".concat(name, "\".");
}
var SCALE_BINDINGS_CONTINUOUS = 'Scale bindings are currently only supported for scales with unbinned, continuous domains.';
var LEGEND_BINDINGS_PROJECT_LENGTH = 'Legend bindings are only supported for selections over an individual field or encoding channel.';
function noSameUnitLookup(name) {
  return "Cannot define and lookup the \"".concat(name, "\" selection in the same view. ") + "Try moving the lookup into a second, layered view?";
} // REPEAT

function noSuchRepeatedValue(field) {
  return "Unknown repeated value \"".concat(field, "\".");
}
function columnsNotSupportByRowCol(type) {
  return "The \"columns\" property cannot be used when \"".concat(type, "\" has nested row/column.");
} // CONCAT / REPEAT

var CONCAT_CANNOT_SHARE_AXIS = 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).'; // DATA

function unrecognizedParse(p) {
  return "Unrecognized parse \"".concat(p, "\".");
}
function differentParse(field, local, ancestor) {
  return "An ancestor parsed field \"".concat(field, "\" as ").concat(ancestor, " but a child wants to parse the field as ").concat(local, ".");
} // TRANSFORMS

function invalidTransformIgnored(transform) {
  return "Ignoring an invalid transform: ".concat(stringify(transform), ".");
}
var NO_FIELDS_NEEDS_AS = 'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'; // ENCODING & FACET

function encodingOverridden(channels) {
  return "Layer's shared ".concat(channels.join(','), " channel ").concat(channels.length === 1 ? 'is' : 'are', " overriden.");
}
function projectionOverridden(opt) {
  var parentProjection = opt.parentProjection,
      projection = opt.projection;
  return "Layer's shared projection ".concat(stringify(parentProjection), " is overridden by a child projection ").concat(stringify(projection), ".");
}
function primitiveChannelDef(channel, type, value) {
  return "Channel ".concat(channel, " is a ").concat(type, ". Converted to {value: ").concat(stringify(value), "}.");
}
function invalidFieldType(type) {
  return "Invalid field type \"".concat(type, "\".");
}
function invalidFieldTypeForCountAggregate(type, aggregate) {
  return "Invalid field type \"".concat(type, "\" for aggregate: \"").concat(aggregate, "\", using \"quantitative\" instead.");
}
function invalidAggregate(aggregate) {
  return "Invalid aggregation operator \"".concat(aggregate, "\".");
}
function missingFieldType(channel, newType) {
  return "Missing type for channel \"".concat(channel, "\", using \"").concat(newType, "\" instead.");
}
function droppingColor(type, opt) {
  var fill = opt.fill,
      stroke = opt.stroke;
  return "Dropping color ".concat(type, " as the plot also has ").concat(fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke', ".");
}
function emptyFieldDef(fieldDef, channel) {
  return "Dropping ".concat(stringify(fieldDef), " from channel \"").concat(channel, "\" since it does not contain any data field, value, or signal.");
}
function latLongDeprecated(channel, type, newChannel) {
  return "".concat(channel, "-encoding with type ").concat(type, " is deprecated. Replacing with ").concat(newChannel, "-encoding.");
}
var LINE_WITH_VARYING_SIZE = 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.';
function incompatibleChannel(channel, markOrFacet, when) {
  return "".concat(channel, " dropped as it is incompatible with \"").concat(markOrFacet, "\"").concat(when ? " when ".concat(when) : '', ".");
}
function invalidEncodingChannel(channel) {
  return "".concat(channel, "-encoding is dropped as ").concat(channel, " is not a valid encoding channel.");
}
function facetChannelShouldBeDiscrete(channel) {
  return "".concat(channel, " encoding should be discrete (ordinal / nominal / binned).");
}
function facetChannelDropped(channels) {
  return "Facet encoding dropped as ".concat(channels.join(' and '), " ").concat(channels.length > 1 ? 'are' : 'is', " also specified.");
}
function discreteChannelCannotEncode(channel, type) {
  return "Using discrete channel \"".concat(channel, "\" to encode \"").concat(type, "\" field can be misleading as it does not encode ").concat(type === 'ordinal' ? 'order' : 'magnitude', ".");
} // Mark

function lineWithRange(hasX2, hasY2) {
  var channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2';
  return "Line mark is for continuous lines and thus cannot be used with ".concat(channels, ". We will use the rule mark (line segments) instead.");
}
function orientOverridden(original, actual) {
  return "Specified orient \"".concat(original, "\" overridden with \"").concat(actual, "\".");
} // SCALE

var CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN = 'Custom domain scale cannot be unioned with default field-based domain.';
var RANGE_STEP_DEPRECATED = "Scale's \"rangeStep\" is deprecated and will be removed in Vega-Lite 5.0. Please use \"width\"/\"height\": {\"step\": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.";
function cannotUseScalePropertyWithNonColor(prop) {
  return "Cannot use the scale property \"".concat(prop, "\" with non-color channel.");
}
function unaggregateDomainHasNoEffectForRawField(fieldDef) {
  return "Using unaggregated domain with raw field has no effect (".concat(stringify(fieldDef), ").");
}
function unaggregateDomainWithNonSharedDomainOp(aggregate) {
  return "Unaggregated domain not applicable for \"".concat(aggregate, "\" since it produces values outside the origin domain of the source data.");
}
function unaggregatedDomainWithLogScale(fieldDef) {
  return "Unaggregated domain is currently unsupported for log scale (".concat(stringify(fieldDef), ").");
}
function cannotApplySizeToNonOrientedMark(mark) {
  return "Cannot apply size to non-oriented mark \"".concat(mark, "\".");
}
function scaleTypeNotWorkWithChannel(channel, scaleType, defaultScaleType) {
  return "Channel \"".concat(channel, "\" does not work with \"").concat(scaleType, "\" scale. We are using \"").concat(defaultScaleType, "\" scale instead.");
}
function scaleTypeNotWorkWithFieldDef(scaleType, defaultScaleType) {
  return "FieldDef does not work with \"".concat(scaleType, "\" scale. We are using \"").concat(defaultScaleType, "\" scale instead.");
}
function scalePropertyNotWorkWithScaleType(scaleType, propName, channel) {
  return "".concat(channel, "-scale's \"").concat(propName, "\" is dropped as it does not work with ").concat(scaleType, " scale.");
}
function scaleTypeNotWorkWithMark(mark, scaleType) {
  return "Scale type \"".concat(scaleType, "\" does not work with mark \"").concat(mark, "\".");
}
function stepDropped(channel) {
  return "The step for \"".concat(channel, "\" is dropped because the ").concat(channel === 'width' ? 'x' : 'y', " is continuous.");
}
function mergeConflictingProperty(property, propertyOf, v1, v2) {
  return "Conflicting ".concat(propertyOf.toString(), " property \"").concat(property.toString(), "\" (").concat(stringify(v1), " and ").concat(stringify(v2), "). Using ").concat(stringify(v1), ".");
}
function mergeConflictingDomainProperty(property, propertyOf, v1, v2) {
  return "Conflicting ".concat(propertyOf.toString(), " property \"").concat(property.toString(), "\" (").concat(stringify(v1), " and ").concat(stringify(v2), "). Using the union of the two domains.");
}
function independentScaleMeansIndependentGuide(channel) {
  return "Setting the scale to be independent for \"".concat(channel, "\" means we also have to set the guide (axis or legend) to be independent.");
}
function domainSortDropped(sort) {
  return "Dropping sort property ".concat(stringify(sort), " as unioned domains only support boolean or op \"count\", \"min\", and \"max\".");
}
var UNABLE_TO_MERGE_DOMAINS = 'Unable to merge domains.';
var MORE_THAN_ONE_SORT = 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.'; // AXIS

var INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.'; // STACK

function cannotStackRangedMark(channel) {
  return "Cannot stack \"".concat(channel, "\" if there is already \"").concat(channel, "2\".");
}
function cannotStackNonLinearScale(scaleType) {
  return "Cannot stack non-linear scale (".concat(scaleType, ").");
}
function stackNonSummativeAggregate(aggregate) {
  return "Stacking is applied even though the aggregate function is non-summative (\"".concat(aggregate, "\").");
} // TIMEUNIT

function invalidTimeUnit(unitName, value) {
  return "Invalid ".concat(unitName, ": ").concat(stringify(value), ".");
}
function dayReplacedWithDate(fullTimeUnit) {
  return "Time unit \"".concat(fullTimeUnit, "\" is not supported. We are replacing it with ").concat(replaceAll(fullTimeUnit, 'day', 'date'), ".");
}
function droppedDay(d) {
  return "Dropping day from datetime ".concat(stringify(d), " as day cannot be combined with other units.");
}
function errorBarCenterAndExtentAreNotNeeded(center, extent) {
  return "".concat(extent ? 'extent ' : '').concat(extent && center ? 'and ' : '').concat(center ? 'center ' : '').concat(extent && center ? 'are ' : 'is ', "not needed when data are aggregated.");
}
function errorBarCenterIsUsedWithWrongExtent(center, extent, mark) {
  return "".concat(center, " is not usually used with ").concat(extent, " for ").concat(mark, ".");
}
function errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark) {
  return "Continuous axis should not have customized aggregation function ".concat(aggregate, "; ").concat(compositeMark, " already agregates the axis.");
}
function errorBarCenterIsNotNeeded(extent, mark) {
  return "Center is not needed to be specified in ".concat(mark, " when extent is ").concat(extent, ".");
}
function errorBand1DNotSupport(property) {
  return "1D error band does not support ".concat(property, ".");
} // CHANNEL

function channelRequiredForBinned(channel) {
  return "Channel ".concat(channel, " is required for \"binned\" bin.");
}
function domainRequiredForThresholdScale(channel) {
  return "Domain for ".concat(channel, " is required for threshold scale.");
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/log/index.js



/**
 * Vega-Lite's singleton logger utility.
 */


var message = message_namespaceObject;
/**
 * Main (default) Vega Logger instance for Vega-Lite.
 */

var log_main = logger(Warn);
var log_current = log_main;
/**
 * Logger tool for checking if the code throws correct warning.
 */

var log_LocalLogger = /*#__PURE__*/function () {
  function LocalLogger() {
    _classCallCheck(this, LocalLogger);

    this.warns = [];
    this.infos = [];
    this.debugs = [];
  }

  _createClass(LocalLogger, [{
    key: "level",
    value: function level() {
      return this;
    }
  }, {
    key: "warn",
    value: function warn() {
      var _this$warns;

      (_this$warns = this.warns).push.apply(_this$warns, arguments);

      return this;
    }
  }, {
    key: "info",
    value: function info() {
      var _this$infos;

      (_this$infos = this.infos).push.apply(_this$infos, arguments);

      return this;
    }
  }, {
    key: "debug",
    value: function debug() {
      var _this$debugs;

      (_this$debugs = this.debugs).push.apply(_this$debugs, arguments);

      return this;
    }
  }, {
    key: "error",
    value: function error() {
      throw Error.apply(void 0, arguments);
    }
  }]);

  return LocalLogger;
}();
function log_wrap(f) {
  return function () {
    log_current = new log_LocalLogger();
    f(log_current);
    log_reset();
  };
}
/**
 * Set the singleton logger to be a custom logger.
 */

function log_set(newLogger) {
  log_current = newLogger;
  return log_current;
}
/**
 * Reset the main logger to use the default Vega Logger.
 */

function log_reset() {
  log_current = log_main;
  return log_current;
}
function log_warn() {
  var _current;

  (_current = log_current).warn.apply(_current, arguments);
}
function log_info() {
  var _current2;

  (_current2 = log_current).info.apply(_current2, arguments);
}
function log_debug() {
  var _current3;

  (_current3 = log_current).debug.apply(_current3, arguments);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/datetime.js






// DateTime definition object



/*
 * A designated year that starts on Sunday.
 */

var SUNDAY_YEAR = 2006;
function isDateTime(o) {
  return !!o && (!!o.year || !!o.quarter || !!o.month || !!o.date || !!o.day || !!o.hours || !!o.minutes || !!o.seconds || !!o.milliseconds);
}
var MONTHS = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
var SHORT_MONTHS = MONTHS.map(function (m) {
  return m.substr(0, 3);
});
var DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
var SHORT_DAYS = DAYS.map(function (d) {
  return d.substr(0, 3);
});

function normalizeQuarter(q) {
  if (isNumeric(q)) {
    q = +q;
  }

  if (isNumber(q)) {
    if (q > 4) {
      log_warn(message.invalidTimeUnit('quarter', q));
    } // We accept 1-based quarter, so need to readjust to 0-based quarter


    return q - 1;
  } else {
    // Invalid quarter
    throw new Error(message.invalidTimeUnit('quarter', q));
  }
}

function normalizeMonth(m) {
  if (isNumeric(m)) {
    m = +m;
  }

  if (isNumber(m)) {
    // We accept 1-based month, so need to readjust to 0-based month
    return m - 1;
  } else {
    var lowerM = m.toLowerCase();
    var monthIndex = MONTHS.indexOf(lowerM);

    if (monthIndex !== -1) {
      return monthIndex; // 0 for january, ...
    }

    var shortM = lowerM.substr(0, 3);
    var shortMonthIndex = SHORT_MONTHS.indexOf(shortM);

    if (shortMonthIndex !== -1) {
      return shortMonthIndex;
    } // Invalid month


    throw new Error(message.invalidTimeUnit('month', m));
  }
}

function normalizeDay(d) {
  if (isNumeric(d)) {
    d = +d;
  }

  if (isNumber(d)) {
    // mod so that this can be both 0-based where 0 = sunday
    // and 1-based where 7=sunday
    return d % 7;
  } else {
    var lowerD = d.toLowerCase();
    var dayIndex = DAYS.indexOf(lowerD);

    if (dayIndex !== -1) {
      return dayIndex; // 0 for january, ...
    }

    var shortD = lowerD.substr(0, 3);
    var shortDayIndex = SHORT_DAYS.indexOf(shortD);

    if (shortDayIndex !== -1) {
      return shortDayIndex;
    } // Invalid day


    throw new Error(message.invalidTimeUnit('day', d));
  }
}
/**
 * @param d the date.
 * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime.
 * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds]
 */


function dateTimeParts(d, normalize) {
  var parts = [];

  if (normalize && d.day !== undefined) {
    if (util_keys(d).length > 1) {
      log_warn(message.droppedDay(d));
      d = duplicate(d);
      delete d.day;
    }
  }

  if (d.year !== undefined) {
    parts.push(d.year);
  } else if (d.day !== undefined) {
    // Set year to 2006 for working with day since January 1 2006 is a Sunday
    parts.push(SUNDAY_YEAR);
  } else {
    parts.push(0);
  }

  if (d.month !== undefined) {
    var month = normalize ? normalizeMonth(d.month) : d.month;
    parts.push(month);
  } else if (d.quarter !== undefined) {
    var quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter;
    parts.push(isNumber(quarter) ? quarter * 3 : quarter + '*3');
  } else {
    parts.push(0); // months start at zero in JS
  }

  if (d.date !== undefined) {
    parts.push(d.date);
  } else if (d.day !== undefined) {
    // HACK: Day only works as a standalone unit
    // This is only correct because we always set year to 2006 for day
    var day = normalize ? normalizeDay(d.day) : d.day;
    parts.push(isNumber(day) ? day + 1 : day + '+1');
  } else {
    parts.push(1); // Date starts at 1 in JS
  } // Note: can't use TimeUnit enum here as importing it will create
  // circular dependency problem!


  for (var _i = 0, _arr = ['hours', 'minutes', 'seconds', 'milliseconds']; _i < _arr.length; _i++) {
    var timeUnit = _arr[_i];
    var unit = d[timeUnit];
    parts.push(typeof unit === 'undefined' ? 0 : unit);
  }

  return parts;
}
/**
 * Return Vega expression for a date time.
 *
 * @param d the date time.
 * @returns the Vega expression.
 */


function dateTimeToExpr(d) {
  var parts = dateTimeParts(d, true);
  var string = parts.join(', ');

  if (d.utc) {
    return "utc(".concat(string, ")");
  } else {
    return "datetime(".concat(string, ")");
  }
}
/**
 * Return Vega expression for a date time expression.
 *
 * @param d the internal date time object with expression.
 * @returns the Vega expression.
 */

function dateTimeExprToExpr(d) {
  var parts = dateTimeParts(d, false);
  var string = parts.join(', ');

  if (d.utc) {
    return "utc(".concat(string, ")");
  } else {
    return "datetime(".concat(string, ")");
  }
}
/**
 * @param d the date time.
 * @returns the timestamp.
 */

function dateTimeToTimestamp(d) {
  var parts = dateTimeParts(d, true);

  if (d.utc) {
    return +new Date(Date.UTC.apply(Date, _toConsumableArray(parts)));
  } else {
    return +construct_construct(Date, _toConsumableArray(parts));
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/timeunit.js













var timeunit_TimeUnit;

(function (TimeUnit) {
  TimeUnit.YEAR = 'year';
  TimeUnit.MONTH = 'month';
  TimeUnit.DAY = 'day';
  TimeUnit.DATE = 'date';
  TimeUnit.HOURS = 'hours';
  TimeUnit.MINUTES = 'minutes';
  TimeUnit.SECONDS = 'seconds';
  TimeUnit.MILLISECONDS = 'milliseconds';
  TimeUnit.YEARMONTH = 'yearmonth';
  TimeUnit.YEARMONTHDATE = 'yearmonthdate';
  TimeUnit.YEARMONTHDATEHOURS = 'yearmonthdatehours';
  TimeUnit.YEARMONTHDATEHOURSMINUTES = 'yearmonthdatehoursminutes';
  TimeUnit.YEARMONTHDATEHOURSMINUTESSECONDS = 'yearmonthdatehoursminutesseconds'; // MONTHDATE and MONTHDATEHOURS always include 29 February since we use year 0th (which is a leap year);

  TimeUnit.MONTHDATE = 'monthdate';
  TimeUnit.MONTHDATEHOURS = 'monthdatehours';
  TimeUnit.HOURSMINUTES = 'hoursminutes';
  TimeUnit.HOURSMINUTESSECONDS = 'hoursminutesseconds';
  TimeUnit.MINUTESSECONDS = 'minutesseconds';
  TimeUnit.SECONDSMILLISECONDS = 'secondsmilliseconds';
  TimeUnit.QUARTER = 'quarter';
  TimeUnit.YEARQUARTER = 'yearquarter';
  TimeUnit.QUARTERMONTH = 'quartermonth';
  TimeUnit.YEARQUARTERMONTH = 'yearquartermonth';
  TimeUnit.UTCYEAR = 'utcyear';
  TimeUnit.UTCMONTH = 'utcmonth';
  TimeUnit.UTCDAY = 'utcday';
  TimeUnit.UTCDATE = 'utcdate';
  TimeUnit.UTCHOURS = 'utchours';
  TimeUnit.UTCMINUTES = 'utcminutes';
  TimeUnit.UTCSECONDS = 'utcseconds';
  TimeUnit.UTCMILLISECONDS = 'utcmilliseconds';
  TimeUnit.UTCYEARMONTH = 'utcyearmonth';
  TimeUnit.UTCYEARMONTHDATE = 'utcyearmonthdate';
  TimeUnit.UTCYEARMONTHDATEHOURS = 'utcyearmonthdatehours';
  TimeUnit.UTCYEARMONTHDATEHOURSMINUTES = 'utcyearmonthdatehoursminutes';
  TimeUnit.UTCYEARMONTHDATEHOURSMINUTESSECONDS = 'utcyearmonthdatehoursminutesseconds'; // UTCMONTHDATE and UTCMONTHDATEHOURS always include 29 February since we use year 0th (which is a leap year);

  TimeUnit.UTCMONTHDATE = 'utcmonthdate';
  TimeUnit.UTCMONTHDATEHOURS = 'utcmonthdatehours';
  TimeUnit.UTCHOURSMINUTES = 'utchoursminutes';
  TimeUnit.UTCHOURSMINUTESSECONDS = 'utchoursminutesseconds';
  TimeUnit.UTCMINUTESSECONDS = 'utcminutesseconds';
  TimeUnit.UTCSECONDSMILLISECONDS = 'utcsecondsmilliseconds';
  TimeUnit.UTCQUARTER = 'utcquarter';
  TimeUnit.UTCYEARQUARTER = 'utcyearquarter';
  TimeUnit.UTCQUARTERMONTH = 'utcquartermonth';
  TimeUnit.UTCYEARQUARTERMONTH = 'utcyearquartermonth';
})(timeunit_TimeUnit || (timeunit_TimeUnit = {}));
/** Time Unit that only corresponds to only one part of Date objects. */


var LOCAL_SINGLE_TIMEUNIT_INDEX = {
  year: 1,
  quarter: 1,
  month: 1,
  day: 1,
  date: 1,
  hours: 1,
  minutes: 1,
  seconds: 1,
  milliseconds: 1
};
var TIMEUNIT_PARTS = util_keys(LOCAL_SINGLE_TIMEUNIT_INDEX);
function isLocalSingleTimeUnit(timeUnit) {
  return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit];
}
var UTC_SINGLE_TIMEUNIT_INDEX = {
  utcyear: 1,
  utcquarter: 1,
  utcmonth: 1,
  utcday: 1,
  utcdate: 1,
  utchours: 1,
  utcminutes: 1,
  utcseconds: 1,
  utcmilliseconds: 1
};
function isUtcSingleTimeUnit(timeUnit) {
  return !!UTC_SINGLE_TIMEUNIT_INDEX[timeUnit];
}
var LOCAL_MULTI_TIMEUNIT_INDEX = {
  yearquarter: 1,
  yearquartermonth: 1,
  yearmonth: 1,
  yearmonthdate: 1,
  yearmonthdatehours: 1,
  yearmonthdatehoursminutes: 1,
  yearmonthdatehoursminutesseconds: 1,
  quartermonth: 1,
  monthdate: 1,
  monthdatehours: 1,
  hoursminutes: 1,
  hoursminutesseconds: 1,
  minutesseconds: 1,
  secondsmilliseconds: 1
};
var UTC_MULTI_TIMEUNIT_INDEX = {
  utcyearquarter: 1,
  utcyearquartermonth: 1,
  utcyearmonth: 1,
  utcyearmonthdate: 1,
  utcyearmonthdatehours: 1,
  utcyearmonthdatehoursminutes: 1,
  utcyearmonthdatehoursminutesseconds: 1,
  utcquartermonth: 1,
  utcmonthdate: 1,
  utcmonthdatehours: 1,
  utchoursminutes: 1,
  utchoursminutesseconds: 1,
  utcminutesseconds: 1,
  utcsecondsmilliseconds: 1
};
var UTC_TIMEUNIT_INDEX = Object.assign(Object.assign({}, UTC_SINGLE_TIMEUNIT_INDEX), UTC_MULTI_TIMEUNIT_INDEX);
function isUTCTimeUnit(t) {
  return !!UTC_TIMEUNIT_INDEX[t];
}
function getLocalTimeUnit(t) {
  return t.substr(3);
}
var TIMEUNIT_INDEX = Object.assign(Object.assign(Object.assign(Object.assign({}, LOCAL_SINGLE_TIMEUNIT_INDEX), UTC_SINGLE_TIMEUNIT_INDEX), LOCAL_MULTI_TIMEUNIT_INDEX), UTC_MULTI_TIMEUNIT_INDEX);
var TIMEUNITS = util_keys(TIMEUNIT_INDEX); // In order of increasing specificity

var VEGALITE_TIMEFORMAT = {
  'year-month': '%b %Y ',
  'year-month-date': '%b %d, %Y '
};
function isTimeUnit(t) {
  return !!TIMEUNIT_INDEX[t];
}
function getTimeUnitParts(timeUnit) {
  return TIMEUNIT_PARTS.reduce(function (parts, part) {
    if (containsTimeUnit(timeUnit, part)) {
      return [].concat(_toConsumableArray(parts), [part]);
    }

    return parts;
  }, []);
}
/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */

function containsTimeUnit(fullTimeUnit, timeUnit) {
  var index = fullTimeUnit.indexOf(timeUnit);
  return index > -1 && (timeUnit !== timeunit_TimeUnit.SECONDS || index === 0 || fullTimeUnit.charAt(index - 1) !== 'i') // exclude milliseconds
  ;
}
/**
 * Returns Vega expresssion for a given timeUnit and fieldRef
 */

function timeunit_fieldExpr(fullTimeUnit, field) {
  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
    end: false
  },
      end = _ref.end;

  var fieldRef = accessPathWithDatum(field);
  var utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : '';

  function func(timeUnit) {
    if (timeUnit === timeunit_TimeUnit.QUARTER) {
      // quarter starting at 0 (0,3,6,9).
      return "(".concat(utc, "quarter(").concat(fieldRef, ")-1)");
    } else {
      return "".concat(utc).concat(timeUnit, "(").concat(fieldRef, ")");
    }
  }

  var lastTimeUnit;
  var d = TIMEUNIT_PARTS.reduce(function (dateExpr, tu) {
    if (containsTimeUnit(fullTimeUnit, tu)) {
      dateExpr[tu] = func(tu);
      lastTimeUnit = tu;
    }

    return dateExpr;
  }, {});

  if (end) {
    d[lastTimeUnit] += '+1';
  }

  return dateTimeExprToExpr(d);
}
function getTimeUnitSpecifierExpression(timeUnit) {
  if (!timeUnit) {
    return undefined;
  }

  var timeUnitParts = getTimeUnitParts(timeUnit);
  return "timeUnitSpecifier(".concat(fast_json_stable_stringify_default()(timeUnitParts), ", ").concat(fast_json_stable_stringify_default()(VEGALITE_TIMEFORMAT), ")");
}
/**
 * returns the signal expression used for axis labels for a time unit
 */

function formatExpression(timeUnit, field, isUTCScale) {
  if (!timeUnit) {
    return undefined;
  }

  var timeUnitSpecifierExpr = getTimeUnitSpecifierExpression(timeUnit); // We only use utcFormat for utc scale
  // For utc time units, the data is already converted as a part of timeUnit transform.
  // Thus, utc time units should use timeFormat to avoid shifting the time twice.

  if (isUTCScale || isUTCTimeUnit(timeUnit)) {
    return "utcFormat(".concat(field, ", ").concat(timeUnitSpecifierExpr, ")");
  } else {
    return "timeFormat(".concat(field, ", ").concat(timeUnitSpecifierExpr, ")");
  }
}
function normalizeTimeUnit(timeUnit) {
  if (!timeUnit) {
    return undefined;
  }

  var params;

  if (isString(timeUnit)) {
    params = {
      unit: correctTimeUnit(timeUnit)
    };
  } else if (isObject(timeUnit)) {
    params = Object.assign(Object.assign({}, timeUnit), timeUnit.unit ? {
      unit: correctTimeUnit(timeUnit.unit)
    } : {});
  }

  if (isUTCTimeUnit(params.unit)) {
    params.utc = true;
    params.unit = getLocalTimeUnit(params.unit);
  }

  return params;
}
function correctTimeUnit(timeUnit) {
  if (timeUnit !== 'day' && timeUnit.indexOf('day') >= 0) {
    log_warn(message.dayReplacedWithDate(timeUnit));
    return replaceAll(timeUnit, 'day', 'date');
  }

  return timeUnit;
}
function timeUnitToString(tu) {
  var _a = normalizeTimeUnit(tu),
      utc = _a.utc,
      rest = __rest(_a, ["utc"]);

  if (rest.unit) {
    return (utc ? 'utc' : '') + util_keys(rest).map(function (p) {
      return varName("".concat(p === 'unit' ? '' : "_".concat(p, "_")).concat(rest[p]));
    }).join('');
  } else {
    // when maxbins is specified instead of units
    return (utc ? 'utc' : '') + 'timeunit' + util_keys(rest).map(function (p) {
      return varName("_".concat(p, "_").concat(rest[p]));
    }).join('');
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/predicate.js








function isSelectionPredicate(predicate) {
  return predicate === null || predicate === void 0 ? void 0 : predicate['selection'];
}
function isFieldEqualPredicate(predicate) {
  return predicate && !!predicate.field && predicate.equal !== undefined;
}
function isFieldLTPredicate(predicate) {
  return predicate && !!predicate.field && predicate.lt !== undefined;
}
function isFieldLTEPredicate(predicate) {
  return predicate && !!predicate.field && predicate.lte !== undefined;
}
function isFieldGTPredicate(predicate) {
  return predicate && !!predicate.field && predicate.gt !== undefined;
}
function isFieldGTEPredicate(predicate) {
  return predicate && !!predicate.field && predicate.gte !== undefined;
}
function isFieldRangePredicate(predicate) {
  if (predicate && predicate.field) {
    if (isArray(predicate.range) && predicate.range.length === 2) {
      return true;
    } else if (isSignalRef(predicate.range)) {
      return true;
    }
  }

  return false;
}
function isFieldOneOfPredicate(predicate) {
  return predicate && !!predicate.field && (isArray(predicate.oneOf) || isArray(predicate["in"])) // backward compatibility
  ;
}
function isFieldValidPredicate(predicate) {
  return predicate && !!predicate.field && predicate.valid !== undefined;
}
function isFieldPredicate(predicate) {
  return isFieldOneOfPredicate(predicate) || isFieldEqualPredicate(predicate) || isFieldRangePredicate(predicate) || isFieldLTPredicate(predicate) || isFieldGTPredicate(predicate) || isFieldLTEPredicate(predicate) || isFieldGTEPredicate(predicate);
}

function predicateValueExpr(v, timeUnit) {
  return valueExpr(v, {
    timeUnit: timeUnit,
    time: true
  });
}

function predicateValuesExpr(vals, timeUnit) {
  return vals.map(function (v) {
    return predicateValueExpr(v, timeUnit);
  });
} // This method is used by Voyager. Do not change its behavior without changing Voyager.


function fieldFilterExpression(predicate) {
  var useInRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

  var _a;

  var field = predicate.field;
  var timeUnit = (_a = normalizeTimeUnit(predicate.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit;
  var fieldExpr = timeUnit ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly.
  // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline
  // TODO: support utc
  'time(' + timeunit_fieldExpr(timeUnit, field) + ')' : channeldef_vgField(predicate, {
    expr: 'datum'
  });

  if (isFieldEqualPredicate(predicate)) {
    return fieldExpr + '===' + predicateValueExpr(predicate.equal, timeUnit);
  } else if (isFieldLTPredicate(predicate)) {
    var upper = predicate.lt;
    return "".concat(fieldExpr, "<").concat(predicateValueExpr(upper, timeUnit));
  } else if (isFieldGTPredicate(predicate)) {
    var lower = predicate.gt;
    return "".concat(fieldExpr, ">").concat(predicateValueExpr(lower, timeUnit));
  } else if (isFieldLTEPredicate(predicate)) {
    var _upper = predicate.lte;
    return "".concat(fieldExpr, "<=").concat(predicateValueExpr(_upper, timeUnit));
  } else if (isFieldGTEPredicate(predicate)) {
    var _lower = predicate.gte;
    return "".concat(fieldExpr, ">=").concat(predicateValueExpr(_lower, timeUnit));
  } else if (isFieldOneOfPredicate(predicate)) {
    return "indexof([".concat(predicateValuesExpr(predicate.oneOf, timeUnit).join(','), "], ").concat(fieldExpr, ") !== -1");
  } else if (isFieldValidPredicate(predicate)) {
    return fieldValidPredicate(fieldExpr, predicate.valid);
  } else if (isFieldRangePredicate(predicate)) {
    var range = predicate.range;

    var _lower2 = isSignalRef(range) ? {
      signal: "".concat(range.signal, "[0]")
    } : range[0];

    var _upper2 = isSignalRef(range) ? {
      signal: "".concat(range.signal, "[1]")
    } : range[1];

    if (_lower2 !== null && _upper2 !== null && useInRange) {
      return 'inrange(' + fieldExpr + ', [' + predicateValueExpr(_lower2, timeUnit) + ', ' + predicateValueExpr(_upper2, timeUnit) + '])';
    }

    var exprs = [];

    if (_lower2 !== null) {
      exprs.push("".concat(fieldExpr, " >= ").concat(predicateValueExpr(_lower2, timeUnit)));
    }

    if (_upper2 !== null) {
      exprs.push("".concat(fieldExpr, " <= ").concat(predicateValueExpr(_upper2, timeUnit)));
    }

    return exprs.length > 0 ? exprs.join(' && ') : 'true';
  }
  /* istanbul ignore next: it should never reach here */


  throw new Error("Invalid field predicate: ".concat(JSON.stringify(predicate)));
}
function fieldValidPredicate(fieldExpr) {
  var valid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

  if (valid) {
    return "isValid(".concat(fieldExpr, ") && isFinite(+").concat(fieldExpr, ")");
  } else {
    return "!isValid(".concat(fieldExpr, ") || !isFinite(+").concat(fieldExpr, ")");
  }
}
function normalizePredicate(f) {
  var _a;

  if (isFieldPredicate(f) && f.timeUnit) {
    return Object.assign(Object.assign({}, f), {
      timeUnit: (_a = normalizeTimeUnit(f.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit
    });
  }

  return f;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/type.js
/** Constants and utilities for data type */

/** Data type based on level of measurement */
var TYPE_INDEX = {
  quantitative: 1,
  ordinal: 1,
  temporal: 1,
  nominal: 1,
  geojson: 1
};
function isType(t) {
  return !!TYPE_INDEX[t];
}
var QUANTITATIVE = 'quantitative';
var ORDINAL = 'ordinal';
var TEMPORAL = 'temporal';
var NOMINAL = 'nominal';
var GEOJSON = 'geojson';
/**
 * Get full, lowercase type name for a given type.
 * @param  type
 * @return Full type name.
 */

function getFullName(type) {
  if (type) {
    type = type.toLowerCase();

    switch (type) {
      case 'q':
      case QUANTITATIVE:
        return 'quantitative';

      case 't':
      case TEMPORAL:
        return 'temporal';

      case 'o':
      case ORDINAL:
        return 'ordinal';

      case 'n':
      case NOMINAL:
        return 'nominal';

      case GEOJSON:
        return 'geojson';
    }
  } // If we get invalid input, return undefined type.


  return undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/scale.js











var ScaleType;

(function (ScaleType) {
  // Continuous - Quantitative
  ScaleType.LINEAR = 'linear';
  ScaleType.LOG = 'log';
  ScaleType.POW = 'pow';
  ScaleType.SQRT = 'sqrt';
  ScaleType.SYMLOG = 'symlog';
  ScaleType.IDENTITY = 'identity';
  ScaleType.SEQUENTIAL = 'sequential'; // Continuous - Time

  ScaleType.TIME = 'time';
  ScaleType.UTC = 'utc'; // Discretizing scales

  ScaleType.QUANTILE = 'quantile';
  ScaleType.QUANTIZE = 'quantize';
  ScaleType.THRESHOLD = 'threshold';
  ScaleType.BIN_ORDINAL = 'bin-ordinal'; // Discrete scales

  ScaleType.ORDINAL = 'ordinal';
  ScaleType.POINT = 'point';
  ScaleType.BAND = 'band';
})(ScaleType || (ScaleType = {}));
/**
 * Index for scale categories -- only scale of the same categories can be merged together.
 * Current implementation is trying to be conservative and avoid merging scale type that might not work together
 */


var SCALE_CATEGORY_INDEX = {
  linear: 'numeric',
  log: 'numeric',
  pow: 'numeric',
  sqrt: 'numeric',
  symlog: 'numeric',
  identity: 'numeric',
  sequential: 'numeric',
  time: 'time',
  utc: 'time',
  ordinal: 'ordinal',
  'bin-ordinal': 'bin-ordinal',
  point: 'ordinal-position',
  band: 'ordinal-position',
  quantile: 'discretizing',
  quantize: 'discretizing',
  threshold: 'discretizing'
};
var SCALE_TYPES = util_keys(SCALE_CATEGORY_INDEX);
/**
 * Whether the two given scale types can be merged together.
 */

function scaleCompatible(scaleType1, scaleType2) {
  var scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1];
  var scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2];
  return scaleCategory1 === scaleCategory2 || scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time' || scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time';
}
/**
 * Index for scale precedence -- high score = higher priority for merging.
 */

var SCALE_PRECEDENCE_INDEX = {
  // numeric
  linear: 0,
  log: 1,
  pow: 1,
  sqrt: 1,
  symlog: 1,
  identity: 1,
  sequential: 1,
  // time
  time: 0,
  utc: 0,
  // ordinal-position -- these have higher precedence than continuous scales as they support more types of data
  point: 10,
  band: 11,
  // non grouped types
  ordinal: 0,
  'bin-ordinal': 0,
  quantile: 0,
  quantize: 0,
  threshold: 0
};
/**
 * Return scale categories -- only scale of the same categories can be merged together.
 */

function scaleTypePrecedence(scaleType) {
  return SCALE_PRECEDENCE_INDEX[scaleType];
}
var CONTINUOUS_TO_CONTINUOUS_SCALES = ['linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc'];
var CONTINUOUS_TO_CONTINUOUS_INDEX = toSet(CONTINUOUS_TO_CONTINUOUS_SCALES);
var QUANTITATIVE_SCALES = ['linear', 'log', 'pow', 'sqrt', 'symlog'];
var QUANTITATIVE_SCALES_INDEX = toSet(QUANTITATIVE_SCALES);
function isQuantitative(type) {
  return type in QUANTITATIVE_SCALES_INDEX;
}
var CONTINUOUS_TO_DISCRETE_SCALES = ['quantile', 'quantize', 'threshold'];
var CONTINUOUS_TO_DISCRETE_INDEX = toSet(CONTINUOUS_TO_DISCRETE_SCALES);
var CONTINUOUS_DOMAIN_SCALES = CONTINUOUS_TO_CONTINUOUS_SCALES.concat(['quantile', 'quantize', 'threshold', 'sequential', 'identity']);
var CONTINUOUS_DOMAIN_INDEX = toSet(CONTINUOUS_DOMAIN_SCALES);
var DISCRETE_DOMAIN_SCALES = ['ordinal', 'bin-ordinal', 'point', 'band'];
var DISCRETE_DOMAIN_INDEX = toSet(DISCRETE_DOMAIN_SCALES);
var TIME_SCALE_TYPES = ['time', 'utc'];
function hasDiscreteDomain(type) {
  return type in DISCRETE_DOMAIN_INDEX;
}
function hasContinuousDomain(type) {
  return type in CONTINUOUS_DOMAIN_INDEX;
}
function isContinuousToContinuous(type) {
  return type in CONTINUOUS_TO_CONTINUOUS_INDEX;
}
function isContinuousToDiscrete(type) {
  return type in CONTINUOUS_TO_DISCRETE_INDEX;
}
var defaultScaleConfig = {
  pointPadding: 0.5,
  barBandPaddingInner: 0.1,
  rectBandPaddingInner: 0,
  minBandSize: 2,
  minFontSize: 8,
  maxFontSize: 40,
  minOpacity: 0.3,
  maxOpacity: 0.8,
  // FIXME: revise if these *can* become ratios of width/height step
  minSize: 9,
  minStrokeWidth: 1,
  maxStrokeWidth: 4,
  quantileCount: 4,
  quantizeCount: 4
};
function isExtendedScheme(scheme) {
  return !isString(scheme) && !!scheme['name'];
}
function isSelectionDomain(domain) {
  return domain === null || domain === void 0 ? void 0 : domain['selection'];
}
function isDomainUnionWith(domain) {
  return domain && domain['unionWith'];
}
var SCALE_PROPERTY_INDEX = {
  type: 1,
  domain: 1,
  domainMid: 1,
  align: 1,
  range: 1,
  scheme: 1,
  bins: 1,
  // Other properties
  reverse: 1,
  round: 1,
  // quantitative / time
  clamp: 1,
  nice: 1,
  // quantitative
  base: 1,
  exponent: 1,
  constant: 1,
  interpolate: 1,
  zero: 1,
  // band/point
  padding: 1,
  paddingInner: 1,
  paddingOuter: 1
};
var SCALE_PROPERTIES = util_keys(SCALE_PROPERTY_INDEX);

var scale_type = SCALE_PROPERTY_INDEX.type,
    scale_domain = SCALE_PROPERTY_INDEX.domain,
    scale_range = SCALE_PROPERTY_INDEX.range,
    scale_scheme = SCALE_PROPERTY_INDEX.scheme,
    NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX = __rest(SCALE_PROPERTY_INDEX, ["type", "domain", "range", "scheme"]);

var NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = util_keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX);
var SCALE_TYPE_INDEX = generateScaleTypeIndex();
function scaleTypeSupportProperty(scaleType, propName) {
  switch (propName) {
    case 'type':
    case 'domain':
    case 'reverse':
    case 'range':
      return true;

    case 'scheme':
    case 'interpolate':
      return !util_contains(['point', 'band', 'identity'], scaleType);

    case 'bins':
      return !util_contains(['point', 'band', 'identity', 'ordinal'], scaleType);

    case 'round':
      return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point';

    case 'padding':
      return isContinuousToContinuous(scaleType) || util_contains(['point', 'band'], scaleType);

    case 'paddingOuter':
    case 'align':
      return util_contains(['point', 'band'], scaleType);

    case 'paddingInner':
      return scaleType === 'band';

    case 'domainMid':
    case 'clamp':
      return isContinuousToContinuous(scaleType);

    case 'nice':
      return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold';

    case 'exponent':
      return scaleType === 'pow';

    case 'base':
      return scaleType === 'log';

    case 'constant':
      return scaleType === 'symlog';

    case 'zero':
      return hasContinuousDomain(scaleType) && !util_contains(['log', 'time', 'utc', 'threshold', 'quantile' // quantile depends on distribution so zero does not matter
      ], scaleType);
  }
}
/**
 * Returns undefined if the input channel supports the input scale property name
 */

function channelScalePropertyIncompatability(channel, propName) {
  switch (propName) {
    case 'interpolate':
    case 'scheme':
    case 'domainMid':
      if (!isColorChannel(channel)) {
        return message.cannotUseScalePropertyWithNonColor(channel);
      }

      return undefined;

    case 'align':
    case 'type':
    case 'bins':
    case 'domain':
    case 'range':
    case 'base':
    case 'exponent':
    case 'constant':
    case 'nice':
    case 'padding':
    case 'paddingInner':
    case 'paddingOuter':
    case 'reverse':
    case 'round':
    case 'clamp':
    case 'zero':
      return undefined;
    // GOOD!
  }
}
function scaleTypeSupportDataType(specifiedType, fieldDefType) {
  if (util_contains([ORDINAL, NOMINAL], fieldDefType)) {
    return specifiedType === undefined || hasDiscreteDomain(specifiedType);
  } else if (fieldDefType === TEMPORAL) {
    return util_contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType);
  } else if (fieldDefType === QUANTITATIVE) {
    return util_contains([ScaleType.LOG, ScaleType.POW, ScaleType.SQRT, ScaleType.SYMLOG, ScaleType.QUANTILE, ScaleType.QUANTIZE, ScaleType.THRESHOLD, ScaleType.LINEAR, undefined], specifiedType);
  }

  return true;
}
function channelSupportScaleType(channel, scaleType) {
  switch (channel) {
    case channel_X:
    case channel_Y:
      return isContinuousToContinuous(scaleType) || util_contains(['band', 'point'], scaleType);

    case channel_SIZE: // TODO: size and opacity can support ordinal with more modification

    case STROKEWIDTH:
    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY:
      // Although it generally doesn't make sense to use band with size and opacity,
      // it can also work since we use band: 0.5 to get midpoint.
      return isContinuousToContinuous(scaleType) || isContinuousToDiscrete(scaleType) || util_contains(['band', 'point', 'ordinal'], scaleType);

    case COLOR:
    case FILL:
    case STROKE:
      return scaleType !== 'band';
    // band does not make sense with color

    case STROKEDASH:
      return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType);

    case SHAPE:
      return scaleType === 'ordinal';
    // shape = lookup only
  }
  /* istanbul ignore next: it should never reach here */


  return false;
}
function getSupportedScaleType(channel, fieldDefType) {
  return SCALE_TYPE_INDEX[generateScaleTypeIndexKey(channel, fieldDefType)];
} // generates ScaleTypeIndex where keys are encoding channels and values are list of valid ScaleTypes

function generateScaleTypeIndex() {
  var _a;

  var index = {};

  var _iterator = _createForOfIteratorHelper(CHANNELS),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var channel = _step.value;

      var _iterator2 = _createForOfIteratorHelper(util_keys(TYPE_INDEX)),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var fieldDefType = _step2.value;

          var _iterator3 = _createForOfIteratorHelper(SCALE_TYPES),
              _step3;

          try {
            for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
              var scaleType = _step3.value;
              var key = generateScaleTypeIndexKey(channel, fieldDefType);

              if (channelSupportScaleType(channel, scaleType) && scaleTypeSupportDataType(scaleType, fieldDefType)) {
                index[key] = (_a = index[key]) !== null && _a !== void 0 ? _a : [];
                index[key].push(scaleType);
              }
            }
          } catch (err) {
            _iterator3.e(err);
          } finally {
            _iterator3.f();
          }
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return index;
}

function generateScaleTypeIndexKey(channel, fieldDefType) {
  return channel + '_' + fieldDefType;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/format.js













var format_BIN_RANGE_DELIMITER = " \u2013 ";
var customFormatTypeIndex = new Set();
function setCustomFormatTypes(formatTypes) {
  customFormatTypeIndex = new Set(formatTypes);
}
function isCustomFormatType(formatType) {
  return formatType && formatType !== 'number' && formatType !== 'time' && customFormatTypeIndex.has(formatType);
}

function customFormatExpr(_ref) {
  var formatType = _ref.formatType,
      field = _ref.field,
      format = _ref.format;
  return "".concat(formatType, "(").concat(field, ", ").concat(JSON.stringify(format), ")");
}

function formatSignalRef(_ref2) {
  var fieldDef = _ref2.fieldDef,
      format = _ref2.format,
      formatType = _ref2.formatType,
      expr = _ref2.expr,
      normalizeStack = _ref2.normalizeStack,
      config = _ref2.config,
      field = _ref2.field,
      omitNumberFormatAndEmptyTimeFormat = _ref2.omitNumberFormatAndEmptyTimeFormat,
      omitTimeFormatConfig = _ref2.omitTimeFormatConfig,
      isUTCScale = _ref2.isUTCScale;

  var _a;

  if (!field) {
    if (normalizeStack) {
      field = "".concat(channeldef_vgField(fieldDef, {
        expr: expr,
        suffix: 'end'
      }), "-").concat(channeldef_vgField(fieldDef, {
        expr: expr,
        suffix: 'start'
      }));
    } else {
      field = channeldef_vgField(fieldDef, {
        expr: expr
      });
    }
  }

  isUTCScale = isUTCScale !== null && isUTCScale !== void 0 ? isUTCScale : isScaleFieldDef(fieldDef) && fieldDef['scale'] && fieldDef['scale'].type === ScaleType.UTC;
  var defaultTimeFormat = omitTimeFormatConfig ? null : config.timeFormat;

  if (isCustomFormatType(formatType)) {
    if (isBinning(fieldDef.bin)) {
      var endField = channeldef_vgField(fieldDef, {
        expr: expr,
        binSuffix: 'end'
      });
      return {
        signal: binFormatExpression(field, endField, format, formatType, config)
      };
    }

    return {
      signal: customFormatExpr({
        formatType: formatType,
        format: format,
        field: field
      })
    };
  } else if (formatType) {
    formatType = undefined; // drop unregistered custom formatType
  }

  if (isFieldDefForTimeFormat(fieldDef)) {
    var signal = timeFormatExpression(field, (_a = normalizeTimeUnit(fieldDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit, format, defaultTimeFormat, isUTCScale, !omitNumberFormatAndEmptyTimeFormat);
    return signal ? {
      signal: signal
    } : undefined;
  } else if (!omitNumberFormatAndEmptyTimeFormat) {
    format = numberFormat(fieldDef, format, config);

    if (isBinning(fieldDef.bin)) {
      var _endField = channeldef_vgField(fieldDef, {
        expr: expr,
        binSuffix: 'end'
      });

      return {
        signal: binFormatExpression(field, _endField, format, formatType, config)
      };
    } else if (fieldDef.type === 'quantitative' || format) {
      return {
        signal: "".concat(formatExpr(field, format))
      };
    } else {
      return {
        signal: "''+".concat(field)
      };
    }
  }

  return undefined;
}
/**
 * Returns number format for a fieldDef
 */

function numberFormat(fieldDef, specifiedFormat, config) {
  // Specified format in axis/legend has higher precedence than fieldDef.format
  if (isString(specifiedFormat)) {
    return specifiedFormat;
  }

  if (fieldDef.type === QUANTITATIVE) {
    // we only apply the default if the field is quantitative
    return config.numberFormat;
  }

  return undefined;
}

function formatExpr(field, format) {
  return "format(".concat(field, ", \"").concat(format || '', "\")");
}

function binNumberFormatExpr(field, format, formatType, config) {
  var _a;

  if (isCustomFormatType(formatType)) {
    return customFormatExpr({
      formatType: formatType,
      field: field,
      format: format
    });
  }

  return formatExpr(field, (_a = isString(format) ? format : undefined) !== null && _a !== void 0 ? _a : config.numberFormat);
}

function binFormatExpression(startField, endField, format, formatType, config) {
  var start = binNumberFormatExpr(startField, format, formatType, config);
  var end = binNumberFormatExpr(endField, format, formatType, config);
  return "".concat(fieldValidPredicate(startField, false), " ? \"null\" : ").concat(start, " + \"").concat(format_BIN_RANGE_DELIMITER, "\" + ").concat(end);
}
/**
 * Returns the time expression used for axis/legend labels or text mark for a temporal field
 */

function timeFormatExpression(field, timeUnit, format, rawTimeFormat, // should be provided only for actual text and headers, not axis/legend labels
isUTCScale) {
  var alwaysReturn = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;

  if (!timeUnit || format) {
    // If there is not time unit, or if user explicitly specify format for axis/legend/text.
    format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit.

    if (format || alwaysReturn) {
      return "".concat(isUTCScale ? 'utc' : 'time', "Format(").concat(field, ", '").concat(format, "')");
    } else {
      return undefined;
    }
  } else {
    return formatExpression(timeUnit, field, isUTCScale);
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/sort.js

var DEFAULT_SORT_OP = 'min';
var SORT_BY_CHANNEL_INDEX = {
  x: 1,
  y: 1,
  color: 1,
  fill: 1,
  stroke: 1,
  strokeWidth: 1,
  size: 1,
  shape: 1,
  fillOpacity: 1,
  strokeOpacity: 1,
  opacity: 1,
  text: 1
};
function isSortByChannel(c) {
  return !!SORT_BY_CHANNEL_INDEX[c];
}
function isSortByEncoding(sort) {
  return !!sort && !!sort['encoding'];
}
function isSortField(sort) {
  return !!sort && (sort['op'] === 'count' || !!sort['field']);
}
function isSortArray(sort) {
  return !!sort && isArray(sort);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/spec/facet.js
function isFacetMapping(f) {
  return !!f['row'] || !!f['column'];
}
function isFacetFieldDef(channelDef) {
  return !!channelDef && !!channelDef['header'];
}
function isFacetSpec(spec) {
  return spec['facet'] !== undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/channeldef.js























function isConditionalSelection(c) {
  return c['selection'];
}
function isRepeatRef(field) {
  return field && !isString(field) && 'repeat' in field;
}
function toFieldDefBase(fieldDef) {
  var field = fieldDef.field,
      timeUnit = fieldDef.timeUnit,
      bin = fieldDef.bin,
      aggregate = fieldDef.aggregate;
  return Object.assign(Object.assign(Object.assign(Object.assign({}, timeUnit ? {
    timeUnit: timeUnit
  } : {}), bin ? {
    bin: bin
  } : {}), aggregate ? {
    aggregate: aggregate
  } : {}), {
    field: field
  });
}
function isSortableFieldDef(fieldDef) {
  return isTypedFieldDef(fieldDef) && !!fieldDef['sort'];
}
function getBand(channel, fieldDef, fieldDef2, mark, config) {
  var _ref = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {},
      isMidPoint = _ref.isMidPoint;

  var timeUnit = fieldDef.timeUnit,
      bin = fieldDef.bin;

  if (util_contains(['x', 'y'], channel)) {
    if (isPositionFieldDef(fieldDef) && fieldDef.band !== undefined) {
      return fieldDef.band;
    } else if (timeUnit && !fieldDef2) {
      if (isMidPoint) {
        return getMarkConfig('timeUnitBandPosition', mark, config);
      } else {
        return isRectBasedMark(mark.type) ? getMarkConfig('timeUnitBand', mark, config) : 0;
      }
    } else if (isBinning(bin)) {
      return isRectBasedMark(mark.type) && !isMidPoint ? 1 : 0.5;
    }
  }

  return undefined;
}
function hasBand(channel, fieldDef, fieldDef2, mark, config) {
  if (isBinning(fieldDef.bin) || fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal') {
    return !!getBand(channel, fieldDef, fieldDef2, mark, config);
  }

  return false;
}
function isConditionalDef(channelDef) {
  return !!channelDef && !!channelDef['condition'];
}
/**
 * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef
 */

function hasConditionalFieldDef(channelDef) {
  return !!channelDef && !!channelDef.condition && !isArray(channelDef.condition) && isFieldDef(channelDef.condition);
}
function hasConditionalValueDef(channelDef) {
  return !!channelDef && !!channelDef.condition && (isArray(channelDef.condition) || isValueDef(channelDef.condition));
}
function isFieldDef(channelDef) {
  return !!channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count');
}
function isTypedFieldDef(channelDef) {
  return !!channelDef && (!!channelDef['field'] && !!channelDef['type'] || channelDef['aggregate'] === 'count');
}
function isStringFieldDef(channelDef) {
  return isFieldDef(channelDef) && isString(channelDef.field);
}
function isValueDef(channelDef) {
  return channelDef && 'value' in channelDef && channelDef['value'] !== undefined;
}
function isScaleFieldDef(channelDef) {
  return !!channelDef && (!!channelDef['scale'] || !!channelDef['sort']);
}
function isPositionFieldDef(channelDef) {
  return !!channelDef && (!!channelDef['axis'] || !!channelDef['stack'] || !!channelDef['impute'] || channelDef['band'] !== undefined);
}
function isMarkPropFieldDef(channelDef) {
  return !!channelDef && !!channelDef['legend'];
}
function isTextFieldDef(channelDef) {
  return !!channelDef && !!channelDef['format'];
}

function isOpFieldDef(fieldDef) {
  return !!fieldDef['op'];
}
/**
 * Get a Vega field reference from a Vega-Lite field def.
 */


function channeldef_vgField(fieldDef) {
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  var _a, _b, _c;

  var field = fieldDef.field;
  var prefix = opt.prefix;
  var suffix = opt.suffix;
  var argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped

  if (isCount(fieldDef)) {
    field = internalField('count');
  } else {
    var fn;

    if (!opt.nofn) {
      if (isOpFieldDef(fieldDef)) {
        fn = fieldDef.op;
      } else {
        var bin = fieldDef.bin,
            aggregate = fieldDef.aggregate,
            timeUnit = fieldDef.timeUnit;

        if (isBinning(bin)) {
          fn = binToString(bin);
          suffix = ((_a = opt.binSuffix) !== null && _a !== void 0 ? _a : '') + ((_b = opt.suffix) !== null && _b !== void 0 ? _b : '');
        } else if (aggregate) {
          if (isArgmaxDef(aggregate)) {
            argAccessor = ".".concat(field);
            field = "argmax_".concat(aggregate.argmax);
          } else if (isArgminDef(aggregate)) {
            argAccessor = ".".concat(field);
            field = "argmin_".concat(aggregate.argmin);
          } else {
            fn = String(aggregate);
          }
        } else if (timeUnit) {
          fn = timeUnitToString(timeUnit);
          suffix = (!util_contains(['range', 'mid'], opt.binSuffix) && opt.binSuffix || '') + ((_c = opt.suffix) !== null && _c !== void 0 ? _c : '');
        }
      }
    }

    if (fn) {
      field = field ? "".concat(fn, "_").concat(field) : fn;
    }
  }

  if (suffix) {
    field = "".concat(field, "_").concat(suffix);
  }

  if (prefix) {
    field = "".concat(prefix, "_").concat(field);
  }

  if (opt.forAs) {
    return field;
  } else if (opt.expr) {
    // Expression to access flattened field. No need to escape dots.
    return flatAccessWithDatum(field, opt.expr) + argAccessor;
  } else {
    // We flattened all fields so paths should have become dot.
    return replacePathInField(field) + argAccessor;
  }
}
function channeldef_isDiscrete(fieldDef) {
  switch (fieldDef.type) {
    case 'nominal':
    case 'ordinal':
    case 'geojson':
      return true;

    case 'quantitative':
      return !!fieldDef.bin;

    case 'temporal':
      return false;
  }

  throw new Error(message.invalidFieldType(fieldDef.type));
}
function channeldef_isContinuous(fieldDef) {
  return !channeldef_isDiscrete(fieldDef);
}
function isCount(fieldDef) {
  return fieldDef.aggregate === 'count';
}
function verbalTitleFormatter(fieldDef, config) {
  var _a;

  var field = fieldDef.field,
      bin = fieldDef.bin,
      timeUnit = fieldDef.timeUnit,
      aggregate = fieldDef.aggregate;

  if (aggregate === 'count') {
    return config.countTitle;
  } else if (isBinning(bin)) {
    return "".concat(field, " (binned)");
  } else if (timeUnit) {
    var unit = (_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit;

    if (unit) {
      return "".concat(field, " (").concat(getTimeUnitParts(unit).join('-'), ")");
    }
  } else if (aggregate) {
    if (isArgmaxDef(aggregate)) {
      return "".concat(field, " for max ").concat(aggregate.argmax);
    } else if (isArgminDef(aggregate)) {
      return "".concat(field, " for min ").concat(aggregate.argmin);
    } else {
      return "".concat(titlecase(aggregate), " of ").concat(field);
    }
  }

  return field;
}
function functionalTitleFormatter(fieldDef) {
  var aggregate = fieldDef.aggregate,
      bin = fieldDef.bin,
      timeUnit = fieldDef.timeUnit,
      field = fieldDef.field;

  if (isArgmaxDef(aggregate)) {
    return "".concat(field, " for argmax(").concat(aggregate.argmax, ")");
  } else if (isArgminDef(aggregate)) {
    return "".concat(field, " for argmin(").concat(aggregate.argmin, ")");
  }

  var timeUnitParams = normalizeTimeUnit(timeUnit);
  var fn = aggregate || (timeUnitParams === null || timeUnitParams === void 0 ? void 0 : timeUnitParams.unit) || (timeUnitParams === null || timeUnitParams === void 0 ? void 0 : timeUnitParams.maxbins) && 'timeunit' || isBinning(bin) && 'bin';

  if (fn) {
    return fn.toUpperCase() + '(' + field + ')';
  } else {
    return field;
  }
}
var defaultTitleFormatter = function defaultTitleFormatter(fieldDef, config) {
  switch (config.fieldTitle) {
    case 'plain':
      return fieldDef.field;

    case 'functional':
      return functionalTitleFormatter(fieldDef);

    default:
      return verbalTitleFormatter(fieldDef, config);
  }
};
var titleFormatter = defaultTitleFormatter;
function setTitleFormatter(formatter) {
  titleFormatter = formatter;
}
function resetTitleFormatter() {
  setTitleFormatter(defaultTitleFormatter);
}
function channeldef_title(fieldDef, config, _ref2) {
  var allowDisabling = _ref2.allowDisabling,
      _ref2$includeDefault = _ref2.includeDefault,
      includeDefault = _ref2$includeDefault === void 0 ? true : _ref2$includeDefault;

  var _a, _b;

  var guide = (_a = getGuide(fieldDef)) !== null && _a !== void 0 ? _a : {};
  var guideTitle = guide.title;
  var def = includeDefault ? defaultTitle(fieldDef, config) : undefined;

  if (allowDisabling) {
    return getFirstDefined(guideTitle, fieldDef.title, def);
  } else {
    return (_b = guideTitle !== null && guideTitle !== void 0 ? guideTitle : fieldDef.title) !== null && _b !== void 0 ? _b : def;
  }
}
function getGuide(fieldDef) {
  if (isPositionFieldDef(fieldDef) && fieldDef.axis) {
    return fieldDef.axis;
  } else if (isMarkPropFieldDef(fieldDef) && fieldDef.legend) {
    return fieldDef.legend;
  } else if (isFacetFieldDef(fieldDef) && fieldDef.header) {
    return fieldDef.header;
  }

  return undefined;
}
function defaultTitle(fieldDef, config) {
  return titleFormatter(fieldDef, config);
}
function getFormatMixins(fieldDef) {
  var _a;

  if (isTextFieldDef(fieldDef)) {
    var format = fieldDef.format,
        formatType = fieldDef.formatType;
    return {
      format: format,
      formatType: formatType
    };
  } else {
    var guide = (_a = getGuide(fieldDef)) !== null && _a !== void 0 ? _a : {};
    var _format = guide.format,
        _formatType = guide.formatType;
    return {
      format: _format,
      formatType: _formatType
    };
  }
}
function defaultType(fieldDef, channel) {
  if (fieldDef.timeUnit) {
    return 'temporal';
  }

  if (isBinning(fieldDef.bin)) {
    return 'quantitative';
  }

  switch (rangeType(channel)) {
    case 'continuous':
      return 'quantitative';

    case 'discrete':
      return 'nominal';

    case 'flexible':
      // color
      return 'nominal';

    default:
      return 'quantitative';
  }
}
/**
 * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef.
 * @param channelDef
 */

function getFieldDef(channelDef) {
  if (isFieldDef(channelDef)) {
    return channelDef;
  } else if (hasConditionalFieldDef(channelDef)) {
    return channelDef.condition;
  }

  return undefined;
}
function getTypedFieldDef(channelDef) {
  if (isFieldDef(channelDef)) {
    return channelDef;
  } else if (hasConditionalFieldDef(channelDef)) {
    return channelDef.condition;
  }

  return undefined;
}
/**
 * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.
 */

function initChannelDef(channelDef, channel) {
  if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) {
    var primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean';
    log_warn(message.primitiveChannelDef(channel, primitiveType, channelDef));
    return {
      value: channelDef
    };
  } // If a fieldDef contains a field, we need type.


  if (isFieldDef(channelDef)) {
    return initFieldDef(channelDef, channel);
  } else if (hasConditionalFieldDef(channelDef)) {
    return Object.assign(Object.assign({}, channelDef), {
      // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition<FieldDef>
      condition: initFieldDef(channelDef.condition, channel)
    });
  }

  return channelDef;
}
function initFieldDef(fd, channel) {
  var aggregate = fd.aggregate,
      timeUnit = fd.timeUnit,
      bin = fd.bin,
      field = fd.field;
  var fieldDef = Object.assign({}, fd); // Drop invalid aggregate

  if (aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) {
    log_warn(message.invalidAggregate(aggregate));
    delete fieldDef.aggregate;
  } // Normalize Time Unit


  if (timeUnit) {
    fieldDef.timeUnit = normalizeTimeUnit(timeUnit);
  }

  if (field) {
    fieldDef.field = "".concat(field);
  } // Normalize bin


  if (isBinning(bin)) {
    fieldDef.bin = normalizeBin(bin, channel);
  }

  if (isBinned(bin) && !util_contains(POSITION_SCALE_CHANNELS, channel)) {
    log_warn("Channel ".concat(channel, " should not be used with \"binned\" bin."));
  } // Normalize Type


  if (isTypedFieldDef(fieldDef)) {
    var type = fieldDef.type;
    var fullType = getFullName(type);

    if (type !== fullType) {
      // convert short type to full type
      fieldDef.type = fullType;
    }

    if (type !== 'quantitative') {
      if (isCountingAggregateOp(aggregate)) {
        log_warn(message.invalidFieldTypeForCountAggregate(type, aggregate));
        fieldDef.type = 'quantitative';
      }
    }
  } else if (!isSecondaryRangeChannel(channel)) {
    // If type is empty / invalid, then augment with default type
    var newType = defaultType(fieldDef, channel);
    log_warn(message.missingFieldType(channel, newType));
    fieldDef['type'] = newType;
  }

  if (isTypedFieldDef(fieldDef)) {
    var _channelCompatibility = channelCompatibility(fieldDef, channel),
        compatible = _channelCompatibility.compatible,
        warning = _channelCompatibility.warning;

    if (!compatible) {
      log_warn(warning);
    }
  }

  if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) {
    var sort = fieldDef.sort;

    if (isSortByChannel(sort)) {
      return Object.assign(Object.assign({}, fieldDef), {
        sort: {
          encoding: sort
        }
      });
    }

    var sub = sort.substr(1);

    if (sort.charAt(0) === '-' && isSortByChannel(sub)) {
      return Object.assign(Object.assign({}, fieldDef), {
        sort: {
          encoding: sub,
          order: 'descending'
        }
      });
    }
  }

  if (isFacetFieldDef(fieldDef)) {
    var header = fieldDef.header;

    var orient = header.orient,
        rest = __rest(header, ["orient"]);

    if (orient) {
      return Object.assign(Object.assign({}, fieldDef), {
        header: Object.assign(Object.assign({}, rest), {
          labelOrient: header.labelOrient || orient,
          titleOrient: header.titleOrient || orient
        })
      });
    }
  }

  return fieldDef;
}
function normalizeBin(bin, channel) {
  if (isBoolean(bin)) {
    return {
      maxbins: autoMaxBins(channel)
    };
  } else if (bin === 'binned') {
    return {
      binned: true
    };
  } else if (!bin.maxbins && !bin.step) {
    return Object.assign(Object.assign({}, bin), {
      maxbins: autoMaxBins(channel)
    });
  } else {
    return bin;
  }
}
var COMPATIBLE = {
  compatible: true
};
function channelCompatibility(fieldDef, channel) {
  var type = fieldDef.type;

  if (type === 'geojson' && channel !== 'shape') {
    return {
      compatible: false,
      warning: "Channel ".concat(channel, " should not be used with a geojson data.")
    };
  }

  switch (channel) {
    case 'row':
    case 'column':
    case 'facet':
      if (channeldef_isContinuous(fieldDef)) {
        return {
          compatible: false,
          warning: message.facetChannelShouldBeDiscrete(channel)
        };
      }

      return COMPATIBLE;

    case 'x':
    case 'y':
    case 'color':
    case 'fill':
    case 'stroke':
    case 'text':
    case 'detail':
    case 'key':
    case 'tooltip':
    case 'href':
    case 'url':
      return COMPATIBLE;

    case 'longitude':
    case 'longitude2':
    case 'latitude':
    case 'latitude2':
      if (type !== QUANTITATIVE) {
        return {
          compatible: false,
          warning: "Channel ".concat(channel, " should be used with a quantitative field only, not ").concat(fieldDef.type, " field.")
        };
      }

      return COMPATIBLE;

    case 'opacity':
    case 'fillOpacity':
    case 'strokeOpacity':
    case 'strokeWidth':
    case 'size':
    case 'x2':
    case 'y2':
      if (type === 'nominal' && !fieldDef['sort']) {
        return {
          compatible: false,
          warning: "Channel ".concat(channel, " should not be used with an unsorted discrete field.")
        };
      }

      return COMPATIBLE;

    case 'strokeDash':
      if (!util_contains(['ordinal', 'nominal'], fieldDef.type)) {
        return {
          compatible: false,
          warning: 'StrokeDash channel should be used with only discrete data.'
        };
      }

      return COMPATIBLE;

    case 'shape':
      if (!util_contains(['ordinal', 'nominal', 'geojson'], fieldDef.type)) {
        return {
          compatible: false,
          warning: 'Shape channel should be used with only either discrete or geojson data.'
        };
      }

      return COMPATIBLE;

    case 'order':
      if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) {
        return {
          compatible: false,
          warning: "Channel order is inappropriate for nominal field, which has no inherent order."
        };
      }

      return COMPATIBLE;
  }
}
/**
 * Check if the field def uses a time format or does not use any format but is temporal
 * (this does not cover field defs that are temporal but use a number format).
 */

function isFieldDefForTimeFormat(fieldDef) {
  var guide = getGuide(fieldDef);
  var formatType = guide && guide.formatType || isTextFieldDef(fieldDef) && fieldDef.formatType;
  return formatType === 'time' || !formatType && isTimeFieldDef(fieldDef);
}
function isFieldDefWithCustomTimeFormat(fieldDef) {
  var guide = getGuide(fieldDef);
  var formatType = guide && guide.formatType || isTextFieldDef(fieldDef) && fieldDef.formatType;
  return formatType && isCustomFormatType(formatType);
}
/**
 * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`.
 */

function isTimeFieldDef(fieldDef) {
  return fieldDef.type === 'temporal' || !!fieldDef.timeUnit;
}
/**
 * Getting a value associated with a fielddef.
 * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit)
 */

function valueExpr(v, _ref3) {
  var timeUnit = _ref3.timeUnit,
      type = _ref3.type,
      time = _ref3.time,
      undefinedIfExprNotRequired = _ref3.undefinedIfExprNotRequired;

  var _a;

  var unit = (_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit;
  var expr;

  if (isSignalRef(v)) {
    var s = v.signal;

    if (time && !unit && type !== 'temporal') {
      // We don't know if this is a date or not, so we need to check
      return time ? "isDate(".concat(s, ") ? time(").concat(s, ") : ").concat(s) : s;
    } else {
      // TODO: support isLocalSingleTimeUnit(unit) -- we can't do that until DateTime object supports signal
      expr = s;
    }
  } else if (isDateTime(v)) {
    expr = dateTimeToExpr(v);
  } else if (isString(v) || isNumber(v)) {
    if (unit || type === 'temporal') {
      if (isLocalSingleTimeUnit(unit)) {
        expr = dateTimeToExpr(_defineProperty({}, unit, v));
      } else {
        expr = "datetime(".concat(JSON.stringify(v), ")");
      }
    }
  }

  if (expr) {
    return time ? "time(".concat(expr, ")") : expr;
  } // number or boolean or normal string


  return undefinedIfExprNotRequired ? undefined : JSON.stringify(v);
}
/**
 * Standardize value array -- convert each value to Vega expression if applicable
 */

function valueArray(fieldDef, values) {
  var _a;

  var type = fieldDef.type;
  var timeUnit = (_a = normalizeTimeUnit(fieldDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit;
  return values.map(function (v) {
    var expr = valueExpr(v, {
      timeUnit: timeUnit,
      type: type,
      undefinedIfExprNotRequired: true
    }); // return signal for the expression if we need an expression

    if (expr !== undefined) {
      return {
        signal: expr
      };
    } // otherwise just return the original value


    return v;
  });
}
/**
 * Checks whether a fieldDef for a particular channel requires a computed bin range.
 */

function binRequiresRange(fieldDef, channel) {
  if (!isBinning(fieldDef.bin)) {
    console.warn('Only call this method for binned field defs.');
    return false;
  } // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels.
  // We could check whether the axis or legend exists (not disabled) but that seems overkill.


  return isScaleChannel(channel) && util_contains(['ordinal', 'nominal'], fieldDef.type);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/bin.js








/**
 * Create a key for the bin configuration. Not for prebinned bin.
 */

function binToString(bin) {
  if (isBoolean(bin)) {
    bin = normalizeBin(bin, undefined);
  }

  return 'bin' + util_keys(bin).map(function (p) {
    return isSelectionExtent(bin[p]) ? varName("_".concat(p, "_").concat(Object.entries(bin[p]))) : varName("_".concat(p, "_").concat(bin[p]));
  }).join('');
}
/**
 * Vega-Lite should bin the data.
 */

function isBinning(bin) {
  return bin === true || isBinParams(bin) && !bin.binned;
}
/**
 * The data is already binned and so Vega-Lite should not bin it again.
 */

function isBinned(bin) {
  return bin === 'binned' || isBinParams(bin) && bin.binned === true;
}
function isBinParams(bin) {
  return isObject(bin);
}
function isSelectionExtent(extent) {
  return extent === null || extent === void 0 ? void 0 : extent['selection'];
}
function autoMaxBins(channel) {
  switch (channel) {
    case ROW:
    case COLUMN:
    case channel_SIZE:
    case COLOR:
    case FILL:
    case STROKE:
    case STROKEWIDTH:
    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY: // Facets and Size shouldn't have too many bins
    // We choose 6 like shape to simplify the rule [falls through]

    case SHAPE:
      return 6;
    // Vega's "shape" has 6 distinct values

    case STROKEDASH:
      return 4;
    // We only provide 5 different stroke dash values (but 4 is more effective)

    default:
      return 10;
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/encoding.js

















function encoding_channelHasField(encoding, channel) {
  var channelDef = encoding && encoding[channel];

  if (channelDef) {
    if (isArray(channelDef)) {
      return some(channelDef, function (fieldDef) {
        return !!fieldDef.field;
      });
    } else {
      return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef);
    }
  }

  return false;
}
function encoding_isAggregate(encoding) {
  return some(CHANNELS, function (channel) {
    if (encoding_channelHasField(encoding, channel)) {
      var channelDef = encoding[channel];

      if (isArray(channelDef)) {
        return some(channelDef, function (fieldDef) {
          return !!fieldDef.aggregate;
        });
      } else {
        var fieldDef = getFieldDef(channelDef);
        return fieldDef && !!fieldDef.aggregate;
      }
    }

    return false;
  });
}
function extractTransformsFromEncoding(oldEncoding, config) {
  var groupby = [];
  var bins = [];
  var timeUnits = [];
  var aggregate = [];
  var encoding = {};
  forEach(oldEncoding, function (channelDef, channel) {
    // Extract potential embedded transformations along with remaining properties
    if (isFieldDef(channelDef)) {
      var field = channelDef.field,
          aggOp = channelDef.aggregate,
          bin = channelDef.bin,
          timeUnit = channelDef.timeUnit,
          remaining = __rest(channelDef, ["field", "aggregate", "bin", "timeUnit"]);

      if (aggOp || timeUnit || bin) {
        var guide = getGuide(channelDef);
        var isTitleDefined = guide && guide.title;
        var newField = channeldef_vgField(channelDef, {
          forAs: true
        });
        var newFieldDef = Object.assign(Object.assign(Object.assign({}, isTitleDefined ? [] : {
          title: channeldef_title(channelDef, config, {
            allowDisabling: true
          })
        }), remaining), {
          // Always overwrite field
          field: newField
        });
        var isPositionChannel = channel === 'x' || channel === 'y';

        if (aggOp) {
          var op;

          if (isArgmaxDef(aggOp)) {
            op = 'argmax';
            newField = channeldef_vgField({
              op: 'argmax',
              field: aggOp.argmax
            }, {
              forAs: true
            });
            newFieldDef.field = "".concat(newField, ".").concat(field);
          } else if (isArgminDef(aggOp)) {
            op = 'argmin';
            newField = channeldef_vgField({
              op: 'argmin',
              field: aggOp.argmin
            }, {
              forAs: true
            });
            newFieldDef.field = "".concat(newField, ".").concat(field);
          } else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') {
            op = aggOp;
          }

          if (op) {
            var aggregateEntry = {
              op: op,
              as: newField
            };

            if (field) {
              aggregateEntry.field = field;
            }

            aggregate.push(aggregateEntry);
          }
        } else {
          groupby.push(newField);

          if (isTypedFieldDef(channelDef) && isBinning(bin)) {
            bins.push({
              bin: bin,
              field: field,
              as: newField
            }); // Add additional groupbys for range and end of bins

            groupby.push(channeldef_vgField(channelDef, {
              binSuffix: 'end'
            }));

            if (binRequiresRange(channelDef, channel)) {
              groupby.push(channeldef_vgField(channelDef, {
                binSuffix: 'range'
              }));
            } // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively


            if (isPositionChannel) {
              var secondaryChannel = {
                field: newField + '_end'
              };
              encoding[channel + '2'] = secondaryChannel;
            }

            newFieldDef.bin = 'binned';

            if (!isSecondaryRangeChannel(channel)) {
              newFieldDef['type'] = 'quantitative';
            }
          } else if (timeUnit) {
            timeUnits.push({
              timeUnit: timeUnit,
              field: field,
              as: newField
            }); // define the format type for later compilation

            var formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time';

            if (formatType) {
              if (channel === 'text' || channel === 'tooltip') {
                newFieldDef['formatType'] = formatType;
              } else if (isNonPositionScaleChannel(channel)) {
                newFieldDef['legend'] = Object.assign({
                  formatType: formatType
                }, newFieldDef['legend']);
              } else if (isPositionChannel) {
                newFieldDef['axis'] = Object.assign({
                  formatType: formatType
                }, newFieldDef['axis']);
              }
            }
          }
        } // now the field should refer to post-transformed field instead


        encoding[channel] = newFieldDef;
      } else {
        groupby.push(field);
        encoding[channel] = oldEncoding[channel];
      }
    } else {
      // For value def, just copy
      encoding[channel] = oldEncoding[channel];
    }
  });
  return {
    bins: bins,
    timeUnits: timeUnits,
    aggregate: aggregate,
    groupby: groupby,
    encoding: encoding
  };
}
function markChannelCompatible(encoding, channel, mark) {
  var markSupported = supportMark(channel, mark);

  if (!markSupported) {
    return false;
  } else if (markSupported === 'binned') {
    var primaryFieldDef = encoding[channel === 'x2' ? 'x' : 'y']; // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef
    // has "binned" data and thus need x2/y2 to specify the bin-end field.

    if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) {
      return true;
    } else {
      return false;
    }
  }

  return true;
}
function initEncoding(encoding, markDef) {
  var mark = markDef.type;
  return util_keys(encoding).reduce(function (normalizedEncoding, channel) {
    if (!isChannel(channel)) {
      // Drop invalid channel
      log_warn(message.invalidEncodingChannel(channel));
      return normalizedEncoding;
    }

    if (!markChannelCompatible(encoding, channel, mark)) {
      // Drop unsupported channel
      log_warn(message.incompatibleChannel(channel, mark));
      return normalizedEncoding;
    } // Drop line's size if the field is aggregated.


    if (channel === 'size' && mark === 'line') {
      var fieldDef = getTypedFieldDef(encoding[channel]);

      if (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.aggregate) {
        log_warn(message.LINE_WITH_VARYING_SIZE);
        return normalizedEncoding;
      }
    } // Drop color if either fill or stroke is specified


    if (channel === 'color' && (markDef.filled ? 'fill' in encoding : 'stroke' in encoding)) {
      log_warn(message.droppingColor('encoding', {
        fill: 'fill' in encoding,
        stroke: 'stroke' in encoding
      }));
      return normalizedEncoding;
    }

    var channelDef = encoding[channel];

    if (channel === 'detail' || channel === 'order' && !isArray(channelDef) && !isValueDef(channelDef) || channel === 'tooltip' && isArray(channelDef)) {
      if (channelDef) {
        // Array of fieldDefs for detail channel (or production rule)
        normalizedEncoding[channel] = vega_util_src_array(channelDef).reduce(function (defs, fieldDef) {
          if (!isFieldDef(fieldDef)) {
            log_warn(message.emptyFieldDef(fieldDef, channel));
          } else {
            defs.push(initFieldDef(fieldDef, channel));
          }

          return defs;
        }, []);
      }
    } else {
      if (channel === 'tooltip' && channelDef === null) {
        // Preserve null so we can use it to disable tooltip
        normalizedEncoding[channel] = null;
      } else if (!isFieldDef(channelDef) && !isValueDef(channelDef) && !isConditionalDef(channelDef) && !isSignalRef(channelDef)) {
        log_warn(message.emptyFieldDef(channelDef, channel));
        return normalizedEncoding;
      }

      normalizedEncoding[channel] = initChannelDef(channelDef, channel);
    }

    return normalizedEncoding;
  }, {});
}
function fieldDefs(encoding) {
  var arr = [];

  var _iterator = _createForOfIteratorHelper(util_keys(encoding)),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var channel = _step.value;

      if (encoding_channelHasField(encoding, channel)) {
        var channelDef = encoding[channel];
        var channelDefArray = vega_util_src_array(channelDef);

        var _iterator2 = _createForOfIteratorHelper(channelDefArray),
            _step2;

        try {
          for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
            var def = _step2.value;

            if (isFieldDef(def)) {
              arr.push(def);
            } else if (hasConditionalFieldDef(def)) {
              arr.push(def.condition);
            }
          }
        } catch (err) {
          _iterator2.e(err);
        } finally {
          _iterator2.f();
        }
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return arr;
}
function forEach(mapping, f, thisArg) {
  if (!mapping) {
    return;
  }

  var _iterator3 = _createForOfIteratorHelper(util_keys(mapping)),
      _step3;

  try {
    for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
      var channel = _step3.value;
      var el = mapping[channel];

      if (isArray(el)) {
        var _iterator4 = _createForOfIteratorHelper(el),
            _step4;

        try {
          for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
            var channelDef = _step4.value;
            f.call(thisArg, channelDef, channel);
          }
        } catch (err) {
          _iterator4.e(err);
        } finally {
          _iterator4.f();
        }
      } else {
        f.call(thisArg, el, channel);
      }
    }
  } catch (err) {
    _iterator3.e(err);
  } finally {
    _iterator3.f();
  }
}
function encoding_reduce(mapping, f, init, thisArg) {
  if (!mapping) {
    return init;
  }

  return util_keys(mapping).reduce(function (r, channel) {
    var map = mapping[channel];

    if (isArray(map)) {
      return map.reduce(function (r1, channelDef) {
        return f.call(thisArg, r1, channelDef, channel);
      }, r);
    } else {
      return f.call(thisArg, r, map, channel);
    }
  }, init);
}
/**
 * Returns list of path grouping fields for the given encoding
 */

function pathGroupingFields(mark, encoding) {
  return util_keys(encoding).reduce(function (details, channel) {
    switch (channel) {
      // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, cursor should not cause lines to group
      case 'x':
      case 'y':
      case 'href':
      case 'url':
      case 'x2':
      case 'y2': // falls through

      case 'latitude':
      case 'longitude':
      case 'latitude2':
      case 'longitude2': // TODO: case 'cursor':
      // text, shape, shouldn't be a part of line/trail/area [falls through]

      case 'text':
      case 'shape': // falls through
      // tooltip fields should not be added to group by [falls through]

      case 'tooltip':
        return details;

      case 'order':
        // order should not group line / trail
        if (mark === 'line' || mark === 'trail') {
          return details;
        }

      // but order should group area for stacking (falls through)

      case 'detail':
      case 'key':
        {
          var channelDef = encoding[channel];

          if (isArray(channelDef) || isFieldDef(channelDef)) {
            vega_util_src_array(channelDef).forEach(function (fieldDef) {
              if (!fieldDef.aggregate) {
                details.push(channeldef_vgField(fieldDef, {}));
              }
            });
          }

          return details;
        }

      case 'size':
        if (mark === 'trail') {
          // For trail, size should not group trail lines.
          return details;
        }

      // For line, size should group lines.
      // falls through

      case 'color':
      case 'fill':
      case 'stroke':
      case 'opacity':
      case 'fillOpacity':
      case 'strokeOpacity':
      case 'strokeDash':
      case 'strokeWidth':
        {
          // TODO strokeDashOffset:
          // falls through
          var fieldDef = getTypedFieldDef(encoding[channel]);

          if (fieldDef && !fieldDef.aggregate) {
            details.push(channeldef_vgField(fieldDef, {}));
          }

          return details;
        }
    }
  }, []);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compositemark/common.js















function filterTooltipWithAggregatedField(oldEncoding) {
  var tooltip = oldEncoding.tooltip,
      filteredEncoding = __rest(oldEncoding, ["tooltip"]);

  if (!tooltip) {
    return {
      filteredEncoding: oldEncoding
    };
  }

  var customTooltipWithAggregatedField;
  var customTooltipWithoutAggregatedField;

  if (isArray(tooltip)) {
    tooltip.forEach(function (t) {
      if (t.aggregate) {
        if (!customTooltipWithAggregatedField) {
          customTooltipWithAggregatedField = [];
        }

        customTooltipWithAggregatedField.push(t);
      } else {
        if (!customTooltipWithoutAggregatedField) {
          customTooltipWithoutAggregatedField = [];
        }

        customTooltipWithoutAggregatedField.push(t);
      }
    });

    if (customTooltipWithAggregatedField) {
      filteredEncoding.tooltip = customTooltipWithAggregatedField;
    }
  } else {
    if (tooltip['aggregate']) {
      filteredEncoding.tooltip = tooltip;
    } else {
      customTooltipWithoutAggregatedField = tooltip;
    }
  }

  if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) {
    customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0];
  }

  return {
    customTooltipWithoutAggregatedField: customTooltipWithoutAggregatedField,
    filteredEncoding: filteredEncoding
  };
}
function getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis) {
  var withFieldName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;

  if ('tooltip' in encodingWithoutContinuousAxis) {
    return {
      tooltip: encodingWithoutContinuousAxis.tooltip
    };
  }

  var fiveSummaryTooltip = tooltipSummary.map(function (_ref) {
    var fieldPrefix = _ref.fieldPrefix,
        titlePrefix = _ref.titlePrefix;
    var mainTitle = withFieldName ? " of ".concat(continuousAxisChannelDef.field) : '';
    return {
      field: fieldPrefix + continuousAxisChannelDef.field,
      type: continuousAxisChannelDef.type,
      title: isSignalRef(titlePrefix) ? {
        signal: titlePrefix + "\"".concat(escape(mainTitle), "\"")
      } : titlePrefix + mainTitle
    };
  });
  return {
    tooltip: [].concat(_toConsumableArray(fiveSummaryTooltip), _toConsumableArray(fieldDefs(encodingWithoutContinuousAxis)))
  };
}
function getTitle(continuousAxisChannelDef) {
  var axis = continuousAxisChannelDef.axis,
      title = continuousAxisChannelDef.title,
      field = continuousAxisChannelDef.field;
  return axis && axis.title !== undefined ? undefined : getFirstDefined(title, field);
}
function makeCompositeAggregatePartFactory(compositeMarkDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, compositeMarkConfig) {
  var scale = continuousAxisChannelDef.scale,
      axis = continuousAxisChannelDef.axis;
  return function (_ref2) {
    var partName = _ref2.partName,
        mark = _ref2.mark,
        positionPrefix = _ref2.positionPrefix,
        _ref2$endPositionPref = _ref2.endPositionPrefix,
        endPositionPrefix = _ref2$endPositionPref === void 0 ? undefined : _ref2$endPositionPref,
        _ref2$extraEncoding = _ref2.extraEncoding,
        extraEncoding = _ref2$extraEncoding === void 0 ? {} : _ref2$extraEncoding;
    var title = getTitle(continuousAxisChannelDef);
    return partLayerMixins(compositeMarkDef, partName, compositeMarkConfig, {
      mark: mark,
      encoding: Object.assign(Object.assign(Object.assign(_defineProperty({}, continuousAxis, Object.assign(Object.assign(Object.assign({
        field: positionPrefix + '_' + continuousAxisChannelDef.field,
        type: continuousAxisChannelDef.type
      }, title !== undefined ? {
        title: title
      } : {}), scale !== undefined ? {
        scale: scale
      } : {}), axis !== undefined ? {
        axis: axis
      } : {})), isString(endPositionPrefix) ? _defineProperty({}, continuousAxis + '2', {
        field: endPositionPrefix + '_' + continuousAxisChannelDef.field
      }) : {}), sharedEncoding), extraEncoding)
    });
  };
}
function partLayerMixins(markDef, part, compositeMarkConfig, partBaseSpec) {
  var clip = markDef.clip,
      color = markDef.color,
      opacity = markDef.opacity;
  var mark = markDef.type;

  if (markDef[part] || markDef[part] === undefined && compositeMarkConfig[part]) {
    return [Object.assign(Object.assign({}, partBaseSpec), {
      mark: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, compositeMarkConfig[part]), clip ? {
        clip: clip
      } : {}), color ? {
        color: color
      } : {}), opacity ? {
        opacity: opacity
      } : {}), isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : {
        type: partBaseSpec.mark
      }), {
        style: "".concat(mark, "-").concat(part)
      }), isBoolean(markDef[part]) ? {} : markDef[part])
    })];
  }

  return [];
}
function compositeMarkContinuousAxis(spec, orient, compositeMark) {
  var encoding = spec.encoding;
  var continuousAxis = orient === 'vertical' ? 'y' : 'x';
  var continuousAxisChannelDef = encoding[continuousAxis]; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal.

  var continuousAxisChannelDef2 = encoding[continuousAxis + '2'];
  var continuousAxisChannelDefError = encoding[continuousAxis + 'Error'];
  var continuousAxisChannelDefError2 = encoding[continuousAxis + 'Error2'];
  return {
    continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark),
    continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark),
    continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark),
    continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark),
    continuousAxis: continuousAxis
  };
}

function filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark) {
  if (continuousAxisChannelDef && continuousAxisChannelDef.aggregate) {
    var aggregate = continuousAxisChannelDef.aggregate,
        continuousAxisWithoutAggregate = __rest(continuousAxisChannelDef, ["aggregate"]);

    if (aggregate !== compositeMark) {
      log_warn(message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark));
    }

    return continuousAxisWithoutAggregate;
  } else {
    return continuousAxisChannelDef;
  }
}

function compositeMarkOrient(spec, compositeMark) {
  var mark = spec.mark,
      encoding = spec.encoding;

  if (isFieldDef(encoding.x) && channeldef_isContinuous(encoding.x)) {
    // x is continuous
    if (isFieldDef(encoding.y) && channeldef_isContinuous(encoding.y)) {
      // both x and y are continuous
      if (encoding.x.aggregate === undefined && encoding.y.aggregate === compositeMark) {
        return 'vertical';
      } else if (encoding.y.aggregate === undefined && encoding.x.aggregate === compositeMark) {
        return 'horizontal';
      } else if (encoding.x.aggregate === compositeMark && encoding.y.aggregate === compositeMark) {
        throw new Error('Both x and y cannot have aggregate');
      } else {
        if (isMarkDef(mark) && mark.orient) {
          return mark.orient;
        } // default orientation = vertical


        return 'vertical';
      }
    } // x is continuous but y is not


    return 'horizontal';
  } else if (isFieldDef(encoding.y) && channeldef_isContinuous(encoding.y)) {
    // y is continuous but x is not
    return 'vertical';
  } else {
    // Neither x nor y is continuous.
    throw new Error('Need a valid continuous axis for ' + compositeMark + 's');
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compositemark/boxplot.js













var BOXPLOT = 'boxplot';
var BOXPLOT_PART_INDEX = {
  box: 1,
  median: 1,
  outliers: 1,
  rule: 1,
  ticks: 1
};
var BOXPLOT_PARTS = util_keys(BOXPLOT_PART_INDEX);
var boxPlotNormalizer = new base_CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot);
function getBoxPlotType(extent) {
  if (isNumber(extent)) {
    return 'tukey';
  } // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now.


  return extent;
}
function normalizeBoxPlot(spec, _ref) {
  var config = _ref.config;

  var _a, _b; // TODO: use selection


  var mark = spec.mark,
      _encoding = spec.encoding,
      selection = spec.selection,
      _p = spec.projection,
      outerSpec = __rest(spec, ["mark", "encoding", "selection", "projection"]);

  var markDef = isMarkDef(mark) ? mark : {
    type: mark
  }; // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support

  if (selection) {
    log_warn(message.selectionNotSupported('boxplot'));
  }

  var extent = (_a = markDef.extent) !== null && _a !== void 0 ? _a : config.boxplot.extent;
  var sizeValue = getFirstDefined(markDef.size, config.boxplot.size);
  var boxPlotType = getBoxPlotType(extent);

  var _boxParams = boxParams(spec, extent, config),
      transform = _boxParams.transform,
      continuousAxisChannelDef = _boxParams.continuousAxisChannelDef,
      continuousAxis = _boxParams.continuousAxis,
      groupby = _boxParams.groupby,
      aggregate = _boxParams.aggregate,
      encodingWithoutContinuousAxis = _boxParams.encodingWithoutContinuousAxis,
      ticksOrient = _boxParams.ticksOrient,
      boxOrient = _boxParams.boxOrient,
      customTooltipWithoutAggregatedField = _boxParams.customTooltipWithoutAggregatedField;

  var color = encodingWithoutContinuousAxis.color,
      size = encodingWithoutContinuousAxis.size,
      encodingWithoutSizeColorAndContinuousAxis = __rest(encodingWithoutContinuousAxis, ["color", "size"]);

  var makeBoxPlotPart = function makeBoxPlotPart(sharedEncoding) {
    return makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, config.boxplot);
  };

  var makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis);
  var makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis);
  var makeBoxPlotMidTick = makeBoxPlotPart(Object.assign(Object.assign({}, encodingWithoutSizeColorAndContinuousAxis), size ? {
    size: size
  } : {}));
  var fiveSummaryTooltipEncoding = getCompositeMarkTooltip([{
    fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_',
    titlePrefix: 'Max'
  }, {
    fieldPrefix: 'upper_box_',
    titlePrefix: 'Q3'
  }, {
    fieldPrefix: 'mid_box_',
    titlePrefix: 'Median'
  }, {
    fieldPrefix: 'lower_box_',
    titlePrefix: 'Q1'
  }, {
    fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_',
    titlePrefix: 'Min'
  }], continuousAxisChannelDef, encodingWithoutContinuousAxis); // ## Whisker Layers

  var endTick = {
    type: 'tick',
    color: 'black',
    opacity: 1,
    orient: ticksOrient,
    invalid: null
  };
  var whiskerTooltipEncoding = boxPlotType === 'min-max' ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker
  : // for tukey / k-IQR, just show upper/lower-whisker
  getCompositeMarkTooltip([{
    fieldPrefix: 'upper_whisker_',
    titlePrefix: 'Upper Whisker'
  }, {
    fieldPrefix: 'lower_whisker_',
    titlePrefix: 'Lower Whisker'
  }], continuousAxisChannelDef, encodingWithoutContinuousAxis);
  var whiskerLayers = [].concat(_toConsumableArray(makeBoxPlotExtent({
    partName: 'rule',
    mark: {
      type: 'rule',
      invalid: null
    },
    positionPrefix: 'lower_whisker',
    endPositionPrefix: 'lower_box',
    extraEncoding: whiskerTooltipEncoding
  })), _toConsumableArray(makeBoxPlotExtent({
    partName: 'rule',
    mark: {
      type: 'rule',
      invalid: null
    },
    positionPrefix: 'upper_box',
    endPositionPrefix: 'upper_whisker',
    extraEncoding: whiskerTooltipEncoding
  })), _toConsumableArray(makeBoxPlotExtent({
    partName: 'ticks',
    mark: endTick,
    positionPrefix: 'lower_whisker',
    extraEncoding: whiskerTooltipEncoding
  })), _toConsumableArray(makeBoxPlotExtent({
    partName: 'ticks',
    mark: endTick,
    positionPrefix: 'upper_whisker',
    extraEncoding: whiskerTooltipEncoding
  }))); // ## Box Layers
  // TODO: support hiding certain mark parts

  var boxLayers = [].concat(_toConsumableArray(boxPlotType !== 'tukey' ? whiskerLayers : []), _toConsumableArray(makeBoxPlotBox({
    partName: 'box',
    mark: Object.assign(Object.assign({
      type: 'bar'
    }, sizeValue ? {
      size: sizeValue
    } : {}), {
      orient: boxOrient,
      invalid: null
    }),
    positionPrefix: 'lower_box',
    endPositionPrefix: 'upper_box',
    extraEncoding: fiveSummaryTooltipEncoding
  })), _toConsumableArray(makeBoxPlotMidTick({
    partName: 'median',
    mark: Object.assign(Object.assign(Object.assign({
      type: 'tick',
      invalid: null
    }, isObject(config.boxplot.median) && config.boxplot.median.color ? {
      color: config.boxplot.median.color
    } : {}), sizeValue ? {
      size: sizeValue
    } : {}), {
      orient: ticksOrient
    }),
    positionPrefix: 'mid_box',
    extraEncoding: fiveSummaryTooltipEncoding
  }))); // ## Filtered Layers

  var filteredLayersMixins;

  if (boxPlotType !== 'min-max') {
    var lowerBoxExpr = "datum[\"lower_box_".concat(continuousAxisChannelDef.field, "\"]");
    var upperBoxExpr = "datum[\"upper_box_".concat(continuousAxisChannelDef.field, "\"]");
    var iqrExpr = "(".concat(upperBoxExpr, " - ").concat(lowerBoxExpr, ")");
    var lowerWhiskerExpr = "".concat(lowerBoxExpr, " - ").concat(extent, " * ").concat(iqrExpr);
    var upperWhiskerExpr = "".concat(upperBoxExpr, " + ").concat(extent, " * ").concat(iqrExpr);
    var fieldExpr = "datum[\"".concat(continuousAxisChannelDef.field, "\"]");
    var joinaggregateTransform = {
      joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field),
      groupby: groupby
    };
    var filteredWhiskerSpec = undefined;

    if (boxPlotType === 'tukey') {
      filteredWhiskerSpec = {
        transform: [{
          filter: "(".concat(lowerWhiskerExpr, " <= ").concat(fieldExpr, ") && (").concat(fieldExpr, " <= ").concat(upperWhiskerExpr, ")")
        }, {
          aggregate: [{
            op: 'min',
            field: continuousAxisChannelDef.field,
            as: 'lower_whisker_' + continuousAxisChannelDef.field
          }, {
            op: 'max',
            field: continuousAxisChannelDef.field,
            as: 'upper_whisker_' + continuousAxisChannelDef.field
          }, // preserve lower_box / upper_box
          {
            op: 'min',
            field: 'lower_box_' + continuousAxisChannelDef.field,
            as: 'lower_box_' + continuousAxisChannelDef.field
          }, {
            op: 'max',
            field: 'upper_box_' + continuousAxisChannelDef.field,
            as: 'upper_box_' + continuousAxisChannelDef.field
          }].concat(_toConsumableArray(aggregate)),
          groupby: groupby
        }],
        layer: whiskerLayers
      };
    }

    var tooltip = encodingWithoutSizeColorAndContinuousAxis.tooltip,
        encodingWithoutSizeColorContinuousAxisAndTooltip = __rest(encodingWithoutSizeColorAndContinuousAxis, ["tooltip"]);

    var scale = continuousAxisChannelDef.scale,
        axis = continuousAxisChannelDef.axis;
    var title = getTitle(continuousAxisChannelDef);
    var outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, {
      transform: [{
        filter: "(".concat(fieldExpr, " < ").concat(lowerWhiskerExpr, ") || (").concat(fieldExpr, " > ").concat(upperWhiskerExpr, ")")
      }],
      mark: 'point',
      encoding: Object.assign(Object.assign(_defineProperty({}, continuousAxis, Object.assign(Object.assign(Object.assign({
        field: continuousAxisChannelDef.field,
        type: continuousAxisChannelDef.type
      }, title !== undefined ? {
        title: title
      } : {}), scale !== undefined ? {
        scale: scale
      } : {}), axis !== undefined ? {
        axis: axis
      } : {})), encodingWithoutSizeColorContinuousAxisAndTooltip), customTooltipWithoutAggregatedField ? {
        tooltip: customTooltipWithoutAggregatedField
      } : {})
    })[0];

    if (outlierLayersMixins && filteredWhiskerSpec) {
      filteredLayersMixins = {
        transform: [joinaggregateTransform],
        layer: [outlierLayersMixins, filteredWhiskerSpec]
      };
    } else if (outlierLayersMixins) {
      filteredLayersMixins = outlierLayersMixins;
      filteredLayersMixins.transform.unshift(joinaggregateTransform);
    } else if (filteredWhiskerSpec) {
      filteredLayersMixins = filteredWhiskerSpec;
      filteredLayersMixins.transform.unshift(joinaggregateTransform);
    }
  }

  if (filteredLayersMixins) {
    // tukey box plot with outliers included
    return Object.assign(Object.assign({}, outerSpec), {
      layer: [filteredLayersMixins, {
        // boxplot
        transform: transform,
        layer: boxLayers
      }]
    });
  }

  return Object.assign(Object.assign({}, outerSpec), {
    transform: ((_b = outerSpec.transform) !== null && _b !== void 0 ? _b : []).concat(transform),
    layer: boxLayers
  });
}

function boxParamsQuartiles(continousAxisField) {
  return [{
    op: 'q1',
    field: continousAxisField,
    as: 'lower_box_' + continousAxisField
  }, {
    op: 'q3',
    field: continousAxisField,
    as: 'upper_box_' + continousAxisField
  }];
}

function boxParams(spec, extent, config) {
  var orient = compositeMarkOrient(spec, BOXPLOT);

  var _compositeMarkContinu = compositeMarkContinuousAxis(spec, orient, BOXPLOT),
      continuousAxisChannelDef = _compositeMarkContinu.continuousAxisChannelDef,
      continuousAxis = _compositeMarkContinu.continuousAxis;

  var continuousFieldName = continuousAxisChannelDef.field;
  var boxPlotType = getBoxPlotType(extent);
  var boxplotSpecificAggregate = [].concat(_toConsumableArray(boxParamsQuartiles(continuousFieldName)), [{
    op: 'median',
    field: continuousFieldName,
    as: 'mid_box_' + continuousFieldName
  }, {
    op: 'min',
    field: continuousFieldName,
    as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName
  }, {
    op: 'max',
    field: continuousFieldName,
    as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName
  }]);
  var postAggregateCalculates = boxPlotType === 'min-max' || boxPlotType === 'tukey' ? [] : [// This is for the  original k-IQR, which we do not expose
  {
    calculate: "datum[\"upper_box_".concat(continuousFieldName, "\"] - datum[\"lower_box_").concat(continuousFieldName, "\"]"),
    as: 'iqr_' + continuousFieldName
  }, {
    calculate: "min(datum[\"upper_box_".concat(continuousFieldName, "\"] + datum[\"iqr_").concat(continuousFieldName, "\"] * ").concat(extent, ", datum[\"max_").concat(continuousFieldName, "\"])"),
    as: 'upper_whisker_' + continuousFieldName
  }, {
    calculate: "max(datum[\"lower_box_".concat(continuousFieldName, "\"] - datum[\"iqr_").concat(continuousFieldName, "\"] * ").concat(extent, ", datum[\"min_").concat(continuousFieldName, "\"])"),
    as: 'lower_whisker_' + continuousFieldName
  }];

  var _a = spec.encoding,
      _b = continuousAxis,
      oldContinuousAxisChannelDef = _a[_b],
      oldEncodingWithoutContinuousAxis = __rest(_a, [_typeof(_b) === "symbol" ? _b : _b + ""]);

  var _filterTooltipWithAgg = filterTooltipWithAggregatedField(oldEncodingWithoutContinuousAxis),
      customTooltipWithoutAggregatedField = _filterTooltipWithAgg.customTooltipWithoutAggregatedField,
      filteredEncoding = _filterTooltipWithAgg.filteredEncoding;

  var _extractTransformsFro = extractTransformsFromEncoding(filteredEncoding, config),
      bins = _extractTransformsFro.bins,
      timeUnits = _extractTransformsFro.timeUnits,
      aggregate = _extractTransformsFro.aggregate,
      groupby = _extractTransformsFro.groupby,
      encodingWithoutContinuousAxis = _extractTransformsFro.encoding;

  var ticksOrient = orient === 'vertical' ? 'horizontal' : 'vertical';
  var boxOrient = orient;
  var transform = [].concat(_toConsumableArray(bins), _toConsumableArray(timeUnits), [{
    aggregate: [].concat(_toConsumableArray(aggregate), _toConsumableArray(boxplotSpecificAggregate)),
    groupby: groupby
  }], postAggregateCalculates);
  return {
    transform: transform,
    groupby: groupby,
    aggregate: aggregate,
    continuousAxisChannelDef: continuousAxisChannelDef,
    continuousAxis: continuousAxis,
    encodingWithoutContinuousAxis: encodingWithoutContinuousAxis,
    ticksOrient: ticksOrient,
    boxOrient: boxOrient,
    customTooltipWithoutAggregatedField: customTooltipWithoutAggregatedField
  };
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compositemark/errorbar.js













var ERRORBAR = 'errorbar';
var ERRORBAR_PART_INDEX = {
  ticks: 1,
  rule: 1
};
var ERRORBAR_PARTS = util_keys(ERRORBAR_PART_INDEX);
var errorBarNormalizer = new base_CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar);
function normalizeErrorBar(spec, _ref) {
  var config = _ref.config;

  var _errorBarParams = errorBarParams(spec, ERRORBAR, config),
      transform = _errorBarParams.transform,
      continuousAxisChannelDef = _errorBarParams.continuousAxisChannelDef,
      continuousAxis = _errorBarParams.continuousAxis,
      encodingWithoutContinuousAxis = _errorBarParams.encodingWithoutContinuousAxis,
      ticksOrient = _errorBarParams.ticksOrient,
      markDef = _errorBarParams.markDef,
      outerSpec = _errorBarParams.outerSpec,
      tooltipEncoding = _errorBarParams.tooltipEncoding;

  var makeErrorBarPart = makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorbar);
  var tick = {
    type: 'tick',
    orient: ticksOrient
  };
  var layer = [].concat(_toConsumableArray(makeErrorBarPart({
    partName: 'ticks',
    mark: tick,
    positionPrefix: 'lower',
    extraEncoding: tooltipEncoding
  })), _toConsumableArray(makeErrorBarPart({
    partName: 'ticks',
    mark: tick,
    positionPrefix: 'upper',
    extraEncoding: tooltipEncoding
  })), _toConsumableArray(makeErrorBarPart({
    partName: 'rule',
    mark: 'rule',
    positionPrefix: 'lower',
    endPositionPrefix: 'upper',
    extraEncoding: tooltipEncoding
  })));
  return Object.assign(Object.assign(Object.assign({}, outerSpec), {
    transform: transform
  }), layer.length > 1 ? {
    layer: layer
  } : Object.assign({}, layer[0]));
}

function errorBarOrientAndInputType(spec, compositeMark) {
  var encoding = spec.encoding;

  if (errorBarIsInputTypeRaw(encoding)) {
    return {
      orient: compositeMarkOrient(spec, compositeMark),
      inputType: 'raw'
    };
  }

  var isTypeAggregatedUpperLower = errorBarIsInputTypeAggregatedUpperLower(encoding);
  var isTypeAggregatedError = errorBarIsInputTypeAggregatedError(encoding);
  var x = encoding.x;
  var y = encoding.y;

  if (isTypeAggregatedUpperLower) {
    // type is aggregated-upper-lower
    if (isTypeAggregatedError) {
      throw new Error("".concat(compositeMark, " cannot be both type aggregated-upper-lower and aggregated-error"));
    }

    var x2 = encoding.x2;
    var y2 = encoding.y2;

    if (isFieldDef(x2) && isFieldDef(y2)) {
      // having both x, x2 and y, y2
      throw new Error("".concat(compositeMark, " cannot have both x2 and y2"));
    } else if (isFieldDef(x2)) {
      if (isFieldDef(x) && channeldef_isContinuous(x)) {
        // having x, x2 quantitative and field y, y2 are not specified
        return {
          orient: 'horizontal',
          inputType: 'aggregated-upper-lower'
        };
      } else {
        // having x, x2 that are not both quantitative
        throw new Error("Both x and x2 have to be quantitative in ".concat(compositeMark));
      }
    } else if (isFieldDef(y2)) {
      // y2 is a FieldDef
      if (isFieldDef(y) && channeldef_isContinuous(y)) {
        // having y, y2 quantitative and field x, x2 are not specified
        return {
          orient: 'vertical',
          inputType: 'aggregated-upper-lower'
        };
      } else {
        // having y, y2 that are not both quantitative
        throw new Error("Both y and y2 have to be quantitative in ".concat(compositeMark));
      }
    }

    throw new Error('No ranged axis');
  } else {
    // type is aggregated-error
    var xError = encoding.xError;
    var xError2 = encoding.xError2;
    var yError = encoding.yError;
    var yError2 = encoding.yError2;

    if (isFieldDef(xError2) && !isFieldDef(xError)) {
      // having xError2 without xError
      throw new Error("".concat(compositeMark, " cannot have xError2 without xError"));
    }

    if (isFieldDef(yError2) && !isFieldDef(yError)) {
      // having yError2 without yError
      throw new Error("".concat(compositeMark, " cannot have yError2 without yError"));
    }

    if (isFieldDef(xError) && isFieldDef(yError)) {
      // having both xError and yError
      throw new Error("".concat(compositeMark, " cannot have both xError and yError with both are quantiative"));
    } else if (isFieldDef(xError)) {
      if (isFieldDef(x) && channeldef_isContinuous(x)) {
        // having x and xError that are all quantitative
        return {
          orient: 'horizontal',
          inputType: 'aggregated-error'
        };
      } else {
        // having x, xError, and xError2 that are not all quantitative
        throw new Error('All x, xError, and xError2 (if exist) have to be quantitative');
      }
    } else if (isFieldDef(yError)) {
      if (isFieldDef(y) && channeldef_isContinuous(y)) {
        // having y and yError that are all quantitative
        return {
          orient: 'vertical',
          inputType: 'aggregated-error'
        };
      } else {
        // having y, yError, and yError2 that are not all quantitative
        throw new Error('All y, yError, and yError2 (if exist) have to be quantitative');
      }
    }

    throw new Error('No ranged axis');
  }
}

function errorBarIsInputTypeRaw(encoding) {
  return (isFieldDef(encoding.x) || isFieldDef(encoding.y)) && !isFieldDef(encoding.x2) && !isFieldDef(encoding.y2) && !isFieldDef(encoding.xError) && !isFieldDef(encoding.xError2) && !isFieldDef(encoding.yError) && !isFieldDef(encoding.yError2);
}

function errorBarIsInputTypeAggregatedUpperLower(encoding) {
  return isFieldDef(encoding.x2) || isFieldDef(encoding.y2);
}

function errorBarIsInputTypeAggregatedError(encoding) {
  return isFieldDef(encoding.xError) || isFieldDef(encoding.xError2) || isFieldDef(encoding.yError) || isFieldDef(encoding.yError2);
}

function errorBarParams(spec, compositeMark, config) {
  var _a; // TODO: use selection


  var mark = spec.mark,
      encoding = spec.encoding,
      selection = spec.selection,
      _p = spec.projection,
      outerSpec = __rest(spec, ["mark", "encoding", "selection", "projection"]);

  var markDef = isMarkDef(mark) ? mark : {
    type: mark
  }; // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support

  if (selection) {
    log_warn(message.selectionNotSupported(compositeMark));
  }

  var _errorBarOrientAndInp = errorBarOrientAndInputType(spec, compositeMark),
      orient = _errorBarOrientAndInp.orient,
      inputType = _errorBarOrientAndInp.inputType;

  var _compositeMarkContinu = compositeMarkContinuousAxis(spec, orient, compositeMark),
      continuousAxisChannelDef = _compositeMarkContinu.continuousAxisChannelDef,
      continuousAxisChannelDef2 = _compositeMarkContinu.continuousAxisChannelDef2,
      continuousAxisChannelDefError = _compositeMarkContinu.continuousAxisChannelDefError,
      continuousAxisChannelDefError2 = _compositeMarkContinu.continuousAxisChannelDefError2,
      continuousAxis = _compositeMarkContinu.continuousAxis;

  var _errorBarAggregationA = errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config),
      errorBarSpecificAggregate = _errorBarAggregationA.errorBarSpecificAggregate,
      postAggregateCalculates = _errorBarAggregationA.postAggregateCalculates,
      tooltipSummary = _errorBarAggregationA.tooltipSummary,
      tooltipTitleWithFieldName = _errorBarAggregationA.tooltipTitleWithFieldName;

  var _b = encoding,
      _c = continuousAxis,
      oldContinuousAxisChannelDef = _b[_c],
      _d = continuousAxis === 'x' ? 'x2' : 'y2',
      oldContinuousAxisChannelDef2 = _b[_d],
      _e = continuousAxis === 'x' ? 'xError' : 'yError',
      oldContinuousAxisChannelDefError = _b[_e],
      _f = continuousAxis === 'x' ? 'xError2' : 'yError2',
      oldContinuousAxisChannelDefError2 = _b[_f],
      oldEncodingWithoutContinuousAxis = __rest(_b, [_typeof(_c) === "symbol" ? _c : _c + "", _typeof(_d) === "symbol" ? _d : _d + "", _typeof(_e) === "symbol" ? _e : _e + "", _typeof(_f) === "symbol" ? _f : _f + ""]);

  var _extractTransformsFro = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config),
      bins = _extractTransformsFro.bins,
      timeUnits = _extractTransformsFro.timeUnits,
      oldAggregate = _extractTransformsFro.aggregate,
      oldGroupBy = _extractTransformsFro.groupby,
      encodingWithoutContinuousAxis = _extractTransformsFro.encoding;

  var aggregate = [].concat(_toConsumableArray(oldAggregate), _toConsumableArray(errorBarSpecificAggregate));
  var groupby = inputType !== 'raw' ? [] : oldGroupBy;
  var tooltipEncoding = getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, tooltipTitleWithFieldName);
  return {
    transform: [].concat(_toConsumableArray((_a = outerSpec.transform) !== null && _a !== void 0 ? _a : []), _toConsumableArray(bins), _toConsumableArray(timeUnits), _toConsumableArray(aggregate.length === 0 ? [] : [{
      aggregate: aggregate,
      groupby: groupby
    }]), _toConsumableArray(postAggregateCalculates)),
    groupby: groupby,
    continuousAxisChannelDef: continuousAxisChannelDef,
    continuousAxis: continuousAxis,
    encodingWithoutContinuousAxis: encodingWithoutContinuousAxis,
    ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical',
    markDef: markDef,
    outerSpec: outerSpec,
    tooltipEncoding: tooltipEncoding
  };
}

function errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config) {
  var errorBarSpecificAggregate = [];
  var postAggregateCalculates = [];
  var continuousFieldName = continuousAxisChannelDef.field;
  var tooltipSummary;
  var tooltipTitleWithFieldName = false;

  if (inputType === 'raw') {
    var center = markDef.center ? markDef.center : markDef.extent ? markDef.extent === 'iqr' ? 'median' : 'mean' : config.errorbar.center;
    var extent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr';

    if (center === 'median' !== (extent === 'iqr')) {
      log_warn(message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark));
    }

    if (extent === 'stderr' || extent === 'stdev') {
      errorBarSpecificAggregate = [{
        op: extent,
        field: continuousFieldName,
        as: 'extent_' + continuousFieldName
      }, {
        op: center,
        field: continuousFieldName,
        as: 'center_' + continuousFieldName
      }];
      postAggregateCalculates = [{
        calculate: "datum[\"center_".concat(continuousFieldName, "\"] + datum[\"extent_").concat(continuousFieldName, "\"]"),
        as: 'upper_' + continuousFieldName
      }, {
        calculate: "datum[\"center_".concat(continuousFieldName, "\"] - datum[\"extent_").concat(continuousFieldName, "\"]"),
        as: 'lower_' + continuousFieldName
      }];
      tooltipSummary = [{
        fieldPrefix: 'center_',
        titlePrefix: titlecase(center)
      }, {
        fieldPrefix: 'upper_',
        titlePrefix: getTitlePrefix(center, extent, '+')
      }, {
        fieldPrefix: 'lower_',
        titlePrefix: getTitlePrefix(center, extent, '-')
      }];
      tooltipTitleWithFieldName = true;
    } else {
      if (markDef.center && markDef.extent) {
        log_warn(message.errorBarCenterIsNotNeeded(markDef.extent, compositeMark));
      }

      var centerOp;
      var lowerExtentOp;
      var upperExtentOp;

      if (extent === 'ci') {
        centerOp = 'mean';
        lowerExtentOp = 'ci0';
        upperExtentOp = 'ci1';
      } else {
        centerOp = 'median';
        lowerExtentOp = 'q1';
        upperExtentOp = 'q3';
      }

      errorBarSpecificAggregate = [{
        op: lowerExtentOp,
        field: continuousFieldName,
        as: 'lower_' + continuousFieldName
      }, {
        op: upperExtentOp,
        field: continuousFieldName,
        as: 'upper_' + continuousFieldName
      }, {
        op: centerOp,
        field: continuousFieldName,
        as: 'center_' + continuousFieldName
      }];
      tooltipSummary = [{
        fieldPrefix: 'upper_',
        titlePrefix: channeldef_title({
          field: continuousFieldName,
          aggregate: upperExtentOp,
          type: 'quantitative'
        }, config, {
          allowDisabling: false
        })
      }, {
        fieldPrefix: 'lower_',
        titlePrefix: channeldef_title({
          field: continuousFieldName,
          aggregate: lowerExtentOp,
          type: 'quantitative'
        }, config, {
          allowDisabling: false
        })
      }, {
        fieldPrefix: 'center_',
        titlePrefix: channeldef_title({
          field: continuousFieldName,
          aggregate: centerOp,
          type: 'quantitative'
        }, config, {
          allowDisabling: false
        })
      }];
    }
  } else {
    if (markDef.center || markDef.extent) {
      log_warn(message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent));
    }

    if (inputType === 'aggregated-upper-lower') {
      tooltipSummary = [];
      postAggregateCalculates = [{
        calculate: "datum[\"".concat(continuousAxisChannelDef2.field, "\"]"),
        as: 'upper_' + continuousFieldName
      }, {
        calculate: "datum[\"".concat(continuousFieldName, "\"]"),
        as: 'lower_' + continuousFieldName
      }];
    } else if (inputType === 'aggregated-error') {
      tooltipSummary = [{
        fieldPrefix: '',
        titlePrefix: continuousFieldName
      }];
      postAggregateCalculates = [{
        calculate: "datum[\"".concat(continuousFieldName, "\"] + datum[\"").concat(continuousAxisChannelDefError.field, "\"]"),
        as: 'upper_' + continuousFieldName
      }];

      if (continuousAxisChannelDefError2) {
        postAggregateCalculates.push({
          calculate: "datum[\"".concat(continuousFieldName, "\"] + datum[\"").concat(continuousAxisChannelDefError2.field, "\"]"),
          as: 'lower_' + continuousFieldName
        });
      } else {
        postAggregateCalculates.push({
          calculate: "datum[\"".concat(continuousFieldName, "\"] - datum[\"").concat(continuousAxisChannelDefError.field, "\"]"),
          as: 'lower_' + continuousFieldName
        });
      }
    }

    var _iterator = _createForOfIteratorHelper(postAggregateCalculates),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var postAggregateCalculate = _step.value;
        tooltipSummary.push({
          fieldPrefix: postAggregateCalculate.as.substring(0, 6),
          titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum["', ''), '"]', '')
        });
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
  }

  return {
    postAggregateCalculates: postAggregateCalculates,
    errorBarSpecificAggregate: errorBarSpecificAggregate,
    tooltipSummary: tooltipSummary,
    tooltipTitleWithFieldName: tooltipTitleWithFieldName
  };
}

function getTitlePrefix(center, extent, operation) {
  return titlecase(center) + ' ' + operation + ' ' + extent;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compositemark/errorband.js








var ERRORBAND = 'errorband';
var ERRORBAND_PART_INDEX = {
  band: 1,
  borders: 1
};
var ERRORBAND_PARTS = util_keys(ERRORBAND_PART_INDEX);
var errorBandNormalizer = new base_CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand);
function normalizeErrorBand(spec, _ref) {
  var config = _ref.config;

  var _errorBarParams = errorBarParams(spec, ERRORBAND, config),
      transform = _errorBarParams.transform,
      continuousAxisChannelDef = _errorBarParams.continuousAxisChannelDef,
      continuousAxis = _errorBarParams.continuousAxis,
      encodingWithoutContinuousAxis = _errorBarParams.encodingWithoutContinuousAxis,
      markDef = _errorBarParams.markDef,
      outerSpec = _errorBarParams.outerSpec,
      tooltipEncoding = _errorBarParams.tooltipEncoding;

  var errorBandDef = markDef;
  var makeErrorBandPart = makeCompositeAggregatePartFactory(errorBandDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorband);
  var is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined;
  var bandMark = {
    type: is2D ? 'area' : 'rect'
  };
  var bordersMark = {
    type: is2D ? 'line' : 'rule'
  };
  var interpolate = Object.assign(Object.assign({}, errorBandDef.interpolate ? {
    interpolate: errorBandDef.interpolate
  } : {}), errorBandDef.tension && errorBandDef.interpolate ? {
    tension: errorBandDef.tension
  } : {});

  if (is2D) {
    bandMark = Object.assign(Object.assign({}, bandMark), interpolate);
    bordersMark = Object.assign(Object.assign({}, bordersMark), interpolate);
  } else if (errorBandDef.interpolate) {
    log_warn(message.errorBand1DNotSupport('interpolate'));
  } else if (errorBandDef.tension) {
    log_warn(message.errorBand1DNotSupport('tension'));
  }

  return Object.assign(Object.assign({}, outerSpec), {
    transform: transform,
    layer: [].concat(_toConsumableArray(makeErrorBandPart({
      partName: 'band',
      mark: bandMark,
      positionPrefix: 'lower',
      endPositionPrefix: 'upper',
      extraEncoding: tooltipEncoding
    })), _toConsumableArray(makeErrorBandPart({
      partName: 'borders',
      mark: bordersMark,
      positionPrefix: 'lower',
      extraEncoding: tooltipEncoding
    })), _toConsumableArray(makeErrorBandPart({
      partName: 'borders',
      mark: bordersMark,
      positionPrefix: 'upper',
      extraEncoding: tooltipEncoding
    })))
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compositemark/index.js





/**
 * Registry index for all composite mark's normalizer
 */

var compositeMarkRegistry = {};
function compositemark_add(mark, run, parts) {
  var normalizer = new base_CompositeMarkNormalizer(mark, run);
  compositeMarkRegistry[mark] = {
    normalizer: normalizer,
    parts: parts
  };
}
function compositemark_remove(mark) {
  delete compositeMarkRegistry[mark];
}
function getAllCompositeMarks() {
  return util_keys(compositeMarkRegistry);
}
compositemark_add(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS);
compositemark_add(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS);
compositemark_add(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/guide.js
var VL_ONLY_LEGEND_CONFIG = ['gradientHorizontalMaxLength', 'gradientHorizontalMinLength', 'gradientVerticalMaxLength', 'gradientVerticalMinLength', 'unselectedOpacity'];
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/legend.js

var LEGEND_SCALE_CHANNELS_INDEX = {
  size: 1,
  shape: 1,
  fill: 1,
  stroke: 1,
  strokeDash: 1,
  strokeWidth: 1,
  opacity: 1
};
var LEGEND_SCALE_CHANNELS = util_keys(LEGEND_SCALE_CHANNELS_INDEX);
var SIGNAL_LEGEND_PROP_INDEX = {
  fillColor: {
    part: 'legend',
    vgProp: 'fill'
  },
  gradientStrokeColor: {
    part: 'gradient',
    vgProp: 'stroke'
  },
  labelColor: {
    part: 'labels',
    vgProp: 'fill'
  },
  strokeColor: {
    part: 'legend',
    vgProp: 'stroke'
  },
  symbolFillColor: {
    part: 'symbols',
    vgProp: 'fill'
  },
  symbolStrokeColor: {
    part: 'symbols',
    vgProp: 'stroke'
  },
  titleColor: {
    part: 'title',
    vgProp: 'fill'
  }
};
var defaultLegendConfig = {
  gradientHorizontalMaxLength: 200,
  gradientHorizontalMinLength: 100,
  gradientVerticalMaxLength: 200,
  gradientVerticalMinLength: 64,
  unselectedOpacity: 0.35
};
var COMMON_LEGEND_PROPERTY_INDEX = {
  clipHeight: 1,
  columnPadding: 1,
  columns: 1,
  cornerRadius: 1,
  direction: 1,
  fillColor: 1,
  format: 1,
  formatType: 1,
  gradientLength: 1,
  gradientOpacity: 1,
  gradientStrokeColor: 1,
  gradientStrokeWidth: 1,
  gradientThickness: 1,
  gridAlign: 1,
  labelAlign: 1,
  labelBaseline: 1,
  labelColor: 1,
  labelFont: 1,
  labelFontSize: 1,
  labelFontStyle: 1,
  labelFontWeight: 1,
  labelLimit: 1,
  labelOffset: 1,
  labelOpacity: 1,
  labelOverlap: 1,
  labelPadding: 1,
  labelSeparation: 1,
  legendX: 1,
  legendY: 1,
  offset: 1,
  orient: 1,
  padding: 1,
  rowPadding: 1,
  strokeColor: 1,
  symbolDash: 1,
  symbolDashOffset: 1,
  symbolFillColor: 1,
  symbolLimit: 1,
  symbolOffset: 1,
  symbolOpacity: 1,
  symbolSize: 1,
  symbolStrokeColor: 1,
  symbolStrokeWidth: 1,
  symbolType: 1,
  tickCount: 1,
  tickMinStep: 1,
  title: 1,
  titleAlign: 1,
  titleAnchor: 1,
  titleBaseline: 1,
  titleColor: 1,
  titleFont: 1,
  titleFontSize: 1,
  titleFontStyle: 1,
  titleFontWeight: 1,
  titleLimit: 1,
  titleLineHeight: 1,
  titleOpacity: 1,
  titleOrient: 1,
  titlePadding: 1,
  type: 1,
  values: 1,
  zindex: 1
};
var LEGEND_PROPERTIES = util_keys(COMMON_LEGEND_PROPERTY_INDEX);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/selection.js

var selection_SELECTION_ID = '_vgsid_';
var defaultConfig = {
  single: {
    on: 'click',
    fields: [selection_SELECTION_ID],
    resolve: 'global',
    empty: 'all',
    clear: 'dblclick'
  },
  multi: {
    on: 'click',
    fields: [selection_SELECTION_ID],
    toggle: 'event.shiftKey',
    resolve: 'global',
    empty: 'all',
    clear: 'dblclick'
  },
  interval: {
    on: '[mousedown, window:mouseup] > window:mousemove!',
    encodings: ['x', 'y'],
    translate: '[mousedown, window:mouseup] > window:mousemove!',
    zoom: 'wheel!',
    mark: {
      fill: '#333',
      fillOpacity: 0.125,
      stroke: 'white'
    },
    resolve: 'global',
    clear: 'dblclick'
  }
};
function isLegendBinding(bind) {
  return !!bind && (bind === 'legend' || !!bind.legend);
}
function isLegendStreamBinding(bind) {
  return isLegendBinding(bind) && isObject(bind);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/spec/concat.js

function isAnyConcatSpec(spec) {
  return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec);
}
function isConcatSpec(spec) {
  return 'concat' in spec;
}
function isVConcatSpec(spec) {
  return 'vconcat' in spec;
}
function isHConcatSpec(spec) {
  return 'hconcat' in spec;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/spec/base.js





function isStep(size) {
  return isObject(size) && size['step'] !== undefined;
}
function isFrameMixins(o) {
  return o['view'] || o['width'] || o['height'];
}
var DEFAULT_SPACING = 20;
var COMPOSITION_LAYOUT_INDEX = {
  align: 1,
  bounds: 1,
  center: 1,
  columns: 1,
  spacing: 1
};
var COMPOSITION_LAYOUT_PROPERTIES = util_keys(COMPOSITION_LAYOUT_INDEX);
function extractCompositionLayout(spec, specType, config) {
  var _a, _b;

  var compositionConfig = config[specType];
  var layout = {}; // Apply config first

  var spacingConfig = compositionConfig.spacing,
      columns = compositionConfig.columns;

  if (spacingConfig !== undefined) {
    layout.spacing = spacingConfig;
  }

  if (columns !== undefined) {
    if (isFacetSpec(spec) && !isFacetMapping(spec.facet) || isConcatSpec(spec)) {
      layout.columns = columns;
    }
  }

  if (isVConcatSpec(spec)) {
    layout.columns = 1;
  } // Then copy properties from the spec


  var _iterator = _createForOfIteratorHelper(COMPOSITION_LAYOUT_PROPERTIES),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var prop = _step.value;

      if (spec[prop] !== undefined) {
        if (prop === 'spacing') {
          var spacing = spec[prop];
          layout[prop] = isNumber(spacing) ? spacing : {
            row: (_a = spacing.row) !== null && _a !== void 0 ? _a : spacingConfig,
            column: (_b = spacing.column) !== null && _b !== void 0 ? _b : spacingConfig
          };
        } else {
          layout[prop] = spec[prop];
        }
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return layout;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/config.js


















function getViewConfigContinuousSize(viewConfig, channel) {
  var _a;

  return (_a = viewConfig[channel]) !== null && _a !== void 0 ? _a : viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility
}
function getViewConfigDiscreteStep(viewConfig, channel) {
  var size = getViewConfigDiscreteSize(viewConfig, channel);
  return isStep(size) ? size.step : DEFAULT_STEP;
}
function getViewConfigDiscreteSize(viewConfig, channel) {
  var _a;

  var size = (_a = viewConfig[channel]) !== null && _a !== void 0 ? _a : viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility

  return getFirstDefined(size, {
    step: viewConfig.step
  });
}
var DEFAULT_STEP = 20;
var defaultViewConfig = {
  continuousWidth: 200,
  continuousHeight: 200,
  step: DEFAULT_STEP
};
function isVgScheme(rangeScheme) {
  return rangeScheme && !!rangeScheme['scheme'];
}
var config_defaultConfig = {
  background: 'white',
  padding: 5,
  timeFormat: '%b %d, %Y',
  countTitle: 'Count of Records',
  view: defaultViewConfig,
  mark: defaultMarkConfig,
  area: {},
  bar: defaultBarConfig,
  circle: {},
  geoshape: {},
  image: {},
  line: {},
  point: {},
  rect: defaultRectConfig,
  rule: {
    color: 'black'
  },
  square: {},
  text: {
    color: 'black'
  },
  tick: defaultTickConfig,
  trail: {},
  boxplot: {
    size: 14,
    extent: 1.5,
    box: {},
    median: {
      color: 'white'
    },
    outliers: {},
    rule: {},
    ticks: null
  },
  errorbar: {
    center: 'mean',
    rule: true,
    ticks: false
  },
  errorband: {
    band: {
      opacity: 0.3
    },
    borders: false
  },
  scale: defaultScaleConfig,
  projection: {},
  axis: {},
  axisX: {},
  axisY: {},
  axisLeft: {},
  axisRight: {},
  axisTop: {},
  axisBottom: {},
  axisBand: {},
  legend: defaultLegendConfig,
  header: {
    titlePadding: 10,
    labelPadding: 10
  },
  headerColumn: {},
  headerRow: {},
  headerFacet: {},
  selection: defaultConfig,
  style: {},
  title: {},
  facet: {
    spacing: DEFAULT_SPACING
  },
  concat: {
    spacing: DEFAULT_SPACING
  }
};
var tab10 = schemes_scheme('tableau10');
var DEFAULT_FONT_SIZE = {
  text: 11,
  guideLabel: 10,
  guideTitle: 11,
  groupTitle: 13,
  groupSubtitle: 12
};
var DEFAULT_COLOR = {
  blue: tab10[0],
  orange: tab10[1],
  red: tab10[2],
  teal: tab10[3],
  green: tab10[4],
  yellow: tab10[5],
  purple: tab10[6],
  pink: tab10[7],
  brown: tab10[8],
  gray0: '#000',
  gray1: '#111',
  gray2: '#222',
  gray3: '#333',
  gray4: '#444',
  gray5: '#555',
  gray6: '#666',
  gray7: '#777',
  gray8: '#888',
  gray9: '#999',
  gray10: '#aaa',
  gray11: '#bbb',
  gray12: '#ccc',
  gray13: '#ddd',
  gray14: '#eee',
  gray15: '#fff'
};
function colorSignalConfig() {
  var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  return {
    signals: [{
      name: 'color',
      value: isObject(color) ? Object.assign(Object.assign({}, DEFAULT_COLOR), color) : DEFAULT_COLOR
    }],
    mark: {
      color: {
        signal: 'color.blue'
      }
    },
    rule: {
      color: {
        signal: 'color.gray0'
      }
    },
    text: {
      color: {
        signal: 'color.gray0'
      }
    },
    style: {
      'guide-label': {
        fill: {
          signal: 'color.gray0'
        }
      },
      'guide-title': {
        fill: {
          signal: 'color.gray0'
        }
      },
      'group-title': {
        fill: {
          signal: 'color.gray0'
        }
      },
      'group-subtitle': {
        fill: {
          signal: 'color.gray0'
        }
      },
      cell: {
        stroke: {
          signal: 'color.gray8'
        }
      }
    },
    axis: {
      domainColor: {
        signal: 'color.gray13'
      },
      gridColor: {
        signal: 'color.gray8'
      },
      tickColor: {
        signal: 'color.gray13'
      }
    },
    range: {
      category: [{
        signal: 'color.blue'
      }, {
        signal: 'color.orange'
      }, {
        signal: 'color.red'
      }, {
        signal: 'color.teal'
      }, {
        signal: 'color.green'
      }, {
        signal: 'color.yellow'
      }, {
        signal: 'color.purple'
      }, {
        signal: 'color.pink'
      }, {
        signal: 'color.brown'
      }, {
        signal: 'color.grey8'
      }]
    }
  };
}
function fontSizeSignalConfig(fontSize) {
  return {
    signals: [{
      name: 'fontSize',
      value: isObject(fontSize) ? Object.assign(Object.assign({}, DEFAULT_FONT_SIZE), fontSize) : DEFAULT_FONT_SIZE
    }],
    text: {
      fontSize: {
        signal: 'fontSize.text'
      }
    },
    style: {
      'guide-label': {
        fontSize: {
          signal: 'fontSize.guideLabel'
        }
      },
      'guide-title': {
        fontSize: {
          signal: 'fontSize.guideTitle'
        }
      },
      'group-title': {
        fontSize: {
          signal: 'fontSize.groupTitle'
        }
      },
      'group-subtitle': {
        fontSize: {
          signal: 'fontSize.groupSubtitle'
        }
      }
    }
  };
}
function fontConfig(font) {
  return {
    text: {
      font: font
    },
    style: {
      'guide-label': {
        font: font
      },
      'guide-title': {
        font: font
      },
      'group-title': {
        font: font
      },
      'group-subtitle': {
        font: font
      }
    }
  };
}
function initConfig() {
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

  var color = config.color,
      font = config.font,
      fontSize = config.fontSize,
      restConfig = __rest(config, ["color", "font", "fontSize"]);

  return mergeConfig({}, config_defaultConfig, font ? fontConfig(font) : {}, color ? colorSignalConfig(color) : {}, fontSize ? fontSizeSignalConfig(fontSize) : {}, restConfig || {});
}
var MARK_STYLES = ['view'].concat(_toConsumableArray(PRIMITIVE_MARKS));
var VL_ONLY_CONFIG_PROPERTIES = ['color', 'fontSize', 'background', 'padding', 'facet', 'concat', 'numberFormat', 'timeFormat', 'countTitle', 'header', 'axisQuantitative', 'axisTemporal', 'scale', 'selection', 'overlay' // FIXME: Redesign and unhide this
];
var VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = Object.assign({
  view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step']
}, VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX);
function stripAndRedirectConfig(config) {
  config = duplicate(config);

  var _iterator = _createForOfIteratorHelper(VL_ONLY_CONFIG_PROPERTIES),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var _prop4 = _step.value;
      delete config[_prop4];
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  if (config.axis) {
    // delete condition axis config
    for (var prop in config.axis) {
      if (isConditionalAxisValue(config.axis[prop])) {
        delete config.axis[prop];
      }
    }
  }

  if (config.legend) {
    var _iterator2 = _createForOfIteratorHelper(VL_ONLY_LEGEND_CONFIG),
        _step2;

    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _prop = _step2.value;
        delete config.legend[_prop];
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
  } // Remove Vega-Lite only generic mark config


  if (config.mark) {
    var _iterator3 = _createForOfIteratorHelper(VL_ONLY_MARK_CONFIG_PROPERTIES),
        _step3;

    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var _prop2 = _step3.value;
        delete config.mark[_prop2];
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }
  }

  var _iterator4 = _createForOfIteratorHelper(MARK_STYLES),
      _step4;

  try {
    for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
      var markType = _step4.value;

      // Remove Vega-Lite-only mark config
      var _iterator6 = _createForOfIteratorHelper(VL_ONLY_MARK_CONFIG_PROPERTIES),
          _step6;

      try {
        for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
          var _prop6 = _step6.value;
          delete config[markType][_prop6];
        } // Remove Vega-Lite only mark-specific config

      } catch (err) {
        _iterator6.e(err);
      } finally {
        _iterator6.f();
      }

      var vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType];

      if (vlOnlyMarkSpecificConfigs) {
        var _iterator7 = _createForOfIteratorHelper(vlOnlyMarkSpecificConfigs),
            _step7;

        try {
          for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
            var _prop5 = _step7.value;
            delete config[markType][_prop5];
          }
        } catch (err) {
          _iterator7.e(err);
        } finally {
          _iterator7.f();
        }
      } // Redirect mark config to config.style so that mark config only affect its own mark type
      // without affecting other marks that share the same underlying Vega marks.
      // For example, config.rect should not affect bar marks.


      redirectConfigToStyleConfig(config, markType);
    }
  } catch (err) {
    _iterator4.e(err);
  } finally {
    _iterator4.f();
  }

  var _iterator5 = _createForOfIteratorHelper(getAllCompositeMarks()),
      _step5;

  try {
    for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
      var m = _step5.value;
      // Clean up the composite mark config as we don't need them in the output specs anymore
      delete config[m];
    }
  } catch (err) {
    _iterator5.e(err);
  } finally {
    _iterator5.f();
  }

  redirectTitleConfig(config); // Remove empty config objects.

  for (var _prop3 in config) {
    if (isObject(config[_prop3]) && util_keys(config[_prop3]).length === 0) {
      delete config[_prop3];
    }
  }

  return util_keys(config).length > 0 ? config : undefined;
}
/**
 *
 * Redirect config.title -- so that title config do not affect header labels,
 * which also uses `title` directive to implement.
 *
 * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles.
 */

function redirectTitleConfig(config) {
  var _extractTitleConfig = extractTitleConfig(config.title),
      m = _extractTitleConfig.mark,
      subtitle = _extractTitleConfig.subtitle;

  var style = Object.assign(Object.assign({}, config.style['group-title']), m); // set config.style if it is not an empty object

  if (util_keys(style).length > 0) {
    config.style['group-title'] = style;
  } //


  if (util_keys(subtitle).length > 0) {
    config.title = subtitle;
  } else {
    delete config.title;
  }
}

function redirectConfigToStyleConfig(config, prop, // string = composite mark
toProp, compositeMarkPart) {
  var propConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop];

  if (prop === 'view') {
    toProp = 'cell'; // View's default style is "cell"
  }

  var style = Object.assign(Object.assign({}, propConfig), config.style[toProp !== null && toProp !== void 0 ? toProp : prop]); // set config.style if it is not an empty object

  if (util_keys(style).length > 0) {
    config.style[toProp !== null && toProp !== void 0 ? toProp : prop] = style;
  }

  if (!compositeMarkPart) {
    // For composite mark, so don't delete the whole config yet as we have to do multiple redirections.
    delete config[prop];
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/spec/layer.js
function isLayerSpec(spec) {
  return spec['layer'] !== undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/spec/repeat.js

function isRepeatSpec(spec) {
  return spec['repeat'] !== undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/spec/index.js





// EXTERNAL MODULE: ./node_modules/core-js/modules/es.reflect.get.js
var es_reflect_get = __webpack_require__("5d41");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.get-own-property-descriptor.js
var es_object_get_own_property_descriptor = __webpack_require__("e439");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.get-prototype-of.js
var es_object_get_prototype_of = __webpack_require__("3410");

// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js


function _getPrototypeOf(o) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  };
  return _getPrototypeOf(o);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/superPropBase.js

function _superPropBase(object, property) {
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
    object = _getPrototypeOf(object);
    if (object === null) break;
  }

  return object;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/get.js



function get_get(target, property, receiver) {
  if (typeof Reflect !== "undefined" && Reflect.get) {
    get_get = Reflect.get;
  } else {
    get_get = function _get(target, property, receiver) {
      var base = _superPropBase(target, property);
      if (!base) return;
      var desc = Object.getOwnPropertyDescriptor(base, property);

      if (desc.get) {
        return desc.get.call(receiver);
      }

      return desc.value;
    };
  }

  return get_get(target, property, receiver || target);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js


function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }

  subClass.prototype = Object.create(superClass && superClass.prototype, {
    constructor: {
      value: subClass,
      writable: true,
      configurable: true
    }
  });
  if (superClass) _setPrototypeOf(subClass, superClass);
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/typeof.js
var helpers_typeof = __webpack_require__("7037");
var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_typeof);

// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }

  return self;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js


function _possibleConstructorReturn(self, call) {
  if (call && (typeof_default()(call) === "object" || typeof call === "function")) {
    return call;
  } else if (call !== void 0) {
    throw new TypeError("Derived constructors may only return object or undefined");
  }

  return _assertThisInitialized(self);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js




function _createSuper(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived),
        result;

    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }

    return _possibleConstructorReturn(this, result);
  };
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/spec/map.js












var map_SpecMapper = /*#__PURE__*/function () {
  function SpecMapper() {
    _classCallCheck(this, SpecMapper);
  }

  _createClass(SpecMapper, [{
    key: "map",
    value: function map(spec, params) {
      if (isFacetSpec(spec)) {
        return this.mapFacet(spec, params);
      } else if (isRepeatSpec(spec)) {
        return this.mapRepeat(spec, params);
      } else if (isHConcatSpec(spec)) {
        return this.mapHConcat(spec, params);
      } else if (isVConcatSpec(spec)) {
        return this.mapVConcat(spec, params);
      } else if (isConcatSpec(spec)) {
        return this.mapConcat(spec, params);
      } else {
        return this.mapLayerOrUnit(spec, params);
      }
    }
  }, {
    key: "mapLayerOrUnit",
    value: function mapLayerOrUnit(spec, params) {
      if (isLayerSpec(spec)) {
        return this.mapLayer(spec, params);
      } else if (isUnitSpec(spec)) {
        return this.mapUnit(spec, params);
      }

      throw new Error(message.invalidSpec(spec));
    }
  }, {
    key: "mapLayer",
    value: function mapLayer(spec, params) {
      var _this = this;

      return Object.assign(Object.assign({}, spec), {
        layer: spec.layer.map(function (subspec) {
          return _this.mapLayerOrUnit(subspec, params);
        })
      });
    }
  }, {
    key: "mapHConcat",
    value: function mapHConcat(spec, params) {
      var _this2 = this;

      return Object.assign(Object.assign({}, spec), {
        hconcat: spec.hconcat.map(function (subspec) {
          return _this2.map(subspec, params);
        })
      });
    }
  }, {
    key: "mapVConcat",
    value: function mapVConcat(spec, params) {
      var _this3 = this;

      return Object.assign(Object.assign({}, spec), {
        vconcat: spec.vconcat.map(function (subspec) {
          return _this3.map(subspec, params);
        })
      });
    }
  }, {
    key: "mapConcat",
    value: function mapConcat(spec, params) {
      var _this4 = this;

      var concat = spec.concat,
          rest = __rest(spec, ["concat"]);

      return Object.assign(Object.assign({}, rest), {
        concat: concat.map(function (subspec) {
          return _this4.map(subspec, params);
        })
      });
    }
  }, {
    key: "mapFacet",
    value: function mapFacet(spec, params) {
      return Object.assign(Object.assign({}, spec), {
        // TODO: remove "any" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760
        spec: this.map(spec.spec, params)
      });
    }
  }, {
    key: "mapRepeat",
    value: function mapRepeat(spec, params) {
      return Object.assign(Object.assign({}, spec), {
        // as any is required here since TS cannot infer that the output type satisfies the input type
        spec: this.map(spec.spec, params)
      });
    }
  }]);

  return SpecMapper;
}();
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/stack.js












var STACK_OFFSET_INDEX = {
  zero: 1,
  center: 1,
  normalize: 1
};
function isStackOffset(s) {
  return !!STACK_OFFSET_INDEX[s];
}
var STACKABLE_MARKS = [BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK];
var STACK_BY_DEFAULT_MARKS = [BAR, AREA];

function potentialStackedChannel(encoding) {
  var xDef = encoding.x;
  var yDef = encoding.y;

  if (isFieldDef(xDef) && isFieldDef(yDef)) {
    if (xDef.type === 'quantitative' && yDef.type === 'quantitative') {
      if (xDef.stack) {
        return 'x';
      } else if (yDef.stack) {
        return 'y';
      } // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y


      if (!!xDef.aggregate !== !!yDef.aggregate) {
        return xDef.aggregate ? 'x' : 'y';
      }
    } else if (xDef.type === 'quantitative') {
      return 'x';
    } else if (yDef.type === 'quantitative') {
      return 'y';
    }
  } else if (isFieldDef(xDef) && xDef.type === 'quantitative') {
    return 'x';
  } else if (isFieldDef(yDef) && yDef.type === 'quantitative') {
    return 'y';
  }

  return undefined;
} // Note: CompassQL uses this method and only passes in required properties of each argument object.
// If required properties change, make sure to update CompassQL.


function stack_stack(m, encoding) {
  var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  var mark = isMarkDef(m) ? m.type : m; // Should have stackable mark

  if (!util_contains(STACKABLE_MARKS, mark)) {
    return null;
  }

  var fieldChannel = potentialStackedChannel(encoding);

  if (!fieldChannel) {
    return null;
  }

  var stackedFieldDef = encoding[fieldChannel];
  var stackedField = isStringFieldDef(stackedFieldDef) ? channeldef_vgField(stackedFieldDef, {}) : undefined;
  var dimensionChannel = fieldChannel === 'x' ? 'y' : 'x';
  var dimensionDef = encoding[dimensionChannel];
  var dimensionField = isStringFieldDef(dimensionDef) ? channeldef_vgField(dimensionDef, {}) : undefined; // Should have grouping level of detail that is different from the dimension field

  var stackBy = NONPOSITION_CHANNELS.reduce(function (sc, channel) {
    // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001)
    if (channel !== 'tooltip' && encoding_channelHasField(encoding, channel)) {
      var channelDef = encoding[channel];
      vega_util_src_array(channelDef).forEach(function (cDef) {
        var fieldDef = getTypedFieldDef(cDef);

        if (fieldDef.aggregate) {
          return;
        } // Check whether the channel's field is identical to x/y's field or if the channel is a repeat


        var f = isStringFieldDef(fieldDef) ? channeldef_vgField(fieldDef, {}) : undefined;

        if ( // if fielddef is a repeat, just include it in the stack by
        !f || // otherwise, the field must be different from x and y fields.
        f !== dimensionField && f !== stackedField) {
          sc.push({
            channel: channel,
            fieldDef: fieldDef
          });
        }
      });
    }

    return sc;
  }, []); // Automatically determine offset

  var offset;

  if (stackedFieldDef.stack !== undefined) {
    if (isBoolean(stackedFieldDef.stack)) {
      offset = stackedFieldDef.stack ? 'zero' : null;
    } else {
      offset = stackedFieldDef.stack;
    }
  } else if (stackBy.length > 0 && util_contains(STACK_BY_DEFAULT_MARKS, mark)) {
    // Bar and Area with sum ops are automatically stacked by default
    offset = 'zero';
  }

  if (!offset || !isStackOffset(offset)) {
    return null;
  }

  if (encoding_isAggregate(encoding) && stackBy.length === 0) {
    return null;
  } // warn when stacking non-linear


  if (stackedFieldDef.scale && stackedFieldDef.scale.type && stackedFieldDef.scale.type !== ScaleType.LINEAR) {
    if (opt.disallowNonLinearStack) {
      return null;
    } else {
      log_warn(message.cannotStackNonLinearScale(stackedFieldDef.scale.type));
    }
  } // Check if it is a ranged mark


  if (encoding_channelHasField(encoding, fieldChannel === channel_X ? channel_X2 : channel_Y2)) {
    if (stackedFieldDef.stack !== undefined) {
      log_warn(message.cannotStackRangedMark(fieldChannel));
    }

    return null;
  } // Warn if stacking non-summative aggregate


  if (stackedFieldDef.aggregate && !util_contains(SUM_OPS, stackedFieldDef.aggregate)) {
    log_warn(message.stackNonSummativeAggregate(stackedFieldDef.aggregate));
  }

  return {
    groupbyChannel: dimensionDef ? dimensionChannel : undefined,
    groupbyField: dimensionField,
    fieldChannel: fieldChannel,
    impute: stackedFieldDef.impute === null ? false : isPathMark(mark),
    stackBy: stackBy,
    offset: offset
  };
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/normalize/pathoverlay.js












function dropLineAndPoint(markDef) {
  var _point = markDef.point,
      _line = markDef.line,
      mark = __rest(markDef, ["point", "line"]);

  return util_keys(mark).length > 1 ? mark : mark.type;
}

function dropLineAndPointFromConfig(config) {
  for (var _i = 0, _arr = ['line', 'area', 'rule', 'trail']; _i < _arr.length; _i++) {
    var mark = _arr[_i];

    if (config[mark]) {
      config = Object.assign(Object.assign({}, config), _defineProperty({}, mark, omit(config[mark], ['point', 'line'])));
    }
  }

  return config;
}

function getPointOverlay(markDef) {
  var markConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var encoding = arguments.length > 2 ? arguments[2] : undefined;

  if (markDef.point === 'transparent') {
    return {
      opacity: 0
    };
  } else if (markDef.point) {
    // truthy : true or object
    return isObject(markDef.point) ? markDef.point : {};
  } else if (markDef.point !== undefined) {
    // false or null
    return null;
  } else {
    // undefined (not disabled)
    if (markConfig.point || encoding.shape) {
      // enable point overlay if config[mark].point is truthy or if encoding.shape is provided
      return isObject(markConfig.point) ? markConfig.point : {};
    } // markDef.point is defined as falsy


    return undefined;
  }
}

function getLineOverlay(markDef) {
  var markConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  if (markDef.line) {
    // true or object
    return markDef.line === true ? {} : markDef.line;
  } else if (markDef.line !== undefined) {
    // false or null
    return null;
  } else {
    // undefined (not disabled)
    if (markConfig.line) {
      // enable line overlay if config[mark].line is truthy
      return markConfig.line === true ? {} : markConfig.line;
    } // markDef.point is defined as falsy


    return undefined;
  }
}

var pathoverlay_PathOverlayNormalizer = /*#__PURE__*/function () {
  function PathOverlayNormalizer() {
    _classCallCheck(this, PathOverlayNormalizer);

    this.name = 'path-overlay';
  }

  _createClass(PathOverlayNormalizer, [{
    key: "hasMatchingType",
    value: function hasMatchingType(spec, config) {
      if (isUnitSpec(spec)) {
        var mark = spec.mark,
            encoding = spec.encoding;
        var markDef = isMarkDef(mark) ? mark : {
          type: mark
        };

        switch (markDef.type) {
          case 'line':
          case 'rule':
          case 'trail':
            return !!getPointOverlay(markDef, config[markDef.type], encoding);

          case 'area':
            return (// false / null are also included as we want to remove the properties
              !!getPointOverlay(markDef, config[markDef.type], encoding) || !!getLineOverlay(markDef, config[markDef.type])
            );
        }
      }

      return false;
    }
  }, {
    key: "run",
    value: function run(spec, params, normalize) {
      var config = params.config;

      var selection = spec.selection,
          projection = spec.projection,
          encoding = spec.encoding,
          mark = spec.mark,
          outerSpec = __rest(spec, ["selection", "projection", "encoding", "mark"]);

      var markDef = isMarkDef(mark) ? mark : {
        type: mark
      };
      var pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding);
      var lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]);
      var layer = [Object.assign(Object.assign({}, selection ? {
        selection: selection
      } : {}), {
        mark: dropLineAndPoint(Object.assign(Object.assign({}, markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined ? {
          opacity: 0.7
        } : {}), markDef)),
        // drop shape from encoding as this might be used to trigger point overlay
        encoding: omit(encoding, ['shape'])
      })]; // FIXME: determine rules for applying selections.
      // Need to copy stack config to overlayed layer

      var stackProps = stack_stack(markDef, encoding);
      var overlayEncoding = encoding;

      if (stackProps) {
        var stackFieldChannel = stackProps.fieldChannel,
            offset = stackProps.offset;
        overlayEncoding = Object.assign(Object.assign({}, encoding), _defineProperty({}, stackFieldChannel, Object.assign(Object.assign({}, encoding[stackFieldChannel]), offset ? {
          stack: offset
        } : {})));
      }

      if (lineOverlay) {
        layer.push(Object.assign(Object.assign({}, projection ? {
          projection: projection
        } : {}), {
          mark: Object.assign(Object.assign({
            type: 'line'
          }, util_pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip'])), lineOverlay),
          encoding: overlayEncoding
        }));
      }

      if (pointOverlay) {
        layer.push(Object.assign(Object.assign({}, projection ? {
          projection: projection
        } : {}), {
          mark: Object.assign(Object.assign({
            type: 'point',
            opacity: 1,
            filled: true
          }, util_pick(markDef, ['clip', 'tooltip'])), pointOverlay),
          encoding: overlayEncoding
        }));
      }

      return normalize(Object.assign(Object.assign({}, outerSpec), {
        layer: layer
      }), Object.assign(Object.assign({}, params), {
        config: dropLineAndPointFromConfig(config)
      }));
    }
  }]);

  return PathOverlayNormalizer;
}();
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/normalize/rangestep.js












var rangestep_RangeStepNormalizer = /*#__PURE__*/function () {
  function RangeStepNormalizer() {
    _classCallCheck(this, RangeStepNormalizer);

    this.name = 'RangeStep';
  }

  _createClass(RangeStepNormalizer, [{
    key: "hasMatchingType",
    value: function hasMatchingType(spec) {
      var _a;

      if (isUnitSpec(spec) && spec.encoding) {
        var _iterator = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS),
            _step;

        try {
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
            var channel = _step.value;
            var def = spec.encoding[channel];

            if (def && isFieldDef(def)) {
              if ((_a = def === null || def === void 0 ? void 0 : def.scale) === null || _a === void 0 ? void 0 : _a['rangeStep']) {
                return true;
              }
            }
          }
        } catch (err) {
          _iterator.e(err);
        } finally {
          _iterator.f();
        }
      }

      return false;
    }
  }, {
    key: "run",
    value: function run(spec) {
      var _a;

      var sizeMixins = {};
      var encoding = Object.assign({}, spec.encoding);

      var _iterator2 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var channel = _step2.value;
          var sizeType = getSizeType(channel);
          var def = encoding[channel];

          if (def && isFieldDef(def)) {
            if ((_a = def === null || def === void 0 ? void 0 : def.scale) === null || _a === void 0 ? void 0 : _a['rangeStep']) {
              var scale = def.scale,
                  defWithoutScale = __rest(def, ["scale"]);

              var _b = scale,
                  rangeStep = _b.rangeStep,
                  scaleWithoutRangeStep = __rest(_b, ["rangeStep"]);

              sizeMixins[sizeType] = {
                step: scale['rangeStep']
              };
              log_warn(message.RANGE_STEP_DEPRECATED);
              encoding = Object.assign(Object.assign({}, encoding), _defineProperty({}, channel, Object.assign(Object.assign({}, defWithoutScale), util_keys(scaleWithoutRangeStep).length > 0 ? {
                scale: scaleWithoutRangeStep
              } : {})));
            }
          }
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }

      return Object.assign(Object.assign(Object.assign({}, sizeMixins), spec), {
        encoding: encoding
      });
    }
  }]);

  return RangeStepNormalizer;
}();
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/normalize/repeater.js











function replaceRepeaterInFacet(facet, repeater) {
  if (!repeater) {
    return facet;
  }

  if (isFacetMapping(facet)) {
    return replaceRepeater(facet, repeater);
  }

  return replaceRepeaterInFieldDef(facet, repeater);
}
function replaceRepeaterInEncoding(encoding, repeater) {
  if (!repeater) {
    return encoding;
  }

  return replaceRepeater(encoding, repeater);
}
/**
 * Replaces repeated value and returns if the repeated value is valid.
 */

function replaceRepeat(o, repeater) {
  if (isRepeatRef(o.field)) {
    if (o.field.repeat in repeater) {
      return Object.assign(Object.assign({}, o), {
        field: repeater[o.field.repeat]
      });
    } else {
      log_warn(message.noSuchRepeatedValue(o.field.repeat));
      return undefined;
    }
  }

  return o;
}
/**
 * Replace repeater values in a field def with the concrete field name.
 */


function replaceRepeaterInFieldDef(fieldDef, repeater) {
  fieldDef = replaceRepeat(fieldDef, repeater);

  if (fieldDef === undefined) {
    // the field def should be ignored
    return undefined;
  } else if (fieldDef === null) {
    return null;
  }

  if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) {
    var sort = replaceRepeat(fieldDef.sort, repeater);
    fieldDef = Object.assign(Object.assign({}, fieldDef), sort ? {
      sort: sort
    } : {});
  }

  return fieldDef;
}

function replaceRepeaterInChannelDef(channelDef, repeater) {
  if (isFieldDef(channelDef)) {
    var fd = replaceRepeaterInFieldDef(channelDef, repeater);

    if (fd) {
      return fd;
    } else if (isConditionalDef(channelDef)) {
      return {
        condition: channelDef.condition
      };
    }
  } else {
    if (hasConditionalFieldDef(channelDef)) {
      var _fd = replaceRepeaterInFieldDef(channelDef.condition, repeater);

      if (_fd) {
        return Object.assign(Object.assign({}, channelDef), {
          condition: _fd
        });
      } else {
        var condition = channelDef.condition,
            channelDefWithoutCondition = __rest(channelDef, ["condition"]);

        return channelDefWithoutCondition;
      }
    }

    return channelDef;
  }

  return undefined;
}

function replaceRepeater(mapping, repeater) {
  var out = {};

  for (var channel in mapping) {
    if (src_hasOwnProperty(mapping, channel)) {
      var channelDef = mapping[channel];

      if (isArray(channelDef)) {
        // array cannot have condition
        out[channel] = channelDef.map(function (cd) {
          return replaceRepeaterInChannelDef(cd, repeater);
        }).filter(function (cd) {
          return cd;
        });
      } else {
        var cd = replaceRepeaterInChannelDef(channelDef, repeater);

        if (cd !== undefined) {
          out[channel] = cd;
        }
      }
    }
  }

  return out;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/normalize/ruleforrangedline.js










var ruleforrangedline_RuleForRangedLineNormalizer = /*#__PURE__*/function () {
  function RuleForRangedLineNormalizer() {
    _classCallCheck(this, RuleForRangedLineNormalizer);

    this.name = 'RuleForRangedLine';
  }

  _createClass(RuleForRangedLineNormalizer, [{
    key: "hasMatchingType",
    value: function hasMatchingType(spec) {
      if (isUnitSpec(spec)) {
        var encoding = spec.encoding,
            mark = spec.mark;

        if (mark === 'line') {
          var _iterator = _createForOfIteratorHelper(SECONDARY_RANGE_CHANNEL),
              _step;

          try {
            for (_iterator.s(); !(_step = _iterator.n()).done;) {
              var channel = _step.value;
              var mainChannel = getMainRangeChannel(channel);
              var mainChannelDef = encoding[mainChannel];

              if (!!encoding[channel] && isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) {
                return true;
              }
            }
          } catch (err) {
            _iterator.e(err);
          } finally {
            _iterator.f();
          }
        }
      }

      return false;
    }
  }, {
    key: "run",
    value: function run(spec, params, normalize) {
      var encoding = spec.encoding;
      log_warn(message.lineWithRange(!!encoding.x2, !!encoding.y2));
      return normalize(Object.assign(Object.assign({}, spec), {
        mark: 'rule'
      }), params);
    }
  }]);

  return RuleForRangedLineNormalizer;
}();
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/normalize/core.js































var core_CoreNormalizer = /*#__PURE__*/function (_SpecMapper) {
  _inherits(CoreNormalizer, _SpecMapper);

  var _super = _createSuper(CoreNormalizer);

  function CoreNormalizer() {
    var _this;

    _classCallCheck(this, CoreNormalizer);

    _this = _super.apply(this, arguments);
    _this.nonFacetUnitNormalizers = [boxPlotNormalizer, errorBarNormalizer, errorBandNormalizer, new pathoverlay_PathOverlayNormalizer(), new ruleforrangedline_RuleForRangedLineNormalizer(), new rangestep_RangeStepNormalizer()];
    return _this;
  }

  _createClass(CoreNormalizer, [{
    key: "map",
    value: function map(spec, params) {
      // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec.
      if (isUnitSpec(spec)) {
        var hasRow = encoding_channelHasField(spec.encoding, ROW);
        var hasColumn = encoding_channelHasField(spec.encoding, COLUMN);
        var hasFacet = encoding_channelHasField(spec.encoding, FACET);

        if (hasRow || hasColumn || hasFacet) {
          return this.mapFacetedUnit(spec, params);
        }
      }

      return get_get(_getPrototypeOf(CoreNormalizer.prototype), "map", this).call(this, spec, params);
    } // This is for normalizing non-facet unit

  }, {
    key: "mapUnit",
    value: function mapUnit(spec, params) {
      var parentEncoding = params.parentEncoding,
          parentProjection = params.parentProjection;
      var specWithReplacedEncoding = Object.assign(Object.assign({}, spec), {
        encoding: replaceRepeaterInEncoding(spec.encoding, params.repeater)
      });

      if (parentEncoding || parentProjection) {
        return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params);
      }

      var normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this);

      var _iterator = _createForOfIteratorHelper(this.nonFacetUnitNormalizers),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var unitNormalizer = _step.value;

          if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) {
            return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit);
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      return specWithReplacedEncoding;
    }
  }, {
    key: "mapRepeat",
    value: function mapRepeat(spec, params) {
      var _spec = spec,
          repeat = _spec.repeat,
          childSpec = _spec.spec,
          data = _spec.data,
          remainingProperties = __rest(spec, ["repeat", "spec", "data"]);

      if (!isArray(repeat) && spec.columns) {
        // is repeat with row/column
        spec = omit(spec, ['columns']);
        log_warn(message.columnsNotSupportByRowCol('repeat'));
      }

      var children = [];
      var repeater = params.repeater;
      var row = !isArray(repeat) && repeat.row || [repeater ? repeater.row : null];
      var column = !isArray(repeat) && repeat.column || [repeater ? repeater.column : null];
      var repeatValues = isArray(repeat) && repeat || [repeater ? repeater.repeat : null]; // cross product

      var _iterator2 = _createForOfIteratorHelper(repeatValues),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var repeatValue = _step2.value;

          var _iterator3 = _createForOfIteratorHelper(row),
              _step3;

          try {
            for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
              var rowValue = _step3.value;

              var _iterator4 = _createForOfIteratorHelper(column),
                  _step4;

              try {
                for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
                  var columnValue = _step4.value;
                  var childRepeater = {
                    repeat: repeatValue,
                    row: rowValue,
                    column: columnValue
                  };
                  var child = this.map(childSpec, Object.assign(Object.assign({}, params), {
                    repeater: childRepeater
                  }));
                  child.name = 'child__' + (repeatValue ? "".concat(varName(repeatValue)) : '') + (rowValue ? "row_".concat(varName(rowValue)) : '') + (columnValue ? "column_".concat(varName(columnValue)) : ''); // we move data up

                  children.push(omit(child, ['data']));
                }
              } catch (err) {
                _iterator4.e(err);
              } finally {
                _iterator4.f();
              }
            }
          } catch (err) {
            _iterator3.e(err);
          } finally {
            _iterator3.f();
          }
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }

      var columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1;
      return Object.assign(Object.assign({
        data: data !== null && data !== void 0 ? data : childSpec.data,
        align: 'all'
      }, remainingProperties), {
        columns: columns,
        concat: children
      });
    }
  }, {
    key: "mapFacet",
    value: function mapFacet(spec, params) {
      var _spec2 = spec,
          facet = _spec2.facet;

      if (isFacetMapping(facet) && spec.columns) {
        // is facet with row/column
        spec = omit(spec, ['columns']);
        log_warn(message.columnsNotSupportByRowCol('facet'));
      }

      return get_get(_getPrototypeOf(CoreNormalizer.prototype), "mapFacet", this).call(this, spec, params);
    }
  }, {
    key: "mapUnitWithParentEncodingOrProjection",
    value: function mapUnitWithParentEncodingOrProjection(spec, params) {
      var encoding = spec.encoding,
          projection = spec.projection;
      var parentEncoding = params.parentEncoding,
          parentProjection = params.parentProjection,
          config = params.config;
      var mergedProjection = mergeProjection({
        parentProjection: parentProjection,
        projection: projection
      });
      var mergedEncoding = mergeEncoding({
        parentEncoding: parentEncoding,
        encoding: replaceRepeaterInEncoding(encoding, params.repeater)
      });
      return this.mapUnit(Object.assign(Object.assign(Object.assign({}, spec), mergedProjection ? {
        projection: mergedProjection
      } : {}), mergedEncoding ? {
        encoding: mergedEncoding
      } : {}), {
        config: config
      });
    }
  }, {
    key: "mapFacetedUnit",
    value: function mapFacetedUnit(spec, params) {
      // New encoding in the inside spec should not contain row / column
      // as row/column should be moved to facet
      var _a = spec.encoding,
          row = _a.row,
          column = _a.column,
          facet = _a.facet,
          encoding = __rest(_a, ["row", "column", "facet"]); // Mark and encoding should be moved into the inner spec


      var mark = spec.mark,
          width = spec.width,
          projection = spec.projection,
          height = spec.height,
          view = spec.view,
          selection = spec.selection,
          _ = spec.encoding,
          outerSpec = __rest(spec, ["mark", "width", "projection", "height", "view", "selection", "encoding"]);

      var _this$getFacetMapping = this.getFacetMappingAndLayout({
        row: row,
        column: column,
        facet: facet
      }, params),
          facetMapping = _this$getFacetMapping.facetMapping,
          layout = _this$getFacetMapping.layout;

      return this.mapFacet(Object.assign(Object.assign(Object.assign({}, outerSpec), layout), {
        // row / column has higher precedence than facet
        facet: facetMapping,
        spec: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, width ? {
          width: width
        } : {}), height ? {
          height: height
        } : {}), view ? {
          view: view
        } : {}), projection ? {
          projection: projection
        } : {}), {
          mark: mark,
          encoding: replaceRepeaterInEncoding(encoding, params.repeater)
        }), selection ? {
          selection: selection
        } : {})
      }), params);
    }
  }, {
    key: "getFacetMappingAndLayout",
    value: function getFacetMappingAndLayout(facets, params) {
      var _a;

      var row = facets.row,
          column = facets.column,
          facet = facets.facet;

      if (row || column) {
        if (facet) {
          log_warn(message.facetChannelDropped([].concat(_toConsumableArray(row ? [ROW] : []), _toConsumableArray(column ? [COLUMN] : []))));
        }

        var facetMapping = {};
        var layout = {};

        for (var _i = 0, _arr = [ROW, COLUMN]; _i < _arr.length; _i++) {
          var channel = _arr[_i];
          var def = facets[channel];

          if (def) {
            var align = def.align,
                center = def.center,
                spacing = def.spacing,
                columns = def.columns,
                defWithoutLayout = __rest(def, ["align", "center", "spacing", "columns"]);

            facetMapping[channel] = defWithoutLayout;

            for (var _i2 = 0, _arr2 = ['align', 'center', 'spacing']; _i2 < _arr2.length; _i2++) {
              var prop = _arr2[_i2];

              if (def[prop] !== undefined) {
                layout[prop] = (_a = layout[prop]) !== null && _a !== void 0 ? _a : {};
                layout[prop][channel] = def[prop];
              }
            }
          }
        }

        return {
          facetMapping: facetMapping,
          layout: layout
        };
      } else {
        var _align = facet.align,
            _center = facet.center,
            _spacing = facet.spacing,
            _columns = facet.columns,
            _facetMapping = __rest(facet, ["align", "center", "spacing", "columns"]);

        return {
          facetMapping: replaceRepeaterInFacet(_facetMapping, params.repeater),
          layout: Object.assign(Object.assign(Object.assign(Object.assign({}, _align ? {
            align: _align
          } : {}), _center ? {
            center: _center
          } : {}), _spacing ? {
            spacing: _spacing
          } : {}), _columns ? {
            columns: _columns
          } : {})
        };
      }
    }
  }, {
    key: "mapLayer",
    value: function mapLayer(spec, _a) {
      // Special handling for extended layer spec
      var parentEncoding = _a.parentEncoding,
          parentProjection = _a.parentProjection,
          otherParams = __rest(_a, ["parentEncoding", "parentProjection"]);

      var encoding = spec.encoding,
          projection = spec.projection,
          rest = __rest(spec, ["encoding", "projection"]);

      var params = Object.assign(Object.assign({}, otherParams), {
        parentEncoding: mergeEncoding({
          parentEncoding: parentEncoding,
          encoding: encoding
        }),
        parentProjection: mergeProjection({
          parentProjection: parentProjection,
          projection: projection
        })
      });
      return get_get(_getPrototypeOf(CoreNormalizer.prototype), "mapLayer", this).call(this, rest, params);
    }
  }]);

  return CoreNormalizer;
}(map_SpecMapper);

function mergeEncoding(opt) {
  var parentEncoding = opt.parentEncoding,
      encoding = opt.encoding;

  if (parentEncoding && encoding) {
    var overriden = util_keys(parentEncoding).reduce(function (o, key) {
      if (encoding[key]) {
        o.push(key);
      }

      return o;
    }, []);

    if (overriden.length > 0) {
      log_warn(message.encodingOverridden(overriden));
    }
  }

  var merged = Object.assign(Object.assign({}, parentEncoding !== null && parentEncoding !== void 0 ? parentEncoding : {}), encoding !== null && encoding !== void 0 ? encoding : {});
  return util_keys(merged).length > 0 ? merged : undefined;
}

function mergeProjection(opt) {
  var parentProjection = opt.parentProjection,
      projection = opt.projection;

  if (parentProjection && projection) {
    log_warn(message.projectionOverridden({
      parentProjection: parentProjection,
      projection: projection
    }));
  }

  return projection !== null && projection !== void 0 ? projection : parentProjection;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/normalize/index.js








function normalize_normalize(spec, config) {
  if (config === undefined) {
    config = initConfig(spec.config);
  }

  var normalizedSpec = normalizeGenericSpec(spec, config);
  var width = spec.width,
      height = spec.height;
  var autosize = normalizeAutoSize(normalizedSpec, {
    width: width,
    height: height,
    autosize: spec.autosize
  }, config);
  return Object.assign(Object.assign({}, normalizedSpec), autosize ? {
    autosize: autosize
  } : {});
}
var normalize_normalizer = new core_CoreNormalizer();
/**
 * Decompose extended unit specs into composition of pure unit specs.
 */

function normalizeGenericSpec(spec) {
  var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  return normalize_normalizer.map(spec, {
    config: config
  });
}

function _normalizeAutoSize(autosize) {
  return isString(autosize) ? {
    type: autosize
  } : autosize !== null && autosize !== void 0 ? autosize : {};
}
/**
 * Normalize autosize and deal with width or height == "container".
 */


function normalizeAutoSize(spec, sizeInfo, config) {
  var width = sizeInfo.width,
      height = sizeInfo.height;
  var isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec);
  var autosizeDefault = {};

  if (!isFitCompatible) {
    // If spec is not compatible with autosize == "fit", discard width/height == container
    if (width == 'container') {
      log_warn(message.containerSizeNonSingle('width'));
      width = undefined;
    }

    if (height == 'container') {
      log_warn(message.containerSizeNonSingle('height'));
      height = undefined;
    }
  } else {
    // Default autosize parameters to fit when width/height is "container"
    if (width == 'container' && height == 'container') {
      autosizeDefault.type = 'fit';
      autosizeDefault.contains = 'padding';
    } else if (width == 'container') {
      autosizeDefault.type = 'fit-x';
      autosizeDefault.contains = 'padding';
    } else if (height == 'container') {
      autosizeDefault.type = 'fit-y';
      autosizeDefault.contains = 'padding';
    }
  }

  var autosize = Object.assign(Object.assign(Object.assign({
    type: 'pad'
  }, autosizeDefault), config ? _normalizeAutoSize(config.autosize) : {}), _normalizeAutoSize(spec.autosize));

  if (autosize.type === 'fit' && !isFitCompatible) {
    log_warn(message.FIT_NON_SINGLE);
    autosize.type = 'pad';
  }

  if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) {
    log_warn(message.containerSizeNotCompatibleWithAutosize('width'));
  }

  if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) {
    log_warn(message.containerSizeNotCompatibleWithAutosize('height'));
  } // Delete autosize property if it's Vega's default


  if (deepEqual(autosize, {
    type: 'pad'
  })) {
    return undefined;
  }

  return autosize;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/spec/toplevel.js


function isFitType(autoSizeType) {
  return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y';
}
function getFitType(sizeType) {
  return sizeType ? "fit-".concat(getPositionScaleChannel(sizeType)) : 'fit';
}
var TOP_LEVEL_PROPERTIES = ['background', 'padding' // We do not include "autosize" here as it is supported by only unit and layer specs and thus need to be normalized
];
function extractTopLevelProperties(t) {
  return TOP_LEVEL_PROPERTIES.reduce(function (o, p) {
    if (t && t[p] !== undefined) {
      o[p] = t[p];
    }

    return o;
  }, {});
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/data.js




function isUrlData(data) {
  return !!data['url'];
}
function isInlineData(data) {
  return !!data['values'];
}
function isNamedData(data) {
  return !!data['name'] && !isUrlData(data) && !isInlineData(data) && !isGenerator(data);
}
function isGenerator(data) {
  return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data));
}
function isSequenceGenerator(data) {
  return !!data['sequence'];
}
function isSphereGenerator(data) {
  return !!data['sphere'];
}
function isGraticuleGenerator(data) {
  return !!data['graticule'];
}
var MAIN = 'main';
var RAW = 'raw';
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/transform.js




function isFilter(t) {
  return t['filter'] !== undefined;
}
function isImputeSequence(t) {
  return (t === null || t === void 0 ? void 0 : t['stop']) !== undefined;
}
function isLookup(t) {
  return t['lookup'] !== undefined;
}
function isLookupData(from) {
  return from['data'] !== undefined;
}
function isLookupSelection(from) {
  return from['selection'] !== undefined;
}
function isPivot(t) {
  return t['pivot'] !== undefined;
}
function isDensity(t) {
  return t['density'] !== undefined;
}
function transform_isQuantile(t) {
  return t['quantile'] !== undefined;
}
function isRegression(t) {
  return t['regression'] !== undefined;
}
function isLoess(t) {
  return t['loess'] !== undefined;
}
function isSample(t) {
  return t['sample'] !== undefined;
}
function isWindow(t) {
  return t['window'] !== undefined;
}
function isJoinAggregate(t) {
  return t['joinaggregate'] !== undefined;
}
function isFlatten(t) {
  return t['flatten'] !== undefined;
}
function isCalculate(t) {
  return t['calculate'] !== undefined;
}
function isBin(t) {
  return !!t['bin'];
}
function isImpute(t) {
  return t['impute'] !== undefined;
}
function transform_isTimeUnit(t) {
  return t['timeUnit'] !== undefined;
}
function transform_isAggregate(t) {
  return t['aggregate'] !== undefined;
}
function isStack(t) {
  return t['stack'] !== undefined;
}
function isFold(t) {
  return t['fold'] !== undefined;
}
function normalizeTransform(transform) {
  return transform.map(function (t) {
    if (isFilter(t)) {
      return {
        filter: normalizeLogicalComposition(t.filter, normalizePredicate)
      };
    }

    return t;
  });
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.some.js
var es_array_some = __webpack_require__("45fc");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find-index.js
var es_array_find_index = __webpack_require__("c740");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.splice.js
var es_array_splice = __webpack_require__("a434");

// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/conditional.js









/**
 * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition.
 * or a simple mixin if channel def has no condition.
 */

function wrapCondition(model, channelDef, vgChannel, refFn) {
  var condition = channelDef && channelDef.condition;
  var valueRef = refFn(channelDef);

  if (condition) {
    var conditions = vega_util_src_array(condition);
    var vgConditions = conditions.map(function (c) {
      var conditionValueRef = refFn(c);
      var test = isConditionalSelection(c) ? parseSelectionPredicate(model, c.selection) // FIXME: remove casting once TS is no longer dumb about it
      : predicate_expression(model, c.test); // FIXME: remove casting once TS is no longer dumb about it

      return Object.assign({
        test: test
      }, conditionValueRef);
    });
    return _defineProperty({}, vgChannel, [].concat(_toConsumableArray(vgConditions), _toConsumableArray(valueRef !== undefined ? [valueRef] : [])));
  } else {
    return valueRef !== undefined ? _defineProperty({}, vgChannel, valueRef) : {};
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/valueref.js















function midPointRefWithPositionInvalidTest(params) {
  var channel = params.channel,
      channelDef = params.channelDef,
      markDef = params.markDef,
      scale = params.scale,
      config = params.config;
  var ref = midPoint(params); // Wrap to check if the positional value is invalid, if so, plot the point on the min value

  if ( // Only this for field def without counting aggregate (as count wouldn't be null)
  isFieldDef(channelDef) && !isCountingAggregateOp(channelDef.aggregate) && // and only for continuous scale without zero (otherwise, null / invalid will be interpreted as zero, which doesn't cause layout problem)
  scale && isContinuousToContinuous(scale.get('type')) && scale.get('zero') === false) {
    return wrapPositionInvalidTest({
      fieldDef: channelDef,
      channel: channel,
      markDef: markDef,
      ref: ref,
      config: config
    });
  }

  return ref;
}
function wrapPositionInvalidTest(_ref) {
  var fieldDef = _ref.fieldDef,
      channel = _ref.channel,
      markDef = _ref.markDef,
      ref = _ref.ref,
      config = _ref.config;

  if (isPathMark(markDef.type)) {
    // path mark already use defined to skip points, no need to do it here.
    return ref;
  }

  var invalid = getFirstDefined(markDef.invalid, getMarkConfig('invalid', markDef, config));

  if (invalid === null) {
    // if there is no invalid filter, don't do the invalid test
    return ref;
  }

  return [fieldInvalidTestValueRef(fieldDef, channel), ref];
}
function fieldInvalidTestValueRef(fieldDef, channel) {
  var test = fieldInvalidPredicate(fieldDef, true);
  var mainChannel = getMainRangeChannel(channel);
  var zeroValueRef = mainChannel === 'x' ? {
    value: 0
  } : {
    field: {
      group: 'height'
    }
  };
  return Object.assign({
    test: test
  }, zeroValueRef);
}
function fieldInvalidPredicate(field) {
  var invalid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  return fieldValidPredicate(isString(field) ? field : channeldef_vgField(field, {
    expr: 'datum'
  }), !invalid);
}
function valueref_fieldRef(fieldDef, scaleName, opt, encode) {
  var ref = Object.assign(Object.assign({}, scaleName ? {
    scale: scaleName
  } : {}), {
    field: channeldef_vgField(fieldDef, opt)
  });

  if (encode) {
    var offset = encode.offset,
        band = encode.band;
    return Object.assign(Object.assign(Object.assign({}, ref), offset ? {
      offset: offset
    } : {}), band ? {
      band: band
    } : {});
  }

  return ref;
}
/**
 * Signal that returns the middle of a bin from start and end field. Should only be used with x and y.
 */

function interpolatedSignalRef(_ref2) {
  var scaleName = _ref2.scaleName,
      fieldDef = _ref2.fieldDef,
      fieldDef2 = _ref2.fieldDef2,
      offset = _ref2.offset,
      startSuffix = _ref2.startSuffix,
      _ref2$band = _ref2.band,
      band = _ref2$band === void 0 ? 0.5 : _ref2$band;
  var expr = 0 < band && band < 1 ? 'datum' : undefined;
  var start = channeldef_vgField(fieldDef, {
    expr: expr,
    suffix: startSuffix
  });
  var end = fieldDef2 !== undefined ? channeldef_vgField(fieldDef2, {
    expr: expr
  }) : channeldef_vgField(fieldDef, {
    suffix: 'end',
    expr: expr
  });

  if (band === 0) {
    return Object.assign({
      scale: scaleName,
      field: start
    }, offset ? {
      offset: offset
    } : {});
  } else if (band === 1) {
    return Object.assign({
      scale: scaleName,
      field: end
    }, offset ? {
      offset: offset
    } : {});
  } else {
    var datum = "".concat(band, " * ").concat(start, " + ").concat(1 - band, " * ").concat(end);
    return Object.assign({
      signal: "scale(\"".concat(scaleName, "\", ").concat(datum, ")")
    }, offset ? {
      offset: offset
    } : {});
  }
}
/**
 * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels.
 */

function midPoint(_ref3) {
  var channel = _ref3.channel,
      channelDef = _ref3.channelDef,
      channel2Def = _ref3.channel2Def,
      markDef = _ref3.markDef,
      config = _ref3.config,
      scaleName = _ref3.scaleName,
      scale = _ref3.scale,
      stack = _ref3.stack,
      offset = _ref3.offset,
      defaultRef = _ref3.defaultRef;

  // TODO: datum support
  if (channelDef) {
    /* istanbul ignore else */
    if (isFieldDef(channelDef)) {
      if (isTypedFieldDef(channelDef)) {
        var band = getBand(channel, channelDef, channel2Def, markDef, config, {
          isMidPoint: true
        });

        if (isBinning(channelDef.bin) || band && channelDef.timeUnit) {
          // Use middle only for x an y to place marks in the center between start and end of the bin range.
          // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match.
          if (util_contains([channel_X, channel_Y], channel) && util_contains([QUANTITATIVE, TEMPORAL], channelDef.type)) {
            if (stack && stack.impute) {
              // For stack, we computed bin_mid so we can impute.
              return valueref_fieldRef(channelDef, scaleName, {
                binSuffix: 'mid'
              }, {
                offset: offset
              });
            } // For non-stack, we can just calculate bin mid on the fly using signal.


            return interpolatedSignalRef({
              scaleName: scaleName,
              fieldDef: channelDef,
              band: band,
              offset: offset
            });
          }

          return valueref_fieldRef(channelDef, scaleName, binRequiresRange(channelDef, channel) ? {
            binSuffix: 'range'
          } : {}, {
            offset: offset
          });
        } else if (isBinned(channelDef.bin)) {
          if (isFieldDef(channel2Def)) {
            return interpolatedSignalRef({
              scaleName: scaleName,
              fieldDef: channelDef,
              fieldDef2: channel2Def,
              band: band,
              offset: offset
            });
          } else {
            var channel2 = channel === channel_X ? channel_X2 : channel_Y2;
            log_warn(message.channelRequiredForBinned(channel2));
          }
        }
      }

      if (scale) {
        var scaleType = scale.get('type');

        if (hasDiscreteDomain(scaleType)) {
          if (scaleType === 'band') {
            // For band, to get mid point, need to offset by half of the band
            var _band = getFirstDefined(isPositionFieldDef(channelDef) ? channelDef.band : undefined, 0.5);

            return valueref_fieldRef(channelDef, scaleName, {
              binSuffix: 'range'
            }, {
              band: _band,
              offset: offset
            });
          }

          return valueref_fieldRef(channelDef, scaleName, {
            binSuffix: 'range'
          }, {
            offset: offset
          });
        }
      }

      return valueref_fieldRef(channelDef, scaleName, {}, {
        offset: offset
      }); // no need for bin suffix
    } else if (isValueDef(channelDef)) {
      var value = channelDef.value;
      var offsetMixins = offset ? {
        offset: offset
      } : {};
      return Object.assign(Object.assign({}, widthHeightValueRef(channel, value)), offsetMixins);
    } else if (isSignalRef(channelDef)) {
      return channelDef;
    } // If channelDef is neither field def or value def, it's a condition-only def.
    // In such case, we will use default ref.

  }

  var ref = isFunction(defaultRef) ? Object.assign(Object.assign({}, defaultRef()), offset ? {
    offset: offset
  } : {}) : defaultRef;

  if (ref) {
    // for non-position, ref could be undefined.
    return Object.assign(Object.assign({}, ref), offset ? {
      offset: offset
    } : {});
  }

  return ref;
}
/**
 * Convert special "width" and "height" values in Vega-Lite into Vega value ref.
 */

function widthHeightValueRef(channel, value) {
  if (util_contains(['x', 'x2'], channel) && value === 'width') {
    return {
      field: {
        group: 'width'
      }
    };
  } else if (util_contains(['y', 'y2'], channel) && value === 'height') {
    return {
      field: {
        group: 'height'
      }
    };
  }

  return signalOrValueRef(value);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/nonposition.js




/**
 * Return encode for non-positional channels with scales. (Text doesn't have scale.)
 */

function nonPosition(channel, model) {
  var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  var markDef = model.markDef,
      encoding = model.encoding,
      config = model.config;
  var _opt$vgChannel = opt.vgChannel,
      vgChannel = _opt$vgChannel === void 0 ? channel : _opt$vgChannel;
  var defaultRef = opt.defaultRef,
      defaultValue = opt.defaultValue;

  if (defaultRef === undefined) {
    // prettier-ignore
    defaultValue = defaultValue !== null && defaultValue !== void 0 ? defaultValue : vgChannel === channel ? // When vl channel is the same as Vega's, no need to read from config as Vega will apply them correctly
    markDef[channel] : // However, when they are different (e.g, vl's text size is vg fontSize), need to read "size" from configs
    getFirstDefined(markDef[channel], markDef[vgChannel], getMarkConfig(channel, markDef, config, {
      vgChannel: vgChannel
    }));

    if (defaultValue !== undefined) {
      defaultRef = signalOrValueRef(defaultValue);
    }
  }

  var channelDef = encoding[channel];
  return wrapCondition(model, channelDef, vgChannel, function (cDef) {
    return midPoint({
      channel: channel,
      channelDef: cDef,
      markDef: markDef,
      config: config,
      scaleName: model.scaleName(channel),
      scale: model.getScaleComponent(channel),
      stack: null,
      defaultRef: defaultRef
    });
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/color.js






function encode_color_color(model) {
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
    filled: undefined
  };
  var markDef = model.markDef,
      encoding = model.encoding,
      config = model.config;
  var markType = markDef.type; // Allow filled to be overridden (for trail's "filled")

  var filled = getFirstDefined(opt.filled, markDef.filled);
  var configValue = {
    fill: getMarkConfig('fill', markDef, config),
    stroke: getMarkConfig('stroke', markDef, config),
    color: getMarkConfig('color', markDef, config)
  };
  var transparentIfNeeded = util_contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType) ? 'transparent' : undefined;
  var defaultFill = getFirstDefined(markDef.fill, filled === true ? markDef.color : undefined, configValue.fill, filled === true ? configValue.color : undefined, // If there is no fill, always fill symbols, bar, geoshape
  // with transparent fills https://github.com/vega/vega-lite/issues/1316
  transparentIfNeeded);
  var defaultStroke = getFirstDefined(markDef.stroke, filled === false ? markDef.color : undefined, configValue.stroke, filled === false ? configValue.color : undefined);
  var colorVgChannel = filled ? 'fill' : 'stroke';
  var fillStrokeMarkDefAndConfig = Object.assign(Object.assign({}, defaultFill ? {
    fill: signalOrValueRef(defaultFill)
  } : {}), defaultStroke ? {
    stroke: signalOrValueRef(defaultStroke)
  } : {});

  if (markDef.color && (filled ? markDef.fill : markDef.stroke)) {
    log_warn(message.droppingColor('property', {
      fill: 'fill' in markDef,
      stroke: 'stroke' in markDef
    }));
  }

  return Object.assign(Object.assign(Object.assign(Object.assign({}, fillStrokeMarkDefAndConfig), nonPosition('color', model, {
    vgChannel: colorVgChannel,
    defaultValue: filled ? defaultFill : defaultStroke
  })), nonPosition('fill', model, {
    // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding
    defaultValue: encoding.fill ? defaultFill : undefined
  })), nonPosition('stroke', model, {
    // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding
    defaultValue: encoding.stroke ? defaultStroke : undefined
  }));
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/text.js



function text_text(model) {
  var channel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
  var channelDef = model.encoding[channel];
  return wrapCondition(model, channelDef, channel, function (cDef) {
    return textRef(cDef, model.config);
  });
}
function textRef(channelDef, config) {
  var expr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'datum';

  // text
  if (channelDef) {
    if (isValueDef(channelDef)) {
      return {
        value: channelDef.value
      };
    }

    if (isTypedFieldDef(channelDef)) {
      var _getFormatMixins = getFormatMixins(channelDef),
          format = _getFormatMixins.format,
          formatType = _getFormatMixins.formatType;

      return formatSignalRef({
        fieldDef: channelDef,
        format: format,
        formatType: formatType,
        expr: expr,
        config: config
      });
    }
  }

  return undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/tooltip.js













function tooltip_tooltip(model) {
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var encoding = model.encoding,
      markDef = model.markDef,
      config = model.config;
  var channelDef = encoding.tooltip;

  if (isArray(channelDef)) {
    return {
      tooltip: tooltipRefForEncoding({
        tooltip: channelDef
      }, model.stack, config, opt)
    };
  } else {
    return wrapCondition(model, channelDef, 'tooltip', function (cDef) {
      // use valueRef based on channelDef first
      var tooltipRefFromChannelDef = textRef(cDef, model.config, opt.reactiveGeom ? 'datum.datum' : 'datum');

      if (tooltipRefFromChannelDef) {
        return tooltipRefFromChannelDef;
      }

      if (cDef === null) {
        // Allow using encoding.tooltip = null to disable tooltip
        return undefined;
      } // If tooltipDef does not exist, then use value from markDef or config


      var markTooltip = getFirstDefined(markDef.tooltip, getMarkConfig('tooltip', markDef, config));

      if (markTooltip === true) {
        markTooltip = {
          content: 'encoding'
        };
      }

      if (isString(markTooltip)) {
        return {
          value: markTooltip
        };
      } else if (isObject(markTooltip)) {
        // `tooltip` is `{fields: 'encodings' | 'fields'}`
        if (markTooltip.content === 'encoding') {
          return tooltipRefForEncoding(encoding, model.stack, config, opt);
        } else {
          return {
            signal: 'datum'
          };
        }
      }

      return undefined;
    });
  }
}
function tooltipRefForEncoding(encoding, stack, config) {
  var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
      reactiveGeom = _ref.reactiveGeom;

  var keyValues = [];
  var usedKey = {};
  var toSkip = {};
  var expr = reactiveGeom ? 'datum.datum' : 'datum';
  var tooltipTuples = [];

  function add(fDef, channel) {
    var mainChannel = getMainRangeChannel(channel);
    var fieldDef = isTypedFieldDef(fDef) ? fDef : Object.assign(Object.assign({}, fDef), {
      type: encoding[mainChannel].type // for secondary field def, copy type from main channel

    });
    var key = vega_util_src_array(channeldef_title(fieldDef, config, {
      allowDisabling: false
    })).join(', ');
    var value = textRef(fieldDef, config, expr).signal;

    if (channel === 'x' || channel === 'y') {
      var channel2 = channel === 'x' ? 'x2' : 'y2';
      var fieldDef2 = getFieldDef(encoding[channel2]);

      if (isBinned(fieldDef.bin) && fieldDef2) {
        var startField = channeldef_vgField(fieldDef, {
          expr: expr
        });
        var endField = channeldef_vgField(fieldDef2, {
          expr: expr
        });

        var _getFormatMixins = getFormatMixins(fieldDef),
            format = _getFormatMixins.format,
            formatType = _getFormatMixins.formatType;

        value = binFormatExpression(startField, endField, format, formatType, config);
        toSkip[channel2] = true;
      } else if (stack && stack.fieldChannel === channel && stack.offset === 'normalize') {
        var _getFormatMixins2 = getFormatMixins(fieldDef),
            _format = _getFormatMixins2.format,
            _formatType = _getFormatMixins2.formatType;

        value = formatSignalRef({
          fieldDef: fieldDef,
          format: _format,
          formatType: _formatType,
          expr: expr,
          config: config,
          normalizeStack: true
        }).signal;
      }
    }

    tooltipTuples.push({
      channel: channel,
      key: key,
      value: value
    });
  }

  forEach(encoding, function (channelDef, channel) {
    if (isFieldDef(channelDef)) {
      add(channelDef, channel);
    } else if (hasConditionalFieldDef(channelDef)) {
      add(channelDef.condition, channel);
    }
  });

  for (var _i = 0, _tooltipTuples = tooltipTuples; _i < _tooltipTuples.length; _i++) {
    var _tooltipTuples$_i = _tooltipTuples[_i],
        channel = _tooltipTuples$_i.channel,
        key = _tooltipTuples$_i.key,
        value = _tooltipTuples$_i.value;

    if (!toSkip[channel] && !usedKey[key]) {
      keyValues.push("".concat(stringValue_$(key), ": ").concat(value));
      usedKey[key] = true;
    }
  }

  return keyValues.length > 0 ? {
    signal: "{".concat(keyValues.join(', '), "}")
  } : undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/offset.js
function getOffset(channel, markDef) {
  var offsetChannel = channel + 'Offset'; // Need to cast as the type can't be inferred automatically
  // TODO: in the future read from encoding channel too

  var markDefOffsetValue = markDef[offsetChannel];

  if (markDefOffsetValue) {
    return markDefOffsetValue;
  }

  return undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/position-point.js









/**
 * Return encode for point (non-band) position channels.
 */

function pointPosition(channel, model, _ref) {
  var defaultPos = _ref.defaultPos,
      vgChannel = _ref.vgChannel;
  var encoding = model.encoding,
      markDef = model.markDef,
      config = model.config,
      stack = model.stack;
  var channelDef = encoding[channel];
  var channel2Def = encoding[channel === channel_X ? channel_X2 : channel_Y2];
  var scaleName = model.scaleName(channel);
  var scale = model.getScaleComponent(channel);
  var offset = getOffset(channel, markDef); // Get default position or position from mark def

  var defaultRef = pointPositionDefaultRef({
    model: model,
    defaultPos: defaultPos,
    channel: channel,
    scaleName: scaleName,
    scale: scale
  });
  var valueRef = !channelDef && (encoding.latitude || encoding.longitude) ? // use geopoint output if there are lat/long and there is no point position overriding lat/long.
  {
    field: model.getName(channel)
  } : positionRef({
    channel: channel,
    channelDef: channelDef,
    channel2Def: channel2Def,
    markDef: markDef,
    config: config,
    scaleName: scaleName,
    scale: scale,
    stack: stack,
    offset: offset,
    defaultRef: defaultRef
  });
  return _defineProperty({}, vgChannel !== null && vgChannel !== void 0 ? vgChannel : channel, valueRef);
} // TODO: we need to find a way to refactor these so that scaleName is a part of scale
// but that's complicated. For now, this is a huge step moving forward.

/**
 * @return Vega ValueRef for normal x- or y-position without projection
 */

function positionRef(params) {
  var channel = params.channel,
      channelDef = params.channelDef,
      scaleName = params.scaleName,
      stack = params.stack,
      offset = params.offset; // This isn't a part of midPoint because we use midPoint for non-position too

  if (isFieldDef(channelDef) && stack && channel === stack.fieldChannel) {
    if (isPositionFieldDef(channelDef) && channelDef.band !== undefined) {
      return interpolatedSignalRef({
        scaleName: scaleName,
        fieldDef: channelDef,
        startSuffix: 'start',
        band: channelDef.band,
        offset: 0
      });
    } // x or y use stack_end so that stacked line's point mark use stack_end too.


    return valueref_fieldRef(channelDef, scaleName, {
      suffix: 'end'
    }, {
      offset: offset
    });
  }

  return midPointRefWithPositionInvalidTest(params);
}

function pointPositionDefaultRef(_ref3) {
  var model = _ref3.model,
      defaultPos = _ref3.defaultPos,
      channel = _ref3.channel,
      scaleName = _ref3.scaleName,
      scale = _ref3.scale;
  var markDef = model.markDef,
      config = model.config;
  return function () {
    var mainChannel = getMainRangeChannel(channel);
    var definedValueOrConfig = getFirstDefined(markDef[channel], getMarkConfig(channel, markDef, config));

    if (definedValueOrConfig !== undefined) {
      return widthHeightValueRef(channel, definedValueOrConfig);
    }

    if (defaultPos === 'zeroOrMin' || defaultPos === 'zeroOrMax') {
      if (scaleName) {
        var scaleType = scale.get('type');

        if (util_contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) {// Log scales cannot have zero.
          // Zero in time scale is arbitrary, and does not affect ratio.
          // (Time is an interval level of measurement, not ratio).
          // See https://en.wikipedia.org/wiki/Level_of_measurement for more info.
        } else {
          if (scale.domainDefinitelyIncludesZero()) {
            return {
              scale: scaleName,
              value: 0
            };
          }
        }
      }

      if (defaultPos === 'zeroOrMin') {
        return mainChannel === 'x' ? {
          value: 0
        } : {
          field: {
            group: 'height'
          }
        };
      } else {
        // zeroOrMax
        return mainChannel === 'x' ? {
          field: {
            group: 'width'
          }
        } : {
          value: 0
        };
      }
    } else {
      // mid
      var sizeRef = model[mainChannel === 'x' ? 'width' : 'height'];
      return Object.assign(Object.assign({}, sizeRef), {
        mult: 0.5
      });
    }
  };
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/position-align.js


var ALIGNED_X_CHANNEL = {
  left: 'x',
  center: 'xc',
  right: 'x2'
};
var BASELINED_Y_CHANNEL = {
  top: 'y',
  middle: 'yc',
  bottom: 'y2'
};
function alignedPositionChannel(channel, markDef, config) {
  var alignChannel = channel === 'x' ? 'align' : 'baseline';
  var align = getFirstDefined(markDef[alignChannel], getMarkConfig(alignChannel, markDef, config));

  if (channel === 'x') {
    return ALIGNED_X_CHANNEL[align !== null && align !== void 0 ? align : 'center'];
  } else {
    return BASELINED_Y_CHANNEL[align !== null && align !== void 0 ? align : 'middle'];
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/position-range.js









/**
 * Utility for area/rule position, which can be either point or range. (One of the axes should be point and the other should be range.)
 */

function pointOrRangePosition(channel, model, _ref) {
  var defaultPos = _ref.defaultPos,
      defaultPos2 = _ref.defaultPos2,
      range = _ref.range;

  if (range) {
    return rangePosition(channel, model, {
      defaultPos: defaultPos,
      defaultPos2: defaultPos2
    });
  }

  return pointPosition(channel, model, {
    defaultPos: defaultPos
  });
}
function rangePosition(channel, model, _ref2) {
  var defaultPos = _ref2.defaultPos,
      defaultPos2 = _ref2.defaultPos2;
  var markDef = model.markDef,
      config = model.config;
  var channel2 = channel === 'x' ? 'x2' : 'y2';
  var sizeChannel = channel === 'x' ? 'width' : 'height';
  var pos2Mixins = pointPosition2(model, defaultPos2, channel2); // If there is width/height, we need to position the marks based on the alignment.

  var vgChannel = pos2Mixins[sizeChannel] ? alignedPositionChannel(channel, markDef, config) : channel;
  return Object.assign(Object.assign({}, pointPosition(channel, model, {
    defaultPos: defaultPos,
    vgChannel: vgChannel
  })), pos2Mixins);
}
/**
 * Return encode for x2, y2.
 * If channel is not specified, return one channel based on orientation.
 */

function pointPosition2(model, defaultPos, channel) {
  var _position2orSize;

  var encoding = model.encoding,
      mark = model.mark,
      markDef = model.markDef,
      stack = model.stack,
      config = model.config;
  var baseChannel = channel === 'x2' ? 'x' : 'y';
  var sizeChannel = channel === 'x2' ? 'width' : 'height';
  var channelDef = encoding[baseChannel];
  var scaleName = model.scaleName(baseChannel);
  var scale = model.getScaleComponent(baseChannel);
  var offset = getOffset(channel, model.markDef);

  if (!channelDef && (encoding.latitude || encoding.longitude)) {
    // use geopoint output if there are lat2/long2 and there is no point position2 overriding lat2/long2.
    return _defineProperty({}, channel, {
      field: model.getName(channel)
    });
  }

  var valueRef = position2Ref({
    channel: channel,
    channelDef: channelDef,
    channel2Def: encoding[channel],
    markDef: markDef,
    config: config,
    scaleName: scaleName,
    scale: scale,
    stack: stack,
    offset: offset,
    defaultRef: undefined
  });

  if (valueRef !== undefined) {
    return _defineProperty({}, channel, valueRef);
  }

  var defaultRef = pointPositionDefaultRef({
    model: model,
    defaultPos: defaultPos,
    channel: channel,
    scaleName: scaleName,
    scale: scale
  })(); // TODO: check width/height encoding here once we add them
  // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence:
  // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark)

  return getFirstDefined(position2orSize(channel, markDef), position2orSize(channel, (_position2orSize = {}, _defineProperty(_position2orSize, channel, getMarkStyleConfig(channel, markDef, config.style)), _defineProperty(_position2orSize, sizeChannel, getMarkStyleConfig(sizeChannel, markDef, config.style)), _position2orSize)), position2orSize(channel, config[mark]), position2orSize(channel, config.mark), _defineProperty({}, channel, defaultRef));
}

function position2Ref(_ref5) {
  var channel = _ref5.channel,
      channelDef = _ref5.channelDef,
      channel2Def = _ref5.channel2Def,
      markDef = _ref5.markDef,
      config = _ref5.config,
      scaleName = _ref5.scaleName,
      scale = _ref5.scale,
      stack = _ref5.stack,
      offset = _ref5.offset,
      defaultRef = _ref5.defaultRef;

  if (isFieldDef(channelDef) && stack && // If fieldChannel is X and channel is X2 (or Y and Y2)
  channel.charAt(0) === stack.fieldChannel.charAt(0)) {
    return valueref_fieldRef(channelDef, scaleName, {
      suffix: 'start'
    }, {
      offset: offset
    });
  }

  return midPointRefWithPositionInvalidTest({
    channel: channel,
    channelDef: channel2Def,
    scaleName: scaleName,
    scale: scale,
    stack: stack,
    markDef: markDef,
    config: config,
    offset: offset,
    defaultRef: defaultRef
  });
}

function position2orSize(channel, markDef) {
  var sizeChannel = channel === 'x2' ? 'width' : 'height';

  if (markDef[channel]) {
    return _defineProperty({}, channel, widthHeightValueRef(channel, markDef[channel]));
  } else if (markDef[sizeChannel]) {
    return _defineProperty({}, sizeChannel, {
      value: markDef[sizeChannel]
    });
  }

  return undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/position-rect.js




















function rectPosition(model, channel, mark) {
  var _a, _b, _c, _d;

  var config = model.config,
      encoding = model.encoding,
      markDef = model.markDef;
  var channel2 = channel === 'x' ? 'x2' : 'y2';
  var sizeChannel = channel === 'x' ? 'width' : 'height';
  var fieldDef = encoding[channel];
  var fieldDef2 = encoding[channel2];
  var scale = model.getScaleComponent(channel);
  var scaleType = scale ? scale.get('type') : undefined;
  var scaleName = model.scaleName(channel);
  var orient = markDef.orient;
  var hasSizeDef = (_d = (_c = (_b = (_a = encoding[sizeChannel]) !== null && _a !== void 0 ? _a : encoding.size) !== null && _b !== void 0 ? _b : markDef[sizeChannel]) !== null && _c !== void 0 ? _c : markDef.size) !== null && _d !== void 0 ? _d : getMarkConfig('size', markDef, config, {
    vgChannel: sizeChannel
  });
  var isBarBand = channel === 'x' ? orient === 'vertical' : orient === 'horizontal'; // x, x2, and width -- we must specify two of these in all conditions

  if (isFieldDef(fieldDef) && (isBinning(fieldDef.bin) || isBinned(fieldDef.bin) || fieldDef.timeUnit && !fieldDef2) && !hasSizeDef && !hasDiscreteDomain(scaleType)) {
    var band = getBand(channel, fieldDef, undefined, markDef, config);
    return rectBinPosition({
      fieldDef: fieldDef,
      fieldDef2: fieldDef2,
      channel: channel,
      markDef: markDef,
      scaleName: scaleName,
      band: band,
      spacing: getFirstDefined(markDef.binSpacing, config[mark].binSpacing),
      reverse: scale.get('reverse'),
      config: config
    });
  } else if ((isFieldDef(fieldDef) && hasDiscreteDomain(scaleType) || isBarBand) && !fieldDef2) {
    // vertical
    if (isFieldDef(fieldDef) && scaleType === ScaleType.BAND) {
      var _band = isPositionFieldDef(fieldDef) ? fieldDef.band : undefined;

      return rectBandPosition(fieldDef, channel, model, defaultSizeRef(mark, markDef, sizeChannel, scaleName, scale, config, _band));
    } // sized bin, normal point-ordinal axis, quantitative x-axis, or no x


    return centeredPointPositionWithSize(channel, model, defaultSizeRef(mark, markDef, sizeChannel, scaleName, scale, config));
  } else {
    return rangePosition(channel, model, {
      defaultPos: 'zeroOrMax',
      defaultPos2: 'zeroOrMin'
    });
  }
}

function centeredPointPositionWithSize(channel, model, sizeRef) {
  var centerChannel = channel === 'x' ? 'xc' : 'yc';
  var sizeChannel = channel === 'x' ? 'width' : 'height';
  return Object.assign(Object.assign({}, pointPosition(channel, model, {
    defaultPos: 'mid',
    vgChannel: centerChannel
  })), nonPosition('size', model, {
    defaultRef: sizeRef,
    vgChannel: sizeChannel
  }));
}

function defaultSizeRef(mark, markDef, sizeChannel, scaleName, scale, config, band) {
  var markPropOrConfig = getFirstDefined(markDef[sizeChannel], markDef.size, // TODO: deal with sizeChannel config
  getMarkConfig('size', markDef, config, {
    vgChannel: sizeChannel
  }));

  if (markPropOrConfig !== undefined) {
    return signalOrValueRef(markPropOrConfig);
  }

  if (scale) {
    var scaleType = scale.get('type');

    if (scaleType === 'point' || scaleType === 'band') {
      if (config[mark].discreteBandSize !== undefined) {
        return {
          value: config[mark].discreteBandSize
        };
      }

      if (scaleType === ScaleType.POINT) {
        var scaleRange = scale.get('range');

        if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {
          return {
            value: scaleRange.step - 2
          };
        }

        return {
          value: DEFAULT_STEP - 2
        };
      } else {
        // BAND
        return bandRef(scaleName, band);
      }
    } else {
      // continuous scale
      return {
        value: config[mark].continuousBandSize
      };
    }
  } // No Scale


  var step = getViewConfigDiscreteStep(config.view, sizeChannel);
  var value = getFirstDefined( // No scale is like discrete bar (with one item)
  config[mark].discreteBandSize, step - 2);
  return {
    value: value
  };
}

function bandRef(scaleName) {
  var band = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  return {
    scale: scaleName,
    band: band
  };
}

function rectBandPosition(fieldDef, channel, model, sizeRef) {
  var _ref;

  var scaleName = model.scaleName(channel);
  var sizeChannel = channel === 'x' ? 'width' : 'height';
  var markDef = model.markDef,
      encoding = model.encoding,
      config = model.config;
  var vgChannel = alignedPositionChannel(channel, markDef, config);
  var offset = getOffset(channel, markDef);

  var centeredBandPositionMixins = _defineProperty({}, vgChannel, valueref_fieldRef(fieldDef, scaleName, {}, {
    band: 0.5,
    offset: offset
  }));

  if (encoding.size || markDef.size !== null && markDef.size !== undefined) {
    var orient = markDef.orient;

    if (orient) {
      if (getTypedFieldDef(encoding.size) || isValueDef(encoding.size)) {
        return Object.assign(Object.assign({}, centeredBandPositionMixins), nonPosition('size', model, {
          vgChannel: sizeChannel
        }));
      } else if (markDef.size !== undefined) {
        return Object.assign(Object.assign({}, centeredBandPositionMixins), _defineProperty({}, sizeChannel, {
          value: markDef.size
        }));
      }
    } else {
      log_warn(message.cannotApplySizeToNonOrientedMark(markDef.type));
    }
  }

  if ((sizeRef === null || sizeRef === void 0 ? void 0 : sizeRef.value) !== undefined) {
    return Object.assign(Object.assign({}, centeredBandPositionMixins), _defineProperty({}, sizeChannel, sizeRef));
  }

  var _fieldDef$band = fieldDef.band,
      band = _fieldDef$band === void 0 ? 1 : _fieldDef$band;
  return _ref = {}, _defineProperty(_ref, channel, valueref_fieldRef(fieldDef, scaleName, {
    binSuffix: 'range'
  }, {
    band: (1 - band) / 2,
    offset: offset
  })), _defineProperty(_ref, sizeChannel, sizeRef !== null && sizeRef !== void 0 ? sizeRef : bandRef(scaleName, band)), _ref;
}

function getBinSpacing(channel, spacing, reverse) {
  if (isSignalRef(reverse)) {
    if (channel === 'x' || channel === 'y2') {
      return {
        signal: "".concat(reverse.signal, " ? ").concat(spacing, " : 0")
      };
    } else {
      return {
        signal: "".concat(reverse.signal, " ? 0 : ").concat(spacing)
      };
    }
  } else {
    var spacingIndex = {
      x: reverse ? spacing : 0,
      x2: reverse ? 0 : spacing,
      y: reverse ? 0 : spacing,
      y2: reverse ? spacing : 0
    };
    return spacingIndex[channel];
  }
}

function rectBinPosition(_ref2) {
  var fieldDef = _ref2.fieldDef,
      fieldDef2 = _ref2.fieldDef2,
      channel = _ref2.channel,
      band = _ref2.band,
      scaleName = _ref2.scaleName,
      markDef = _ref2.markDef,
      _ref2$spacing = _ref2.spacing,
      spacing = _ref2$spacing === void 0 ? 0 : _ref2$spacing,
      reverse = _ref2.reverse,
      config = _ref2.config;
  var channel2 = channel === channel_X ? channel_X2 : channel_Y2;

  if (isBinning(fieldDef.bin) || fieldDef.timeUnit) {
    var _ref3;

    return _ref3 = {}, _defineProperty(_ref3, channel2, rectBinRef({
      channel: channel,
      fieldDef: fieldDef,
      scaleName: scaleName,
      markDef: markDef,
      band: (1 - band) / 2,
      offset: getBinSpacing(channel2, spacing, reverse),
      config: config
    })), _defineProperty(_ref3, channel, rectBinRef({
      channel: channel,
      fieldDef: fieldDef,
      scaleName: scaleName,
      markDef: markDef,
      band: 1 - (1 - band) / 2,
      offset: getBinSpacing(channel, spacing, reverse),
      config: config
    })), _ref3;
  } else if (isBinned(fieldDef.bin) && isFieldDef(fieldDef2)) {
    var _ref4;

    return _ref4 = {}, _defineProperty(_ref4, channel2, valueref_fieldRef(fieldDef, scaleName, {}, {
      offset: getBinSpacing(channel2, spacing, reverse)
    })), _defineProperty(_ref4, channel, valueref_fieldRef(fieldDef2, scaleName, {}, {
      offset: getBinSpacing(channel, spacing, reverse)
    })), _ref4;
  } else {
    log_warn(message.channelRequiredForBinned(channel2));
    return undefined;
  }
}
/**
 * Value Ref for binned fields
 */

function rectBinRef(_ref5) {
  var channel = _ref5.channel,
      fieldDef = _ref5.fieldDef,
      scaleName = _ref5.scaleName,
      markDef = _ref5.markDef,
      band = _ref5.band,
      offset = _ref5.offset,
      config = _ref5.config;
  var r = interpolatedSignalRef({
    scaleName: scaleName,
    fieldDef: fieldDef,
    band: band,
    offset: offset
  });
  return wrapPositionInvalidTest({
    fieldDef: fieldDef,
    channel: channel,
    markDef: markDef,
    ref: r,
    config: config
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/base.js




























function baseEncodeEntry(model, ignore) {
  var _ref = ignore.color === 'include' ? encode_color_color(model) : {},
      _ref$fill = _ref.fill,
      fill = _ref$fill === void 0 ? undefined : _ref$fill,
      _ref$stroke = _ref.stroke,
      stroke = _ref$stroke === void 0 ? undefined : _ref$stroke;

  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, markDefProperties(model.markDef, ignore)), wrapAllFieldsInvalid(model, 'fill', fill)), wrapAllFieldsInvalid(model, 'stroke', stroke)), nonPosition('opacity', model)), nonPosition('fillOpacity', model)), nonPosition('strokeOpacity', model)), nonPosition('strokeWidth', model)), nonPosition('strokeDash', model)), tooltip_tooltip(model)), text_text(model, 'href'));
} // TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987

function wrapAllFieldsInvalid(model, channel, valueRef) {
  var config = model.config,
      mark = model.mark,
      markDef = model.markDef;
  var invalid = getMarkPropOrConfig('invalid', markDef, config);

  if (invalid === 'hide' && valueRef && !isPathMark(mark)) {
    // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains.
    // For path marks, we will use "defined" property and skip these values instead.
    var test = allFieldsInvalidPredicate(model, {
      invalid: true,
      channels: SCALE_CHANNELS
    });

    if (test) {
      return _defineProperty({}, channel, [// prepend the invalid case
      // TODO: support custom value
      {
        test: test,
        value: null
      }].concat(_toConsumableArray(vega_util_src_array(valueRef))));
    }
  }

  return valueRef ? _defineProperty({}, channel, valueRef) : {};
}

function markDefProperties(mark, ignore) {
  return VG_MARK_CONFIGS.reduce(function (m, prop) {
    if (mark[prop] !== undefined && ignore[prop] !== 'ignore') {
      m[prop] = {
        value: mark[prop]
      };
    }

    return m;
  }, {});
}

function allFieldsInvalidPredicate(model, _ref4) {
  var _ref4$invalid = _ref4.invalid,
      invalid = _ref4$invalid === void 0 ? false : _ref4$invalid,
      channels = _ref4.channels;
  var filterIndex = channels.reduce(function (aggregator, channel) {
    var scaleComponent = model.getScaleComponent(channel);

    if (scaleComponent) {
      var scaleType = scaleComponent.get('type');
      var field = model.vgField(channel, {
        expr: 'datum'
      }); // While discrete domain scales can handle invalid values, continuous scales can't.

      if (field && hasContinuousDomain(scaleType)) {
        aggregator[field] = true;
      }
    }

    return aggregator;
  }, {});
  var fields = util_keys(filterIndex);

  if (fields.length > 0) {
    var op = invalid ? '||' : '&&';
    return fields.map(function (field) {
      return fieldInvalidPredicate(field, invalid);
    }).join(" ".concat(op, " "));
  }

  return undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/defined.js








function defined_defined(model) {
  var config = model.config,
      markDef = model.markDef;
  var invalid = getMarkPropOrConfig('invalid', markDef, config);

  if (invalid) {
    var signal = defined_allFieldsInvalidPredicate(model, {
      channels: ['x', 'y']
    });

    if (signal) {
      return {
        defined: {
          signal: signal
        }
      };
    }
  }

  return {};
}

function defined_allFieldsInvalidPredicate(model, _ref) {
  var _ref$invalid = _ref.invalid,
      invalid = _ref$invalid === void 0 ? false : _ref$invalid,
      channels = _ref.channels;
  var filterIndex = channels.reduce(function (aggregator, channel) {
    var scaleComponent = model.getScaleComponent(channel);

    if (scaleComponent) {
      var scaleType = scaleComponent.get('type');
      var field = model.vgField(channel, {
        expr: 'datum'
      }); // While discrete domain scales can handle invalid values, continuous scales can't.

      if (field && hasContinuousDomain(scaleType)) {
        aggregator[field] = true;
      }
    }

    return aggregator;
  }, {});
  var fields = util_keys(filterIndex);

  if (fields.length > 0) {
    var op = invalid ? '||' : '&&';
    return fields.map(function (field) {
      return fieldInvalidPredicate(field, invalid);
    }).join(" ".concat(op, " "));
  }

  return undefined;
}

function valueIfDefined(prop, value) {
  if (value !== undefined) {
    return _defineProperty({}, prop, {
      value: value
    });
  }

  return undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/encode/index.js










// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/nearest.js










var VORONOI = 'voronoi';
var nearest = {
  has: function has(selCmpt) {
    return selCmpt.type !== 'interval' && selCmpt.nearest;
  },
  parse: function parse(model, selCmpt) {
    // Scope selection events to the voronoi mark to prevent capturing
    // events that occur on the group mark (https://github.com/vega/vega/issues/2112).
    if (selCmpt.events) {
      var _iterator = _createForOfIteratorHelper(selCmpt.events),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var s = _step.value;
          s.markname = model.getName(VORONOI);
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
    }
  },
  marks: function marks(model, selCmpt, _marks) {
    var _selCmpt$project$hasC = selCmpt.project.hasChannel,
        x = _selCmpt$project$hasC.x,
        y = _selCmpt$project$hasC.y;
    var markType = model.mark;

    if (isPathMark(markType)) {
      log_warn(message.nearestNotSupportForContinuous(markType));
      return _marks;
    }

    var cellDef = {
      name: model.getName(VORONOI),
      type: 'path',
      interactive: true,
      from: {
        data: model.getName('marks')
      },
      encode: {
        update: Object.assign({
          fill: {
            value: 'transparent'
          },
          strokeWidth: {
            value: 0.35
          },
          stroke: {
            value: 'transparent'
          },
          isVoronoi: {
            value: true
          }
        }, tooltip_tooltip(model, {
          reactiveGeom: true
        }))
      },
      transform: [{
        type: 'voronoi',
        x: {
          expr: x || !y ? 'datum.datum.x || 0' : '0'
        },
        y: {
          expr: y || !x ? 'datum.datum.y || 0' : '0'
        },
        size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')]
      }]
    };
    var index = 0;
    var exists = false;

    _marks.forEach(function (mark, i) {
      var _a;

      var name = (_a = mark.name) !== null && _a !== void 0 ? _a : '';

      if (name === model.component.mark[0].name) {
        index = i;
      } else if (name.indexOf(VORONOI) >= 0) {
        exists = true;
      }
    });

    if (!exists) {
      _marks.splice(index + 1, 0, cellDef);
    }

    return _marks;
  }
};
/* harmony default export */ var transforms_nearest = (nearest);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/dataflow.js













/**
 * A node in the dataflow tree.
 */

var dataflow_DataFlowNode = /*#__PURE__*/function () {
  function DataFlowNode(parent, debugName) {
    _classCallCheck(this, DataFlowNode);

    this.debugName = debugName;
    this._children = [];
    this._parent = null;

    if (parent) {
      this.parent = parent;
    }
  }
  /**
   * Clone this node with a deep copy but don't clone links to children or parents.
   */


  _createClass(DataFlowNode, [{
    key: "clone",
    value: function clone() {
      throw new Error('Cannot clone node');
    }
  }, {
    key: "parent",
    get: function get() {
      return this._parent;
    }
    /**
     * Set the parent of the node and also add this node to the parent's children.
     */
    ,
    set: function set(parent) {
      this._parent = parent;

      if (parent) {
        parent.addChild(this);
      }
    }
  }, {
    key: "children",
    get: function get() {
      return this._children;
    }
  }, {
    key: "numChildren",
    value: function numChildren() {
      return this._children.length;
    }
  }, {
    key: "addChild",
    value: function addChild(child, loc) {
      // do not add the same child twice
      if (this._children.indexOf(child) > -1) {
        console.warn('Attempt to add the same child twice.');
        return;
      }

      if (loc !== undefined) {
        this._children.splice(loc, 0, child);
      } else {
        this._children.push(child);
      }
    }
  }, {
    key: "removeChild",
    value: function removeChild(oldChild) {
      var loc = this._children.indexOf(oldChild);

      this._children.splice(loc, 1);

      return loc;
    }
    /**
     * Remove node from the dataflow.
     */

  }, {
    key: "remove",
    value: function remove() {
      var loc = this._parent.removeChild(this);

      var _iterator = _createForOfIteratorHelper(this._children),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var child = _step.value;
          // do not use the set method because we want to insert at a particular location
          child._parent = this._parent;

          this._parent.addChild(child, loc++);
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
    }
    /**
     * Insert another node as a parent of this node.
     */

  }, {
    key: "insertAsParentOf",
    value: function insertAsParentOf(other) {
      var parent = other.parent;
      parent.removeChild(this);
      this.parent = parent;
      other.parent = this;
    }
  }, {
    key: "swapWithParent",
    value: function swapWithParent() {
      var parent = this._parent;
      var newParent = parent.parent; // reconnect the children

      var _iterator2 = _createForOfIteratorHelper(this._children),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var child = _step2.value;
          child.parent = parent;
        } // remove old links

      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }

      this._children = []; // equivalent to removing every child link one by one

      parent.removeChild(this);
      parent.parent.removeChild(parent); // swap two nodes

      this.parent = newParent;
      parent.parent = this;
    }
  }]);

  return DataFlowNode;
}();
var dataflow_OutputNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(OutputNode, _DataFlowNode);

  var _super = _createSuper(OutputNode);

  /**
   * @param source The name of the source. Will change in assemble.
   * @param type The type of the output node.
   * @param refCounts A global ref counter map.
   */
  function OutputNode(parent, source, type, refCounts) {
    var _this;

    _classCallCheck(this, OutputNode);

    _this = _super.call(this, parent, source);
    _this.type = type;
    _this.refCounts = refCounts;
    _this._source = _this._name = source;

    if (_this.refCounts && !(_this._name in _this.refCounts)) {
      _this.refCounts[_this._name] = 0;
    }

    return _this;
  }

  _createClass(OutputNode, [{
    key: "clone",
    value: function clone() {
      var cloneObj = new this.constructor();
      cloneObj.debugName = 'clone_' + this.debugName;
      cloneObj._source = this._source;
      cloneObj._name = 'clone_' + this._name;
      cloneObj.type = this.type;
      cloneObj.refCounts = this.refCounts;
      cloneObj.refCounts[cloneObj._name] = 0;
      return cloneObj;
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set();
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set();
    }
  }, {
    key: "hash",
    value: function hash() {
      if (this._hash === undefined) {
        this._hash = "Output ".concat(uniqueId());
      }

      return this._hash;
    }
    /**
     * Request the datasource name and increase the ref counter.
     *
     * During the parsing phase, this will return the simple name such as 'main' or 'raw'.
     * It is crucial to request the name from an output node to mark it as a required node.
     * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase.
     *
     * In the assemble phase, this will return the correct name.
     */

  }, {
    key: "getSource",
    value: function getSource() {
      this.refCounts[this._name]++;
      return this._source;
    }
  }, {
    key: "isRequired",
    value: function isRequired() {
      return !!this.refCounts[this._name];
    }
  }, {
    key: "setSource",
    value: function setSource(source) {
      this._source = source;
    }
  }]);

  return OutputNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/timeunit.js




















var timeunit_TimeUnitNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(TimeUnitNode, _DataFlowNode);

  var _super = _createSuper(TimeUnitNode);

  function TimeUnitNode(parent, formula) {
    var _this;

    _classCallCheck(this, TimeUnitNode);

    _this = _super.call(this, parent);
    _this.formula = formula;
    return _this;
  }

  _createClass(TimeUnitNode, [{
    key: "clone",
    value: function clone() {
      return new TimeUnitNode(null, duplicate(this.formula));
    }
  }, {
    key: "merge",
    value:
    /**
     * Merge together TimeUnitNodes assigning the children of `other` to `this`
     * and removing `other`.
     */
    function merge(other) {
      this.formula = Object.assign({}, this.formula); // if the same hash happen twice, merge "band"

      for (var key in other.formula) {
        if (!this.formula[key] || other.formula[key].band) {
          // copy if it's not a duplicate or if we need to include copy band over
          this.formula[key] = other.formula[key];
        }
      }

      var _iterator = _createForOfIteratorHelper(other.children),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var child = _step.value;
          other.removeChild(child);
          child.parent = this;
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      other.remove();
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(util_vals(this.formula).map(function (f) {
        return f.as;
      }));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set(util_vals(this.formula).map(function (f) {
        return f.field;
      }));
    }
  }, {
    key: "hash",
    value: function hash() {
      return "TimeUnit ".concat(util_hash(this.formula));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var transforms = [];

      var _iterator2 = _createForOfIteratorHelper(util_vals(this.formula)),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var f = _step2.value;
          var field = f.field,
              as = f.as,
              timeUnit = f.timeUnit;

          var _a = normalizeTimeUnit(timeUnit),
              unit = _a.unit,
              utc = _a.utc,
              params = __rest(_a, ["unit", "utc"]);

          transforms.push(Object.assign(Object.assign(Object.assign(Object.assign({
            field: field,
            type: 'timeunit'
          }, unit ? {
            units: getTimeUnitParts(unit)
          } : {}), utc ? {
            timezone: 'utc'
          } : {}), params), {
            as: [as, "".concat(as, "_end")]
          }));
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }

      return transforms;
    }
  }], [{
    key: "makeFromEncoding",
    value: function makeFromEncoding(parent, model) {
      var formula = model.reduceFieldDef(function (timeUnitComponent, fieldDef, channel) {
        var field = fieldDef.field,
            timeUnit = fieldDef.timeUnit;
        var channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;
        var band = isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.markDef, model.config);

        if (timeUnit) {
          var as = channeldef_vgField(fieldDef, {
            forAs: true
          });
          timeUnitComponent[util_hash({
            as: as,
            field: field,
            timeUnit: timeUnit
          })] = Object.assign({
            as: as,
            field: field,
            timeUnit: timeUnit
          }, band ? {
            band: true
          } : {});
        }

        return timeUnitComponent;
      }, {});

      if (util_keys(formula).length === 0) {
        return null;
      }

      return new TimeUnitNode(parent, formula);
    }
  }, {
    key: "makeFromTransform",
    value: function makeFromTransform(parent, t) {
      var _a = Object.assign({}, t),
          timeUnit = _a.timeUnit,
          other = __rest(_a, ["timeUnit"]);

      var normalizedTimeUnit = normalizeTimeUnit(timeUnit);
      var component = Object.assign(Object.assign({}, other), {
        timeUnit: normalizedTimeUnit
      });
      return new TimeUnitNode(parent, _defineProperty({}, util_hash(component), component));
    }
  }]);

  return TimeUnitNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/project.js




















var TUPLE_FIELDS = '_tuple_fields';
var project_SelectionProjectionComponent = function SelectionProjectionComponent() {
  _classCallCheck(this, SelectionProjectionComponent);

  for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
    items[_key] = arguments[_key];
  }

  this.items = items;
  this.hasChannel = {};
  this.hasField = {};
};
var project_project = {
  has: function has() {
    return true; // This transform handles its own defaults, so always run parse.
  },
  parse: function parse(model, selCmpt, selDef) {
    var _a, _b, _c;

    var name = selCmpt.name;
    var proj = (_a = selCmpt.project) !== null && _a !== void 0 ? _a : selCmpt.project = new project_SelectionProjectionComponent();
    var parsed = {};
    var timeUnits = {};
    var signals = new Set();

    var signalName = function signalName(p, range) {
      var suffix = range === 'visual' ? p.channel : p.field;
      var sg = varName("".concat(name, "_").concat(suffix));

      for (var counter = 1; signals.has(sg); counter++) {
        sg = varName("".concat(name, "_").concat(suffix, "_").concat(counter));
      }

      signals.add(sg);
      return _defineProperty({}, range, sg);
    }; // If no explicit projection (either fields or encodings) is specified, set some defaults.
    // If an initial value is set, try to infer projections.
    // Otherwise, use the default configuration.


    if (!selDef.fields && !selDef.encodings) {
      var cfg = model.config.selection[selDef.type];

      if (selDef.init) {
        var _iterator = _createForOfIteratorHelper(vega_util_src_array(selDef.init)),
            _step;

        try {
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
            var init = _step.value;

            var _iterator2 = _createForOfIteratorHelper(util_keys(init)),
                _step2;

            try {
              for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
                var key = _step2.value;

                if (isSingleDefUnitChannel(key)) {
                  (selDef.encodings || (selDef.encodings = [])).push(key);
                } else {
                  if (selDef.type === 'interval') {
                    log_warn('Interval selections should be initialized using "x" and/or "y" keys.');
                    selDef.encodings = cfg.encodings;
                  } else {
                    (selDef.fields || (selDef.fields = [])).push(key);
                  }
                }
              }
            } catch (err) {
              _iterator2.e(err);
            } finally {
              _iterator2.f();
            }
          }
        } catch (err) {
          _iterator.e(err);
        } finally {
          _iterator.f();
        }
      } else {
        selDef.encodings = cfg.encodings;
        selDef.fields = cfg.fields;
      }
    } // TODO: find a possible channel mapping for these fields.


    var _iterator3 = _createForOfIteratorHelper((_b = selDef.fields) !== null && _b !== void 0 ? _b : []),
        _step3;

    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var field = _step3.value;
        var p = {
          type: 'E',
          field: field
        };
        p.signals = Object.assign({}, signalName(p, 'data'));
        proj.items.push(p);
        proj.hasField[field] = p;
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }

    var _iterator4 = _createForOfIteratorHelper((_c = selDef.encodings) !== null && _c !== void 0 ? _c : []),
        _step4;

    try {
      for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
        var channel = _step4.value;
        var fieldDef = model.fieldDef(channel);

        if (fieldDef) {
          var _field = fieldDef.field;

          if (fieldDef.aggregate) {
            log_warn(message.cannotProjectAggregate(channel, fieldDef.aggregate));
            continue;
          } else if (!_field) {
            log_warn(message.cannotProjectOnChannelWithoutField(channel));
            continue;
          }

          if (fieldDef.timeUnit) {
            _field = model.vgField(channel); // Construct TimeUnitComponents which will be combined into a
            // TimeUnitNode. This node may need to be inserted into the
            // dataflow if the selection is used across views that do not
            // have these time units defined.

            var component = {
              timeUnit: fieldDef.timeUnit,
              as: _field,
              field: fieldDef.field
            };
            timeUnits[util_hash(component)] = component;
          } // Prevent duplicate projections on the same field.
          // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag).


          if (!parsed[_field]) {
            // Determine whether the tuple will store enumerated or ranged values.
            // Interval selections store ranges for continuous scales, and enumerations otherwise.
            // Single/multi selections store ranges for binned fields, and enumerations otherwise.
            var type = 'E';

            if (selCmpt.type === 'interval') {
              var scaleType = model.getScaleComponent(channel).get('type');

              if (hasContinuousDomain(scaleType)) {
                type = 'R';
              }
            } else if (fieldDef.bin) {
              type = 'R-RE';
            }

            var _p = {
              field: _field,
              channel: channel,
              type: type
            };
            _p.signals = Object.assign(Object.assign({}, signalName(_p, 'data')), signalName(_p, 'visual'));
            proj.items.push(parsed[_field] = _p);
            proj.hasField[_field] = proj.hasChannel[channel] = parsed[_field];
          }
        } else {
          log_warn(message.cannotProjectOnChannelWithoutField(channel));
        }
      }
    } catch (err) {
      _iterator4.e(err);
    } finally {
      _iterator4.f();
    }

    if (selDef.init) {
      var parseInit = function parseInit(i) {
        return proj.items.map(function (p) {
          return i[p.channel] !== undefined ? i[p.channel] : i[p.field];
        });
      };

      if (selDef.type === 'interval') {
        selCmpt.init = parseInit(selDef.init);
      } else {
        var _init = vega_util_src_array(selDef.init);

        selCmpt.init = _init.map(parseInit);
      }
    }

    if (util_keys(timeUnits).length > 0) {
      proj.timeUnit = new timeunit_TimeUnitNode(null, timeUnits);
    }
  },
  signals: function signals(model, selCmpt, allSignals) {
    var name = selCmpt.name + TUPLE_FIELDS;
    var hasSignal = allSignals.filter(function (s) {
      return s.name === name;
    });
    return hasSignal.length > 0 ? allSignals : allSignals.concat({
      name: name,
      value: selCmpt.project.items.map(function (proj) {
        var signals = proj.signals,
            hasLegend = proj.hasLegend,
            rest = __rest(proj, ["signals", "hasLegend"]);

        var p = duplicate(rest);
        p.field = replacePathInField(p.field);
        return p;
      })
    });
  }
};
/* harmony default export */ var transforms_project = (project_project);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/inputs.js
















var inputBindings = {
  has: function has(selCmpt) {
    return selCmpt.type === 'single' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind !== 'scales' && !isLegendBinding(selCmpt.bind);
  },
  parse: function parse(model, selCmpt, selDef, origDef) {
    // Binding a selection to input widgets disables default direct manipulation interaction.
    // A user can choose to re-enable it by explicitly specifying triggering input events.
    if (!origDef.on) delete selCmpt.events;
    if (!origDef.clear) delete selCmpt.clear;
  },
  topLevelSignals: function topLevelSignals(model, selCmpt, signals) {
    var name = selCmpt.name;
    var proj = selCmpt.project;
    var bind = selCmpt.bind;
    var init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value).

    var datum = transforms_nearest.has(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum';
    proj.items.forEach(function (p, i) {
      var _a, _b;

      var sgname = varName("".concat(name, "_").concat(p.field));
      var hasSignal = signals.filter(function (s) {
        return s.name === sgname;
      });

      if (!hasSignal.length) {
        signals.unshift(Object.assign(Object.assign({
          name: sgname
        }, init ? {
          init: assembleInit(init[i])
        } : {
          value: null
        }), {
          on: selCmpt.events ? [{
            events: selCmpt.events,
            update: "datum && item().mark.marktype !== 'group' ? ".concat(datum, "[").concat(stringValue_$(p.field), "] : null")
          }] : [],
          bind: (_b = (_a = bind[p.field]) !== null && _a !== void 0 ? _a : bind[p.channel]) !== null && _b !== void 0 ? _b : bind
        }));
      }
    });
    return signals;
  },
  signals: function signals(model, selCmpt, _signals) {
    var name = selCmpt.name;
    var proj = selCmpt.project;

    var signal = _signals.filter(function (s) {
      return s.name === name + TUPLE;
    })[0];

    var fields = name + TUPLE_FIELDS;
    var values = proj.items.map(function (p) {
      return varName("".concat(name, "_").concat(p.field));
    });
    var valid = values.map(function (v) {
      return "".concat(v, " !== null");
    }).join(' && ');

    if (values.length) {
      signal.update = "".concat(valid, " ? {fields: ").concat(fields, ", values: [").concat(values.join(', '), "]} : null");
    }

    delete signal.value;
    delete signal.on;
    return _signals;
  }
};
/* harmony default export */ var transforms_inputs = (inputBindings);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/toggle.js



var TOGGLE = '_toggle';
var toggle_toggle = {
  has: function has(selCmpt) {
    return selCmpt.type === 'multi' && !!selCmpt.toggle;
  },
  signals: function signals(model, selCmpt, _signals) {
    return _signals.concat({
      name: selCmpt.name + TOGGLE,
      value: false,
      on: [{
        events: selCmpt.events,
        update: selCmpt.toggle
      }]
    });
  },
  modifyExpr: function modifyExpr(model, selCmpt) {
    var tpl = selCmpt.name + TUPLE;
    var signal = selCmpt.name + TOGGLE;
    return "".concat(signal, " ? null : ").concat(tpl, ", ") + (selCmpt.resolve === 'global' ? "".concat(signal, " ? null : true, ") : "".concat(signal, " ? null : {unit: ").concat(selection_unitName(model), "}, ")) + "".concat(signal, " ? ").concat(tpl, " : null");
  }
};
/* harmony default export */ var transforms_toggle = (toggle_toggle);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/clear.js











var clear_clear = {
  has: function has(selCmpt) {
    return selCmpt.clear !== undefined && selCmpt.clear !== false;
  },
  parse: function parse(model, selCmpt, selDef) {
    if (selDef.clear) {
      selCmpt.clear = isString(selDef.clear) ? vega_event_selector_module_eventSelector(selDef.clear, 'scope') : selDef.clear;
    }
  },
  topLevelSignals: function topLevelSignals(model, selCmpt, signals) {
    if (transforms_inputs.has(selCmpt)) {
      selCmpt.project.items.forEach(function (proj) {
        var idx = signals.findIndex(function (n) {
          return n.name === varName("".concat(selCmpt.name, "_").concat(proj.field));
        });

        if (idx !== -1) {
          signals[idx].on.push({
            events: selCmpt.clear,
            update: 'null'
          });
        }
      });
    }

    return signals;
  },
  signals: function signals(model, selCmpt, _signals) {
    function addClear(idx, update) {
      if (idx !== -1 && _signals[idx].on) {
        _signals[idx].on.push({
          events: selCmpt.clear,
          update: update
        });
      }
    } // Be as minimalist as possible when adding clear triggers to minimize dataflow execution.


    if (selCmpt.type === 'interval') {
      selCmpt.project.items.forEach(function (proj) {
        var vIdx = _signals.findIndex(function (n) {
          return n.name === proj.signals.visual;
        });

        addClear(vIdx, '[0, 0]');

        if (vIdx === -1) {
          var dIdx = _signals.findIndex(function (n) {
            return n.name === proj.signals.data;
          });

          addClear(dIdx, 'null');
        }
      });
    } else {
      var tIdx = _signals.findIndex(function (n) {
        return n.name === selCmpt.name + TUPLE;
      });

      addClear(tIdx, 'null');

      if (transforms_toggle.has(selCmpt)) {
        tIdx = _signals.findIndex(function (n) {
          return n.name === selCmpt.name + TOGGLE;
        });
        addClear(tIdx, 'false');
      }
    }

    return _signals;
  }
};
/* harmony default export */ var transforms_clear = (clear_clear);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/scales.js














var scaleBindings = {
  has: function has(selCmpt) {
    return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales';
  },
  parse: function parse(model, selCmpt) {
    var bound = selCmpt.scales = [];

    var _iterator = _createForOfIteratorHelper(selCmpt.project.items),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var proj = _step.value;
        var channel = proj.channel;

        if (!isScaleChannel(channel)) {
          continue;
        }

        var scale = model.getScaleComponent(channel);
        var scaleType = scale ? scale.get('type') : undefined;

        if (!scale || !hasContinuousDomain(scaleType)) {
          log_warn(message.SCALE_BINDINGS_CONTINUOUS);
          continue;
        }

        var extent = {
          selection: selCmpt.name,
          field: proj.field
        };
        scale.set('selectionExtent', extent, true);
        bound.push(proj);
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
  },
  topLevelSignals: function topLevelSignals(model, selCmpt, signals) {
    var bound = selCmpt.scales.filter(function (proj) {
      return signals.filter(function (s) {
        return s.name === proj.signals.data;
      }).length === 0;
    }); // Top-level signals are only needed for multiview displays and if this
    // view's top-level signals haven't already been generated.

    if (!model.parent || isTopLevelLayer(model) || bound.length === 0) {
      return signals;
    } // vlSelectionResolve does not account for the behavior of bound scales in
    // multiview displays. Each unit view adds a tuple to the store, but the
    // state of the selection is the unit selection most recently updated. This
    // state is captured by the top-level signals that we insert and "push
    // outer" to from within the units. We need to reassemble this state into
    // the top-level named signal, except no single selCmpt has a global view.


    var namedSg = signals.filter(function (s) {
      return s.name === selCmpt.name;
    })[0];
    var update = namedSg.update;

    if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) {
      namedSg.update = "{".concat(bound.map(function (proj) {
        return "".concat(stringValue_$(proj.field), ": ").concat(proj.signals.data);
      }).join(', '), "}");
    } else {
      var _iterator2 = _createForOfIteratorHelper(bound),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var proj = _step2.value;
          var mapping = "".concat(stringValue_$(proj.field), ": ").concat(proj.signals.data);

          if (update.indexOf(mapping) < 0) {
            update = "".concat(update.substring(0, update.length - 1), ", ").concat(mapping, "}");
          }
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }

      namedSg.update = update;
    }

    return signals.concat(bound.map(function (proj) {
      return {
        name: proj.signals.data
      };
    }));
  },
  signals: function signals(model, selCmpt, _signals) {
    // Nested signals need only push to top-level signals with multiview displays.
    if (model.parent && !isTopLevelLayer(model)) {
      var _iterator3 = _createForOfIteratorHelper(selCmpt.scales),
          _step3;

      try {
        var _loop = function _loop() {
          var proj = _step3.value;

          var signal = _signals.filter(function (s) {
            return s.name === proj.signals.data;
          })[0];

          signal.push = 'outer';
          delete signal.value;
          delete signal.update;
        };

        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          _loop();
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }
    }

    return _signals;
  }
};
/* harmony default export */ var transforms_scales = (scaleBindings);
function scales_domain(model, channel) {
  var scale = stringValue_$(model.scaleName(channel));
  return "domain(".concat(scale, ")");
}

function isTopLevelLayer(model) {
  var _a;

  return model.parent && isLayerModel(model.parent) && ((_a = !model.parent.parent) !== null && _a !== void 0 ? _a : isTopLevelLayer(model.parent.parent));
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find.js
var es_array_find = __webpack_require__("7db0");

// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/legends.js


















var legendBindings = {
  has: function has(selCmpt) {
    var spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind);
    var projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== selection_SELECTION_ID;

    if (spec && !projLen) {
      log_warn(message.LEGEND_BINDINGS_PROJECT_LENGTH);
    }

    return spec && projLen;
  },
  parse: function parse(model, selCmpt, selDef, origDef) {
    var _a; // Binding a selection to a legend disables default direct manipulation interaction.
    // A user can choose to re-enable it by explicitly specifying triggering input events.


    if (!origDef.on) delete selCmpt.events;
    if (!origDef.clear) delete selCmpt.clear;

    if (origDef.on || origDef.clear) {
      var legendFilter = 'event.item && indexof(event.item.mark.role, "legend") < 0';

      var _iterator = _createForOfIteratorHelper(selCmpt.events),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var _evt = _step.value;
          _evt.filter = vega_util_src_array((_a = _evt.filter) !== null && _a !== void 0 ? _a : []);

          if (_evt.filter.indexOf(legendFilter) < 0) {
            _evt.filter.push(legendFilter);
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
    }

    var evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click';
    var stream = isString(evt) ? vega_event_selector_module_eventSelector(evt, 'view') : vega_util_src_array(evt);
    selCmpt.bind = {
      legend: {
        merge: stream
      }
    };
  },
  topLevelSignals: function topLevelSignals(model, selCmpt, signals) {
    var selName = selCmpt.name;
    var stream = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;

    var markName = function markName(name) {
      return function (s) {
        var ds = duplicate(s);
        ds.markname = name;
        return ds;
      };
    };

    var _iterator2 = _createForOfIteratorHelper(selCmpt.project.items),
        _step2;

    try {
      var _loop = function _loop() {
        var proj = _step2.value;
        if (!proj.hasLegend) return "continue";
        var prefix = "".concat(varName(proj.field), "_legend");
        var sgName = "".concat(selName, "_").concat(prefix);
        var hasSignal = signals.filter(function (s) {
          return s.name === sgName;
        });

        if (hasSignal.length === 0) {
          var events = stream.merge.map(markName("".concat(prefix, "_symbols"))).concat(stream.merge.map(markName("".concat(prefix, "_labels")))).concat(stream.merge.map(markName("".concat(prefix, "_entries"))));
          signals.unshift(Object.assign(Object.assign({
            name: sgName
          }, !selCmpt.init ? {
            value: null
          } : {}), {
            on: [// Legend entries do not store values, so we need to walk the scenegraph to the symbol datum.
            {
              events: events,
              update: 'datum.value || item().items[0].items[0].datum.value',
              force: true
            }, {
              events: stream.merge,
              update: "!event.item || !datum ? null : ".concat(sgName),
              force: true
            }]
          }));
        }
      };

      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _ret = _loop();

        if (_ret === "continue") continue;
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }

    return signals;
  },
  signals: function signals(model, selCmpt, _signals) {
    var name = selCmpt.name;
    var proj = selCmpt.project;

    var tuple = _signals.find(function (s) {
      return s.name === name + TUPLE;
    });

    var fields = name + TUPLE_FIELDS;
    var values = proj.items.filter(function (p) {
      return p.hasLegend;
    }).map(function (p) {
      return varName("".concat(name, "_").concat(varName(p.field), "_legend"));
    });
    var valid = values.map(function (v) {
      return "".concat(v, " !== null");
    }).join(' && ');
    var update = "".concat(valid, " ? {fields: ").concat(fields, ", values: [").concat(values.join(', '), "]} : null");

    if (selCmpt.events && values.length > 0) {
      tuple.on.push({
        events: values.map(function (signal) {
          return {
            signal: signal
          };
        }),
        update: update
      });
    } else if (values.length > 0) {
      tuple.update = update;
      delete tuple.value;
      delete tuple.on;
    }

    var toggle = _signals.find(function (s) {
      return s.name === name + TOGGLE;
    });

    var events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;

    if (toggle) {
      if (!selCmpt.events) toggle.on[0].events = events;else toggle.on.push(Object.assign(Object.assign({}, toggle.on[0]), {
        events: events
      }));
    }

    return _signals;
  }
};
/* harmony default export */ var transforms_legends = (legendBindings);
function parseInteractiveLegend(model, channel, legendCmpt) {
  var field = model.fieldDef(channel).field;
  forEachSelection(model, function (selCmpt) {
    var _a, _b;

    var proj = (_a = selCmpt.project.hasField[field]) !== null && _a !== void 0 ? _a : selCmpt.project.hasChannel[channel];

    if (proj && legendBindings.has(selCmpt)) {
      var legendSelections = (_b = legendCmpt.get('selections')) !== null && _b !== void 0 ? _b : [];
      legendSelections.push(selCmpt.name);
      legendCmpt.set('selections', legendSelections, false);
      proj.hasLegend = true;
    }
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/translate.js








var ANCHOR = '_translate_anchor';
var DELTA = '_translate_delta';
var translate_translate = {
  has: function has(selCmpt) {
    return selCmpt.type === 'interval' && selCmpt.translate;
  },
  signals: function signals(model, selCmpt, _signals) {
    var name = selCmpt.name;
    var hasScales = transforms_scales.has(selCmpt);
    var anchor = name + ANCHOR;
    var _selCmpt$project$hasC = selCmpt.project.hasChannel,
        x = _selCmpt$project$hasC.x,
        y = _selCmpt$project$hasC.y;
    var events = vega_event_selector_module_eventSelector(selCmpt.translate, 'scope');

    if (!hasScales) {
      events = events.map(function (e) {
        return e.between[0].markname = name + BRUSH, e;
      });
    }

    _signals.push({
      name: anchor,
      value: {},
      on: [{
        events: events.map(function (e) {
          return e.between[0];
        }),
        update: '{x: x(unit), y: y(unit)' + (x !== undefined ? ', extent_x: ' + (hasScales ? scales_domain(model, channel_X) : "slice(".concat(x.signals.visual, ")")) : '') + (y !== undefined ? ', extent_y: ' + (hasScales ? scales_domain(model, channel_Y) : "slice(".concat(y.signals.visual, ")")) : '') + '}'
      }]
    }, {
      name: name + DELTA,
      value: {},
      on: [{
        events: events,
        update: "{x: ".concat(anchor, ".x - x(unit), y: ").concat(anchor, ".y - y(unit)}")
      }]
    });

    if (x !== undefined) {
      onDelta(model, selCmpt, x, 'width', _signals);
    }

    if (y !== undefined) {
      onDelta(model, selCmpt, y, 'height', _signals);
    }

    return _signals;
  }
};
/* harmony default export */ var transforms_translate = (translate_translate);

function onDelta(model, selCmpt, proj, size, signals) {
  var _a;

  var name = selCmpt.name;
  var anchor = name + ANCHOR;
  var delta = name + DELTA;
  var channel = proj.channel;
  var hasScales = transforms_scales.has(selCmpt);
  var signal = signals.filter(function (s) {
    return s.name === proj.signals[hasScales ? 'data' : 'visual'];
  })[0];
  var sizeSg = model.getSizeSignalRef(size).signal;
  var scaleCmpt = model.getScaleComponent(channel);
  var scaleType = scaleCmpt.get('type');
  var sign = hasScales && channel === channel_X ? '-' : ''; // Invert delta when panning x-scales.

  var extent = "".concat(anchor, ".extent_").concat(channel);
  var offset = "".concat(sign).concat(delta, ".").concat(channel, " / ") + (hasScales ? "".concat(sizeSg) : "span(".concat(extent, ")"));
  var panFn = !hasScales ? 'panLinear' : scaleType === 'log' ? 'panLog' : scaleType === 'pow' ? 'panPow' : 'panLinear';
  var update = "".concat(panFn, "(").concat(extent, ", ").concat(offset) + (hasScales && scaleType === 'pow' ? ", ".concat((_a = scaleCmpt.get('exponent')) !== null && _a !== void 0 ? _a : 1) : '') + ')';
  signal.on.push({
    events: {
      signal: delta
    },
    update: hasScales ? update : "clampRange(".concat(update, ", 0, ").concat(sizeSg, ")")
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/zoom.js










var zoom_ANCHOR = '_zoom_anchor';
var zoom_DELTA = '_zoom_delta';
var zoom_zoom = {
  has: function has(selCmpt) {
    return selCmpt.type === 'interval' && selCmpt.zoom;
  },
  signals: function signals(model, selCmpt, _signals) {
    var name = selCmpt.name;
    var hasScales = transforms_scales.has(selCmpt);
    var delta = name + zoom_DELTA;
    var _selCmpt$project$hasC = selCmpt.project.hasChannel,
        x = _selCmpt$project$hasC.x,
        y = _selCmpt$project$hasC.y;
    var sx = stringValue_$(model.scaleName(channel_X));
    var sy = stringValue_$(model.scaleName(channel_Y));
    var events = vega_event_selector_module_eventSelector(selCmpt.zoom, 'scope');

    if (!hasScales) {
      events = events.map(function (e) {
        return e.markname = name + BRUSH, e;
      });
    }

    _signals.push({
      name: name + zoom_ANCHOR,
      on: [{
        events: events,
        update: !hasScales ? "{x: x(unit), y: y(unit)}" : '{' + [sx ? "x: invert(".concat(sx, ", x(unit))") : '', sy ? "y: invert(".concat(sy, ", y(unit))") : ''].filter(function (expr) {
          return !!expr;
        }).join(', ') + '}'
      }]
    }, {
      name: delta,
      on: [{
        events: events,
        force: true,
        update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))'
      }]
    });

    if (x !== undefined) {
      zoom_onDelta(model, selCmpt, x, 'width', _signals);
    }

    if (y !== undefined) {
      zoom_onDelta(model, selCmpt, y, 'height', _signals);
    }

    return _signals;
  }
};
/* harmony default export */ var transforms_zoom = (zoom_zoom);

function zoom_onDelta(model, selCmpt, proj, size, signals) {
  var _a;

  var name = selCmpt.name;
  var channel = proj.channel;
  var hasScales = transforms_scales.has(selCmpt);
  var signal = signals.filter(function (s) {
    return s.name === proj.signals[hasScales ? 'data' : 'visual'];
  })[0];
  var sizeSg = model.getSizeSignalRef(size).signal;
  var scaleCmpt = model.getScaleComponent(channel);
  var scaleType = scaleCmpt.get('type');
  var base = hasScales ? scales_domain(model, channel) : signal.name;
  var delta = name + zoom_DELTA;
  var anchor = "".concat(name).concat(zoom_ANCHOR, ".").concat(channel);
  var zoomFn = !hasScales ? 'zoomLinear' : scaleType === 'log' ? 'zoomLog' : scaleType === 'pow' ? 'zoomPow' : 'zoomLinear';
  var update = "".concat(zoomFn, "(").concat(base, ", ").concat(anchor, ", ").concat(delta) + (hasScales && scaleType === 'pow' ? ", ".concat((_a = scaleCmpt.get('exponent')) !== null && _a !== void 0 ? _a : 1) : '') + ')';
  signal.on.push({
    events: {
      signal: delta
    },
    update: hasScales ? update : "clampRange(".concat(update, ", 0, ").concat(sizeSg, ")")
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/transforms/transforms.js










var compilers = [transforms_project, transforms_toggle, transforms_scales, transforms_legends, transforms_translate, transforms_zoom, transforms_inputs, transforms_nearest, transforms_clear];
function forEachTransform(selCmpt, cb) {
  var _iterator = _createForOfIteratorHelper(compilers),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var t = _step.value;

      if (t.has(selCmpt)) {
        cb(t);
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/assemble.js



















function assembleInit(init) {
  var isExpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  var wrap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : accessors_identity;

  if (isArray(init)) {
    var assembled = init.map(function (v) {
      return assembleInit(v, isExpr, wrap);
    });
    return isExpr ? "[".concat(assembled.join(', '), "]") : assembled;
  } else if (isDateTime(init)) {
    if (isExpr) {
      return wrap(dateTimeToExpr(init));
    } else {
      return wrap(dateTimeToTimestamp(init));
    }
  }

  return isExpr ? wrap(JSON.stringify(init)) : init;
}
function assembleUnitSelectionSignals(model, signals) {
  forEachSelection(model, function (selCmpt, selCompiler) {
    var _signals;

    var name = selCmpt.name;
    var modifyExpr = selCompiler.modifyExpr(model, selCmpt);

    (_signals = signals).push.apply(_signals, _toConsumableArray(selCompiler.signals(model, selCmpt)));

    forEachTransform(selCmpt, function (txCompiler) {
      if (txCompiler.signals) {
        signals = txCompiler.signals(model, selCmpt, signals);
      }

      if (txCompiler.modifyExpr) {
        modifyExpr = txCompiler.modifyExpr(model, selCmpt, modifyExpr);
      }
    });
    signals.push({
      name: name + MODIFY,
      on: [{
        events: {
          signal: selCmpt.name + TUPLE
        },
        update: "modify(".concat(stringValue_$(selCmpt.name + STORE), ", ").concat(modifyExpr, ")")
      }]
    });
  });
  return cleanupEmptyOnArray(signals);
}
function assembleFacetSignals(model, signals) {
  if (model.component.selection && util_keys(model.component.selection).length) {
    var name = stringValue_$(model.getName('cell'));
    signals.unshift({
      name: 'facet',
      value: {},
      on: [{
        events: vega_event_selector_module_eventSelector('mousemove', 'scope'),
        update: "isTuple(facet) ? facet : group(".concat(name, ").datum")
      }]
    });
  }

  return cleanupEmptyOnArray(signals);
}
function assembleTopLevelSignals(model, signals) {
  var hasSelections = false;
  forEachSelection(model, function (selCmpt, selCompiler) {
    var name = selCmpt.name;
    var store = stringValue_$(name + STORE);
    var hasSg = signals.filter(function (s) {
      return s.name === name;
    });

    if (hasSg.length === 0) {
      var resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve;
      var isMulti = selCmpt.type === 'multi' ? ', true)' : ')';
      signals.push({
        name: selCmpt.name,
        update: "".concat(VL_SELECTION_RESOLVE, "(").concat(store, ", ").concat(stringValue_$(resolve)).concat(isMulti)
      });
    }

    hasSelections = true;

    if (selCompiler.topLevelSignals) {
      signals = selCompiler.topLevelSignals(model, selCmpt, signals);
    }

    forEachTransform(selCmpt, function (txCompiler) {
      if (txCompiler.topLevelSignals) {
        signals = txCompiler.topLevelSignals(model, selCmpt, signals);
      }
    });
  });

  if (hasSelections) {
    var hasUnit = signals.filter(function (s) {
      return s.name === 'unit';
    });

    if (hasUnit.length === 0) {
      signals.unshift({
        name: 'unit',
        value: {},
        on: [{
          events: 'mousemove',
          update: 'isTuple(group()) ? group() : unit'
        }]
      });
    }
  }

  return cleanupEmptyOnArray(signals);
}
function assembleUnitSelectionData(model, data) {
  var dataCopy = _toConsumableArray(data);

  forEachSelection(model, function (selCmpt) {
    var init = {
      name: selCmpt.name + STORE
    };

    if (selCmpt.init) {
      var fields = selCmpt.project.items.map(function (proj) {
        var signals = proj.signals,
            rest = __rest(proj, ["signals"]);

        return rest;
      });
      var insert = selCmpt.init.map(function (i) {
        return assembleInit(i, false);
      });
      init.values = selCmpt.type === 'interval' ? [{
        unit: selection_unitName(model, {
          escape: false
        }),
        fields: fields,
        values: insert
      }] : insert.map(function (i) {
        return {
          unit: selection_unitName(model, {
            escape: false
          }),
          fields: fields,
          values: i
        };
      });
    }

    var contains = dataCopy.filter(function (d) {
      return d.name === selCmpt.name + STORE;
    });

    if (!contains.length) {
      dataCopy.push(init);
    }
  });
  return dataCopy;
}
function assembleUnitSelectionMarks(model, marks) {
  forEachSelection(model, function (selCmpt, selCompiler) {
    marks = selCompiler.marks ? selCompiler.marks(model, selCmpt, marks) : marks;
    forEachTransform(selCmpt, function (txCompiler) {
      if (txCompiler.marks) {
        marks = txCompiler.marks(model, selCmpt, marks);
      }
    });
  });
  return marks;
}
function assembleLayerSelectionMarks(model, marks) {
  var _iterator = _createForOfIteratorHelper(model.children),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var child = _step.value;

      if (isUnitModel(child)) {
        marks = assembleUnitSelectionMarks(child, marks);
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return marks;
}
function assembleSelectionScaleDomain(model, extent) {
  var name = extent.selection;
  var selCmpt = model.getSelectionComponent(name, varName(name));
  return {
    signal: parseSelectionBinExtent(selCmpt, extent)
  };
}

function cleanupEmptyOnArray(signals) {
  return signals.map(function (s) {
    if (s.on && !s.on.length) delete s.on;
    return s;
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/interval.js























var BRUSH = '_brush';
var SCALE_TRIGGER = '_scale_trigger';
var interval_interval = {
  signals: function signals(model, selCmpt) {
    var name = selCmpt.name;
    var fieldsSg = name + TUPLE_FIELDS;
    var hasScales = transforms_scales.has(selCmpt);
    var signals = [];
    var dataSignals = [];
    var scaleTriggers = [];

    if (selCmpt.translate && !hasScales) {
      var filterExpr = "!event.item || event.item.mark.name !== ".concat(stringValue_$(name + BRUSH));
      interval_events(selCmpt, function (on, evt) {
        var _a;

        var filters = vega_util_src_array((_a = evt.between[0].filter) !== null && _a !== void 0 ? _a : evt.between[0].filter = []);

        if (filters.indexOf(filterExpr) < 0) {
          filters.push(filterExpr);
        }

        return on;
      });
    }

    selCmpt.project.items.forEach(function (proj, i) {
      var channel = proj.channel;

      if (channel !== channel_X && channel !== channel_Y) {
        log_warn('Interval selections only support x and y encoding channels.');
        return;
      }

      var init = selCmpt.init ? selCmpt.init[i] : null;
      var cs = channelSignals(model, selCmpt, proj, init);
      var dname = proj.signals.data;
      var vname = proj.signals.visual;
      var scaleName = stringValue_$(model.scaleName(channel));
      var scaleType = model.getScaleComponent(channel).get('type');
      var toNum = hasContinuousDomain(scaleType) ? '+' : '';
      signals.push.apply(signals, _toConsumableArray(cs));
      dataSignals.push(dname);
      scaleTriggers.push({
        scaleName: model.scaleName(channel),
        expr: "(!isArray(".concat(dname, ") || ") + "(".concat(toNum, "invert(").concat(scaleName, ", ").concat(vname, ")[0] === ").concat(toNum).concat(dname, "[0] && ") + "".concat(toNum, "invert(").concat(scaleName, ", ").concat(vname, ")[1] === ").concat(toNum).concat(dname, "[1]))")
      });
    }); // Proxy scale reactions to ensure that an infinite loop doesn't occur
    // when an interval selection filter touches the scale.

    if (!hasScales) {
      signals.push({
        name: name + SCALE_TRIGGER,
        value: {},
        on: [{
          events: scaleTriggers.map(function (t) {
            return {
              scale: t.scaleName
            };
          }),
          update: scaleTriggers.map(function (t) {
            return t.expr;
          }).join(' && ') + " ? ".concat(name + SCALE_TRIGGER, " : {}")
        }]
      });
    } // Only add an interval to the store if it has valid data extents. Data extents
    // are set to null if pixel extents are equal to account for intervals over
    // ordinal/nominal domains which, when inverted, will still produce a valid datum.


    var init = selCmpt.init;
    var update = "unit: ".concat(selection_unitName(model), ", fields: ").concat(fieldsSg, ", values");
    return signals.concat(Object.assign(Object.assign({
      name: name + TUPLE
    }, init ? {
      init: "{".concat(update, ": ").concat(assembleInit(init), "}")
    } : {}), {
      on: [{
        events: [{
          signal: dataSignals.join(' || ')
        }],
        update: dataSignals.join(' && ') + " ? {".concat(update, ": [").concat(dataSignals, "]} : null")
      }]
    }));
  },
  modifyExpr: function modifyExpr(model, selCmpt) {
    var tpl = selCmpt.name + TUPLE;
    return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : "{unit: ".concat(selection_unitName(model), "}"));
  },
  marks: function marks(model, selCmpt, _marks) {
    var name = selCmpt.name;
    var _selCmpt$project$hasC = selCmpt.project.hasChannel,
        x = _selCmpt$project$hasC.x,
        y = _selCmpt$project$hasC.y;
    var xvname = x && x.signals.visual;
    var yvname = y && y.signals.visual;
    var store = "data(".concat(stringValue_$(selCmpt.name + STORE), ")"); // Do not add a brush if we're binding to scales.

    if (transforms_scales.has(selCmpt)) {
      return _marks;
    }

    var update = {
      x: x !== undefined ? {
        signal: "".concat(xvname, "[0]")
      } : {
        value: 0
      },
      y: y !== undefined ? {
        signal: "".concat(yvname, "[0]")
      } : {
        value: 0
      },
      x2: x !== undefined ? {
        signal: "".concat(xvname, "[1]")
      } : {
        field: {
          group: 'width'
        }
      },
      y2: y !== undefined ? {
        signal: "".concat(yvname, "[1]")
      } : {
        field: {
          group: 'height'
        }
      }
    }; // If the selection is resolved to global, only a single interval is in
    // the store. Wrap brush mark's encodings with a production rule to test
    // this based on the `unit` property. Hide the brush mark if it corresponds
    // to a unit different from the one in the store.

    if (selCmpt.resolve === 'global') {
      var _iterator = _createForOfIteratorHelper(util_keys(update)),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var key = _step.value;
          update[key] = [Object.assign({
            test: "".concat(store, ".length && ").concat(store, "[0].unit === ").concat(selection_unitName(model))
          }, update[key]), {
            value: 0
          }];
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
    } // Two brush marks ensure that fill colors and other aesthetic choices do
    // not interefere with the core marks, but that the brushed region can still
    // be interacted with (e.g., dragging it around).


    var _a = selCmpt.mark,
        fill = _a.fill,
        fillOpacity = _a.fillOpacity,
        cursor = _a.cursor,
        stroke = __rest(_a, ["fill", "fillOpacity", "cursor"]);

    var vgStroke = util_keys(stroke).reduce(function (def, k) {
      def[k] = [{
        test: [x !== undefined && "".concat(xvname, "[0] !== ").concat(xvname, "[1]"), y !== undefined && "".concat(yvname, "[0] !== ").concat(yvname, "[1]")].filter(function (t) {
          return t;
        }).join(' && '),
        value: stroke[k]
      }, {
        value: null
      }];
      return def;
    }, {});
    return [{
      name: name + BRUSH + '_bg',
      type: 'rect',
      clip: true,
      encode: {
        enter: {
          fill: {
            value: fill
          },
          fillOpacity: {
            value: fillOpacity
          }
        },
        update: update
      }
    }].concat(_toConsumableArray(_marks), [{
      name: name + BRUSH,
      type: 'rect',
      clip: true,
      encode: {
        enter: Object.assign(Object.assign({}, cursor ? {
          cursor: {
            value: cursor
          }
        } : {}), {
          fill: {
            value: 'transparent'
          }
        }),
        update: Object.assign(Object.assign({}, update), vgStroke)
      }
    }]);
  }
};
/* harmony default export */ var selection_interval = (interval_interval);
/**
 * Returns the visual and data signals for an interval selection.
 */

function channelSignals(model, selCmpt, proj, init) {
  var channel = proj.channel;
  var vname = proj.signals.visual;
  var dname = proj.signals.data;
  var hasScales = transforms_scales.has(selCmpt);
  var scaleName = stringValue_$(model.scaleName(channel));
  var scale = model.getScaleComponent(channel);
  var scaleType = scale ? scale.get('type') : undefined;

  var scaled = function scaled(str) {
    return "scale(".concat(scaleName, ", ").concat(str, ")");
  };

  var size = model.getSizeSignalRef(channel === channel_X ? 'width' : 'height').signal;
  var coord = "".concat(channel, "(unit)");
  var on = interval_events(selCmpt, function (def, evt) {
    return [].concat(_toConsumableArray(def), [{
      events: evt.between[0],
      update: "[".concat(coord, ", ").concat(coord, "]")
    }, {
      events: evt,
      update: "[".concat(vname, "[0], clamp(").concat(coord, ", 0, ").concat(size, ")]")
    } // Brush End
    ]);
  }); // React to pan/zooms of continuous scales. Non-continuous scales
  // (band, point) cannot be pan/zoomed and any other changes
  // to their domains (e.g., filtering) should clear the brushes.

  on.push({
    events: {
      signal: selCmpt.name + SCALE_TRIGGER
    },
    update: hasContinuousDomain(scaleType) ? "[".concat(scaled("".concat(dname, "[0]")), ", ").concat(scaled("".concat(dname, "[1]")), "]") : "[0, 0]"
  });
  return hasScales ? [{
    name: dname,
    on: []
  }] : [Object.assign(Object.assign({
    name: vname
  }, init ? {
    init: assembleInit(init, true, scaled)
  } : {
    value: []
  }), {
    on: on
  }), Object.assign(Object.assign({
    name: dname
  }, init ? {
    init: assembleInit(init)
  } : {}), {
    on: [{
      events: {
        signal: vname
      },
      update: "".concat(vname, "[0] === ").concat(vname, "[1] ? null : invert(").concat(scaleName, ", ").concat(vname, ")")
    }]
  })];
}

function interval_events(selCmpt, cb) {
  return selCmpt.events.reduce(function (on, evt) {
    if (!evt.between) {
      log_warn("".concat(evt, " is not an ordered event stream for interval selections."));
      return on;
    }

    return cb(on, evt);
  }, []);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/multi.js







function singleOrMultiSignals(model, selCmpt) {
  var name = selCmpt.name;
  var fieldsSg = name + TUPLE_FIELDS;
  var project = selCmpt.project;
  var datum = '(item().isVoronoi ? datum.datum : datum)';
  var values = project.items.map(function (p) {
    var fieldDef = model.fieldDef(p.channel); // Binned fields should capture extents, for a range test against the raw field.

    return fieldDef && fieldDef.bin ? "[".concat(datum, "[").concat(stringValue_$(model.vgField(p.channel, {})), "], ") + "".concat(datum, "[").concat(stringValue_$(model.vgField(p.channel, {
      binSuffix: 'end'
    })), "]]") : "".concat(datum, "[").concat(stringValue_$(p.field), "]");
  }).join(', '); // Only add a discrete selection to the store if a datum is present _and_
  // the interaction isn't occurring on a group mark. This guards against
  // polluting interactive state with invalid values in faceted displays
  // as the group marks are also data-driven. We force the update to account
  // for constant null states but varying toggles (e.g., shift-click in
  // whitespace followed by a click in whitespace; the store should only
  // be cleared on the second click).

  var update = "unit: ".concat(selection_unitName(model), ", fields: ").concat(fieldsSg, ", values");
  var events = selCmpt.events;
  return [{
    name: name + TUPLE,
    on: events ? [{
      events: events,
      update: "datum && item().mark.marktype !== 'group' ? {".concat(update, ": [").concat(values, "]} : null"),
      force: true
    }] : []
  }];
}
var multi = {
  signals: singleOrMultiSignals,
  modifyExpr: function modifyExpr(model, selCmpt) {
    var tpl = selCmpt.name + TUPLE;
    return tpl + ', ' + (selCmpt.resolve === 'global' ? 'null' : "{unit: ".concat(selection_unitName(model), "}"));
  }
};
/* harmony default export */ var selection_multi = (multi);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/single.js



var single = {
  signals: singleOrMultiSignals,
  modifyExpr: function modifyExpr(model, selCmpt) {
    var tpl = selCmpt.name + TUPLE;
    return tpl + ', ' + (selCmpt.resolve === 'global' ? 'true' : "{unit: ".concat(selection_unitName(model), "}"));
  }
};
/* harmony default export */ var selection_single = (single);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/index.js












var STORE = '_store';
var TUPLE = '_tuple';
var MODIFY = '_modify';
var SELECTION_DOMAIN = '_selection_domain_';
var VL_SELECTION_RESOLVE = 'vlSelectionResolve';
var selection_compilers = {
  single: selection_single,
  multi: selection_multi,
  interval: selection_interval
};
function forEachSelection(model, cb) {
  var selections = model.component.selection;

  if (selections) {
    var _iterator = _createForOfIteratorHelper(util_vals(selections)),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var sel = _step.value;
        var success = cb(sel, selection_compilers[sel.type]);
        if (success === true) break;
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
  }
}

function getFacetModel(model) {
  var parent = model.parent;

  while (parent) {
    if (isFacetModel(parent)) {
      break;
    }

    parent = parent.parent;
  }

  return parent;
}

function selection_unitName(model) {
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
    escape: true
  },
      escape = _ref.escape;

  var name = escape ? stringValue_$(model.name) : model.name;
  var facetModel = getFacetModel(model);

  if (facetModel) {
    var facet = facetModel.facet;

    var _iterator2 = _createForOfIteratorHelper(FACET_CHANNELS),
        _step2;

    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var channel = _step2.value;

        if (facet[channel]) {
          name += " + '__facet_".concat(channel, "_' + (facet[").concat(stringValue_$(facetModel.vgField(channel)), "])");
        }
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
  }

  return name;
}
function requiresSelectionId(model) {
  var identifier = false;
  forEachSelection(model, function (selCmpt) {
    identifier = identifier || selCmpt.project.items.some(function (proj) {
      return proj.field === selection_SELECTION_ID;
    });
  });
  return identifier;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-expression/src/ast.js

var ast_RawCode = 'RawCode';
var ast_Literal = 'Literal';
var ast_Property = 'Property';
var ast_Identifier = 'Identifier';
var ast_ArrayExpression = 'ArrayExpression';
var ast_BinaryExpression = 'BinaryExpression';
var ast_CallExpression = 'CallExpression';
var ast_ConditionalExpression = 'ConditionalExpression';
var ast_LogicalExpression = 'LogicalExpression';
var ast_MemberExpression = 'MemberExpression';
var ast_ObjectExpression = 'ObjectExpression';
var ast_UnaryExpression = 'UnaryExpression';
function ast_ASTNode(type) {
  this.type = type;
}

ast_ASTNode.prototype.visit = function (visitor) {
  var c, i, n;
  if (visitor(this)) return 1;

  for (c = ast_children(this), i = 0, n = c.length; i < n; ++i) {
    if (c[i].visit(visitor)) return 1;
  }
};

function ast_children(node) {
  switch (node.type) {
    case ast_ArrayExpression:
      return node.elements;

    case ast_BinaryExpression:
    case ast_LogicalExpression:
      return [node.left, node.right];

    case ast_CallExpression:
      return [node.callee].concat(node.arguments);

    case ast_ConditionalExpression:
      return [node.test, node.consequent, node.alternate];

    case ast_MemberExpression:
      return [node.object, node.property];

    case ast_ObjectExpression:
      return node.properties;

    case ast_Property:
      return [node.key, node.value];

    case ast_UnaryExpression:
      return [node.argument];

    case ast_Identifier:
    case ast_Literal:
    case ast_RawCode:
    default:
      return [];
  }
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.search.js
var es_string_search = __webpack_require__("841c");

// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-expression/src/parser.js













/*
  The following expression parser is based on Esprima (http://esprima.org/).
  Original header comment and license for Esprima is included here:

  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
  Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be>
  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
  Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
  Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
  Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
  Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
  Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

var parser_TokenName, parser_source, parser_index, parser_length, parser_lookahead;
var parser_TokenBooleanLiteral = 1,
    parser_TokenEOF = 2,
    parser_TokenIdentifier = 3,
    parser_TokenKeyword = 4,
    parser_TokenNullLiteral = 5,
    parser_TokenNumericLiteral = 6,
    parser_TokenPunctuator = 7,
    parser_TokenStringLiteral = 8,
    parser_TokenRegularExpression = 9;
parser_TokenName = {};
parser_TokenName[parser_TokenBooleanLiteral] = 'Boolean';
parser_TokenName[parser_TokenEOF] = '<end>';
parser_TokenName[parser_TokenIdentifier] = 'Identifier';
parser_TokenName[parser_TokenKeyword] = 'Keyword';
parser_TokenName[parser_TokenNullLiteral] = 'Null';
parser_TokenName[parser_TokenNumericLiteral] = 'Numeric';
parser_TokenName[parser_TokenPunctuator] = 'Punctuator';
parser_TokenName[parser_TokenStringLiteral] = 'String';
parser_TokenName[parser_TokenRegularExpression] = 'RegularExpression';
var parser_SyntaxArrayExpression = 'ArrayExpression',
    parser_SyntaxBinaryExpression = 'BinaryExpression',
    parser_SyntaxCallExpression = 'CallExpression',
    parser_SyntaxConditionalExpression = 'ConditionalExpression',
    parser_SyntaxIdentifier = 'Identifier',
    parser_SyntaxLiteral = 'Literal',
    parser_SyntaxLogicalExpression = 'LogicalExpression',
    parser_SyntaxMemberExpression = 'MemberExpression',
    parser_SyntaxObjectExpression = 'ObjectExpression',
    parser_SyntaxProperty = 'Property',
    parser_SyntaxUnaryExpression = 'UnaryExpression'; // Error messages should be identical to V8.

var parser_MessageUnexpectedToken = 'Unexpected token %0',
    parser_MessageUnexpectedNumber = 'Unexpected number',
    parser_MessageUnexpectedString = 'Unexpected string',
    parser_MessageUnexpectedIdentifier = 'Unexpected identifier',
    parser_MessageUnexpectedReserved = 'Unexpected reserved word',
    parser_MessageUnexpectedEOS = 'Unexpected end of input',
    parser_MessageInvalidRegExp = 'Invalid regular expression',
    parser_MessageUnterminatedRegExp = 'Invalid regular expression: missing /',
    parser_MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.',
    parser_MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';
var parser_ILLEGAL = 'ILLEGAL',
    parser_DISABLED = 'Disabled.'; // See also tools/generate-unicode-regex.py.

var parser_RegexNonAsciiIdentifierStart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),
    // eslint-disable-next-line no-misleading-character-class
parser_RegexNonAsciiIdentifierPart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"); // Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.

function parser_assert(condition, message) {
  /* istanbul ignore next */
  if (!condition) {
    throw new Error('ASSERT: ' + message);
  }
}

function parser_isDecimalDigit(ch) {
  return ch >= 0x30 && ch <= 0x39; // 0..9
}

function parser_isHexDigit(ch) {
  return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
}

function parser_isOctalDigit(ch) {
  return '01234567'.indexOf(ch) >= 0;
} // 7.2 White Space


function parser_isWhiteSpace(ch) {
  return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0;
} // 7.3 Line Terminators


function parser_isLineTerminator(ch) {
  return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
} // 7.6 Identifier Names and Identifiers


function parser_isIdentifierStart(ch) {
  return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore)
  ch >= 0x41 && ch <= 0x5A || // A..Z
  ch >= 0x61 && ch <= 0x7A || // a..z
  ch === 0x5C || // \ (backslash)
  ch >= 0x80 && parser_RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));
}

function parser_isIdentifierPart(ch) {
  return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore)
  ch >= 0x41 && ch <= 0x5A || // A..Z
  ch >= 0x61 && ch <= 0x7A || // a..z
  ch >= 0x30 && ch <= 0x39 || // 0..9
  ch === 0x5C || // \ (backslash)
  ch >= 0x80 && parser_RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));
} // 7.6.1.1 Keywords


var parser_keywords = {
  'if': 1,
  'in': 1,
  'do': 1,
  'var': 1,
  'for': 1,
  'new': 1,
  'try': 1,
  'let': 1,
  'this': 1,
  'else': 1,
  'case': 1,
  'void': 1,
  'with': 1,
  'enum': 1,
  'while': 1,
  'break': 1,
  'catch': 1,
  'throw': 1,
  'const': 1,
  'yield': 1,
  'class': 1,
  'super': 1,
  'return': 1,
  'typeof': 1,
  'delete': 1,
  'switch': 1,
  'export': 1,
  'import': 1,
  'public': 1,
  'static': 1,
  'default': 1,
  'finally': 1,
  'extends': 1,
  'package': 1,
  'private': 1,
  'function': 1,
  'continue': 1,
  'debugger': 1,
  'interface': 1,
  'protected': 1,
  'instanceof': 1,
  'implements': 1
};

function parser_skipComment() {
  var ch;

  while (parser_index < parser_length) {
    ch = parser_source.charCodeAt(parser_index);

    if (parser_isWhiteSpace(ch) || parser_isLineTerminator(ch)) {
      ++parser_index;
    } else {
      break;
    }
  }
}

function parser_scanHexEscape(prefix) {
  var i,
      len,
      ch,
      code = 0;
  len = prefix === 'u' ? 4 : 2;

  for (i = 0; i < len; ++i) {
    if (parser_index < parser_length && parser_isHexDigit(parser_source[parser_index])) {
      ch = parser_source[parser_index++];
      code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
    } else {
      parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
    }
  }

  return String.fromCharCode(code);
}

function parser_scanUnicodeCodePointEscape() {
  var ch, code, cu1, cu2;
  ch = parser_source[parser_index];
  code = 0; // At least, one hex digit is required.

  if (ch === '}') {
    parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
  }

  while (parser_index < parser_length) {
    ch = parser_source[parser_index++];

    if (!parser_isHexDigit(ch)) {
      break;
    }

    code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
  }

  if (code > 0x10FFFF || ch !== '}') {
    parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
  } // UTF-16 Encoding


  if (code <= 0xFFFF) {
    return String.fromCharCode(code);
  }

  cu1 = (code - 0x10000 >> 10) + 0xD800;
  cu2 = (code - 0x10000 & 1023) + 0xDC00;
  return String.fromCharCode(cu1, cu2);
}

function parser_getEscapedIdentifier() {
  var ch, id;
  ch = parser_source.charCodeAt(parser_index++);
  id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.

  if (ch === 0x5C) {
    if (parser_source.charCodeAt(parser_index) !== 0x75) {
      parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
    }

    ++parser_index;
    ch = parser_scanHexEscape('u');

    if (!ch || ch === '\\' || !parser_isIdentifierStart(ch.charCodeAt(0))) {
      parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
    }

    id = ch;
  }

  while (parser_index < parser_length) {
    ch = parser_source.charCodeAt(parser_index);

    if (!parser_isIdentifierPart(ch)) {
      break;
    }

    ++parser_index;
    id += String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.

    if (ch === 0x5C) {
      id = id.substr(0, id.length - 1);

      if (parser_source.charCodeAt(parser_index) !== 0x75) {
        parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
      }

      ++parser_index;
      ch = parser_scanHexEscape('u');

      if (!ch || ch === '\\' || !parser_isIdentifierPart(ch.charCodeAt(0))) {
        parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
      }

      id += ch;
    }
  }

  return id;
}

function parser_getIdentifier() {
  var start, ch;
  start = parser_index++;

  while (parser_index < parser_length) {
    ch = parser_source.charCodeAt(parser_index);

    if (ch === 0x5C) {
      // Blackslash (U+005C) marks Unicode escape sequence.
      parser_index = start;
      return parser_getEscapedIdentifier();
    }

    if (parser_isIdentifierPart(ch)) {
      ++parser_index;
    } else {
      break;
    }
  }

  return parser_source.slice(start, parser_index);
}

function parser_scanIdentifier() {
  var start, id, type;
  start = parser_index; // Backslash (U+005C) starts an escaped character.

  id = parser_source.charCodeAt(parser_index) === 0x5C ? parser_getEscapedIdentifier() : parser_getIdentifier(); // There is no keyword or literal with only one character.
  // Thus, it must be an identifier.

  if (id.length === 1) {
    type = parser_TokenIdentifier;
  } else if (parser_keywords.hasOwnProperty(id)) {
    // eslint-disable-line no-prototype-builtins
    type = parser_TokenKeyword;
  } else if (id === 'null') {
    type = parser_TokenNullLiteral;
  } else if (id === 'true' || id === 'false') {
    type = parser_TokenBooleanLiteral;
  } else {
    type = parser_TokenIdentifier;
  }

  return {
    type: type,
    value: id,
    start: start,
    end: parser_index
  };
} // 7.7 Punctuators


function parser_scanPunctuator() {
  var start = parser_index,
      code = parser_source.charCodeAt(parser_index),
      code2,
      ch1 = parser_source[parser_index],
      ch2,
      ch3,
      ch4;

  switch (code) {
    // Check for most common single-character punctuators.
    case 0x2E: // . dot

    case 0x28: // ( open bracket

    case 0x29: // ) close bracket

    case 0x3B: // ; semicolon

    case 0x2C: // , comma

    case 0x7B: // { open curly brace

    case 0x7D: // } close curly brace

    case 0x5B: // [

    case 0x5D: // ]

    case 0x3A: // :

    case 0x3F: // ?

    case 0x7E:
      // ~
      ++parser_index;
      return {
        type: parser_TokenPunctuator,
        value: String.fromCharCode(code),
        start: start,
        end: parser_index
      };

    default:
      code2 = parser_source.charCodeAt(parser_index + 1); // '=' (U+003D) marks an assignment or comparison operator.

      if (code2 === 0x3D) {
        switch (code) {
          case 0x2B: // +

          case 0x2D: // -

          case 0x2F: // /

          case 0x3C: // <

          case 0x3E: // >

          case 0x5E: // ^

          case 0x7C: // |

          case 0x25: // %

          case 0x26: // &

          case 0x2A:
            // *
            parser_index += 2;
            return {
              type: parser_TokenPunctuator,
              value: String.fromCharCode(code) + String.fromCharCode(code2),
              start: start,
              end: parser_index
            };

          case 0x21: // !

          case 0x3D:
            // =
            parser_index += 2; // !== and ===

            if (parser_source.charCodeAt(parser_index) === 0x3D) {
              ++parser_index;
            }

            return {
              type: parser_TokenPunctuator,
              value: parser_source.slice(start, parser_index),
              start: start,
              end: parser_index
            };
        }
      }

  } // 4-character punctuator: >>>=


  ch4 = parser_source.substr(parser_index, 4);

  if (ch4 === '>>>=') {
    parser_index += 4;
    return {
      type: parser_TokenPunctuator,
      value: ch4,
      start: start,
      end: parser_index
    };
  } // 3-character punctuators: === !== >>> <<= >>=


  ch3 = ch4.substr(0, 3);

  if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {
    parser_index += 3;
    return {
      type: parser_TokenPunctuator,
      value: ch3,
      start: start,
      end: parser_index
    };
  } // Other 2-character punctuators: ++ -- << >> && ||


  ch2 = ch3.substr(0, 2);

  if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') {
    parser_index += 2;
    return {
      type: parser_TokenPunctuator,
      value: ch2,
      start: start,
      end: parser_index
    };
  } // 1-character punctuators: < > = ! + - * % & | ^ /


  if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
    ++parser_index;
    return {
      type: parser_TokenPunctuator,
      value: ch1,
      start: start,
      end: parser_index
    };
  }

  parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
} // 7.8.3 Numeric Literals


function parser_scanHexLiteral(start) {
  var number = '';

  while (parser_index < parser_length) {
    if (!parser_isHexDigit(parser_source[parser_index])) {
      break;
    }

    number += parser_source[parser_index++];
  }

  if (number.length === 0) {
    parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
  }

  if (parser_isIdentifierStart(parser_source.charCodeAt(parser_index))) {
    parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
  }

  return {
    type: parser_TokenNumericLiteral,
    value: parseInt('0x' + number, 16),
    start: start,
    end: parser_index
  };
}

function parser_scanOctalLiteral(start) {
  var number = '0' + parser_source[parser_index++];

  while (parser_index < parser_length) {
    if (!parser_isOctalDigit(parser_source[parser_index])) {
      break;
    }

    number += parser_source[parser_index++];
  }

  if (parser_isIdentifierStart(parser_source.charCodeAt(parser_index)) || parser_isDecimalDigit(parser_source.charCodeAt(parser_index))) {
    parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
  }

  return {
    type: parser_TokenNumericLiteral,
    value: parseInt(number, 8),
    octal: true,
    start: start,
    end: parser_index
  };
}

function parser_scanNumericLiteral() {
  var number, start, ch;
  ch = parser_source[parser_index];
  parser_assert(parser_isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point');
  start = parser_index;
  number = '';

  if (ch !== '.') {
    number = parser_source[parser_index++];
    ch = parser_source[parser_index]; // Hex number starts with '0x'.
    // Octal number starts with '0'.

    if (number === '0') {
      if (ch === 'x' || ch === 'X') {
        ++parser_index;
        return parser_scanHexLiteral(start);
      }

      if (parser_isOctalDigit(ch)) {
        return parser_scanOctalLiteral(start);
      } // decimal number starts with '0' such as '09' is illegal.


      if (ch && parser_isDecimalDigit(ch.charCodeAt(0))) {
        parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
      }
    }

    while (parser_isDecimalDigit(parser_source.charCodeAt(parser_index))) {
      number += parser_source[parser_index++];
    }

    ch = parser_source[parser_index];
  }

  if (ch === '.') {
    number += parser_source[parser_index++];

    while (parser_isDecimalDigit(parser_source.charCodeAt(parser_index))) {
      number += parser_source[parser_index++];
    }

    ch = parser_source[parser_index];
  }

  if (ch === 'e' || ch === 'E') {
    number += parser_source[parser_index++];
    ch = parser_source[parser_index];

    if (ch === '+' || ch === '-') {
      number += parser_source[parser_index++];
    }

    if (parser_isDecimalDigit(parser_source.charCodeAt(parser_index))) {
      while (parser_isDecimalDigit(parser_source.charCodeAt(parser_index))) {
        number += parser_source[parser_index++];
      }
    } else {
      parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
    }
  }

  if (parser_isIdentifierStart(parser_source.charCodeAt(parser_index))) {
    parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
  }

  return {
    type: parser_TokenNumericLiteral,
    value: parseFloat(number),
    start: start,
    end: parser_index
  };
} // 7.8.4 String Literals


function parser_scanStringLiteral() {
  var str = '',
      quote,
      start,
      ch,
      code,
      octal = false;
  quote = parser_source[parser_index];
  parser_assert(quote === '\'' || quote === '"', 'String literal must starts with a quote');
  start = parser_index;
  ++parser_index;

  while (parser_index < parser_length) {
    ch = parser_source[parser_index++];

    if (ch === quote) {
      quote = '';
      break;
    } else if (ch === '\\') {
      ch = parser_source[parser_index++];

      if (!ch || !parser_isLineTerminator(ch.charCodeAt(0))) {
        switch (ch) {
          case 'u':
          case 'x':
            if (parser_source[parser_index] === '{') {
              ++parser_index;
              str += parser_scanUnicodeCodePointEscape();
            } else {
              str += parser_scanHexEscape(ch);
            }

            break;

          case 'n':
            str += '\n';
            break;

          case 'r':
            str += '\r';
            break;

          case 't':
            str += '\t';
            break;

          case 'b':
            str += '\b';
            break;

          case 'f':
            str += '\f';
            break;

          case 'v':
            str += '\x0B';
            break;

          default:
            if (parser_isOctalDigit(ch)) {
              code = '01234567'.indexOf(ch); // \0 is not octal escape sequence

              if (code !== 0) {
                octal = true;
              }

              if (parser_index < parser_length && parser_isOctalDigit(parser_source[parser_index])) {
                octal = true;
                code = code * 8 + '01234567'.indexOf(parser_source[parser_index++]); // 3 digits are only allowed when string starts
                // with 0, 1, 2, 3

                if ('0123'.indexOf(ch) >= 0 && parser_index < parser_length && parser_isOctalDigit(parser_source[parser_index])) {
                  code = code * 8 + '01234567'.indexOf(parser_source[parser_index++]);
                }
              }

              str += String.fromCharCode(code);
            } else {
              str += ch;
            }

            break;
        }
      } else {
        if (ch === '\r' && parser_source[parser_index] === '\n') {
          ++parser_index;
        }
      }
    } else if (parser_isLineTerminator(ch.charCodeAt(0))) {
      break;
    } else {
      str += ch;
    }
  }

  if (quote !== '') {
    parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
  }

  return {
    type: parser_TokenStringLiteral,
    value: str,
    octal: octal,
    start: start,
    end: parser_index
  };
}

function parser_testRegExp(pattern, flags) {
  var tmp = pattern;

  if (flags.indexOf('u') >= 0) {
    // Replace each astral symbol and every Unicode code point
    // escape sequence with a single ASCII symbol to avoid throwing on
    // regular expressions that are only valid in combination with the
    // `/u` flag.
    // Note: replacing with the ASCII symbol `x` might cause false
    // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
    // perfectly valid pattern that is equivalent to `[a-b]`, but it
    // would be replaced by `[x-b]` which throws an error.
    tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) {
      if (parseInt($1, 16) <= 0x10FFFF) {
        return 'x';
      }

      parser_throwError({}, parser_MessageInvalidRegExp);
    }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
  } // First, detect invalid regular expressions.


  try {
    new RegExp(tmp);
  } catch (e) {
    parser_throwError({}, parser_MessageInvalidRegExp);
  } // Return a regular expression object for this pattern-flag pair, or
  // `null` in case the current environment doesn't support the flags it
  // uses.


  try {
    return new RegExp(pattern, flags);
  } catch (exception) {
    return null;
  }
}

function parser_scanRegExpBody() {
  var ch, str, classMarker, terminated, body;
  ch = parser_source[parser_index];
  parser_assert(ch === '/', 'Regular expression literal must start with a slash');
  str = parser_source[parser_index++];
  classMarker = false;
  terminated = false;

  while (parser_index < parser_length) {
    ch = parser_source[parser_index++];
    str += ch;

    if (ch === '\\') {
      ch = parser_source[parser_index++]; // ECMA-262 7.8.5

      if (parser_isLineTerminator(ch.charCodeAt(0))) {
        parser_throwError({}, parser_MessageUnterminatedRegExp);
      }

      str += ch;
    } else if (parser_isLineTerminator(ch.charCodeAt(0))) {
      parser_throwError({}, parser_MessageUnterminatedRegExp);
    } else if (classMarker) {
      if (ch === ']') {
        classMarker = false;
      }
    } else {
      if (ch === '/') {
        terminated = true;
        break;
      } else if (ch === '[') {
        classMarker = true;
      }
    }
  }

  if (!terminated) {
    parser_throwError({}, parser_MessageUnterminatedRegExp);
  } // Exclude leading and trailing slash.


  body = str.substr(1, str.length - 2);
  return {
    value: body,
    literal: str
  };
}

function parser_scanRegExpFlags() {
  var ch, str, flags;
  str = '';
  flags = '';

  while (parser_index < parser_length) {
    ch = parser_source[parser_index];

    if (!parser_isIdentifierPart(ch.charCodeAt(0))) {
      break;
    }

    ++parser_index;

    if (ch === '\\' && parser_index < parser_length) {
      parser_throwError({}, parser_MessageUnexpectedToken, parser_ILLEGAL);
    } else {
      flags += ch;
      str += ch;
    }
  }

  if (flags.search(/[^gimuy]/g) >= 0) {
    parser_throwError({}, parser_MessageInvalidRegExp, flags);
  }

  return {
    value: flags,
    literal: str
  };
}

function parser_scanRegExp() {
  var start, body, flags, value;
  parser_lookahead = null;
  parser_skipComment();
  start = parser_index;
  body = parser_scanRegExpBody();
  flags = parser_scanRegExpFlags();
  value = parser_testRegExp(body.value, flags.value);
  return {
    literal: body.literal + flags.literal,
    value: value,
    regex: {
      pattern: body.value,
      flags: flags.value
    },
    start: start,
    end: parser_index
  };
}

function parser_isIdentifierName(token) {
  return token.type === parser_TokenIdentifier || token.type === parser_TokenKeyword || token.type === parser_TokenBooleanLiteral || token.type === parser_TokenNullLiteral;
}

function parser_advance() {
  var ch;
  parser_skipComment();

  if (parser_index >= parser_length) {
    return {
      type: parser_TokenEOF,
      start: parser_index,
      end: parser_index
    };
  }

  ch = parser_source.charCodeAt(parser_index);

  if (parser_isIdentifierStart(ch)) {
    return parser_scanIdentifier();
  } // Very common: ( and ) and ;


  if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {
    return parser_scanPunctuator();
  } // String literal starts with single quote (U+0027) or double quote (U+0022).


  if (ch === 0x27 || ch === 0x22) {
    return parser_scanStringLiteral();
  } // Dot (.) U+002E can also start a floating-point number, hence the need
  // to check the next character.


  if (ch === 0x2E) {
    if (parser_isDecimalDigit(parser_source.charCodeAt(parser_index + 1))) {
      return parser_scanNumericLiteral();
    }

    return parser_scanPunctuator();
  }

  if (parser_isDecimalDigit(ch)) {
    return parser_scanNumericLiteral();
  }

  return parser_scanPunctuator();
}

function parser_lex() {
  var token;
  token = parser_lookahead;
  parser_index = token.end;
  parser_lookahead = parser_advance();
  parser_index = token.end;
  return token;
}

function parser_peek() {
  var pos;
  pos = parser_index;
  parser_lookahead = parser_advance();
  parser_index = pos;
}

function parser_finishArrayExpression(elements) {
  var node = new ast_ASTNode(parser_SyntaxArrayExpression);
  node.elements = elements;
  return node;
}

function parser_finishBinaryExpression(operator, left, right) {
  var node = new ast_ASTNode(operator === '||' || operator === '&&' ? parser_SyntaxLogicalExpression : parser_SyntaxBinaryExpression);
  node.operator = operator;
  node.left = left;
  node.right = right;
  return node;
}

function parser_finishCallExpression(callee, args) {
  var node = new ast_ASTNode(parser_SyntaxCallExpression);
  node.callee = callee;
  node.arguments = args;
  return node;
}

function parser_finishConditionalExpression(test, consequent, alternate) {
  var node = new ast_ASTNode(parser_SyntaxConditionalExpression);
  node.test = test;
  node.consequent = consequent;
  node.alternate = alternate;
  return node;
}

function parser_finishIdentifier(name) {
  var node = new ast_ASTNode(parser_SyntaxIdentifier);
  node.name = name;
  return node;
}

function parser_finishLiteral(token) {
  var node = new ast_ASTNode(parser_SyntaxLiteral);
  node.value = token.value;
  node.raw = parser_source.slice(token.start, token.end);

  if (token.regex) {
    if (node.raw === '//') {
      node.raw = '/(?:)/';
    }

    node.regex = token.regex;
  }

  return node;
}

function parser_finishMemberExpression(accessor, object, property) {
  var node = new ast_ASTNode(parser_SyntaxMemberExpression);
  node.computed = accessor === '[';
  node.object = object;
  node.property = property;
  if (!node.computed) property.member = true;
  return node;
}

function parser_finishObjectExpression(properties) {
  var node = new ast_ASTNode(parser_SyntaxObjectExpression);
  node.properties = properties;
  return node;
}

function parser_finishProperty(kind, key, value) {
  var node = new ast_ASTNode(parser_SyntaxProperty);
  node.key = key;
  node.value = value;
  node.kind = kind;
  return node;
}

function parser_finishUnaryExpression(operator, argument) {
  var node = new ast_ASTNode(parser_SyntaxUnaryExpression);
  node.operator = operator;
  node.argument = argument;
  node.prefix = true;
  return node;
} // Throw an exception


function parser_throwError(token, messageFormat) {
  var error,
      args = Array.prototype.slice.call(arguments, 2),
      msg = messageFormat.replace(/%(\d)/g, function (whole, index) {
    parser_assert(index < args.length, 'Message reference must be in range');
    return args[index];
  });
  error = new Error(msg);
  error.index = parser_index;
  error.description = msg;
  throw error;
} // Throw an exception because of the token.


function parser_throwUnexpected(token) {
  if (token.type === parser_TokenEOF) {
    parser_throwError(token, parser_MessageUnexpectedEOS);
  }

  if (token.type === parser_TokenNumericLiteral) {
    parser_throwError(token, parser_MessageUnexpectedNumber);
  }

  if (token.type === parser_TokenStringLiteral) {
    parser_throwError(token, parser_MessageUnexpectedString);
  }

  if (token.type === parser_TokenIdentifier) {
    parser_throwError(token, parser_MessageUnexpectedIdentifier);
  }

  if (token.type === parser_TokenKeyword) {
    parser_throwError(token, parser_MessageUnexpectedReserved);
  } // BooleanLiteral, NullLiteral, or Punctuator.


  parser_throwError(token, parser_MessageUnexpectedToken, token.value);
} // Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.


function parser_expect(value) {
  var token = parser_lex();

  if (token.type !== parser_TokenPunctuator || token.value !== value) {
    parser_throwUnexpected(token);
  }
} // Return true if the next token matches the specified punctuator.


function parser_match(value) {
  return parser_lookahead.type === parser_TokenPunctuator && parser_lookahead.value === value;
} // Return true if the next token matches the specified keyword


function parser_matchKeyword(keyword) {
  return parser_lookahead.type === parser_TokenKeyword && parser_lookahead.value === keyword;
} // 11.1.4 Array Initialiser


function parser_parseArrayInitialiser() {
  var elements = [];
  parser_index = parser_lookahead.start;
  parser_expect('[');

  while (!parser_match(']')) {
    if (parser_match(',')) {
      parser_lex();
      elements.push(null);
    } else {
      elements.push(parser_parseConditionalExpression());

      if (!parser_match(']')) {
        parser_expect(',');
      }
    }
  }

  parser_lex();
  return parser_finishArrayExpression(elements);
} // 11.1.5 Object Initialiser


function parser_parseObjectPropertyKey() {
  var token;
  parser_index = parser_lookahead.start;
  token = parser_lex(); // Note: This function is called only from parseObjectProperty(), where
  // EOF and Punctuator tokens are already filtered out.

  if (token.type === parser_TokenStringLiteral || token.type === parser_TokenNumericLiteral) {
    if (token.octal) {
      parser_throwError(token, parser_MessageStrictOctalLiteral);
    }

    return parser_finishLiteral(token);
  }

  return parser_finishIdentifier(token.value);
}

function parser_parseObjectProperty() {
  var token, key, id, value;
  parser_index = parser_lookahead.start;
  token = parser_lookahead;

  if (token.type === parser_TokenIdentifier) {
    id = parser_parseObjectPropertyKey();
    parser_expect(':');
    value = parser_parseConditionalExpression();
    return parser_finishProperty('init', id, value);
  }

  if (token.type === parser_TokenEOF || token.type === parser_TokenPunctuator) {
    parser_throwUnexpected(token);
  } else {
    key = parser_parseObjectPropertyKey();
    parser_expect(':');
    value = parser_parseConditionalExpression();
    return parser_finishProperty('init', key, value);
  }
}

function parser_parseObjectInitialiser() {
  var properties = [],
      property,
      name,
      key,
      map = {},
      toString = String;
  parser_index = parser_lookahead.start;
  parser_expect('{');

  while (!parser_match('}')) {
    property = parser_parseObjectProperty();

    if (property.key.type === parser_SyntaxIdentifier) {
      name = property.key.name;
    } else {
      name = toString(property.key.value);
    }

    key = '$' + name;

    if (Object.prototype.hasOwnProperty.call(map, key)) {
      parser_throwError({}, parser_MessageStrictDuplicateProperty);
    } else {
      map[key] = true;
    }

    properties.push(property);

    if (!parser_match('}')) {
      parser_expect(',');
    }
  }

  parser_expect('}');
  return parser_finishObjectExpression(properties);
} // 11.1.6 The Grouping Operator


function parser_parseGroupExpression() {
  var expr;
  parser_expect('(');
  expr = parser_parseExpression();
  parser_expect(')');
  return expr;
} // 11.1 Primary Expressions


var parser_legalKeywords = {
  'if': 1
};

function parser_parsePrimaryExpression() {
  var type, token, expr;

  if (parser_match('(')) {
    return parser_parseGroupExpression();
  }

  if (parser_match('[')) {
    return parser_parseArrayInitialiser();
  }

  if (parser_match('{')) {
    return parser_parseObjectInitialiser();
  }

  type = parser_lookahead.type;
  parser_index = parser_lookahead.start;

  if (type === parser_TokenIdentifier || parser_legalKeywords[parser_lookahead.value]) {
    expr = parser_finishIdentifier(parser_lex().value);
  } else if (type === parser_TokenStringLiteral || type === parser_TokenNumericLiteral) {
    if (parser_lookahead.octal) {
      parser_throwError(parser_lookahead, parser_MessageStrictOctalLiteral);
    }

    expr = parser_finishLiteral(parser_lex());
  } else if (type === parser_TokenKeyword) {
    throw new Error(parser_DISABLED);
  } else if (type === parser_TokenBooleanLiteral) {
    token = parser_lex();
    token.value = token.value === 'true';
    expr = parser_finishLiteral(token);
  } else if (type === parser_TokenNullLiteral) {
    token = parser_lex();
    token.value = null;
    expr = parser_finishLiteral(token);
  } else if (parser_match('/') || parser_match('/=')) {
    expr = parser_finishLiteral(parser_scanRegExp());
    parser_peek();
  } else {
    parser_throwUnexpected(parser_lex());
  }

  return expr;
} // 11.2 Left-Hand-Side Expressions


function parser_parseArguments() {
  var args = [];
  parser_expect('(');

  if (!parser_match(')')) {
    while (parser_index < parser_length) {
      args.push(parser_parseConditionalExpression());

      if (parser_match(')')) {
        break;
      }

      parser_expect(',');
    }
  }

  parser_expect(')');
  return args;
}

function parser_parseNonComputedProperty() {
  var token;
  parser_index = parser_lookahead.start;
  token = parser_lex();

  if (!parser_isIdentifierName(token)) {
    parser_throwUnexpected(token);
  }

  return parser_finishIdentifier(token.value);
}

function parser_parseNonComputedMember() {
  parser_expect('.');
  return parser_parseNonComputedProperty();
}

function parser_parseComputedMember() {
  var expr;
  parser_expect('[');
  expr = parser_parseExpression();
  parser_expect(']');
  return expr;
}

function parser_parseLeftHandSideExpressionAllowCall() {
  var expr, args, property;
  expr = parser_parsePrimaryExpression();

  for (;;) {
    if (parser_match('.')) {
      property = parser_parseNonComputedMember();
      expr = parser_finishMemberExpression('.', expr, property);
    } else if (parser_match('(')) {
      args = parser_parseArguments();
      expr = parser_finishCallExpression(expr, args);
    } else if (parser_match('[')) {
      property = parser_parseComputedMember();
      expr = parser_finishMemberExpression('[', expr, property);
    } else {
      break;
    }
  }

  return expr;
} // 11.3 Postfix Expressions


function parser_parsePostfixExpression() {
  var expr = parser_parseLeftHandSideExpressionAllowCall();

  if (parser_lookahead.type === parser_TokenPunctuator) {
    if (parser_match('++') || parser_match('--')) {
      throw new Error(parser_DISABLED);
    }
  }

  return expr;
} // 11.4 Unary Operators


function parser_parseUnaryExpression() {
  var token, expr;

  if (parser_lookahead.type !== parser_TokenPunctuator && parser_lookahead.type !== parser_TokenKeyword) {
    expr = parser_parsePostfixExpression();
  } else if (parser_match('++') || parser_match('--')) {
    throw new Error(parser_DISABLED);
  } else if (parser_match('+') || parser_match('-') || parser_match('~') || parser_match('!')) {
    token = parser_lex();
    expr = parser_parseUnaryExpression();
    expr = parser_finishUnaryExpression(token.value, expr);
  } else if (parser_matchKeyword('delete') || parser_matchKeyword('void') || parser_matchKeyword('typeof')) {
    throw new Error(parser_DISABLED);
  } else {
    expr = parser_parsePostfixExpression();
  }

  return expr;
}

function parser_binaryPrecedence(token) {
  var prec = 0;

  if (token.type !== parser_TokenPunctuator && token.type !== parser_TokenKeyword) {
    return 0;
  }

  switch (token.value) {
    case '||':
      prec = 1;
      break;

    case '&&':
      prec = 2;
      break;

    case '|':
      prec = 3;
      break;

    case '^':
      prec = 4;
      break;

    case '&':
      prec = 5;
      break;

    case '==':
    case '!=':
    case '===':
    case '!==':
      prec = 6;
      break;

    case '<':
    case '>':
    case '<=':
    case '>=':
    case 'instanceof':
    case 'in':
      prec = 7;
      break;

    case '<<':
    case '>>':
    case '>>>':
      prec = 8;
      break;

    case '+':
    case '-':
      prec = 9;
      break;

    case '*':
    case '/':
    case '%':
      prec = 11;
      break;

    default:
      break;
  }

  return prec;
} // 11.5 Multiplicative Operators
// 11.6 Additive Operators
// 11.7 Bitwise Shift Operators
// 11.8 Relational Operators
// 11.9 Equality Operators
// 11.10 Binary Bitwise Operators
// 11.11 Binary Logical Operators


function parser_parseBinaryExpression() {
  var marker, markers, expr, token, prec, stack, right, operator, left, i;
  marker = parser_lookahead;
  left = parser_parseUnaryExpression();
  token = parser_lookahead;
  prec = parser_binaryPrecedence(token);

  if (prec === 0) {
    return left;
  }

  token.prec = prec;
  parser_lex();
  markers = [marker, parser_lookahead];
  right = parser_parseUnaryExpression();
  stack = [left, token, right];

  while ((prec = parser_binaryPrecedence(parser_lookahead)) > 0) {
    // Reduce: make a binary expression from the three topmost entries.
    while (stack.length > 2 && prec <= stack[stack.length - 2].prec) {
      right = stack.pop();
      operator = stack.pop().value;
      left = stack.pop();
      markers.pop();
      expr = parser_finishBinaryExpression(operator, left, right);
      stack.push(expr);
    } // Shift.


    token = parser_lex();
    token.prec = prec;
    stack.push(token);
    markers.push(parser_lookahead);
    expr = parser_parseUnaryExpression();
    stack.push(expr);
  } // Final reduce to clean-up the stack.


  i = stack.length - 1;
  expr = stack[i];
  markers.pop();

  while (i > 1) {
    markers.pop();
    expr = parser_finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
    i -= 2;
  }

  return expr;
} // 11.12 Conditional Operator


function parser_parseConditionalExpression() {
  var expr, consequent, alternate;
  expr = parser_parseBinaryExpression();

  if (parser_match('?')) {
    parser_lex();
    consequent = parser_parseConditionalExpression();
    parser_expect(':');
    alternate = parser_parseConditionalExpression();
    expr = parser_finishConditionalExpression(expr, consequent, alternate);
  }

  return expr;
} // 11.14 Comma Operator


function parser_parseExpression() {
  var expr = parser_parseConditionalExpression();

  if (parser_match(',')) {
    throw new Error(parser_DISABLED); // no sequence expressions
  }

  return expr;
}

/* harmony default export */ var src_parser = (function (code) {
  parser_source = code;
  parser_index = 0;
  parser_length = parser_source.length;
  parser_lookahead = null;
  parser_peek();
  var expr = parser_parseExpression();

  if (parser_lookahead.type !== parser_TokenEOF) {
    throw new Error('Unexpect token after expression.');
  }

  return expr;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-expression/src/constants.js
/* harmony default export */ var src_constants = ({
  NaN: 'NaN',
  E: 'Math.E',
  LN2: 'Math.LN2',
  LN10: 'Math.LN10',
  LOG2E: 'Math.LOG2E',
  LOG10E: 'Math.LOG10E',
  PI: 'Math.PI',
  SQRT1_2: 'Math.SQRT1_2',
  SQRT2: 'Math.SQRT2',
  MIN_VALUE: 'Number.MIN_VALUE',
  MAX_VALUE: 'Number.MAX_VALUE'
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-expression/node_modules/vega-util/build/vega-util.module.js


























function vega_util_module_accessor(fn, fields, name) {
  fn.fields = fields || [];
  fn.fname = name;
  return fn;
}

function vega_util_module_accessorName(fn) {
  return fn == null ? null : fn.fname;
}

function vega_util_module_accessorFields(fn) {
  return fn == null ? null : fn.fields;
}

function getter(path) {
  return path.length === 1 ? get1(path[0]) : getN(path);
}

var get1 = function get1(field) {
  return function (obj) {
    return obj[field];
  };
};

var getN = function getN(path) {
  var len = path.length;
  return function (obj) {
    for (var i = 0; i < len; ++i) {
      obj = obj[path[i]];
    }

    return obj;
  };
};

function vega_util_module_error(message) {
  throw Error(message);
}

function vega_util_module_splitAccessPath(p) {
  var path = [],
      n = p.length;
  var q = null,
      b = 0,
      s = '',
      i,
      j,
      c;
  p = p + '';

  function push() {
    path.push(s + p.substring(i, j));
    s = '';
    i = j + 1;
  }

  for (i = j = 0; j < n; ++j) {
    c = p[j];

    if (c === '\\') {
      s += p.substring(i, j);
      s += p.substring(++j, ++j);
      i = j;
    } else if (c === q) {
      push();
      q = null;
      b = -1;
    } else if (q) {
      continue;
    } else if (i === b && c === '"') {
      i = j + 1;
      q = c;
    } else if (i === b && c === "'") {
      i = j + 1;
      q = c;
    } else if (c === '.' && !b) {
      if (j > i) {
        push();
      } else {
        i = j + 1;
      }
    } else if (c === '[') {
      if (j > i) push();
      b = i = j + 1;
    } else if (c === ']') {
      if (!b) vega_util_module_error('Access path missing open bracket: ' + p);
      if (b > 0) push();
      b = 0;
      i = j + 1;
    }
  }

  if (b) vega_util_module_error('Access path missing closing bracket: ' + p);
  if (q) vega_util_module_error('Access path missing closing quote: ' + p);

  if (j > i) {
    j++;
    push();
  }

  return path;
}

function vega_util_module_field(field, name, opt) {
  var path = vega_util_module_splitAccessPath(field);
  field = path.length === 1 ? path[0] : field;
  return vega_util_module_accessor((opt && opt.get || getter)(path), [field], name || field);
}

var vega_util_module_id = vega_util_module_field('id');
var vega_util_module_identity = vega_util_module_accessor(function (_) {
  return _;
}, [], 'identity');
var vega_util_module_zero = vega_util_module_accessor(function () {
  return 0;
}, [], 'zero');
var vega_util_module_one = vega_util_module_accessor(function () {
  return 1;
}, [], 'one');
var vega_util_module_truthy = vega_util_module_accessor(function () {
  return true;
}, [], 'true');
var vega_util_module_falsy = vega_util_module_accessor(function () {
  return false;
}, [], 'false');

function log$1(method, level, input) {
  var args = [level].concat([].slice.call(input));
  console[method].apply(console, args); // eslint-disable-line no-console
}

var vega_util_module_None = 0;
var Error$1 = 1;
var vega_util_module_Warn = 2;
var vega_util_module_Info = 3;
var vega_util_module_Debug = 4;

function vega_util_module_logger(_, method) {
  var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1;

  var _level = _ || vega_util_module_None;

  return {
    level: function level(_) {
      if (arguments.length) {
        _level = +_;
        return this;
      } else {
        return _level;
      }
    },
    error: function error() {
      if (_level >= Error$1) handler(method || 'error', 'ERROR', arguments);
      return this;
    },
    warn: function warn() {
      if (_level >= vega_util_module_Warn) handler(method || 'warn', 'WARN', arguments);
      return this;
    },
    info: function info() {
      if (_level >= vega_util_module_Info) handler(method || 'log', 'INFO', arguments);
      return this;
    },
    debug: function debug() {
      if (_level >= vega_util_module_Debug) handler(method || 'log', 'DEBUG', arguments);
      return this;
    }
  };
}

var vega_util_module_isArray = Array.isArray;

function vega_util_module_isObject(_) {
  return _ === Object(_);
}

var vega_util_module_isLegalKey = function isLegalKey(key) {
  return key !== '__proto__';
};

function vega_util_module_mergeConfig() {
  for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) {
    configs[_key] = arguments[_key];
  }

  return configs.reduce(function (out, source) {
    for (var _key2 in source) {
      if (_key2 === 'signals') {
        // for signals, we merge the signals arrays
        // source signals take precedence over
        // existing signals with the same name
        out.signals = vega_util_module_mergeNamed(out.signals, source.signals);
      } else {
        // otherwise, merge objects subject to recursion constraints
        // for legend block, recurse for the layout entry only
        // for style block, recurse for all properties
        // otherwise, no recursion: objects overwrite, no merging
        var r = _key2 === 'legend' ? {
          layout: 1
        } : _key2 === 'style' ? true : null;
        vega_util_module_writeConfig(out, _key2, source[_key2], r);
      }
    }

    return out;
  }, {});
}

function vega_util_module_writeConfig(output, key, value, recurse) {
  if (!vega_util_module_isLegalKey(key)) return;
  var k, o;

  if (vega_util_module_isObject(value) && !vega_util_module_isArray(value)) {
    o = vega_util_module_isObject(output[key]) ? output[key] : output[key] = {};

    for (k in value) {
      if (recurse && (recurse === true || recurse[k])) {
        vega_util_module_writeConfig(o, k, value[k]);
      } else if (vega_util_module_isLegalKey(k)) {
        o[k] = value[k];
      }
    }
  } else {
    output[key] = value;
  }
}

function vega_util_module_mergeNamed(a, b) {
  if (a == null) return b;
  var map = {},
      out = [];

  function add(_) {
    if (!map[_.name]) {
      map[_.name] = 1;
      out.push(_);
    }
  }

  b.forEach(add);
  a.forEach(add);
  return out;
}

function vega_util_module_peek(array) {
  return array[array.length - 1];
}

function vega_util_module_toNumber(_) {
  return _ == null || _ === '' ? null : +_;
}

var vega_util_module_exp = function exp(sign) {
  return function (x) {
    return sign * Math.exp(x);
  };
};

var vega_util_module_log = function log(sign) {
  return function (x) {
    return Math.log(sign * x);
  };
};

var vega_util_module_symlog = function symlog(c) {
  return function (x) {
    return Math.sign(x) * Math.log1p(Math.abs(x / c));
  };
};

var vega_util_module_symexp = function symexp(c) {
  return function (x) {
    return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
  };
};

var vega_util_module_pow = function pow(exponent) {
  return function (x) {
    return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
  };
};

function vega_util_module_pan(domain, delta, lift, ground) {
  var d0 = lift(domain[0]),
      d1 = lift(vega_util_module_peek(domain)),
      dd = (d1 - d0) * delta;
  return [ground(d0 - dd), ground(d1 - dd)];
}

function vega_util_module_panLinear(domain, delta) {
  return vega_util_module_pan(domain, delta, vega_util_module_toNumber, vega_util_module_identity);
}

function vega_util_module_panLog(domain, delta) {
  var sign = Math.sign(domain[0]);
  return vega_util_module_pan(domain, delta, vega_util_module_log(sign), vega_util_module_exp(sign));
}

function vega_util_module_panPow(domain, delta, exponent) {
  return vega_util_module_pan(domain, delta, vega_util_module_pow(exponent), vega_util_module_pow(1 / exponent));
}

function vega_util_module_panSymlog(domain, delta, constant) {
  return vega_util_module_pan(domain, delta, vega_util_module_symlog(constant), vega_util_module_symexp(constant));
}

function vega_util_module_zoom(domain, anchor, scale, lift, ground) {
  var d0 = lift(domain[0]),
      d1 = lift(vega_util_module_peek(domain)),
      da = anchor != null ? lift(anchor) : (d0 + d1) / 2;
  return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)];
}

function vega_util_module_zoomLinear(domain, anchor, scale) {
  return vega_util_module_zoom(domain, anchor, scale, vega_util_module_toNumber, vega_util_module_identity);
}

function vega_util_module_zoomLog(domain, anchor, scale) {
  var sign = Math.sign(domain[0]);
  return vega_util_module_zoom(domain, anchor, scale, vega_util_module_log(sign), vega_util_module_exp(sign));
}

function vega_util_module_zoomPow(domain, anchor, scale, exponent) {
  return vega_util_module_zoom(domain, anchor, scale, vega_util_module_pow(exponent), vega_util_module_pow(1 / exponent));
}

function vega_util_module_zoomSymlog(domain, anchor, scale, constant) {
  return vega_util_module_zoom(domain, anchor, scale, vega_util_module_symlog(constant), vega_util_module_symexp(constant));
}

function vega_util_module_quarter(date) {
  return 1 + ~~(new Date(date).getMonth() / 3);
}

function vega_util_module_utcquarter(date) {
  return 1 + ~~(new Date(date).getUTCMonth() / 3);
}

function vega_util_module_array(_) {
  return _ != null ? vega_util_module_isArray(_) ? _ : [_] : [];
}
/**
 * Span-preserving range clamp. If the span of the input range is less
 * than (max - min) and an endpoint exceeds either the min or max value,
 * the range is translated such that the span is preserved and one
 * endpoint touches the boundary of the min/max range.
 * If the span exceeds (max - min), the range [min, max] is returned.
 */


function vega_util_module_clampRange(range, min, max) {
  var lo = range[0],
      hi = range[1],
      span;

  if (hi < lo) {
    span = hi;
    hi = lo;
    lo = span;
  }

  span = hi - lo;
  return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span];
}

function vega_util_module_isFunction(_) {
  return typeof _ === 'function';
}

var DESCENDING = 'descending';

function vega_util_module_compare(fields, orders, opt) {
  opt = opt || {};
  orders = vega_util_module_array(orders) || [];
  var ord = [],
      get = [],
      fmap = {},
      gen = opt.comparator || comparator;
  vega_util_module_array(fields).forEach(function (f, i) {
    if (f == null) return;
    ord.push(orders[i] === DESCENDING ? -1 : 1);
    get.push(f = vega_util_module_isFunction(f) ? f : vega_util_module_field(f, null, opt));
    (vega_util_module_accessorFields(f) || []).forEach(function (_) {
      return fmap[_] = 1;
    });
  });
  return get.length === 0 ? null : vega_util_module_accessor(gen(get, ord), Object.keys(fmap));
}

var vega_util_module_ascending = function ascending(u, v) {
  return (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0;
};

var comparator = function comparator(fields, orders) {
  return fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length);
};

var compare1 = function compare1(field, order) {
  return function (a, b) {
    return vega_util_module_ascending(field(a), field(b)) * order;
  };
};

var compareN = function compareN(fields, orders, n) {
  orders.push(0); // pad zero for convenient lookup

  return function (a, b) {
    var f,
        c = 0,
        i = -1;

    while (c === 0 && ++i < n) {
      f = fields[i];
      c = vega_util_module_ascending(f(a), f(b));
    }

    return c * orders[i];
  };
};

function vega_util_module_constant(_) {
  return vega_util_module_isFunction(_) ? _ : function () {
    return _;
  };
}

function vega_util_module_debounce(delay, handler) {
  var tid;
  return function (e) {
    if (tid) clearTimeout(tid);
    tid = setTimeout(function () {
      return handler(e), tid = null;
    }, delay);
  };
}

function vega_util_module_extend(_) {
  for (var x, k, i = 1, len = arguments.length; i < len; ++i) {
    x = arguments[i];

    for (k in x) {
      _[k] = x[k];
    }
  }

  return _;
}
/**
 * Return an array with minimum and maximum values, in the
 * form [min, max]. Ignores null, undefined, and NaN values.
 */


function vega_util_module_extent(array, f) {
  var i = 0,
      n,
      v,
      min,
      max;

  if (array && (n = array.length)) {
    if (f == null) {
      // find first valid value
      for (v = array[i]; i < n && (v == null || v !== v); v = array[++i]) {
        ;
      }

      min = max = v; // visit all other values

      for (; i < n; ++i) {
        v = array[i]; // skip null/undefined; NaN will fail all comparisons

        if (v != null) {
          if (v < min) min = v;
          if (v > max) max = v;
        }
      }
    } else {
      // find first valid value
      for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])) {
        ;
      }

      min = max = v; // visit all other values

      for (; i < n; ++i) {
        v = f(array[i]); // skip null/undefined; NaN will fail all comparisons

        if (v != null) {
          if (v < min) min = v;
          if (v > max) max = v;
        }
      }
    }
  }

  return [min, max];
}

function vega_util_module_extentIndex(array, f) {
  var n = array.length;
  var i = -1,
      a,
      b,
      c,
      u,
      v;

  if (f == null) {
    while (++i < n) {
      b = array[i];

      if (b != null && b >= b) {
        a = c = b;
        break;
      }
    }

    if (i === n) return [-1, -1];
    u = v = i;

    while (++i < n) {
      b = array[i];

      if (b != null) {
        if (a > b) {
          a = b;
          u = i;
        }

        if (c < b) {
          c = b;
          v = i;
        }
      }
    }
  } else {
    while (++i < n) {
      b = f(array[i], i, array);

      if (b != null && b >= b) {
        a = c = b;
        break;
      }
    }

    if (i === n) return [-1, -1];
    u = v = i;

    while (++i < n) {
      b = f(array[i], i, array);

      if (b != null) {
        if (a > b) {
          a = b;
          u = i;
        }

        if (c < b) {
          c = b;
          v = i;
        }
      }
    }
  }

  return [u, v];
}

var vega_util_module_hop = Object.prototype.hasOwnProperty;

function _has(object, property) {
  return vega_util_module_hop.call(object, property);
}

var vega_util_module_NULL = {};

function vega_util_module_fastmap(input) {
  var obj = {},
      _test;

  function has$1(key) {
    return _has(obj, key) && obj[key] !== vega_util_module_NULL;
  }

  var map = {
    size: 0,
    empty: 0,
    object: obj,
    has: has$1,
    get: function get(key) {
      return has$1(key) ? obj[key] : undefined;
    },
    set: function set(key, value) {
      if (!has$1(key)) {
        ++map.size;
        if (obj[key] === vega_util_module_NULL) --map.empty;
      }

      obj[key] = value;
      return this;
    },
    "delete": function _delete(key) {
      if (has$1(key)) {
        --map.size;
        ++map.empty;
        obj[key] = vega_util_module_NULL;
      }

      return this;
    },
    clear: function clear() {
      map.size = map.empty = 0;
      map.object = obj = {};
    },
    test: function test(_) {
      if (arguments.length) {
        _test = _;
        return map;
      } else {
        return _test;
      }
    },
    clean: function clean() {
      var next = {};
      var size = 0;

      for (var _key3 in obj) {
        var value = obj[_key3];

        if (value !== vega_util_module_NULL && (!_test || !_test(value))) {
          next[_key3] = value;
          ++size;
        }
      }

      map.size = size;
      map.empty = 0;
      map.object = obj = next;
    }
  };
  if (input) Object.keys(input).forEach(function (key) {
    map.set(key, input[key]);
  });
  return map;
}

function vega_util_module_flush(range, value, threshold, left, right, center) {
  if (!threshold && threshold !== 0) return center;
  var t = +threshold;
  var a = range[0],
      b = vega_util_module_peek(range),
      l; // swap endpoints if range is reversed

  if (b < a) {
    l = a;
    a = b;
    b = l;
  } // compare value to endpoints


  l = Math.abs(value - a);
  var r = Math.abs(b - value); // adjust if value is within threshold distance of endpoint

  return l < r && l <= t ? left : r <= t ? right : center;
}

function vega_util_module_inherits(child, parent, members) {
  var proto = child.prototype = Object.create(parent.prototype);
  Object.defineProperty(proto, 'constructor', {
    value: child,
    writable: true,
    enumerable: true,
    configurable: true
  });
  return vega_util_module_extend(proto, members);
}
/**
 * Predicate that returns true if the value lies within the span
 * of the given range. The left and right flags control the use
 * of inclusive (true) or exclusive (false) comparisons.
 */


function vega_util_module_inrange(value, range, left, right) {
  var r0 = range[0],
      r1 = range[range.length - 1],
      t;

  if (r0 > r1) {
    t = r0;
    r0 = r1;
    r1 = t;
  }

  left = left === undefined || left;
  right = right === undefined || right;
  return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1);
}

function vega_util_module_isBoolean(_) {
  return typeof _ === 'boolean';
}

function vega_util_module_isDate(_) {
  return Object.prototype.toString.call(_) === '[object Date]';
}

function isIterable(_) {
  return _ && vega_util_module_isFunction(_[Symbol.iterator]);
}

function vega_util_module_isNumber(_) {
  return typeof _ === 'number';
}

function vega_util_module_isRegExp(_) {
  return Object.prototype.toString.call(_) === '[object RegExp]';
}

function vega_util_module_isString(_) {
  return typeof _ === 'string';
}

function vega_util_module_key(fields, flat, opt) {
  if (fields) {
    fields = flat ? vega_util_module_array(fields).map(function (f) {
      return f.replace(/\\(.)/g, '$1');
    }) : vega_util_module_array(fields);
  }

  var len = fields && fields.length,
      gen = opt && opt.get || getter,
      map = function map(f) {
    return gen(flat ? [f] : vega_util_module_splitAccessPath(f));
  };

  var fn;

  if (!len) {
    fn = function fn() {
      return '';
    };
  } else if (len === 1) {
    var get = map(fields[0]);

    fn = function fn(_) {
      return '' + get(_);
    };
  } else {
    var _get = fields.map(map);

    fn = function fn(_) {
      var s = '' + _get[0](_),
          i = 0;

      while (++i < len) {
        s += '|' + _get[i](_);
      }

      return s;
    };
  }

  return vega_util_module_accessor(fn, fields, 'key');
}

function vega_util_module_lerp(array, frac) {
  var lo = array[0],
      hi = vega_util_module_peek(array),
      f = +frac;
  return !f ? lo : f === 1 ? hi : lo + f * (hi - lo);
}

var vega_util_module_DEFAULT_MAX_SIZE = 10000; // adapted from https://github.com/dominictarr/hashlru/ (MIT License)

function vega_util_module_lruCache(maxsize) {
  maxsize = +maxsize || vega_util_module_DEFAULT_MAX_SIZE;
  var curr, prev, size;

  var clear = function clear() {
    curr = {};
    prev = {};
    size = 0;
  };

  var update = function update(key, value) {
    if (++size > maxsize) {
      prev = curr;
      curr = {};
      size = 1;
    }

    return curr[key] = value;
  };

  clear();
  return {
    clear: clear,
    has: function has(key) {
      return _has(curr, key) || _has(prev, key);
    },
    get: function get(key) {
      return _has(curr, key) ? curr[key] : _has(prev, key) ? update(key, prev[key]) : undefined;
    },
    set: function set(key, value) {
      return _has(curr, key) ? curr[key] = value : update(key, value);
    }
  };
}

function vega_util_module_merge(compare, array0, array1, output) {
  var n0 = array0.length,
      n1 = array1.length;
  if (!n1) return array0;
  if (!n0) return array1;
  var merged = output || new array0.constructor(n0 + n1);
  var i0 = 0,
      i1 = 0,
      i = 0;

  for (; i0 < n0 && i1 < n1; ++i) {
    merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++];
  }

  for (; i0 < n0; ++i0, ++i) {
    merged[i] = array0[i0];
  }

  for (; i1 < n1; ++i1, ++i) {
    merged[i] = array1[i1];
  }

  return merged;
}

function vega_util_module_repeat(str, reps) {
  var s = '';

  while (--reps >= 0) {
    s += str;
  }

  return s;
}

function vega_util_module_pad(str, length, padchar, align) {
  var c = padchar || ' ',
      s = str + '',
      n = length - s.length;
  return n <= 0 ? s : align === 'left' ? vega_util_module_repeat(c, n) + s : align === 'center' ? vega_util_module_repeat(c, ~~(n / 2)) + s + vega_util_module_repeat(c, Math.ceil(n / 2)) : s + vega_util_module_repeat(c, n);
}
/**
 * Return the numerical span of an array: the difference between
 * the last and first values.
 */


function vega_util_module_span(array) {
  return array && vega_util_module_peek(array) - array[0] || 0;
}

function vega_util_module_$(x) {
  return vega_util_module_isArray(x) ? '[' + x.map(vega_util_module_$) + ']' : vega_util_module_isObject(x) || vega_util_module_isString(x) ? // Output valid JSON and JS source strings.
  // See http://timelessrepo.com/json-isnt-a-javascript-subset
  JSON.stringify(x).replace("\u2028", "\\u2028").replace("\u2029", "\\u2029") : x;
}

function vega_util_module_toBoolean(_) {
  return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;
}

var vega_util_module_defaultParser = function defaultParser(_) {
  return vega_util_module_isNumber(_) ? _ : vega_util_module_isDate(_) ? _ : Date.parse(_);
};

function vega_util_module_toDate(_, parser) {
  parser = parser || vega_util_module_defaultParser;
  return _ == null || _ === '' ? null : parser(_);
}

function vega_util_module_toString(_) {
  return _ == null || _ === '' ? null : _ + '';
}

function vega_util_module_toSet(_) {
  var s = {},
      n = _.length;

  for (var i = 0; i < n; ++i) {
    s[_[i]] = true;
  }

  return s;
}

function vega_util_module_truncate(str, length, align, ellipsis) {
  var e = ellipsis != null ? ellipsis : "\u2026",
      s = str + '',
      n = s.length,
      l = Math.max(0, length - e.length);
  return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e;
}

function vega_util_module_visitArray(array, filter, visitor) {
  if (array) {
    if (filter) {
      var n = array.length;

      for (var i = 0; i < n; ++i) {
        var t = filter(array[i]);
        if (t) visitor(t, i, array);
      }
    } else {
      array.forEach(visitor);
    }
  }
}


// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-expression/src/functions.js





/* harmony default export */ var src_functions = (function (codegen) {
  function fncall(name, args, cast, type) {
    var obj = codegen(args[0]);

    if (cast) {
      obj = cast + '(' + obj + ')';
      if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';
    }

    return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')');
  }

  function fn(name, cast, type) {
    return function (args) {
      return fncall(name, args, cast, type);
    };
  }

  var DATE = 'new Date',
      STRING = 'String',
      REGEXP = 'RegExp';
  return {
    // MATH functions
    isNaN: 'Number.isNaN',
    isFinite: 'Number.isFinite',
    abs: 'Math.abs',
    acos: 'Math.acos',
    asin: 'Math.asin',
    atan: 'Math.atan',
    atan2: 'Math.atan2',
    ceil: 'Math.ceil',
    cos: 'Math.cos',
    exp: 'Math.exp',
    floor: 'Math.floor',
    log: 'Math.log',
    max: 'Math.max',
    min: 'Math.min',
    pow: 'Math.pow',
    random: 'Math.random',
    round: 'Math.round',
    sin: 'Math.sin',
    sqrt: 'Math.sqrt',
    tan: 'Math.tan',
    clamp: function clamp(args) {
      if (args.length < 3) vega_util_module_error('Missing arguments to clamp function.');
      if (args.length > 3) vega_util_module_error('Too many arguments to clamp function.');
      var a = args.map(codegen);
      return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))';
    },
    // DATE functions
    now: 'Date.now',
    utc: 'Date.UTC',
    datetime: DATE,
    date: fn('getDate', DATE, 0),
    day: fn('getDay', DATE, 0),
    year: fn('getFullYear', DATE, 0),
    month: fn('getMonth', DATE, 0),
    hours: fn('getHours', DATE, 0),
    minutes: fn('getMinutes', DATE, 0),
    seconds: fn('getSeconds', DATE, 0),
    milliseconds: fn('getMilliseconds', DATE, 0),
    time: fn('getTime', DATE, 0),
    timezoneoffset: fn('getTimezoneOffset', DATE, 0),
    utcdate: fn('getUTCDate', DATE, 0),
    utcday: fn('getUTCDay', DATE, 0),
    utcyear: fn('getUTCFullYear', DATE, 0),
    utcmonth: fn('getUTCMonth', DATE, 0),
    utchours: fn('getUTCHours', DATE, 0),
    utcminutes: fn('getUTCMinutes', DATE, 0),
    utcseconds: fn('getUTCSeconds', DATE, 0),
    utcmilliseconds: fn('getUTCMilliseconds', DATE, 0),
    // sequence functions
    length: fn('length', null, -1),
    join: fn('join', null),
    indexof: fn('indexOf', null),
    lastindexof: fn('lastIndexOf', null),
    slice: fn('slice', null),
    reverse: function reverse(args) {
      return '(' + codegen(args[0]) + ').slice().reverse()';
    },
    // STRING functions
    parseFloat: 'parseFloat',
    parseInt: 'parseInt',
    upper: fn('toUpperCase', STRING, 0),
    lower: fn('toLowerCase', STRING, 0),
    substring: fn('substring', STRING),
    split: fn('split', STRING),
    replace: fn('replace', STRING),
    trim: fn('trim', STRING, 0),
    // REGEXP functions
    regexp: REGEXP,
    test: fn('test', REGEXP),
    // Control Flow functions
    "if": function _if(args) {
      if (args.length < 3) vega_util_module_error('Missing arguments to if function.');
      if (args.length > 3) vega_util_module_error('Too many arguments to if function.');
      var a = args.map(codegen);
      return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')';
    }
  };
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-expression/src/codegen.js










function codegen_stripQuotes(s) {
  var n = s && s.length - 1;
  return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s;
}

/* harmony default export */ var src_codegen = (function (opt) {
  opt = opt || {};
  var whitelist = opt.whitelist ? vega_util_module_toSet(opt.whitelist) : {},
      blacklist = opt.blacklist ? vega_util_module_toSet(opt.blacklist) : {},
      constants = opt.constants || src_constants,
      functions = (opt.functions || src_functions)(visit),
      globalvar = opt.globalvar,
      fieldvar = opt.fieldvar,
      outputGlobal = vega_util_module_isFunction(globalvar) ? globalvar : function (id) {
    return "".concat(globalvar, "[\"").concat(id, "\"]");
  };
  var globals = {},
      fields = {},
      memberDepth = 0;

  function visit(ast) {
    if (vega_util_module_isString(ast)) return ast;
    var generator = Generators[ast.type];
    if (generator == null) vega_util_module_error('Unsupported type: ' + ast.type);
    return generator(ast);
  }

  var Generators = {
    Literal: function Literal(n) {
      return n.raw;
    },
    Identifier: function Identifier(n) {
      var id = n.name;

      if (memberDepth > 0) {
        return id;
      } else if (_has(blacklist, id)) {
        return vega_util_module_error('Illegal identifier: ' + id);
      } else if (_has(constants, id)) {
        return constants[id];
      } else if (_has(whitelist, id)) {
        return id;
      } else {
        globals[id] = 1;
        return outputGlobal(id);
      }
    },
    MemberExpression: function MemberExpression(n) {
      var d = !n.computed,
          o = visit(n.object);
      if (d) memberDepth += 1;
      var p = visit(n.property);

      if (o === fieldvar) {
        // strip quotes to sanitize field name (#1653)
        fields[codegen_stripQuotes(p)] = 1;
      }

      if (d) memberDepth -= 1;
      return o + (d ? '.' + p : '[' + p + ']');
    },
    CallExpression: function CallExpression(n) {
      if (n.callee.type !== 'Identifier') {
        vega_util_module_error('Illegal callee type: ' + n.callee.type);
      }

      var callee = n.callee.name,
          args = n.arguments,
          fn = _has(functions, callee) && functions[callee];
      if (!fn) vega_util_module_error('Unrecognized function: ' + callee);
      return vega_util_module_isFunction(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')';
    },
    ArrayExpression: function ArrayExpression(n) {
      return '[' + n.elements.map(visit).join(',') + ']';
    },
    BinaryExpression: function BinaryExpression(n) {
      return '(' + visit(n.left) + n.operator + visit(n.right) + ')';
    },
    UnaryExpression: function UnaryExpression(n) {
      return '(' + n.operator + visit(n.argument) + ')';
    },
    ConditionalExpression: function ConditionalExpression(n) {
      return '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')';
    },
    LogicalExpression: function LogicalExpression(n) {
      return '(' + visit(n.left) + n.operator + visit(n.right) + ')';
    },
    ObjectExpression: function ObjectExpression(n) {
      return '{' + n.properties.map(visit).join(',') + '}';
    },
    Property: function Property(n) {
      memberDepth += 1;
      var k = visit(n.key);
      memberDepth -= 1;
      return k + ':' + visit(n.value);
    }
  };

  function codegen(ast) {
    var result = {
      code: visit(ast),
      globals: Object.keys(globals),
      fields: Object.keys(fields)
    };
    globals = {};
    fields = {};
    return result;
  }

  codegen.functions = functions;
  codegen.constants = constants;
  return codegen;
});
// CONCATENATED MODULE: ./node_modules/vega-lite/node_modules/vega-expression/index.js





// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/expressions.js











function expressions_getName(node) {
  var name = [];

  if (node.type === 'Identifier') {
    return [node.name];
  }

  if (node.type === 'Literal') {
    return [node.value];
  }

  if (node.type === 'MemberExpression') {
    name.push.apply(name, _toConsumableArray(expressions_getName(node.object)));
    name.push.apply(name, _toConsumableArray(expressions_getName(node.property)));
  }

  return name;
}

function startsWithDatum(node) {
  if (node.object.type === 'MemberExpression') {
    return startsWithDatum(node.object);
  }

  return node.object.name === 'datum';
}

function getDependentFields(expression) {
  var ast = src_parser(expression);
  var dependents = new Set();
  ast.visit(function (node) {
    if (node.type === 'MemberExpression' && startsWithDatum(node)) {
      dependents.add(expressions_getName(node).slice(1).join('.'));
    }
  });
  return dependents;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/filter.js















var filter_FilterNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(FilterNode, _DataFlowNode);

  var _super = _createSuper(FilterNode);

  function FilterNode(parent, model, filter) {
    var _this;

    _classCallCheck(this, FilterNode);

    _this = _super.call(this, parent);
    _this.model = model;
    _this.filter = filter; // TODO: refactor this to not take a node and
    // then add a static function makeFromOperand and make the constructor take only an expression

    _this.expr = predicate_expression(_this.model, _this.filter, _assertThisInitialized(_this));
    _this._dependentFields = getDependentFields(_this.expr);
    return _this;
  }

  _createClass(FilterNode, [{
    key: "clone",
    value: function clone() {
      return new FilterNode(null, this.model, duplicate(this.filter));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return this._dependentFields;
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(); // filter does not produce any new fields
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return {
        type: 'filter',
        expr: this.expr
      };
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Filter ".concat(this.expr);
    }
  }]);

  return FilterNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/selection/parse.js
















function parseUnitSelection(model, selDefs) {
  var _a;

  var selCmpts = {};
  var selectionConfig = model.config.selection;

  var _iterator = _createForOfIteratorHelper(util_keys(selDefs !== null && selDefs !== void 0 ? selDefs : {})),
      _step;

  try {
    var _loop = function _loop() {
      var name = _step.value;
      var selDef = duplicate(selDefs[name]);

      var _b = selectionConfig[selDef.type],
          fields = _b.fields,
          encodings = _b.encodings,
          cfg = __rest(_b, ["fields", "encodings"]); // Project transform applies its defaults.
      // Set default values from config if a property hasn't been specified,
      // or if it is true. E.g., "translate": true should use the default
      // event handlers for translate. However, true may be a valid value for
      // a property (e.g., "nearest": true).


      for (var key in cfg) {
        // A selection should contain either `encodings` or `fields`, only use
        // default values for these two values if neither of them is specified.
        if (key === 'encodings' && selDef.fields || key === 'fields' && selDef.encodings) {
          continue;
        }

        if (key === 'mark') {
          selDef[key] = Object.assign(Object.assign({}, cfg[key]), selDef[key]);
        }

        if (selDef[key] === undefined || selDef[key] === true) {
          selDef[key] = (_a = cfg[key]) !== null && _a !== void 0 ? _a : selDef[key];
        }
      }

      var safeName = varName(name);
      var selCmpt = selCmpts[safeName] = Object.assign(Object.assign({}, selDef), {
        name: safeName,
        events: isString(selDef.on) ? vega_event_selector_module_eventSelector(selDef.on, 'scope') : duplicate(selDef.on)
      });
      forEachTransform(selCmpt, function (txCompiler) {
        if (txCompiler.has(selCmpt) && txCompiler.parse) {
          txCompiler.parse(model, selCmpt, selDef, selDefs[name]);
        }
      });
    };

    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      _loop();
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return selCmpts;
}
function parseSelectionPredicate(model, selections, dfnode) {
  var datum = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'datum';
  var stores = [];

  function expr(name) {
    var vname = varName(name);
    var selCmpt = model.getSelectionComponent(vname, name);
    var store = stringValue_$(vname + STORE);

    if (selCmpt.project.timeUnit) {
      var child = dfnode !== null && dfnode !== void 0 ? dfnode : model.component.data.raw;
      var tunode = selCmpt.project.timeUnit.clone();

      if (child.parent) {
        tunode.insertAsParentOf(child);
      } else {
        child.parent = tunode;
      }
    }

    if (selCmpt.empty !== 'none') {
      stores.push(store);
    }

    return "vlSelectionTest(".concat(store, ", ").concat(datum) + (selCmpt.resolve === 'global' ? ')' : ", ".concat(stringValue_$(selCmpt.resolve), ")"));
  }

  var predicateStr = logicalExpr(selections, expr);
  return (stores.length ? '!(' + stores.map(function (s) {
    return "length(data(".concat(s, "))");
  }).join(' || ') + ') || ' : '') + "(".concat(predicateStr, ")");
}
function parseSelectionBinExtent(selCmpt, extent) {
  var encoding = extent['encoding'];
  var field = extent['field'];

  if (!encoding && !field) {
    field = selCmpt.project.items[0].field;

    if (selCmpt.project.items.length > 1) {
      log_warn('A "field" or "encoding" must be specified when using a selection as a scale domain. ' + "Using \"field\": ".concat(stringValue_$(field), "."));
    }
  } else if (encoding && !field) {
    var encodings = selCmpt.project.items.filter(function (p) {
      return p.channel === encoding;
    });

    if (!encodings.length || encodings.length > 1) {
      field = selCmpt.project.items[0].field;
      log_warn((!encodings.length ? 'No ' : 'Multiple ') + "matching ".concat(stringValue_$(encoding), " encoding found for selection ").concat(stringValue_$(extent.selection), ". ") + "Using \"field\": ".concat(stringValue_$(field), "."));
    } else {
      field = encodings[0].field;
    }
  }

  return "".concat(selCmpt.name, "[").concat(stringValue_$(field), "]");
}
function materializeSelections(model, main) {
  forEachSelection(model, function (selCmpt) {
    var selection = selCmpt.name;
    var lookupName = model.getName("lookup_".concat(selection));
    model.component.data.outputNodes[lookupName] = selCmpt.materialized = new dataflow_OutputNode(new filter_FilterNode(main, model, {
      selection: selection
    }), lookupName, 'lookup', model.component.data.outputNodeRefCounts);
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/predicate.js




/**
 * Converts a predicate into an expression.
 */
// model is only used for selection filters.

function predicate_expression(model, filterOp, node) {
  return logicalExpr(filterOp, function (predicate) {
    if (isString(predicate)) {
      return predicate;
    } else if (isSelectionPredicate(predicate)) {
      return parseSelectionPredicate(model, predicate.selection, node);
    } else {
      // Filter Object
      return fieldFilterExpression(predicate);
    }
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/axis/assemble.js

















function assemble_assembleTitle(title, config) {
  if (!title) {
    return undefined;
  }

  if (!isText(title)) {
    return title.map(function (fieldDef) {
      return defaultTitle(fieldDef, config);
    }).join(', ');
  }

  return title;
}

function setAxisEncode(axis, part, vgProp, vgRef) {
  var _a, _b, _c;

  axis.encode = (_a = axis.encode) !== null && _a !== void 0 ? _a : {};
  axis.encode[part] = (_b = axis.encode[part]) !== null && _b !== void 0 ? _b : {};
  axis.encode[part].update = (_c = axis.encode[part].update) !== null && _c !== void 0 ? _c : {}; // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291

  axis.encode[part].update[vgProp] = vgRef;
}

function exprFromValueOrSignalRef(ref) {
  if (isSignalRef(ref)) {
    return ref.signal;
  }

  return stringValue_$(ref.value);
}

function assembleAxis(axisCmpt, kind, config) {
  var opt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
    header: false
  };

  var _a, _b;

  var _c = axisCmpt.combine(),
      disable = _c.disable,
      orient = _c.orient,
      scale = _c.scale,
      labelExpr = _c.labelExpr,
      title = _c.title,
      zindex = _c.zindex,
      axis = __rest(_c, ["disable", "orient", "scale", "labelExpr", "title", "zindex"]);

  if (disable) {
    return undefined;
  }

  for (var prop in axis) {
    var propType = AXIS_PROPERTY_TYPE[prop];
    var propValue = axis[prop];

    if (propType && propType !== kind && propType !== 'both') {
      // Remove properties that are not valid for this kind of axis
      delete axis[prop];
    } else if (isConditionalAxisValue(propValue)) {
      // deal with conditional axis value
      var condition = propValue.condition,
          valueOrSignalRef = __rest(propValue, ["condition"]);

      var conditions = vega_util_src_array(condition);
      var propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];

      if (propIndex) {
        var vgProp = propIndex.vgProp,
            part = propIndex.part; // If there is a corresponding Vega property for the channel,
        // use Vega's custom axis encoding and delete the original axis property to avoid conflicts

        var vgRef = [].concat(_toConsumableArray(conditions.map(function (c) {
          var test = c.test,
              valueOrSignalCRef = __rest(c, ["test"]);

          return Object.assign({
            test: predicate_expression(null, test)
          }, valueOrSignalCRef);
        })), [valueOrSignalRef]);
        setAxisEncode(axis, part, vgProp, vgRef);
        delete axis[prop];
      } else if (propIndex === null) {
        // If propIndex is null, this means we support conditional axis property by converting the condition to signal insteed.
        var signalRef = {
          signal: conditions.map(function (c) {
            var test = c.test,
                valueOrSignalCRef = __rest(c, ["test"]);

            return "".concat(predicate_expression(null, test), " ? ").concat(exprFromValueOrSignalRef(valueOrSignalCRef), " : ");
          }).join('') + exprFromValueOrSignalRef(valueOrSignalRef)
        };
        axis[prop] = signalRef;
      }
    } else if (isSignalRef(propValue)) {
      var _propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];

      if (_propIndex) {
        var _vgProp = _propIndex.vgProp,
            _part = _propIndex.part;
        setAxisEncode(axis, _part, _vgProp, propValue);
        delete axis[prop];
      } // else do nothing since the property already supports signal

    }
  }

  if (kind === 'grid') {
    if (!axis.grid) {
      return undefined;
    } // Remove unnecessary encode block


    if (axis.encode) {
      // Only need to keep encode block for grid
      var grid = axis.encode.grid;
      axis.encode = Object.assign({}, grid ? {
        grid: grid
      } : {});

      if (util_keys(axis.encode).length === 0) {
        delete axis.encode;
      }
    }

    return Object.assign(Object.assign({
      scale: scale,
      orient: orient
    }, axis), {
      domain: false,
      labels: false,
      // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent`
      // would not affect gridAxis
      maxExtent: 0,
      minExtent: 0,
      ticks: false,
      zindex: getFirstDefined(zindex, 0) // put grid behind marks by default

    });
  } else {
    // kind === 'main'
    if (!opt.header && axisCmpt.mainExtracted) {
      // if mainExtracted has been extracted to a separate facet
      return undefined;
    }

    if (labelExpr !== undefined) {
      var expr = labelExpr;

      if (((_b = (_a = axis.encode) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.update) && isSignalRef(axis.encode.labels.update.text)) {
        expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal);
      }

      setAxisEncode(axis, 'labels', 'text', {
        signal: expr
      });
    } // Remove unnecessary encode block


    if (axis.encode) {
      var _iterator = _createForOfIteratorHelper(AXIS_PARTS),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var _part2 = _step.value;

          if (!axisCmpt.hasAxisPart(_part2)) {
            delete axis.encode[_part2];
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      if (util_keys(axis.encode).length === 0) {
        delete axis.encode;
      }
    }

    var titleString = assemble_assembleTitle(title, config);
    return Object.assign(Object.assign(Object.assign({
      scale: scale,
      orient: orient,
      grid: false
    }, titleString ? {
      title: titleString
    } : {}), axis), {
      zindex: getFirstDefined(zindex, 0) // put axis line above marks by default

    });
  }
}
/**
 * Add axis signals so grid line works correctly
 * (Fix https://github.com/vega/vega-lite/issues/4226)
 */

function assembleAxisSignals(model) {
  var axes = model.component.axes;

  var _iterator2 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS),
      _step2;

  try {
    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      var channel = _step2.value;

      if (axes[channel]) {
        var _iterator3 = _createForOfIteratorHelper(axes[channel]),
            _step3;

        try {
          for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
            var axis = _step3.value;

            if (!axis.get('gridScale')) {
              // If there is x-axis but no y-scale for gridScale, need to set height/weight so x-axis can draw the grid with the right height. Same for y-axis and width.
              var sizeType = channel === 'x' ? 'height' : 'width';
              return [{
                name: sizeType,
                update: model.getSizeSignalRef(sizeType).signal
              }];
            }
          }
        } catch (err) {
          _iterator3.e(err);
        } finally {
          _iterator3.f();
        }
      }
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }

  return [];
}
function assemble_assembleAxes(axisComponents, config) {
  var _axisComponents$x = axisComponents.x,
      x = _axisComponents$x === void 0 ? [] : _axisComponents$x,
      _axisComponents$y = axisComponents.y,
      y = _axisComponents$y === void 0 ? [] : _axisComponents$y;
  return [].concat(_toConsumableArray(x.map(function (a) {
    return assembleAxis(a, 'grid', config);
  })), _toConsumableArray(y.map(function (a) {
    return assembleAxis(a, 'grid', config);
  })), _toConsumableArray(x.map(function (a) {
    return assembleAxis(a, 'main', config);
  })), _toConsumableArray(y.map(function (a) {
    return assembleAxis(a, 'main', config);
  }))).filter(function (a) {
    return a;
  }); // filter undefined
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/header.js

var HEADER_TITLE_PROPERTIES_MAP = {
  titleAlign: 'align',
  titleAnchor: 'anchor',
  titleAngle: 'angle',
  titleBaseline: 'baseline',
  titleColor: 'color',
  titleFont: 'font',
  titleFontSize: 'fontSize',
  titleFontStyle: 'fontStyle',
  titleFontWeight: 'fontWeight',
  titleLimit: 'limit',
  titleLineHeight: 'lineHeight',
  titleOrient: 'orient',
  titlePadding: 'offset'
};
var HEADER_LABEL_PROPERTIES_MAP = {
  labelAlign: 'align',
  labelAnchor: 'anchor',
  labelAngle: 'angle',
  labelBaseline: 'baseline',
  labelColor: 'color',
  labelFont: 'font',
  labelFontSize: 'fontSize',
  labelFontStyle: 'fontStyle',
  labelFontWeight: 'fontWeight',
  labelLimit: 'limit',
  labelLineHeight: 'lineHeight',
  labelOrient: 'orient',
  labelPadding: 'offset'
};
var HEADER_TITLE_PROPERTIES = util_keys(HEADER_TITLE_PROPERTIES_MAP);
var HEADER_LABEL_PROPERTIES = util_keys(HEADER_LABEL_PROPERTIES_MAP);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/axis/config.js







function getAxisConfig(property, config, channel, orient, scaleType, style) {
  var _a, _b, _c;

  var styleConfig = getStyleConfig(property, style, config.style);

  if (styleConfig !== undefined) {
    return {
      configFrom: 'style',
      configValue: styleConfig
    };
  }

  var typeBasedConfigs = [].concat(_toConsumableArray(scaleType === 'band' ? ['axisBand', 'axisDiscrete'] : []), _toConsumableArray(scaleType === 'point' ? ['axisPoint', 'axisDiscrete'] : []), _toConsumableArray(isQuantitative(scaleType) ? ['axisQuantitative'] : []), _toConsumableArray(scaleType === 'time' || scaleType === 'utc' ? ['axisTemporal'] : []));
  var channelBasedConfig = channel === 'x' ? 'axisX' : 'axisY'; // configTypes to loop, starting from higher precedence

  var axisConfigs = [].concat(_toConsumableArray(typeBasedConfigs.map(function (c) {
    return channelBasedConfig + c.substr(4);
  })), _toConsumableArray(typeBasedConfigs), [// X/Y
  channelBasedConfig], _toConsumableArray(orient ? ['axis' + titlecase(orient)] : []), ['axis']); // apply properties in config Types first

  var _iterator = _createForOfIteratorHelper(axisConfigs),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var configType = _step.value;

      if (((_a = config[configType]) === null || _a === void 0 ? void 0 : _a[property]) !== undefined) {
        return {
          configFrom: configType,
          configValue: config[configType][property]
        };
      }
    } // then apply style in config types

  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  var _iterator2 = _createForOfIteratorHelper(axisConfigs),
      _step2;

  try {
    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      var _configType = _step2.value;

      if ((_b = config[_configType]) === null || _b === void 0 ? void 0 : _b.style) {
        styleConfig = getStyleConfig(property, (_c = config[_configType]) === null || _c === void 0 ? void 0 : _c.style, config.style);

        if (styleConfig !== undefined) {
          return {
            configFrom: 'axis-config-style',
            configValue: styleConfig
          };
        }
      }
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }

  return {};
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/axis/properties.js













 // TODO: we need to refactor this method after we take care of config refactoring

/**
 * Default rules for whether to show a grid should be shown for a channel.
 * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned
 */

function defaultGrid(scaleType, fieldDef) {
  return !hasDiscreteDomain(scaleType) && !isBinning(fieldDef.bin);
}
function gridScale(model, channel) {
  var gridChannel = channel === 'x' ? 'y' : 'x';

  if (model.getScaleComponent(gridChannel)) {
    return model.scaleName(gridChannel);
  }

  return undefined;
}
function properties_labelAngle(model, specifiedAxis, channel, fieldDef) {
  // try axis value
  if ((specifiedAxis === null || specifiedAxis === void 0 ? void 0 : specifiedAxis.labelAngle) !== undefined) {
    return normalizeAngle(specifiedAxis === null || specifiedAxis === void 0 ? void 0 : specifiedAxis.labelAngle);
  } else {
    // try axis config value
    var _getAxisConfig = getAxisConfig('labelAngle', model.config, channel, properties_orient(channel), model.getScaleComponent(channel).get('type'), specifiedAxis === null || specifiedAxis === void 0 ? void 0 : specifiedAxis.style),
        angle = _getAxisConfig.configValue;

    if (angle !== undefined) {
      return normalizeAngle(angle);
    } else {
      // get default value
      if (channel === channel_X && util_contains([NOMINAL, ORDINAL], fieldDef.type)) {
        return 270;
      } // no default


      return undefined;
    }
  }
}
function defaultLabelBaseline(angle, axisOrient) {
  if (angle !== undefined) {
    angle = normalizeAngle(angle);

    if (axisOrient === 'top' || axisOrient === 'bottom') {
      if (angle <= 45 || 315 <= angle) {
        return axisOrient === 'top' ? 'bottom' : 'top';
      } else if (135 <= angle && angle <= 225) {
        return axisOrient === 'top' ? 'top' : 'bottom';
      } else {
        return 'middle';
      }
    } else {
      if (angle <= 45 || 315 <= angle || 135 <= angle && angle <= 225) {
        return 'middle';
      } else if (45 <= angle && angle <= 135) {
        return axisOrient === 'left' ? 'top' : 'bottom';
      } else {
        return axisOrient === 'left' ? 'bottom' : 'top';
      }
    }
  }

  return undefined;
}
function defaultLabelAlign(angle, axisOrient) {
  if (angle !== undefined) {
    angle = normalizeAngle(angle);

    if (axisOrient === 'top' || axisOrient === 'bottom') {
      if (angle % 180 === 0) {
        return 'center';
      } else if (0 < angle && angle < 180) {
        return axisOrient === 'top' ? 'right' : 'left';
      } else {
        return axisOrient === 'top' ? 'left' : 'right';
      }
    } else {
      if ((angle + 90) % 180 === 0) {
        return 'center';
      } else if (90 <= angle && angle < 270) {
        return axisOrient === 'left' ? 'left' : 'right';
      } else {
        return axisOrient === 'left' ? 'right' : 'left';
      }
    }
  }

  return undefined;
}
function defaultLabelFlush(fieldDef, channel) {
  if (channel === 'x' && util_contains(['quantitative', 'temporal'], fieldDef.type)) {
    return true;
  }

  return undefined;
}
function defaultLabelOverlap(fieldDef, scaleType) {
  // do not prevent overlap for nominal data because there is no way to infer what the missing labels are
  if (fieldDef.type !== 'nominal') {
    if (scaleType === 'log') {
      return 'greedy';
    }

    return true;
  }

  return undefined;
}
function properties_orient(channel) {
  switch (channel) {
    case channel_X:
      return 'bottom';

    case channel_Y:
      return 'left';
  }
  /* istanbul ignore next: This should never happen. */


  throw new Error(message.INVALID_CHANNEL_FOR_AXIS);
}
function defaultTickCount(_ref) {
  var fieldDef = _ref.fieldDef,
      scaleType = _ref.scaleType,
      size = _ref.size;

  var _a;

  if (!hasDiscreteDomain(scaleType) && scaleType !== 'log' && !util_contains(['month', 'hours', 'day', 'quarter'], (_a = normalizeTimeUnit(fieldDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit)) {
    if (isBinning(fieldDef.bin)) {
      // for binned data, we don't want more ticks than maxbins
      return {
        signal: "ceil(".concat(size.signal, "/10)")
      };
    }

    return {
      signal: "ceil(".concat(size.signal, "/40)")
    };
  }

  return undefined;
}
function properties_values(specifiedAxis, model, fieldDef) {
  var vals = specifiedAxis.values;

  if (isArray(vals)) {
    return valueArray(fieldDef, vals);
  } else if (isSignalRef(vals)) {
    return vals;
  }

  return undefined;
}
function defaultZindex(mark, fieldDef) {
  if (mark === 'rect' && channeldef_isDiscrete(fieldDef)) {
    return 1;
  }

  return 0;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/calculate.js




















var calculate_CalculateNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(CalculateNode, _DataFlowNode);

  var _super = _createSuper(CalculateNode);

  function CalculateNode(parent, transform) {
    var _this;

    _classCallCheck(this, CalculateNode);

    _this = _super.call(this, parent);
    _this.transform = transform;
    _this._dependentFields = getDependentFields(_this.transform.calculate);
    return _this;
  }

  _createClass(CalculateNode, [{
    key: "clone",
    value: function clone() {
      return new CalculateNode(null, duplicate(this.transform));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set([this.transform.as]);
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return this._dependentFields;
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return {
        type: 'formula',
        expr: this.transform.calculate,
        as: this.transform.as
      };
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Calculate ".concat(util_hash(this.transform));
    }
  }], [{
    key: "parseAllForSortIndex",
    value: function parseAllForSortIndex(parent, model) {
      // get all the encoding with sort fields from model
      model.forEachFieldDef(function (fieldDef, channel) {
        if (!isScaleFieldDef(fieldDef)) {
          return;
        }

        if (isSortArray(fieldDef.sort)) {
          var field = fieldDef.field,
              timeUnit = fieldDef.timeUnit;
          var sort = fieldDef.sort; // generate `datum["a"] === val0 ? 0 : datum["a"] === val1 ? 1 : ... : n` via FieldEqualPredicate

          var calculate = sort.map(function (sortValue, i) {
            return "".concat(fieldFilterExpression({
              field: field,
              timeUnit: timeUnit,
              equal: sortValue
            }), " ? ").concat(i, " : ");
          }).join('') + sort.length;
          parent = new CalculateNode(parent, {
            calculate: calculate,
            as: sortArrayIndexField(fieldDef, channel, {
              forAs: true
            })
          });
        }
      });
      return parent;
    }
  }]);

  return CalculateNode;
}(dataflow_DataFlowNode);
function sortArrayIndexField(fieldDef, channel, opt) {
  return channeldef_vgField(fieldDef, Object.assign({
    prefix: channel,
    suffix: 'sort_index'
  }, opt !== null && opt !== void 0 ? opt : {}));
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/header/common.js


/**
 * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet.
 */

function getHeaderChannel(channel, orient) {
  if (util_contains(['top', 'bottom'], orient)) {
    return 'column';
  } else if (util_contains(['left', 'right'], orient)) {
    return 'row';
  }

  return channel === 'row' ? 'row' : 'column';
}
function getHeaderProperty(prop, facetFieldDef, config, channel) {
  var headerSpecificConfig = channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet;
  return getFirstDefined(facetFieldDef && facetFieldDef.header ? facetFieldDef.header[prop] : undefined, headerSpecificConfig[prop], config.header[prop]);
}
function getHeaderProperties(properties, facetFieldDef, config, channel) {
  var props = {};

  var _iterator = _createForOfIteratorHelper(properties),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var prop = _step.value;
      var value = getHeaderProperty(prop, facetFieldDef, config, channel);

      if (value !== undefined) {
        props[prop] = value;
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return props;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/header/component.js
var HEADER_CHANNELS = ['row', 'column'];
var HEADER_TYPES = ['header', 'footer'];
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/header/assemble.js






/**
 * Utility for generating row / column headers
 */












 // TODO: rename to assembleHeaderTitleGroup

function assembleTitleGroup(model, channel) {
  var title = model.component.layoutHeaders[channel].title;
  var config = model.config ? model.config : undefined;
  var facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef ? model.component.layoutHeaders[channel].facetFieldDef : undefined;

  var _getHeaderProperties = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef, config, channel),
      titleAnchor = _getHeaderProperties.titleAnchor,
      titleAngle = _getHeaderProperties.titleAngle,
      titleOrient = _getHeaderProperties.titleOrient;

  var headerChannel = getHeaderChannel(channel, titleOrient);
  return {
    name: "".concat(channel, "-title"),
    type: 'group',
    role: "".concat(headerChannel, "-title"),
    title: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
      text: title
    }, channel === 'row' ? {
      orient: 'left'
    } : {}), {
      style: 'guide-title'
    }), defaultHeaderGuideBaseline(titleAngle, headerChannel)), defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor)), assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP))
  };
}
function defaultHeaderGuideAlign(headerChannel, angle) {
  var anchor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'middle';

  switch (anchor) {
    case 'start':
      return {
        align: 'left'
      };

    case 'end':
      return {
        align: 'right'
      };
  }

  var align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top');
  return align ? {
    align: align
  } : {};
}
function defaultHeaderGuideBaseline(angle, channel) {
  var baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top');
  return baseline ? {
    baseline: baseline
  } : {};
}
function assembleHeaderGroups(model, channel) {
  var layoutHeader = model.component.layoutHeaders[channel];
  var groups = [];

  var _iterator = _createForOfIteratorHelper(HEADER_TYPES),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var headerType = _step.value;

      if (layoutHeader[headerType]) {
        var _iterator2 = _createForOfIteratorHelper(layoutHeader[headerType]),
            _step2;

        try {
          for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
            var headerComponent = _step2.value;
            var group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent);

            if (group != null) {
              groups.push(group);
            }
          }
        } catch (err) {
          _iterator2.e(err);
        } finally {
          _iterator2.f();
        }
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return groups;
}

function getSort(facetFieldDef, channel) {
  var _a;

  var sort = facetFieldDef.sort;

  if (isSortField(sort)) {
    return {
      field: channeldef_vgField(sort, {
        expr: 'datum'
      }),
      order: (_a = sort.order) !== null && _a !== void 0 ? _a : 'ascending'
    };
  } else if (isArray(sort)) {
    return {
      field: sortArrayIndexField(facetFieldDef, channel, {
        expr: 'datum'
      }),
      order: 'ascending'
    };
  } else {
    return {
      field: channeldef_vgField(facetFieldDef, {
        expr: 'datum'
      }),
      order: sort !== null && sort !== void 0 ? sort : 'ascending'
    };
  }
}

function assemble_assembleLabelTitle(facetFieldDef, channel, config) {
  var _getHeaderProperties2 = getHeaderProperties(['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], facetFieldDef, config, channel),
      format = _getHeaderProperties2.format,
      formatType = _getHeaderProperties2.formatType,
      labelAngle = _getHeaderProperties2.labelAngle,
      labelAnchor = _getHeaderProperties2.labelAnchor,
      labelOrient = _getHeaderProperties2.labelOrient,
      labelExpr = _getHeaderProperties2.labelExpr;

  var titleTextExpr = formatSignalRef({
    fieldDef: facetFieldDef,
    format: format,
    formatType: formatType,
    expr: 'parent',
    config: config
  }).signal;
  var headerChannel = getHeaderChannel(channel, labelOrient);
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
    text: {
      signal: labelExpr ? replaceAll(replaceAll(labelExpr, 'datum.label', titleTextExpr), 'datum.value', channeldef_vgField(facetFieldDef, {
        expr: 'parent'
      })) : titleTextExpr
    }
  }, channel === 'row' ? {
    orient: 'left'
  } : {}), {
    style: 'guide-label',
    frame: 'group'
  }), defaultHeaderGuideBaseline(labelAngle, headerChannel)), defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor)), assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP));
}
function assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent) {
  if (headerComponent) {
    var title = null;
    var facetFieldDef = layoutHeader.facetFieldDef;
    var config = model.config ? model.config : undefined;

    if (facetFieldDef && headerComponent.labels) {
      var _getHeaderProperties3 = getHeaderProperties(['labelOrient'], facetFieldDef, config, channel),
          labelOrient = _getHeaderProperties3.labelOrient; // Include label title in the header if orient aligns with the channel


      if (channel === 'row' && !util_contains(['top', 'bottom'], labelOrient) || channel === 'column' && !util_contains(['left', 'right'], labelOrient)) {
        title = assemble_assembleLabelTitle(facetFieldDef, channel, config);
      }
    }

    var isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet);
    var axes = headerComponent.axes;
    var hasAxes = (axes === null || axes === void 0 ? void 0 : axes.length) > 0;

    if (title || hasAxes) {
      var sizeChannel = channel === 'row' ? 'height' : 'width';
      return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
        name: model.getName("".concat(channel, "_").concat(headerType)),
        type: 'group',
        role: "".concat(channel, "-").concat(headerType)
      }, layoutHeader.facetFieldDef ? {
        from: {
          data: model.getName(channel + '_domain')
        },
        sort: getSort(facetFieldDef, channel)
      } : {}), hasAxes && isFacetWithoutRowCol ? {
        from: {
          data: model.getName("facet_domain_".concat(channel))
        }
      } : {}), title ? {
        title: title
      } : {}), headerComponent.sizeSignal ? {
        encode: {
          update: _defineProperty({}, sizeChannel, headerComponent.sizeSignal)
        }
      } : {}), hasAxes ? {
        axes: axes
      } : {});
    }
  }

  return null;
}
var LAYOUT_TITLE_BAND = {
  column: {
    start: 0,
    end: 1
  },
  row: {
    start: 1,
    end: 0
  }
};
function getLayoutTitleBand(titleAnchor, headerChannel) {
  return LAYOUT_TITLE_BAND[headerChannel][titleAnchor];
}
function assembleLayoutTitleBand(headerComponentIndex, config) {
  var titleBand = {};

  var _iterator3 = _createForOfIteratorHelper(FACET_CHANNELS),
      _step3;

  try {
    for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
      var channel = _step3.value;
      var headerComponent = headerComponentIndex[channel];

      if (headerComponent === null || headerComponent === void 0 ? void 0 : headerComponent.facetFieldDef) {
        var _getHeaderProperties4 = getHeaderProperties(['titleAnchor', 'titleOrient'], headerComponent.facetFieldDef, config, channel),
            titleAnchor = _getHeaderProperties4.titleAnchor,
            titleOrient = _getHeaderProperties4.titleOrient;

        var headerChannel = getHeaderChannel(channel, titleOrient);
        var band = getLayoutTitleBand(titleAnchor, headerChannel);

        if (band !== undefined) {
          titleBand[headerChannel] = band;
        }
      }
    }
  } catch (err) {
    _iterator3.e(err);
  } finally {
    _iterator3.f();
  }

  return util_keys(titleBand).length > 0 ? titleBand : undefined;
}
function assembleHeaderProperties(config, facetFieldDef, channel, properties, propertiesMap) {
  var props = {};

  var _iterator4 = _createForOfIteratorHelper(properties),
      _step4;

  try {
    for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
      var prop = _step4.value;

      if (!propertiesMap[prop]) {
        continue;
      }

      var value = getHeaderProperty(prop, facetFieldDef, config, channel);

      if (value !== undefined) {
        props[propertiesMap[prop]] = value;
      }
    }
  } catch (err) {
    _iterator4.e(err);
  } finally {
    _iterator4.f();
  }

  return props;
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.ends-with.js
var es_string_ends_with = __webpack_require__("8a79");

// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/layoutsize/assemble.js








function assemble_assembleLayoutSignals(model) {
  return [].concat(_toConsumableArray(sizeSignals(model, 'width')), _toConsumableArray(sizeSignals(model, 'height')), _toConsumableArray(sizeSignals(model, 'childWidth')), _toConsumableArray(sizeSignals(model, 'childHeight')));
}
function sizeSignals(model, sizeType) {
  var channel = sizeType === 'width' ? 'x' : 'y';
  var size = model.component.layoutSize.get(sizeType);

  if (!size || size === 'merged') {
    return [];
  } // Read size signal name from name map, just in case it is the top-level size signal that got renamed.


  var name = model.getSizeSignalRef(sizeType).signal;

  if (size === 'step') {
    var scaleComponent = model.getScaleComponent(channel);

    if (scaleComponent) {
      var type = scaleComponent.get('type');
      var range = scaleComponent.get('range');

      if (hasDiscreteDomain(type) && isVgRangeStep(range)) {
        var scaleName = model.scaleName(channel);

        if (isFacetModel(model.parent)) {
          // If parent is facet and this is an independent scale, return only signal signal
          // as the width/height will be calculated using the cardinality from
          // facet's aggregate rather than reading from scale domain
          var parentResolve = model.parent.component.resolve;

          if (parentResolve.scale[channel] === 'independent') {
            return [stepSignal(scaleName, range)];
          }
        }

        return [stepSignal(scaleName, range), {
          name: name,
          update: sizeExpr(scaleName, scaleComponent, "domain('".concat(scaleName, "').length"))
        }];
      }
    }
    /* istanbul ignore next: Condition should not happen -- only for warning in development. */


    throw new Error('layout size is step although width/height is not step.');
  } else if (size == 'container') {
    var isWidth = name.endsWith('width');
    var expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]';
    var defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height');
    var safeExpr = "isFinite(".concat(expr, ") ? ").concat(expr, " : ").concat(defaultValue);
    return [{
      name: name,
      init: safeExpr,
      on: [{
        update: safeExpr,
        events: 'window:resize'
      }]
    }];
  } else {
    return [{
      name: name,
      value: size
    }];
  }
}

function stepSignal(scaleName, range) {
  return {
    name: scaleName + '_step',
    value: range.step
  };
}

function sizeExpr(scaleName, scaleComponent, cardinality) {
  var type = scaleComponent.get('type');
  var padding = scaleComponent.get('padding');
  var paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding);
  var paddingInner = scaleComponent.get('paddingInner');
  paddingInner = type === 'band' ? // only band has real paddingInner
  paddingInner !== undefined ? paddingInner : padding : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128,
  // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points.
  1;
  return "bandspace(".concat(cardinality, ", ").concat(paddingInner, ", ").concat(paddingOuter, ") * ").concat(scaleName, "_step");
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/layoutsize/component.js
function getSizeTypeFromLayoutSizeType(layoutSizeType) {
  return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType;
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.flat.js
var es_array_flat = __webpack_require__("0481");

// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/guide.js





function guideEncodeEntry(encoding, model) {
  return util_keys(encoding).reduce(function (encode, channel) {
    var valueDef = encoding[channel];
    return Object.assign(Object.assign({}, encode), wrapCondition(model, valueDef, channel, function (x) {
      return isSignalRef(x) ? x : {
        value: x.value
      };
    }));
  }, {});
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/resolve.js




function defaultScaleResolve(channel, model) {
  if (isLayerModel(model) || isFacetModel(model)) {
    return 'shared';
  } else if (isConcatModel(model)) {
    return util_contains(POSITION_SCALE_CHANNELS, channel) ? 'independent' : 'shared';
  }
  /* istanbul ignore next: should never reach here. */


  throw new Error('invalid model type for resolve');
}
function parseGuideResolve(resolve, channel) {
  var channelScaleResolve = resolve.scale[channel];
  var guide = util_contains(POSITION_SCALE_CHANNELS, channel) ? 'axis' : 'legend';

  if (channelScaleResolve === 'independent') {
    if (resolve[guide][channel] === 'shared') {
      log_warn(message.independentScaleMeansIndependentGuide(channel));
    }

    return 'independent';
  }

  return resolve[guide][channel] || 'shared';
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/split.js






/**
 * Generic class for storing properties that are explicitly specified
 * and implicitly determined by the compiler.
 * This is important for scale/axis/legend merging as
 * we want to prioritize properties that users explicitly specified.
 */

var split_Split = /*#__PURE__*/function () {
  function Split() {
    var explicit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var implicit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, Split);

    this.explicit = explicit;
    this.implicit = implicit;
  }

  _createClass(Split, [{
    key: "clone",
    value: function clone() {
      return new Split(duplicate(this.explicit), duplicate(this.implicit));
    }
  }, {
    key: "combine",
    value: function combine() {
      // FIXME remove "as any".
      // Add "as any" to avoid an error "Spread types may only be created from object types".
      return Object.assign(Object.assign({}, this.explicit), this.implicit);
    }
  }, {
    key: "get",
    value: function get(key) {
      // Explicit has higher precedence
      return getFirstDefined(this.explicit[key], this.implicit[key]);
    }
  }, {
    key: "getWithExplicit",
    value: function getWithExplicit(key) {
      // Explicit has higher precedence
      if (this.explicit[key] !== undefined) {
        return {
          explicit: true,
          value: this.explicit[key]
        };
      } else if (this.implicit[key] !== undefined) {
        return {
          explicit: false,
          value: this.implicit[key]
        };
      }

      return {
        explicit: false,
        value: undefined
      };
    }
  }, {
    key: "setWithExplicit",
    value: function setWithExplicit(key, value) {
      if (value.value !== undefined) {
        this.set(key, value.value, value.explicit);
      }
    }
  }, {
    key: "set",
    value: function set(key, value, explicit) {
      delete this[explicit ? 'implicit' : 'explicit'][key];
      this[explicit ? 'explicit' : 'implicit'][key] = value;
      return this;
    }
  }, {
    key: "copyKeyFromSplit",
    value: function copyKeyFromSplit(key, s) {
      // Explicit has higher precedence
      if (s.explicit[key] !== undefined) {
        this.set(key, s.explicit[key], true);
      } else if (s.implicit[key] !== undefined) {
        this.set(key, s.implicit[key], false);
      }
    }
  }, {
    key: "copyKeyFromObject",
    value: function copyKeyFromObject(key, s) {
      // Explicit has higher precedence
      if (s[key] !== undefined) {
        this.set(key, s[key], true);
      }
    }
    /**
     * Merge split object into this split object. Properties from the other split
     * overwrite properties from this split.
     */

  }, {
    key: "copyAll",
    value: function copyAll(other) {
      var _iterator = _createForOfIteratorHelper(util_keys(other.combine())),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var key = _step.value;
          var val = other.getWithExplicit(key);
          this.setWithExplicit(key, val);
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
    }
  }]);

  return Split;
}();
function split_makeExplicit(value) {
  return {
    explicit: true,
    value: value
  };
}
function makeImplicit(value) {
  return {
    explicit: false,
    value: value
  };
}
function tieBreakByComparing(compare) {
  return function (v1, v2, property, propertyOf) {
    var diff = compare(v1.value, v2.value);

    if (diff > 0) {
      return v1;
    } else if (diff < 0) {
      return v2;
    }

    return defaultTieBreaker(v1, v2, property, propertyOf);
  };
}
function defaultTieBreaker(v1, v2, property, propertyOf) {
  if (v1.explicit && v2.explicit) {
    log_warn(message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value));
  } // If equal score, prefer v1.


  return v1;
}
function mergeValuesWithExplicit(v1, v2, property, propertyOf) {
  var tieBreaker = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : defaultTieBreaker;

  if (v1 === undefined || v1.value === undefined) {
    // For first run
    return v2;
  }

  if (v1.explicit && !v2.explicit) {
    return v1;
  } else if (v2.explicit && !v1.explicit) {
    return v2;
  } else if (deepEqual(v1.value, v2.value)) {
    return v1;
  } else {
    return tieBreaker(v1, v2, property, propertyOf);
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/legend/component.js







var LEGEND_COMPONENT_PROPERTY_INDEX = Object.assign(Object.assign({}, COMMON_LEGEND_PROPERTY_INDEX), {
  disable: 1,
  labelExpr: 1,
  selections: 1,
  // channel scales
  opacity: 1,
  shape: 1,
  stroke: 1,
  fill: 1,
  size: 1,
  strokeWidth: 1,
  strokeDash: 1,
  // encode
  encode: 1
});
var LEGEND_COMPONENT_PROPERTIES = util_keys(LEGEND_COMPONENT_PROPERTY_INDEX);
var component_LegendComponent = /*#__PURE__*/function (_Split) {
  _inherits(LegendComponent, _Split);

  var _super = _createSuper(LegendComponent);

  function LegendComponent() {
    _classCallCheck(this, LegendComponent);

    return _super.apply(this, arguments);
  }

  return LegendComponent;
}(split_Split);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/legend/properties.js











function legend_properties_values(legend, fieldDef) {
  var vals = legend.values;

  if (isArray(vals)) {
    return valueArray(fieldDef, vals);
  } else if (isSignalRef(vals)) {
    return vals;
  }

  return undefined;
}
function defaultSymbolType(mark, channel, shapeChannelDef, markShape) {
  var _a;

  if (channel !== 'shape') {
    // use the value from the shape encoding or the mark config if they exist
    var shape = (_a = getFirstConditionValue(shapeChannelDef)) !== null && _a !== void 0 ? _a : markShape;

    if (shape) {
      return shape;
    }
  }

  switch (mark) {
    case 'bar':
    case 'rect':
    case 'image':
    case 'square':
      return 'square';

    case 'line':
    case 'trail':
    case 'rule':
      return 'stroke';

    case 'point':
    case 'circle':
    case 'tick':
    case 'geoshape':
    case 'area':
    case 'text':
      return 'circle';
  }
}
function clipHeight(legendType) {
  if (legendType === 'gradient') {
    return 20;
  }

  return undefined;
}
function properties_type(params) {
  var legend = params.legend;
  return getFirstDefined(legend.type, properties_defaultType(params));
}
function properties_defaultType(_ref) {
  var channel = _ref.channel,
      timeUnit = _ref.timeUnit,
      scaleType = _ref.scaleType,
      alwaysReturn = _ref.alwaysReturn;

  // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js
  if (isColorChannel(channel)) {
    if (util_contains(['quarter', 'month', 'day'], timeUnit)) {
      return 'symbol';
    }

    if (isContinuousToContinuous(scaleType)) {
      return alwaysReturn ? 'gradient' : undefined;
    }
  }

  return alwaysReturn ? 'symbol' : undefined;
}
function properties_direction(_ref2) {
  var legend = _ref2.legend,
      legendConfig = _ref2.legendConfig,
      timeUnit = _ref2.timeUnit,
      channel = _ref2.channel,
      scaleType = _ref2.scaleType;
  var orient = getFirstDefined(legend.orient, legendConfig.orient, 'right');
  var legendType = properties_type({
    legend: legend,
    channel: channel,
    timeUnit: timeUnit,
    scaleType: scaleType,
    alwaysReturn: true
  });
  return getFirstDefined(legend.direction, legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'], defaultDirection(orient, legendType));
}

function defaultDirection(orient, legendType) {
  switch (orient) {
    case 'top':
    case 'bottom':
      return 'horizontal';

    case 'left':
    case 'right':
    case 'none':
    case undefined:
      // undefined = "right" in Vega
      return undefined;
    // vertical is Vega's default

    default:
      // top-left / ...
      // For inner legend, uses compact layout like Tableau
      return legendType === 'gradient' ? 'horizontal' : undefined;
  }
}

function defaultGradientLength(_ref3) {
  var legend = _ref3.legend,
      legendConfig = _ref3.legendConfig,
      model = _ref3.model,
      channel = _ref3.channel,
      scaleType = _ref3.scaleType;
  var gradientHorizontalMaxLength = legendConfig.gradientHorizontalMaxLength,
      gradientHorizontalMinLength = legendConfig.gradientHorizontalMinLength,
      gradientVerticalMaxLength = legendConfig.gradientVerticalMaxLength,
      gradientVerticalMinLength = legendConfig.gradientVerticalMinLength;

  if (isContinuousToContinuous(scaleType)) {
    var dir = properties_direction({
      legend: legend,
      legendConfig: legendConfig,
      channel: channel,
      scaleType: scaleType
    });

    if (dir === 'horizontal') {
      var orient = getFirstDefined(legend.orient, legendConfig.orient);

      if (orient === 'top' || orient === 'bottom') {
        return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength);
      } else {
        return gradientHorizontalMinLength;
      }
    } else {
      // vertical / undefined (Vega uses vertical by default)
      return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength);
    }
  }

  return undefined;
}

function gradientLengthSignal(model, sizeType, min, max) {
  var sizeSignal = model.getSizeSignalRef(sizeType).signal;
  return {
    signal: "clamp(".concat(sizeSignal, ", ").concat(min, ", ").concat(max, ")")
  };
}

function properties_defaultLabelOverlap(scaleType) {
  if (util_contains(['quantile', 'threshold', 'log'], scaleType)) {
    return 'greedy';
  }

  return undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/legend/encode.js


















function encode_type(legendCmp, model, channel) {
  var scaleType = model.getScaleComponent(channel).get('type');
  return getFirstDefined(legendCmp.get('type'), properties_defaultType({
    channel: channel,
    scaleType: scaleType,
    alwaysReturn: true
  }));
}

function encode_symbols(fieldDef, symbolsSpec, model, channel, legendCmp) {
  var _a, _b, _c, _d, _e;

  if (encode_type(legendCmp, model, channel) !== 'symbol') {
    return undefined;
  }

  var markDef = model.markDef,
      encoding = model.encoding,
      config = model.config,
      mark = model.mark;
  var filled = markDef.filled && mark !== 'trail';
  var out = Object.assign(Object.assign({}, applyMarkConfig({}, model, FILL_STROKE_CONFIG)), encode_color_color(model, {
    filled: filled
  })); // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry

  var opacity = (_a = getMaxValue(encoding.opacity)) !== null && _a !== void 0 ? _a : markDef.opacity;
  var condition = selectedCondition(model, legendCmp, fieldDef);

  if (out.fill) {
    // for fill legend, we don't want any fill in symbol
    if (channel === 'fill' || filled && channel === COLOR) {
      delete out.fill;
    } else {
      if (out.fill['field']) {
        // For others, set fill to some opaque value (or nothing if a color is already set)
        if (legendCmp.get('symbolFillColor')) {
          delete out.fill;
        } else {
          out.fill = signalOrValueRef((_b = config.legend.symbolBaseFillColor) !== null && _b !== void 0 ? _b : 'black');
          out.fillOpacity = signalOrValueRef(opacity !== null && opacity !== void 0 ? opacity : 1);
        }
      } else if (isArray(out.fill)) {
        var fill = (_e = (_d = getFirstConditionValue((_c = encoding.fill) !== null && _c !== void 0 ? _c : encoding.color)) !== null && _d !== void 0 ? _d : markDef.fill) !== null && _e !== void 0 ? _e : filled && markDef.color;

        if (fill) {
          out.fill = signalOrValueRef(fill);
        }
      }
    }
  }

  if (out.stroke) {
    if (channel === 'stroke' || !filled && channel === COLOR) {
      delete out.stroke;
    } else {
      if (out.stroke['field']) {
        // For others, remove stroke field
        delete out.stroke;
      } else if (isArray(out.stroke)) {
        var stroke = getFirstDefined(getFirstConditionValue(encoding.stroke || encoding.color), markDef.stroke, filled ? markDef.color : undefined);

        if (stroke) {
          out.stroke = {
            value: stroke
          };
        }
      }
    }
  }

  if (channel !== OPACITY) {
    if (condition) {
      out.opacity = [Object.assign({
        test: condition
      }, signalOrValueRef(opacity !== null && opacity !== void 0 ? opacity : 1)), signalOrValueRef(config.legend.unselectedOpacity)];
    } else if (opacity) {
      out.opacity = signalOrValueRef(opacity);
    }
  }

  out = Object.assign(Object.assign({}, out), symbolsSpec);
  return util_keys(out).length > 0 ? out : undefined;
}
function encode_gradient(fieldDef, gradientSpec, model, channel, legendCmp) {
  if (encode_type(legendCmp, model, channel) !== 'gradient') {
    return undefined;
  }

  var out = {};
  var opacity = getMaxValue(model.encoding.opacity) || model.markDef.opacity;

  if (opacity) {
    // only apply opacity if it is neither zero or undefined
    out.opacity = signalOrValueRef(opacity);
  }

  out = Object.assign(Object.assign({}, out), gradientSpec);
  return util_keys(out).length > 0 ? out : undefined;
}
function encode_labels(fieldDef, specifiedlabelsSpec, model, channel, legendCmp) {
  var legend = model.legend(channel) || {};
  var config = model.config;
  var condition = selectedCondition(model, legendCmp, fieldDef);
  var opacity = condition ? [{
    test: condition,
    value: 1
  }, {
    value: config.legend.unselectedOpacity
  }] : undefined;
  var format = legend.format,
      formatType = legend.formatType;
  var text = formatSignalRef({
    fieldDef: fieldDef,
    format: format,
    formatType: formatType,
    field: 'datum.value',
    config: config,
    isUTCScale: model.getScaleComponent(channel).get('type') === ScaleType.UTC,
    omitNumberFormatAndEmptyTimeFormat: true // no need to generate number format for encoding block as we can use Vega's legend format

  });
  var labelsSpec = Object.assign(Object.assign(Object.assign({}, opacity ? {
    opacity: opacity
  } : {}), text ? {
    text: text
  } : {}), specifiedlabelsSpec);
  return util_keys(labelsSpec).length > 0 ? labelsSpec : undefined;
}
function encode_entries(fieldDef, entriesSpec, model, channel, legendCmp) {
  var selections = legendCmp.get('selections');
  return (selections === null || selections === void 0 ? void 0 : selections.length) ? {
    fill: {
      value: 'transparent'
    }
  } : undefined;
}

function getMaxValue(channelDef) {
  return getConditionValue(channelDef, function (v, conditionalDef) {
    return Math.max(v, conditionalDef.value);
  });
}

function getFirstConditionValue(channelDef) {
  return getConditionValue(channelDef, function (v, conditionalDef) {
    return getFirstDefined(v, conditionalDef.value);
  });
}

function getConditionValue(channelDef, reducer) {
  if (hasConditionalValueDef(channelDef)) {
    return vega_util_src_array(channelDef.condition).reduce(reducer, channelDef.value);
  } else if (isValueDef(channelDef)) {
    return channelDef.value;
  }

  return undefined;
}

function selectedCondition(model, legendCmp, fieldDef) {
  var selections = legendCmp.get('selections');
  if (!(selections === null || selections === void 0 ? void 0 : selections.length)) return undefined;
  var field = stringValue_$(fieldDef.field);
  return selections.map(function (name) {
    var store = stringValue_$(varName(name) + STORE);
    return "(!length(data(".concat(store, ")) || (").concat(name, "[").concat(field, "] && indexof(").concat(name, "[").concat(field, "], datum.value) >= 0))");
  }).join(' || ');
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/legend/parse.js


























function parse_parseLegend(model) {
  if (isUnitModel(model)) {
    model.component.legends = parseUnitLegend(model);
  } else {
    model.component.legends = parseNonUnitLegend(model);
  }
}

function parseUnitLegend(model) {
  var encoding = model.encoding;
  return [COLOR, FILL, STROKE, STROKEWIDTH, STROKEDASH, channel_SIZE, SHAPE, OPACITY, FILLOPACITY, STROKEOPACITY].reduce(function (legendComponent, channel) {
    var def = encoding[channel];

    if (model.channelHasField(channel) && model.getScaleComponent(channel) && !(isFieldDef(def) && channel === SHAPE && def.type === GEOJSON)) {
      legendComponent[channel] = parseLegendForChannel(model, channel);
    }

    return legendComponent;
  }, {});
}

function getLegendDefWithScale(model, channel) {
  var scale = model.scaleName(channel);

  if (model.mark === 'trail') {
    if (channel === 'color') {
      // trail is a filled mark, but its default symbolType ("stroke") should use "stroke"
      return {
        stroke: scale
      };
    } else if (channel === 'size') {
      return {
        strokeWidth: scale
      };
    }
  }

  if (channel === 'color') {
    return model.markDef.filled ? {
      fill: scale
    } : {
      stroke: scale
    };
  }

  return _defineProperty({}, channel, scale);
}

function isExplicit(value, property, legend, fieldDef) {
  switch (property) {
    case 'disable':
      return legend !== undefined;
    // if axis is specified or null/false, then it's enable/disable state is explicit

    case 'values':
      // specified legend.values is already respected, but may get transformed.
      return !!(legend === null || legend === void 0 ? void 0 : legend.values);

    case 'title':
      // title can be explicit if fieldDef.title is set
      if (property === 'title' && value === fieldDef.title) {
        return true;
      }

  } // Otherwise, things are explicit if the returned value matches the specified property


  return value === (legend || {})[property];
}

function parseLegendForChannel(model, channel) {
  var _a;

  var fieldDef = model.fieldDef(channel);
  var legend = model.legend(channel);
  var legendCmpt = new component_LegendComponent({}, getLegendDefWithScale(model, channel));
  parseInteractiveLegend(model, channel, legendCmpt);

  var _iterator = _createForOfIteratorHelper(LEGEND_COMPONENT_PROPERTIES),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var property = _step.value;
      var value = getProperty(property, legend, channel, model);

      if (value !== undefined) {
        var explicit = isExplicit(value, property, legend, fieldDef);

        if (explicit || model.config.legend[property] === undefined) {
          legendCmpt.set(property, value, explicit);
        }
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  var legendEncoding = (_a = legend === null || legend === void 0 ? void 0 : legend.encoding) !== null && _a !== void 0 ? _a : {};
  var selections = legendCmpt.get('selections');
  var legendEncode = ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries'].reduce(function (e, part) {
    var _a;

    var legendEncodingPart = guideEncodeEntry((_a = legendEncoding[part]) !== null && _a !== void 0 ? _a : {}, model);
    var value = legend_encode_namespaceObject[part] ? legend_encode_namespaceObject[part](fieldDef, legendEncodingPart, model, channel, legendCmpt) // apply rule
    : legendEncodingPart; // no rule -- just default values

    if (value !== undefined && util_keys(value).length > 0) {
      e[part] = Object.assign(Object.assign(Object.assign({}, (selections === null || selections === void 0 ? void 0 : selections.length) ? {
        name: "".concat(varName(fieldDef.field), "_legend_").concat(part)
      } : {}), (selections === null || selections === void 0 ? void 0 : selections.length) ? {
        interactive: !!selections
      } : {}), {
        update: value
      });
    }

    return e;
  }, {});

  if (util_keys(legendEncode).length > 0) {
    legendCmpt.set('encode', legendEncode, !!(legend === null || legend === void 0 ? void 0 : legend.encoding));
  }

  return legendCmpt;
}

function getProperty(property, legend, channel, model) {
  var _a;

  if (property === 'disable') {
    return legend !== undefined && !legend;
  }

  legend = legend || {}; // assign object so the rest doesn't have to check if legend exists

  var encoding = model.encoding,
      mark = model.mark;
  var fieldDef = getTypedFieldDef(encoding[channel]);
  var legendConfig = model.config.legend;
  var timeUnit = (_a = normalizeTimeUnit(fieldDef.timeUnit)) === null || _a === void 0 ? void 0 : _a.unit;
  var scaleType = model.getScaleComponent(channel).get('type');

  switch (property) {
    // TODO: enable when https://github.com/vega/vega/issues/1351 is fixed
    // case 'clipHeight':
    //   return getFirstDefined(specifiedLegend.clipHeight, properties.clipHeight(properties.type(...)));
    case 'direction':
      return properties_direction({
        legend: legend,
        legendConfig: legendConfig,
        timeUnit: timeUnit,
        channel: channel,
        scaleType: scaleType
      });

    case 'format':
      // We don't include temporal field here as we apply format in encode block
      if (isFieldDefForTimeFormat(fieldDef)) {
        return undefined;
      }

      return numberFormat(fieldDef, legend.format, model.config);

    case 'formatType':
      // As with format, we don't include temporal field here as we apply format in encode block
      if (isFieldDefForTimeFormat(fieldDef)) {
        return undefined;
      }

      return legend.formatType;

    case 'gradientLength':
      return getFirstDefined( // do specified gradientLength first
      legend.gradientLength, legendConfig.gradientLength, // Otherwise, use smart default based on plot height
      defaultGradientLength({
        model: model,
        legend: legend,
        legendConfig: legendConfig,
        channel: channel,
        scaleType: scaleType
      }));

    case 'labelOverlap':
      return getFirstDefined(legend.labelOverlap, properties_defaultLabelOverlap(scaleType));

    case 'symbolType':
      return getFirstDefined(legend.symbolType, defaultSymbolType(mark, channel, encoding.shape, model.markDef.shape));

    case 'title':
      return channeldef_title(fieldDef, model.config, {
        allowDisabling: true
      });

    case 'type':
      return properties_type({
        legend: legend,
        channel: channel,
        timeUnit: timeUnit,
        scaleType: scaleType,
        alwaysReturn: false
      });

    case 'values':
      return legend_properties_values(legend, fieldDef);
  } // Otherwise, return specified property.


  return legend[property];
}

function parseNonUnitLegend(model) {
  var _model$component = model.component,
      legends = _model$component.legends,
      resolve = _model$component.resolve;

  var _iterator2 = _createForOfIteratorHelper(model.children),
      _step2;

  try {
    var _loop = function _loop() {
      var child = _step2.value;
      parse_parseLegend(child);
      util_keys(child.component.legends).forEach(function (channel) {
        resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel);

        if (resolve.legend[channel] === 'shared') {
          // If the resolve says shared (and has not been overridden)
          // We will try to merge and see if there is a conflict
          legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]);

          if (!legends[channel]) {
            // If merge returns nothing, there is a conflict so we cannot make the legend shared.
            // Thus, mark legend as independent and remove the legend component.
            resolve.legend[channel] = 'independent';
            delete legends[channel];
          }
        }
      });
    };

    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      _loop();
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }

  util_keys(legends).forEach(function (channel) {
    var _iterator3 = _createForOfIteratorHelper(model.children),
        _step3;

    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var child = _step3.value;

        if (!child.component.legends[channel]) {
          // skip if the child does not have a particular legend
          continue;
        }

        if (resolve.legend[channel] === 'shared') {
          // After merging shared legend, make sure to remove legend from child
          delete child.component.legends[channel];
        }
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }
  });
  return legends;
}

function mergeLegendComponent(mergedLegend, childLegend) {
  var _a, _b, _c, _d, _e, _f;

  if (!mergedLegend) {
    return childLegend.clone();
  }

  var mergedOrient = mergedLegend.getWithExplicit('orient');
  var childOrient = childLegend.getWithExplicit('orient');

  if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {
    // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)
    // Cannot merge due to inconsistent orient
    return undefined;
  }

  var typeMerged = false; // Otherwise, let's merge

  var _iterator4 = _createForOfIteratorHelper(LEGEND_COMPONENT_PROPERTIES),
      _step4;

  try {
    var _loop2 = function _loop2() {
      var prop = _step4.value;
      var mergedValueWithExplicit = mergeValuesWithExplicit(mergedLegend.getWithExplicit(prop), childLegend.getWithExplicit(prop), prop, 'legend', // Tie breaker function
      function (v1, v2) {
        switch (prop) {
          case 'symbolType':
            return mergeSymbolType(v1, v2);

          case 'title':
            return mergeTitleComponent(v1, v2);

          case 'type':
            // There are only two types. If we have different types, then prefer symbol over gradient.
            typeMerged = true;
            return makeImplicit('symbol');
        }

        return defaultTieBreaker(v1, v2, prop, 'legend');
      });
      mergedLegend.setWithExplicit(prop, mergedValueWithExplicit);
    };

    for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
      _loop2();
    }
  } catch (err) {
    _iterator4.e(err);
  } finally {
    _iterator4.f();
  }

  if (typeMerged) {
    if ((_c = (_b = (_a = mergedLegend.implicit) === null || _a === void 0 ? void 0 : _a.encode) === null || _b === void 0 ? void 0 : _b.gradient) !== null && _c !== void 0 ? _c : {}) {
      deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']);
    }

    if ((_f = (_e = (_d = mergedLegend.explicit) === null || _d === void 0 ? void 0 : _d.encode) === null || _e === void 0 ? void 0 : _e.gradient) !== null && _f !== void 0 ? _f : {}) {
      deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']);
    }
  }

  return mergedLegend;
}

function mergeSymbolType(st1, st2) {
  if (st2.value === 'circle') {
    // prefer "circle" over "stroke"
    return st2;
  }

  return st1;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/legend/assemble.js












function setLegendEncode(legend, part, vgProp, vgRef) {
  var _a, _b, _c;

  legend.encode = (_a = legend.encode) !== null && _a !== void 0 ? _a : {};
  legend.encode[part] = (_b = legend.encode[part]) !== null && _b !== void 0 ? _b : {};
  legend.encode[part].update = (_c = legend.encode[part].update) !== null && _c !== void 0 ? _c : {}; // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291

  legend.encode[part].update[vgProp] = vgRef;
}

function assemble_assembleLegends(model) {
  var legendComponentIndex = model.component.legends;
  var legendByDomain = {};

  var _iterator = _createForOfIteratorHelper(util_keys(legendComponentIndex)),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var channel = _step.value;
      var scaleComponent = model.getScaleComponent(channel);
      var domainHash = stringify(scaleComponent.get('domains'));

      if (legendByDomain[domainHash]) {
        var _iterator2 = _createForOfIteratorHelper(legendByDomain[domainHash]),
            _step2;

        try {
          for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
            var mergedLegendComponent = _step2.value;
            var merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]);

            if (!merged) {
              // If cannot merge, need to add this legend separately
              legendByDomain[domainHash].push(legendComponentIndex[channel]);
            }
          }
        } catch (err) {
          _iterator2.e(err);
        } finally {
          _iterator2.f();
        }
      } else {
        legendByDomain[domainHash] = [legendComponentIndex[channel].clone()];
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return util_vals(legendByDomain).flat().map(assembleLegend).filter(function (l) {
    return l !== undefined;
  });
}
function assembleLegend(legendCmpt) {
  var _a, _b, _c, _d;

  var _e = legendCmpt.combine(),
      disable = _e.disable,
      labelExpr = _e.labelExpr,
      selections = _e.selections,
      legend = __rest(_e, ["disable", "labelExpr", "selections"]);

  if (disable) {
    return undefined;
  }

  if ((_a = legend.encode) === null || _a === void 0 ? void 0 : _a.symbols) {
    var out = legend.encode.symbols.update;

    if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) {
      // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used.
      out.stroke = {
        value: 'transparent'
      };
    } // Remove properties that the legend is encoding.


    var _iterator3 = _createForOfIteratorHelper(LEGEND_SCALE_CHANNELS),
        _step3;

    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var property = _step3.value;

        if (legend[property]) {
          delete out[property];
        }
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }
  }

  if (!legend.title) {
    // title schema doesn't include null, ''
    delete legend.title;
  }

  if (labelExpr !== undefined) {
    var expr = labelExpr;

    if (((_d = (_c = (_b = legend.encode) === null || _b === void 0 ? void 0 : _b.labels) === null || _c === void 0 ? void 0 : _c.update) === null || _d === void 0 ? void 0 : _d.text) && isSignalRef(legend.encode.labels.update.text)) {
      expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal);
    }

    setLegendEncode(legend, 'labels', 'text', {
      signal: expr
    });
  }

  for (var prop in legend) {
    var propValue = legend[prop];

    if (isSignalRef(propValue)) {
      var propIndex = SIGNAL_LEGEND_PROP_INDEX[prop];

      if (propIndex) {
        var vgProp = propIndex.vgProp,
            part = propIndex.part;
        setLegendEncode(legend, part, vgProp, propValue);
        delete legend[prop];
      }
    }
  }

  return legend;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/projection/assemble.js










function assemble_assembleProjections(model) {
  if (isLayerModel(model) || isConcatModel(model)) {
    return assembleProjectionsForModelAndChildren(model);
  } else {
    return assembleProjectionForModel(model);
  }
}
function assembleProjectionsForModelAndChildren(model) {
  return model.children.reduce(function (projections, child) {
    return projections.concat(child.assembleProjections());
  }, assembleProjectionForModel(model));
}
function assembleProjectionForModel(model) {
  var component = model.component.projection;

  if (!component || component.merged) {
    return [];
  }

  var projection = component.combine();

  var name = projection.name,
      rest = __rest(projection, ["name"]); // we need to extract name so that it is always present in the output and pass TS type validation


  if (!component.data) {
    // generate custom projection, no automatic fitting
    return [Object.assign(Object.assign({
      name: name
    }, {
      translate: {
        signal: '[width / 2, height / 2]'
      }
    }), rest)];
  } else {
    // generate projection that uses extent fitting
    var size = {
      signal: "[".concat(component.size.map(function (ref) {
        return ref.signal;
      }).join(', '), "]")
    };
    var fit = component.data.reduce(function (sources, data) {
      var source = isSignalRef(data) ? data.signal : "data('".concat(model.lookupDataSource(data), "')");

      if (!util_contains(sources, source)) {
        // build a unique list of sources
        sources.push(source);
      }

      return sources;
    }, []);

    if (fit.length <= 0) {
      throw new Error("Projection's fit didn't find any data sources");
    }

    return [Object.assign({
      name: name,
      size: size,
      fit: {
        signal: fit.length > 1 ? "[".concat(fit.join(', '), "]") : fit[0]
      }
    }, rest)];
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/projection.js
var PROJECTION_PROPERTIES = ['type', 'clipAngle', 'clipExtent', 'center', 'rotate', 'precision', 'reflectX', 'reflectY', 'coefficient', 'distance', 'fraction', 'lobes', 'parallel', 'radius', 'ratio', 'spacing', 'tilt'];
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/projection/component.js






var component_ProjectionComponent = /*#__PURE__*/function (_Split) {
  _inherits(ProjectionComponent, _Split);

  var _super = _createSuper(ProjectionComponent);

  function ProjectionComponent(name, specifiedProjection, size, data) {
    var _this;

    _classCallCheck(this, ProjectionComponent);

    _this = _super.call(this, Object.assign({}, specifiedProjection), // all explicit properties of projection
    {
      name: name
    } // name as initial implicit property
    );
    _this.specifiedProjection = specifiedProjection;
    _this.size = size;
    _this.data = data;
    _this.merged = false;
    return _this;
  }
  /**
   * Whether the projection parameters should fit provided data.
   */


  _createClass(ProjectionComponent, [{
    key: "isFit",
    get: function get() {
      return !!this.data;
    }
  }]);

  return ProjectionComponent;
}(split_Split);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/projection/parse.js











function parse_parseProjection(model) {
  model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model);
}

function parseUnitProjection(model) {
  var _a;

  if (model.hasProjection) {
    var proj = model.specifiedProjection;
    var fit = !(proj && (proj.scale != null || proj.translate != null));
    var size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined;
    var data = fit ? gatherFitData(model) : undefined;
    return new component_ProjectionComponent(model.projectionName(true), Object.assign(Object.assign({}, (_a = model.config.projection) !== null && _a !== void 0 ? _a : {}), proj !== null && proj !== void 0 ? proj : {}), size, data);
  }

  return undefined;
}

function gatherFitData(model) {
  var data = [];

  for (var _i = 0, _arr = [[LONGITUDE, LATITUDE], [LONGITUDE2, LATITUDE2]]; _i < _arr.length; _i++) {
    var posssiblePair = _arr[_i];

    if (model.channelHasField(posssiblePair[0]) || model.channelHasField(posssiblePair[1])) {
      data.push({
        signal: model.getName("geojson_".concat(data.length))
      });
    }
  }

  if (model.channelHasField(SHAPE) && model.fieldDef(SHAPE).type === GEOJSON) {
    data.push({
      signal: model.getName("geojson_".concat(data.length))
    });
  }

  if (data.length === 0) {
    // main source is geojson, so we can just use that
    data.push(model.requestDataName(MAIN));
  }

  return data;
}

function mergeIfNoConflict(first, second) {
  var allPropertiesShared = every(PROJECTION_PROPERTIES, function (prop) {
    // neither has the property
    if (!src_hasOwnProperty(first.explicit, prop) && !src_hasOwnProperty(second.explicit, prop)) {
      return true;
    } // both have property and an equal value for property


    if (src_hasOwnProperty(first.explicit, prop) && src_hasOwnProperty(second.explicit, prop) && // some properties might be signals or objects and require hashing for comparison
    stringify(first.get(prop)) === stringify(second.get(prop))) {
      return true;
    }

    return false;
  });
  var size = stringify(first.size) === stringify(second.size);

  if (size) {
    if (allPropertiesShared) {
      return first;
    } else if (stringify(first.explicit) === stringify({})) {
      return second;
    } else if (stringify(second.explicit) === stringify({})) {
      return first;
    }
  } // if all properties don't match, let each unit spec have its own projection


  return null;
}

function parseNonUnitProjections(model) {
  if (model.children.length === 0) {
    return undefined;
  }

  var nonUnitProjection; // parse all children first

  var _iterator = _createForOfIteratorHelper(model.children),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var _child = _step.value;
      parse_parseProjection(_child);
    } // analyze parsed projections, attempt to merge

  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  var mergable = every(model.children, function (child) {
    var projection = child.component.projection;

    if (!projection) {
      // child layer does not use a projection
      return true;
    } else if (!nonUnitProjection) {
      // cached 'projection' is null, cache this one
      nonUnitProjection = projection;
      return true;
    } else {
      var merge = mergeIfNoConflict(nonUnitProjection, projection);

      if (merge) {
        nonUnitProjection = merge;
      }

      return !!merge;
    }
  }); // if cached one and all other children share the same projection,

  if (nonUnitProjection && mergable) {
    // so we can elevate it to the layer level
    var name = model.projectionName(true);
    var modelProjection = new component_ProjectionComponent(name, nonUnitProjection.specifiedProjection, nonUnitProjection.size, duplicate(nonUnitProjection.data)); // rename and assign all others as merged

    var _iterator2 = _createForOfIteratorHelper(model.children),
        _step2;

    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var child = _step2.value;
        var projection = child.component.projection;

        if (projection) {
          if (projection.isFit) {
            var _modelProjection$data;

            (_modelProjection$data = modelProjection.data).push.apply(_modelProjection$data, _toConsumableArray(child.component.projection.data));
          }

          child.renameProjection(projection.get('name'), name);
          projection.merged = true;
        }
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }

    return modelProjection;
  }

  return undefined;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toArray.js




function _toArray(arr) {
  return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.flat-map.js
var es_array_flat_map = __webpack_require__("5db7");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.unscopables.flat-map.js
var es_array_unscopables_flat_map = __webpack_require__("73d9");

// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/bin.js






























function rangeFormula(model, fieldDef, channel, config) {
  var _a, _b;

  if (binRequiresRange(fieldDef, channel)) {
    // read format from axis or legend, if there is no format then use config.numberFormat
    var guide = isUnitModel(model) ? (_b = (_a = model.axis(channel)) !== null && _a !== void 0 ? _a : model.legend(channel)) !== null && _b !== void 0 ? _b : {} : {};
    var startField = channeldef_vgField(fieldDef, {
      expr: 'datum'
    });
    var endField = channeldef_vgField(fieldDef, {
      expr: 'datum',
      binSuffix: 'end'
    });
    return {
      formulaAs: channeldef_vgField(fieldDef, {
        binSuffix: 'range',
        forAs: true
      }),
      formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config)
    };
  }

  return {};
}

function binKey(bin, field) {
  return "".concat(binToString(bin), "_").concat(field);
}

function getSignalsFromModel(model, key) {
  return {
    signal: model.getName("".concat(key, "_bins")),
    extentSignal: model.getName("".concat(key, "_extent"))
  };
}

function getBinSignalName(model, field, bin) {
  var _a;

  var normalizedBin = (_a = normalizeBin(bin, undefined)) !== null && _a !== void 0 ? _a : {};
  var key = binKey(normalizedBin, field);
  return model.getName("".concat(key, "_bins"));
}

function isBinTransform(t) {
  return 'as' in t;
}

function createBinComponent(t, bin, model) {
  var as;
  var span;

  if (isBinTransform(t)) {
    as = isString(t.as) ? [t.as, "".concat(t.as, "_end")] : [t.as[0], t.as[1]];
  } else {
    as = [channeldef_vgField(t, {
      forAs: true
    }), channeldef_vgField(t, {
      binSuffix: 'end',
      forAs: true
    })];
  }

  var normalizedBin = Object.assign({}, normalizeBin(bin, undefined));
  var key = binKey(normalizedBin, t.field);

  var _getSignalsFromModel = getSignalsFromModel(model, key),
      signal = _getSignalsFromModel.signal,
      extentSignal = _getSignalsFromModel.extentSignal;

  if (isSelectionExtent(normalizedBin.extent)) {
    var ext = normalizedBin.extent;
    var selName = ext.selection;
    span = parseSelectionBinExtent(model.getSelectionComponent(varName(selName), selName), ext);
    delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property.
  }

  var binComponent = Object.assign(Object.assign(Object.assign({
    bin: normalizedBin,
    field: t.field,
    as: [as]
  }, signal ? {
    signal: signal
  } : {}), extentSignal ? {
    extentSignal: extentSignal
  } : {}), span ? {
    span: span
  } : {});
  return {
    key: key,
    binComponent: binComponent
  };
}

var bin_BinNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(BinNode, _DataFlowNode);

  var _super = _createSuper(BinNode);

  function BinNode(parent, bins) {
    var _this;

    _classCallCheck(this, BinNode);

    _this = _super.call(this, parent);
    _this.bins = bins;
    return _this;
  }

  _createClass(BinNode, [{
    key: "clone",
    value: function clone() {
      return new BinNode(null, duplicate(this.bins));
    }
  }, {
    key: "merge",
    value:
    /**
     * Merge bin nodes. This method either integrates the bin config from the other node
     * or if this node already has a bin config, renames the corresponding signal in the model.
     */
    function merge(other, renameSignal) {
      var _iterator = _createForOfIteratorHelper(util_keys(other.bins)),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var key = _step.value;

          if (key in this.bins) {
            renameSignal(other.bins[key].signal, this.bins[key].signal); // Ensure that we don't have duplicate names for signal pairs

            this.bins[key].as = unique([].concat(_toConsumableArray(this.bins[key].as), _toConsumableArray(other.bins[key].as)), util_hash);
          } else {
            this.bins[key] = other.bins[key];
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      var _iterator2 = _createForOfIteratorHelper(other.children),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var child = _step2.value;
          other.removeChild(child);
          child.parent = this;
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }

      other.remove();
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(util_vals(this.bins).map(function (c) {
        return c.as;
      }).flat(2));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set(util_vals(this.bins).map(function (c) {
        return c.field;
      }));
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Bin ".concat(util_hash(this.bins));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return util_vals(this.bins).flatMap(function (bin) {
        var transform = [];

        var _bin$as = _toArray(bin.as),
            binAs = _bin$as[0],
            remainingAs = _bin$as.slice(1);

        var _a = bin.bin,
            extent = _a.extent,
            params = __rest(_a, ["extent"]);

        var binTrans = Object.assign(Object.assign(Object.assign({
          type: 'bin',
          field: replacePathInField(bin.field),
          as: binAs,
          signal: bin.signal
        }, !isSelectionExtent(extent) ? {
          extent: extent
        } : {
          extent: null
        }), bin.span ? {
          span: {
            signal: "span(".concat(bin.span, ")")
          }
        } : {}), params);

        if (!extent && bin.extentSignal) {
          transform.push({
            type: 'extent',
            field: replacePathInField(bin.field),
            signal: bin.extentSignal
          });
          binTrans.extent = {
            signal: bin.extentSignal
          };
        }

        transform.push(binTrans);

        var _iterator3 = _createForOfIteratorHelper(remainingAs),
            _step3;

        try {
          for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
            var as = _step3.value;

            for (var i = 0; i < 2; i++) {
              transform.push({
                type: 'formula',
                expr: channeldef_vgField({
                  field: binAs[i]
                }, {
                  expr: 'datum'
                }),
                as: as[i]
              });
            }
          }
        } catch (err) {
          _iterator3.e(err);
        } finally {
          _iterator3.f();
        }

        if (bin.formula) {
          transform.push({
            type: 'formula',
            expr: bin.formula,
            as: bin.formulaAs
          });
        }

        return transform;
      });
    }
  }], [{
    key: "makeFromEncoding",
    value: function makeFromEncoding(parent, model) {
      var bins = model.reduceFieldDef(function (binComponentIndex, fieldDef, channel) {
        if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) {
          var _createBinComponent = createBinComponent(fieldDef, fieldDef.bin, model),
              key = _createBinComponent.key,
              binComponent = _createBinComponent.binComponent;

          binComponentIndex[key] = Object.assign(Object.assign(Object.assign({}, binComponent), binComponentIndex[key]), rangeFormula(model, fieldDef, channel, model.config));
        }

        return binComponentIndex;
      }, {});

      if (util_keys(bins).length === 0) {
        return null;
      }

      return new BinNode(parent, bins);
    }
    /**
     * Creates a bin node from BinTransform.
     * The optional parameter should provide
     */

  }, {
    key: "makeFromTransform",
    value: function makeFromTransform(parent, t, model) {
      var _createBinComponent2 = createBinComponent(t, t.bin, model),
          key = _createBinComponent2.key,
          binComponent = _createBinComponent2.binComponent;

      return new BinNode(parent, _defineProperty({}, key, binComponent));
    }
  }]);

  return BinNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/source.js















var source_SourceNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(SourceNode, _DataFlowNode);

  var _super = _createSuper(SourceNode);

  function SourceNode(data) {
    var _this;

    _classCallCheck(this, SourceNode);

    _this = _super.call(this, null); // source cannot have parent

    data = data !== null && data !== void 0 ? data : {
      name: 'source'
    };
    var format;

    if (!isGenerator(data)) {
      format = data.format ? Object.assign({}, omit(data.format, ['parse'])) : {};
    }

    if (isInlineData(data)) {
      _this._data = {
        values: data.values
      };
    } else if (isUrlData(data)) {
      _this._data = {
        url: data.url
      };

      if (!format.type) {
        // Extract extension from URL using snippet from
        // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript
        var defaultExtension = /(?:\.([^.]+))?$/.exec(data.url)[1];

        if (!util_contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) {
          defaultExtension = 'json';
        } // defaultExtension has type string but we ensure that it is DataFormatType above


        format.type = defaultExtension;
      }
    } else if (isSphereGenerator(data)) {
      // hardwire GeoJSON sphere data into output specification
      _this._data = {
        values: [{
          type: 'Sphere'
        }]
      };
    } else if (isNamedData(data) || isGenerator(data)) {
      _this._data = {};
    } // set flag to check if generator


    _this._generator = isGenerator(data); // any dataset can be named

    if (data.name) {
      _this._name = data.name;
    }

    if (format && util_keys(format).length > 0) {
      _this._data.format = format;
    }

    return _this;
  }

  _createClass(SourceNode, [{
    key: "dependentFields",
    value: function dependentFields() {
      return new Set();
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return undefined; // we don't know what this source produces
    }
  }, {
    key: "data",
    get: function get() {
      return this._data;
    }
  }, {
    key: "hasName",
    value: function hasName() {
      return !!this._name;
    }
  }, {
    key: "isGenerator",
    get: function get() {
      return this._generator;
    }
  }, {
    key: "dataName",
    get: function get() {
      return this._name;
    },
    set: function set(name) {
      this._name = name;
    }
  }, {
    key: "parent",
    set: function set(parent) {
      throw new Error('Source nodes have to be roots.');
    }
  }, {
    key: "remove",
    value: function remove() {
      throw new Error('Source nodes are roots and cannot be removed.');
    }
  }, {
    key: "hash",
    value: function hash() {
      throw new Error('Cannot hash sources');
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return Object.assign(Object.assign({
        name: this._name
      }, this._data), {
        transform: []
      });
    }
  }]);

  return SourceNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/debug.js















/**
 * Print debug information for dataflow tree.
 */

function debug_debug(node) {
  console.log("".concat(node.constructor.name).concat(node.debugName ? "(".concat(node.debugName, ")") : '', " -> ").concat(node.children.map(function (c) {
    return "".concat(c.constructor.name).concat(c.debugName ? " (".concat(c.debugName, ")") : '');
  })));
  console.log(node);
  node.children.forEach(debug_debug);
}
/**
 * Print the dataflow tree as graphviz.
 *
 * Render the output in http://viz-js.com/.
 */

function debug_draw(roots) {
  // check the graph before printing it since the logic below assumes a consistent graph
  checkLinks(roots);
  var nodes = {};
  var edges = [];

  function getId(node) {
    var id = node['__uniqueid'];

    if (id === undefined) {
      id = uniqueId();
      node['__uniqueid'] = id;
    }

    return id;
  }

  function getLabel(node) {
    var _a;

    var out = [node.constructor.name.slice(0, -4)];

    if (node.debugName) {
      out.push("<i>".concat(node.debugName, "</i>"));
    } else if (node instanceof source_SourceNode) {
      if (node.data.name || node.data.url) {
        out.push("<i>".concat((_a = node.data.name) !== null && _a !== void 0 ? _a : node.data.url, "</i>"));
      }
    }

    var dep = node.dependentFields();

    if (dep === null || dep === void 0 ? void 0 : dep.size) {
      out.push("<font color=\"grey\" point-size=\"10\">IN:</font> ".concat(_toConsumableArray(node.dependentFields()).join(', ')));
    }

    var prod = node.producedFields();

    if (prod === null || prod === void 0 ? void 0 : prod.size) {
      out.push("<font color=\"grey\" point-size=\"10\">OUT:</font> ".concat(_toConsumableArray(node.producedFields()).join(', ')));
    }

    if (node instanceof dataflow_OutputNode) {
      out.push("<font color=\"grey\" point-size=\"10\">required:</font> ".concat(node.isRequired()));
    }

    return out.join('<br/>');
  }

  function collector(node) {
    var _a, _b;

    var id = getId(node);
    nodes[id] = {
      id: id,
      label: getLabel(node),
      hash: node instanceof source_SourceNode ? (_b = (_a = node.data.url) !== null && _a !== void 0 ? _a : node.data.name) !== null && _b !== void 0 ? _b : node.debugName : String(node.hash()).replace(/"/g, '')
    };

    var _iterator = _createForOfIteratorHelper(node.children),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var child = _step.value;
        edges.push([id, getId(child)]);
        collector(child);
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
  }

  roots.forEach(function (n) {
    return collector(n);
  });
  var dot = "digraph DataFlow {\n  rankdir = TB;\n  node [shape=record]\n  ".concat(util_entries(nodes).map(function (_ref) {
    var key = _ref.key,
        value = _ref.value;
    return "  \"".concat(key, "\" [\n    label = <").concat(value.label, ">;\n    tooltip = \"[").concat(value.id, "]&#010;").concat(value.hash, "\"\n  ]");
  }).join('\n'), "\n\n  ").concat(edges.map(function (_ref2) {
    var _ref3 = _slicedToArray(_ref2, 2),
        source = _ref3[0],
        target = _ref3[1];

    return "\"".concat(source, "\" -> \"").concat(target, "\"");
  }).join(' '), "\n}");
  console.log(dot);
  return dot;
}
/**
 * Iterates over a dataflow graph and checks whether all links are consistent.
 */

function checkLinks(nodes) {
  var _iterator2 = _createForOfIteratorHelper(nodes),
      _step2;

  try {
    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      var node = _step2.value;

      var _iterator3 = _createForOfIteratorHelper(node.children),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var child = _step3.value;

          if (child.parent !== node) {
            console.error('Dataflow graph is inconsistent.', node, child);
            return false;
          }
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }

      if (!checkLinks(node.children)) {
        return false;
      }
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }

  return true;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/graticule.js












var graticule_GraticuleNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(GraticuleNode, _DataFlowNode);

  var _super = _createSuper(GraticuleNode);

  function GraticuleNode(parent, params) {
    var _this;

    _classCallCheck(this, GraticuleNode);

    _this = _super.call(this, parent);
    _this.params = params;
    return _this;
  }

  _createClass(GraticuleNode, [{
    key: "clone",
    value: function clone() {
      return new GraticuleNode(null, this.params);
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set();
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return undefined; // there should never be a node before graticule
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Graticule ".concat(util_hash(this.params));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return Object.assign({
        type: 'graticule'
      }, this.params === true ? {} : this.params);
    }
  }]);

  return GraticuleNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/sequence.js












var sequence_SequenceNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(SequenceNode, _DataFlowNode);

  var _super = _createSuper(SequenceNode);

  function SequenceNode(parent, params) {
    var _this;

    _classCallCheck(this, SequenceNode);

    _this = _super.call(this, parent);
    _this.params = params;
    return _this;
  }

  _createClass(SequenceNode, [{
    key: "clone",
    value: function clone() {
      return new SequenceNode(null, this.params);
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set();
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      var _a;

      return new Set([(_a = this.params.as) !== null && _a !== void 0 ? _a : 'data']);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Hash ".concat(util_hash(this.params));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return Object.assign({
        type: 'sequence'
      }, this.params);
    }
  }]);

  return SequenceNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/optimizer.js







/**
 * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator.
 */

function isDataSourceNode(node) {
  return node instanceof source_SourceNode || node instanceof graticule_GraticuleNode || node instanceof sequence_SequenceNode;
}
/**
 * Abstract base class for BottomUpOptimizer and TopDownOptimizer.
 * Contains only mutation handling logic. Subclasses need to implement iteration logic.
 */

var optimizer_OptimizerBase = /*#__PURE__*/function () {
  function OptimizerBase() {
    _classCallCheck(this, OptimizerBase);

    this._mutated = false;
  } // Once true, _mutated is never set to false


  _createClass(OptimizerBase, [{
    key: "setMutated",
    value: function setMutated() {
      this._mutated = true;
    }
  }, {
    key: "mutatedFlag",
    get: function get() {
      return this._mutated;
    }
  }]);

  return OptimizerBase;
}();
/**
 * Starts from a node and runs the optimization function(the "run" method) upwards to the root,
 * depending on the continueFlag and mutatedFlag values returned by the optimization function.
 */


var optimizer_BottomUpOptimizer = /*#__PURE__*/function (_OptimizerBase) {
  _inherits(BottomUpOptimizer, _OptimizerBase);

  var _super = _createSuper(BottomUpOptimizer);

  function BottomUpOptimizer() {
    var _this;

    _classCallCheck(this, BottomUpOptimizer);

    _this = _super.call(this);
    _this._continue = false;
    return _this;
  }

  _createClass(BottomUpOptimizer, [{
    key: "setContinue",
    value: function setContinue() {
      this._continue = true;
    }
  }, {
    key: "continueFlag",
    get: function get() {
      return this._continue;
    }
  }, {
    key: "flags",
    get: function get() {
      return {
        continueFlag: this.continueFlag,
        mutatedFlag: this.mutatedFlag
      };
    },
    set: function set(_ref) {
      var continueFlag = _ref.continueFlag,
          mutatedFlag = _ref.mutatedFlag;

      if (continueFlag) {
        this.setContinue();
      }

      if (mutatedFlag) {
        this.setMutated();
      }
    }
    /**
     * Reset the state of the optimizer after it has completed a run from the bottom of the tree to the top.
     */

  }, {
    key: "reset",
    value: function reset() {// do nothing
    }
  }, {
    key: "optimizeNextFromLeaves",
    value: function optimizeNextFromLeaves(node) {
      if (isDataSourceNode(node)) {
        return false;
      }

      var next = node.parent;

      var _this$run = this.run(node),
          continueFlag = _this$run.continueFlag;

      if (continueFlag) {
        this.optimizeNextFromLeaves(next);
      }

      return this.mutatedFlag;
    }
  }]);

  return BottomUpOptimizer;
}(optimizer_OptimizerBase);
/**
 * The optimizer function( the "run" method), is invoked on the given node and then continues recursively.
 */

var optimizer_TopDownOptimizer = /*#__PURE__*/function (_OptimizerBase2) {
  _inherits(TopDownOptimizer, _OptimizerBase2);

  var _super2 = _createSuper(TopDownOptimizer);

  function TopDownOptimizer() {
    _classCallCheck(this, TopDownOptimizer);

    return _super2.apply(this, arguments);
  }

  return TopDownOptimizer;
}(optimizer_OptimizerBase);
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.flags.js
var es_regexp_flags = __webpack_require__("5377");

// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/aggregate.js
























function addDimension(dims, channel, fieldDef, model) {
  var channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;

  if (isTypedFieldDef(fieldDef) && isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.markDef, model.config)) {
    dims.add(channeldef_vgField(fieldDef, {}));
    dims.add(channeldef_vgField(fieldDef, {
      suffix: 'end'
    }));

    if (fieldDef.bin && binRequiresRange(fieldDef, channel)) {
      dims.add(channeldef_vgField(fieldDef, {
        binSuffix: 'range'
      }));
    }
  } else if (isGeoPositionChannel(channel)) {
    var posChannel = getPositionChannelFromLatLong(channel);
    dims.add(model.getName(posChannel));
  } else {
    dims.add(channeldef_vgField(fieldDef));
  }

  return dims;
}

function mergeMeasures(parentMeasures, childMeasures) {
  var _a;

  var _iterator = _createForOfIteratorHelper(util_keys(childMeasures)),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var field = _step.value;
      // when we merge a measure, we either have to add an aggregation operator or even a new field
      var ops = childMeasures[field];

      var _iterator2 = _createForOfIteratorHelper(util_keys(ops)),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var op = _step2.value;

          if (field in parentMeasures) {
            // add operator to existing measure field
            parentMeasures[field][op] = new Set([].concat(_toConsumableArray((_a = parentMeasures[field][op]) !== null && _a !== void 0 ? _a : []), _toConsumableArray(ops[op])));
          } else {
            parentMeasures[field] = _defineProperty({}, op, ops[op]);
          }
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }
}

var aggregate_AggregateNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(AggregateNode, _DataFlowNode);

  var _super = _createSuper(AggregateNode);

  /**
   * @param dimensions string set for dimensions
   * @param measures dictionary mapping field name => dict of aggregation functions and names to use
   */
  function AggregateNode(parent, dimensions, measures) {
    var _this;

    _classCallCheck(this, AggregateNode);

    _this = _super.call(this, parent);
    _this.dimensions = dimensions;
    _this.measures = measures;
    return _this;
  }

  _createClass(AggregateNode, [{
    key: "clone",
    value: function clone() {
      return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures));
    }
  }, {
    key: "groupBy",
    get: function get() {
      return this.dimensions;
    }
  }, {
    key: "merge",
    value: function merge(other) {
      if (setEqual(this.dimensions, other.dimensions)) {
        mergeMeasures(this.measures, other.measures);
        return true;
      } else {
        log_debug('different dimensions, cannot merge');
        return false;
      }
    }
  }, {
    key: "addDimensions",
    value: function addDimensions(fields) {
      fields.forEach(this.dimensions.add, this.dimensions);
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set([].concat(_toConsumableArray(this.dimensions), _toConsumableArray(util_keys(this.measures))));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      var out = new Set();

      var _iterator3 = _createForOfIteratorHelper(util_keys(this.measures)),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var field = _step3.value;

          var _iterator4 = _createForOfIteratorHelper(util_keys(this.measures[field])),
              _step4;

          try {
            for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
              var op = _step4.value;
              var m = this.measures[field][op];

              if (m.size === 0) {
                out.add("".concat(op, "_").concat(field));
              } else {
                m.forEach(out.add, out);
              }
            }
          } catch (err) {
            _iterator4.e(err);
          } finally {
            _iterator4.f();
          }
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }

      return out;
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Aggregate ".concat(util_hash({
        dimensions: this.dimensions,
        measures: this.measures
      }));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var ops = [];
      var fields = [];
      var as = [];

      var _iterator5 = _createForOfIteratorHelper(util_keys(this.measures)),
          _step5;

      try {
        for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
          var field = _step5.value;

          var _iterator6 = _createForOfIteratorHelper(util_keys(this.measures[field])),
              _step6;

          try {
            for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
              var op = _step6.value;

              var _iterator7 = _createForOfIteratorHelper(this.measures[field][op]),
                  _step7;

              try {
                for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
                  var alias = _step7.value;
                  as.push(alias);
                  ops.push(op);
                  fields.push(field === '*' ? null : replacePathInField(field));
                }
              } catch (err) {
                _iterator7.e(err);
              } finally {
                _iterator7.f();
              }
            }
          } catch (err) {
            _iterator6.e(err);
          } finally {
            _iterator6.f();
          }
        }
      } catch (err) {
        _iterator5.e(err);
      } finally {
        _iterator5.f();
      }

      var result = {
        type: 'aggregate',
        groupby: _toConsumableArray(this.dimensions).map(replacePathInField),
        ops: ops,
        fields: fields,
        as: as
      };
      return result;
    }
  }], [{
    key: "makeFromEncoding",
    value: function makeFromEncoding(parent, model) {
      var isAggregate = false;
      model.forEachFieldDef(function (fd) {
        if (fd.aggregate) {
          isAggregate = true;
        }
      });
      var meas = {};
      var dims = new Set();

      if (!isAggregate) {
        // no need to create this node if the model has no aggregation
        return null;
      }

      model.forEachFieldDef(function (fieldDef, channel) {
        var _a, _b, _c, _d;

        var aggregate = fieldDef.aggregate,
            field = fieldDef.field;

        if (aggregate) {
          if (aggregate === 'count') {
            meas['*'] = (_a = meas['*']) !== null && _a !== void 0 ? _a : {};
            meas['*']['count'] = new Set([channeldef_vgField(fieldDef, {
              forAs: true
            })]);
          } else {
            if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {
              var op = isArgminDef(aggregate) ? 'argmin' : 'argmax';
              var argField = aggregate[op];
              meas[argField] = (_b = meas[argField]) !== null && _b !== void 0 ? _b : {};
              meas[argField][op] = new Set([channeldef_vgField({
                op: op,
                field: argField
              }, {
                forAs: true
              })]);
            } else {
              meas[field] = (_c = meas[field]) !== null && _c !== void 0 ? _c : {};
              meas[field][aggregate] = new Set([channeldef_vgField(fieldDef, {
                forAs: true
              })]);
            } // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain


            if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') {
              meas[field] = (_d = meas[field]) !== null && _d !== void 0 ? _d : {};
              meas[field]['min'] = new Set([channeldef_vgField({
                field: field,
                aggregate: 'min'
              }, {
                forAs: true
              })]);
              meas[field]['max'] = new Set([channeldef_vgField({
                field: field,
                aggregate: 'max'
              }, {
                forAs: true
              })]);
            }
          }
        } else {
          addDimension(dims, channel, fieldDef, model);
        }
      });

      if (dims.size + util_keys(meas).length === 0) {
        return null;
      }

      return new AggregateNode(parent, dims, meas);
    }
  }, {
    key: "makeFromTransform",
    value: function makeFromTransform(parent, t) {
      var _a, _b, _c;

      var dims = new Set();
      var meas = {};

      var _iterator8 = _createForOfIteratorHelper(t.aggregate),
          _step8;

      try {
        for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
          var s = _step8.value;
          var op = s.op,
              field = s.field,
              as = s.as;

          if (op) {
            if (op === 'count') {
              meas['*'] = (_a = meas['*']) !== null && _a !== void 0 ? _a : {};
              meas['*']['count'] = new Set([as ? as : channeldef_vgField(s, {
                forAs: true
              })]);
            } else {
              meas[field] = (_b = meas[field]) !== null && _b !== void 0 ? _b : {};
              meas[field][op] = new Set([as ? as : channeldef_vgField(s, {
                forAs: true
              })]);
            }
          }
        }
      } catch (err) {
        _iterator8.e(err);
      } finally {
        _iterator8.f();
      }

      var _iterator9 = _createForOfIteratorHelper((_c = t.groupby) !== null && _c !== void 0 ? _c : []),
          _step9;

      try {
        for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
          var _s = _step9.value;
          dims.add(_s);
        }
      } catch (err) {
        _iterator9.e(err);
      } finally {
        _iterator9.f();
      }

      if (dims.size + util_keys(meas).length === 0) {
        return null;
      }

      return new AggregateNode(parent, dims, meas);
    }
  }]);

  return AggregateNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/facet.js





























/**
 * A node that helps us track what fields we are faceting by.
 */

var facet_FacetNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(FacetNode, _DataFlowNode);

  var _super = _createSuper(FacetNode);

  /**
   * @param model The facet model.
   * @param name The name that this facet source will have.
   * @param data The source data for this facet data.
   */
  function FacetNode(parent, model, name, data) {
    var _this;

    _classCallCheck(this, FacetNode);

    _this = _super.call(this, parent);
    _this.model = model;
    _this.name = name;
    _this.data = data;

    var _iterator = _createForOfIteratorHelper(FACET_CHANNELS),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var channel = _step.value;
        var fieldDef = model.facet[channel];

        if (fieldDef) {
          var bin = fieldDef.bin,
              sort = fieldDef.sort;
          _this[channel] = Object.assign({
            name: model.getName("".concat(channel, "_domain")),
            fields: [channeldef_vgField(fieldDef)].concat(_toConsumableArray(isBinning(bin) ? [channeldef_vgField(fieldDef, {
              binSuffix: 'end'
            })] : []))
          }, isSortField(sort) ? {
            sortField: sort
          } : isArray(sort) ? {
            sortIndexField: sortArrayIndexField(fieldDef, channel)
          } : {});
        }
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }

    _this.childModel = model.child;
    return _this;
  }

  _createClass(FacetNode, [{
    key: "hash",
    value: function hash() {
      var out = "Facet";

      var _iterator2 = _createForOfIteratorHelper(FACET_CHANNELS),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var channel = _step2.value;

          if (this[channel]) {
            out += " ".concat(channel.charAt(0), ":").concat(util_hash(this[channel]));
          }
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }

      return out;
    }
  }, {
    key: "fields",
    get: function get() {
      var _a;

      var f = [];

      var _iterator3 = _createForOfIteratorHelper(FACET_CHANNELS),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var channel = _step3.value;

          if ((_a = this[channel]) === null || _a === void 0 ? void 0 : _a.fields) {
            f.push.apply(f, _toConsumableArray(this[channel].fields));
          }
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }

      return f;
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var depFields = new Set(this.fields);

      var _iterator4 = _createForOfIteratorHelper(FACET_CHANNELS),
          _step4;

      try {
        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
          var channel = _step4.value;

          if (this[channel]) {
            if (this[channel].sortField) {
              depFields.add(this[channel].sortField.field);
            }

            if (this[channel].sortIndexField) {
              depFields.add(this[channel].sortIndexField);
            }
          }
        }
      } catch (err) {
        _iterator4.e(err);
      } finally {
        _iterator4.f();
      }

      return depFields;
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(); // facet does not produce any new fields
    }
    /**
     * The name to reference this source is its name.
     */

  }, {
    key: "getSource",
    value: function getSource() {
      return this.name;
    }
  }, {
    key: "getChildIndependentFieldsWithStep",
    value: function getChildIndependentFieldsWithStep() {
      var childIndependentFieldsWithStep = {};

      for (var _i = 0, _arr = ['x', 'y']; _i < _arr.length; _i++) {
        var channel = _arr[_i];
        var childScaleComponent = this.childModel.component.scales[channel];

        if (childScaleComponent && !childScaleComponent.merged) {
          // independent scale
          var type = childScaleComponent.get('type');
          var range = childScaleComponent.get('range');

          if (hasDiscreteDomain(type) && isVgRangeStep(range)) {
            var domain = assembleDomain(this.childModel, channel);
            var field = getFieldFromDomain(domain);

            if (field) {
              childIndependentFieldsWithStep[channel] = field;
            } else {
              log_warn("Unknown field for ".concat(channel, ". Cannot calculate view size."));
            }
          }
        }
      }

      return childIndependentFieldsWithStep;
    }
  }, {
    key: "assembleRowColumnHeaderData",
    value: function assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep) {
      var childChannel = {
        row: 'y',
        column: 'x'
      }[channel];
      var fields = [];
      var ops = [];
      var as = [];

      if (childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) {
        if (crossedDataName) {
          // If there is a crossed data, calculate max
          fields.push("distinct_".concat(childIndependentFieldsWithStep[childChannel]));
          ops.push('max');
        } else {
          // If there is no crossed data, just calculate distinct
          fields.push(childIndependentFieldsWithStep[childChannel]);
          ops.push('distinct');
        } // Although it is technically a max, just name it distinct so it's easier to refer to it


        as.push("distinct_".concat(childIndependentFieldsWithStep[childChannel]));
      }

      var _this$channel = this[channel],
          sortField = _this$channel.sortField,
          sortIndexField = _this$channel.sortIndexField;

      if (sortField) {
        var _sortField$op = sortField.op,
            op = _sortField$op === void 0 ? DEFAULT_SORT_OP : _sortField$op,
            field = sortField.field;
        fields.push(field);
        ops.push(op);
        as.push(channeldef_vgField(sortField, {
          forAs: true
        }));
      } else if (sortIndexField) {
        fields.push(sortIndexField);
        ops.push('max');
        as.push(sortIndexField);
      }

      return {
        name: this[channel].name,
        // Use data from the crossed one if it exist
        source: crossedDataName !== null && crossedDataName !== void 0 ? crossedDataName : this.data,
        transform: [Object.assign({
          type: 'aggregate',
          groupby: this[channel].fields
        }, fields.length ? {
          fields: fields,
          ops: ops,
          as: as
        } : {})]
      };
    }
  }, {
    key: "assembleFacetHeaderData",
    value: function assembleFacetHeaderData(childIndependentFieldsWithStep) {
      var _a, _b;

      var columns = this.model.layout.columns;
      var layoutHeaders = this.model.component.layoutHeaders;
      var data = [];
      var hasSharedAxis = {};

      var _iterator5 = _createForOfIteratorHelper(HEADER_CHANNELS),
          _step5;

      try {
        for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
          var headerChannel = _step5.value;

          var _iterator6 = _createForOfIteratorHelper(HEADER_TYPES),
              _step6;

          try {
            for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
              var headerType = _step6.value;
              var headers = (_a = layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) !== null && _a !== void 0 ? _a : [];

              var _iterator7 = _createForOfIteratorHelper(headers),
                  _step7;

              try {
                for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
                  var header = _step7.value;

                  if (((_b = header.axes) === null || _b === void 0 ? void 0 : _b.length) > 0) {
                    hasSharedAxis[headerChannel] = true;
                    break;
                  }
                }
              } catch (err) {
                _iterator7.e(err);
              } finally {
                _iterator7.f();
              }
            }
          } catch (err) {
            _iterator6.e(err);
          } finally {
            _iterator6.f();
          }

          if (hasSharedAxis[headerChannel]) {
            var cardinality = "length(data(\"".concat(this.facet.name, "\"))");
            var stop = headerChannel === 'row' ? columns ? {
              signal: "ceil(".concat(cardinality, " / ").concat(columns, ")")
            } : 1 : columns ? {
              signal: "min(".concat(cardinality, ", ").concat(columns, ")")
            } : {
              signal: cardinality
            };
            data.push({
              name: "".concat(this.facet.name, "_").concat(headerChannel),
              transform: [{
                type: 'sequence',
                start: 0,
                stop: stop
              }]
            });
          }
        }
      } catch (err) {
        _iterator5.e(err);
      } finally {
        _iterator5.f();
      }

      var row = hasSharedAxis.row,
          column = hasSharedAxis.column;

      if (row || column) {
        data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep));
      }

      return data;
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _a, _b;

      var data = [];
      var crossedDataName = null;
      var childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep();
      var column = this.column,
          row = this.row,
          facet = this.facet;

      if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) {
        // Need to create a cross dataset to correctly calculate cardinality
        crossedDataName = "cross_".concat(this.column.name, "_").concat(this.row.name);
        var fields = [].concat((_a = childIndependentFieldsWithStep.x) !== null && _a !== void 0 ? _a : [], (_b = childIndependentFieldsWithStep.y) !== null && _b !== void 0 ? _b : []);
        var ops = fields.map(function () {
          return 'distinct';
        });
        data.push({
          name: crossedDataName,
          source: this.data,
          transform: [{
            type: 'aggregate',
            groupby: this.fields,
            fields: fields,
            ops: ops
          }]
        });
      }

      for (var _i2 = 0, _arr2 = [COLUMN, ROW]; _i2 < _arr2.length; _i2++) {
        var channel = _arr2[_i2];

        if (this[channel]) {
          data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep));
        }
      }

      if (facet) {
        var facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep);

        if (facetData) {
          data.push.apply(data, _toConsumableArray(facetData));
        }
      }

      return data;
    }
  }]);

  return FacetNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/formatparse.js
































/**
 * Remove quotes from a string.
 */

function unquote(pattern) {
  if (pattern[0] === "'" && pattern[pattern.length - 1] === "'" || pattern[0] === '"' && pattern[pattern.length - 1] === '"') {
    return pattern.slice(1, -1);
  }

  return pattern;
}
/**
 * @param field The field.
 * @param parse What to parse the field as.
 */


function formatparse_parseExpression(field, parse) {
  var f = accessPathWithDatum(field);

  if (parse === 'number') {
    return "toNumber(".concat(f, ")");
  } else if (parse === 'boolean') {
    return "toBoolean(".concat(f, ")");
  } else if (parse === 'string') {
    return "toString(".concat(f, ")");
  } else if (parse === 'date') {
    return "toDate(".concat(f, ")");
  } else if (parse === 'flatten') {
    return f;
  } else if (parse.indexOf('date:') === 0) {
    var specifier = unquote(parse.slice(5, parse.length));
    return "timeParse(".concat(f, ",'").concat(specifier, "')");
  } else if (parse.indexOf('utc:') === 0) {
    var _specifier = unquote(parse.slice(4, parse.length));

    return "utcParse(".concat(f, ",'").concat(_specifier, "')");
  } else {
    log_warn(message.unrecognizedParse(parse));
    return null;
  }
}

function getImplicitFromFilterTransform(transform) {
  var implicit = {};
  forEachLeaf(transform.filter, function (filter) {
    var _a;

    if (isFieldPredicate(filter)) {
      // Automatically add a parse node for filters with filter objects
      var val = null; // For EqualFilter, just use the equal property.
      // For RangeFilter and OneOfFilter, all array members should have
      // the same type, so we only use the first one.

      if (isFieldEqualPredicate(filter)) {
        val = filter.equal;
      } else if (isFieldRangePredicate(filter)) {
        val = filter.range[0];
      } else if (isFieldOneOfPredicate(filter)) {
        val = ((_a = filter.oneOf) !== null && _a !== void 0 ? _a : filter['in'])[0];
      } // else -- for filter expression, we can't infer anything


      if (val) {
        if (isDateTime(val)) {
          implicit[filter.field] = 'date';
        } else if (isNumber(val)) {
          implicit[filter.field] = 'number';
        } else if (isString(val)) {
          implicit[filter.field] = 'string';
        }
      }

      if (filter.timeUnit) {
        implicit[filter.field] = 'date';
      }
    }
  });
  return implicit;
}
/**
 * Creates a parse node for implicit parsing from a model and updates ancestorParse.
 */

function getImplicitFromEncoding(model) {
  var implicit = {};

  function add(fieldDef) {
    if (isFieldDefForTimeFormat(fieldDef)) {
      implicit[fieldDef.field] = 'date';
    } else if (fieldDef.type === 'quantitative' && isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max
    ) {
      implicit[fieldDef.field] = 'number';
    } else if (accessPathDepth(fieldDef.field) > 1) {
      // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field.
      // (Parsing numbers / dates already flattens numeric and temporal fields.)
      if (!(fieldDef.field in implicit)) {
        implicit[fieldDef.field] = 'flatten';
      }
    } else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) {
      // Flatten fields that we sort by but that are not otherwise flattened.
      if (!(fieldDef.sort.field in implicit)) {
        implicit[fieldDef.sort.field] = 'flatten';
      }
    }
  }

  if (isUnitModel(model) || isFacetModel(model)) {
    // Parse encoded fields
    model.forEachFieldDef(function (fieldDef, channel) {
      if (isTypedFieldDef(fieldDef)) {
        add(fieldDef);
      } else {
        var mainChannel = getMainRangeChannel(channel);
        var mainFieldDef = model.fieldDef(mainChannel);
        add(Object.assign(Object.assign({}, fieldDef), {
          type: mainFieldDef.type
        }));
      }
    });
  } // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly.


  if (isUnitModel(model)) {
    var mark = model.mark,
        markDef = model.markDef,
        encoding = model.encoding;

    if (isPathMark(mark) && // No need to sort by dimension if we have a connected scatterplot (order channel is present)
    !model.encoding.order) {
      var dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';
      var dimensionChannelDef = encoding[dimensionChannel];

      if (isFieldDef(dimensionChannelDef) && dimensionChannelDef.type === 'quantitative' && !(dimensionChannelDef.field in implicit)) {
        implicit[dimensionChannelDef.field] = 'number';
      }
    }
  }

  return implicit;
}
/**
 * Creates a parse node for implicit parsing from a model and updates ancestorParse.
 */

function getImplicitFromSelection(model) {
  var implicit = {};

  if (isUnitModel(model) && model.component.selection) {
    var _iterator = _createForOfIteratorHelper(util_keys(model.component.selection)),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var name = _step.value;
        var selCmpt = model.component.selection[name];

        var _iterator2 = _createForOfIteratorHelper(selCmpt.project.items),
            _step2;

        try {
          for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
            var proj = _step2.value;

            if (!proj.channel && accessPathDepth(proj.field) > 1) {
              implicit[proj.field] = 'flatten';
            }
          }
        } catch (err) {
          _iterator2.e(err);
        } finally {
          _iterator2.f();
        }
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
  }

  return implicit;
}
var formatparse_ParseNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(ParseNode, _DataFlowNode);

  var _super = _createSuper(ParseNode);

  function ParseNode(parent, parse) {
    var _this;

    _classCallCheck(this, ParseNode);

    _this = _super.call(this, parent);
    _this._parse = parse;
    return _this;
  }

  _createClass(ParseNode, [{
    key: "clone",
    value: function clone() {
      return new ParseNode(null, duplicate(this._parse));
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Parse ".concat(util_hash(this._parse));
    }
    /**
     * Creates a parse node from a data.format.parse and updates ancestorParse.
     */

  }, {
    key: "parse",
    get: function get() {
      return this._parse;
    }
  }, {
    key: "merge",
    value: function merge(other) {
      this._parse = Object.assign(Object.assign({}, this._parse), other.parse);
      other.remove();
    }
    /**
     * Assemble an object for Vega's format.parse property.
     */

  }, {
    key: "assembleFormatParse",
    value: function assembleFormatParse() {
      var formatParse = {};

      var _iterator3 = _createForOfIteratorHelper(util_keys(this._parse)),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var field = _step3.value;
          var p = this._parse[field];

          if (accessPathDepth(field) === 1) {
            formatParse[field] = p;
          }
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }

      return formatParse;
    } // format parse depends and produces all fields in its parse

  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(util_keys(this._parse));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set(util_keys(this._parse));
    }
  }, {
    key: "assembleTransforms",
    value: function assembleTransforms() {
      var _this2 = this;

      var onlyNested = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
      return util_keys(this._parse).filter(function (field) {
        return onlyNested ? accessPathDepth(field) > 1 : true;
      }).map(function (field) {
        var expr = formatparse_parseExpression(field, _this2._parse[field]);

        if (!expr) {
          return null;
        }

        var formula = {
          type: 'formula',
          expr: expr,
          as: removePathFromField(field) // Vega output is always flattened

        };
        return formula;
      }).filter(function (t) {
        return t !== null;
      });
    }
  }], [{
    key: "makeExplicit",
    value: function makeExplicit(parent, model, ancestorParse) {
      // Custom parse
      var explicit = {};
      var data = model.data;

      if (!isGenerator(data) && data && data.format && data.format.parse) {
        explicit = data.format.parse;
      }

      return this.makeWithAncestors(parent, explicit, {}, ancestorParse);
    }
    /**
     * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse.
     */

  }, {
    key: "makeWithAncestors",
    value: function makeWithAncestors(parent, explicit, implicit, ancestorParse) {
      // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as "derived"). We also don't need to flatten a field that has already been parsed.
      var _iterator4 = _createForOfIteratorHelper(util_keys(implicit)),
          _step4;

      try {
        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
          var field = _step4.value;
          var parsedAs = ancestorParse.getWithExplicit(field);

          if (parsedAs.value !== undefined) {
            // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types.
            if (parsedAs.explicit || parsedAs.value === implicit[field] || parsedAs.value === 'derived' || implicit[field] === 'flatten') {
              delete implicit[field];
            } else {
              log_warn(message.differentParse(field, implicit[field], parsedAs.value));
            }
          }
        }
      } catch (err) {
        _iterator4.e(err);
      } finally {
        _iterator4.f();
      }

      var _iterator5 = _createForOfIteratorHelper(util_keys(explicit)),
          _step5;

      try {
        for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
          var _field = _step5.value;

          var _parsedAs = ancestorParse.get(_field);

          if (_parsedAs !== undefined) {
            // Don't parse a field again if it has been parsed with the same type already.
            if (_parsedAs === explicit[_field]) {
              delete explicit[_field];
            } else {
              log_warn(message.differentParse(_field, explicit[_field], _parsedAs));
            }
          }
        }
      } catch (err) {
        _iterator5.e(err);
      } finally {
        _iterator5.f();
      }

      var parse = new split_Split(explicit, implicit); // add the format parse from this model so that children don't parse the same field again

      ancestorParse.copyAll(parse); // copy only non-null parses

      var p = {};

      var _iterator6 = _createForOfIteratorHelper(util_keys(parse.combine())),
          _step6;

      try {
        for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
          var key = _step6.value;
          var val = parse.get(key);

          if (val !== null) {
            p[key] = val;
          }
        }
      } catch (err) {
        _iterator6.e(err);
      } finally {
        _iterator6.f();
      }

      if (util_keys(p).length === 0 || ancestorParse.parseNothing) {
        return null;
      }

      return new ParseNode(parent, p);
    }
  }]);

  return ParseNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/joinaggregate.js




















/**
 * A class for the join aggregate transform nodes.
 */

var joinaggregate_JoinAggregateTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(JoinAggregateTransformNode, _DataFlowNode);

  var _super = _createSuper(JoinAggregateTransformNode);

  function JoinAggregateTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, JoinAggregateTransformNode);

    _this = _super.call(this, parent);
    _this.transform = transform;
    return _this;
  }

  _createClass(JoinAggregateTransformNode, [{
    key: "clone",
    value: function clone() {
      return new JoinAggregateTransformNode(null, duplicate(this.transform));
    }
  }, {
    key: "addDimensions",
    value: function addDimensions(fields) {
      this.transform.groupby = unique(this.transform.groupby.concat(fields), function (d) {
        return d;
      });
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var out = new Set();

      if (this.transform.groupby) {
        this.transform.groupby.forEach(function (f) {
          return out.add(f);
        });
      }

      this.transform.joinaggregate.map(function (w) {
        return w.field;
      }).filter(function (f) {
        return f !== undefined;
      }).forEach(function (f) {
        return out.add(f);
      });
      return out;
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.transform.joinaggregate.map(this.getDefaultName));
    }
  }, {
    key: "getDefaultName",
    value: function getDefaultName(joinAggregateFieldDef) {
      var _a;

      return (_a = joinAggregateFieldDef.as) !== null && _a !== void 0 ? _a : channeldef_vgField(joinAggregateFieldDef);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "JoinAggregateTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var fields = [];
      var ops = [];
      var as = [];

      var _iterator = _createForOfIteratorHelper(this.transform.joinaggregate),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var joinaggregate = _step.value;
          ops.push(joinaggregate.op);
          as.push(this.getDefaultName(joinaggregate));
          fields.push(joinaggregate.field === undefined ? null : joinaggregate.field);
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      var groupby = this.transform.groupby;
      return Object.assign({
        type: 'joinaggregate',
        as: as,
        ops: ops,
        fields: fields
      }, groupby !== undefined ? {
        groupby: groupby
      } : {});
    }
  }]);

  return JoinAggregateTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/stack.js























function getStackByFields(model) {
  return model.stack.stackBy.reduce(function (fields, by) {
    var fieldDef = by.fieldDef;

    var _field = channeldef_vgField(fieldDef);

    if (_field) {
      fields.push(_field);
    }

    return fields;
  }, []);
}

function isValidAsArray(as) {
  return isArray(as) && as.every(function (s) {
    return isString(s);
  }) && as.length > 1;
}

var stack_StackNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(StackNode, _DataFlowNode);

  var _super = _createSuper(StackNode);

  function StackNode(parent, stack) {
    var _this;

    _classCallCheck(this, StackNode);

    _this = _super.call(this, parent);
    _this._stack = stack;
    return _this;
  }

  _createClass(StackNode, [{
    key: "clone",
    value: function clone() {
      return new StackNode(null, duplicate(this._stack));
    }
  }, {
    key: "stack",
    get: function get() {
      return this._stack;
    }
  }, {
    key: "addDimensions",
    value: function addDimensions(fields) {
      var _this$_stack$facetby;

      (_this$_stack$facetby = this._stack.facetby).push.apply(_this$_stack$facetby, _toConsumableArray(fields));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var out = new Set();
      out.add(this._stack.stackField);
      this.getGroupbyFields().forEach(function (f) {
        return out.add(f);
      });

      this._stack.facetby.forEach(function (f) {
        return out.add(f);
      });

      this._stack.sort.field.forEach(function (f) {
        return out.add(f);
      });

      return out;
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this._stack.as);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Stack ".concat(util_hash(this._stack));
    }
  }, {
    key: "getGroupbyFields",
    value: function getGroupbyFields() {
      var _this$_stack = this._stack,
          dimensionFieldDef = _this$_stack.dimensionFieldDef,
          impute = _this$_stack.impute,
          groupby = _this$_stack.groupby;

      if (dimensionFieldDef) {
        if (dimensionFieldDef.bin) {
          if (impute) {
            // For binned group by field with impute, we calculate bin_mid
            // as we cannot impute two fields simultaneously
            return [channeldef_vgField(dimensionFieldDef, {
              binSuffix: 'mid'
            })];
          }

          return [// For binned group by field without impute, we need both bin (start) and bin_end
          channeldef_vgField(dimensionFieldDef, {}), channeldef_vgField(dimensionFieldDef, {
            binSuffix: 'end'
          })];
        }

        return [channeldef_vgField(dimensionFieldDef)];
      }

      return groupby !== null && groupby !== void 0 ? groupby : [];
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var transform = [];
      var _this$_stack2 = this._stack,
          facetby = _this$_stack2.facetby,
          dimensionFieldDef = _this$_stack2.dimensionFieldDef,
          field = _this$_stack2.stackField,
          stackby = _this$_stack2.stackby,
          sort = _this$_stack2.sort,
          offset = _this$_stack2.offset,
          impute = _this$_stack2.impute,
          as = _this$_stack2.as; // Impute

      if (impute && dimensionFieldDef) {
        var _dimensionFieldDef$ba = dimensionFieldDef.band,
            band = _dimensionFieldDef$ba === void 0 ? 0.5 : _dimensionFieldDef$ba,
            bin = dimensionFieldDef.bin;

        if (bin) {
          // As we can only impute one field at a time, we need to calculate
          // mid point for a binned field
          transform.push({
            type: 'formula',
            expr: "".concat(band, "*") + channeldef_vgField(dimensionFieldDef, {
              expr: 'datum'
            }) + "+".concat(1 - band, "*") + channeldef_vgField(dimensionFieldDef, {
              expr: 'datum',
              binSuffix: 'end'
            }),
            as: channeldef_vgField(dimensionFieldDef, {
              binSuffix: 'mid',
              forAs: true
            })
          });
        }

        transform.push({
          type: 'impute',
          field: field,
          groupby: [].concat(_toConsumableArray(stackby), _toConsumableArray(facetby)),
          key: channeldef_vgField(dimensionFieldDef, {
            binSuffix: 'mid'
          }),
          method: 'value',
          value: 0
        });
      } // Stack


      transform.push({
        type: 'stack',
        groupby: [].concat(_toConsumableArray(this.getGroupbyFields()), _toConsumableArray(facetby)),
        field: field,
        sort: sort,
        as: as,
        offset: offset
      });
      return transform;
    }
  }], [{
    key: "makeFromTransform",
    value: function makeFromTransform(parent, stackTransform) {
      var stack = stackTransform.stack,
          groupby = stackTransform.groupby,
          as = stackTransform.as,
          _stackTransform$offse = stackTransform.offset,
          offset = _stackTransform$offse === void 0 ? 'zero' : _stackTransform$offse;
      var sortFields = [];
      var sortOrder = [];

      if (stackTransform.sort !== undefined) {
        var _iterator = _createForOfIteratorHelper(stackTransform.sort),
            _step;

        try {
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
            var sortField = _step.value;
            sortFields.push(sortField.field);
            sortOrder.push(getFirstDefined(sortField.order, 'ascending'));
          }
        } catch (err) {
          _iterator.e(err);
        } finally {
          _iterator.f();
        }
      }

      var sort = {
        field: sortFields,
        order: sortOrder
      };
      var normalizedAs;

      if (isValidAsArray(as)) {
        normalizedAs = as;
      } else if (isString(as)) {
        normalizedAs = [as, as + '_end'];
      } else {
        normalizedAs = [stackTransform.stack + '_start', stackTransform.stack + '_end'];
      }

      return new StackNode(parent, {
        stackField: stack,
        groupby: groupby,
        offset: offset,
        sort: sort,
        facetby: [],
        as: normalizedAs
      });
    }
  }, {
    key: "makeFromEncoding",
    value: function makeFromEncoding(parent, model) {
      var stackProperties = model.stack;
      var encoding = model.encoding;

      if (!stackProperties) {
        return null;
      }

      var dimensionFieldDef;

      if (stackProperties.groupbyChannel) {
        var cDef = encoding[stackProperties.groupbyChannel];
        dimensionFieldDef = getTypedFieldDef(cDef); // Fair to cast as groupByChannel is always either x or y
      }

      var stackby = getStackByFields(model);
      var orderDef = model.encoding.order;
      var sort;

      if (isArray(orderDef) || isFieldDef(orderDef)) {
        sort = sortParams(orderDef);
      } else {
        // default = descending by stackFields
        // FIXME is the default here correct for binned fields?
        sort = stackby.reduce(function (s, field) {
          s.field.push(field);
          s.order.push('descending');
          return s;
        }, {
          field: [],
          order: []
        });
      }

      return new StackNode(parent, {
        dimensionFieldDef: dimensionFieldDef,
        stackField: model.vgField(stackProperties.fieldChannel),
        facetby: [],
        stackby: stackby,
        sort: sort,
        offset: stackProperties.offset,
        impute: stackProperties.impute,
        as: [model.vgField(stackProperties.fieldChannel, {
          suffix: 'start',
          forAs: true
        }), model.vgField(stackProperties.fieldChannel, {
          suffix: 'end',
          forAs: true
        })]
      });
    }
  }]);

  return StackNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/window.js























/**
 * A class for the window transform nodes
 */

var window_WindowTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(WindowTransformNode, _DataFlowNode);

  var _super = _createSuper(WindowTransformNode);

  function WindowTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, WindowTransformNode);

    _this = _super.call(this, parent);
    _this.transform = transform;
    return _this;
  }

  _createClass(WindowTransformNode, [{
    key: "clone",
    value: function clone() {
      return new WindowTransformNode(null, duplicate(this.transform));
    }
  }, {
    key: "addDimensions",
    value: function addDimensions(fields) {
      this.transform.groupby = unique(this.transform.groupby.concat(fields), function (d) {
        return d;
      });
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var _a, _b;

      var out = new Set();
      ((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []).forEach(function (f) {
        return out.add(f);
      });
      ((_b = this.transform.sort) !== null && _b !== void 0 ? _b : []).forEach(function (m) {
        return out.add(m.field);
      });
      this.transform.window.map(function (w) {
        return w.field;
      }).filter(function (f) {
        return f !== undefined;
      }).forEach(function (f) {
        return out.add(f);
      });
      return out;
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.transform.window.map(this.getDefaultName));
    }
  }, {
    key: "getDefaultName",
    value: function getDefaultName(windowFieldDef) {
      var _a;

      return (_a = windowFieldDef.as) !== null && _a !== void 0 ? _a : channeldef_vgField(windowFieldDef);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "WindowTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _a;

      var fields = [];
      var ops = [];
      var as = [];
      var params = [];

      var _iterator = _createForOfIteratorHelper(this.transform.window),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var window = _step.value;
          ops.push(window.op);
          as.push(this.getDefaultName(window));
          params.push(window.param === undefined ? null : window.param);
          fields.push(window.field === undefined ? null : window.field);
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      var frame = this.transform.frame;
      var groupby = this.transform.groupby;

      if (frame && frame[0] === null && frame[1] === null && ops.every(function (o) {
        return isAggregateOp(o);
      })) {
        // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate
        return Object.assign({
          type: 'joinaggregate',
          as: as,
          ops: ops,
          fields: fields
        }, groupby !== undefined ? {
          groupby: groupby
        } : {});
      }

      var sortFields = [];
      var sortOrder = [];

      if (this.transform.sort !== undefined) {
        var _iterator2 = _createForOfIteratorHelper(this.transform.sort),
            _step2;

        try {
          for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
            var sortField = _step2.value;
            sortFields.push(sortField.field);
            sortOrder.push((_a = sortField.order) !== null && _a !== void 0 ? _a : 'ascending');
          }
        } catch (err) {
          _iterator2.e(err);
        } finally {
          _iterator2.f();
        }
      }

      var sort = {
        field: sortFields,
        order: sortOrder
      };
      var ignorePeers = this.transform.ignorePeers;
      return Object.assign(Object.assign(Object.assign({
        type: 'window',
        params: params,
        as: as,
        ops: ops,
        fields: fields,
        sort: sort
      }, ignorePeers !== undefined ? {
        ignorePeers: ignorePeers
      } : {}), groupby !== undefined ? {
        groupby: groupby
      } : {}), frame !== undefined ? {
        frame: frame
      } : {});
    }
  }]);

  return WindowTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/identifier.js











var identifier_IdentifierNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(IdentifierNode, _DataFlowNode);

  var _super = _createSuper(IdentifierNode);

  function IdentifierNode(parent) {
    _classCallCheck(this, IdentifierNode);

    return _super.call(this, parent);
  }

  _createClass(IdentifierNode, [{
    key: "clone",
    value: function clone() {
      return new IdentifierNode(null);
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set();
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set([selection_SELECTION_ID]);
    }
  }, {
    key: "hash",
    value: function hash() {
      return 'Identifier';
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return {
        type: 'identifier',
        as: selection_SELECTION_ID
      };
    }
  }]);

  return IdentifierNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/optimizers.js





































/**
 * Move parse nodes up to forks.
 */

var optimizers_MoveParseUp = /*#__PURE__*/function (_BottomUpOptimizer) {
  _inherits(MoveParseUp, _BottomUpOptimizer);

  var _super = _createSuper(MoveParseUp);

  function MoveParseUp() {
    _classCallCheck(this, MoveParseUp);

    return _super.apply(this, arguments);
  }

  _createClass(MoveParseUp, [{
    key: "run",
    value: function run(node) {
      var parent = node.parent; // Move parse up by merging or swapping.

      if (node instanceof formatparse_ParseNode) {
        if (isDataSourceNode(parent)) {
          return this.flags;
        }

        if (parent.numChildren() > 1) {
          // Don't move parse further up but continue with parent.
          this.setContinue();
          return this.flags;
        }

        if (parent instanceof formatparse_ParseNode) {
          this.setMutated();
          parent.merge(node);
        } else {
          // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup).
          if (fieldIntersection(parent.producedFields(), node.dependentFields())) {
            this.setContinue();
            return this.flags;
          }

          this.setMutated();
          node.swapWithParent();
        }
      }

      this.setContinue();
      return this.flags;
    }
  }]);

  return MoveParseUp;
}(optimizer_BottomUpOptimizer);
/**
 * Merge identical nodes at forks by comparing hashes.
 *
 * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler.
 */

var optimizers_MergeIdenticalNodes = /*#__PURE__*/function (_TopDownOptimizer) {
  _inherits(MergeIdenticalNodes, _TopDownOptimizer);

  var _super2 = _createSuper(MergeIdenticalNodes);

  function MergeIdenticalNodes() {
    _classCallCheck(this, MergeIdenticalNodes);

    return _super2.apply(this, arguments);
  }

  _createClass(MergeIdenticalNodes, [{
    key: "mergeNodes",
    value: function mergeNodes(parent, nodes) {
      var mergedNode = nodes.shift();

      var _iterator = _createForOfIteratorHelper(nodes),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var node = _step.value;
          parent.removeChild(node);
          node.parent = mergedNode;
          node.remove();
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
    }
  }, {
    key: "run",
    value: function run(node) {
      var hashes = node.children.map(function (x) {
        return x.hash();
      });
      var buckets = {};

      for (var i = 0; i < hashes.length; i++) {
        if (buckets[hashes[i]] === undefined) {
          buckets[hashes[i]] = [node.children[i]];
        } else {
          buckets[hashes[i]].push(node.children[i]);
        }
      }

      var _iterator2 = _createForOfIteratorHelper(util_keys(buckets)),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var k = _step2.value;

          if (buckets[k].length > 1) {
            this.setMutated();
            this.mergeNodes(node, buckets[k]);
          }
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }

      var _iterator3 = _createForOfIteratorHelper(node.children),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var child = _step3.value;
          this.run(child);
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }

      return this.mutatedFlag;
    }
  }]);

  return MergeIdenticalNodes;
}(optimizer_TopDownOptimizer);
/**
 * Repeatedly remove leaf nodes that are not output or facet nodes.
 * The reason is that we don't need subtrees that don't have any output nodes.
 * Facet nodes are needed for the row or column domains.
 */

var optimizers_RemoveUnusedSubtrees = /*#__PURE__*/function (_BottomUpOptimizer2) {
  _inherits(RemoveUnusedSubtrees, _BottomUpOptimizer2);

  var _super3 = _createSuper(RemoveUnusedSubtrees);

  function RemoveUnusedSubtrees() {
    _classCallCheck(this, RemoveUnusedSubtrees);

    return _super3.apply(this, arguments);
  }

  _createClass(RemoveUnusedSubtrees, [{
    key: "run",
    value: function run(node) {
      if (node instanceof dataflow_OutputNode || node.numChildren() > 0 || node instanceof facet_FacetNode) {
        // no need to continue with parent because it is output node or will have children (there was a fork)
        return this.flags;
      } else {
        this.setMutated();
        node.remove();
      }

      return this.flags;
    }
  }]);

  return RemoveUnusedSubtrees;
}(optimizer_BottomUpOptimizer);
/**
 * Removes duplicate time unit nodes (as determined by the name of the
 * output field) that may be generated due to selections projected over
 * time units.
 *
 * TODO: Try to make this a top down optimizer that keeps only the first
 * insance of a time unit node.
 * TODO: Try to make a generic version of this that only keeps one node per hash.
 */

var optimizers_RemoveDuplicateTimeUnits = /*#__PURE__*/function (_BottomUpOptimizer3) {
  _inherits(RemoveDuplicateTimeUnits, _BottomUpOptimizer3);

  var _super4 = _createSuper(RemoveDuplicateTimeUnits);

  function RemoveDuplicateTimeUnits() {
    var _this;

    _classCallCheck(this, RemoveDuplicateTimeUnits);

    _this = _super4.apply(this, arguments);
    _this.fields = new Set();
    _this.prev = null;
    return _this;
  }

  _createClass(RemoveDuplicateTimeUnits, [{
    key: "run",
    value: function run(node) {
      this.setContinue();

      if (node instanceof timeunit_TimeUnitNode) {
        var pfields = node.producedFields();

        if (hasIntersection(pfields, this.fields)) {
          this.setMutated();
          this.prev.remove();
        } else {
          this.fields = new Set([].concat(_toConsumableArray(this.fields), _toConsumableArray(pfields)));
        }

        this.prev = node;
      }

      return this.flags;
    }
  }, {
    key: "reset",
    value: function reset() {
      this.fields.clear();
    }
  }]);

  return RemoveDuplicateTimeUnits;
}(optimizer_BottomUpOptimizer);
/**
 * Merge adjacent time unit nodes.
 */

var optimizers_MergeTimeUnits = /*#__PURE__*/function (_BottomUpOptimizer4) {
  _inherits(MergeTimeUnits, _BottomUpOptimizer4);

  var _super5 = _createSuper(MergeTimeUnits);

  function MergeTimeUnits() {
    _classCallCheck(this, MergeTimeUnits);

    return _super5.apply(this, arguments);
  }

  _createClass(MergeTimeUnits, [{
    key: "run",
    value: function run(node) {
      this.setContinue();
      var parent = node.parent;
      var timeUnitChildren = parent.children.filter(function (x) {
        return x instanceof timeunit_TimeUnitNode;
      });
      var combination = timeUnitChildren.pop();

      var _iterator4 = _createForOfIteratorHelper(timeUnitChildren),
          _step4;

      try {
        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
          var timeUnit = _step4.value;
          this.setMutated();
          combination.merge(timeUnit);
        }
      } catch (err) {
        _iterator4.e(err);
      } finally {
        _iterator4.f();
      }

      return this.flags;
    }
  }]);

  return MergeTimeUnits;
}(optimizer_BottomUpOptimizer);
/**
 * Clones the subtree and ignores output nodes except for the leaves, which are renamed.
 */

function cloneSubtree(facet) {
  function clone(node) {
    if (!(node instanceof facet_FacetNode)) {
      var copy = node.clone();

      if (copy instanceof dataflow_OutputNode) {
        var newName = FACET_SCALE_PREFIX + copy.getSource();
        copy.setSource(newName);
        facet.model.component.data.outputNodes[newName] = copy;
      } else if (copy instanceof aggregate_AggregateNode || copy instanceof stack_StackNode || copy instanceof window_WindowTransformNode || copy instanceof joinaggregate_JoinAggregateTransformNode) {
        copy.addDimensions(facet.fields);
      }

      node.children.flatMap(clone).forEach(function (n) {
        return n.parent = copy;
      });
      return [copy];
    }

    return node.children.flatMap(clone);
  }

  return clone;
}
/**
 * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node.
 * After moving down the facet node, make a copy of the subtree and make it a child of the main output.
 */


function moveFacetDown(node) {
  if (node instanceof facet_FacetNode) {
    if (node.numChildren() === 1 && !(node.children[0] instanceof dataflow_OutputNode)) {
      // move down until we hit a fork or output node
      var child = node.children[0];

      if (child instanceof aggregate_AggregateNode || child instanceof stack_StackNode || child instanceof window_WindowTransformNode || child instanceof joinaggregate_JoinAggregateTransformNode) {
        child.addDimensions(node.fields);
      }

      child.swapWithParent();
      moveFacetDown(node);
    } else {
      // move main to facet
      var facetMain = node.model.component.data.main;
      moveMainDownToFacet(facetMain); // replicate the subtree and place it before the facet's main node

      var cloner = cloneSubtree(node);
      var copy = node.children.map(cloner).flat();

      var _iterator5 = _createForOfIteratorHelper(copy),
          _step5;

      try {
        for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
          var c = _step5.value;
          c.parent = facetMain;
        }
      } catch (err) {
        _iterator5.e(err);
      } finally {
        _iterator5.f();
      }
    }
  } else {
    node.children.map(moveFacetDown);
  }
}

function moveMainDownToFacet(node) {
  if (node instanceof dataflow_OutputNode && node.type === MAIN) {
    if (node.numChildren() === 1) {
      var child = node.children[0];

      if (!(child instanceof facet_FacetNode)) {
        child.swapWithParent();
        moveMainDownToFacet(node);
      }
    }
  }
}
/**
 * Remove output nodes that are not required. Starting from a root.
 */


var optimizers_RemoveUnnecessaryOutputNodes = /*#__PURE__*/function (_TopDownOptimizer2) {
  _inherits(RemoveUnnecessaryOutputNodes, _TopDownOptimizer2);

  var _super6 = _createSuper(RemoveUnnecessaryOutputNodes);

  function RemoveUnnecessaryOutputNodes() {
    _classCallCheck(this, RemoveUnnecessaryOutputNodes);

    return _super6.call(this);
  }

  _createClass(RemoveUnnecessaryOutputNodes, [{
    key: "run",
    value: function run(node) {
      if (node instanceof dataflow_OutputNode && !node.isRequired()) {
        this.setMutated();
        node.remove();
      }

      var _iterator6 = _createForOfIteratorHelper(node.children),
          _step6;

      try {
        for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
          var child = _step6.value;
          this.run(child);
        }
      } catch (err) {
        _iterator6.e(err);
      } finally {
        _iterator6.f();
      }

      return this.mutatedFlag;
    }
  }]);

  return RemoveUnnecessaryOutputNodes;
}(optimizer_TopDownOptimizer);
var optimizers_RemoveUnnecessaryIdentifierNodes = /*#__PURE__*/function (_TopDownOptimizer3) {
  _inherits(RemoveUnnecessaryIdentifierNodes, _TopDownOptimizer3);

  var _super7 = _createSuper(RemoveUnnecessaryIdentifierNodes);

  function RemoveUnnecessaryIdentifierNodes(model) {
    var _this2;

    _classCallCheck(this, RemoveUnnecessaryIdentifierNodes);

    _this2 = _super7.call(this);
    _this2.requiresSelectionId = model && requiresSelectionId(model);
    return _this2;
  }

  _createClass(RemoveUnnecessaryIdentifierNodes, [{
    key: "run",
    value: function run(node) {
      if (node instanceof identifier_IdentifierNode) {
        // Only preserve IdentifierNodes if we have default discrete selections
        // in our model tree, and if the nodes come after tuple producing nodes.
        if (!(this.requiresSelectionId && (isDataSourceNode(node.parent) || node.parent instanceof aggregate_AggregateNode || node.parent instanceof formatparse_ParseNode))) {
          this.setMutated();
          node.remove();
        }
      }

      var _iterator7 = _createForOfIteratorHelper(node.children),
          _step7;

      try {
        for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
          var child = _step7.value;
          this.run(child);
        }
      } catch (err) {
        _iterator7.e(err);
      } finally {
        _iterator7.f();
      }

      return this.mutatedFlag;
    }
  }]);

  return RemoveUnnecessaryIdentifierNodes;
}(optimizer_TopDownOptimizer);
/**
 * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes.
 *
 * We assume that dependent paths that do not have a parse node can be just merged.
 */

var optimizers_MergeParse = /*#__PURE__*/function (_BottomUpOptimizer5) {
  _inherits(MergeParse, _BottomUpOptimizer5);

  var _super8 = _createSuper(MergeParse);

  function MergeParse() {
    _classCallCheck(this, MergeParse);

    return _super8.apply(this, arguments);
  }

  _createClass(MergeParse, [{
    key: "run",
    value: function run(node) {
      var parent = node.parent;

      var originalChildren = _toConsumableArray(parent.children);

      var parseChildren = parent.children.filter(function (child) {
        return child instanceof formatparse_ParseNode;
      });

      if (parent.numChildren() > 1 && parseChildren.length >= 1) {
        var commonParse = {};
        var conflictingParse = new Set();

        var _iterator8 = _createForOfIteratorHelper(parseChildren),
            _step8;

        try {
          for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
            var parseNode = _step8.value;
            var parse = parseNode.parse;

            var _iterator12 = _createForOfIteratorHelper(util_keys(parse)),
                _step12;

            try {
              for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
                var k = _step12.value;

                if (!(k in commonParse)) {
                  commonParse[k] = parse[k];
                } else if (commonParse[k] !== parse[k]) {
                  conflictingParse.add(k);
                }
              }
            } catch (err) {
              _iterator12.e(err);
            } finally {
              _iterator12.f();
            }
          }
        } catch (err) {
          _iterator8.e(err);
        } finally {
          _iterator8.f();
        }

        var _iterator9 = _createForOfIteratorHelper(conflictingParse),
            _step9;

        try {
          for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
            var field = _step9.value;
            delete commonParse[field];
          }
        } catch (err) {
          _iterator9.e(err);
        } finally {
          _iterator9.f();
        }

        if (util_keys(commonParse).length !== 0) {
          this.setMutated();
          var mergedParseNode = new formatparse_ParseNode(parent, commonParse);

          var _iterator10 = _createForOfIteratorHelper(originalChildren),
              _step10;

          try {
            for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
              var childNode = _step10.value;

              if (childNode instanceof formatparse_ParseNode) {
                var _iterator11 = _createForOfIteratorHelper(util_keys(commonParse)),
                    _step11;

                try {
                  for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
                    var key = _step11.value;
                    delete childNode.parse[key];
                  }
                } catch (err) {
                  _iterator11.e(err);
                } finally {
                  _iterator11.f();
                }
              }

              parent.removeChild(childNode);
              childNode.parent = mergedParseNode; // remove empty parse nodes

              if (childNode instanceof formatparse_ParseNode && util_keys(childNode.parse).length === 0) {
                childNode.remove();
              }
            }
          } catch (err) {
            _iterator10.e(err);
          } finally {
            _iterator10.f();
          }
        }
      }

      this.setContinue();
      return this.flags;
    }
  }]);

  return MergeParse;
}(optimizer_BottomUpOptimizer);
var optimizers_MergeAggregates = /*#__PURE__*/function (_BottomUpOptimizer6) {
  _inherits(MergeAggregates, _BottomUpOptimizer6);

  var _super9 = _createSuper(MergeAggregates);

  function MergeAggregates() {
    _classCallCheck(this, MergeAggregates);

    return _super9.apply(this, arguments);
  }

  _createClass(MergeAggregates, [{
    key: "run",
    value: function run(node) {
      var parent = node.parent;
      var aggChildren = parent.children.filter(function (child) {
        return child instanceof aggregate_AggregateNode;
      }); // Object which we'll use to map the fields which an aggregate is grouped by to
      // the set of aggregates with that grouping. This is useful as only aggregates
      // with the same group by can be merged

      var groupedAggregates = {}; // Build groupedAggregates

      var _iterator13 = _createForOfIteratorHelper(aggChildren),
          _step13;

      try {
        for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
          var agg = _step13.value;
          var groupBys = util_hash(agg.groupBy);

          if (!(groupBys in groupedAggregates)) {
            groupedAggregates[groupBys] = [];
          }

          groupedAggregates[groupBys].push(agg);
        } // Merge aggregateNodes with same key in groupedAggregates

      } catch (err) {
        _iterator13.e(err);
      } finally {
        _iterator13.f();
      }

      var _iterator14 = _createForOfIteratorHelper(util_keys(groupedAggregates)),
          _step14;

      try {
        for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
          var group = _step14.value;
          var mergeableAggs = groupedAggregates[group];

          if (mergeableAggs.length > 1) {
            var mergedAggs = mergeableAggs.pop();

            var _iterator15 = _createForOfIteratorHelper(mergeableAggs),
                _step15;

            try {
              for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
                var _agg = _step15.value;

                if (mergedAggs.merge(_agg)) {
                  parent.removeChild(_agg);
                  _agg.parent = mergedAggs;

                  _agg.remove();

                  this.setMutated();
                }
              }
            } catch (err) {
              _iterator15.e(err);
            } finally {
              _iterator15.f();
            }
          }
        }
      } catch (err) {
        _iterator14.e(err);
      } finally {
        _iterator14.f();
      }

      this.setContinue();
      return this.flags;
    }
  }]);

  return MergeAggregates;
}(optimizer_BottomUpOptimizer);
/**
 * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node.
 */

var optimizers_MergeBins = /*#__PURE__*/function (_BottomUpOptimizer7) {
  _inherits(MergeBins, _BottomUpOptimizer7);

  var _super10 = _createSuper(MergeBins);

  function MergeBins(model) {
    var _this3;

    _classCallCheck(this, MergeBins);

    _this3 = _super10.call(this);
    _this3.model = model;
    return _this3;
  }

  _createClass(MergeBins, [{
    key: "run",
    value: function run(node) {
      var parent = node.parent;
      var moveBinsUp = !(isDataSourceNode(parent) || parent instanceof filter_FilterNode || parent instanceof formatparse_ParseNode || parent instanceof identifier_IdentifierNode);
      var promotableBins = [];
      var remainingBins = [];

      var _iterator16 = _createForOfIteratorHelper(parent.children),
          _step16;

      try {
        for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
          var child = _step16.value;

          if (child instanceof bin_BinNode) {
            if (moveBinsUp && !fieldIntersection(parent.producedFields(), child.dependentFields())) {
              promotableBins.push(child);
            } else {
              remainingBins.push(child);
            }
          }
        }
      } catch (err) {
        _iterator16.e(err);
      } finally {
        _iterator16.f();
      }

      if (promotableBins.length > 0) {
        var promotedBin = promotableBins.pop();

        var _iterator17 = _createForOfIteratorHelper(promotableBins),
            _step17;

        try {
          for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
            var bin = _step17.value;
            promotedBin.merge(bin, this.model.renameSignal.bind(this.model));
          }
        } catch (err) {
          _iterator17.e(err);
        } finally {
          _iterator17.f();
        }

        this.setMutated();

        if (parent instanceof bin_BinNode) {
          parent.merge(promotedBin, this.model.renameSignal.bind(this.model));
        } else {
          promotedBin.swapWithParent();
        }
      }

      if (remainingBins.length > 1) {
        var remainingBin = remainingBins.pop();

        var _iterator18 = _createForOfIteratorHelper(remainingBins),
            _step18;

        try {
          for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
            var _bin = _step18.value;
            remainingBin.merge(_bin, this.model.renameSignal.bind(this.model));
          }
        } catch (err) {
          _iterator18.e(err);
        } finally {
          _iterator18.f();
        }

        this.setMutated();
      }

      this.setContinue();
      return this.flags;
    }
  }]);

  return MergeBins;
}(optimizer_BottomUpOptimizer);
/**
 * This optimizer takes output nodes that are at a fork and moves them before the fork.
 *
 * The algorithm iterates over the children and tries to find the last output node in a cahin of output nodes.
 * It then moves all output nodes before that main output node. All other children (and the children of the output nodes)
 * are inserted after the main output node.
 */

var optimizers_MergeOutputs = /*#__PURE__*/function (_BottomUpOptimizer8) {
  _inherits(MergeOutputs, _BottomUpOptimizer8);

  var _super11 = _createSuper(MergeOutputs);

  function MergeOutputs() {
    _classCallCheck(this, MergeOutputs);

    return _super11.apply(this, arguments);
  }

  _createClass(MergeOutputs, [{
    key: "run",
    value: function run(node) {
      var parent = node.parent;

      var children = _toConsumableArray(parent.children);

      var hasOutputChild = some(children, function (child) {
        return child instanceof dataflow_OutputNode;
      });

      if (!hasOutputChild || parent.numChildren() <= 1) {
        this.setContinue();
        return this.flags;
      }

      var otherChildren = []; // The output node we will connect all other nodes to
      // output nodes will be added before, other nodes after

      var mainOutput;

      var _iterator19 = _createForOfIteratorHelper(children),
          _step19;

      try {
        for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
          var _child = _step19.value;

          if (_child instanceof dataflow_OutputNode) {
            var lastOutput = _child;

            while (lastOutput.numChildren() === 1) {
              var theChild = lastOutput.children[0];

              if (theChild instanceof dataflow_OutputNode) {
                lastOutput = theChild;
              } else {
                break;
              }
            }

            otherChildren.push.apply(otherChildren, _toConsumableArray(lastOutput.children));

            if (mainOutput) {
              // Move the output nodes before the mainOutput. We do this by setting
              // the parent of the first not to the parent of the main output and
              // the main output's parent to the last output.
              // note: the child is the first output
              parent.removeChild(_child);
              _child.parent = mainOutput.parent;
              mainOutput.parent.removeChild(mainOutput);
              mainOutput.parent = lastOutput;
              this.setMutated();
            } else {
              mainOutput = lastOutput;
            }
          } else {
            otherChildren.push(_child);
          }
        }
      } catch (err) {
        _iterator19.e(err);
      } finally {
        _iterator19.f();
      }

      if (otherChildren.length) {
        this.setMutated();

        var _iterator20 = _createForOfIteratorHelper(otherChildren),
            _step20;

        try {
          for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
            var child = _step20.value;
            child.parent.removeChild(child);
            child.parent = mainOutput;
          }
        } catch (err) {
          _iterator20.e(err);
        } finally {
          _iterator20.f();
        }
      }

      this.setContinue();
      return this.flags;
    }
  }]);

  return MergeOutputs;
}(optimizer_BottomUpOptimizer);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/optimize.js














var FACET_SCALE_PREFIX = 'scale_';
var MAX_OPTIMIZATION_RUNS = 5;
/**
 * Return all leaf nodes.
 */

function getLeaves(roots) {
  var leaves = [];

  function append(node) {
    if (node.numChildren() === 0) {
      leaves.push(node);
    } else {
      node.children.forEach(append);
    }
  }

  roots.forEach(append);
  return leaves;
}

function isTrue(x) {
  return x;
}
/**
 * Run the specified optimizer on the provided nodes.
 *
 * @param optimizer The optimizer instance to run.
 * @param nodes A set of nodes to optimize.
 * @param flag Flag that will be or'ed with return valued from optimization calls to the nodes.
 */

function runOptimizer(optimizer, nodes) {
  var flags = nodes.map(function (node) {
    if (optimizer instanceof optimizer_BottomUpOptimizer) {
      var runFlags = optimizer.optimizeNextFromLeaves(node);
      optimizer.reset();
      return runFlags;
    } else {
      return optimizer.run(node);
    }
  });
  return flags.some(isTrue);
}

function optimizationDataflowHelper(dataComponent, model) {
  var roots = dataComponent.sources;
  var mutatedFlags = new Set();
  mutatedFlags.add(runOptimizer(new optimizers_RemoveUnnecessaryOutputNodes(), roots));
  mutatedFlags.add(runOptimizer(new optimizers_RemoveUnnecessaryIdentifierNodes(model), roots)); // remove source nodes that don't have any children because they also don't have output nodes

  roots = roots.filter(function (r) {
    return r.numChildren() > 0;
  });
  mutatedFlags.add(runOptimizer(new optimizers_RemoveUnusedSubtrees(), getLeaves(roots)));
  roots = roots.filter(function (r) {
    return r.numChildren() > 0;
  });
  mutatedFlags.add(runOptimizer(new optimizers_MoveParseUp(), getLeaves(roots)));
  mutatedFlags.add(runOptimizer(new optimizers_MergeBins(model), getLeaves(roots)));
  mutatedFlags.add(runOptimizer(new optimizers_RemoveDuplicateTimeUnits(), getLeaves(roots)));
  mutatedFlags.add(runOptimizer(new optimizers_MergeParse(), getLeaves(roots)));
  mutatedFlags.add(runOptimizer(new optimizers_MergeAggregates(), getLeaves(roots)));
  mutatedFlags.add(runOptimizer(new optimizers_MergeTimeUnits(), getLeaves(roots)));
  mutatedFlags.add(runOptimizer(new optimizers_MergeIdenticalNodes(), roots));
  mutatedFlags.add(runOptimizer(new optimizers_MergeOutputs(), getLeaves(roots)));
  dataComponent.sources = roots;
  return mutatedFlags.has(true);
}
/**
 * Optimizes the dataflow of the passed in data component.
 */


function optimizeDataflow(data, model) {
  // check before optimizations
  checkLinks(data.sources);
  var firstPassCounter = 0;
  var secondPassCounter = 0;

  for (var i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {
    if (!optimizationDataflowHelper(data, model)) {
      break;
    }

    firstPassCounter++;
  } // move facets down and make a copy of the subtree so that we can have scales at the top level


  data.sources.map(moveFacetDown);

  for (var _i = 0; _i < MAX_OPTIMIZATION_RUNS; _i++) {
    if (!optimizationDataflowHelper(data, model)) {
      break;
    }

    secondPassCounter++;
  } // check after optimizations


  checkLinks(data.sources);

  if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) {
    log_warn("Maximum optimization runs(".concat(MAX_OPTIMIZATION_RUNS, ") reached."));
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/signal.js




/**
 * A class that behaves like a SignalRef but lazily generates the signal.
 * The provided generator function should use `Model.getSignalName` to use the correct signal name.
 */
var signal_SignalRefWrapper = /*#__PURE__*/function () {
  function SignalRefWrapper(exprGenerator) {
    _classCallCheck(this, SignalRefWrapper);

    Object.defineProperty(this, 'signal', {
      enumerable: true,
      get: exprGenerator
    });
  }

  _createClass(SignalRefWrapper, null, [{
    key: "fromName",
    value: function fromName(rename, signalName) {
      return new SignalRefWrapper(function () {
        return rename(signalName);
      });
    }
  }]);

  return SignalRefWrapper;
}();
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/scale/domain.js




























function domain_parseScaleDomain(model) {
  if (isUnitModel(model)) {
    parseUnitScaleDomain(model);
  } else {
    parseNonUnitScaleDomain(model);
  }
}

function parseUnitScaleDomain(model) {
  var localScaleComponents = model.component.scales;

  var _iterator = _createForOfIteratorHelper(util_keys(localScaleComponents)),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var channel = _step.value;
      var domains = parseDomainForChannel(model, channel);
      var localScaleCmpt = localScaleComponents[channel];
      localScaleCmpt.setWithExplicit('domains', domains);
      parseSelectionDomain(model, channel);

      if (model.component.data.isFaceted) {
        // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not
        var facetParent = model;

        while (!isFacetModel(facetParent) && facetParent.parent) {
          facetParent = facetParent.parent;
        }

        var resolve = facetParent.component.resolve.scale[channel];

        if (resolve === 'shared') {
          var _iterator2 = _createForOfIteratorHelper(domains.value),
              _step2;

          try {
            for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
              var domain = _step2.value;

              // Replace the scale domain with data output from a cloned subtree after the facet.
              if (isDataRefDomain(domain)) {
                // use data from cloned subtree (which is the same as data but with a prefix added once)
                domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, '');
              }
            }
          } catch (err) {
            _iterator2.e(err);
          } finally {
            _iterator2.f();
          }
        }
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }
}

function parseNonUnitScaleDomain(model) {
  var _iterator3 = _createForOfIteratorHelper(model.children),
      _step3;

  try {
    for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
      var child = _step3.value;
      domain_parseScaleDomain(child);
    }
  } catch (err) {
    _iterator3.e(err);
  } finally {
    _iterator3.f();
  }

  var localScaleComponents = model.component.scales;

  var _iterator4 = _createForOfIteratorHelper(util_keys(localScaleComponents)),
      _step4;

  try {
    for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
      var channel = _step4.value;
      var domains = void 0;
      var selectionExtent = null;

      var _iterator5 = _createForOfIteratorHelper(model.children),
          _step5;

      try {
        for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
          var _child = _step5.value;
          var childComponent = _child.component.scales[channel];

          if (childComponent) {
            if (domains === undefined) {
              domains = childComponent.getWithExplicit('domains');
            } else {
              domains = mergeValuesWithExplicit(domains, childComponent.getWithExplicit('domains'), 'domains', 'scale', domainsTieBreaker);
            }

            var se = childComponent.get('selectionExtent');

            if (selectionExtent && se && selectionExtent.selection !== se.selection) {
              log_warn('The same selection must be used to override scale domains in a layered view.');
            }

            selectionExtent = se;
          }
        }
      } catch (err) {
        _iterator5.e(err);
      } finally {
        _iterator5.f();
      }

      localScaleComponents[channel].setWithExplicit('domains', domains);

      if (selectionExtent) {
        localScaleComponents[channel].set('selectionExtent', selectionExtent, true);
      }
    }
  } catch (err) {
    _iterator4.e(err);
  } finally {
    _iterator4.f();
  }
}
/**
 * Remove unaggregated domain if it is not applicable
 * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true.
 */


function normalizeUnaggregatedDomain(domain, fieldDef, scaleType, scaleConfig) {
  if (domain === 'unaggregated') {
    var _canUseUnaggregatedDo = canUseUnaggregatedDomain(fieldDef, scaleType),
        valid = _canUseUnaggregatedDo.valid,
        reason = _canUseUnaggregatedDo.reason;

    if (!valid) {
      log_warn(reason);
      return undefined;
    }
  } else if (domain === undefined && scaleConfig.useUnaggregatedDomain) {
    // Apply config if domain is not specified.
    var _canUseUnaggregatedDo2 = canUseUnaggregatedDomain(fieldDef, scaleType),
        _valid = _canUseUnaggregatedDo2.valid;

    if (_valid) {
      return 'unaggregated';
    }
  }

  return domain;
}

function parseDomainForChannel(model, channel) {
  var scaleType = model.getScaleComponent(channel).get('type');
  var domain = normalizeUnaggregatedDomain(model.scaleDomain(channel), model.fieldDef(channel), scaleType, model.config.scale);

  if (domain !== model.scaleDomain(channel)) {
    model.specifiedScales[channel] = Object.assign(Object.assign({}, model.specifiedScales[channel]), {
      domain: domain
    });
  } // If channel is either X or Y then union them with X2 & Y2 if they exist


  if (channel === 'x' && model.channelHasField('x2')) {
    if (model.channelHasField('x')) {
      return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'x'), parseSingleChannelDomain(scaleType, domain, model, 'x2'), 'domain', 'scale', domainsTieBreaker);
    } else {
      return parseSingleChannelDomain(scaleType, domain, model, 'x2');
    }
  } else if (channel === 'y' && model.channelHasField('y2')) {
    if (model.channelHasField('y')) {
      return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'y'), parseSingleChannelDomain(scaleType, domain, model, 'y2'), 'domain', 'scale', domainsTieBreaker);
    } else {
      return parseSingleChannelDomain(scaleType, domain, model, 'y2');
    }
  }

  return parseSingleChannelDomain(scaleType, domain, model, channel);
}

function mapDomainToDataSignal(domain, type, timeUnit) {
  return domain.map(function (v) {
    var data = valueExpr(v, {
      timeUnit: timeUnit,
      type: type
    });
    return {
      signal: "{data: ".concat(data, "}")
    };
  });
}

function convertDomainIfItIsDateTime(domain, type, timeUnit) {
  var _a; // explicit value


  var normalizedTimeUnit = (_a = normalizeTimeUnit(timeUnit)) === null || _a === void 0 ? void 0 : _a.unit;

  if (type === 'temporal' || normalizedTimeUnit) {
    return mapDomainToDataSignal(domain, type, normalizedTimeUnit);
  }

  return [domain]; // Date time won't make sense
}

function parseSingleChannelDomain(scaleType, domain, model, channel) {
  var fieldDef = model.fieldDef(channel);
  var mainFieldDef = model.fieldDef(getMainRangeChannel(channel));

  if (isDomainUnionWith(domain)) {
    var defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel);
    var unionWith = convertDomainIfItIsDateTime(domain.unionWith, mainFieldDef.type, fieldDef.timeUnit);
    return split_makeExplicit([].concat(_toConsumableArray(defaultDomain.value), _toConsumableArray(unionWith)));
  } else if (isSignalRef(domain)) {
    return split_makeExplicit([domain]);
  } else if (domain && domain !== 'unaggregated' && !isSelectionDomain(domain)) {
    return split_makeExplicit(convertDomainIfItIsDateTime(domain, mainFieldDef.type, fieldDef.timeUnit));
  }

  var stack = model.stack;

  if (stack && channel === stack.fieldChannel) {
    if (stack.offset === 'normalize') {
      return makeImplicit([[0, 1]]);
    }

    var data = model.requestDataName(MAIN);
    return makeImplicit([{
      data: data,
      field: model.vgField(channel, {
        suffix: 'start'
      })
    }, {
      data: data,
      field: model.vgField(channel, {
        suffix: 'end'
      })
    }]);
  }

  var sort = isScaleChannel(channel) ? domainSort(model, channel, scaleType) : undefined;

  if (domain === 'unaggregated') {
    var _data = model.requestDataName(MAIN);

    var field = fieldDef.field;
    return makeImplicit([{
      data: _data,
      field: channeldef_vgField({
        field: field,
        aggregate: 'min'
      })
    }, {
      data: _data,
      field: channeldef_vgField({
        field: field,
        aggregate: 'max'
      })
    }]);
  } else if (isBinning(fieldDef.bin)) {
    if (hasDiscreteDomain(scaleType)) {
      if (scaleType === 'bin-ordinal') {
        // we can omit the domain as it is inferred from the `bins` property
        return makeImplicit([]);
      } // ordinal bin scale takes domain from bin_range, ordered by bin start
      // This is useful for both axis-based scale (x/y) and legend-based scale (other channels).


      return makeImplicit([{
        // If sort by aggregation of a specified sort field, we need to use RAW table,
        // so we can aggregate values for the scale independently from the main aggregation.
        data: util_isBoolean(sort) ? model.requestDataName(MAIN) : model.requestDataName(RAW),
        // Use range if we added it and the scale does not support computing a range as a signal.
        field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? {
          binSuffix: 'range'
        } : {}),
        // we have to use a sort object if sort = true to make the sort correct by bin start
        sort: sort === true || !isObject(sort) ? {
          field: model.vgField(channel, {}),
          op: 'min' // min or max doesn't matter since we sort by the start of the bin range

        } : sort
      }]);
    } else {
      // continuous scales
      var bin = fieldDef.bin;

      if (isBinning(bin)) {
        var binSignal = getBinSignalName(model, fieldDef.field, bin);
        return makeImplicit([new signal_SignalRefWrapper(function () {
          var signal = model.getSignalName(binSignal);
          return "[".concat(signal, ".start, ").concat(signal, ".stop]");
        })]);
      } else {
        return makeImplicit([{
          data: model.requestDataName(MAIN),
          field: model.vgField(channel, {})
        }]);
      }
    }
  } else if (fieldDef.timeUnit && util_contains(['time', 'utc'], scaleType) && hasBand(channel, fieldDef, isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined, model.markDef, model.config)) {
    var _data2 = model.requestDataName(MAIN);

    return makeImplicit([{
      data: _data2,
      field: model.vgField(channel)
    }, {
      data: _data2,
      field: model.vgField(channel, {
        suffix: 'end'
      })
    }]);
  } else if (sort) {
    return makeImplicit([{
      // If sort by aggregation of a specified sort field, we need to use RAW table,
      // so we can aggregate values for the scale independently from the main aggregation.
      data: util_isBoolean(sort) ? model.requestDataName(MAIN) : model.requestDataName(RAW),
      field: model.vgField(channel),
      sort: sort
    }]);
  } else {
    return makeImplicit([{
      data: model.requestDataName(MAIN),
      field: model.vgField(channel)
    }]);
  }
}

function normalizeSortField(sort, isStackedMeasure) {
  var op = sort.op,
      field = sort.field,
      order = sort.order;
  return Object.assign(Object.assign({
    // Apply default op
    op: op !== null && op !== void 0 ? op : isStackedMeasure ? 'sum' : DEFAULT_SORT_OP
  }, field ? {
    field: replacePathInField(field)
  } : {}), order ? {
    order: order
  } : {});
}

function parseSelectionDomain(model, channel) {
  var scale = model.component.scales[channel];
  var spec = model.specifiedScales[channel].domain;
  var bin = model.fieldDef(channel).bin;
  var domain = isSelectionDomain(spec) && spec;
  var extent = isBinParams(bin) && isSelectionExtent(bin.extent) && bin.extent;

  if (domain || extent) {
    // As scale parsing occurs before selection parsing, we cannot set
    // domainRaw directly. So instead, we store the selectionExtent on
    // the scale component, and then add domainRaw during scale assembly.
    scale.set('selectionExtent', domain !== null && domain !== void 0 ? domain : extent, true);
  }
}

function domainSort(model, channel, scaleType) {
  if (!hasDiscreteDomain(scaleType)) {
    return undefined;
  } // save to cast as the only exception is the geojson type for shape, which would not generate a scale


  var fieldDef = model.fieldDef(channel);
  var sort = fieldDef.sort; // if the sort is specified with array, use the derived sort index field

  if (isSortArray(sort)) {
    return {
      op: 'min',
      field: sortArrayIndexField(fieldDef, channel),
      order: 'ascending'
    };
  }

  var stack = model.stack;
  var stackDimensions = stack ? [].concat(_toConsumableArray(stack.groupbyField ? [stack.groupbyField] : []), _toConsumableArray(stack.stackBy.map(function (s) {
    return s.fieldDef.field;
  }))) : undefined; // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)

  if (isSortField(sort)) {
    var isStackedMeasure = stack && !util_contains(stackDimensions, sort.field);
    return normalizeSortField(sort, isStackedMeasure);
  } else if (isSortByEncoding(sort)) {
    var encoding = sort.encoding,
        order = sort.order;
    var fieldDefToSortBy = model.fieldDef(encoding);
    var aggregate = fieldDefToSortBy.aggregate,
        field = fieldDefToSortBy.field;

    var _isStackedMeasure = stack && !util_contains(stackDimensions, field);

    if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {
      return normalizeSortField({
        field: channeldef_vgField(fieldDefToSortBy),
        order: order
      }, _isStackedMeasure);
    } else if (isAggregateOp(aggregate) || !aggregate) {
      return normalizeSortField({
        op: aggregate,
        field: field,
        order: order
      }, _isStackedMeasure);
    }
  } else if (sort === 'descending') {
    return {
      op: 'min',
      field: model.vgField(channel),
      order: 'descending'
    };
  } else if (util_contains(['ascending', undefined
  /* default =ascending*/
  ], sort)) {
    return true;
  } // sort == null


  return undefined;
}
/**
 * Determine if a scale can use unaggregated domain.
 * @return {Boolean} Returns true if all of the following conditions apply:
 * 1. `scale.domain` is `unaggregated`
 * 2. Aggregation function is not `count` or `sum`
 * 3. The scale is quantitative or time scale.
 */

function canUseUnaggregatedDomain(fieldDef, scaleType) {
  var aggregate = fieldDef.aggregate,
      type = fieldDef.type;

  if (!aggregate) {
    return {
      valid: false,
      reason: message.unaggregateDomainHasNoEffectForRawField(fieldDef)
    };
  }

  if (isString(aggregate) && !SHARED_DOMAIN_OP_INDEX[aggregate]) {
    return {
      valid: false,
      reason: message.unaggregateDomainWithNonSharedDomainOp(aggregate)
    };
  }

  if (type === 'quantitative') {
    if (scaleType === 'log') {
      return {
        valid: false,
        reason: message.unaggregatedDomainWithLogScale(fieldDef)
      };
    }
  }

  return {
    valid: true
  };
}
/**
 * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values.
 */

function domainsTieBreaker(v1, v2, property, propertyOf) {
  if (v1.explicit && v2.explicit) {
    log_warn(message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value));
  } // If equal score, concat the domains so that we union them later.


  return {
    explicit: v1.explicit,
    value: [].concat(_toConsumableArray(v1.value), _toConsumableArray(v2.value))
  };
}
/**
 * Converts an array of domains to a single Vega scale domain.
 */


function mergeDomains(domains) {
  var uniqueDomains = unique(domains.map(function (domain) {
    // ignore sort property when computing the unique domains
    if (isDataRefDomain(domain)) {
      var _s = domain.sort,
          domainWithoutSort = __rest(domain, ["sort"]);

      return domainWithoutSort;
    }

    return domain;
  }), util_hash);
  var sorts = unique(domains.map(function (d) {
    if (isDataRefDomain(d)) {
      var s = d.sort;

      if (s !== undefined && !util_isBoolean(s)) {
        if ('op' in s && s.op === 'count') {
          // let's make sure that if op is count, we don't use a field
          delete s.field;
        }

        if (s.order === 'ascending') {
          // drop order: ascending as it is the default
          delete s.order;
        }
      }

      return s;
    }

    return undefined;
  }).filter(function (s) {
    return s !== undefined;
  }), util_hash);

  if (uniqueDomains.length === 0) {
    return undefined;
  } else if (uniqueDomains.length === 1) {
    var domain = domains[0];

    if (isDataRefDomain(domain) && sorts.length > 0) {
      var _sort = sorts[0];

      if (sorts.length > 1) {
        log_warn(message.MORE_THAN_ONE_SORT);
        _sort = true;
      } else {
        // Simplify domain sort by removing field and op when the field is the same as the domain field.
        if (isObject(_sort) && 'field' in _sort) {
          var sortField = _sort.field;

          if (domain.field === sortField) {
            _sort = _sort.order ? {
              order: _sort.order
            } : true;
          }
        }
      }

      return Object.assign(Object.assign({}, domain), {
        sort: _sort
      });
    }

    return domain;
  } // only keep sort properties that work with unioned domains


  var unionDomainSorts = unique(sorts.map(function (s) {
    if (util_isBoolean(s) || !('op' in s) || s.op in MULTIDOMAIN_SORT_OP_INDEX) {
      return s;
    }

    log_warn(message.domainSortDropped(s));
    return true;
  }), util_hash);
  var sort;

  if (unionDomainSorts.length === 1) {
    sort = unionDomainSorts[0];
  } else if (unionDomainSorts.length > 1) {
    log_warn(message.MORE_THAN_ONE_SORT);
    sort = true;
  }

  var allData = unique(domains.map(function (d) {
    if (isDataRefDomain(d)) {
      return d.data;
    }

    return null;
  }), function (x) {
    return x;
  });

  if (allData.length === 1 && allData[0] !== null) {
    // create a union domain of different fields with a single data source
    var _domain = Object.assign({
      data: allData[0],
      fields: uniqueDomains.map(function (d) {
        return d.field;
      })
    }, sort ? {
      sort: sort
    } : {});

    return _domain;
  }

  return Object.assign({
    fields: uniqueDomains
  }, sort ? {
    sort: sort
  } : {});
}
/**
 * Return a field if a scale uses a single field.
 * Return `undefined` otherwise.
 */

function getFieldFromDomain(domain) {
  if (isDataRefDomain(domain) && isString(domain.field)) {
    return domain.field;
  } else if (isDataRefUnionedDomain(domain)) {
    var field;

    var _iterator6 = _createForOfIteratorHelper(domain.fields),
        _step6;

    try {
      for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
        var nonUnionDomain = _step6.value;

        if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) {
          if (!field) {
            field = nonUnionDomain.field;
          } else if (field !== nonUnionDomain.field) {
            log_warn('Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.');
            return field;
          }
        }
      }
    } catch (err) {
      _iterator6.e(err);
    } finally {
      _iterator6.f();
    }

    log_warn('Detected faceted independent scales that union domain of identical fields from different source detected. We will assume that this is the same field from a different fork of the same data source. However, if this is not case, the result view size maybe incorrect.');
    return field;
  } else if (isFieldRefUnionDomain(domain)) {
    log_warn('Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.');
    var _field = domain.fields[0];
    return isString(_field) ? _field : undefined;
  }

  return undefined;
}
function assembleDomain(model, channel) {
  var scaleComponent = model.component.scales[channel];
  var domains = scaleComponent.get('domains').map(function (domain) {
    // Correct references to data as the original domain's data was determined
    // in parseScale, which happens before parseData. Thus the original data
    // reference can be incorrect.
    if (isDataRefDomain(domain)) {
      domain.data = model.lookupDataSource(domain.data);
    }

    return domain;
  }); // domains is an array that has to be merged into a single vega domain

  return mergeDomains(domains);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/scale/assemble.js











function assembleScales(model) {
  if (isLayerModel(model) || isConcatModel(model)) {
    // For concat and layer, include scales of children too
    return model.children.reduce(function (scales, child) {
      return scales.concat(assembleScales(child));
    }, assembleScalesForModel(model));
  } else {
    // For facet, child scales would not be included in the parent's scope.
    // For unit, there is no child.
    return assembleScalesForModel(model);
  }
}
function assembleScalesForModel(model) {
  return util_keys(model.component.scales).reduce(function (scales, channel) {
    var scaleComponent = model.component.scales[channel];

    if (scaleComponent.merged) {
      // Skipped merged scales
      return scales;
    }

    var scale = scaleComponent.combine();

    var name = scale.name,
        type = scale.type,
        selectionExtent = scale.selectionExtent,
        _d = scale.domains,
        _r = scale.range,
        reverse = scale.reverse,
        otherScaleProps = __rest(scale, ["name", "type", "selectionExtent", "domains", "range", "reverse"]);

    var range = assembleScaleRange(scale.range, name, channel);
    var domainRaw;

    if (selectionExtent) {
      domainRaw = assembleSelectionScaleDomain(model, selectionExtent);
    }

    var domain = assembleDomain(model, channel);
    scales.push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
      name: name,
      type: type
    }, domain ? {
      domain: domain
    } : {}), domainRaw ? {
      domainRaw: domainRaw
    } : {}), {
      range: range
    }), reverse !== undefined ? {
      reverse: reverse
    } : {}), otherScaleProps));
    return scales;
  }, []);
}
function assembleScaleRange(scaleRange, scaleName, channel) {
  // add signals to x/y range
  if (channel === 'x' || channel === 'y') {
    if (isVgRangeStep(scaleRange)) {
      // For width/height step, use a signal created in layout assemble instead of a constant step.
      return {
        step: {
          signal: scaleName + '_step'
        }
      };
    }
  }

  return scaleRange;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/scale/component.js







var component_ScaleComponent = /*#__PURE__*/function (_Split) {
  _inherits(ScaleComponent, _Split);

  var _super = _createSuper(ScaleComponent);

  function ScaleComponent(name, typeWithExplicit) {
    var _this;

    _classCallCheck(this, ScaleComponent);

    _this = _super.call(this, {}, // no initial explicit property
    {
      name: name
    } // name as initial implicit property
    );
    _this.merged = false;

    _this.setWithExplicit('type', typeWithExplicit);

    return _this;
  }
  /**
   * Whether the scale definitely includes zero in the domain
   */


  _createClass(ScaleComponent, [{
    key: "domainDefinitelyIncludesZero",
    value: function domainDefinitelyIncludesZero() {
      if (this.get('zero') !== false) {
        return true;
      }

      return some(this.get('domains'), function (d) {
        return isArray(d) && d.length === 2 && d[0] <= 0 && d[1] >= 0;
      });
    }
  }]);

  return ScaleComponent;
}(split_Split);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/scale/range.js





















var RANGE_PROPERTIES = ['range', 'scheme'];

function range_getSizeType(channel) {
  return channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;
}

function parseUnitScaleRange(model) {
  var localScaleComponents = model.component.scales; // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first!

  SCALE_CHANNELS.forEach(function (channel) {
    var localScaleCmpt = localScaleComponents[channel];

    if (!localScaleCmpt) {
      return;
    }

    var rangeWithExplicit = parseRangeForChannel(channel, model);
    localScaleCmpt.setWithExplicit('range', rangeWithExplicit);
  });
}

function getBinStepSignal(model, channel) {
  var fieldDef = model.fieldDef(channel);

  if (fieldDef && fieldDef.bin && isBinning(fieldDef.bin)) {
    var binSignal = getBinSignalName(model, fieldDef.field, fieldDef.bin); // TODO: extract this to be range step signal

    var sizeType = range_getSizeType(channel);
    var sizeSignal = model.getName(sizeType);
    return new signal_SignalRefWrapper(function () {
      var updatedName = model.getSignalName(binSignal);
      var binCount = "(".concat(updatedName, ".stop - ").concat(updatedName, ".start) / ").concat(updatedName, ".step");
      return "".concat(model.getSignalName(sizeSignal), " / (").concat(binCount, ")");
    });
  }

  return undefined;
}
/**
 * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme).
 */


function parseRangeForChannel(channel, model) {
  var specifiedScale = model.specifiedScales[channel];
  var size = model.size;
  var mergedScaleCmpt = model.getScaleComponent(channel);
  var scaleType = mergedScaleCmpt.get('type'); // Check if any of the range properties is specified.
  // If so, check if it is compatible and make sure that we only output one of the properties

  var _iterator = _createForOfIteratorHelper(RANGE_PROPERTIES),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var property = _step.value;

      if (specifiedScale[property] !== undefined) {
        var supportedByScaleType = scaleTypeSupportProperty(scaleType, property);
        var channelIncompatability = channelScalePropertyIncompatability(channel, property);

        if (!supportedByScaleType) {
          log_warn(message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));
        } else if (channelIncompatability) {
          // channel
          log_warn(channelIncompatability);
        } else {
          switch (property) {
            case 'range':
              if (isArray(specifiedScale.range) && (channel === 'x' || channel === 'y')) {
                return split_makeExplicit(specifiedScale.range.map(function (v) {
                  if (v === 'width' || v === 'height') {
                    // get signal for width/height
                    // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames.
                    var sizeSignal = model.getName(v);
                    var getSignalName = model.getSignalName.bind(model);
                    return signal_SignalRefWrapper.fromName(getSignalName, sizeSignal);
                  }

                  return v;
                }));
              }

              return split_makeExplicit(specifiedScale.range);

            case 'scheme':
              return split_makeExplicit(parseScheme(specifiedScale[property]));
          }
        }
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  if (channel === channel_X || channel === channel_Y) {
    var sizeChannel = channel === channel_X ? 'width' : 'height';
    var sizeValue = size[sizeChannel];

    if (isStep(sizeValue)) {
      if (hasDiscreteDomain(scaleType)) {
        return split_makeExplicit({
          step: sizeValue.step
        });
      } else {
        log_warn(message.stepDropped(sizeChannel));
      }
    }
  }

  return makeImplicit(defaultRange(channel, model));
}

function parseScheme(scheme) {
  if (isExtendedScheme(scheme)) {
    return Object.assign({
      scheme: scheme.name
    }, omit(scheme, ['name']));
  }

  return {
    scheme: scheme
  };
}

function defaultRange(channel, model) {
  var size = model.size,
      config = model.config,
      mark = model.mark;
  var getSignalName = model.getSignalName.bind(model);

  var _model$fieldDef = model.fieldDef(channel),
      type = _model$fieldDef.type;

  var mergedScaleCmpt = model.getScaleComponent(channel);
  var scaleType = mergedScaleCmpt.get('type');
  var _model$specifiedScale = model.specifiedScales[channel],
      domain = _model$specifiedScale.domain,
      domainMid = _model$specifiedScale.domainMid;

  switch (channel) {
    case channel_X:
    case channel_Y:
      {
        // If there is no explicit width/height for discrete x/y scales
        if (util_contains(['point', 'band'], scaleType)) {
          if (channel === channel_X && !size.width) {
            var w = getViewConfigDiscreteSize(config.view, 'width');

            if (isStep(w)) {
              return w;
            }
          } else if (channel === channel_Y && !size.height) {
            var h = getViewConfigDiscreteSize(config.view, 'height');

            if (isStep(h)) {
              return h;
            }
          }
        } // If step is null, use zero to width or height.
        // Note that we use SignalRefWrapper to account for potential merges and renames.


        var sizeType = range_getSizeType(channel);
        var sizeSignal = model.getName(sizeType);

        if (channel === channel_Y && hasContinuousDomain(scaleType)) {
          // For y continuous scale, we have to start from the height as the bottom part has the max value.
          return [signal_SignalRefWrapper.fromName(getSignalName, sizeSignal), 0];
        } else {
          return [0, signal_SignalRefWrapper.fromName(getSignalName, sizeSignal)];
        }
      }

    case channel_SIZE:
      {
        // TODO: support custom rangeMin, rangeMax
        var zero = model.component.scales[channel].get('zero');
        var rangeMin = sizeRangeMin(mark, zero, config);
        var rangeMax = sizeRangeMax(mark, size, model, config);

        if (isContinuousToDiscrete(scaleType)) {
          return range_interpolateRange(rangeMin, rangeMax, defaultContinuousToDiscreteCount(scaleType, config, domain, channel));
        } else {
          return [rangeMin, rangeMax];
        }
      }

    case STROKEWIDTH:
      // TODO: support custom rangeMin, rangeMax
      return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth];

    case STROKEDASH:
      return [// TODO: add this to Vega's config.range?
      [1, 0], [4, 2], [2, 1], [1, 1], [1, 2, 4, 2]];

    case SHAPE:
      return 'symbol';

    case COLOR:
    case FILL:
    case STROKE:
      if (scaleType === 'ordinal') {
        // Only nominal data uses ordinal scale by default
        return type === 'nominal' ? 'category' : 'ordinal';
      } else {
        if (domainMid !== undefined) {
          return 'diverging';
        } else {
          return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp';
        }
      }

    case OPACITY:
    case FILLOPACITY:
    case STROKEOPACITY:
      // TODO: support custom rangeMin, rangeMax
      return [config.scale.minOpacity, config.scale.maxOpacity];
  }
  /* istanbul ignore next: should never reach here */


  throw new Error("Scale range undefined for channel ".concat(channel));
}

function defaultContinuousToDiscreteCount(scaleType, config, domain, channel) {
  switch (scaleType) {
    case 'quantile':
      return config.scale.quantileCount;

    case 'quantize':
      return config.scale.quantizeCount;

    case 'threshold':
      if (domain !== undefined && isArray(domain)) {
        return domain.length + 1;
      } else {
        log_warn(message.domainRequiredForThresholdScale(channel)); // default threshold boundaries for threshold scale since domain has cardinality of 2

        return 3;
      }

  }
}
/**
 * Returns the linear interpolation of the range according to the cardinality
 *
 * @param rangeMin start of the range
 * @param rangeMax end of the range
 * @param cardinality number of values in the output range
 */

function range_interpolateRange(rangeMin, rangeMax, cardinality) {
  // always return a signal since it's better to compute the sequence in Vega later
  var f = function f() {
    var rMax = isSignalRef(rangeMax) ? rangeMax.signal : rangeMax;
    var rMin = isSignalRef(rangeMin) ? rangeMin.signal : rangeMin;
    var step = "(".concat(rMax, " - ").concat(rMin, ") / (").concat(cardinality, " - 1)");
    return "sequence(".concat(rMin, ", ").concat(rMax, " + ").concat(step, ", ").concat(step, ")");
  };

  if (isSignalRef(rangeMax)) {
    return new signal_SignalRefWrapper(f);
  } else {
    return {
      signal: f()
    };
  }
}

function sizeRangeMin(mark, zero, config) {
  if (zero) {
    if (isSignalRef(zero)) {
      return {
        signal: "".concat(zero.signal, " ? 0 : ").concat(sizeRangeMin(mark, false, config))
      };
    } else {
      return 0;
    }
  }

  switch (mark) {
    case 'bar':
    case 'tick':
      return config.scale.minBandSize;

    case 'line':
    case 'trail':
    case 'rule':
      return config.scale.minStrokeWidth;

    case 'text':
      return config.scale.minFontSize;

    case 'point':
    case 'square':
    case 'circle':
      return config.scale.minSize;
  }
  /* istanbul ignore next: should never reach here */
  // sizeRangeMin not implemented for the mark


  throw new Error(message.incompatibleChannel('size', mark));
}

var MAX_SIZE_RANGE_STEP_RATIO = 0.95;

function sizeRangeMax(mark, size, model, config) {
  var xyStepSignals = {
    x: getBinStepSignal(model, 'x'),
    y: getBinStepSignal(model, 'y')
  };

  switch (mark) {
    case 'bar':
    case 'tick':
      {
        if (config.scale.maxBandSize !== undefined) {
          return config.scale.maxBandSize;
        }

        var min = minXYStep(size, xyStepSignals, config.view);

        if (isNumber(min)) {
          return min - 1;
        } else {
          return new signal_SignalRefWrapper(function () {
            return "".concat(min.signal, " - 1");
          });
        }
      }

    case 'line':
    case 'trail':
    case 'rule':
      return config.scale.maxStrokeWidth;

    case 'text':
      return config.scale.maxFontSize;

    case 'point':
    case 'square':
    case 'circle':
      {
        if (config.scale.maxSize) {
          return config.scale.maxSize;
        }

        var pointStep = minXYStep(size, xyStepSignals, config.view);

        if (isNumber(pointStep)) {
          return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2);
        } else {
          return new signal_SignalRefWrapper(function () {
            return "pow(".concat(MAX_SIZE_RANGE_STEP_RATIO, " * ").concat(pointStep.signal, ", 2)");
          });
        }
      }
  }
  /* istanbul ignore next: should never reach here */
  // sizeRangeMax not implemented for the mark


  throw new Error(message.incompatibleChannel('size', mark));
}
/**
 * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale.
 */


function minXYStep(size, xyStepSignals, viewConfig) {
  var widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width');
  var heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height');

  if (xyStepSignals.x || xyStepSignals.y) {
    return new signal_SignalRefWrapper(function () {
      var exprs = [xyStepSignals.x ? xyStepSignals.x.signal : widthStep, xyStepSignals.y ? xyStepSignals.y.signal : heightStep];
      return "min(".concat(exprs.join(', '), ")");
    });
  }

  return Math.min(widthStep, heightStep);
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/scale/properties.js

















function parseScaleProperty(model, property) {
  if (isUnitModel(model)) {
    parseUnitScaleProperty(model, property);
  } else {
    parseNonUnitScaleProperty(model, property);
  }
}

function parseUnitScaleProperty(model, property) {
  var localScaleComponents = model.component.scales;
  util_keys(localScaleComponents).forEach(function (channel) {
    var specifiedScale = model.specifiedScales[channel];
    var localScaleCmpt = localScaleComponents[channel];
    var mergedScaleCmpt = model.getScaleComponent(channel);
    var fieldDef = model.fieldDef(channel);
    var config = model.config;
    var specifiedValue = specifiedScale[property];
    var sType = mergedScaleCmpt.get('type');
    var supportedByScaleType = scaleTypeSupportProperty(sType, property);
    var channelIncompatability = channelScalePropertyIncompatability(channel, property);

    if (specifiedValue !== undefined) {
      // If there is a specified value, check if it is compatible with scale type and channel
      if (!supportedByScaleType) {
        log_warn(message.scalePropertyNotWorkWithScaleType(sType, property, channel));
      } else if (channelIncompatability) {
        // channel
        log_warn(channelIncompatability);
      }
    }

    if (supportedByScaleType && channelIncompatability === undefined) {
      if (specifiedValue !== undefined) {
        // copyKeyFromObject ensures type safety
        localScaleCmpt.copyKeyFromObject(property, specifiedScale);
      } else {
        var value = getDefaultValue(property, model, channel, fieldDef, mergedScaleCmpt.get('type'), mergedScaleCmpt.get('padding'), mergedScaleCmpt.get('paddingInner'), specifiedScale.domain, model.markDef, config);

        if (value !== undefined) {
          localScaleCmpt.set(property, value, false);
        }
      }
    }
  });
} // Note: This method is used in Voyager.


function getDefaultValue(property, model, channel, fieldDef, scaleType, scalePadding, scalePaddingInner, specifiedDomain, markDef, config) {
  var scaleConfig = config.scale;
  var type = fieldDef.type,
      sort = fieldDef.sort; // If we have default rule-base, determine default value first

  switch (property) {
    case 'bins':
      return properties_bins(model, fieldDef);

    case 'interpolate':
      return properties_interpolate(channel, type);

    case 'nice':
      return properties_nice(scaleType, channel, fieldDef);

    case 'padding':
      return properties_padding(channel, scaleType, scaleConfig, fieldDef, markDef, config.bar);

    case 'paddingInner':
      return properties_paddingInner(scalePadding, channel, markDef.type, scaleConfig);

    case 'paddingOuter':
      return properties_paddingOuter(scalePadding, channel, scaleType, markDef.type, scalePaddingInner, scaleConfig);

    case 'reverse':
      return properties_reverse(scaleType, sort, channel, scaleConfig);

    case 'zero':
      return properties_zero(channel, fieldDef, specifiedDomain, markDef, scaleType);
  } // Otherwise, use scale config


  return scaleConfig[property];
} // This method is here rather than in range.ts to avoid circular dependency.

function properties_parseScaleRange(model) {
  if (isUnitModel(model)) {
    parseUnitScaleRange(model);
  } else {
    parseNonUnitScaleProperty(model, 'range');
  }
}
function parseNonUnitScaleProperty(model, property) {
  var localScaleComponents = model.component.scales;

  var _iterator = _createForOfIteratorHelper(model.children),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var child = _step.value;

      if (property === 'range') {
        properties_parseScaleRange(child);
      } else {
        parseScaleProperty(child, property);
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  util_keys(localScaleComponents).forEach(function (channel) {
    var valueWithExplicit;

    var _iterator2 = _createForOfIteratorHelper(model.children),
        _step2;

    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var child = _step2.value;
        var childComponent = child.component.scales[channel];

        if (childComponent) {
          var childValueWithExplicit = childComponent.getWithExplicit(property);
          valueWithExplicit = mergeValuesWithExplicit(valueWithExplicit, childValueWithExplicit, property, 'scale', tieBreakByComparing(function (v1, v2) {
            switch (property) {
              case 'range':
                // For step, prefer larger step
                if (v1.step && v2.step) {
                  return v1.step - v2.step;
                }

                return 0;
              // TODO: precedence rule for other properties
            }

            return 0;
          }));
        }
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }

    localScaleComponents[channel].setWithExplicit(property, valueWithExplicit);
  });
}
function properties_bins(model, fieldDef) {
  var bin = fieldDef.bin;

  if (isBinning(bin)) {
    var binSignal = getBinSignalName(model, fieldDef.field, bin);
    return new signal_SignalRefWrapper(function () {
      return model.getSignalName(binSignal);
    });
  } else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) {
    // start and stop will be determined from the scale domain
    return {
      step: bin.step
    };
  }

  return undefined;
}
function properties_interpolate(channel, type) {
  if (util_contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') {
    return 'hcl';
  }

  return undefined;
}
function properties_nice(scaleType, channel, fieldDef) {
  if (fieldDef.bin || util_contains([ScaleType.TIME, ScaleType.UTC], scaleType)) {
    return undefined;
  }

  return util_contains([channel_X, channel_Y], channel) ? true : undefined;
}
function properties_padding(channel, scaleType, scaleConfig, fieldDef, markDef, barConfig) {
  if (util_contains([channel_X, channel_Y], channel)) {
    if (isContinuousToContinuous(scaleType)) {
      if (scaleConfig.continuousPadding !== undefined) {
        return scaleConfig.continuousPadding;
      }

      var type = markDef.type,
          orient = markDef.orient;

      if (type === 'bar' && !fieldDef.bin && !fieldDef.timeUnit) {
        if (orient === 'vertical' && channel === 'x' || orient === 'horizontal' && channel === 'y') {
          return barConfig.continuousBandSize;
        }
      }
    }

    if (scaleType === ScaleType.POINT) {
      return scaleConfig.pointPadding;
    }
  }

  return undefined;
}
function properties_paddingInner(paddingValue, channel, mark, scaleConfig) {
  if (paddingValue !== undefined) {
    // If user has already manually specified "padding", no need to add default paddingInner.
    return undefined;
  }

  if (util_contains([channel_X, channel_Y], channel)) {
    // Padding is only set for X and Y by default.
    // Basically it doesn't make sense to add padding for color and size.
    // paddingOuter would only be called if it's a band scale, just return the default for bandScale.
    var bandPaddingInner = scaleConfig.bandPaddingInner,
        barBandPaddingInner = scaleConfig.barBandPaddingInner,
        rectBandPaddingInner = scaleConfig.rectBandPaddingInner;
    return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner);
  }

  return undefined;
}
function properties_paddingOuter(paddingValue, channel, scaleType, mark, paddingInnerValue, scaleConfig) {
  if (paddingValue !== undefined) {
    // If user has already manually specified "padding", no need to add default paddingOuter.
    return undefined;
  }

  if (util_contains([channel_X, channel_Y], channel)) {
    // Padding is only set for X and Y by default.
    // Basically it doesn't make sense to add padding for color and size.
    if (scaleType === ScaleType.BAND) {
      var bandPaddingOuter = scaleConfig.bandPaddingOuter;
      return getFirstDefined(bandPaddingOuter,
      /* By default, paddingOuter is paddingInner / 2. The reason is that
        size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter).
        and we want the width/height to be integer by default.
        Note that step (by default) and cardinality are integers.) */
      isSignalRef(paddingInnerValue) ? {
        signal: "".concat(paddingInnerValue.signal, "/2")
      } : paddingInnerValue / 2);
    }
  }

  return undefined;
}
function properties_reverse(scaleType, sort, channel, scaleConfig) {
  var isDescendingSort = hasContinuousDomain(scaleType) && sort === 'descending';

  if (channel === 'x' && scaleConfig.xReverse !== undefined) {
    if (isDescendingSort) {
      if (isSignalRef(scaleConfig.xReverse)) {
        return {
          signal: "!".concat(scaleConfig.xReverse.signal)
        };
      } else {
        return !scaleConfig.xReverse;
      }
    }

    return scaleConfig.xReverse;
  }

  if (isDescendingSort) {
    // For continuous domain scales, Vega does not support domain sort.
    // Thus, we reverse range instead if sort is descending
    return true;
  }

  return undefined;
}
function properties_zero(channel, fieldDef, specifiedDomain, markDef, scaleType) {
  // If users explicitly provide a domain range, we should not augment zero as that will be unexpected.
  var hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated';

  if (hasCustomDomain) {
    if (hasContinuousDomain(scaleType)) {
      if (isArray(specifiedDomain)) {
        var first = specifiedDomain[0];
        var last = specifiedDomain[specifiedDomain.length - 1];

        if (first <= 0 && last >= 0) {
          // if the domain includes zero, make zero remains true
          return true;
        }
      }

      return false;
    }
  } // If there is no custom domain, return true only for the following cases:
  // 1) using quantitative field with size
  // While this can be either ratio or interval fields, our assumption is that
  // ratio are more common. However, if the scaleType is discretizing scale, we want to return
  // false so that range doesn't start at zero


  if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) {
    return true;
  } // 2) non-binned, quantitative x-scale or y-scale
  // (For binning, we should not include zero by default because binning are calculated without zero.)


  if (!fieldDef.bin && util_contains([channel_X, channel_Y], channel)) {
    var orient = markDef.orient,
        type = markDef.type;

    if (util_contains(['bar', 'area', 'line', 'trail'], type)) {
      if (orient === 'horizontal' && channel === 'y' || orient === 'vertical' && channel === 'x') {
        return false;
      }
    }

    return true;
  }

  return false;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/scale/type.js






/**
 * Determine if there is a specified scale type and if it is appropriate,
 * or determine default type if type is unspecified or inappropriate.
 */
// NOTE: CompassQL uses this method.

function type_scaleType(specifiedScale, channel, fieldDef, mark) {
  var defaultScaleType = type_defaultType(channel, fieldDef, mark);
  var type = specifiedScale.type;

  if (!isScaleChannel(channel)) {
    // There is no scale for these channels
    return null;
  }

  if (type !== undefined) {
    // Check if explicitly specified scale type is supported by the channel
    if (!channelSupportScaleType(channel, type)) {
      log_warn(message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType));
      return defaultScaleType;
    } // Check if explicitly specified scale type is supported by the data type


    if (!scaleTypeSupportDataType(type, fieldDef.type)) {
      log_warn(message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType));
      return defaultScaleType;
    }

    return type;
  }

  return defaultScaleType;
}
/**
 * Determine appropriate default scale type.
 */
// NOTE: Voyager uses this method.

function type_defaultType(channel, fieldDef, mark) {
  switch (fieldDef.type) {
    case 'nominal':
    case 'ordinal':
      if (isColorChannel(channel) || rangeType(channel) === 'discrete') {
        if (channel === 'shape' && fieldDef.type === 'ordinal') {
          log_warn(message.discreteChannelCannotEncode(channel, 'ordinal'));
        }

        return 'ordinal';
      }

      if (util_contains(['x', 'y'], channel)) {
        if (util_contains(['rect', 'bar', 'image', 'rule'], mark)) {
          // The rect/bar mark should fit into a band.
          // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429
          return 'band';
        }
      } // Otherwise, use ordinal point scale so we can easily get center positions of the marks.


      return 'point';

    case 'temporal':
      if (isColorChannel(channel)) {
        return 'time';
      } else if (rangeType(channel) === 'discrete') {
        log_warn(message.discreteChannelCannotEncode(channel, 'temporal')); // TODO: consider using quantize (equivalent to binning) once we have it

        return 'ordinal';
      } else if (fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) {
        return 'utc';
      }

      return 'time';

    case 'quantitative':
      if (isColorChannel(channel)) {
        if (isBinning(fieldDef.bin)) {
          return 'bin-ordinal';
        }

        return 'linear';
      } else if (rangeType(channel) === 'discrete') {
        log_warn(message.discreteChannelCannotEncode(channel, 'quantitative')); // TODO: consider using quantize (equivalent to binning) once we have it

        return 'ordinal';
      }

      return 'linear';

    case 'geojson':
      return undefined;
  }
  /* istanbul ignore next: should never reach this */


  throw new Error(message.invalidFieldType(fieldDef.type));
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/scale/parse.js

















function parseScales(model) {
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      ignoreRange = _ref.ignoreRange;

  parseScaleCore(model);
  domain_parseScaleDomain(model);

  var _iterator = _createForOfIteratorHelper(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var prop = _step.value;
      parseScaleProperty(model, prop);
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  if (!ignoreRange) {
    // range depends on zero
    properties_parseScaleRange(model);
  }
}
function parseScaleCore(model) {
  if (isUnitModel(model)) {
    model.component.scales = parseUnitScaleCore(model);
  } else {
    model.component.scales = parseNonUnitScaleCore(model);
  }
}
/**
 * Parse scales for all channels of a model.
 */

function parseUnitScaleCore(model) {
  var encoding = model.encoding,
      mark = model.mark;
  return SCALE_CHANNELS.reduce(function (scaleComponents, channel) {
    var fieldDef;
    var specifiedScale;
    var channelDef = encoding[channel]; // Don't generate scale for shape of geoshape

    if (isFieldDef(channelDef) && mark === GEOSHAPE && channel === SHAPE && channelDef.type === GEOJSON) {
      return scaleComponents;
    }

    if (isFieldDef(channelDef)) {
      fieldDef = channelDef;
      specifiedScale = channelDef.scale;
    } else if (hasConditionalFieldDef(channelDef)) {
      // Need to specify generic for hasConditionalFieldDef as the value type can vary across channels
      fieldDef = channelDef.condition;
      specifiedScale = channelDef.condition['scale']; // We use ['scale'] since we know that channel here has scale for sure
    }

    if (fieldDef && specifiedScale !== null && specifiedScale !== false) {
      specifiedScale = specifiedScale !== null && specifiedScale !== void 0 ? specifiedScale : {};
      var sType = type_scaleType(specifiedScale, channel, fieldDef, mark);
      scaleComponents[channel] = new component_ScaleComponent(model.scaleName(channel + '', true), {
        value: sType,
        explicit: specifiedScale.type === sType
      });
    }

    return scaleComponents;
  }, {});
}

var scaleTypeTieBreaker = tieBreakByComparing(function (st1, st2) {
  return scaleTypePrecedence(st1) - scaleTypePrecedence(st2);
});

function parseNonUnitScaleCore(model) {
  var scaleComponents = model.component.scales = {};
  var scaleTypeWithExplicitIndex = {};
  var resolve = model.component.resolve; // Parse each child scale and determine if a particular channel can be merged.

  var _iterator2 = _createForOfIteratorHelper(model.children),
      _step2;

  try {
    var _loop = function _loop() {
      var child = _step2.value;
      parseScaleCore(child); // Instead of always merging right away -- check if it is compatible to merge first!

      util_keys(child.component.scales).forEach(function (channel) {
        var _a; // if resolve is undefined, set default first


        resolve.scale[channel] = (_a = resolve.scale[channel]) !== null && _a !== void 0 ? _a : defaultScaleResolve(channel, model);

        if (resolve.scale[channel] === 'shared') {
          var explicitScaleType = scaleTypeWithExplicitIndex[channel];
          var childScaleType = child.component.scales[channel].getWithExplicit('type');

          if (explicitScaleType) {
            if (scaleCompatible(explicitScaleType.value, childScaleType.value)) {
              // merge scale component if type are compatible
              scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(explicitScaleType, childScaleType, 'type', 'scale', scaleTypeTieBreaker);
            } else {
              // Otherwise, update conflicting channel to be independent
              resolve.scale[channel] = 'independent'; // Remove from the index so they don't get merged

              delete scaleTypeWithExplicitIndex[channel];
            }
          } else {
            scaleTypeWithExplicitIndex[channel] = childScaleType;
          }
        }
      });
    };

    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      _loop();
    } // Merge each channel listed in the index

  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }

  var _iterator3 = _createForOfIteratorHelper(util_keys(scaleTypeWithExplicitIndex)),
      _step3;

  try {
    for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
      var channel = _step3.value;
      // Create new merged scale component
      var name = model.scaleName(channel, true);
      var typeWithExplicit = scaleTypeWithExplicitIndex[channel];
      scaleComponents[channel] = new component_ScaleComponent(name, typeWithExplicit); // rename each child and mark them as merged

      var _iterator4 = _createForOfIteratorHelper(model.children),
          _step4;

      try {
        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
          var child = _step4.value;
          var childScale = child.component.scales[channel];

          if (childScale) {
            child.renameScale(childScale.get('name'), name);
            childScale.merged = true;
          }
        }
      } catch (err) {
        _iterator4.e(err);
      } finally {
        _iterator4.f();
      }
    }
  } catch (err) {
    _iterator3.e(err);
  } finally {
    _iterator3.f();
  }

  return scaleComponents;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/model.js





































var model_NameMap = /*#__PURE__*/function () {
  function NameMap() {
    _classCallCheck(this, NameMap);

    this.nameMap = {};
  }

  _createClass(NameMap, [{
    key: "rename",
    value: function rename(oldName, newName) {
      this.nameMap[oldName] = newName;
    }
  }, {
    key: "has",
    value: function has(name) {
      return this.nameMap[name] !== undefined;
    }
  }, {
    key: "get",
    value: function get(name) {
      // If the name appears in the _nameMap, we need to read its new name.
      // We have to loop over the dict just in case the new name also gets renamed.
      while (this.nameMap[name] && name !== this.nameMap[name]) {
        name = this.nameMap[name];
      }

      return name;
    }
  }]);

  return NameMap;
}();
/*
  We use type guards instead of `instanceof` as `instanceof` makes
  different parts of the compiler depend on the actual implementation of
  the model classes, which in turn depend on different parts of the compiler.
  Thus, `instanceof` leads to circular dependency problems.

  On the other hand, type guards only make different parts of the compiler
  depend on the type of the model classes, but not the actual implementation.
*/

function isUnitModel(model) {
  return (model === null || model === void 0 ? void 0 : model.type) === 'unit';
}
function isFacetModel(model) {
  return (model === null || model === void 0 ? void 0 : model.type) === 'facet';
}
function isConcatModel(model) {
  return (model === null || model === void 0 ? void 0 : model.type) === 'concat';
}
function isLayerModel(model) {
  return (model === null || model === void 0 ? void 0 : model.type) === 'layer';
}
var model_Model = /*#__PURE__*/function () {
  function Model(spec, type, parent, parentGivenName, config, resolve, view) {
    var _this = this;

    _classCallCheck(this, Model);

    var _a, _b;

    this.type = type;
    this.parent = parent;
    this.config = config;
    this.view = view;
    this.children = [];
    /**
     * Corrects the data references in marks after assemble.
     */

    this.correctDataNames = function (mark) {
      // TODO: make this correct
      // for normal data references
      if (mark.from && mark.from.data) {
        mark.from.data = _this.lookupDataSource(mark.from.data);
      } // for access to facet data


      if (mark.from && mark.from.facet && mark.from.facet.data) {
        mark.from.facet.data = _this.lookupDataSource(mark.from.facet.data);
      }

      return mark;
    };

    this.parent = parent;
    this.config = config; // If name is not provided, always use parent's givenName to avoid name conflicts.

    this.name = (_a = spec.name) !== null && _a !== void 0 ? _a : parentGivenName;
    this.title = isText(spec.title) ? {
      text: spec.title
    } : spec.title; // Shared name maps

    this.scaleNameMap = parent ? parent.scaleNameMap : new model_NameMap();
    this.projectionNameMap = parent ? parent.projectionNameMap : new model_NameMap();
    this.signalNameMap = parent ? parent.signalNameMap : new model_NameMap();
    this.data = spec.data;
    this.description = spec.description;
    this.transforms = normalizeTransform((_b = spec.transform) !== null && _b !== void 0 ? _b : []);
    this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config);
    this.component = {
      data: {
        sources: parent ? parent.component.data.sources : [],
        outputNodes: parent ? parent.component.data.outputNodes : {},
        outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {},
        // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined
        isFaceted: isFacetSpec(spec) || parent && parent.component.data.isFaceted && spec.data === undefined
      },
      layoutSize: new split_Split(),
      layoutHeaders: {
        row: {},
        column: {},
        facet: {}
      },
      mark: null,
      resolve: Object.assign({
        scale: {},
        axis: {},
        legend: {}
      }, resolve ? duplicate(resolve) : {}),
      selection: null,
      scales: null,
      projection: null,
      axes: {},
      legends: {}
    };
  }

  _createClass(Model, [{
    key: "width",
    get: function get() {
      return this.getSizeSignalRef('width');
    }
  }, {
    key: "height",
    get: function get() {
      return this.getSizeSignalRef('height');
    }
  }, {
    key: "parse",
    value: function parse() {
      this.parseScale();
      this.parseLayoutSize(); // depends on scale

      this.renameTopLevelLayoutSizeSignal();
      this.parseSelections();
      this.parseProjection();
      this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name.

      this.parseAxesAndHeaders(); // depends on scale and layout size

      this.parseLegends(); // depends on scale, markDef

      this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark.
    }
  }, {
    key: "parseScale",
    value: function parseScale() {
      parseScales(this);
    }
  }, {
    key: "parseProjection",
    value: function parseProjection() {
      parse_parseProjection(this);
    }
    /**
     * Rename top-level spec's size to be just width / height, ignoring model name.
     * This essentially merges the top-level spec's width/height signals with the width/height signals
     * to help us reduce redundant signals declaration.
     */

  }, {
    key: "renameTopLevelLayoutSizeSignal",
    value: function renameTopLevelLayoutSizeSignal() {
      if (this.getName('width') !== 'width') {
        this.renameSignal(this.getName('width'), 'width');
      }

      if (this.getName('height') !== 'height') {
        this.renameSignal(this.getName('height'), 'height');
      }
    }
  }, {
    key: "parseLegends",
    value: function parseLegends() {
      parse_parseLegend(this);
    }
  }, {
    key: "assembleGroupStyle",
    value: function assembleGroupStyle() {
      var _a, _b;

      if (this.type === 'unit' || this.type === 'layer') {
        return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : 'cell';
      }

      return undefined;
    }
  }, {
    key: "assembleEncodeFromView",
    value: function assembleEncodeFromView(view) {
      // Exclude "style"
      var _ = view.style,
          baseView = __rest(view, ["style"]);

      var e = {};

      var _iterator = _createForOfIteratorHelper(util_keys(baseView)),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var property = _step.value;
          var value = baseView[property];

          if (value !== undefined) {
            e[property] = signalOrValueRef(value);
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      return e;
    }
  }, {
    key: "assembleGroupEncodeEntry",
    value: function assembleGroupEncodeEntry(isTopLevel) {
      var encodeEntry = undefined;

      if (this.view) {
        encodeEntry = this.assembleEncodeFromView(this.view);
      }

      if (!isTopLevel) {
        // For top-level spec, we can set the global width and height signal to adjust the group size.
        // For other child specs, we have to manually set width and height in the encode entry.
        if (this.type === 'unit' || this.type === 'layer') {
          return Object.assign({
            width: this.getSizeSignalRef('width'),
            height: this.getSizeSignalRef('height')
          }, encodeEntry !== null && encodeEntry !== void 0 ? encodeEntry : {});
        }
      }

      return encodeEntry;
    }
  }, {
    key: "assembleLayout",
    value: function assembleLayout() {
      if (!this.layout) {
        return undefined;
      }

      var _a = this.layout,
          spacing = _a.spacing,
          layout = __rest(_a, ["spacing"]);

      var component = this.component,
          config = this.config;
      var titleBand = assembleLayoutTitleBand(component.layoutHeaders, config);
      return Object.assign(Object.assign(Object.assign({
        padding: spacing
      }, this.assembleDefaultLayout()), layout), titleBand ? {
        titleBand: titleBand
      } : {});
    }
  }, {
    key: "assembleDefaultLayout",
    value: function assembleDefaultLayout() {
      return {};
    }
  }, {
    key: "assembleHeaderMarks",
    value: function assembleHeaderMarks() {
      var layoutHeaders = this.component.layoutHeaders;
      var headerMarks = [];

      var _iterator2 = _createForOfIteratorHelper(FACET_CHANNELS),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var channel = _step2.value;

          if (layoutHeaders[channel].title) {
            headerMarks.push(assembleTitleGroup(this, channel));
          }
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }

      var _iterator3 = _createForOfIteratorHelper(HEADER_CHANNELS),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var _channel = _step3.value;
          headerMarks = headerMarks.concat(assembleHeaderGroups(this, _channel));
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }

      return headerMarks;
    }
  }, {
    key: "assembleAxes",
    value: function assembleAxes() {
      return assemble_assembleAxes(this.component.axes, this.config);
    }
  }, {
    key: "assembleLegends",
    value: function assembleLegends() {
      return assemble_assembleLegends(this);
    }
  }, {
    key: "assembleProjections",
    value: function assembleProjections() {
      return assemble_assembleProjections(this);
    }
  }, {
    key: "assembleTitle",
    value: function assembleTitle() {
      var _a, _b, _c;

      var _d = (_a = this.title) !== null && _a !== void 0 ? _a : {},
          encoding = _d.encoding,
          titleNoEncoding = __rest(_d, ["encoding"]);

      var title = Object.assign(Object.assign(Object.assign({}, extractTitleConfig(this.config.title).nonMark), titleNoEncoding), encoding ? {
        encode: {
          update: encoding
        }
      } : {});

      if (title.text) {
        if (util_contains(['unit', 'layer'], this.type)) {
          // Unit/Layer
          if (util_contains(['middle', undefined], title.anchor)) {
            title.frame = (_b = title.frame) !== null && _b !== void 0 ? _b : 'group';
          }
        } else {
          // composition with Vega layout
          // Set title = "start" by default for composition as "middle" does not look nice
          // https://github.com/vega/vega/issues/960#issuecomment-471360328
          title.anchor = (_c = title.anchor) !== null && _c !== void 0 ? _c : 'start';
        }

        return util_keys(title).length > 0 ? title : undefined;
      }

      return undefined;
    }
    /**
     * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals.
     */

  }, {
    key: "assembleGroup",
    value: function assembleGroup() {
      var signals = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      var group = {};
      signals = signals.concat(this.assembleSignals());

      if (signals.length > 0) {
        group.signals = signals;
      }

      var layout = this.assembleLayout();

      if (layout) {
        group.layout = layout;
      }

      group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks()); // Only include scales if this spec is top-level or if parent is facet.
      // (Otherwise, it will be merged with upper-level's scope.)

      var scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : [];

      if (scales.length > 0) {
        group.scales = scales;
      }

      var axes = this.assembleAxes();

      if (axes.length > 0) {
        group.axes = axes;
      }

      var legends = this.assembleLegends();

      if (legends.length > 0) {
        group.legends = legends;
      }

      return group;
    }
  }, {
    key: "getName",
    value: function getName(text) {
      return varName((this.name ? this.name + '_' : '') + text);
    }
    /**
     * Request a data source name for the given data source type and mark that data source as required.
     * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData().
     * You can lookup the correct dataset name in assemble with `lookupDataSource`.
     */

  }, {
    key: "requestDataName",
    value: function requestDataName(name) {
      var _a;

      var fullName = this.getName(name); // Increase ref count. This is critical because otherwise we won't create a data source.
      // We also increase the ref counts on OutputNode.getSource() calls.

      var refCounts = this.component.data.outputNodeRefCounts;
      refCounts[fullName] = ((_a = refCounts[fullName]) !== null && _a !== void 0 ? _a : 0) + 1;
      return fullName;
    }
  }, {
    key: "getSizeSignalRef",
    value: function getSizeSignalRef(layoutSizeType) {
      if (isFacetModel(this.parent)) {
        var sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);
        var channel = getPositionScaleChannel(sizeType);
        var scaleComponent = this.component.scales[channel];

        if (scaleComponent && !scaleComponent.merged) {
          // independent scale
          var type = scaleComponent.get('type');
          var range = scaleComponent.get('range');

          if (hasDiscreteDomain(type) && isVgRangeStep(range)) {
            var scaleName = scaleComponent.get('name');
            var domain = assembleDomain(this, channel);
            var field = getFieldFromDomain(domain);

            if (field) {
              var fieldRef = channeldef_vgField({
                aggregate: 'distinct',
                field: field
              }, {
                expr: 'datum'
              });

              return {
                signal: sizeExpr(scaleName, scaleComponent, fieldRef)
              };
            } else {
              log_warn("Unknown field for ".concat(channel, ". Cannot calculate view size."));
              return null;
            }
          }
        }
      }

      return {
        signal: this.signalNameMap.get(this.getName(layoutSizeType))
      };
    }
    /**
     * Lookup the name of the datasource for an output node. You probably want to call this in assemble.
     */

  }, {
    key: "lookupDataSource",
    value: function lookupDataSource(name) {
      var node = this.component.data.outputNodes[name];

      if (!node) {
        // Name not found in map so let's just return what we got.
        // This can happen if we already have the correct name.
        return name;
      }

      return node.getSource();
    }
  }, {
    key: "getSignalName",
    value: function getSignalName(oldSignalName) {
      return this.signalNameMap.get(oldSignalName);
    }
  }, {
    key: "renameSignal",
    value: function renameSignal(oldName, newName) {
      this.signalNameMap.rename(oldName, newName);
    }
  }, {
    key: "renameScale",
    value: function renameScale(oldName, newName) {
      this.scaleNameMap.rename(oldName, newName);
    }
  }, {
    key: "renameProjection",
    value: function renameProjection(oldName, newName) {
      this.projectionNameMap.rename(oldName, newName);
    }
    /**
     * @return scale name for a given channel after the scale has been parsed and named.
     */

  }, {
    key: "scaleName",
    value: function scaleName(originalScaleName, parse) {
      if (parse) {
        // During the parse phase always return a value
        // No need to refer to rename map because a scale can't be renamed
        // before it has the original name.
        return this.getName(originalScaleName);
      } // If there is a scale for the channel, it should either
      // be in the scale component or exist in the name map


      if ( // If there is a scale for the channel, there should be a local scale component for it
      isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName] || // in the scale name map (the scale get merged by its parent)
      this.scaleNameMap.has(this.getName(originalScaleName))) {
        return this.scaleNameMap.get(this.getName(originalScaleName));
      }

      return undefined;
    }
    /**
     * @return projection name after the projection has been parsed and named.
     */

  }, {
    key: "projectionName",
    value: function projectionName(parse) {
      if (parse) {
        // During the parse phase always return a value
        // No need to refer to rename map because a projection can't be renamed
        // before it has the original name.
        return this.getName('projection');
      }

      if (this.component.projection && !this.component.projection.merged || this.projectionNameMap.has(this.getName('projection'))) {
        return this.projectionNameMap.get(this.getName('projection'));
      }

      return undefined;
    }
    /**
     * Traverse a model's hierarchy to get the scale component for a particular channel.
     */

  }, {
    key: "getScaleComponent",
    value: function getScaleComponent(channel) {
      /* istanbul ignore next: This is warning for debugging test */
      if (!this.component.scales) {
        throw new Error('getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().');
      }

      var localScaleComponent = this.component.scales[channel];

      if (localScaleComponent && !localScaleComponent.merged) {
        return localScaleComponent;
      }

      return this.parent ? this.parent.getScaleComponent(channel) : undefined;
    }
    /**
     * Traverse a model's hierarchy to get a particular selection component.
     */

  }, {
    key: "getSelectionComponent",
    value: function getSelectionComponent(variableName, origName) {
      var sel = this.component.selection[variableName];

      if (!sel && this.parent) {
        sel = this.parent.getSelectionComponent(variableName, origName);
      }

      if (!sel) {
        throw new Error(message.selectionNotFound(origName));
      }

      return sel;
    }
  }]);

  return Model;
}();
/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */

var model_ModelWithField = /*#__PURE__*/function (_Model) {
  _inherits(ModelWithField, _Model);

  var _super = _createSuper(ModelWithField);

  function ModelWithField() {
    _classCallCheck(this, ModelWithField);

    return _super.apply(this, arguments);
  }

  _createClass(ModelWithField, [{
    key: "vgField",
    value:
    /** Get "field" reference for Vega */
    function vgField(channel) {
      var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var fieldDef = this.fieldDef(channel);

      if (!fieldDef) {
        return undefined;
      }

      return channeldef_vgField(fieldDef, opt);
    }
  }, {
    key: "reduceFieldDef",
    value: function reduceFieldDef(f, init) {
      return encoding_reduce(this.getMapping(), function (acc, cd, c) {
        var fieldDef = getFieldDef(cd);

        if (fieldDef) {
          return f(acc, fieldDef, c);
        }

        return acc;
      }, init);
    }
  }, {
    key: "forEachFieldDef",
    value: function forEachFieldDef(f, t) {
      forEach(this.getMapping(), function (cd, c) {
        var fieldDef = getFieldDef(cd);

        if (fieldDef) {
          f(fieldDef, c);
        }
      }, t);
    }
  }]);

  return ModelWithField;
}(model_Model);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/density.js















/**
 * A class for density transform nodes
 */

var density_DensityTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(DensityTransformNode, _DataFlowNode);

  var _super = _createSuper(DensityTransformNode);

  function DensityTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, DensityTransformNode);

    var _a, _b, _c;

    _this = _super.call(this, parent);
    _this.transform = transform;
    _this.transform = duplicate(transform); // duplicate to prevent side effects

    var specifiedAs = (_a = _this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined];
    _this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'value', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'density'];
    return _this;
  }

  _createClass(DensityTransformNode, [{
    key: "clone",
    value: function clone() {
      return new DensityTransformNode(null, duplicate(this.transform));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var _a;

      return new Set([this.transform.density].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.transform.as);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "DensityTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _a = this.transform,
          density = _a.density,
          rest = __rest(_a, ["density"]);

      var result = Object.assign({
        type: 'kde',
        field: density
      }, rest);
      return result;
    }
  }]);

  return DensityTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/filterinvalid.js





















var filterinvalid_FilterInvalidNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(FilterInvalidNode, _DataFlowNode);

  var _super = _createSuper(FilterInvalidNode);

  function FilterInvalidNode(parent, filter) {
    var _this;

    _classCallCheck(this, FilterInvalidNode);

    _this = _super.call(this, parent);
    _this.filter = filter;
    return _this;
  }

  _createClass(FilterInvalidNode, [{
    key: "clone",
    value: function clone() {
      return new FilterInvalidNode(null, Object.assign({}, this.filter));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set(util_keys(this.filter));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(); // filter does not produce any new fields
    }
  }, {
    key: "hash",
    value: function hash() {
      return "FilterInvalid ".concat(util_hash(this.filter));
    }
    /**
     * Create the VgTransforms for each of the filtered fields.
     */

  }, {
    key: "assemble",
    value: function assemble() {
      var _this2 = this;

      var filters = util_keys(this.filter).reduce(function (vegaFilters, field) {
        var fieldDef = _this2.filter[field];
        var ref = channeldef_vgField(fieldDef, {
          expr: 'datum'
        });

        if (fieldDef !== null) {
          if (fieldDef.type === 'temporal') {
            vegaFilters.push("(isDate(".concat(ref, ") || (isValid(").concat(ref, ") && isFinite(+").concat(ref, ")))"));
          } else if (fieldDef.type === 'quantitative') {
            vegaFilters.push("isValid(".concat(ref, ")"));
            vegaFilters.push("isFinite(+".concat(ref, ")"));
          } else {// should never get here
          }
        }

        return vegaFilters;
      }, []);
      return filters.length > 0 ? {
        type: 'filter',
        expr: filters.join(' && ')
      } : null;
    }
  }], [{
    key: "make",
    value: function make(parent, model) {
      var config = model.config,
          mark = model.mark,
          markDef = model.markDef;
      var invalid = getMarkPropOrConfig('invalid', markDef, config);

      if (invalid !== 'filter') {
        return null;
      }

      var filter = model.reduceFieldDef(function (aggregator, fieldDef, channel) {
        var scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel);

        if (scaleComponent) {
          var scaleType = scaleComponent.get('type'); // While discrete domain scales can handle invalid values, continuous scales can't.
          // Thus, for non-path marks, we have to filter null for scales with continuous domains.
          // (For path marks, we will use "defined" property and skip these values instead.)

          if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) {
            aggregator[fieldDef.field] = fieldDef; // we know that the fieldDef is a typed field def
          }
        }

        return aggregator;
      }, {});

      if (!util_keys(filter).length) {
        return null;
      }

      return new FilterInvalidNode(parent, filter);
    }
  }]);

  return FilterInvalidNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/flatten.js












/**
 * A class for flatten transform nodes
 */

var flatten_FlattenTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(FlattenTransformNode, _DataFlowNode);

  var _super = _createSuper(FlattenTransformNode);

  function FlattenTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, FlattenTransformNode);

    _this = _super.call(this, parent);
    _this.transform = transform;
    _this.transform = duplicate(transform); // duplicate to prevent side effects

    var _this$transform = _this.transform,
        flatten = _this$transform.flatten,
        _this$transform$as = _this$transform.as,
        as = _this$transform$as === void 0 ? [] : _this$transform$as;
    _this.transform.as = flatten.map(function (f, i) {
      var _a;

      return (_a = as[i]) !== null && _a !== void 0 ? _a : f;
    });
    return _this;
  }

  _createClass(FlattenTransformNode, [{
    key: "clone",
    value: function clone() {
      return new FlattenTransformNode(this.parent, duplicate(this.transform));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set(this.transform.flatten);
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.transform.as);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "FlattenTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _this$transform2 = this.transform,
          fields = _this$transform2.flatten,
          as = _this$transform2.as;
      var result = {
        type: 'flatten',
        fields: fields,
        as: as
      };
      return result;
    }
  }]);

  return FlattenTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/fold.js











/**
 * A class for flatten transform nodes
 */

var fold_FoldTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(FoldTransformNode, _DataFlowNode);

  var _super = _createSuper(FoldTransformNode);

  function FoldTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, FoldTransformNode);

    var _a, _b, _c;

    _this = _super.call(this, parent);
    _this.transform = transform;
    _this.transform = duplicate(transform); // duplicate to prevent side effects

    var specifiedAs = (_a = _this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined];
    _this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'key', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'value'];
    return _this;
  }

  _createClass(FoldTransformNode, [{
    key: "clone",
    value: function clone() {
      return new FoldTransformNode(null, duplicate(this.transform));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set(this.transform.fold);
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.transform.as);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "FoldTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _this$transform = this.transform,
          fold = _this$transform.fold,
          as = _this$transform.as;
      var result = {
        type: 'fold',
        fields: fold,
        as: as
      };
      return result;
    }
  }]);

  return FoldTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/geojson.js




















var geojson_GeoJSONNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(GeoJSONNode, _DataFlowNode);

  var _super = _createSuper(GeoJSONNode);

  function GeoJSONNode(parent, fields, geojson, signal) {
    var _this;

    _classCallCheck(this, GeoJSONNode);

    _this = _super.call(this, parent);
    _this.fields = fields;
    _this.geojson = geojson;
    _this.signal = signal;
    return _this;
  }

  _createClass(GeoJSONNode, [{
    key: "clone",
    value: function clone() {
      return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal);
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var _a;

      var fields = ((_a = this.fields) !== null && _a !== void 0 ? _a : []).filter(isString);
      return new Set([].concat(_toConsumableArray(this.geojson ? [this.geojson] : []), _toConsumableArray(fields)));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set();
    }
  }, {
    key: "hash",
    value: function hash() {
      return "GeoJSON ".concat(this.geojson, " ").concat(this.signal, " ").concat(util_hash(this.fields));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return Object.assign(Object.assign(Object.assign({
        type: 'geojson'
      }, this.fields ? {
        fields: this.fields
      } : {}), this.geojson ? {
        geojson: this.geojson
      } : {}), {
        signal: this.signal
      });
    }
  }], [{
    key: "parseAll",
    value: function parseAll(parent, model) {
      if (model.component.projection && !model.component.projection.isFit) {
        return parent;
      }

      var geoJsonCounter = 0;

      for (var _i = 0, _arr = [[LONGITUDE, LATITUDE], [LONGITUDE2, LATITUDE2]]; _i < _arr.length; _i++) {
        var coordinates = _arr[_i];
        var pair = coordinates.map(function (channel) {
          return model.channelHasField(channel) ? model.fieldDef(channel).field : isValueDef(model.encoding[channel]) ? {
            expr: model.encoding[channel].value + ''
          } : undefined;
        });

        if (pair[0] || pair[1]) {
          parent = new GeoJSONNode(parent, pair, null, model.getName("geojson_".concat(geoJsonCounter++)));
        }
      }

      if (model.channelHasField(SHAPE)) {
        var fieldDef = model.fieldDef(SHAPE);

        if (fieldDef.type === GEOJSON) {
          parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName("geojson_".concat(geoJsonCounter++)));
        }
      }

      return parent;
    }
  }]);

  return GeoJSONNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/geopoint.js

















var geopoint_GeoPointNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(GeoPointNode, _DataFlowNode);

  var _super = _createSuper(GeoPointNode);

  function GeoPointNode(parent, projection, fields, as) {
    var _this;

    _classCallCheck(this, GeoPointNode);

    _this = _super.call(this, parent);
    _this.projection = projection;
    _this.fields = fields;
    _this.as = as;
    return _this;
  }

  _createClass(GeoPointNode, [{
    key: "clone",
    value: function clone() {
      return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set(this.fields.filter(isString));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.as);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Geopoint ".concat(this.projection, " ").concat(util_hash(this.fields), " ").concat(util_hash(this.as));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return {
        type: 'geopoint',
        projection: this.projection,
        fields: this.fields,
        as: this.as
      };
    }
  }], [{
    key: "parseAll",
    value: function parseAll(parent, model) {
      if (!model.projectionName()) {
        return parent;
      }

      for (var _i = 0, _arr = [[LONGITUDE, LATITUDE], [LONGITUDE2, LATITUDE2]]; _i < _arr.length; _i++) {
        var coordinates = _arr[_i];
        var pair = coordinates.map(function (channel) {
          return model.channelHasField(channel) ? model.fieldDef(channel).field : isValueDef(model.encoding[channel]) ? {
            expr: model.encoding[channel].value + ''
          } : undefined;
        });
        var suffix = coordinates[0] === LONGITUDE2 ? '2' : '';

        if (pair[0] || pair[1]) {
          parent = new GeoPointNode(parent, model.projectionName(), pair, [model.getName('x' + suffix), model.getName('y' + suffix)]);
        }
      }

      return parent;
    }
  }]);

  return GeoPointNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/impute.js


















var impute_ImputeNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(ImputeNode, _DataFlowNode);

  var _super = _createSuper(ImputeNode);

  function ImputeNode(parent, transform) {
    var _this;

    _classCallCheck(this, ImputeNode);

    _this = _super.call(this, parent);
    _this.transform = transform;
    return _this;
  }

  _createClass(ImputeNode, [{
    key: "clone",
    value: function clone() {
      return new ImputeNode(null, duplicate(this.transform));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var _a;

      return new Set([this.transform.impute, this.transform.key].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set([this.transform.impute]);
    }
  }, {
    key: "processSequence",
    value: function processSequence(keyvals) {
      var _keyvals$start = keyvals.start,
          start = _keyvals$start === void 0 ? 0 : _keyvals$start,
          stop = keyvals.stop,
          step = keyvals.step;
      var result = [start, stop].concat(_toConsumableArray(step ? [step] : [])).join(',');
      return {
        signal: "sequence(".concat(result, ")")
      };
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Impute ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _this$transform = this.transform,
          impute = _this$transform.impute,
          key = _this$transform.key,
          keyvals = _this$transform.keyvals,
          method = _this$transform.method,
          groupby = _this$transform.groupby,
          value = _this$transform.value,
          _this$transform$frame = _this$transform.frame,
          frame = _this$transform$frame === void 0 ? [null, null] : _this$transform$frame;
      var imputeTransform = Object.assign(Object.assign(Object.assign(Object.assign({
        type: 'impute',
        field: impute,
        key: key
      }, keyvals ? {
        keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals
      } : {}), {
        method: 'value'
      }), groupby ? {
        groupby: groupby
      } : {}), {
        value: !method || method === 'value' ? value : null
      });

      if (method && method !== 'value') {
        var deriveNewField = Object.assign({
          type: 'window',
          as: ["imputed_".concat(impute, "_value")],
          ops: [method],
          fields: [impute],
          frame: frame,
          ignorePeers: false
        }, groupby ? {
          groupby: groupby
        } : {});
        var replaceOriginal = {
          type: 'formula',
          expr: "datum.".concat(impute, " === null ? datum.imputed_").concat(impute, "_value : datum.").concat(impute),
          as: impute
        };
        return [imputeTransform, deriveNewField, replaceOriginal];
      } else {
        return [imputeTransform];
      }
    }
  }], [{
    key: "makeFromTransform",
    value: function makeFromTransform(parent, imputeTransform) {
      return new ImputeNode(parent, imputeTransform);
    }
  }, {
    key: "makeFromEncoding",
    value: function makeFromEncoding(parent, model) {
      var encoding = model.encoding;
      var xDef = encoding.x;
      var yDef = encoding.y;

      if (isFieldDef(xDef) && isFieldDef(yDef)) {
        var imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined;

        if (imputedChannel === undefined) {
          return undefined;
        }

        var keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined;
        var _imputedChannel$imput = imputedChannel.impute,
            method = _imputedChannel$imput.method,
            value = _imputedChannel$imput.value,
            frame = _imputedChannel$imput.frame,
            keyvals = _imputedChannel$imput.keyvals;
        var groupbyFields = pathGroupingFields(model.mark, encoding);
        return new ImputeNode(parent, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
          impute: imputedChannel.field,
          key: keyChannel.field
        }, method ? {
          method: method
        } : {}), value !== undefined ? {
          value: value
        } : {}), frame ? {
          frame: frame
        } : {}), keyvals !== undefined ? {
          keyvals: keyvals
        } : {}), groupbyFields.length ? {
          groupby: groupbyFields
        } : {}));
      }

      return null;
    }
  }]);

  return ImputeNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/index.js







/**
 * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf)
 * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the
 * same field again (or differently).
 */

var data_AncestorParse = /*#__PURE__*/function (_Split) {
  _inherits(AncestorParse, _Split);

  var _super = _createSuper(AncestorParse);

  function AncestorParse() {
    var _this;

    var explicit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var implicit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    var parseNothing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

    _classCallCheck(this, AncestorParse);

    _this = _super.call(this, explicit, implicit);
    _this.explicit = explicit;
    _this.implicit = implicit;
    _this.parseNothing = parseNothing;
    return _this;
  }

  _createClass(AncestorParse, [{
    key: "clone",
    value: function clone() {
      var clone = get_get(_getPrototypeOf(AncestorParse.prototype), "clone", this).call(this);

      clone.parseNothing = this.parseNothing;
      return clone;
    }
  }]);

  return AncestorParse;
}(split_Split);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/loess.js















/**
 * A class for loess transform nodes
 */

var loess_LoessTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(LoessTransformNode, _DataFlowNode);

  var _super = _createSuper(LoessTransformNode);

  function LoessTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, LoessTransformNode);

    var _a, _b, _c;

    _this = _super.call(this, parent);
    _this.transform = transform;
    _this.transform = duplicate(transform); // duplicate to prevent side effects

    var specifiedAs = (_a = _this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined];
    _this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : transform.on, (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : transform.loess];
    return _this;
  }

  _createClass(LoessTransformNode, [{
    key: "clone",
    value: function clone() {
      return new LoessTransformNode(null, duplicate(this.transform));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var _a;

      return new Set([this.transform.loess, this.transform.on].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.transform.as);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "LoessTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _a = this.transform,
          loess = _a.loess,
          on = _a.on,
          rest = __rest(_a, ["loess", "on"]);

      var result = Object.assign({
        type: 'loess',
        x: on,
        y: loess
      }, rest);
      return result;
    }
  }]);

  return LoessTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/lookup.js

















var lookup_LookupNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(LookupNode, _DataFlowNode);

  var _super = _createSuper(LookupNode);

  function LookupNode(parent, transform, secondary) {
    var _this;

    _classCallCheck(this, LookupNode);

    _this = _super.call(this, parent);
    _this.transform = transform;
    _this.secondary = secondary;
    return _this;
  }

  _createClass(LookupNode, [{
    key: "clone",
    value: function clone() {
      return new LookupNode(null, duplicate(this.transform), this.secondary);
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set([this.transform.lookup]);
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.transform.as ? vega_util_src_array(this.transform.as) : this.transform.from.fields);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "Lookup ".concat(util_hash({
        transform: this.transform,
        secondary: this.secondary
      }));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var foreign;

      if (this.transform.from.fields) {
        // lookup a few fields and add create a flat output
        foreign = Object.assign({
          values: this.transform.from.fields
        }, this.transform.as ? {
          as: vega_util_src_array(this.transform.as)
        } : {});
      } else {
        // lookup full record and nest it
        var asName = this.transform.as;

        if (!isString(asName)) {
          log_warn(message.NO_FIELDS_NEEDS_AS);
          asName = '_lookup';
        }

        foreign = {
          as: [asName]
        };
      }

      return Object.assign(Object.assign({
        type: 'lookup',
        from: this.secondary,
        key: this.transform.from.key,
        fields: [this.transform.lookup]
      }, foreign), this.transform["default"] ? {
        "default": this.transform["default"]
      } : {});
    }
  }], [{
    key: "make",
    value: function make(parent, model, transform, counter) {
      var sources = model.component.data.sources;
      var _transform = transform,
          from = _transform.from;
      var fromOutputNode = null;

      if (isLookupData(from)) {
        var fromSource = findSource(from.data, sources);

        if (!fromSource) {
          fromSource = new source_SourceNode(from.data);
          sources.push(fromSource);
        }

        var fromOutputName = model.getName("lookup_".concat(counter));
        fromOutputNode = new dataflow_OutputNode(fromSource, fromOutputName, 'lookup', model.component.data.outputNodeRefCounts);
        model.component.data.outputNodes[fromOutputName] = fromOutputNode;
      } else if (isLookupSelection(from)) {
        var selName = from.selection;
        transform = Object.assign({
          as: selName
        }, transform);
        fromOutputNode = model.getSelectionComponent(varName(selName), selName).materialized;

        if (!fromOutputNode) {
          throw new Error(message.noSameUnitLookup(selName));
        }
      }

      return new LookupNode(parent, transform, fromOutputNode.getSource());
    }
  }]);

  return LookupNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/quantile.js















/**
 * A class for quantile transform nodes
 */

var quantile_QuantileTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(QuantileTransformNode, _DataFlowNode);

  var _super = _createSuper(QuantileTransformNode);

  function QuantileTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, QuantileTransformNode);

    var _a, _b, _c;

    _this = _super.call(this, parent);
    _this.transform = transform;
    _this.transform = duplicate(transform); // duplicate to prevent side effects

    var specifiedAs = (_a = _this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined];
    _this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : 'prob', (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : 'value'];
    return _this;
  }

  _createClass(QuantileTransformNode, [{
    key: "clone",
    value: function clone() {
      return new QuantileTransformNode(null, duplicate(this.transform));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var _a;

      return new Set([this.transform.quantile].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.transform.as);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "QuantileTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _a = this.transform,
          quantile = _a.quantile,
          rest = __rest(_a, ["quantile"]);

      var result = Object.assign({
        type: 'quantile',
        field: quantile
      }, rest);
      return result;
    }
  }]);

  return QuantileTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/regression.js















/**
 * A class for regression transform nodes
 */

var regression_RegressionTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(RegressionTransformNode, _DataFlowNode);

  var _super = _createSuper(RegressionTransformNode);

  function RegressionTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, RegressionTransformNode);

    var _a, _b, _c;

    _this = _super.call(this, parent);
    _this.transform = transform;
    _this.transform = duplicate(transform); // duplicate to prevent side effects

    var specifiedAs = (_a = _this.transform.as) !== null && _a !== void 0 ? _a : [undefined, undefined];
    _this.transform.as = [(_b = specifiedAs[0]) !== null && _b !== void 0 ? _b : transform.on, (_c = specifiedAs[1]) !== null && _c !== void 0 ? _c : transform.regression];
    return _this;
  }

  _createClass(RegressionTransformNode, [{
    key: "clone",
    value: function clone() {
      return new RegressionTransformNode(null, duplicate(this.transform));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var _a;

      return new Set([this.transform.regression, this.transform.on].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])));
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set(this.transform.as);
    }
  }, {
    key: "hash",
    value: function hash() {
      return "RegressionTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _a = this.transform,
          regression = _a.regression,
          on = _a.on,
          rest = __rest(_a, ["regression", "on"]);

      var result = Object.assign({
        type: 'regression',
        x: on,
        y: regression
      }, rest);
      return result;
    }
  }]);

  return RegressionTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/pivot.js














/**
 * A class for pivot transform nodes.
 */

var pivot_PivotTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(PivotTransformNode, _DataFlowNode);

  var _super = _createSuper(PivotTransformNode);

  function PivotTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, PivotTransformNode);

    _this = _super.call(this, parent);
    _this.transform = transform;
    return _this;
  }

  _createClass(PivotTransformNode, [{
    key: "clone",
    value: function clone() {
      return new PivotTransformNode(null, duplicate(this.transform));
    }
  }, {
    key: "addDimensions",
    value: function addDimensions(fields) {
      var _a;

      this.transform.groupby = unique(((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : []).concat(fields), function (d) {
        return d;
      });
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return undefined; // return undefined so that potentially everything can depend on the pivot
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      var _a;

      return new Set([this.transform.pivot, this.transform.value].concat(_toConsumableArray((_a = this.transform.groupby) !== null && _a !== void 0 ? _a : [])));
    }
  }, {
    key: "hash",
    value: function hash() {
      return "PivotTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      var _this$transform = this.transform,
          pivot = _this$transform.pivot,
          value = _this$transform.value,
          groupby = _this$transform.groupby,
          limit = _this$transform.limit,
          op = _this$transform.op;
      return Object.assign(Object.assign(Object.assign({
        type: 'pivot',
        field: pivot,
        value: value
      }, limit !== undefined ? {
        limit: limit
      } : {}), op !== undefined ? {
        op: op
      } : {}), groupby !== undefined ? {
        groupby: groupby
      } : {});
    }
  }]);

  return PivotTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/sample.js











/**
 * A class for the sample transform nodes
 */

var sample_SampleTransformNode = /*#__PURE__*/function (_DataFlowNode) {
  _inherits(SampleTransformNode, _DataFlowNode);

  var _super = _createSuper(SampleTransformNode);

  function SampleTransformNode(parent, transform) {
    var _this;

    _classCallCheck(this, SampleTransformNode);

    _this = _super.call(this, parent);
    _this.transform = transform;
    return _this;
  }

  _createClass(SampleTransformNode, [{
    key: "clone",
    value: function clone() {
      return new SampleTransformNode(null, duplicate(this.transform));
    }
  }, {
    key: "dependentFields",
    value: function dependentFields() {
      return new Set();
    }
  }, {
    key: "producedFields",
    value: function producedFields() {
      return new Set();
    }
  }, {
    key: "hash",
    value: function hash() {
      return "SampleTransform ".concat(util_hash(this.transform));
    }
  }, {
    key: "assemble",
    value: function assemble() {
      return {
        type: 'sample',
        size: this.transform.sample
      };
    }
  }]);

  return SampleTransformNode;
}(dataflow_DataFlowNode);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/assemble.js









































function makeWalkTree(data) {
  // to name datasources
  var datasetIndex = 0;
  /**
   * Recursively walk down the tree.
   */

  function walkTree(node, dataSource) {
    var _a;

    if (node instanceof source_SourceNode) {
      // If the source is a named data source or a data source with values, we need
      // to put it in a different data source. Otherwise, Vega may override the data.
      if (!node.isGenerator && !isUrlData(node.data)) {
        data.push(dataSource);
        var newData = {
          name: null,
          source: dataSource.name,
          transform: []
        };
        dataSource = newData;
      }
    }

    if (node instanceof formatparse_ParseNode) {
      if (node.parent instanceof source_SourceNode && !dataSource.source) {
        var _dataSource$transform;

        // If node's parent is a root source and the data source does not refer to another data source, use normal format parse
        dataSource.format = Object.assign(Object.assign({}, (_a = dataSource.format) !== null && _a !== void 0 ? _a : {}), {
          parse: node.assembleFormatParse()
        }); // add calculates for all nested fields

        (_dataSource$transform = dataSource.transform).push.apply(_dataSource$transform, _toConsumableArray(node.assembleTransforms(true)));
      } else {
        var _dataSource$transform2;

        // Otherwise use Vega expression to parse
        (_dataSource$transform2 = dataSource.transform).push.apply(_dataSource$transform2, _toConsumableArray(node.assembleTransforms()));
      }
    }

    if (node instanceof facet_FacetNode) {
      if (!dataSource.name) {
        dataSource.name = "data_".concat(datasetIndex++);
      }

      if (!dataSource.source || dataSource.transform.length > 0) {
        data.push(dataSource);
        node.data = dataSource.name;
      } else {
        node.data = dataSource.source;
      }

      node.assemble().forEach(function (d) {
        return data.push(d);
      }); // break here because the rest of the tree has to be taken care of by the facet.

      return;
    }

    if (node instanceof graticule_GraticuleNode || node instanceof sequence_SequenceNode || node instanceof filterinvalid_FilterInvalidNode || node instanceof filter_FilterNode || node instanceof calculate_CalculateNode || node instanceof geopoint_GeoPointNode || node instanceof geojson_GeoJSONNode || node instanceof aggregate_AggregateNode || node instanceof lookup_LookupNode || node instanceof window_WindowTransformNode || node instanceof joinaggregate_JoinAggregateTransformNode || node instanceof fold_FoldTransformNode || node instanceof flatten_FlattenTransformNode || node instanceof density_DensityTransformNode || node instanceof loess_LoessTransformNode || node instanceof quantile_QuantileTransformNode || node instanceof regression_RegressionTransformNode || node instanceof identifier_IdentifierNode || node instanceof sample_SampleTransformNode || node instanceof pivot_PivotTransformNode) {
      dataSource.transform.push(node.assemble());
    }

    if (node instanceof bin_BinNode || node instanceof timeunit_TimeUnitNode || node instanceof impute_ImputeNode || node instanceof stack_StackNode) {
      var _dataSource$transform3;

      (_dataSource$transform3 = dataSource.transform).push.apply(_dataSource$transform3, _toConsumableArray(node.assemble()));
    }

    if (node instanceof dataflow_OutputNode) {
      if (dataSource.source && dataSource.transform.length === 0) {
        node.setSource(dataSource.source);
      } else if (node.parent instanceof dataflow_OutputNode) {
        // Note that an output node may be required but we still do not assemble a
        // separate data source for it.
        node.setSource(dataSource.name);
      } else {
        if (!dataSource.name) {
          dataSource.name = "data_".concat(datasetIndex++);
        } // Here we set the name of the datasource we generated. From now on
        // other assemblers can use it.


        node.setSource(dataSource.name); // if this node has more than one child, we will add a datasource automatically

        if (node.numChildren() === 1) {
          data.push(dataSource);
          var _newData = {
            name: null,
            source: dataSource.name,
            transform: []
          };
          dataSource = _newData;
        }
      }
    }

    switch (node.numChildren()) {
      case 0:
        // done
        if (node instanceof dataflow_OutputNode && (!dataSource.source || dataSource.transform.length > 0)) {
          // do not push empty datasources that are simply references
          data.push(dataSource);
        }

        break;

      case 1:
        walkTree(node.children[0], dataSource);
        break;

      default:
        {
          if (!dataSource.name) {
            dataSource.name = "data_".concat(datasetIndex++);
          }

          var source = dataSource.name;

          if (!dataSource.source || dataSource.transform.length > 0) {
            data.push(dataSource);
          } else {
            source = dataSource.source;
          }

          node.children.forEach(function (child) {
            var newData = {
              name: null,
              source: source,
              transform: []
            };
            walkTree(child, newData);
          });
          break;
        }
    }
  }

  return walkTree;
}
/**
 * Assemble data sources that are derived from faceted data.
 */


function assembleFacetData(root) {
  var data = [];
  var walkTree = makeWalkTree(data);
  root.children.forEach(function (child) {
    return walkTree(child, {
      source: root.name,
      name: null,
      transform: []
    });
  });
  return data;
}
/**
 * Create Vega Data array from a given compiled model and append all of them to the given array
 *
 * @param  model
 * @param  data array
 * @return modified data array
 */

function assembleRootData(dataComponent, datasets) {
  var _a, _b;

  var data = []; // dataComponent.sources.forEach(debug);
  // draw(dataComponent.sources);

  var walkTree = makeWalkTree(data);
  var sourceIndex = 0;
  dataComponent.sources.forEach(function (root) {
    // assign a name if the source does not have a name yet
    if (!root.hasName()) {
      root.dataName = "source_".concat(sourceIndex++);
    }

    var newData = root.assemble();
    walkTree(root, newData);
  }); // remove empty transform arrays for cleaner output

  data.forEach(function (d) {
    if (d.transform.length === 0) {
      delete d.transform;
    }
  }); // move sources without transforms (the ones that are potentially used in lookups) to the beginning

  var whereTo = 0;

  var _iterator = _createForOfIteratorHelper(data.entries()),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var _step$value = _slicedToArray(_step.value, 2),
          i = _step$value[0],
          _d2 = _step$value[1];

      if (((_a = _d2.transform) !== null && _a !== void 0 ? _a : []).length === 0 && !_d2.source) {
        data.splice(whereTo++, 0, data.splice(i, 1)[0]);
      }
    } // now fix the from references in lookup transforms

  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  for (var _i = 0, _data = data; _i < _data.length; _i++) {
    var d = _data[_i];

    var _iterator2 = _createForOfIteratorHelper((_b = d.transform) !== null && _b !== void 0 ? _b : []),
        _step2;

    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var t = _step2.value;

        if (t.type === 'lookup') {
          t.from = dataComponent.outputNodes[t.from].getSource();
        }
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
  } // inline values for datasets that are in the datastore


  for (var _i2 = 0, _data2 = data; _i2 < _data2.length; _i2++) {
    var _d = _data2[_i2];

    if (_d.name in datasets) {
      _d.values = datasets[_d.name];
    }
  }

  return data;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/header/parse.js










function getHeaderType(orient) {
  if (orient === 'top' || orient === 'left') {
    return 'header';
  }

  return 'footer';
}
function parseFacetHeaders(model) {
  var _iterator = _createForOfIteratorHelper(FACET_CHANNELS),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var channel = _step.value;
      parseFacetHeader(model, channel);
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  mergeChildAxis(model, 'x');
  mergeChildAxis(model, 'y');
}

function parseFacetHeader(model, channel) {
  var _a;

  if (model.channelHasField(channel)) {
    var fieldDef = model.facet[channel];
    var titleConfig = getHeaderProperty('title', null, model.config, channel);
    var title = channeldef_title(fieldDef, model.config, {
      allowDisabling: true,
      includeDefault: titleConfig === undefined || !!titleConfig
    });

    if (model.child.component.layoutHeaders[channel].title) {
      // TODO: better handle multiline titles
      title = isArray(title) ? title.join(', ') : title; // merge title with child to produce "Title / Subtitle / Sub-subtitle"

      title += ' / ' + model.child.component.layoutHeaders[channel].title;
      model.child.component.layoutHeaders[channel].title = null;
    }

    var labelOrient = getHeaderProperty('labelOrient', fieldDef, model.config, channel);
    var header = (_a = fieldDef.header) !== null && _a !== void 0 ? _a : {};
    var labels = getFirstDefined(header.labels, true);
    var headerType = util_contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header';
    model.component.layoutHeaders[channel] = _defineProperty({
      title: title,
      facetFieldDef: fieldDef
    }, headerType, channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)]);
  }
}

function makeHeaderComponent(model, channel, labels) {
  var sizeType = channel === 'row' ? 'height' : 'width';
  return {
    labels: labels,
    sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined,
    axes: []
  };
}

function mergeChildAxis(model, channel) {
  var _a;

  var child = model.child;

  if (child.component.axes[channel]) {
    var _model$component = model.component,
        layoutHeaders = _model$component.layoutHeaders,
        resolve = _model$component.resolve;
    resolve.axis[channel] = parseGuideResolve(resolve, channel);

    if (resolve.axis[channel] === 'shared') {
      // For shared axis, move the axes to facet's header or footer
      var headerChannel = channel === 'x' ? 'column' : 'row';
      var layoutHeader = layoutHeaders[headerChannel];

      var _iterator2 = _createForOfIteratorHelper(child.component.axes[channel]),
          _step2;

      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var axisComponent = _step2.value;
          var headerType = getHeaderType(axisComponent.get('orient'));
          layoutHeader[headerType] = (_a = layoutHeader[headerType]) !== null && _a !== void 0 ? _a : [makeHeaderComponent(model, headerChannel, false)]; // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes

          var mainAxis = assembleAxis(axisComponent, 'main', model.config, {
            header: true
          });

          if (mainAxis) {
            // LayoutHeader no longer keep track of property precedence, thus let's combine.
            layoutHeader[headerType][0].axes.push(mainAxis);
          }

          axisComponent.mainExtracted = true;
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }
    } else {// Otherwise do nothing for independent axes
    }
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/layoutsize/parse.js








function parseLayerLayoutSize(model) {
  parseChildrenLayoutSize(model);
  parseNonUnitLayoutSizeForChannel(model, 'width');
  parseNonUnitLayoutSizeForChannel(model, 'height');
}
var parseRepeatLayoutSize = parseConcatLayoutSize;
function parseConcatLayoutSize(model) {
  parseChildrenLayoutSize(model);
  parseNonUnitLayoutSizeForChannel(model, 'childWidth');
  parseNonUnitLayoutSizeForChannel(model, 'childHeight');
}
function parseChildrenLayoutSize(model) {
  var _iterator = _createForOfIteratorHelper(model.children),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var child = _step.value;
      child.parseLayoutSize();
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }
}
/**
 * Merge child layout size (width or height).
 */

function parseNonUnitLayoutSizeForChannel(model, layoutSizeType) {
  /*
   * For concat, the parent width or height might not be the same as the children's shared height.
   * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width.
   *
   * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height)
   * while the sizeType represents the properties of the child.
   */
  var sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);
  var channel = getPositionScaleChannel(sizeType);
  var resolve = model.component.resolve;
  var layoutSizeCmpt = model.component.layoutSize;
  var mergedSize; // Try to merge layout size

  var _iterator2 = _createForOfIteratorHelper(model.children),
      _step2;

  try {
    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      var _child = _step2.value;

      var childSize = _child.component.layoutSize.getWithExplicit(sizeType);

      var scaleResolve = resolve.scale[channel];

      if (scaleResolve === 'independent' && childSize.value === 'step') {
        // Do not merge independent scales with range-step as their size depends
        // on the scale domains, which can be different between scales.
        mergedSize = undefined;
        break;
      }

      if (mergedSize) {
        if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) {
          // For independent scale, only merge if all the sizes are the same.
          // If the values are different, abandon the merge!
          mergedSize = undefined;
          break;
        }

        mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, '');
      } else {
        mergedSize = childSize;
      }
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }

  if (mergedSize) {
    // If merged, rename size and set size of all children.
    var _iterator3 = _createForOfIteratorHelper(model.children),
        _step3;

    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var child = _step3.value;
        model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType));
        child.component.layoutSize.set(sizeType, 'merged', false);
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }

    layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize);
  } else {
    layoutSizeCmpt.setWithExplicit(layoutSizeType, {
      explicit: false,
      value: undefined
    });
  }
}

function parseUnitLayoutSize(model) {
  var size = model.size,
      component = model.component;

  var _iterator4 = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS),
      _step4;

  try {
    for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
      var channel = _step4.value;
      var sizeType = getSizeType(channel);

      if (size[sizeType]) {
        var specifiedSize = size[sizeType];
        component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true);
      } else {
        var defaultSize = defaultUnitSize(model, sizeType);
        component.layoutSize.set(sizeType, defaultSize, false);
      }
    }
  } catch (err) {
    _iterator4.e(err);
  } finally {
    _iterator4.f();
  }
}

function defaultUnitSize(model, sizeType) {
  var channel = sizeType === 'width' ? 'x' : 'y';
  var config = model.config;
  var scaleComponent = model.getScaleComponent(channel);

  if (scaleComponent) {
    var scaleType = scaleComponent.get('type');
    var range = scaleComponent.get('range');

    if (hasDiscreteDomain(scaleType)) {
      var size = getViewConfigDiscreteSize(config.view, sizeType);

      if (isVgRangeStep(range) || isStep(size)) {
        // For discrete domain with range.step, use dynamic width/height
        return 'step';
      } else {
        return size;
      }
    } else {
      return getViewConfigContinuousSize(config.view, sizeType);
    }
  } else if (model.hasProjection) {
    return getViewConfigContinuousSize(config.view, sizeType);
  } else {
    var _size = getViewConfigDiscreteSize(config.view, sizeType);

    return isStep(_size) ? _size.step : _size;
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/facet.js




































function facetSortFieldName(fieldDef, sort, opt) {
  return channeldef_vgField(sort, Object.assign({
    suffix: "by_".concat(channeldef_vgField(fieldDef))
  }, opt !== null && opt !== void 0 ? opt : {}));
}
var facet_FacetModel = /*#__PURE__*/function (_ModelWithField) {
  _inherits(FacetModel, _ModelWithField);

  var _super = _createSuper(FacetModel);

  function FacetModel(spec, parent, parentGivenName, config) {
    var _this;

    _classCallCheck(this, FacetModel);

    _this = _super.call(this, spec, 'facet', parent, parentGivenName, config, spec.resolve);
    _this.child = buildModel(spec.spec, _assertThisInitialized(_this), _this.getName('child'), undefined, config);
    _this.children = [_this.child];
    _this.facet = _this.initFacet(spec.facet);
    return _this;
  }

  _createClass(FacetModel, [{
    key: "initFacet",
    value: function initFacet(facet) {
      // clone to prevent side effect to the original spec
      if (!isFacetMapping(facet)) {
        return {
          facet: initChannelDef(facet, 'facet')
        };
      }

      return encoding_reduce(facet, function (normalizedFacet, fieldDef, channel) {
        if (!util_contains([ROW, COLUMN], channel)) {
          // Drop unsupported channel
          log_warn(message.incompatibleChannel(channel, 'facet'));
          return normalizedFacet;
        }

        if (fieldDef.field === undefined) {
          log_warn(message.emptyFieldDef(fieldDef, channel));
          return normalizedFacet;
        } // Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.


        normalizedFacet[channel] = initChannelDef(fieldDef, channel);
        return normalizedFacet;
      }, {});
    }
  }, {
    key: "channelHasField",
    value: function channelHasField(channel) {
      return !!this.facet[channel];
    }
  }, {
    key: "fieldDef",
    value: function fieldDef(channel) {
      return this.facet[channel];
    }
  }, {
    key: "parseData",
    value: function parseData() {
      this.component.data = parse_parseData(this);
      this.child.parseData();
    }
  }, {
    key: "parseLayoutSize",
    value: function parseLayoutSize() {
      parseChildrenLayoutSize(this);
    }
  }, {
    key: "parseSelections",
    value: function parseSelections() {
      // As a facet has a single child, the selection components are the same.
      // The child maintains its selections to assemble signals, which remain
      // within its unit.
      this.child.parseSelections();
      this.component.selection = this.child.component.selection;
    }
  }, {
    key: "parseMarkGroup",
    value: function parseMarkGroup() {
      this.child.parseMarkGroup();
    }
  }, {
    key: "parseAxesAndHeaders",
    value: function parseAxesAndHeaders() {
      this.child.parseAxesAndHeaders();
      parseFacetHeaders(this);
    }
  }, {
    key: "assembleSelectionTopLevelSignals",
    value: function assembleSelectionTopLevelSignals(signals) {
      return this.child.assembleSelectionTopLevelSignals(signals);
    }
  }, {
    key: "assembleSignals",
    value: function assembleSignals() {
      this.child.assembleSignals();
      return [];
    }
  }, {
    key: "assembleSelectionData",
    value: function assembleSelectionData(data) {
      return this.child.assembleSelectionData(data);
    }
  }, {
    key: "getHeaderLayoutMixins",
    value: function getHeaderLayoutMixins() {
      var _a, _b, _c;

      var layoutMixins = {};

      var _iterator = _createForOfIteratorHelper(FACET_CHANNELS),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var channel = _step.value;

          var _iterator2 = _createForOfIteratorHelper(HEADER_TYPES),
              _step2;

          try {
            for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
              var headerType = _step2.value;
              var layoutHeaderComponent = this.component.layoutHeaders[channel];
              var headerComponent = layoutHeaderComponent[headerType];
              var facetFieldDef = layoutHeaderComponent.facetFieldDef;

              if (facetFieldDef) {
                var titleOrient = getHeaderProperty('titleOrient', facetFieldDef, this.config, channel);

                if (util_contains(['right', 'bottom'], titleOrient)) {
                  var headerChannel = getHeaderChannel(channel, titleOrient);
                  layoutMixins.titleAnchor = (_a = layoutMixins.titleAnchor) !== null && _a !== void 0 ? _a : {};
                  layoutMixins.titleAnchor[headerChannel] = 'end';
                }
              }

              if (headerComponent === null || headerComponent === void 0 ? void 0 : headerComponent[0]) {
                // set header/footerBand
                var sizeType = channel === 'row' ? 'height' : 'width';
                var bandType = headerType === 'header' ? 'headerBand' : 'footerBand';

                if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) {
                  // If facet child does not have size signal, then apply headerBand
                  layoutMixins[bandType] = (_b = layoutMixins[bandType]) !== null && _b !== void 0 ? _b : {};
                  layoutMixins[bandType][channel] = 0.5;
                }

                if (layoutHeaderComponent.title) {
                  layoutMixins.offset = (_c = layoutMixins.offset) !== null && _c !== void 0 ? _c : {};
                  layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10;
                }
              }
            }
          } catch (err) {
            _iterator2.e(err);
          } finally {
            _iterator2.f();
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      return layoutMixins;
    }
  }, {
    key: "assembleDefaultLayout",
    value: function assembleDefaultLayout() {
      var _this$facet = this.facet,
          column = _this$facet.column,
          row = _this$facet.row;
      var columns = column ? this.columnDistinctSignal() : row ? 1 : undefined;
      var align = 'all'; // Do not align the cells if the scale corresponding to the direction is indepent.
      // We always align when we facet into both row and column.

      if (!row && this.component.resolve.scale.x === 'independent') {
        align = 'none';
      } else if (!column && this.component.resolve.scale.y === 'independent') {
        align = 'none';
      }

      return Object.assign(Object.assign(Object.assign({}, this.getHeaderLayoutMixins()), columns ? {
        columns: columns
      } : {}), {
        bounds: 'full',
        align: align
      });
    }
  }, {
    key: "assembleLayoutSignals",
    value: function assembleLayoutSignals() {
      // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales.
      return this.child.assembleLayoutSignals();
    }
  }, {
    key: "columnDistinctSignal",
    value: function columnDistinctSignal() {
      if (this.parent && this.parent instanceof FacetModel) {
        // For nested facet, we will add columns to group mark instead
        // See discussion in https://github.com/vega/vega/issues/952
        // and https://github.com/vega/vega-view/releases/tag/v1.2.6
        return undefined;
      } else {
        // In facetNode.assemble(), the name is always this.getName('column') + '_layout'.
        var facetLayoutDataName = this.getName('column_domain');
        return {
          signal: "length(data('".concat(facetLayoutDataName, "'))")
        };
      }
    }
  }, {
    key: "assembleGroup",
    value: function assembleGroup(signals) {
      if (this.parent && this.parent instanceof FacetModel) {
        // Provide number of columns for layout.
        // See discussion in https://github.com/vega/vega/issues/952
        // and https://github.com/vega/vega-view/releases/tag/v1.2.6
        return Object.assign(Object.assign({}, this.channelHasField('column') ? {
          encode: {
            update: {
              // TODO(https://github.com/vega/vega-lite/issues/2759):
              // Correct the signal for facet of concat of facet_column
              columns: {
                field: channeldef_vgField(this.facet.column, {
                  prefix: 'distinct'
                })
              }
            }
          }
        } : {}), get_get(_getPrototypeOf(FacetModel.prototype), "assembleGroup", this).call(this, signals));
      }

      return get_get(_getPrototypeOf(FacetModel.prototype), "assembleGroup", this).call(this, signals);
    }
    /**
     * Aggregate cardinality for calculating size
     */

  }, {
    key: "getCardinalityAggregateForChild",
    value: function getCardinalityAggregateForChild() {
      var fields = [];
      var ops = [];
      var as = [];

      if (this.child instanceof FacetModel) {
        if (this.child.channelHasField('column')) {
          var field = channeldef_vgField(this.child.facet.column);
          fields.push(field);
          ops.push('distinct');
          as.push("distinct_".concat(field));
        }
      } else {
        for (var _i = 0, _arr = ['x', 'y']; _i < _arr.length; _i++) {
          var channel = _arr[_i];
          var childScaleComponent = this.child.component.scales[channel];

          if (childScaleComponent && !childScaleComponent.merged) {
            var type = childScaleComponent.get('type');
            var range = childScaleComponent.get('range');

            if (hasDiscreteDomain(type) && isVgRangeStep(range)) {
              var domain = assembleDomain(this.child, channel);

              var _field = getFieldFromDomain(domain);

              if (_field) {
                fields.push(_field);
                ops.push('distinct');
                as.push("distinct_".concat(_field));
              } else {
                log_warn("Unknown field for ".concat(channel, ". Cannot calculate view size."));
              }
            }
          }
        }
      }

      return {
        fields: fields,
        ops: ops,
        as: as
      };
    }
  }, {
    key: "assembleFacet",
    value: function assembleFacet() {
      var _this$component$data$ = this.component.data.facetRoot,
          name = _this$component$data$.name,
          data = _this$component$data$.data;
      var _this$facet2 = this.facet,
          row = _this$facet2.row,
          column = _this$facet2.column;

      var _this$getCardinalityA = this.getCardinalityAggregateForChild(),
          fields = _this$getCardinalityA.fields,
          ops = _this$getCardinalityA.ops,
          as = _this$getCardinalityA.as;

      var groupby = [];

      var _iterator3 = _createForOfIteratorHelper(FACET_CHANNELS),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var channel = _step3.value;
          var fieldDef = this.facet[channel];

          if (fieldDef) {
            groupby.push(channeldef_vgField(fieldDef));
            var bin = fieldDef.bin,
                sort = fieldDef.sort;

            if (isBinning(bin)) {
              groupby.push(channeldef_vgField(fieldDef, {
                binSuffix: 'end'
              }));
            }

            if (isSortField(sort)) {
              var field = sort.field,
                  _sort$op = sort.op,
                  op = _sort$op === void 0 ? DEFAULT_SORT_OP : _sort$op;
              var outputName = facetSortFieldName(fieldDef, sort);

              if (row && column) {
                // For crossed facet, use pre-calculate field as it requires a different groupby
                // For each calculated field, apply max and assign them to the same name as
                // all values of the same group should be the same anyway.
                fields.push(outputName);
                ops.push('max');
                as.push(outputName);
              } else {
                fields.push(field);
                ops.push(op);
                as.push(outputName);
              }
            } else if (isArray(sort)) {
              var _outputName = sortArrayIndexField(fieldDef, channel);

              fields.push(_outputName);
              ops.push('max');
              as.push(_outputName);
            }
          }
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }

      var cross = !!row && !!column;
      return Object.assign({
        name: name,
        data: data,
        groupby: groupby
      }, cross || fields.length > 0 ? {
        aggregate: Object.assign(Object.assign({}, cross ? {
          cross: cross
        } : {}), fields.length ? {
          fields: fields,
          ops: ops,
          as: as
        } : {})
      } : {});
    }
  }, {
    key: "facetSortFields",
    value: function facetSortFields(channel) {
      var facet = this.facet;
      var fieldDef = facet[channel];

      if (fieldDef) {
        if (isSortField(fieldDef.sort)) {
          return [facetSortFieldName(fieldDef, fieldDef.sort, {
            expr: 'datum'
          })];
        } else if (isArray(fieldDef.sort)) {
          return [sortArrayIndexField(fieldDef, channel, {
            expr: 'datum'
          })];
        }

        return [channeldef_vgField(fieldDef, {
          expr: 'datum'
        })];
      }

      return [];
    }
  }, {
    key: "facetSortOrder",
    value: function facetSortOrder(channel) {
      var facet = this.facet;
      var fieldDef = facet[channel];

      if (fieldDef) {
        var sort = fieldDef.sort;
        var order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending';
        return [order];
      }

      return [];
    }
  }, {
    key: "assembleLabelTitle",
    value: function assembleLabelTitle() {
      var facet = this.facet,
          config = this.config;

      if (facet.facet) {
        // Facet always uses title to display labels
        return assemble_assembleLabelTitle(facet.facet, 'facet', config);
      }

      var ORTHOGONAL_ORIENT = {
        row: ['top', 'bottom'],
        column: ['left', 'right']
      };

      var _iterator4 = _createForOfIteratorHelper(HEADER_CHANNELS),
          _step4;

      try {
        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
          var channel = _step4.value;

          if (facet[channel]) {
            var labelOrient = getHeaderProperty('labelOrient', facet[channel], config, channel);

            if (util_contains(ORTHOGONAL_ORIENT[channel], labelOrient)) {
              // Row/Column with orthogonal labelOrient must use title to display labels
              return assemble_assembleLabelTitle(facet[channel], channel, config);
            }
          }
        }
      } catch (err) {
        _iterator4.e(err);
      } finally {
        _iterator4.f();
      }

      return undefined;
    }
  }, {
    key: "assembleMarks",
    value: function assembleMarks() {
      var _this2 = this;

      var child = this.child; // If we facet by two dimensions, we need to add a cross operator to the aggregation
      // so that we create all groups

      var facetRoot = this.component.data.facetRoot;
      var data = assembleFacetData(facetRoot);
      var encodeEntry = child.assembleGroupEncodeEntry(false);
      var title = this.assembleLabelTitle() || child.assembleTitle();
      var style = child.assembleGroupStyle();
      var markGroup = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
        name: this.getName('cell'),
        type: 'group'
      }, title ? {
        title: title
      } : {}), style ? {
        style: style
      } : {}), {
        from: {
          facet: this.assembleFacet()
        },
        // TODO: move this to after data
        sort: {
          field: FACET_CHANNELS.map(function (c) {
            return _this2.facetSortFields(c);
          }).flat(),
          order: FACET_CHANNELS.map(function (c) {
            return _this2.facetSortOrder(c);
          }).flat()
        }
      }), data.length > 0 ? {
        data: data
      } : {}), encodeEntry ? {
        encode: {
          update: encodeEntry
        }
      } : {}), child.assembleGroup(assembleFacetSignals(this, [])));
      return [markGroup];
    }
  }, {
    key: "getMapping",
    value: function getMapping() {
      return this.facet;
    }
  }]);

  return FacetModel;
}(model_ModelWithField);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/joinaggregatefacet.js





function makeJoinAggregateFromFacet(parent, facet) {
  var row = facet.row,
      column = facet.column;

  if (row && column) {
    var newParent = null; // only need to make one for crossed facet

    for (var _i = 0, _arr = [row, column]; _i < _arr.length; _i++) {
      var fieldDef = _arr[_i];

      if (isSortField(fieldDef.sort)) {
        var _fieldDef$sort = fieldDef.sort,
            field = _fieldDef$sort.field,
            _fieldDef$sort$op = _fieldDef$sort.op,
            op = _fieldDef$sort$op === void 0 ? DEFAULT_SORT_OP : _fieldDef$sort$op;
        parent = newParent = new joinaggregate_JoinAggregateTransformNode(parent, {
          joinaggregate: [{
            op: op,
            field: field,
            as: facetSortFieldName(fieldDef, fieldDef.sort, {
              forAs: true
            })
          }],
          groupby: [channeldef_vgField(fieldDef)]
        });
      }
    }

    return newParent;
  }

  return null;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/data/parse.js













































function findSource(data, sources) {
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;

  var _iterator = _createForOfIteratorHelper(sources),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var other = _step.value;
      var otherData = other.data; // if both datasets have a name defined, we cannot merge

      if (data.name && other.hasName() && data.name !== other.dataName) {
        continue;
      } // feature and mesh are mutually exclusive


      if (((_a = data['format']) === null || _a === void 0 ? void 0 : _a.mesh) && ((_b = otherData.format) === null || _b === void 0 ? void 0 : _b.feature)) {
        continue;
      } // we have to extract the same feature or mesh


      if ((((_c = data['format']) === null || _c === void 0 ? void 0 : _c.feature) || ((_d = otherData.format) === null || _d === void 0 ? void 0 : _d.feature)) && ((_e = data['format']) === null || _e === void 0 ? void 0 : _e.feature) !== ((_f = otherData.format) === null || _f === void 0 ? void 0 : _f.feature)) {
        continue;
      }

      if ((((_g = data['format']) === null || _g === void 0 ? void 0 : _g.mesh) || ((_h = otherData.format) === null || _h === void 0 ? void 0 : _h.mesh)) && ((_j = data['format']) === null || _j === void 0 ? void 0 : _j.mesh) !== ((_k = otherData.format) === null || _k === void 0 ? void 0 : _k.mesh)) {
        continue;
      }

      if (isInlineData(data) && isInlineData(otherData)) {
        if (deepEqual(data.values, otherData.values)) {
          return other;
        }
      } else if (isUrlData(data) && isUrlData(otherData)) {
        if (data.url === otherData.url) {
          return other;
        }
      } else if (isNamedData(data)) {
        if (data.name === other.dataName) {
          return other;
        }
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return null;
}

function parseRoot(model, sources) {
  if (model.data || !model.parent) {
    // if the model defines a data source or is the root, create a source node
    if (model.data === null) {
      // data: null means we should ignore the parent's data so we just create a new data source
      var source = new source_SourceNode([]);
      sources.push(source);
      return source;
    }

    var existingSource = findSource(model.data, sources);

    if (existingSource) {
      if (!isGenerator(model.data)) {
        existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format);
      } // if the new source has a name but the existing one does not, we can set it


      if (!existingSource.hasName() && model.data.name) {
        existingSource.dataName = model.data.name;
      }

      return existingSource;
    } else {
      var _source = new source_SourceNode(model.data);

      sources.push(_source);
      return _source;
    }
  } else {
    // If we don't have a source defined (overriding parent's data), use the parent's facet root or main.
    return model.parent.component.data.facetRoot ? model.parent.component.data.facetRoot : model.parent.component.data.main;
  }
}
/**
 * Parses a transform array into a chain of connected dataflow nodes.
 */


function parseTransformArray(head, model, ancestorParse) {
  var _a, _b;

  var lookupCounter = 0;

  var _iterator2 = _createForOfIteratorHelper(model.transforms),
      _step2;

  try {
    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      var t = _step2.value;
      var derivedType = undefined;
      var transformNode = void 0;

      if (isCalculate(t)) {
        transformNode = head = new calculate_CalculateNode(head, t);
        derivedType = 'derived';
      } else if (isFilter(t)) {
        var implicit = getImplicitFromFilterTransform(t);
        transformNode = head = (_a = formatparse_ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse)) !== null && _a !== void 0 ? _a : head;
        head = new filter_FilterNode(head, model, t.filter);
      } else if (isBin(t)) {
        transformNode = head = bin_BinNode.makeFromTransform(head, t, model);
        derivedType = 'number';
      } else if (transform_isTimeUnit(t)) {
        derivedType = 'date';
        var parsedAs = ancestorParse.getWithExplicit(t.field); // Create parse node because the input to time unit is always date.

        if (parsedAs.value === undefined) {
          head = new formatparse_ParseNode(head, _defineProperty({}, t.field, derivedType));
          ancestorParse.set(t.field, derivedType, false);
        }

        transformNode = head = timeunit_TimeUnitNode.makeFromTransform(head, t);
      } else if (transform_isAggregate(t)) {
        transformNode = head = aggregate_AggregateNode.makeFromTransform(head, t);
        derivedType = 'number';

        if (requiresSelectionId(model)) {
          head = new identifier_IdentifierNode(head);
        }
      } else if (isLookup(t)) {
        transformNode = head = lookup_LookupNode.make(head, model, t, lookupCounter++);
        derivedType = 'derived';
      } else if (isWindow(t)) {
        transformNode = head = new window_WindowTransformNode(head, t);
        derivedType = 'number';
      } else if (isJoinAggregate(t)) {
        transformNode = head = new joinaggregate_JoinAggregateTransformNode(head, t);
        derivedType = 'number';
      } else if (isStack(t)) {
        transformNode = head = stack_StackNode.makeFromTransform(head, t);
        derivedType = 'derived';
      } else if (isFold(t)) {
        transformNode = head = new fold_FoldTransformNode(head, t);
        derivedType = 'derived';
      } else if (isFlatten(t)) {
        transformNode = head = new flatten_FlattenTransformNode(head, t);
        derivedType = 'derived';
      } else if (isPivot(t)) {
        transformNode = head = new pivot_PivotTransformNode(head, t);
        derivedType = 'derived';
      } else if (isSample(t)) {
        head = new sample_SampleTransformNode(head, t);
      } else if (isImpute(t)) {
        transformNode = head = impute_ImputeNode.makeFromTransform(head, t);
        derivedType = 'derived';
      } else if (isDensity(t)) {
        transformNode = head = new density_DensityTransformNode(head, t);
        derivedType = 'derived';
      } else if (transform_isQuantile(t)) {
        transformNode = head = new quantile_QuantileTransformNode(head, t);
        derivedType = 'derived';
      } else if (isRegression(t)) {
        transformNode = head = new regression_RegressionTransformNode(head, t);
        derivedType = 'derived';
      } else if (isLoess(t)) {
        transformNode = head = new loess_LoessTransformNode(head, t);
        derivedType = 'derived';
      } else {
        log_warn(message.invalidTransformIgnored(t));
        continue;
      }

      if (transformNode && derivedType !== undefined) {
        var _iterator3 = _createForOfIteratorHelper((_b = transformNode.producedFields()) !== null && _b !== void 0 ? _b : []),
            _step3;

        try {
          for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
            var field = _step3.value;
            ancestorParse.set(field, derivedType, false);
          }
        } catch (err) {
          _iterator3.e(err);
        } finally {
          _iterator3.f();
        }
      }
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }

  return head;
}
/*
Description of the dataflow (http://asciiflow.com/):
     +--------+
     | Source |
     +---+----+
         |
         v
     FormatParse
     (explicit)
         |
         v
     Transforms
(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...)
         |
         v
     FormatParse
     (implicit)
         |
         v
 Binning (in `encoding`)
         |
         v
 Timeunit (in `encoding`)
         |
         v
Formula From Sort Array
         |
         v
      +--+--+
      | Raw |
      +-----+
         |
         v
  Aggregate (in `encoding`)
         |
         v
  Stack (in `encoding`)
         |
         v
  Invalid Filter
         |
         v
   +----------+
   |   Main   |
   +----------+
         |
         v
     +-------+
     | Facet |----> "column", "column-layout", and "row"
     +-------+
         |
         v
  ...Child data...
*/

function parse_parseData(model) {
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;

  var head = parseRoot(model, model.component.data.sources);
  var _model$component$data = model.component.data,
      outputNodes = _model$component$data.outputNodes,
      outputNodeRefCounts = _model$component$data.outputNodeRefCounts;
  var ancestorParse = model.parent ? model.parent.component.data.ancestorParse.clone() : new data_AncestorParse();
  var data = model.data;

  if (isGenerator(data)) {
    // insert generator transform
    if (isSequenceGenerator(data)) {
      head = new sequence_SequenceNode(head, data.sequence);
    } else if (isGraticuleGenerator(data)) {
      head = new graticule_GraticuleNode(head, data.graticule);
    } // no parsing necessary for generator


    ancestorParse.parseNothing = true;
  } else if (((_a = data === null || data === void 0 ? void 0 : data.format) === null || _a === void 0 ? void 0 : _a.parse) === null) {
    // format.parse: null means disable parsing
    ancestorParse.parseNothing = true;
  }

  head = (_b = formatparse_ParseNode.makeExplicit(head, model, ancestorParse)) !== null && _b !== void 0 ? _b : head; // Default discrete selections require an identifer transform to
  // uniquely identify data points. Add this transform at the head of
  // the pipeline such that the identifier field is available for all
  // subsequent datasets. During optimization, we will remove this
  // transform if it proves to be unnecessary. Additional identifier
  // transforms will be necessary when new tuples are constructed
  // (e.g., post-aggregation).

  head = new identifier_IdentifierNode(head); // HACK: This is equivalent for merging bin extent for union scale.
  // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale

  var parentIsLayer = model.parent && isLayerModel(model.parent);

  if (isUnitModel(model) || isFacetModel(model)) {
    if (parentIsLayer) {
      head = (_c = bin_BinNode.makeFromEncoding(head, model)) !== null && _c !== void 0 ? _c : head;
    }
  }

  if (model.transforms.length > 0) {
    head = parseTransformArray(head, model, ancestorParse);
  } // create parse nodes for fields that need to be parsed (or flattened) implicitly


  var implicitSelection = getImplicitFromSelection(model);
  var implicitEncoding = getImplicitFromEncoding(model);
  head = (_d = formatparse_ParseNode.makeWithAncestors(head, {}, Object.assign(Object.assign({}, implicitSelection), implicitEncoding), ancestorParse)) !== null && _d !== void 0 ? _d : head;

  if (isUnitModel(model)) {
    head = geojson_GeoJSONNode.parseAll(head, model);
    head = geopoint_GeoPointNode.parseAll(head, model);
  }

  if (isUnitModel(model) || isFacetModel(model)) {
    if (!parentIsLayer) {
      head = (_e = bin_BinNode.makeFromEncoding(head, model)) !== null && _e !== void 0 ? _e : head;
    }

    head = (_f = timeunit_TimeUnitNode.makeFromEncoding(head, model)) !== null && _f !== void 0 ? _f : head;
    head = calculate_CalculateNode.parseAllForSortIndex(head, model);
  } // add an output node pre aggregation


  var rawName = model.getName(RAW);
  var raw = new dataflow_OutputNode(head, rawName, RAW, outputNodeRefCounts);
  outputNodes[rawName] = raw;
  head = raw;

  if (isUnitModel(model)) {
    var agg = aggregate_AggregateNode.makeFromEncoding(head, model);

    if (agg) {
      head = agg;

      if (requiresSelectionId(model)) {
        head = new identifier_IdentifierNode(head);
      }
    }

    head = (_g = impute_ImputeNode.makeFromEncoding(head, model)) !== null && _g !== void 0 ? _g : head;
    head = (_h = stack_StackNode.makeFromEncoding(head, model)) !== null && _h !== void 0 ? _h : head;
  }

  if (isUnitModel(model)) {
    head = (_j = filterinvalid_FilterInvalidNode.make(head, model)) !== null && _j !== void 0 ? _j : head;
  } // output node for marks


  var mainName = model.getName(MAIN);
  var main = new dataflow_OutputNode(head, mainName, MAIN, outputNodeRefCounts);
  outputNodes[mainName] = main;
  head = main;

  if (isUnitModel(model)) {
    materializeSelections(model, main);
  } // add facet marker


  var facetRoot = null;

  if (isFacetModel(model)) {
    var facetName = model.getName('facet'); // Derive new aggregate for facet's sort field
    // augment data source with new fields for crossed facet

    head = (_k = makeJoinAggregateFromFacet(head, model.facet)) !== null && _k !== void 0 ? _k : head;
    facetRoot = new facet_FacetNode(head, model, facetName, main.getSource());
    outputNodes[facetName] = facetRoot;
    head = facetRoot;
  }

  return Object.assign(Object.assign({}, model.component.data), {
    outputNodes: outputNodes,
    outputNodeRefCounts: outputNodeRefCounts,
    raw: raw,
    main: main,
    facetRoot: facetRoot,
    ancestorParse: ancestorParse
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/concat.js





















var concat_ConcatModel = /*#__PURE__*/function (_Model) {
  _inherits(ConcatModel, _Model);

  var _super = _createSuper(ConcatModel);

  function ConcatModel(spec, parent, parentGivenName, config) {
    var _this;

    _classCallCheck(this, ConcatModel);

    var _a, _b, _c, _d;

    _this = _super.call(this, spec, 'concat', parent, parentGivenName, config, spec.resolve);

    if (((_b = (_a = spec.resolve) === null || _a === void 0 ? void 0 : _a.axis) === null || _b === void 0 ? void 0 : _b.x) === 'shared' || ((_d = (_c = spec.resolve) === null || _c === void 0 ? void 0 : _c.axis) === null || _d === void 0 ? void 0 : _d.y) === 'shared') {
      log_warn(message.CONCAT_CANNOT_SHARE_AXIS);
    }

    _this.children = _this.getChildren(spec).map(function (child, i) {
      return buildModel(child, _assertThisInitialized(_this), _this.getName('concat_' + i), undefined, config);
    });
    return _this;
  }

  _createClass(ConcatModel, [{
    key: "parseData",
    value: function parseData() {
      this.component.data = parse_parseData(this);
      this.children.forEach(function (child) {
        child.parseData();
      });
    }
  }, {
    key: "parseSelections",
    value: function parseSelections() {
      // Merge selections up the hierarchy so that they may be referenced
      // across unit specs. Persist their definitions within each child
      // to assemble signals which remain within output Vega unit groups.
      this.component.selection = {};

      var _iterator = _createForOfIteratorHelper(this.children),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var child = _step.value;
          child.parseSelections();

          var _iterator2 = _createForOfIteratorHelper(util_keys(child.component.selection)),
              _step2;

          try {
            for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
              var key = _step2.value;
              this.component.selection[key] = child.component.selection[key];
            }
          } catch (err) {
            _iterator2.e(err);
          } finally {
            _iterator2.f();
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
    }
  }, {
    key: "parseMarkGroup",
    value: function parseMarkGroup() {
      var _iterator3 = _createForOfIteratorHelper(this.children),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var child = _step3.value;
          child.parseMarkGroup();
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }
    }
  }, {
    key: "parseAxesAndHeaders",
    value: function parseAxesAndHeaders() {
      var _iterator4 = _createForOfIteratorHelper(this.children),
          _step4;

      try {
        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
          var child = _step4.value;
          child.parseAxesAndHeaders();
        } // TODO(#2415): support shared axes

      } catch (err) {
        _iterator4.e(err);
      } finally {
        _iterator4.f();
      }
    }
  }, {
    key: "getChildren",
    value: function getChildren(spec) {
      if (isVConcatSpec(spec)) {
        return spec.vconcat;
      } else if (isHConcatSpec(spec)) {
        return spec.hconcat;
      }

      return spec.concat;
    }
  }, {
    key: "parseLayoutSize",
    value: function parseLayoutSize() {
      parseConcatLayoutSize(this);
    }
  }, {
    key: "parseAxisGroup",
    value: function parseAxisGroup() {
      return null;
    }
  }, {
    key: "assembleSelectionTopLevelSignals",
    value: function assembleSelectionTopLevelSignals(signals) {
      return this.children.reduce(function (sg, child) {
        return child.assembleSelectionTopLevelSignals(sg);
      }, signals);
    }
  }, {
    key: "assembleSignals",
    value: function assembleSignals() {
      this.children.forEach(function (child) {
        return child.assembleSignals();
      });
      return [];
    }
  }, {
    key: "assembleLayoutSignals",
    value: function assembleLayoutSignals() {
      var layoutSignals = assemble_assembleLayoutSignals(this);

      var _iterator5 = _createForOfIteratorHelper(this.children),
          _step5;

      try {
        for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
          var child = _step5.value;
          layoutSignals.push.apply(layoutSignals, _toConsumableArray(child.assembleLayoutSignals()));
        }
      } catch (err) {
        _iterator5.e(err);
      } finally {
        _iterator5.f();
      }

      return layoutSignals;
    }
  }, {
    key: "assembleSelectionData",
    value: function assembleSelectionData(data) {
      return this.children.reduce(function (db, child) {
        return child.assembleSelectionData(db);
      }, data);
    }
  }, {
    key: "assembleMarks",
    value: function assembleMarks() {
      // only children have marks
      return this.children.map(function (child) {
        var title = child.assembleTitle();
        var style = child.assembleGroupStyle();
        var encodeEntry = child.assembleGroupEncodeEntry(false);
        return Object.assign(Object.assign(Object.assign(Object.assign({
          type: 'group',
          name: child.getName('group')
        }, title ? {
          title: title
        } : {}), style ? {
          style: style
        } : {}), encodeEntry ? {
          encode: {
            update: encodeEntry
          }
        } : {}), child.assembleGroup());
      });
    }
  }, {
    key: "assembleDefaultLayout",
    value: function assembleDefaultLayout() {
      var columns = this.layout.columns;
      return Object.assign(Object.assign({}, columns != null ? {
        columns: columns
      } : {}), {
        bounds: 'full',
        // Use align each so it can work with multiple plots with different size
        align: 'each'
      });
    }
  }]);

  return ConcatModel;
}(model_Model);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/axis/component.js









function isFalseOrNull(v) {
  return v === false || v === null;
}

var AXIS_COMPONENT_PROPERTIES_INDEX = Object.assign(Object.assign({
  disable: 1,
  gridScale: 1,
  scale: 1
}, COMMON_AXIS_PROPERTIES_INDEX), {
  labelExpr: 1,
  encode: 1
});
var AXIS_COMPONENT_PROPERTIES = util_keys(AXIS_COMPONENT_PROPERTIES_INDEX);
var component_AxisComponent = /*#__PURE__*/function (_Split) {
  _inherits(AxisComponent, _Split);

  var _super = _createSuper(AxisComponent);

  function AxisComponent() {
    var _this;

    var explicit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var implicit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    var mainExtracted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

    _classCallCheck(this, AxisComponent);

    _this = _super.call(this);
    _this.explicit = explicit;
    _this.implicit = implicit;
    _this.mainExtracted = mainExtracted;
    return _this;
  }

  _createClass(AxisComponent, [{
    key: "clone",
    value: function clone() {
      return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted);
    }
  }, {
    key: "hasAxisPart",
    value: function hasAxisPart(part) {
      // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme.
      if (part === 'axis') {
        // always has the axis container part
        return true;
      }

      if (part === 'grid' || part === 'title') {
        return !!this.get(part);
      } // Other parts are enabled by default, so they should not be false or null.


      return !isFalseOrNull(this.get(part));
    }
  }]);

  return AxisComponent;
}(split_Split);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/axis/encode.js




function axis_encode_labels(model, channel, specifiedLabelsSpec) {
  var _a;

  var fieldDef = (_a = model.fieldDef(channel)) !== null && _a !== void 0 ? _a : channel === 'x' ? model.fieldDef('x2') : channel === 'y' ? model.fieldDef('y2') : undefined;
  var axis = model.axis(channel) || {};
  var format = axis.format,
      formatType = axis.formatType;
  var config = model.config;
  var text = formatSignalRef({
    fieldDef: fieldDef,
    field: 'datum.value',
    format: format,
    formatType: formatType,
    config: config,
    isUTCScale: model.getScaleComponent(channel).get('type') === ScaleType.UTC,
    omitTimeFormatConfig: true,
    omitNumberFormatAndEmptyTimeFormat: true // no need to generate number format for encoding block as we can use Vega's axis format

  });
  var labelsSpec = Object.assign(Object.assign({}, text ? {
    text: text
  } : {}), specifiedLabelsSpec);
  labelsSpec = Object.assign(Object.assign({}, labelsSpec), specifiedLabelsSpec);
  return util_keys(labelsSpec).length === 0 ? undefined : labelsSpec;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/axis/parse.js
























function parseUnitAxes(model) {
  return POSITION_SCALE_CHANNELS.reduce(function (axis, channel) {
    if (model.component.scales[channel]) {
      axis[channel] = [parse_parseAxis(channel, model)];
    }

    return axis;
  }, {});
}
var OPPOSITE_ORIENT = {
  bottom: 'top',
  top: 'bottom',
  left: 'right',
  right: 'left'
};
function parseLayerAxes(model) {
  var _a;

  var _model$component = model.component,
      axes = _model$component.axes,
      resolve = _model$component.resolve;
  var axisCount = {
    top: 0,
    bottom: 0,
    right: 0,
    left: 0
  };

  var _iterator = _createForOfIteratorHelper(model.children),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var _child = _step.value;

      _child.parseAxesAndHeaders();

      var _iterator5 = _createForOfIteratorHelper(util_keys(_child.component.axes)),
          _step5;

      try {
        for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
          var _channel = _step5.value;
          resolve.axis[_channel] = parseGuideResolve(model.component.resolve, _channel);

          if (resolve.axis[_channel] === 'shared') {
            // If the resolve says shared (and has not been overridden)
            // We will try to merge and see if there is a conflict
            axes[_channel] = mergeAxisComponents(axes[_channel], _child.component.axes[_channel]);

            if (!axes[_channel]) {
              // If merge returns nothing, there is a conflict so we cannot make the axis shared.
              // Thus, mark axis as independent and remove the axis component.
              resolve.axis[_channel] = 'independent';
              delete axes[_channel];
            }
          }
        }
      } catch (err) {
        _iterator5.e(err);
      } finally {
        _iterator5.f();
      }
    } // Move axes to layer's axis component and merge shared axes

  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  for (var _i = 0, _arr = [channel_X, channel_Y]; _i < _arr.length; _i++) {
    var channel = _arr[_i];

    var _iterator2 = _createForOfIteratorHelper(model.children),
        _step2;

    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var child = _step2.value;

        if (!child.component.axes[channel]) {
          // skip if the child does not have a particular axis
          continue;
        }

        if (resolve.axis[channel] === 'independent') {
          // If axes are independent, concat the axisComponent array.
          axes[channel] = ((_a = axes[channel]) !== null && _a !== void 0 ? _a : []).concat(child.component.axes[channel]); // Automatically adjust orient

          var _iterator4 = _createForOfIteratorHelper(child.component.axes[channel]),
              _step4;

          try {
            for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
              var axisComponent = _step4.value;

              var _axisComponent$getWit = axisComponent.getWithExplicit('orient'),
                  orient = _axisComponent$getWit.value,
                  explicit = _axisComponent$getWit.explicit;

              if (axisCount[orient] > 0 && !explicit) {
                // Change axis orient if the number do not match
                var oppositeOrient = OPPOSITE_ORIENT[orient];

                if (axisCount[orient] > axisCount[oppositeOrient]) {
                  axisComponent.set('orient', oppositeOrient, false);
                }
              }

              axisCount[orient]++; // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset?
            }
          } catch (err) {
            _iterator4.e(err);
          } finally {
            _iterator4.f();
          }
        } // After merging, make sure to remove axes from child


        delete child.component.axes[channel];
      } // Suppress grid lines for dual axis charts (https://github.com/vega/vega-lite/issues/4676)

    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }

    if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) {
      var _iterator3 = _createForOfIteratorHelper(axes[channel]),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var axisCmpt = _step3.value;

          if (!!axisCmpt.get('grid') && !axisCmpt.explicit.grid) {
            axisCmpt.implicit.grid = false;
          }
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }
    }
  }
}

function mergeAxisComponents(mergedAxisCmpts, childAxisCmpts) {
  if (mergedAxisCmpts) {
    // FIXME: this is a bit wrong once we support multiple axes
    if (mergedAxisCmpts.length !== childAxisCmpts.length) {
      return undefined; // Cannot merge axis component with different number of axes.
    }

    var length = mergedAxisCmpts.length;

    for (var i = 0; i < length; i++) {
      var merged = mergedAxisCmpts[i];
      var child = childAxisCmpts[i];

      if (!!merged !== !!child) {
        return undefined;
      } else if (merged && child) {
        var mergedOrient = merged.getWithExplicit('orient');
        var childOrient = child.getWithExplicit('orient');

        if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {
          // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)
          // Cannot merge due to inconsistent orient
          return undefined;
        } else {
          mergedAxisCmpts[i] = mergeAxisComponent(merged, child);
        }
      }
    }
  } else {
    // For first one, return a copy of the child
    return childAxisCmpts.map(function (axisComponent) {
      return axisComponent.clone();
    });
  }

  return mergedAxisCmpts;
}

function mergeAxisComponent(merged, child) {
  var _iterator6 = _createForOfIteratorHelper(AXIS_COMPONENT_PROPERTIES),
      _step6;

  try {
    var _loop = function _loop() {
      var prop = _step6.value;
      var mergedValueWithExplicit = mergeValuesWithExplicit(merged.getWithExplicit(prop), child.getWithExplicit(prop), prop, 'axis', // Tie breaker function
      function (v1, v2) {
        switch (prop) {
          case 'title':
            return mergeTitleComponent(v1, v2);

          case 'gridScale':
            return {
              explicit: v1.explicit,
              value: getFirstDefined(v1.value, v2.value)
            };
        }

        return defaultTieBreaker(v1, v2, prop, 'axis');
      });
      merged.setWithExplicit(prop, mergedValueWithExplicit);
    };

    for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
      _loop();
    }
  } catch (err) {
    _iterator6.e(err);
  } finally {
    _iterator6.f();
  }

  return merged;
}

function getFieldDefTitle(model, channel) {
  var channel2 = channel === 'x' ? 'x2' : 'y2';
  var fieldDef = model.fieldDef(channel);
  var fieldDef2 = model.fieldDef(channel2);
  var title1 = fieldDef ? fieldDef.title : undefined;
  var title2 = fieldDef2 ? fieldDef2.title : undefined;

  if (title1 && title2) {
    return mergeTitle(title1, title2);
  } else if (title1) {
    return title1;
  } else if (title2) {
    return title2;
  } else if (title1 !== undefined) {
    // falsy value to disable config
    return title1;
  } else if (title2 !== undefined) {
    // falsy value to disable config
    return title2;
  }

  return undefined;
}

function parse_isExplicit(value, property, axis, model, channel) {
  if (property === 'disable') {
    return axis !== undefined; // if axis is specified or null/false, then it's enable/disable state is explicit
  }

  axis = axis || {};

  switch (property) {
    case 'titleAngle':
    case 'labelAngle':
      return value === normalizeAngle(axis[property]);

    case 'values':
      return !!axis.values;
    // specified axis.values is already respected, but may get transformed.

    case 'encode':
      // both VL axis.encoding and axis.labelAngle affect VG axis.encode
      return !!axis.encoding || !!axis.labelAngle;

    case 'title':
      // title can be explicit if fieldDef.title is set
      if (value === getFieldDefTitle(model, channel)) {
        return true;
      }

  } // Otherwise, things are explicit if the returned value matches the specified property


  return value === axis[property];
}

var TYPE_SUFFIX = ['Band', 'Point', 'Discrete', 'Quantitative', 'Temporal'];
var ORIENTATION_TYPE_AXIS_CONFIG_INDEX = toSet([].concat(_toConsumableArray(TYPE_SUFFIX.map(function (t) {
  return "axisX".concat(t);
})), _toConsumableArray(TYPE_SUFFIX.map(function (t) {
  return "axisY".concat(t);
}))));

function parse_parseAxis(channel, model) {
  var _a;

  var axis = model.axis(channel);
  var axisComponent = new component_AxisComponent(); // 1.2. Add properties

  var _iterator7 = _createForOfIteratorHelper(AXIS_COMPONENT_PROPERTIES),
      _step7;

  try {
    for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
      var property = _step7.value;
      var value = parse_getProperty(property, axis, channel, model);

      var _ref = isAxisProperty(property) ? getAxisConfig(property, model.config, channel, axisComponent.get('orient'), model.getScaleComponent(channel).get('type'), axis === null || axis === void 0 ? void 0 : axis.style) : {},
          _ref$configValue = _ref.configValue,
          configValue = _ref$configValue === void 0 ? undefined : _ref$configValue,
          _ref$configFrom = _ref.configFrom,
          configFrom = _ref$configFrom === void 0 ? undefined : _ref$configFrom;

      var explicit = parse_isExplicit(value, property, axis, model, channel);

      if (value !== undefined && (explicit || configValue === undefined)) {
        // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config)
        axisComponent.set(property, value, explicit);
      } else if ( // Cases that we need to implicit values
      // 1. Grid, orient, and tickCount
      // - Grid is an exception because we need to set grid = true to generate another grid axis
      // - Orient, labelExpr, and tickCount are not axis configs in Vega, so we need to set too.
      util_contains(['grid', 'orient', 'tickCount', 'labelExpr'], property) && configValue || // 2. Conditional axis values and signals
      isConditionalAxisValue(configValue) || // need to set "any" as TS isn't smart enough to figure the generic parameter type yet
      isSignalRef(configValue) || // 3. StyleAxis
      util_contains(['style', 'axis-config-style'], configFrom) || // 4. Vega-Lite only config
      util_contains(['axisQuantitative', 'axisTemporal'], configFrom) || configFrom in ORIENTATION_TYPE_AXIS_CONFIG_INDEX // axisXTemporal, ...
      ) {
        // If a config is specified and is conditional, copy conditional value from axis config
        axisComponent.set(property, configValue, false);
      }
    } // 2) Add guide encode definition groups

  } catch (err) {
    _iterator7.e(err);
  } finally {
    _iterator7.f();
  }

  var axisEncoding = (_a = axis === null || axis === void 0 ? void 0 : axis.encoding) !== null && _a !== void 0 ? _a : {};
  var axisEncode = AXIS_PARTS.reduce(function (e, part) {
    var _a;

    if (!axisComponent.hasAxisPart(part)) {
      // No need to create encode for a disabled part.
      return e;
    }

    var axisEncodingPart = guideEncodeEntry((_a = axisEncoding[part]) !== null && _a !== void 0 ? _a : {}, model);
    var value = part === 'labels' ? axis_encode_labels(model, channel, axisEncodingPart) : axisEncodingPart;

    if (value !== undefined && util_keys(value).length > 0) {
      e[part] = {
        update: value
      };
    }

    return e;
  }, {}); // FIXME: By having encode as one property, we won't have fine grained encode merging.

  if (util_keys(axisEncode).length > 0) {
    axisComponent.set('encode', axisEncode, !!(axis === null || axis === void 0 ? void 0 : axis.encoding) || (axis === null || axis === void 0 ? void 0 : axis.labelAngle) !== undefined);
  }

  return axisComponent;
}

function parse_getProperty(property, specifiedAxis, channel, model) {
  if (property === 'disable') {
    return specifiedAxis !== undefined && !specifiedAxis;
  }

  specifiedAxis = specifiedAxis || {}; // assign object so the rest doesn't have to check if legend exists

  var fieldDef = model.fieldDef(channel);
  var mark = model.mark,
      config = model.config;

  switch (property) {
    case 'scale':
      return model.scaleName(channel);

    case 'gridScale':
      return gridScale(model, channel);

    case 'format':
      // We don't include temporal field and custom format as we apply format in encode block
      if (isFieldDefForTimeFormat(fieldDef) || isFieldDefWithCustomTimeFormat(fieldDef)) {
        return undefined;
      }

      return numberFormat(fieldDef, specifiedAxis.format, config);

    case 'formatType':
      // As with format, we don't include temporal field and custom format here as we apply format in encode block
      if (isFieldDefForTimeFormat(fieldDef) || isFieldDefWithCustomTimeFormat(fieldDef)) {
        return undefined;
      }

      return specifiedAxis.formatType;

    case 'grid':
      {
        if (isBinned(model.fieldDef(channel).bin)) {
          return false;
        } else {
          var scaleType = model.getScaleComponent(channel).get('type');
          return getFirstDefined(specifiedAxis.grid, defaultGrid(scaleType, fieldDef));
        }
      }

    case 'labelAlign':
      {
        var orient = getFirstDefined(specifiedAxis.orient, properties_orient(channel));
        var labelAngle = properties_labelAngle(model, specifiedAxis, channel, fieldDef);
        return getFirstDefined(specifiedAxis.labelAlign, defaultLabelAlign(labelAngle, orient));
      }

    case 'labelAngle':
      {
        var _labelAngle = properties_labelAngle(model, specifiedAxis, channel, fieldDef);

        return _labelAngle;
      }

    case 'labelBaseline':
      {
        var _orient = getFirstDefined(specifiedAxis.orient, properties_orient(channel));

        var _labelAngle2 = properties_labelAngle(model, specifiedAxis, channel, fieldDef);

        return getFirstDefined(specifiedAxis.labelBaseline, defaultLabelBaseline(_labelAngle2, _orient));
      }

    case 'labelFlush':
      return getFirstDefined(specifiedAxis.labelFlush, defaultLabelFlush(fieldDef, channel));

    case 'labelOverlap':
      {
        var _scaleType = model.getScaleComponent(channel).get('type');

        return getFirstDefined(specifiedAxis.labelOverlap, defaultLabelOverlap(fieldDef, _scaleType));
      }

    case 'orient':
      {
        var _orient2 = getFirstDefined(specifiedAxis.orient, properties_orient(channel));

        return _orient2;
      }

    case 'tickCount':
      {
        var _scaleType2 = model.getScaleComponent(channel).get('type');

        var sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;
        var size = sizeType ? model.getSizeSignalRef(sizeType) : undefined;
        return getFirstDefined(specifiedAxis.tickCount, defaultTickCount({
          fieldDef: fieldDef,
          scaleType: _scaleType2,
          size: size
        }));
      }

    case 'title':
      {
        var channel2 = channel === 'x' ? 'x2' : 'y2';
        var fieldDef2 = model.fieldDef(channel2); // Keep undefined so we use default if title is unspecified.
        // For other falsy value, keep them so we will hide the title.

        return getFirstDefined(specifiedAxis.title, getFieldDefTitle(model, channel), // If title not specified, store base parts of fieldDef (and fieldDef2 if exists)
        mergeTitleFieldDefs([toFieldDefBase(fieldDef)], fieldDef2 ? [toFieldDefBase(fieldDef2)] : []));
      }

    case 'values':
      return properties_values(specifiedAxis, model, fieldDef);

    case 'zindex':
      return getFirstDefined(specifiedAxis.zindex, defaultZindex(mark, fieldDef));
  } // Otherwise, return specified property.


  return isAxisProperty(property) ? specifiedAxis[property] : undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/layoutsize/init.js





function initLayoutSize(_ref) {
  var encoding = _ref.encoding,
      size = _ref.size;

  var _iterator = _createForOfIteratorHelper(POSITION_SCALE_CHANNELS),
      _step;

  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var channel = _step.value;
      var sizeType = getSizeType(channel);
      var fieldDef = getFieldDef(encoding[channel]);

      if (isStep(size[sizeType])) {
        if (fieldDef) {
          if (channeldef_isContinuous(fieldDef)) {
            delete size[sizeType];
            log_warn(message.stepDropped(sizeType));
          }
        }
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }

  return size;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/init.js










function initMarkdef(mark, encoding, config, _ref) {
  var graticule = _ref.graticule;

  var _a, _b, _c;

  var markDef = isMarkDef(mark) ? Object.assign({}, mark) : {
    type: mark
  }; // set orient, which can be overridden by rules as sometimes the specified orient is invalid.

  var specifiedOrient = (_a = markDef.orient) !== null && _a !== void 0 ? _a : getMarkConfig('orient', markDef, config);
  markDef.orient = init_orient(markDef.type, encoding, specifiedOrient);

  if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) {
    log_warn(message.orientOverridden(markDef.orient, specifiedOrient));
  }

  if (markDef.type === 'bar' && markDef.orient) {
    var cornerRadiusEnd = (_b = markDef.cornerRadiusEnd) !== null && _b !== void 0 ? _b : getMarkConfig('cornerRadiusEnd', // FIXME: make the typing work with getMarkConfig()
    markDef, config);

    if (cornerRadiusEnd !== undefined) {
      var newProps = markDef.orient === 'horizontal' && encoding.x2 || markDef.orient === 'vertical' && encoding.y2 ? ['cornerRadius'] : BAR_CORNER_RADIUS_INDEX[markDef.orient];

      var _iterator = _createForOfIteratorHelper(newProps),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var newProp = _step.value;
          markDef[newProp] = cornerRadiusEnd;
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      if (markDef.cornerRadiusEnd !== undefined) {
        delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius
      }
    }
  } // set opacity and filled if not specified in mark config


  var specifiedOpacity = getFirstDefined(markDef.opacity, getMarkConfig('opacity', markDef, config));

  if (specifiedOpacity === undefined) {
    markDef.opacity = init_opacity(markDef.type, encoding);
  }

  var specifiedFilled = markDef.filled;

  if (specifiedFilled === undefined) {
    markDef.filled = graticule ? false : init_filled(markDef, config);
  } // set cursor, which should be pointer if href channel is present unless otherwise specified


  var specifiedCursor = (_c = markDef.cursor) !== null && _c !== void 0 ? _c : getMarkConfig('cursor', markDef, config);

  if (specifiedCursor === undefined) {
    markDef.cursor = init_cursor(markDef, encoding, config);
  }

  return markDef;
}

function init_cursor(markDef, encoding, config) {
  if (encoding.href || markDef.href || getMarkConfig('href', markDef, config)) {
    return 'pointer';
  }

  return markDef.cursor;
}

function init_opacity(mark, encoding) {
  if (util_contains([POINT, TICK, CIRCLE, SQUARE], mark)) {
    // point-based marks
    if (!encoding_isAggregate(encoding)) {
      return 0.7;
    }
  }

  return undefined;
}

function init_filled(markDef, config) {
  var filledConfig = getMarkConfig('filled', markDef, config);
  var mark = markDef.type;
  return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE);
}

function init_orient(mark, encoding, specifiedOrient) {
  switch (mark) {
    case POINT:
    case CIRCLE:
    case SQUARE:
    case TEXT:
    case RECT:
    case IMAGE:
      // orient is meaningless for these marks.
      return undefined;
  }

  var x = encoding.x,
      y = encoding.y,
      x2 = encoding.x2,
      y2 = encoding.y2;

  switch (mark) {
    case BAR:
      if (isFieldDef(x) && (isBinned(x.bin) || isFieldDef(y) && y.aggregate && !x.aggregate)) {
        return 'vertical';
      }

      if (isFieldDef(y) && (isBinned(y.bin) || isFieldDef(x) && x.aggregate && !y.aggregate)) {
        return 'horizontal';
      }

      if (y2 || x2) {
        // Ranged bar does not always have clear orientation, so we allow overriding
        if (specifiedOrient) {
          return specifiedOrient;
        } // If y is range and x is non-range, non-bin Q, y is likely a prebinned field


        if (!x2 && isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) {
          return 'horizontal';
        } // If x is range and y is non-range, non-bin Q, x is likely a prebinned field


        if (!y2 && isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) {
          return 'vertical';
        }
      }

    // falls through

    case RULE:
      // return undefined for line segment rule and bar with both axis ranged
      // we have to ignore the case that the data are already binned
      if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) {
        return undefined;
      }

    // falls through

    case AREA:
      // If there are range for both x and y, y (vertical) has higher precedence.
      if (y2) {
        if (isFieldDef(y) && isBinned(y.bin)) {
          return 'horizontal';
        } else {
          return 'vertical';
        }
      } else if (x2) {
        if (isFieldDef(x) && isBinned(x.bin)) {
          return 'vertical';
        } else {
          return 'horizontal';
        }
      } else if (mark === RULE) {
        if (x && !y) {
          return 'vertical';
        } else if (y && !x) {
          return 'horizontal';
        }
      }

    // falls through

    case LINE:
    case TICK:
      {
        // Tick is opposite to bar, line, area and never have ranged mark.
        var xIsContinuous = isFieldDef(x) && channeldef_isContinuous(x);
        var yIsContinuous = isFieldDef(y) && channeldef_isContinuous(y);

        if (xIsContinuous && !yIsContinuous) {
          return mark !== 'tick' ? 'horizontal' : 'vertical';
        } else if (!xIsContinuous && yIsContinuous) {
          return mark !== 'tick' ? 'vertical' : 'horizontal';
        } else if (xIsContinuous && yIsContinuous) {
          var xDef = x; // we can cast here since they are surely fieldDef

          var yDef = y;
          var xIsTemporal = xDef.type === TEMPORAL;
          var yIsTemporal = yDef.type === TEMPORAL; // temporal without timeUnit is considered continuous, but better serves as dimension

          if (xIsTemporal && !yIsTemporal) {
            return mark !== 'tick' ? 'vertical' : 'horizontal';
          } else if (!xIsTemporal && yIsTemporal) {
            return mark !== 'tick' ? 'horizontal' : 'vertical';
          }

          if (!xDef.aggregate && yDef.aggregate) {
            return mark !== 'tick' ? 'vertical' : 'horizontal';
          } else if (xDef.aggregate && !yDef.aggregate) {
            return mark !== 'tick' ? 'horizontal' : 'vertical';
          }

          if (specifiedOrient) {
            // When ambiguous, use user specified one.
            return specifiedOrient;
          }

          return 'vertical';
        } else {
          // Discrete x Discrete case
          if (specifiedOrient) {
            // When ambiguous, use user specified one.
            return specifiedOrient;
          }

          return undefined;
        }
      }
  }

  return 'vertical';
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/area.js


var area_area = {
  vgMark: 'area',
  encodeEntry: function encodeEntry(model) {
    return Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
      align: 'ignore',
      baseline: 'ignore',
      color: 'include',
      orient: 'include',
      size: 'ignore'
    })), pointOrRangePosition('x', model, {
      defaultPos: 'zeroOrMin',
      defaultPos2: 'zeroOrMin',
      range: model.markDef.orient === 'horizontal'
    })), pointOrRangePosition('y', model, {
      defaultPos: 'zeroOrMin',
      defaultPos2: 'zeroOrMin',
      range: model.markDef.orient === 'vertical'
    })), defined_defined(model));
  }
};
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/bar.js


var bar = {
  vgMark: 'rect',
  encodeEntry: function encodeEntry(model) {
    return Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
      align: 'ignore',
      baseline: 'ignore',
      color: 'include',
      orient: 'ignore',
      size: 'ignore'
    })), rectPosition(model, 'x', 'bar')), rectPosition(model, 'y', 'bar'));
  }
};
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/geoshape.js




var geoshape = {
  vgMark: 'shape',
  encodeEntry: function encodeEntry(model) {
    return Object.assign({}, baseEncodeEntry(model, {
      align: 'ignore',
      baseline: 'ignore',
      color: 'include',
      size: 'ignore',
      orient: 'ignore'
    }));
  },
  postEncodingTransform: function postEncodingTransform(model) {
    var encoding = model.encoding;
    var shapeDef = encoding.shape;
    var transform = Object.assign({
      type: 'geoshape',
      projection: model.projectionName()
    }, shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON ? {
      field: channeldef_vgField(shapeDef, {
        expr: 'datum'
      })
    } : {});
    return [transform];
  }
};
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/image.js


var image_image = {
  vgMark: 'image',
  encodeEntry: function encodeEntry(model) {
    return Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
      align: 'ignore',
      baseline: 'ignore',
      color: 'ignore',
      orient: 'ignore',
      size: 'ignore'
    })), rectPosition(model, 'x', 'image')), rectPosition(model, 'y', 'image')), text_text(model, 'url'));
  }
};
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/line.js


var line_line = {
  vgMark: 'line',
  encodeEntry: function encodeEntry(model) {
    return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
      align: 'ignore',
      baseline: 'ignore',
      color: 'include',
      size: 'ignore',
      orient: 'ignore'
    })), pointPosition('x', model, {
      defaultPos: 'mid'
    })), pointPosition('y', model, {
      defaultPos: 'mid'
    })), nonPosition('size', model, {
      vgChannel: 'strokeWidth' // VL's line size is strokeWidth

    })), defined_defined(model));
  }
};
var line_trail = {
  vgMark: 'trail',
  encodeEntry: function encodeEntry(model) {
    return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
      align: 'ignore',
      baseline: 'ignore',
      color: 'include',
      size: 'include',
      orient: 'ignore'
    })), pointPosition('x', model, {
      defaultPos: 'mid'
    })), pointPosition('y', model, {
      defaultPos: 'mid'
    })), nonPosition('size', model)), defined_defined(model));
  }
};
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/point.js



function _encodeEntry(model, fixedShape) {
  var config = model.config;
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
    align: 'ignore',
    baseline: 'ignore',
    color: 'include',
    size: 'include',
    orient: 'ignore'
  })), pointPosition('x', model, {
    defaultPos: 'mid'
  })), pointPosition('y', model, {
    defaultPos: 'mid'
  })), nonPosition('size', model)), shapeMixins(model, config, fixedShape));
}

function shapeMixins(model, config, fixedShape) {
  if (fixedShape) {
    return {
      shape: {
        value: fixedShape
      }
    };
  }

  return nonPosition('shape', model);
}
var point_point = {
  vgMark: 'symbol',
  encodeEntry: function encodeEntry(model) {
    return _encodeEntry(model);
  }
};
var point_circle = {
  vgMark: 'symbol',
  encodeEntry: function encodeEntry(model) {
    return _encodeEntry(model, 'circle');
  }
};
var point_square = {
  vgMark: 'symbol',
  encodeEntry: function encodeEntry(model) {
    return _encodeEntry(model, 'square');
  }
};
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/rect.js


var rect_rect = {
  vgMark: 'rect',
  encodeEntry: function encodeEntry(model) {
    return Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
      align: 'ignore',
      baseline: 'ignore',
      color: 'include',
      orient: 'ignore',
      size: 'ignore'
    })), rectPosition(model, 'x', 'rect')), rectPosition(model, 'y', 'rect'));
  }
};
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/rule.js


var rule_rule = {
  vgMark: 'rule',
  encodeEntry: function encodeEntry(model) {
    var markDef = model.markDef;
    var orient = markDef.orient;

    if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) {
      // Show nothing if we have none of x, y, lat, and long.
      return {};
    }

    return Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
      align: 'ignore',
      baseline: 'ignore',
      color: 'include',
      orient: 'ignore',
      size: 'ignore'
    })), pointOrRangePosition('x', model, {
      defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid',
      defaultPos2: 'zeroOrMin',
      range: orient !== 'vertical' // include x2 for horizontal or line segment rule

    })), pointOrRangePosition('y', model, {
      defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid',
      defaultPos2: 'zeroOrMin',
      range: orient !== 'horizontal' // include y2 for vertical or line segment rule

    })), nonPosition('size', model, {
      vgChannel: 'strokeWidth' // VL's rule size is strokeWidth

    }));
  }
};
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/text.js



var mark_text_text = {
  vgMark: 'text',
  encodeEntry: function encodeEntry(model) {
    var config = model.config,
        encoding = model.encoding;
    return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
      align: 'include',
      baseline: 'include',
      color: 'include',
      size: 'ignore',
      orient: 'ignore'
    })), pointPosition('x', model, {
      defaultPos: 'mid'
    })), pointPosition('y', model, {
      defaultPos: 'mid'
    })), text_text(model)), nonPosition('size', model, {
      vgChannel: 'fontSize' // VL's text size is fontSize

    })), valueIfDefined('align', text_align(model.markDef, encoding, config))), valueIfDefined('baseline', text_baseline(model.markDef, encoding, config)));
  }
};

function text_align(markDef, encoding, config) {
  var _a;

  var a = (_a = markDef.align) !== null && _a !== void 0 ? _a : getMarkConfig('align', markDef, config);

  if (a === undefined) {
    return 'center';
  } // If there is a config, Vega-parser will process this already.


  return undefined;
}

function text_baseline(markDef, encoding, config) {
  var _a;

  var b = (_a = markDef.baseline) !== null && _a !== void 0 ? _a : getMarkConfig('baseline', markDef, config);

  if (b === undefined) {
    return 'middle';
  } // If there is a config, Vega-parser will process this already.


  return undefined;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/tick.js








var tick_tick = {
  vgMark: 'rect',
  encodeEntry: function encodeEntry(model) {
    var config = model.config,
        markDef = model.markDef;
    var orient = markDef.orient;
    var vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';
    var vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width';
    return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseEncodeEntry(model, {
      align: 'ignore',
      baseline: 'ignore',
      color: 'include',
      orient: 'ignore',
      size: 'ignore'
    })), pointPosition('x', model, {
      defaultPos: 'mid',
      vgChannel: 'xc'
    })), pointPosition('y', model, {
      defaultPos: 'mid',
      vgChannel: 'yc'
    })), nonPosition('size', model, {
      defaultValue: tick_defaultSize(model),
      vgChannel: vgSizeChannel
    })), _defineProperty({}, vgThicknessChannel, {
      value: getFirstDefined(markDef.thickness, config.tick.thickness)
    }));
  }
};

function tick_defaultSize(model) {
  var config = model.config,
      markDef = model.markDef;
  var orient = markDef.orient;
  var vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';
  var scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y');
  var markPropOrConfig = getFirstDefined(markDef[vgSizeChannel], markDef.size, getMarkConfig('size', markDef, config, {
    vgChannel: vgSizeChannel
  }), config.tick.bandSize);

  if (markPropOrConfig !== undefined) {
    return markPropOrConfig;
  } else {
    var scaleRange = scale ? scale.get('range') : undefined;

    if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {
      return scaleRange.step * 3 / 4;
    }

    var defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel);
    return defaultViewStep * 3 / 4;
  }
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/mark/mark.js






























var markCompiler = {
  area: area_area,
  bar: bar,
  circle: point_circle,
  geoshape: geoshape,
  image: image_image,
  line: line_line,
  point: point_point,
  rect: rect_rect,
  rule: rule_rule,
  square: point_square,
  text: mark_text_text,
  tick: tick_tick,
  trail: line_trail
};
function parseMarkGroups(model) {
  if (util_contains([LINE, AREA, TRAIL], model.mark)) {
    return parsePathMark(model);
  } else if (util_contains([BAR], model.mark)) {
    return getStackGroups(model);
  } else {
    return getMarkGroups(model);
  }
}
var FACETED_PATH_PREFIX = 'faceted_path_';

function parsePathMark(model) {
  var details = pathGroupingFields(model.mark, model.encoding);
  var pathMarks = getMarkGroups(model, {
    // If has subfacet for line/area group, need to use faceted data from below.
    fromPrefix: details.length > 0 ? FACETED_PATH_PREFIX : ''
  });

  if (details.length > 0) {
    // have level of details - need to facet line into subgroups
    // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?)
    return [{
      name: model.getName('pathgroup'),
      type: 'group',
      from: {
        facet: {
          name: FACETED_PATH_PREFIX + model.requestDataName(MAIN),
          data: model.requestDataName(MAIN),
          groupby: details
        }
      },
      encode: {
        update: {
          width: {
            field: {
              group: 'width'
            }
          },
          height: {
            field: {
              group: 'height'
            }
          }
        }
      },
      marks: pathMarks
    }];
  } else {
    return pathMarks;
  }
}

var STACK_GROUP_PREFIX = 'stack_group_';
/**
 * We need to put stacked bars into groups in order to enable cornerRadius for stacks.
 * If stack is used and the model doesn't have size encoding, we put the mark into groups,
 * and apply cornerRadius properties at the group.
 */

function getStackGroups(model) {
  // Don't use nested groups when cornerRadius is not specified, or specified as 0
  var hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(function (prop) {
    return model.markDef[prop] || getMarkConfig(prop, model.markDef, model.config);
  }); // Activate groups if stack is used and the model doesn't have size encoding

  if (model.stack && !model.fieldDef('size') && hasCornerRadius) {
    // Generate the mark
    var _getMarkGroups = getMarkGroups(model, {
      fromPrefix: STACK_GROUP_PREFIX
    }),
        _getMarkGroups2 = _slicedToArray(_getMarkGroups, 1),
        mark = _getMarkGroups2[0]; // Get the scale for the stacked field


    var fieldScale = model.scaleName(model.stack.fieldChannel);

    var stackField = function stackField() {
      var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      return model.vgField(model.stack.fieldChannel, opt);
    }; // Find the min/max of the pixel value on the stacked direction


    var stackFieldGroup = function stackFieldGroup(func, expr) {
      var vgFieldMinMax = [stackField({
        prefix: 'min',
        suffix: 'start',
        expr: expr
      }), stackField({
        prefix: 'max',
        suffix: 'start',
        expr: expr
      }), stackField({
        prefix: 'min',
        suffix: 'end',
        expr: expr
      }), stackField({
        prefix: 'max',
        suffix: 'end',
        expr: expr
      })];
      return "".concat(func, "(").concat(vgFieldMinMax.map(function (field) {
        return "scale('".concat(fieldScale, "',").concat(field, ")");
      }).join(','), ")");
    };

    var groupUpdate;
    var innerGroupUpdate; // Build the encoding for group and an inner group

    if (model.stack.fieldChannel === 'x') {
      // Move cornerRadius, y/yc/y2/height properties to group
      // Group x/x2 should be the min/max of the marks within
      groupUpdate = Object.assign(Object.assign({}, util_pick(mark.encode.update, ['y', 'yc', 'y2', 'height'].concat(_toConsumableArray(VG_CORNERRADIUS_CHANNELS)))), {
        x: {
          signal: stackFieldGroup('min', 'datum')
        },
        x2: {
          signal: stackFieldGroup('max', 'datum')
        },
        clip: {
          value: true
        }
      }); // Inner group should revert the x translation, and pass height through

      innerGroupUpdate = {
        x: {
          field: {
            group: 'x'
          },
          mult: -1
        },
        height: {
          field: {
            group: 'height'
          }
        }
      }; // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group)
      // This is why size encoding is not supported yet

      mark.encode.update = Object.assign(Object.assign({}, omit(mark.encode.update, ['y', 'yc', 'y2'])), {
        height: {
          field: {
            group: 'height'
          }
        }
      });
    } else {
      groupUpdate = Object.assign(Object.assign({}, util_pick(mark.encode.update, ['x', 'xc', 'x2', 'width'])), {
        y: {
          signal: stackFieldGroup('min', 'datum')
        },
        y2: {
          signal: stackFieldGroup('max', 'datum')
        },
        clip: {
          value: true
        }
      });
      innerGroupUpdate = {
        y: {
          field: {
            group: 'y'
          },
          mult: -1
        },
        width: {
          field: {
            group: 'width'
          }
        }
      };
      mark.encode.update = Object.assign(Object.assign({}, omit(mark.encode.update, ['x', 'xc', 'x2'])), {
        width: {
          field: {
            group: 'width'
          }
        }
      });
    } // Deal with cornerRadius properties


    var _iterator = _createForOfIteratorHelper(VG_CORNERRADIUS_CHANNELS),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var key = _step.value;
        var configValue = getMarkConfig(key, model.markDef, model.config); // Move from mark to group

        if (mark.encode.update[key]) {
          groupUpdate[key] = mark.encode.update[key];
          delete mark.encode.update[key];
        } else if (configValue) {
          groupUpdate[key] = {
            value: configValue
          };
        } // Overwrite any cornerRadius on mark set by config --- they are already moved to the group


        if (configValue) {
          mark.encode.update[key] = {
            value: 0
          };
        }
      } // For bin and time unit, we have to add bin/timeunit -end channels.

    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }

    var groupByField = model.fieldDef(model.stack.groupbyChannel);
    var groupby = channeldef_vgField(groupByField) ? [channeldef_vgField(groupByField)] : [];

    if ((groupByField === null || groupByField === void 0 ? void 0 : groupByField.bin) || (groupByField === null || groupByField === void 0 ? void 0 : groupByField.timeUnit)) {
      groupby.push(channeldef_vgField(groupByField, {
        binSuffix: 'end'
      }));
    }

    var strokeProperties = ['stroke', 'strokeWidth', 'strokeJoin', 'strokeCap', 'strokeDash', 'strokeDashOffset', 'strokeMiterLimit', 'strokeOpacity']; // Generate stroke properties for the group

    groupUpdate = strokeProperties.reduce(function (encode, prop) {
      if (mark.encode.update[prop]) {
        return Object.assign(Object.assign({}, encode), _defineProperty({}, prop, mark.encode.update[prop]));
      } else {
        var configValue = getMarkConfig(prop, model.markDef, model.config);

        if (configValue !== undefined) {
          return Object.assign(Object.assign({}, encode), _defineProperty({}, prop, {
            value: configValue
          }));
        } else {
          return encode;
        }
      }
    }, groupUpdate); // Apply strokeForeground and strokeOffset if stroke is used

    if (groupUpdate.stroke) {
      groupUpdate.strokeForeground = {
        value: true
      };
      groupUpdate.strokeOffset = {
        value: 0
      };
    }

    return [{
      type: 'group',
      from: {
        facet: {
          data: model.requestDataName(MAIN),
          name: STACK_GROUP_PREFIX + model.requestDataName(MAIN),
          groupby: groupby,
          aggregate: {
            fields: [stackField({
              suffix: 'start'
            }), stackField({
              suffix: 'start'
            }), stackField({
              suffix: 'end'
            }), stackField({
              suffix: 'end'
            })],
            ops: ['min', 'max', 'min', 'max']
          }
        }
      },
      encode: {
        update: groupUpdate
      },
      marks: [{
        type: 'group',
        encode: {
          update: innerGroupUpdate
        },
        marks: [mark]
      }]
    }];
  } else {
    return getMarkGroups(model);
  }
}

function mark_getSort(model) {
  var encoding = model.encoding,
      stack = model.stack,
      mark = model.mark,
      markDef = model.markDef,
      config = model.config;
  var order = encoding.order;

  if (!isArray(order) && isValueDef(order) && isNullOrFalse(order.value) || !order && isNullOrFalse(markDef.order) || isNullOrFalse(getMarkConfig('order', markDef, config))) {
    return undefined;
  } else if ((isArray(order) || isFieldDef(order)) && !stack) {
    // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.)
    return sortParams(order, {
      expr: 'datum'
    });
  } else if (isPathMark(mark)) {
    // For both line and area, we sort values based on dimension by default
    var dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';
    var dimensionChannelDef = encoding[dimensionChannel];

    if (isFieldDef(dimensionChannelDef)) {
      var s = dimensionChannelDef.sort;

      if (isArray(s)) {
        return {
          field: channeldef_vgField(dimensionChannelDef, {
            prefix: dimensionChannel,
            suffix: 'sort_index',
            expr: 'datum'
          })
        };
      } else if (isSortField(s)) {
        return {
          field: channeldef_vgField({
            // FIXME: this op might not already exist?
            // FIXME: what if dimensionChannel (x or y) contains custom domain?
            aggregate: encoding_isAggregate(model.encoding) ? s.op : undefined,
            field: s.field
          }, {
            expr: 'datum'
          })
        };
      } else if (isSortByEncoding(s)) {
        var fieldDefToSort = model.fieldDef(s.encoding);
        return {
          field: channeldef_vgField(fieldDefToSort, {
            expr: 'datum'
          }),
          order: s.order
        };
      } else {
        return {
          field: channeldef_vgField(dimensionChannelDef, {
            // For stack with imputation, we only have bin_mid
            binSuffix: model.stack && model.stack.impute ? 'mid' : undefined,
            expr: 'datum'
          })
        };
      }
    }

    return undefined;
  }

  return undefined;
}

function getMarkGroups(model) {
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
    fromPrefix: ''
  };
  var mark = model.mark;
  var clip = getFirstDefined(model.markDef.clip, scaleClip(model), projectionClip(model));
  var style = getStyles(model.markDef);
  var key = model.encoding.key;
  var sort = mark_getSort(model);
  var interactive = interactiveFlag(model);
  var postEncodingTransform = markCompiler[mark].postEncodingTransform ? markCompiler[mark].postEncodingTransform(model) : null;
  return [Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
    name: model.getName('marks'),
    type: markCompiler[mark].vgMark
  }, clip ? {
    clip: true
  } : {}), style ? {
    style: style
  } : {}), key ? {
    key: key.field
  } : {}), sort ? {
    sort: sort
  } : {}), interactive ? interactive : {}), {
    from: {
      data: opt.fromPrefix + model.requestDataName(MAIN)
    },
    encode: {
      update: markCompiler[mark].encodeEntry(model)
    }
  }), postEncodingTransform ? {
    transform: postEncodingTransform
  } : {})];
}
/**
 * If scales are bound to interval selections, we want to automatically clip
 * marks to account for panning/zooming interactions. We identify bound scales
 * by the selectionExtent property, which gets added during scale parsing.
 */


function scaleClip(model) {
  var xScale = model.getScaleComponent('x');
  var yScale = model.getScaleComponent('y');
  return xScale && xScale.get('selectionExtent') || yScale && yScale.get('selectionExtent') ? true : undefined;
}
/**
 * If we use a custom projection with auto-fitting to the geodata extent,
 * we need to clip to ensure the chart size doesn't explode.
 */


function projectionClip(model) {
  var projection = model.component.projection;
  return projection && !projection.isFit ? true : undefined;
}
/**
 * Only output interactive flags if we have selections defined somewhere in our model hierarchy.
 */


function interactiveFlag(model) {
  if (!model.component.selection) return null;
  var unitCount = util_keys(model.component.selection).length;
  var parentCount = unitCount;
  var parent = model.parent;

  while (parent && parentCount === 0) {
    parentCount = util_keys(parent.component.selection).length;
    parent = parent.parent;
  }

  return parentCount ? {
    interactive: unitCount > 0
  } : null;
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/unit.js





























/**
 * Internal model of Vega-Lite specification for the compiler.
 */

var unit_UnitModel = /*#__PURE__*/function (_ModelWithField) {
  _inherits(UnitModel, _ModelWithField);

  var _super = _createSuper(UnitModel);

  function UnitModel(spec, parent, parentGivenName) {
    var _this;

    var parentGivenSize = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
    var config = arguments.length > 4 ? arguments[4] : undefined;

    _classCallCheck(this, UnitModel);

    var _a, _b;

    _this = _super.call(this, spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined);
    _this.specifiedScales = {};
    _this.specifiedAxes = {};
    _this.specifiedLegends = {};
    _this.specifiedProjection = {};
    _this.selection = {};
    _this.children = [];
    var mark = isMarkDef(spec.mark) ? spec.mark.type : spec.mark;
    _this.markDef = initMarkdef(spec.mark, (_a = spec.encoding) !== null && _a !== void 0 ? _a : {}, config, {
      graticule: spec.data && isGraticuleGenerator(spec.data)
    });
    var encoding = _this.encoding = initEncoding((_b = spec.encoding) !== null && _b !== void 0 ? _b : {}, _this.markDef);
    _this.size = initLayoutSize({
      encoding: encoding,
      size: isFrameMixins(spec) ? Object.assign(Object.assign(Object.assign({}, parentGivenSize), spec.width ? {
        width: spec.width
      } : {}), spec.height ? {
        height: spec.height
      } : {}) : parentGivenSize
    }); // calculate stack properties

    _this.stack = stack_stack(mark, encoding);
    _this.specifiedScales = _this.initScales(mark, encoding);
    _this.specifiedAxes = _this.initAxes(encoding);
    _this.specifiedLegends = _this.initLegend(encoding);
    _this.specifiedProjection = spec.projection; // Selections will be initialized upon parse.

    _this.selection = spec.selection;
    return _this;
  }

  _createClass(UnitModel, [{
    key: "hasProjection",
    get: function get() {
      var encoding = this.encoding;
      var isGeoShapeMark = this.mark === GEOSHAPE;
      var hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(function (channel) {
        return isFieldDef(encoding[channel]);
      });
      return isGeoShapeMark || hasGeoPosition;
    }
    /**
     * Return specified Vega-Lite scale domain for a particular channel
     * @param channel
     */

  }, {
    key: "scaleDomain",
    value: function scaleDomain(channel) {
      var scale = this.specifiedScales[channel];
      return scale ? scale.domain : undefined;
    }
  }, {
    key: "axis",
    value: function axis(channel) {
      return this.specifiedAxes[channel];
    }
  }, {
    key: "legend",
    value: function legend(channel) {
      return this.specifiedLegends[channel];
    }
  }, {
    key: "initScales",
    value: function initScales(mark, encoding) {
      return SCALE_CHANNELS.reduce(function (scales, channel) {
        var fieldDef;
        var specifiedScale;
        var channelDef = encoding[channel];

        if (isFieldDef(channelDef)) {
          fieldDef = channelDef;
          specifiedScale = channelDef.scale;
        } else if (hasConditionalFieldDef(channelDef)) {
          // Need to specify generic for hasConditionalFieldDef as the value type can vary across channels
          fieldDef = channelDef.condition;
          specifiedScale = channelDef.condition['scale'];
        }

        if (fieldDef) {
          scales[channel] = specifiedScale !== null && specifiedScale !== void 0 ? specifiedScale : {};
        }

        return scales;
      }, {});
    }
  }, {
    key: "initAxes",
    value: function initAxes(encoding) {
      return [channel_X, channel_Y].reduce(function (_axis, channel) {
        // Position Axis
        // TODO: handle ConditionFieldDef
        var channelDef = encoding[channel];

        if (isFieldDef(channelDef) || channel === channel_X && isFieldDef(encoding.x2) || channel === channel_Y && isFieldDef(encoding.y2)) {
          var axisSpec = isFieldDef(channelDef) ? channelDef.axis : undefined;
          _axis[channel] = axisSpec ? Object.assign({}, axisSpec) : axisSpec; // convert truthy value to object
        }

        return _axis;
      }, {});
    }
  }, {
    key: "initLegend",
    value: function initLegend(encoding) {
      return NONPOSITION_SCALE_CHANNELS.reduce(function (_legend, channel) {
        var channelDef = encoding[channel];

        if (channelDef) {
          var legend = isFieldDef(channelDef) ? channelDef.legend : hasConditionalFieldDef(channelDef) // Need to specify generic for hasConditionalFieldDef as the value type can vary across channels
          ? channelDef.condition['legend'] : undefined;

          if (supportLegend(channel)) {
            _legend[channel] = legend ? Object.assign({}, legend) : legend; // convert truthy value to object
          }
        }

        return _legend;
      }, {});
    }
  }, {
    key: "parseData",
    value: function parseData() {
      this.component.data = parse_parseData(this);
    }
  }, {
    key: "parseLayoutSize",
    value: function parseLayoutSize() {
      parseUnitLayoutSize(this);
    }
  }, {
    key: "parseSelections",
    value: function parseSelections() {
      this.component.selection = parseUnitSelection(this, this.selection);
    }
  }, {
    key: "parseMarkGroup",
    value: function parseMarkGroup() {
      this.component.mark = parseMarkGroups(this);
    }
  }, {
    key: "parseAxesAndHeaders",
    value: function parseAxesAndHeaders() {
      this.component.axes = parseUnitAxes(this);
    }
  }, {
    key: "assembleSelectionTopLevelSignals",
    value: function assembleSelectionTopLevelSignals(signals) {
      return assembleTopLevelSignals(this, signals);
    }
  }, {
    key: "assembleSignals",
    value: function assembleSignals() {
      return [].concat(_toConsumableArray(assembleAxisSignals(this)), _toConsumableArray(assembleUnitSelectionSignals(this, [])));
    }
  }, {
    key: "assembleSelectionData",
    value: function assembleSelectionData(data) {
      return assembleUnitSelectionData(this, data);
    }
  }, {
    key: "assembleLayout",
    value: function assembleLayout() {
      return null;
    }
  }, {
    key: "assembleLayoutSignals",
    value: function assembleLayoutSignals() {
      return assemble_assembleLayoutSignals(this);
    }
  }, {
    key: "assembleMarks",
    value: function assembleMarks() {
      var _a;

      var marks = (_a = this.component.mark) !== null && _a !== void 0 ? _a : []; // If this unit is part of a layer, selections should augment
      // all in concert rather than each unit individually. This
      // ensures correct interleaving of clipping and brushed marks.

      if (!this.parent || !isLayerModel(this.parent)) {
        marks = assembleUnitSelectionMarks(this, marks);
      }

      return marks.map(this.correctDataNames);
    }
  }, {
    key: "getMapping",
    value: function getMapping() {
      return this.encoding;
    }
  }, {
    key: "mark",
    get: function get() {
      return this.markDef.type;
    }
  }, {
    key: "channelHasField",
    value: function channelHasField(channel) {
      return encoding_channelHasField(this.encoding, channel);
    }
  }, {
    key: "fieldDef",
    value: function fieldDef(channel) {
      var channelDef = this.encoding[channel];
      return getTypedFieldDef(channelDef);
    }
  }]);

  return UnitModel;
}(model_ModelWithField);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/layer.js




























var layer_LayerModel = /*#__PURE__*/function (_Model) {
  _inherits(LayerModel, _Model);

  var _super = _createSuper(LayerModel);

  function LayerModel(spec, parent, parentGivenName, parentGivenSize, config) {
    var _this;

    _classCallCheck(this, LayerModel);

    _this = _super.call(this, spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view);
    var layoutSize = Object.assign(Object.assign(Object.assign({}, parentGivenSize), spec.width ? {
      width: spec.width
    } : {}), spec.height ? {
      height: spec.height
    } : {});
    _this.children = spec.layer.map(function (layer, i) {
      if (isLayerSpec(layer)) {
        return new LayerModel(layer, _assertThisInitialized(_this), _this.getName('layer_' + i), layoutSize, config);
      } else if (isUnitSpec(layer)) {
        return new unit_UnitModel(layer, _assertThisInitialized(_this), _this.getName('layer_' + i), layoutSize, config);
      }

      throw new Error(message.invalidSpec(layer));
    });
    return _this;
  }

  _createClass(LayerModel, [{
    key: "parseData",
    value: function parseData() {
      this.component.data = parse_parseData(this);

      var _iterator = _createForOfIteratorHelper(this.children),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var child = _step.value;
          child.parseData();
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
    }
  }, {
    key: "parseLayoutSize",
    value: function parseLayoutSize() {
      parseLayerLayoutSize(this);
    }
  }, {
    key: "parseSelections",
    value: function parseSelections() {
      var _this2 = this;

      // Merge selections up the hierarchy so that they may be referenced
      // across unit specs. Persist their definitions within each child
      // to assemble signals which remain within output Vega unit groups.
      this.component.selection = {};

      var _iterator2 = _createForOfIteratorHelper(this.children),
          _step2;

      try {
        var _loop = function _loop() {
          var child = _step2.value;
          child.parseSelections();
          util_keys(child.component.selection).forEach(function (key) {
            _this2.component.selection[key] = child.component.selection[key];
          });
        };

        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          _loop();
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }
    }
  }, {
    key: "parseMarkGroup",
    value: function parseMarkGroup() {
      var _iterator3 = _createForOfIteratorHelper(this.children),
          _step3;

      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var child = _step3.value;
          child.parseMarkGroup();
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }
    }
  }, {
    key: "parseAxesAndHeaders",
    value: function parseAxesAndHeaders() {
      parseLayerAxes(this);
    }
  }, {
    key: "assembleSelectionTopLevelSignals",
    value: function assembleSelectionTopLevelSignals(signals) {
      return this.children.reduce(function (sg, child) {
        return child.assembleSelectionTopLevelSignals(sg);
      }, signals);
    } // TODO: Support same named selections across children.

  }, {
    key: "assembleSignals",
    value: function assembleSignals() {
      return this.children.reduce(function (signals, child) {
        return signals.concat(child.assembleSignals());
      }, assembleAxisSignals(this));
    }
  }, {
    key: "assembleLayoutSignals",
    value: function assembleLayoutSignals() {
      return this.children.reduce(function (signals, child) {
        return signals.concat(child.assembleLayoutSignals());
      }, assemble_assembleLayoutSignals(this));
    }
  }, {
    key: "assembleSelectionData",
    value: function assembleSelectionData(data) {
      return this.children.reduce(function (db, child) {
        return child.assembleSelectionData(db);
      }, data);
    }
  }, {
    key: "assembleTitle",
    value: function assembleTitle() {
      var title = get_get(_getPrototypeOf(LayerModel.prototype), "assembleTitle", this).call(this);

      if (title) {
        return title;
      } // If title does not provide layer, look into children


      var _iterator4 = _createForOfIteratorHelper(this.children),
          _step4;

      try {
        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
          var child = _step4.value;
          title = child.assembleTitle();

          if (title) {
            return title;
          }
        }
      } catch (err) {
        _iterator4.e(err);
      } finally {
        _iterator4.f();
      }

      return undefined;
    }
  }, {
    key: "assembleLayout",
    value: function assembleLayout() {
      return null;
    }
  }, {
    key: "assembleMarks",
    value: function assembleMarks() {
      return assembleLayerSelectionMarks(this, this.children.flatMap(function (child) {
        return child.assembleMarks();
      }));
    }
  }, {
    key: "assembleLegends",
    value: function assembleLegends() {
      return this.children.reduce(function (legends, child) {
        return legends.concat(child.assembleLegends());
      }, assemble_assembleLegends(this));
    }
  }]);

  return LayerModel;
}(model_Model);
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/buildmodel.js






function buildModel(spec, parent, parentGivenName, unitSize, config) {
  if (isFacetSpec(spec)) {
    return new facet_FacetModel(spec, parent, parentGivenName, config);
  } else if (isLayerSpec(spec)) {
    return new layer_LayerModel(spec, parent, parentGivenName, unitSize, config);
  } else if (isUnitSpec(spec)) {
    return new unit_UnitModel(spec, parent, parentGivenName, unitSize, config);
  } else if (isAnyConcatSpec(spec)) {
    return new concat_ConcatModel(spec, parent, parentGivenName, config);
  }

  throw new Error(message.invalidSpec(spec));
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/compile/compile.js



















/**
 * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec.
 *
 * At a high-level, we make the following transformations in different phases:
 *
 * Input spec
 *     |
 *     |  (Normalization)
 *     v
 * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.)
 *     |
 *     |  (Build Model)
 *     v
 * A model tree of the spec
 *     |
 *     |  (Parse)
 *     v
 * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged)
 *     |
 *     | (Optimize)
 *     v
 * A model tree with parsed components with the data component optimized
 *     |
 *     | (Assemble)
 *     v
 * Vega spec
 *
 * @param inputSpec The Vega-Lite specification.
 * @param opt       Optional arguments passed to the Vega-Lite compiler.
 * @returns         An object containing the compiled Vega spec and normalized Vega-Lite spec.
 */

function compile(inputSpec) {
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  // 0. Augment opt with default opts
  if (opt.logger) {
    // set the singleton logger to the provided logger
    log_set(opt.logger);
  }

  if (opt.fieldTitle) {
    // set the singleton field title formatter
    setTitleFormatter(opt.fieldTitle);
  }

  if (opt.formatTypes) {
    setCustomFormatTypes(opt.formatTypes);
  }

  try {
    // 1. Initialize config by deep merging default config with the config provided via option and the input spec.
    var config = initConfig(mergeConfig(opt.config, inputSpec.config)); // 2. Normalize: Convert input spec -> normalized spec
    // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec.
    // - Normalize autosize and width or height spec

    var spec = normalize_normalize(inputSpec, config); // 3. Build Model: normalized spec -> Model (a tree structure)
    // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors.
    // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models.

    var model = buildModel(spec, null, '', undefined, config); // 4 Parse: Model --> Model with components
    // Note that components = intermediate representations that are equivalent to Vega specs.
    // We need these intermediate representation because we need to merge many visualization "components" like projections, scales, axes, and legends.
    // We will later convert these components into actual Vega specs in the assemble phase.
    // In this phase, we do a bottom-up traversal over the whole tree to
    // parse for each type of components once (e.g., data, layout, mark, scale).
    // By doing bottom-up traversal, we start parsing components of unit specs and
    // then merge child components of parent composite specs.
    //
    // Please see inside model.parse() for order of different components parsed.

    model.parse(); // draw(model.component.data.sources);
    // 5. Optimize the dataflow. This will modify the data component of the model.

    optimizeDataflow(model.component.data, model); // 6. Assemble: convert model components --> Vega Spec.

    var vgSpec = assembleTopLevelModel(model, getTopLevelProperties(inputSpec, spec.autosize, config, model), inputSpec.datasets, inputSpec.usermeta);
    return {
      spec: vgSpec,
      normalized: spec
    };
  } finally {
    // Reset the singleton logger if a logger is provided
    if (opt.logger) {
      log_reset();
    } // Reset the singleton field title formatter if provided


    if (opt.fieldTitle) {
      resetTitleFormatter();
    }
  }
}

function getTopLevelProperties(inputSpec, autosize, config, model) {
  var width = model.component.layoutSize.get('width');
  var height = model.component.layoutSize.get('height');

  if (autosize === undefined) {
    autosize = {
      type: 'pad'
    };
  } else if (isString(autosize)) {
    autosize = {
      type: autosize
    };
  }

  if (width && height && isFitType(autosize.type)) {
    if (width === 'step' && height === 'step') {
      log_warn(message.droppingFit());
      autosize.type = 'pad';
    } else if (width === 'step' || height === 'step') {
      // effectively XOR, because else if
      // get step dimension
      var sizeType = width === 'step' ? 'width' : 'height'; // log that we're dropping fit for respective channel

      log_warn(message.droppingFit(getPositionScaleChannel(sizeType))); // setting type to inverse fit (so if we dropped fit-x, type is now fit-y)

      var inverseSizeType = sizeType === 'width' ? 'height' : 'width';
      autosize.type = getFitType(inverseSizeType);
    }
  }

  return Object.assign(Object.assign(Object.assign({}, util_keys(autosize).length === 1 && autosize.type ? autosize.type === 'pad' ? {} : {
    autosize: autosize.type
  } : {
    autosize: autosize
  }), extractTopLevelProperties(config)), extractTopLevelProperties(inputSpec));
}
/*
 * Assemble the top-level model to a Vega spec.
 *
 * Note: this couldn't be `model.assemble()` since the top-level model
 * needs some special treatment to generate top-level properties.
 */


function assembleTopLevelModel(model, topLevelProperties) {
  var datasets = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  var usermeta = arguments.length > 3 ? arguments[3] : undefined;
  // Config with Vega-Lite only config removed.
  var vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined;
  var data = [].concat(model.assembleSelectionData([]), // only assemble data in the root
  assembleRootData(model.component.data, datasets));
  var projections = model.assembleProjections();
  var title = model.assembleTitle();
  var style = model.assembleGroupStyle();
  var encodeEntry = model.assembleGroupEncodeEntry(true);
  var layoutSignals = model.assembleLayoutSignals(); // move width and height signals with values to top level

  layoutSignals = layoutSignals.filter(function (signal) {
    if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) {
      topLevelProperties[signal.name] = +signal.value;
      return false;
    }

    return true;
  });
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
    $schema: 'https://vega.github.io/schema/vega/v5.json'
  }, model.description ? {
    description: model.description
  } : {}), topLevelProperties), title ? {
    title: title
  } : {}), style ? {
    style: style
  } : {}), encodeEntry ? {
    encode: {
      update: encodeEntry
    }
  } : {}), {
    data: data
  }), projections.length > 0 ? {
    projections: projections
  } : {}), model.assembleGroup([].concat(_toConsumableArray(layoutSignals), _toConsumableArray(model.assembleSelectionTopLevelSignals([]))))), vgConfig ? {
    config: vgConfig
  } : {}), usermeta ? {
    usermeta: usermeta
  } : {});
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/transformextract.js











var transformextract_TransformExtractMapper = /*#__PURE__*/function (_SpecMapper) {
  _inherits(TransformExtractMapper, _SpecMapper);

  var _super = _createSuper(TransformExtractMapper);

  function TransformExtractMapper() {
    _classCallCheck(this, TransformExtractMapper);

    return _super.apply(this, arguments);
  }

  _createClass(TransformExtractMapper, [{
    key: "mapUnit",
    value: function mapUnit(spec, _ref) {
      var config = _ref.config;

      if (spec.encoding) {
        var oldEncoding = spec.encoding,
            oldTransforms = spec.transform;

        var _extractTransformsFro = extractTransformsFromEncoding(oldEncoding, config),
            bins = _extractTransformsFro.bins,
            timeUnits = _extractTransformsFro.timeUnits,
            aggregate = _extractTransformsFro.aggregate,
            groupby = _extractTransformsFro.groupby,
            encoding = _extractTransformsFro.encoding;

        var transform = [].concat(_toConsumableArray(oldTransforms ? oldTransforms : []), _toConsumableArray(bins), _toConsumableArray(timeUnits), _toConsumableArray(aggregate.length === 0 ? [] : [{
          aggregate: aggregate,
          groupby: groupby
        }]));
        return Object.assign(Object.assign(Object.assign({}, spec), transform.length > 0 ? {
          transform: transform
        } : {}), {
          encoding: encoding
        });
      } else {
        return spec;
      }
    }
  }]);

  return TransformExtractMapper;
}(map_SpecMapper);

var extractor = new transformextract_TransformExtractMapper();
/**
 * Modifies spec extracting transformations from encoding and moving them to the transforms array
 */

function extractTransforms(spec, config) {
  return extractor.map(spec, {
    config: config
  });
}
// CONCATENATED MODULE: ./node_modules/vega-lite/build/src/index.js


var src_version = build_package.version;



// CONCATENATED MODULE: ./node_modules/vega-schema-url-parser/dist/parser.module.js
function parser_module_e(e){const[n,r]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:n,version:r}}/* harmony default export */ var parser_module = (parser_module_e);
//# sourceMappingURL=parser.module.js.map

// CONCATENATED MODULE: ./node_modules/vega-themes/build/vega-themes.module.js
var vega_themes_module_name = "vega-themes";
var vega_themes_module_version = "2.10.0";
var vega_themes_module_description = "Themes for stylized Vega and Vega-Lite visualizations.";
var vega_themes_module_keywords = [
	"vega",
	"vega-lite",
	"themes",
	"style"
];
var vega_themes_module_license = "BSD-3-Clause";
var vega_themes_module_author = {
	name: "UW Interactive Data Lab",
	url: "https://idl.cs.washington.edu"
};
var contributors = [
	{
		name: "Emily Gu",
		url: "https://github.com/emilygu"
	},
	{
		name: "Arvind Satyanarayan",
		url: "http://arvindsatya.com"
	},
	{
		name: "Jeffrey Heer",
		url: "https://idl.cs.washington.edu"
	},
	{
		name: "Dominik Moritz",
		url: "https://www.domoritz.de"
	}
];
var vega_themes_module_main = "build/vega-themes.js";
var vega_themes_module_module = "build/vega-themes.module.js";
var vega_themes_module_unpkg = "build/vega-themes.min.js";
var vega_themes_module_jsdelivr = "build/vega-themes.min.js";
var vega_themes_module_types = "build/vega-themes.module.d.ts";
var vega_themes_module_repository = {
	type: "git",
	url: "https://github.com/vega/vega-themes.git"
};
var files = [
	"src",
	"build"
];
var vega_themes_module_scripts = {
	prebuild: "yarn clean",
	build: "rollup -c",
	clean: "rimraf build && rimraf examples/build",
	"copy:data": "rsync -r node_modules/vega-datasets/data/* examples/data",
	"copy:build": "rsync -r build/* examples/build",
	"deploy:gh": "yarn build && mkdir -p examples/build && rsync -r build/* examples/build && gh-pages -d examples",
	prepublishOnly: "yarn clean && yarn build",
	preversion: "yarn lint",
	serve: "browser-sync start -s -f build examples --serveStatic examples",
	start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
	prepare: "beemo create-config",
	eslintbase: "beemo eslint .",
	format: "yarn eslintbase --fix",
	lint: "yarn eslintbase"
};
var vega_themes_module_devDependencies = {
	"@rollup/plugin-json": "^4.1.0",
	"@rollup/plugin-node-resolve": "^11.2.0",
	"@wessberg/rollup-plugin-ts": "^1.3.8",
	"browser-sync": "^2.26.14",
	concurrently: "^6.0.0",
	"gh-pages": "^3.1.0",
	rollup: "^2.39.1",
	"rollup-plugin-bundle-size": "^1.0.3",
	"rollup-plugin-terser": "^7.0.2",
	typescript: "^4.2.2",
	vega: "^5.19.1",
	"vega-lite": "^5.0.0",
	"vega-lite-dev-config": "^0.16.1"
};
var peerDependencies = {
	vega: "*",
	"vega-lite": "*"
};
var vega_themes_module_pkg = {
	name: vega_themes_module_name,
	version: vega_themes_module_version,
	description: vega_themes_module_description,
	keywords: vega_themes_module_keywords,
	license: vega_themes_module_license,
	author: vega_themes_module_author,
	contributors: contributors,
	main: vega_themes_module_main,
	module: vega_themes_module_module,
	unpkg: vega_themes_module_unpkg,
	jsdelivr: vega_themes_module_jsdelivr,
	types: vega_themes_module_types,
	repository: vega_themes_module_repository,
	files: files,
	scripts: vega_themes_module_scripts,
	devDependencies: vega_themes_module_devDependencies,
	peerDependencies: peerDependencies
};

const lightColor = '#fff';
const medColor = '#888';
const darkTheme = {
    background: '#333',
    title: {
        color: lightColor,
        subtitleColor: lightColor
    },
    style: {
        'guide-label': {
            fill: lightColor,
        },
        'guide-title': {
            fill: lightColor,
        },
    },
    axis: {
        domainColor: lightColor,
        gridColor: medColor,
        tickColor: lightColor,
    },
};

const markColor = '#4572a7';
const excelTheme = {
    background: '#fff',
    arc: { fill: markColor },
    area: { fill: markColor },
    line: { stroke: markColor, strokeWidth: 2 },
    path: { stroke: markColor },
    rect: { fill: markColor },
    shape: { stroke: markColor },
    symbol: { fill: markColor, strokeWidth: 1.5, size: 50 },
    axis: {
        bandPosition: 0.5,
        grid: true,
        gridColor: '#000000',
        gridOpacity: 1,
        gridWidth: 0.5,
        labelPadding: 10,
        tickSize: 5,
        tickWidth: 0.5,
    },
    axisBand: {
        grid: false,
        tickExtra: true,
    },
    legend: {
        labelBaseline: 'middle',
        labelFontSize: 11,
        symbolSize: 50,
        symbolType: 'square',
    },
    range: {
        category: [
            '#4572a7',
            '#aa4643',
            '#8aa453',
            '#71598e',
            '#4598ae',
            '#d98445',
            '#94aace',
            '#d09393',
            '#b9cc98',
            '#a99cbc',
        ],
    },
};

const markColor$1 = '#30a2da';
const axisColor = '#cbcbcb';
const guideLabelColor = '#999';
const guideTitleColor = '#333';
const backgroundColor = '#f0f0f0';
const blackTitle = '#333';
const fiveThirtyEightTheme = {
    arc: { fill: markColor$1 },
    area: { fill: markColor$1 },
    axis: {
        domainColor: axisColor,
        grid: true,
        gridColor: axisColor,
        gridWidth: 1,
        labelColor: guideLabelColor,
        labelFontSize: 10,
        titleColor: guideTitleColor,
        tickColor: axisColor,
        tickSize: 10,
        titleFontSize: 14,
        titlePadding: 10,
        labelPadding: 4,
    },
    axisBand: {
        grid: false,
    },
    background: backgroundColor,
    group: {
        fill: backgroundColor,
    },
    legend: {
        labelColor: blackTitle,
        labelFontSize: 11,
        padding: 1,
        symbolSize: 30,
        symbolType: 'square',
        titleColor: blackTitle,
        titleFontSize: 14,
        titlePadding: 10,
    },
    line: {
        stroke: markColor$1,
        strokeWidth: 2,
    },
    path: { stroke: markColor$1, strokeWidth: 0.5 },
    rect: { fill: markColor$1 },
    range: {
        category: [
            '#30a2da',
            '#fc4f30',
            '#e5ae38',
            '#6d904f',
            '#8b8b8b',
            '#b96db8',
            '#ff9e27',
            '#56cc60',
            '#52d2ca',
            '#52689e',
            '#545454',
            '#9fe4f8',
        ],
        diverging: ['#cc0020', '#e77866', '#f6e7e1', '#d6e8ed', '#91bfd9', '#1d78b5'],
        heatmap: ['#d6e8ed', '#cee0e5', '#91bfd9', '#549cc6', '#1d78b5'],
    },
    point: {
        filled: true,
        shape: 'circle',
    },
    shape: { stroke: markColor$1 },
    bar: {
        binSpacing: 2,
        fill: markColor$1,
        stroke: null,
    },
    title: {
        anchor: 'start',
        fontSize: 24,
        fontWeight: 600,
        offset: 20,
    },
};

const markColor$2 = '#000';
const ggplot2Theme = {
    group: {
        fill: '#e5e5e5',
    },
    arc: { fill: markColor$2 },
    area: { fill: markColor$2 },
    line: { stroke: markColor$2 },
    path: { stroke: markColor$2 },
    rect: { fill: markColor$2 },
    shape: { stroke: markColor$2 },
    symbol: { fill: markColor$2, size: 40 },
    axis: {
        domain: false,
        grid: true,
        gridColor: '#FFFFFF',
        gridOpacity: 1,
        labelColor: '#7F7F7F',
        labelPadding: 4,
        tickColor: '#7F7F7F',
        tickSize: 5.67,
        titleFontSize: 16,
        titleFontWeight: 'normal',
    },
    legend: {
        labelBaseline: 'middle',
        labelFontSize: 11,
        symbolSize: 40,
    },
    range: {
        category: [
            '#000000',
            '#7F7F7F',
            '#1A1A1A',
            '#999999',
            '#333333',
            '#B0B0B0',
            '#4D4D4D',
            '#C9C9C9',
            '#666666',
            '#DCDCDC',
        ],
    },
};

const headlineFontSize = 22;
const headlineFontWeight = 'normal';
const labelFont = 'Benton Gothic, sans-serif';
const labelFontSize = 11.5;
const labelFontWeight = 'normal';
const markColor$3 = '#82c6df';
// const markHighlight = '#006d8f';
// const markDemocrat = '#5789b8';
// const markRepublican = '#d94f54';
const titleFont = 'Benton Gothic Bold, sans-serif';
const titleFontWeight = 'normal';
const titleFontSize = 13;
const colorSchemes = {
    'category-6': ['#ec8431', '#829eb1', '#c89d29', '#3580b1', '#adc839', '#ab7fb4'],
    'fire-7': ['#fbf2c7', '#f9e39c', '#f8d36e', '#f4bb6a', '#e68a4f', '#d15a40', '#ab4232'],
    'fireandice-6': ['#e68a4f', '#f4bb6a', '#f9e39c', '#dadfe2', '#a6b7c6', '#849eae'],
    'ice-7': ['#edefee', '#dadfe2', '#c4ccd2', '#a6b7c6', '#849eae', '#607785', '#47525d'],
};
const latimesTheme = {
    background: '#ffffff',
    title: {
        anchor: 'start',
        color: '#000000',
        font: titleFont,
        fontSize: headlineFontSize,
        fontWeight: headlineFontWeight,
    },
    arc: { fill: markColor$3 },
    area: { fill: markColor$3 },
    line: { stroke: markColor$3, strokeWidth: 2 },
    path: { stroke: markColor$3 },
    rect: { fill: markColor$3 },
    shape: { stroke: markColor$3 },
    symbol: { fill: markColor$3, size: 30 },
    axis: {
        labelFont,
        labelFontSize,
        labelFontWeight,
        titleFont,
        titleFontSize,
        titleFontWeight,
    },
    axisX: {
        labelAngle: 0,
        labelPadding: 4,
        tickSize: 3,
    },
    axisY: {
        labelBaseline: 'middle',
        maxExtent: 45,
        minExtent: 45,
        tickSize: 2,
        titleAlign: 'left',
        titleAngle: 0,
        titleX: -45,
        titleY: -11,
    },
    legend: {
        labelFont,
        labelFontSize,
        symbolType: 'square',
        titleFont,
        titleFontSize,
        titleFontWeight,
    },
    range: {
        category: colorSchemes['category-6'],
        diverging: colorSchemes['fireandice-6'],
        heatmap: colorSchemes['fire-7'],
        ordinal: colorSchemes['fire-7'],
        ramp: colorSchemes['fire-7'],
    },
};

const markColor$4 = '#ab5787';
const axisColor$1 = '#979797';
const quartzTheme = {
    background: '#f9f9f9',
    arc: { fill: markColor$4 },
    area: { fill: markColor$4 },
    line: { stroke: markColor$4 },
    path: { stroke: markColor$4 },
    rect: { fill: markColor$4 },
    shape: { stroke: markColor$4 },
    symbol: { fill: markColor$4, size: 30 },
    axis: {
        domainColor: axisColor$1,
        domainWidth: 0.5,
        gridWidth: 0.2,
        labelColor: axisColor$1,
        tickColor: axisColor$1,
        tickWidth: 0.2,
        titleColor: axisColor$1,
    },
    axisBand: {
        grid: false,
    },
    axisX: {
        grid: true,
        tickSize: 10,
    },
    axisY: {
        domain: false,
        grid: true,
        tickSize: 0,
    },
    legend: {
        labelFontSize: 11,
        padding: 1,
        symbolSize: 30,
        symbolType: 'square',
    },
    range: {
        category: [
            '#ab5787',
            '#51b2e5',
            '#703c5c',
            '#168dd9',
            '#d190b6',
            '#00609f',
            '#d365ba',
            '#154866',
            '#666666',
            '#c4c4c4',
        ],
    },
};

const markColor$5 = '#3e5c69';
const voxTheme = {
    background: '#fff',
    arc: { fill: markColor$5 },
    area: { fill: markColor$5 },
    line: { stroke: markColor$5 },
    path: { stroke: markColor$5 },
    rect: { fill: markColor$5 },
    shape: { stroke: markColor$5 },
    symbol: { fill: markColor$5 },
    axis: {
        domainWidth: 0.5,
        grid: true,
        labelPadding: 2,
        tickSize: 5,
        tickWidth: 0.5,
        titleFontWeight: 'normal',
    },
    axisBand: {
        grid: false,
    },
    axisX: {
        gridWidth: 0.2,
    },
    axisY: {
        gridDash: [3],
        gridWidth: 0.4,
    },
    legend: {
        labelFontSize: 11,
        padding: 1,
        symbolType: 'square',
    },
    range: {
        category: ['#3e5c69', '#6793a6', '#182429', '#0570b0', '#3690c0', '#74a9cf', '#a6bddb', '#e2ddf2'],
    },
};

const markColor$6 = '#1696d2';
const axisColor$2 = '#000000';
const backgroundColor$1 = '#FFFFFF';
const vega_themes_module_font = 'Lato';
const labelFont$1 = 'Lato';
const sourceFont = 'Lato';
const gridColor = '#DEDDDD';
const titleFontSize$1 = 18;
const colorSchemes$1 = {
    'main-colors': ['#1696d2', '#d2d2d2', '#000000', '#fdbf11', '#ec008b', '#55b748', '#5c5859', '#db2b27'],
    'shades-blue': ['#CFE8F3', '#A2D4EC', '#73BFE2', '#46ABDB', '#1696D2', '#12719E', '#0A4C6A', '#062635'],
    'shades-gray': ['#F5F5F5', '#ECECEC', '#E3E3E3', '#DCDBDB', '#D2D2D2', '#9D9D9D', '#696969', '#353535'],
    'shades-yellow': ['#FFF2CF', '#FCE39E', '#FDD870', '#FCCB41', '#FDBF11', '#E88E2D', '#CA5800', '#843215'],
    'shades-magenta': ['#F5CBDF', '#EB99C2', '#E46AA7', '#E54096', '#EC008B', '#AF1F6B', '#761548', '#351123'],
    'shades-green': ['#DCEDD9', '#BCDEB4', '#98CF90', '#78C26D', '#55B748', '#408941', '#2C5C2D', '#1A2E19'],
    'shades-black': ['#D5D5D4', '#ADABAC', '#848081', '#5C5859', '#332D2F', '#262223', '#1A1717', '#0E0C0D'],
    'shades-red': ['#F8D5D4', '#F1AAA9', '#E9807D', '#E25552', '#DB2B27', '#A4201D', '#6E1614', '#370B0A'],
    'one-group': ['#1696d2', '#000000'],
    'two-groups-cat-1': ['#1696d2', '#000000'],
    'two-groups-cat-2': ['#1696d2', '#fdbf11'],
    'two-groups-cat-3': ['#1696d2', '#db2b27'],
    'two-groups-seq': ['#a2d4ec', '#1696d2'],
    'three-groups-cat': ['#1696d2', '#fdbf11', '#000000'],
    'three-groups-seq': ['#a2d4ec', '#1696d2', '#0a4c6a'],
    'four-groups-cat-1': ['#000000', '#d2d2d2', '#fdbf11', '#1696d2'],
    'four-groups-cat-2': ['#1696d2', '#ec0008b', '#fdbf11', '#5c5859'],
    'four-groups-seq': ['#cfe8f3', '#73bf42', '#1696d2', '#0a4c6a'],
    'five-groups-cat-1': ['#1696d2', '#fdbf11', '#d2d2d2', '#ec008b', '#000000'],
    'five-groups-cat-2': ['#1696d2', '#0a4c6a', '#d2d2d2', '#fdbf11', '#332d2f'],
    'five-groups-seq': ['#cfe8f3', '#73bf42', '#1696d2', '#0a4c6a', '#000000'],
    'six-groups-cat-1': ['#1696d2', '#ec008b', '#fdbf11', '#000000', '#d2d2d2', '#55b748'],
    'six-groups-cat-2': ['#1696d2', '#d2d2d2', '#ec008b', '#fdbf11', '#332d2f', '#0a4c6a'],
    'six-groups-seq': ['#cfe8f3', '#a2d4ec', '#73bfe2', '#46abdb', '#1696d2', '#12719e'],
    'diverging-colors': ['#ca5800', '#fdbf11', '#fdd870', '#fff2cf', '#cfe8f3', '#73bfe2', '#1696d2', '#0a4c6a'],
};
const urbanInstituteTheme = {
    background: backgroundColor$1,
    title: {
        anchor: 'start',
        fontSize: titleFontSize$1,
        font: vega_themes_module_font,
    },
    axisX: {
        domain: true,
        domainColor: axisColor$2,
        domainWidth: 1,
        grid: false,
        labelFontSize: 12,
        labelFont: labelFont$1,
        labelAngle: 0,
        tickColor: axisColor$2,
        tickSize: 5,
        titleFontSize: 12,
        titlePadding: 10,
        titleFont: vega_themes_module_font,
    },
    axisY: {
        domain: false,
        domainWidth: 1,
        grid: true,
        gridColor: gridColor,
        gridWidth: 1,
        labelFontSize: 12,
        labelFont: labelFont$1,
        labelPadding: 8,
        ticks: false,
        titleFontSize: 12,
        titlePadding: 10,
        titleFont: vega_themes_module_font,
        titleAngle: 0,
        titleY: -10,
        titleX: 18,
    },
    legend: {
        labelFontSize: 12,
        labelFont: labelFont$1,
        symbolSize: 100,
        titleFontSize: 12,
        titlePadding: 10,
        titleFont: vega_themes_module_font,
        orient: 'right',
        offset: 10,
    },
    view: {
        stroke: 'transparent',
    },
    range: {
        category: colorSchemes$1['six-groups-cat-1'],
        diverging: colorSchemes$1['diverging-colors'],
        heatmap: colorSchemes$1['diverging-colors'],
        ordinal: colorSchemes$1['six-groups-seq'],
        ramp: colorSchemes$1['shades-blue'],
    },
    area: {
        fill: markColor$6,
    },
    rect: {
        fill: markColor$6,
    },
    line: {
        color: markColor$6,
        stroke: markColor$6,
        strokeWidth: 5,
    },
    trail: {
        color: markColor$6,
        stroke: markColor$6,
        strokeWidth: 0,
        size: 1,
    },
    path: {
        stroke: markColor$6,
        strokeWidth: 0.5,
    },
    point: {
        filled: true,
    },
    text: {
        font: sourceFont,
        color: markColor$6,
        fontSize: 11,
        align: 'center',
        fontWeight: 400,
        size: 11,
    },
    style: {
        bar: {
            fill: markColor$6,
            stroke: null,
        },
    },
    arc: { fill: markColor$6 },
    shape: { stroke: markColor$6 },
    symbol: { fill: markColor$6, size: 30 },
};

/**
 * Copyright 2020 Google LLC.
 *
 * Use of this source code is governed by a BSD-style
 * license that can be found in the LICENSE file or at
 * https://developers.google.com/open-source/licenses/bsd
 */
const markColor$7 = '#3366CC';
const gridColor$1 = '#ccc';
const defaultFont = 'Arial, sans-serif';
const googlechartsTheme = {
    arc: { fill: markColor$7 },
    area: { fill: markColor$7 },
    path: { stroke: markColor$7 },
    rect: { fill: markColor$7 },
    shape: { stroke: markColor$7 },
    symbol: { stroke: markColor$7 },
    circle: { fill: markColor$7 },
    background: '#fff',
    padding: {
        top: 10,
        right: 10,
        bottom: 10,
        left: 10,
    },
    style: {
        'guide-label': {
            font: defaultFont,
            fontSize: 12,
        },
        'guide-title': {
            font: defaultFont,
            fontSize: 12,
        },
        'group-title': {
            font: defaultFont,
            fontSize: 12,
        },
    },
    title: {
        font: defaultFont,
        fontSize: 14,
        fontWeight: 'bold',
        dy: -3,
        anchor: 'start',
    },
    axis: {
        gridColor: gridColor$1,
        tickColor: gridColor$1,
        domain: false,
        grid: true,
    },
    range: {
        category: [
            '#4285F4',
            '#DB4437',
            '#F4B400',
            '#0F9D58',
            '#AB47BC',
            '#00ACC1',
            '#FF7043',
            '#9E9D24',
            '#5C6BC0',
            '#F06292',
            '#00796B',
            '#C2185B',
        ],
        heatmap: ['#c6dafc', '#5e97f6', '#2a56c6'],
    },
};

const vega_themes_module_version$1 = vega_themes_module_pkg.version;



// CONCATENATED MODULE: ./node_modules/vega-tooltip/build/vega-tooltip.module.js


var vega_tooltip_module_name = "vega-tooltip";
var vega_tooltip_module_version = "0.25.1";
var vega_tooltip_module_description = "A tooltip plugin for Vega-Lite and Vega visualizations.";
var vega_tooltip_module_keywords = [
	"vega-lite",
	"vega",
	"tooltip"
];
var vega_tooltip_module_repository = {
	type: "git",
	url: "https://github.com/vega/vega-tooltip.git"
};
var vega_tooltip_module_author = {
	name: "UW Interactive Data Lab",
	url: "https://idl.cs.washington.edu"
};
var collaborators = [
	"Dominik Moritz",
	"Sira Horradarn",
	"Zening Qu",
	"Kanit Wongsuphasawat",
	"Yuri Astrakhan",
	"Jeffrey Heer"
];
var vega_tooltip_module_license = "BSD-3-Clause";
var bugs = {
	url: "https://github.com/vega/vega-tooltip/issues"
};
var homepage = "https://github.com/vega/vega-tooltip#readme";
var vega_tooltip_module_main = "build/vega-tooltip.js";
var vega_tooltip_module_module = "build/vega-tooltip.module.js";
var vega_tooltip_module_unpkg = "build/vega-tooltip.min.js";
var vega_tooltip_module_jsdelivr = "build/vega-tooltip.min.js";
var vega_tooltip_module_types = "build/vega-tooltip.module.d.ts";
var vega_tooltip_module_files = [
	"src",
	"build",
	"types"
];
var vega_tooltip_module_scripts = {
	prebuild: "yarn clean && yarn build:style",
	build: "rollup -c",
	"build:style": "./build-style.sh",
	clean: "rimraf build && rimraf src/style.ts",
	"copy:data": "rsync -r node_modules/vega-datasets/data/* examples/data",
	"copy:build": "rsync -r build/* examples/build",
	"deploy:gh": "yarn build && yarn copy:build && gh-pages -d examples && yarn clean",
	prepublishOnly: "yarn clean && yarn build",
	preversion: "yarn lint && yarn test",
	serve: "browser-sync start -s -f build examples --serveStatic examples",
	start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
	pretest: "yarn build:style",
	test: "beemo jest",
	"test:inspect": "node --inspect-brk ./node_modules/.bin/jest --runInBand",
	prepare: "beemo create-config && yarn copy:data",
	prettierbase: "beemo prettier '*.{css,scss,html}'",
	eslintbase: "beemo eslint .",
	format: "yarn eslintbase --fix && yarn prettierbase --write",
	lint: "yarn eslintbase && yarn prettierbase --check"
};
var vega_tooltip_module_devDependencies = {
	"@rollup/plugin-json": "^4.1.0",
	"@rollup/plugin-node-resolve": "^11.2.0",
	"@wessberg/rollup-plugin-ts": "^1.3.8",
	"browser-sync": "^2.26.14",
	concurrently: "^6.0.0",
	"gh-pages": "^3.1.0",
	"node-sass": "^5.0.0",
	path: "^0.12.7",
	rollup: "^2.39.1",
	"rollup-plugin-bundle-size": "^1.0.3",
	"rollup-plugin-terser": "^7.0.2",
	typescript: "~4.2.2",
	"vega-datasets": "^2.2.0",
	"vega-lite-dev-config": "^0.16.1",
	"vega-typings": "^0.19.2"
};
var vega_tooltip_module_dependencies = {
	"vega-util": "^1.16.0"
};
var vega_tooltip_module_pkg = {
	name: vega_tooltip_module_name,
	version: vega_tooltip_module_version,
	description: vega_tooltip_module_description,
	keywords: vega_tooltip_module_keywords,
	repository: vega_tooltip_module_repository,
	author: vega_tooltip_module_author,
	collaborators: collaborators,
	license: vega_tooltip_module_license,
	bugs: bugs,
	homepage: homepage,
	main: vega_tooltip_module_main,
	module: vega_tooltip_module_module,
	unpkg: vega_tooltip_module_unpkg,
	jsdelivr: vega_tooltip_module_jsdelivr,
	types: vega_tooltip_module_types,
	files: vega_tooltip_module_files,
	scripts: vega_tooltip_module_scripts,
	devDependencies: vega_tooltip_module_devDependencies,
	dependencies: vega_tooltip_module_dependencies
};

// generated with build-style.sh
var defaultStyle = `#vg-tooltip-element {
  visibility: hidden;
  padding: 8px;
  position: fixed;
  z-index: 1000;
  font-family: sans-serif;
  font-size: 11px;
  border-radius: 3px;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  /* The default theme is the light theme. */
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid #d9d9d9;
  color: black; }
  #vg-tooltip-element.visible {
    visibility: visible; }
  #vg-tooltip-element h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 13px; }
  #vg-tooltip-element img {
    max-width: 200px;
    max-height: 200px; }
  #vg-tooltip-element table {
    border-spacing: 0; }
    #vg-tooltip-element table tr {
      border: none; }
      #vg-tooltip-element table tr td {
        overflow: hidden;
        text-overflow: ellipsis;
        padding-top: 2px;
        padding-bottom: 2px; }
        #vg-tooltip-element table tr td.key {
          color: #808080;
          max-width: 150px;
          text-align: right;
          padding-right: 4px; }
        #vg-tooltip-element table tr td.value {
          display: block;
          max-width: 300px;
          max-height: 7em;
          text-align: left; }
  #vg-tooltip-element.dark-theme {
    background-color: rgba(32, 32, 32, 0.9);
    border: 1px solid #f5f5f5;
    color: white; }
    #vg-tooltip-element.dark-theme td.key {
      color: #bfbfbf; }
`;

const EL_ID = 'vg-tooltip-element';
const DEFAULT_OPTIONS = {
    /**
     * X offset.
     */
    offsetX: 10,
    /**
     * Y offset.
     */
    offsetY: 10,
    /**
     * ID of the tooltip element.
     */
    id: EL_ID,
    /**
     * ID of the tooltip CSS style.
     */
    styleId: 'vega-tooltip-style',
    /**
     * The name of the theme. You can use the CSS class called [THEME]-theme to style the tooltips.
     *
     * There are two predefined themes: "light" (default) and "dark".
     */
    theme: 'light',
    /**
     * Do not use the default styles provided by Vega Tooltip. If you enable this option, you need to use your own styles. It is not necessary to disable the default style when using a custom theme.
     */
    disableDefaultStyle: false,
    /**
     * HTML sanitizer function that removes dangerous HTML to prevent XSS.
     *
     * This should be a function from string to string. You may replace it with a formatter such as a markdown formatter.
     */
    sanitize: escapeHTML,
    /**
     * The maximum recursion depth when printing objects in the tooltip.
     */
    maxDepth: 2,
};
/**
 * Escape special HTML characters.
 *
 * @param value A value to convert to string and HTML-escape.
 */
function escapeHTML(value) {
    return String(value).replace(/&/g, '&amp;').replace(/</g, '&lt;');
}
function createDefaultStyle(id) {
    // Just in case this id comes from a user, ensure these is no security issues
    if (!/^[A-Za-z]+[-:.\w]*$/.test(id)) {
        throw new Error('Invalid HTML ID');
    }
    return defaultStyle.toString().replace(EL_ID, id);
}

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

function vega_tooltip_module_rest(s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
}

/**
 * Format the value to be shown in the tooltip.
 *
 * @param value The value to show in the tooltip.
 * @param valueToHtml Function to convert a single cell value to an HTML string
 */
function vega_tooltip_module_formatValue(value, valueToHtml, maxDepth) {
    if (Object(vega_util_module["B" /* isArray */])(value)) {
        return `[${value.map((v) => valueToHtml(Object(vega_util_module["J" /* isString */])(v) ? v : vega_tooltip_module_stringify(v, maxDepth))).join(', ')}]`;
    }
    if (Object(vega_util_module["H" /* isObject */])(value)) {
        let content = '';
        const _a = value, { title, image } = _a, rest = vega_tooltip_module_rest(_a, ["title", "image"]);
        if (title) {
            content += `<h2>${valueToHtml(title)}</h2>`;
        }
        if (image) {
            content += `<img src="${valueToHtml(image)}">`;
        }
        const keys = Object.keys(rest);
        if (keys.length > 0) {
            content += '<table>';
            for (const key of keys) {
                let val = rest[key];
                // ignore undefined properties
                if (val === undefined) {
                    continue;
                }
                if (Object(vega_util_module["H" /* isObject */])(val)) {
                    val = vega_tooltip_module_stringify(val, maxDepth);
                }
                content += `<tr><td class="key">${valueToHtml(key)}:</td><td class="value">${valueToHtml(val)}</td></tr>`;
            }
            content += `</table>`;
        }
        return content || '{}'; // show empty object if there are no properties
    }
    return valueToHtml(value);
}
function replacer(maxDepth) {
    const stack = [];
    return function (key, value) {
        if (typeof value !== 'object' || value === null) {
            return value;
        }
        const pos = stack.indexOf(this) + 1;
        stack.length = pos;
        if (stack.length > maxDepth) {
            return '[Object]';
        }
        if (stack.indexOf(value) >= 0) {
            return '[Circular]';
        }
        stack.push(value);
        return value;
    };
}
/**
 * Stringify any JS object to valid JSON
 */
function vega_tooltip_module_stringify(obj, maxDepth) {
    return JSON.stringify(obj, replacer(maxDepth));
}

/**
 * Position the tooltip
 *
 * @param event The mouse event.
 * @param tooltipBox
 * @param offsetX Horizontal offset.
 * @param offsetY Vertical offset.
 */
function calculatePosition(event, tooltipBox, offsetX, offsetY) {
    let x = event.clientX + offsetX;
    if (x + tooltipBox.width > window.innerWidth) {
        x = +event.clientX - offsetX - tooltipBox.width;
    }
    let y = event.clientY + offsetY;
    if (y + tooltipBox.height > window.innerHeight) {
        y = +event.clientY - offsetY - tooltipBox.height;
    }
    return { x, y };
}

/**
 * The tooltip handler class.
 */
class vega_tooltip_module_Handler {
    /**
     * Create the tooltip handler and initialize the element and style.
     *
     * @param options Tooltip Options
     */
    constructor(options) {
        this.options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
        const elementId = this.options.id;
        this.el = null;
        // bind this to call
        this.call = this.tooltipHandler.bind(this);
        // prepend a default stylesheet for tooltips to the head
        if (!this.options.disableDefaultStyle && !document.getElementById(this.options.styleId)) {
            const style = document.createElement('style');
            style.setAttribute('id', this.options.styleId);
            style.innerHTML = createDefaultStyle(elementId);
            const head = document.head;
            if (head.childNodes.length > 0) {
                head.insertBefore(style, head.childNodes[0]);
            }
            else {
                head.appendChild(style);
            }
        }
    }
    /**
     * The tooltip handler function.
     */
    tooltipHandler(handler, event, item, value) {
        // console.log(handler, event, item, value);
        // append a div element that we use as a tooltip unless it already exists
        this.el = document.getElementById(this.options.id);
        if (!this.el) {
            this.el = document.createElement('div');
            this.el.setAttribute('id', this.options.id);
            this.el.classList.add('vg-tooltip');
            document.body.appendChild(this.el);
        }
        const tooltipContainer = document.fullscreenElement != null ? document.fullscreenElement : document.body;
        tooltipContainer.appendChild(this.el);
        // hide tooltip for null, undefined, or empty string values
        if (value == null || value === '') {
            this.el.classList.remove('visible', `${this.options.theme}-theme`);
            return;
        }
        // set the tooltip content
        this.el.innerHTML = vega_tooltip_module_formatValue(value, this.options.sanitize, this.options.maxDepth);
        // make the tooltip visible
        this.el.classList.add('visible', `${this.options.theme}-theme`);
        const { x, y } = calculatePosition(event, this.el.getBoundingClientRect(), this.options.offsetX, this.options.offsetY);
        this.el.setAttribute('style', `top: ${y}px; left: ${x}px`);
    }
}

const vega_tooltip_module_version$1 = vega_tooltip_module_pkg.version;
/**
 * Create a tooltip handler and register it with the provided view.
 *
 * @param view The Vega view.
 * @param opt Tooltip options.
 */
function vega_tooltip_module_index (view, opt) {
    const handler = new vega_tooltip_module_Handler(opt);
    view.tooltip(handler.call).run();
    return handler;
}

/* harmony default export */ var vega_tooltip_module = (vega_tooltip_module_index);


// CONCATENATED MODULE: ./node_modules/vega-embed/build/vega-embed.module.js










/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

function vega_embed_module_awaiter(thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
}

/**
 * Open editor url in a new window, and pass a message.
 */
function vega_embed_module_post (window, url, data) {
    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
    const editor = window.open(url);
    const wait = 10000;
    const step = 250;
    const { origin } = new URL(url);
    // eslint-disable-next-line no-bitwise
    let count = ~~(wait / step);
    function listen(evt) {
        if (evt.source === editor) {
            count = 0;
            window.removeEventListener('message', listen, false);
        }
    }
    window.addEventListener('message', listen, false);
    // send message
    // periodically resend until ack received or timeout
    function send() {
        if (count <= 0) {
            return;
        }
        editor.postMessage(data, origin);
        setTimeout(send, step);
        count -= 1;
    }
    setTimeout(send, step);
}

// generated with build-style.sh
var embedStyle = `.vega-embed {
  position: relative;
  display: inline-block;
  box-sizing: border-box; }
  .vega-embed.has-actions {
    padding-right: 38px; }
  .vega-embed details:not([open]) > :not(summary) {
    display: none !important; }
  .vega-embed summary {
    list-style: none;
    position: absolute;
    top: 0;
    right: 0;
    padding: 6px;
    z-index: 1000;
    background: white;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
    color: #1b1e23;
    border: 1px solid #aaa;
    border-radius: 999px;
    opacity: 0.2;
    transition: opacity 0.4s ease-in;
    outline: none;
    cursor: pointer;
    line-height: 0px; }
    .vega-embed summary::-webkit-details-marker {
      display: none; }
    .vega-embed summary:active {
      box-shadow: #aaa 0px 0px 0px 1px inset; }
    .vega-embed summary svg {
      width: 14px;
      height: 14px; }
  .vega-embed details[open] summary {
    opacity: 0.7; }
  .vega-embed:hover summary,
  .vega-embed:focus summary {
    opacity: 1 !important;
    transition: opacity 0.2s ease; }
  .vega-embed .vega-actions {
    position: absolute;
    z-index: 1001;
    top: 35px;
    right: -9px;
    display: flex;
    flex-direction: column;
    padding-bottom: 8px;
    padding-top: 8px;
    border-radius: 4px;
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);
    border: 1px solid #d9d9d9;
    background: white;
    animation-duration: 0.15s;
    animation-name: scale-in;
    animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);
    text-align: left; }
    .vega-embed .vega-actions a {
      padding: 8px 16px;
      font-family: sans-serif;
      font-size: 14px;
      font-weight: 600;
      white-space: nowrap;
      color: #434a56;
      text-decoration: none; }
      .vega-embed .vega-actions a:hover {
        background-color: #f7f7f9;
        color: black; }
    .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {
      content: "";
      display: inline-block;
      position: absolute; }
    .vega-embed .vega-actions::before {
      left: auto;
      right: 14px;
      top: -16px;
      border: 8px solid #0000;
      border-bottom-color: #d9d9d9; }
    .vega-embed .vega-actions::after {
      left: auto;
      right: 15px;
      top: -14px;
      border: 7px solid #0000;
      border-bottom-color: #fff; }
  .vega-embed .chart-wrapper {
    width: 100%;
    height: 100%; }

.vega-embed-wrapper {
  max-width: 100%;
  overflow: auto;
  padding-right: 14px; }

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.6); }
  to {
    opacity: 1;
    transform: scale(1); } }
`;

// polyfill for IE
if (!String.prototype.startsWith) {
    // eslint-disable-next-line no-extend-native,func-names
    String.prototype.startsWith = function (search, pos) {
        return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
    };
}
function vega_embed_module_mergeDeep(dest, ...src) {
    for (const s of src) {
        vega_embed_module_deepMerge_(dest, s);
    }
    return dest;
}
function vega_embed_module_deepMerge_(dest, src) {
    for (const property of Object.keys(src)) {
        Object(vega_util_module["lb" /* writeConfig */])(dest, property, src[property], true);
    }
}

var vega_embed_module_a;
const vega = vega_module_namespaceObject;
let vegaLite = build_src_namespaceObject;
// For backwards compatibility with Vega-Lite before v4.
const vega_embed_module_w = (typeof window !== 'undefined' ? window : undefined);
if (vegaLite === undefined && ((vega_embed_module_a = vega_embed_module_w === null || vega_embed_module_w === void 0 ? void 0 : vega_embed_module_w['vl']) === null || vega_embed_module_a === void 0 ? void 0 : vega_embed_module_a.compile)) {
    vegaLite = vega_embed_module_w['vl'];
}
const DEFAULT_ACTIONS = { export: { svg: true, png: true }, source: true, compiled: true, editor: true };
const I18N = {
    CLICK_TO_VIEW_ACTIONS: 'Click to view actions',
    COMPILED_ACTION: 'View Compiled Vega',
    EDITOR_ACTION: 'Open in Vega Editor',
    PNG_ACTION: 'Save as PNG',
    SOURCE_ACTION: 'View Source',
    SVG_ACTION: 'Save as SVG',
};
const NAMES = {
    vega: 'Vega',
    'vega-lite': 'Vega-Lite',
};
const VERSION = {
    vega: vega.version,
    'vega-lite': vegaLite ? vegaLite.version : 'not available',
};
const PREPROCESSOR = {
    vega: (vgSpec) => vgSpec,
    'vega-lite': (vlSpec, config) => vegaLite.compile(vlSpec, { config: config }).spec,
};
const SVG_CIRCLES = `
<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
  <circle r="2" cy="8" cx="2"></circle>
  <circle r="2" cy="8" cx="8"></circle>
  <circle r="2" cy="8" cx="14"></circle>
</svg>`;
const CHART_WRAPPER_CLASS = 'chart-wrapper';
function isTooltipHandler(h) {
    return typeof h === 'function';
}
function viewSource(source, sourceHeader, sourceFooter, mode) {
    const header = `<html><head>${sourceHeader}</head><body><pre><code class="json">`;
    const footer = `</code></pre>${sourceFooter}</body></html>`;
    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
    const win = window.open('');
    win.document.write(header + source + footer);
    win.document.title = `${NAMES[mode]} JSON Source`;
}
/**
 * Try to guess the type of spec.
 *
 * @param spec Vega or Vega-Lite spec.
 */
function guessMode(spec, providedMode) {
    var _a;
    // Decide mode
    if (spec.$schema) {
        const parsed = parser_module(spec.$schema);
        if (providedMode && providedMode !== parsed.library) {
            console.warn(`The given visualization spec is written in ${NAMES[parsed.library]}, but mode argument sets ${(_a = NAMES[providedMode]) !== null && _a !== void 0 ? _a : providedMode}.`);
        }
        const mode = parsed.library;
        if (!Object(semver["satisfies"])(VERSION[mode], `^${parsed.version.slice(1)}`)) {
            console.warn(`The input spec uses ${NAMES[mode]} ${parsed.version}, but the current version of ${NAMES[mode]} is v${VERSION[mode]}.`);
        }
        return mode;
    }
    // try to guess from the provided spec
    if ('mark' in spec ||
        'encoding' in spec ||
        'layer' in spec ||
        'hconcat' in spec ||
        'vconcat' in spec ||
        'facet' in spec ||
        'repeat' in spec) {
        return 'vega-lite';
    }
    if ('marks' in spec || 'signals' in spec || 'scales' in spec || 'axes' in spec) {
        return 'vega';
    }
    return providedMode !== null && providedMode !== void 0 ? providedMode : 'vega';
}
function isLoader(o) {
    return !!(o && 'load' in o);
}
function createLoader(opts) {
    return isLoader(opts) ? opts : vega.loader(opts);
}
function embedOptionsFromUsermeta(parsedSpec) {
    var _a;
    return (_a = (parsedSpec.usermeta && parsedSpec.usermeta['embedOptions'])) !== null && _a !== void 0 ? _a : {};
}
/**
 * Embed a Vega visualization component in a web page. This function returns a promise.
 *
 * @param el        DOM element in which to place component (DOM node or CSS selector).
 * @param spec      String : A URL string from which to load the Vega specification.
 *                  Object : The Vega/Vega-Lite specification as a parsed JSON object.
 * @param opts       A JavaScript object containing options for embedding.
 */
function vega_embed_module_embed(el, spec, opts = {}) {
    var _a, _b, _c;
    return vega_embed_module_awaiter(this, void 0, void 0, function* () {
        let parsedSpec;
        let loader;
        if (Object(vega_util_module["J" /* isString */])(spec)) {
            loader = createLoader(opts.loader);
            parsedSpec = JSON.parse(yield loader.load(spec));
        }
        else {
            parsedSpec = spec;
        }
        const usermetaLoader = embedOptionsFromUsermeta(parsedSpec).loader;
        // either create the loader for the first time or create a new loader if the spec has new loader options
        if (!loader || usermetaLoader) {
            loader = createLoader((_a = opts.loader) !== null && _a !== void 0 ? _a : usermetaLoader);
        }
        const usermetaOpts = yield loadOpts(embedOptionsFromUsermeta(parsedSpec), loader);
        const parsedOpts = yield loadOpts(opts, loader);
        const mergedOpts = Object.assign(Object.assign({}, vega_embed_module_mergeDeep(parsedOpts, usermetaOpts)), { config: Object(vega_util_module["P" /* mergeConfig */])((_b = parsedOpts.config) !== null && _b !== void 0 ? _b : {}, (_c = usermetaOpts.config) !== null && _c !== void 0 ? _c : {}) });
        return yield _embed(el, parsedSpec, mergedOpts, loader);
    });
}
function loadOpts(opt, loader) {
    var _a;
    return vega_embed_module_awaiter(this, void 0, void 0, function* () {
        const config = Object(vega_util_module["J" /* isString */])(opt.config) ? JSON.parse(yield loader.load(opt.config)) : (_a = opt.config) !== null && _a !== void 0 ? _a : {};
        const patch = Object(vega_util_module["J" /* isString */])(opt.patch) ? JSON.parse(yield loader.load(opt.patch)) : opt.patch;
        return Object.assign(Object.assign(Object.assign({}, opt), (patch ? { patch } : {})), (config ? { config } : {}));
    });
}
function getRoot(el) {
    var _a;
    const possibleRoot = el.getRootNode ? el.getRootNode() : document;
    if (possibleRoot instanceof ShadowRoot) {
        return { root: possibleRoot, rootContainer: possibleRoot };
    }
    else {
        return { root: document, rootContainer: (_a = document.head) !== null && _a !== void 0 ? _a : document.body };
    }
}
function _embed(el, spec, opts = {}, loader) {
    var _a, _b, _c, _d, _e, _f;
    return vega_embed_module_awaiter(this, void 0, void 0, function* () {
        const config = opts.theme ? Object(vega_util_module["P" /* mergeConfig */])(vega_themes_module_namespaceObject[opts.theme], (_a = opts.config) !== null && _a !== void 0 ? _a : {}) : opts.config;
        const actions = Object(vega_util_module["C" /* isBoolean */])(opts.actions) ? opts.actions : vega_embed_module_mergeDeep({}, DEFAULT_ACTIONS, (_b = opts.actions) !== null && _b !== void 0 ? _b : {});
        const i18n = Object.assign(Object.assign({}, I18N), opts.i18n);
        const renderer = (_c = opts.renderer) !== null && _c !== void 0 ? _c : 'canvas';
        const logLevel = (_d = opts.logLevel) !== null && _d !== void 0 ? _d : vega.Warn;
        const downloadFileName = (_e = opts.downloadFileName) !== null && _e !== void 0 ? _e : 'visualization';
        const element = typeof el === 'string' ? document.querySelector(el) : el;
        if (!element) {
            throw new Error(`${el} does not exist`);
        }
        if (opts.defaultStyle !== false) {
            // Add a default stylesheet to the head of the document.
            const ID = 'vega-embed-style';
            const { root, rootContainer } = getRoot(element);
            if (!root.getElementById(ID)) {
                const style = document.createElement('style');
                style.id = ID;
                style.innerText =
                    opts.defaultStyle === undefined || opts.defaultStyle === true
                        ? (embedStyle ).toString()
                        : opts.defaultStyle;
                rootContainer.appendChild(style);
            }
        }
        const mode = guessMode(spec, opts.mode);
        let vgSpec = PREPROCESSOR[mode](spec, config);
        if (mode === 'vega-lite') {
            if (vgSpec.$schema) {
                const parsed = parser_module(vgSpec.$schema);
                if (!Object(semver["satisfies"])(VERSION.vega, `^${parsed.version.slice(1)}`)) {
                    console.warn(`The compiled spec uses Vega ${parsed.version}, but current version is v${VERSION.vega}.`);
                }
            }
        }
        element.classList.add('vega-embed');
        if (actions) {
            element.classList.add('has-actions');
        }
        element.innerHTML = ''; // clear container
        let container = element;
        if (actions) {
            const chartWrapper = document.createElement('div');
            chartWrapper.classList.add(CHART_WRAPPER_CLASS);
            element.appendChild(chartWrapper);
            container = chartWrapper;
        }
        const patch = opts.patch;
        if (patch) {
            if (patch instanceof Function) {
                vgSpec = patch(vgSpec);
            }
            else {
                vgSpec = applyPatch(vgSpec, patch, true, false).newDocument;
            }
        }
        // Set locale. Note that this is a global setting.
        if (opts.formatLocale) {
            vega.formatLocale(opts.formatLocale);
        }
        if (opts.timeFormatLocale) {
            vega.timeFormatLocale(opts.timeFormatLocale);
        }
        const { ast } = opts;
        // Do not apply the config to Vega when we have already applied it to Vega-Lite.
        // This call may throw an Error if parsing fails.
        const runtime = vega.parse(vgSpec, mode === 'vega-lite' ? {} : config, { ast });
        const view = new (opts.viewClass || vega.View)(runtime, Object.assign({ loader,
            logLevel,
            renderer }, (ast ? { expr: vega.expressionInterpreter } : {})));
        if (opts.tooltip !== false) {
            let handler;
            if (isTooltipHandler(opts.tooltip)) {
                handler = opts.tooltip;
            }
            else {
                // user provided boolean true or tooltip options
                handler = new vega_tooltip_module_Handler(opts.tooltip === true ? {} : opts.tooltip).call;
            }
            view.tooltip(handler);
        }
        let { hover } = opts;
        if (hover === undefined) {
            hover = mode === 'vega';
        }
        if (hover) {
            const { hoverSet, updateSet } = (typeof hover === 'boolean' ? {} : hover);
            view.hover(hoverSet, updateSet);
        }
        if (opts) {
            if (opts.width != null) {
                view.width(opts.width);
            }
            if (opts.height != null) {
                view.height(opts.height);
            }
            if (opts.padding != null) {
                view.padding(opts.padding);
            }
        }
        yield view.initialize(container, opts.bind).runAsync();
        let documentClickHandler;
        if (actions !== false) {
            let wrapper = element;
            if (opts.defaultStyle !== false) {
                const details = document.createElement('details');
                details.title = i18n.CLICK_TO_VIEW_ACTIONS;
                element.append(details);
                wrapper = details;
                const summary = document.createElement('summary');
                summary.innerHTML = SVG_CIRCLES;
                details.append(summary);
                documentClickHandler = (ev) => {
                    if (!details.contains(ev.target)) {
                        details.removeAttribute('open');
                    }
                };
                document.addEventListener('click', documentClickHandler);
            }
            const ctrl = document.createElement('div');
            wrapper.append(ctrl);
            ctrl.classList.add('vega-actions');
            // add 'Export' action
            if (actions === true || actions.export !== false) {
                for (const ext of ['svg', 'png']) {
                    if (actions === true || actions.export === true || actions.export[ext]) {
                        const i18nExportAction = i18n[`${ext.toUpperCase()}_ACTION`];
                        const exportLink = document.createElement('a');
                        exportLink.text = i18nExportAction;
                        exportLink.href = '#';
                        exportLink.target = '_blank';
                        exportLink.download = `${downloadFileName}.${ext}`;
                        // add link on mousedown so that it's correct when the click happens
                        exportLink.addEventListener('mousedown', function (e) {
                            return vega_embed_module_awaiter(this, void 0, void 0, function* () {
                                e.preventDefault();
                                const url = yield view.toImageURL(ext, opts.scaleFactor);
                                this.href = url;
                            });
                        });
                        ctrl.append(exportLink);
                    }
                }
            }
            // add 'View Source' action
            if (actions === true || actions.source !== false) {
                const viewSourceLink = document.createElement('a');
                viewSourceLink.text = i18n.SOURCE_ACTION;
                viewSourceLink.href = '#';
                viewSourceLink.addEventListener('click', function (e) {
                    var _a, _b;
                    viewSource(json_stringify_pretty_compact_default()(spec), (_a = opts.sourceHeader) !== null && _a !== void 0 ? _a : '', (_b = opts.sourceFooter) !== null && _b !== void 0 ? _b : '', mode);
                    e.preventDefault();
                });
                ctrl.append(viewSourceLink);
            }
            // add 'View Compiled' action
            if (mode === 'vega-lite' && (actions === true || actions.compiled !== false)) {
                const compileLink = document.createElement('a');
                compileLink.text = i18n.COMPILED_ACTION;
                compileLink.href = '#';
                compileLink.addEventListener('click', function (e) {
                    var _a, _b;
                    viewSource(json_stringify_pretty_compact_default()(vgSpec), (_a = opts.sourceHeader) !== null && _a !== void 0 ? _a : '', (_b = opts.sourceFooter) !== null && _b !== void 0 ? _b : '', 'vega');
                    e.preventDefault();
                });
                ctrl.append(compileLink);
            }
            // add 'Open in Vega Editor' action
            if (actions === true || actions.editor !== false) {
                const editorUrl = (_f = opts.editorUrl) !== null && _f !== void 0 ? _f : 'https://vega.github.io/editor/';
                const editorLink = document.createElement('a');
                editorLink.text = i18n.EDITOR_ACTION;
                editorLink.href = '#';
                editorLink.addEventListener('click', function (e) {
                    vega_embed_module_post(window, editorUrl, {
                        config: config,
                        mode,
                        renderer,
                        spec: json_stringify_pretty_compact_default()(spec),
                    });
                    e.preventDefault();
                });
                ctrl.append(editorLink);
            }
        }
        function finalize() {
            if (documentClickHandler) {
                document.removeEventListener('click', documentClickHandler);
            }
            view.finalize();
        }
        return { view, spec, vgSpec, finalize };
    });
}

/* harmony default export */ var vega_embed_module = (vega_embed_module_embed);

//# sourceMappingURL=vega-embed.module.js.map

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/eslint-loader??ref--13-0!./src/components/VegaEmbed/script.js?vue&type=script&lang=js&



/* harmony default export */ var scriptvue_type_script_lang_js_ = ({
  name: 'VegaEmbed',
  props: {
    spec: {
      type: Object
    },
    opt: {
      type: Object,
      "default": function _default() {
        return {
          actions: false
        };
      }
    }
  },
  watch: {
    spec: function spec() {
      var _this = this;

      return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
        return regeneratorRuntime.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                _context.next = 2;
                return _this.mountVis();

              case 2:
              case "end":
                return _context.stop();
            }
          }
        }, _callee);
      }))();
    },
    opt: function opt() {
      var _this2 = this;

      return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
        return regeneratorRuntime.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _context2.next = 2;
                return _this2.mountVis();

              case 2:
              case "end":
                return _context2.stop();
            }
          }
        }, _callee2);
      }))();
    }
  },
  methods: {
    mountVis: function mountVis() {
      var _this3 = this;

      return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
        return regeneratorRuntime.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                _this3.unmoutViz();

                if (!_this3.spec) {
                  _context3.next = 5;
                  break;
                }

                _context3.next = 4;
                return vega_embed_module(_this3.$el, _this3.spec, _this3.opt);

              case 4:
                _this3.viz = _context3.sent;

              case 5:
              case "end":
                return _context3.stop();
            }
          }
        }, _callee3);
      }))();
    },
    unmoutViz: function unmoutViz() {
      if (this.viz) {
        this.viz.finalize();
        this.viz = null;
      }
    }
  },
  mounted: function mounted() {
    var _this4 = this;

    return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
      return regeneratorRuntime.wrap(function _callee4$(_context4) {
        while (1) {
          switch (_context4.prev = _context4.next) {
            case 0:
              _context4.next = 2;
              return _this4.mountVis();

            case 2:
            case "end":
              return _context4.stop();
          }
        }
      }, _callee4);
    }))();
  },
  beforeDestroy: function beforeDestroy() {
    this.unmoutViz();
  }
});
// CONCATENATED MODULE: ./src/components/VegaEmbed/script.js?vue&type=script&lang=js&
 /* harmony default export */ var VegaEmbed_scriptvue_type_script_lang_js_ = (scriptvue_type_script_lang_js_); 
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */

// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.

function normalizeComponent (
  scriptExports,
  render,
  staticRenderFns,
  functionalTemplate,
  injectStyles,
  scopeId,
  moduleIdentifier, /* server only */
  shadowMode /* vue-cli only */
) {
  // Vue.extend constructor export interop
  var options = typeof scriptExports === 'function'
    ? scriptExports.options
    : scriptExports

  // render functions
  if (render) {
    options.render = render
    options.staticRenderFns = staticRenderFns
    options._compiled = true
  }

  // functional template
  if (functionalTemplate) {
    options.functional = true
  }

  // scopedId
  if (scopeId) {
    options._scopeId = 'data-v-' + scopeId
  }

  var hook
  if (moduleIdentifier) { // server build
    hook = function (context) {
      // 2.3 injection
      context =
        context || // cached call
        (this.$vnode && this.$vnode.ssrContext) || // stateful
        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__
      }
      // inject component styles
      if (injectStyles) {
        injectStyles.call(this, context)
      }
      // register component module identifier for async chunk inferrence
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier)
      }
    }
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook
  } else if (injectStyles) {
    hook = shadowMode
      ? function () {
        injectStyles.call(
          this,
          (options.functional ? this.parent : this).$root.$options.shadowRoot
        )
      }
      : injectStyles
  }

  if (hook) {
    if (options.functional) {
      // for template-only hot-reload because in that case the render fn doesn't
      // go through the normalizer
      options._injectStyles = hook
      // register for functional component in vue file
      var originalRender = options.render
      options.render = function renderWithStyleInjection (h, context) {
        hook.call(context)
        return originalRender(h, context)
      }
    } else {
      // inject component registration as beforeCreate hook
      var existing = options.beforeCreate
      options.beforeCreate = existing
        ? [].concat(existing, hook)
        : [hook]
    }
  }

  return {
    exports: scriptExports,
    options: options
  }
}

// CONCATENATED MODULE: ./src/components/VegaEmbed/index.vue





/* normalize component */

var VegaEmbed_component = normalizeComponent(
  VegaEmbed_scriptvue_type_script_lang_js_,
  templatevue_type_template_id_48d93c13_render,
  staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* harmony default export */ var VegaEmbed = (VegaEmbed_component.exports);
// CONCATENATED MODULE: ./src/components/index.js

/* harmony default export */ var components = ({
  VegaEmbed: VegaEmbed
});
// CONCATENATED MODULE: ./src/main.js




/* harmony default export */ var src_main = ({
  install: function install(Vue) {
    Object.keys(components).forEach(function (name) {
      Vue.component(name, components[name]);
    });
  }
});
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js


/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src_main);



/***/ }),

/***/ "fb6a":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var isArray = __webpack_require__("e8b5");
var isConstructor = __webpack_require__("68ee");
var isObject = __webpack_require__("861d");
var toAbsoluteIndex = __webpack_require__("23cb");
var lengthOfArrayLike = __webpack_require__("07fa");
var toIndexedObject = __webpack_require__("fc6a");
var createProperty = __webpack_require__("8418");
var wellKnownSymbol = __webpack_require__("b622");
var arrayMethodHasSpeciesSupport = __webpack_require__("1dde");

var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');

var SPECIES = wellKnownSymbol('species');
var nativeSlice = [].slice;
var max = Math.max;

// `Array.prototype.slice` method
// https://tc39.es/ecma262/#sec-array.prototype.slice
// fallback for not array-like ES3 strings and DOM objects
$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  slice: function slice(start, end) {
    var O = toIndexedObject(this);
    var length = lengthOfArrayLike(O);
    var k = toAbsoluteIndex(start, length);
    var fin = toAbsoluteIndex(end === undefined ? length : end, length);
    // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
    var Constructor, result, n;
    if (isArray(O)) {
      Constructor = O.constructor;
      // cross-realm fallback
      if (isConstructor(Constructor) && (Constructor === Array || isArray(Constructor.prototype))) {
        Constructor = undefined;
      } else if (isObject(Constructor)) {
        Constructor = Constructor[SPECIES];
        if (Constructor === null) Constructor = undefined;
      }
      if (Constructor === Array || Constructor === undefined) {
        return nativeSlice.call(O, k, fin);
      }
    }
    result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
    for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
    result.length = n;
    return result;
  }
});


/***/ }),

/***/ "fc17":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Debug; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Error$1; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Info; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return None; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return Warn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return accessor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return accessorFields; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return accessorName; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return array; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return ascending; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return clampRange; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return compare; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return constant; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return debounce; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return error; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return extend; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return extent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return extentIndex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return falsy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return fastmap; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return field; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return flush; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return has; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return id; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return identity; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return inherits; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return inrange; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return isArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return isBoolean; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return isDate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return isFunction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return isIterable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return isNumber; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return isObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return isRegExp; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return isString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return key; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return lerp; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return logger; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return lruCache; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return merge; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return mergeConfig; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return one; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return pad; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return panLinear; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return panLog; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return panPow; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return panSymlog; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return peek; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return quarter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return repeat; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return span; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ab", function() { return splitAccessPath; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bb", function() { return $; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cb", function() { return toBoolean; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "db", function() { return toDate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "eb", function() { return toNumber; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fb", function() { return toSet; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "gb", function() { return toString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hb", function() { return truncate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ib", function() { return truthy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jb", function() { return utcquarter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "kb", function() { return visitArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lb", function() { return writeConfig; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mb", function() { return zero; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nb", function() { return zoomLinear; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ob", function() { return zoomLog; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pb", function() { return zoomPow; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "qb", function() { return zoomSymlog; });
function accessor (fn, fields, name) {
  fn.fields = fields || [];
  fn.fname = name;
  return fn;
}
function accessorName(fn) {
  return fn == null ? null : fn.fname;
}
function accessorFields(fn) {
  return fn == null ? null : fn.fields;
}

function getter (path) {
  return path.length === 1 ? get1(path[0]) : getN(path);
}

const get1 = field => function (obj) {
  return obj[field];
};

const getN = path => {
  const len = path.length;
  return function (obj) {
    for (let i = 0; i < len; ++i) {
      obj = obj[path[i]];
    }

    return obj;
  };
};

function error (message) {
  throw Error(message);
}

function splitAccessPath (p) {
  const path = [],
        n = p.length;
  let q = null,
      b = 0,
      s = '',
      i,
      j,
      c;
  p = p + '';

  function push() {
    path.push(s + p.substring(i, j));
    s = '';
    i = j + 1;
  }

  for (i = j = 0; j < n; ++j) {
    c = p[j];

    if (c === '\\') {
      s += p.substring(i, j);
      s += p.substring(++j, ++j);
      i = j;
    } else if (c === q) {
      push();
      q = null;
      b = -1;
    } else if (q) {
      continue;
    } else if (i === b && c === '"') {
      i = j + 1;
      q = c;
    } else if (i === b && c === "'") {
      i = j + 1;
      q = c;
    } else if (c === '.' && !b) {
      if (j > i) {
        push();
      } else {
        i = j + 1;
      }
    } else if (c === '[') {
      if (j > i) push();
      b = i = j + 1;
    } else if (c === ']') {
      if (!b) error('Access path missing open bracket: ' + p);
      if (b > 0) push();
      b = 0;
      i = j + 1;
    }
  }

  if (b) error('Access path missing closing bracket: ' + p);
  if (q) error('Access path missing closing quote: ' + p);

  if (j > i) {
    j++;
    push();
  }

  return path;
}

function field (field, name, opt) {
  const path = splitAccessPath(field);
  field = path.length === 1 ? path[0] : field;
  return accessor((opt && opt.get || getter)(path), [field], name || field);
}

const id = field('id');
const identity = accessor(_ => _, [], 'identity');
const zero = accessor(() => 0, [], 'zero');
const one = accessor(() => 1, [], 'one');
const truthy = accessor(() => true, [], 'true');
const falsy = accessor(() => false, [], 'false');

function log$1(method, level, input) {
  const args = [level].concat([].slice.call(input));
  console[method].apply(console, args); // eslint-disable-line no-console
}

const None = 0;
const Error$1 = 1;
const Warn = 2;
const Info = 3;
const Debug = 4;
function logger (_, method) {
  let level = _ || None;
  return {
    level(_) {
      if (arguments.length) {
        level = +_;
        return this;
      } else {
        return level;
      }
    },

    error() {
      if (level >= Error$1) log$1(method || 'error', 'ERROR', arguments);
      return this;
    },

    warn() {
      if (level >= Warn) log$1(method || 'warn', 'WARN', arguments);
      return this;
    },

    info() {
      if (level >= Info) log$1(method || 'log', 'INFO', arguments);
      return this;
    },

    debug() {
      if (level >= Debug) log$1(method || 'log', 'DEBUG', arguments);
      return this;
    }

  };
}

var isArray = Array.isArray;

function isObject (_) {
  return _ === Object(_);
}

const isLegalKey = key => key !== '__proto__';

function mergeConfig(...configs) {
  return configs.reduce((out, source) => {
    for (const key in source) {
      if (key === 'signals') {
        // for signals, we merge the signals arrays
        // source signals take precedence over
        // existing signals with the same name
        out.signals = mergeNamed(out.signals, source.signals);
      } else {
        // otherwise, merge objects subject to recursion constraints
        // for legend block, recurse for the layout entry only
        // for style block, recurse for all properties
        // otherwise, no recursion: objects overwrite, no merging
        const r = key === 'legend' ? {
          layout: 1
        } : key === 'style' ? true : null;
        writeConfig(out, key, source[key], r);
      }
    }

    return out;
  }, {});
}
function writeConfig(output, key, value, recurse) {
  if (!isLegalKey(key)) return;
  let k, o;

  if (isObject(value) && !isArray(value)) {
    o = isObject(output[key]) ? output[key] : output[key] = {};

    for (k in value) {
      if (recurse && (recurse === true || recurse[k])) {
        writeConfig(o, k, value[k]);
      } else if (isLegalKey(k)) {
        o[k] = value[k];
      }
    }
  } else {
    output[key] = value;
  }
}

function mergeNamed(a, b) {
  if (a == null) return b;
  const map = {},
        out = [];

  function add(_) {
    if (!map[_.name]) {
      map[_.name] = 1;
      out.push(_);
    }
  }

  b.forEach(add);
  a.forEach(add);
  return out;
}

function peek (array) {
  return array[array.length - 1];
}

function toNumber (_) {
  return _ == null || _ === '' ? null : +_;
}

const exp = sign => x => sign * Math.exp(x);

const log = sign => x => Math.log(sign * x);

const symlog = c => x => Math.sign(x) * Math.log1p(Math.abs(x / c));

const symexp = c => x => Math.sign(x) * Math.expm1(Math.abs(x)) * c;

const pow = exponent => x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);

function pan(domain, delta, lift, ground) {
  const d0 = lift(domain[0]),
        d1 = lift(peek(domain)),
        dd = (d1 - d0) * delta;
  return [ground(d0 - dd), ground(d1 - dd)];
}

function panLinear(domain, delta) {
  return pan(domain, delta, toNumber, identity);
}
function panLog(domain, delta) {
  var sign = Math.sign(domain[0]);
  return pan(domain, delta, log(sign), exp(sign));
}
function panPow(domain, delta, exponent) {
  return pan(domain, delta, pow(exponent), pow(1 / exponent));
}
function panSymlog(domain, delta, constant) {
  return pan(domain, delta, symlog(constant), symexp(constant));
}

function zoom(domain, anchor, scale, lift, ground) {
  const d0 = lift(domain[0]),
        d1 = lift(peek(domain)),
        da = anchor != null ? lift(anchor) : (d0 + d1) / 2;
  return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)];
}

function zoomLinear(domain, anchor, scale) {
  return zoom(domain, anchor, scale, toNumber, identity);
}
function zoomLog(domain, anchor, scale) {
  const sign = Math.sign(domain[0]);
  return zoom(domain, anchor, scale, log(sign), exp(sign));
}
function zoomPow(domain, anchor, scale, exponent) {
  return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent));
}
function zoomSymlog(domain, anchor, scale, constant) {
  return zoom(domain, anchor, scale, symlog(constant), symexp(constant));
}

function quarter(date) {
  return 1 + ~~(new Date(date).getMonth() / 3);
}
function utcquarter(date) {
  return 1 + ~~(new Date(date).getUTCMonth() / 3);
}

function array (_) {
  return _ != null ? isArray(_) ? _ : [_] : [];
}

/**
 * Span-preserving range clamp. If the span of the input range is less
 * than (max - min) and an endpoint exceeds either the min or max value,
 * the range is translated such that the span is preserved and one
 * endpoint touches the boundary of the min/max range.
 * If the span exceeds (max - min), the range [min, max] is returned.
 */
function clampRange (range, min, max) {
  let lo = range[0],
      hi = range[1],
      span;

  if (hi < lo) {
    span = hi;
    hi = lo;
    lo = span;
  }

  span = hi - lo;
  return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span];
}

function isFunction (_) {
  return typeof _ === 'function';
}

const DESCENDING = 'descending';
function compare (fields, orders, opt) {
  opt = opt || {};
  orders = array(orders) || [];
  const ord = [],
        get = [],
        fmap = {},
        gen = opt.comparator || comparator;
  array(fields).forEach((f, i) => {
    if (f == null) return;
    ord.push(orders[i] === DESCENDING ? -1 : 1);
    get.push(f = isFunction(f) ? f : field(f, null, opt));
    (accessorFields(f) || []).forEach(_ => fmap[_] = 1);
  });
  return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap));
}
const ascending = (u, v) => (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0;

const comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length);

const compare1 = (field, order) => function (a, b) {
  return ascending(field(a), field(b)) * order;
};

const compareN = (fields, orders, n) => {
  orders.push(0); // pad zero for convenient lookup

  return function (a, b) {
    let f,
        c = 0,
        i = -1;

    while (c === 0 && ++i < n) {
      f = fields[i];
      c = ascending(f(a), f(b));
    }

    return c * orders[i];
  };
};

function constant (_) {
  return isFunction(_) ? _ : () => _;
}

function debounce (delay, handler) {
  let tid;
  return e => {
    if (tid) clearTimeout(tid);
    tid = setTimeout(() => (handler(e), tid = null), delay);
  };
}

function extend (_) {
  for (let x, k, i = 1, len = arguments.length; i < len; ++i) {
    x = arguments[i];

    for (k in x) {
      _[k] = x[k];
    }
  }

  return _;
}

/**
 * Return an array with minimum and maximum values, in the
 * form [min, max]. Ignores null, undefined, and NaN values.
 */
function extent (array, f) {
  let i = 0,
      n,
      v,
      min,
      max;

  if (array && (n = array.length)) {
    if (f == null) {
      // find first valid value
      for (v = array[i]; i < n && (v == null || v !== v); v = array[++i]);

      min = max = v; // visit all other values

      for (; i < n; ++i) {
        v = array[i]; // skip null/undefined; NaN will fail all comparisons

        if (v != null) {
          if (v < min) min = v;
          if (v > max) max = v;
        }
      }
    } else {
      // find first valid value
      for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i]));

      min = max = v; // visit all other values

      for (; i < n; ++i) {
        v = f(array[i]); // skip null/undefined; NaN will fail all comparisons

        if (v != null) {
          if (v < min) min = v;
          if (v > max) max = v;
        }
      }
    }
  }

  return [min, max];
}

function extentIndex (array, f) {
  const n = array.length;
  let i = -1,
      a,
      b,
      c,
      u,
      v;

  if (f == null) {
    while (++i < n) {
      b = array[i];

      if (b != null && b >= b) {
        a = c = b;
        break;
      }
    }

    if (i === n) return [-1, -1];
    u = v = i;

    while (++i < n) {
      b = array[i];

      if (b != null) {
        if (a > b) {
          a = b;
          u = i;
        }

        if (c < b) {
          c = b;
          v = i;
        }
      }
    }
  } else {
    while (++i < n) {
      b = f(array[i], i, array);

      if (b != null && b >= b) {
        a = c = b;
        break;
      }
    }

    if (i === n) return [-1, -1];
    u = v = i;

    while (++i < n) {
      b = f(array[i], i, array);

      if (b != null) {
        if (a > b) {
          a = b;
          u = i;
        }

        if (c < b) {
          c = b;
          v = i;
        }
      }
    }
  }

  return [u, v];
}

const hop = Object.prototype.hasOwnProperty;
function has (object, property) {
  return hop.call(object, property);
}

const NULL = {};
function fastmap (input) {
  let obj = {},
      test;

  function has$1(key) {
    return has(obj, key) && obj[key] !== NULL;
  }

  const map = {
    size: 0,
    empty: 0,
    object: obj,
    has: has$1,

    get(key) {
      return has$1(key) ? obj[key] : undefined;
    },

    set(key, value) {
      if (!has$1(key)) {
        ++map.size;
        if (obj[key] === NULL) --map.empty;
      }

      obj[key] = value;
      return this;
    },

    delete(key) {
      if (has$1(key)) {
        --map.size;
        ++map.empty;
        obj[key] = NULL;
      }

      return this;
    },

    clear() {
      map.size = map.empty = 0;
      map.object = obj = {};
    },

    test(_) {
      if (arguments.length) {
        test = _;
        return map;
      } else {
        return test;
      }
    },

    clean() {
      const next = {};
      let size = 0;

      for (const key in obj) {
        const value = obj[key];

        if (value !== NULL && (!test || !test(value))) {
          next[key] = value;
          ++size;
        }
      }

      map.size = size;
      map.empty = 0;
      map.object = obj = next;
    }

  };
  if (input) Object.keys(input).forEach(key => {
    map.set(key, input[key]);
  });
  return map;
}

function flush (range, value, threshold, left, right, center) {
  if (!threshold && threshold !== 0) return center;
  const t = +threshold;
  let a = range[0],
      b = peek(range),
      l; // swap endpoints if range is reversed

  if (b < a) {
    l = a;
    a = b;
    b = l;
  } // compare value to endpoints


  l = Math.abs(value - a);
  const r = Math.abs(b - value); // adjust if value is within threshold distance of endpoint

  return l < r && l <= t ? left : r <= t ? right : center;
}

function inherits (child, parent, members) {
  const proto = child.prototype = Object.create(parent.prototype);
  Object.defineProperty(proto, 'constructor', {
    value: child,
    writable: true,
    enumerable: true,
    configurable: true
  });
  return extend(proto, members);
}

/**
 * Predicate that returns true if the value lies within the span
 * of the given range. The left and right flags control the use
 * of inclusive (true) or exclusive (false) comparisons.
 */
function inrange (value, range, left, right) {
  let r0 = range[0],
      r1 = range[range.length - 1],
      t;

  if (r0 > r1) {
    t = r0;
    r0 = r1;
    r1 = t;
  }

  left = left === undefined || left;
  right = right === undefined || right;
  return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1);
}

function isBoolean (_) {
  return typeof _ === 'boolean';
}

function isDate (_) {
  return Object.prototype.toString.call(_) === '[object Date]';
}

function isIterable (_) {
  return _ && isFunction(_[Symbol.iterator]);
}

function isNumber (_) {
  return typeof _ === 'number';
}

function isRegExp (_) {
  return Object.prototype.toString.call(_) === '[object RegExp]';
}

function isString (_) {
  return typeof _ === 'string';
}

function key (fields, flat, opt) {
  if (fields) {
    fields = flat ? array(fields).map(f => f.replace(/\\(.)/g, '$1')) : array(fields);
  }

  const len = fields && fields.length,
        gen = opt && opt.get || getter,
        map = f => gen(flat ? [f] : splitAccessPath(f));

  let fn;

  if (!len) {
    fn = function () {
      return '';
    };
  } else if (len === 1) {
    const get = map(fields[0]);

    fn = function (_) {
      return '' + get(_);
    };
  } else {
    const get = fields.map(map);

    fn = function (_) {
      let s = '' + get[0](_),
          i = 0;

      while (++i < len) s += '|' + get[i](_);

      return s;
    };
  }

  return accessor(fn, fields, 'key');
}

function lerp (array, frac) {
  const lo = array[0],
        hi = peek(array),
        f = +frac;
  return !f ? lo : f === 1 ? hi : lo + f * (hi - lo);
}

const DEFAULT_MAX_SIZE = 10000; // adapted from https://github.com/dominictarr/hashlru/ (MIT License)

function lruCache (maxsize) {
  maxsize = +maxsize || DEFAULT_MAX_SIZE;
  let curr, prev, size;

  const clear = () => {
    curr = {};
    prev = {};
    size = 0;
  };

  const update = (key, value) => {
    if (++size > maxsize) {
      prev = curr;
      curr = {};
      size = 1;
    }

    return curr[key] = value;
  };

  clear();
  return {
    clear,
    has: key => has(curr, key) || has(prev, key),
    get: key => has(curr, key) ? curr[key] : has(prev, key) ? update(key, prev[key]) : undefined,
    set: (key, value) => has(curr, key) ? curr[key] = value : update(key, value)
  };
}

function merge (compare, array0, array1, output) {
  const n0 = array0.length,
        n1 = array1.length;
  if (!n1) return array0;
  if (!n0) return array1;
  const merged = output || new array0.constructor(n0 + n1);
  let i0 = 0,
      i1 = 0,
      i = 0;

  for (; i0 < n0 && i1 < n1; ++i) {
    merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++];
  }

  for (; i0 < n0; ++i0, ++i) {
    merged[i] = array0[i0];
  }

  for (; i1 < n1; ++i1, ++i) {
    merged[i] = array1[i1];
  }

  return merged;
}

function repeat (str, reps) {
  let s = '';

  while (--reps >= 0) s += str;

  return s;
}

function pad (str, length, padchar, align) {
  const c = padchar || ' ',
        s = str + '',
        n = length - s.length;
  return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n);
}

/**
 * Return the numerical span of an array: the difference between
 * the last and first values.
 */

function span (array) {
  return array && peek(array) - array[0] || 0;
}

function $(x) {
  return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings.
  // See http://timelessrepo.com/json-isnt-a-javascript-subset
  JSON.stringify(x).replace('\u2028', '\\u2028').replace('\u2029', '\\u2029') : x;
}

function toBoolean (_) {
  return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;
}

const defaultParser = _ => isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_);

function toDate (_, parser) {
  parser = parser || defaultParser;
  return _ == null || _ === '' ? null : parser(_);
}

function toString (_) {
  return _ == null || _ === '' ? null : _ + '';
}

function toSet (_) {
  const s = {},
        n = _.length;

  for (let i = 0; i < n; ++i) s[_[i]] = true;

  return s;
}

function truncate (str, length, align, ellipsis) {
  const e = ellipsis != null ? ellipsis : '\u2026',
        s = str + '',
        n = s.length,
        l = Math.max(0, length - e.length);
  return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e;
}

function visitArray (array, filter, visitor) {
  if (array) {
    if (filter) {
      const n = array.length;

      for (let i = 0; i < n; ++i) {
        const t = filter(array[i]);
        if (t) visitor(t, i, array);
      }
    } else {
      array.forEach(visitor);
    }
  }
}




/***/ }),

/***/ "fc6a":
/***/ (function(module, exports, __webpack_require__) {

// toObject with fallback for non-array-like ES3 strings
var IndexedObject = __webpack_require__("44ad");
var requireObjectCoercible = __webpack_require__("1d80");

module.exports = function (it) {
  return IndexedObject(requireObjectCoercible(it));
};


/***/ }),

/***/ "fce3":
/***/ (function(module, exports, __webpack_require__) {

var fails = __webpack_require__("d039");
var global = __webpack_require__("da84");

// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
var $RegExp = global.RegExp;

module.exports = fails(function () {
  var re = $RegExp('.', 's');
  return !(re.dotAll && re.exec('\n') && re.flags === 's');
});


/***/ }),

/***/ "fdbc":
/***/ (function(module, exports) {

// iterable DOM collections
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
module.exports = {
  CSSRuleList: 0,
  CSSStyleDeclaration: 0,
  CSSValueList: 0,
  ClientRectList: 0,
  DOMRectList: 0,
  DOMStringList: 0,
  DOMTokenList: 1,
  DataTransferItemList: 0,
  FileList: 0,
  HTMLAllCollection: 0,
  HTMLCollection: 0,
  HTMLFormElement: 0,
  HTMLSelectElement: 0,
  MediaList: 0,
  MimeTypeArray: 0,
  NamedNodeMap: 0,
  NodeList: 1,
  PaintRequestList: 0,
  Plugin: 0,
  PluginArray: 0,
  SVGLengthList: 0,
  SVGNumberList: 0,
  SVGPathSegList: 0,
  SVGPointList: 0,
  SVGStringList: 0,
  SVGTransformList: 0,
  SourceBufferList: 0,
  StyleSheetList: 0,
  TextTrackCueList: 0,
  TextTrackList: 0,
  TouchList: 0
};


/***/ }),

/***/ "fdbf":
/***/ (function(module, exports, __webpack_require__) {

/* eslint-disable es/no-symbol -- required for testing */
var NATIVE_SYMBOL = __webpack_require__("4930");

module.exports = NATIVE_SYMBOL
  && !Symbol.sham
  && typeof Symbol.iterator == 'symbol';


/***/ }),

/***/ "fe45":
/***/ (function(module, exports) {

// Note: this is the semver.org version of the spec that it implements
// Not necessarily the package version of this code.
const SEMVER_SPEC_VERSION = '2.0.0'

const MAX_LENGTH = 256
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
  /* istanbul ignore next */ 9007199254740991

// Max safe segment length for coercion.
const MAX_SAFE_COMPONENT_LENGTH = 16

module.exports = {
  SEMVER_SPEC_VERSION,
  MAX_LENGTH,
  MAX_SAFE_INTEGER,
  MAX_SAFE_COMPONENT_LENGTH
}


/***/ }),

/***/ "fea9":
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__("da84");

module.exports = global.Promise;


/***/ })

/******/ })["default"];
});
//# sourceMappingURL=vue-vega-embed.umd.js.map